1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3602],{11324:function(e){e.exports=function(){"use strict";var e,i,r;function a(a,n){if(e)if(i){var o="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 = {}; ("+e+")(sharedChunk); ("+i+")(sharedChunk); self.onerror = null;",s={};e(s),r=n(s),"u">typeof window&&window&&window.URL&&window.URL.createObjectURL&&(r.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else i=n;else e=n}return a(["exports"],function(e){let i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,z,D,R,L,O,k,F,B,N,V,U,j,G,q,Z,H,$,W,X,Y;function K(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J,Q={},ee={};function et(){if(J)return ee;J=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.setMatrixArrayType=function(e){ee.ARRAY_TYPE=i=e},ee.toRadian=function(e){return e*r},ee.equals=function(i,r){return Math.abs(i-r)<=e*Math.max(1,Math.abs(i),Math.abs(r))},ee.RANDOM=ee.ARRAY_TYPE=ee.EPSILON=void 0;var e=1e-6;ee.EPSILON=1e-6;var i="u">typeof Float32Array?Float32Array:Array;ee.ARRAY_TYPE=i,ee.RANDOM=Math.random;var r=Math.PI/180;return Math.hypot||(Math.hypot=function(){for(var e=0,i=arguments.length;i--;)e+=arguments[i]*arguments[i];return Math.sqrt(e)}),ee}var ei,er,ea,en={},eo={},es={};function el(){if(ea)return es;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}ea=1,Object.defineProperty(es,"__esModule",{value:!0}),es.create=function(){var e=new i.ARRAY_TYPE(9);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e},es.fromMat4=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[4],e[4]=i[5],e[5]=i[6],e[6]=i[8],e[7]=i[9],e[8]=i[10],e},es.clone=function(e){var r=new i.ARRAY_TYPE(9);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r},es.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e},es.fromValues=function(e,r,a,n,o,s,l,h,u){var c=new i.ARRAY_TYPE(9);return c[0]=e,c[1]=r,c[2]=a,c[3]=n,c[4]=o,c[5]=s,c[6]=l,c[7]=h,c[8]=u,c},es.set=function(e,i,r,a,n,o,s,l,h,u){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e[8]=u,e},es.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},es.transpose=function(e,i){if(e===i){var r=i[1],a=i[2],n=i[5];e[1]=i[3],e[2]=i[6],e[3]=r,e[5]=i[7],e[6]=a,e[7]=n}else e[0]=i[0],e[1]=i[3],e[2]=i[6],e[3]=i[1],e[4]=i[4],e[5]=i[7],e[6]=i[2],e[7]=i[5],e[8]=i[8];return e},es.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=c*s-l*u,p=-c*o+l*h,f=u*o-s*h,m=r*d+a*p+n*f;return m?(e[0]=d*(m=1/m),e[1]=(-c*a+n*u)*m,e[2]=(l*a-n*s)*m,e[3]=p*m,e[4]=(c*r-n*h)*m,e[5]=(-l*r+n*o)*m,e[6]=f*m,e[7]=(-u*r+a*h)*m,e[8]=(s*r-a*o)*m,e):null},es.adjoint=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8];return e[0]=s*c-l*u,e[1]=n*u-a*c,e[2]=a*l-n*s,e[3]=l*h-o*c,e[4]=r*c-n*h,e[5]=n*o-r*l,e[6]=o*u-s*h,e[7]=a*h-r*u,e[8]=r*s-a*o,e},es.determinant=function(e){var i=e[3],r=e[4],a=e[5],n=e[6],o=e[7],s=e[8];return e[0]*(s*r-a*o)+e[1]*(-s*i+a*n)+e[2]*(o*i-r*n)},es.multiply=a,es.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=r[0],f=r[1];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=l,e[5]=h,e[6]=p*a+f*s+u,e[7]=p*n+f*l+c,e[8]=p*o+f*h+d,e},es.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=Math.sin(r),f=Math.cos(r);return e[0]=f*a+p*s,e[1]=f*n+p*l,e[2]=f*o+p*h,e[3]=f*s-p*a,e[4]=f*l-p*n,e[5]=f*h-p*o,e[6]=u,e[7]=c,e[8]=d,e},es.scale=function(e,i,r){var a=r[0],n=r[1];return e[0]=a*i[0],e[1]=a*i[1],e[2]=a*i[2],e[3]=n*i[3],e[4]=n*i[4],e[5]=n*i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e},es.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=i[0],e[7]=i[1],e[8]=1,e},es.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=0,e[3]=-r,e[4]=a,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},es.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=i[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},es.fromMat2d=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=0,e[3]=i[2],e[4]=i[3],e[5]=0,e[6]=i[4],e[7]=i[5],e[8]=1,e},es.fromQuat=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r+r,l=a+a,h=n+n,u=r*s,c=a*s,d=a*l,p=n*s,f=n*l,m=n*h,_=o*s,g=o*l,y=o*h;return e[0]=1-d-m,e[3]=c-y,e[6]=p+g,e[1]=c+y,e[4]=1-u-m,e[7]=f-_,e[2]=p-g,e[5]=f+_,e[8]=1-u-d,e},es.normalFromMat4=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*s,v=r*h-n*s,b=r*u-o*s,w=a*h-n*l,T=a*u-o*l,S=n*u-o*h,M=c*_-d*m,E=c*g-p*m,A=c*y-f*m,I=d*g-p*_,C=d*y-f*_,P=p*y-f*g,z=x*P-v*C+b*I+w*A-T*E+S*M;return z?(e[0]=(l*P-h*C+u*I)*(z=1/z),e[1]=(h*A-s*P-u*E)*z,e[2]=(s*C-l*A+u*M)*z,e[3]=(n*C-a*P-o*I)*z,e[4]=(r*P-n*A+o*E)*z,e[5]=(a*A-r*C-o*M)*z,e[6]=(_*S-g*T+y*w)*z,e[7]=(g*b-m*S-y*v)*z,e[8]=(m*T-_*b+y*x)*z,e):null},es.projection=function(e,i,r){return e[0]=2/i,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},es.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},es.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},es.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e[8]=i[8]+r[8],e},es.subtract=n,es.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e},es.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e[6]=i[6]+r[6]*a,e[7]=i[7]+r[7]*a,e[8]=i[8]+r[8]*a,e},es.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]},es.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=e[4],h=e[5],u=e[6],c=e[7],d=e[8],p=r[0],f=r[1],m=r[2],_=r[3],g=r[4],y=r[5],x=r[6],v=r[7],b=r[8];return Math.abs(a-p)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(n-f)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-m)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(s-_)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(l-g)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(h-y)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(y))&&Math.abs(u-x)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(c-v)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(d-b)<=i.EPSILON*Math.max(1,Math.abs(d),Math.abs(b))},es.sub=es.mul=void 0;var i=function(i){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=r(void 0);if(a&&a.has(i))return a.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,a&&a.set(i,n),n}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=r[0],f=r[1],m=r[2],_=r[3],g=r[4],y=r[5],x=r[6],v=r[7],b=r[8];return e[0]=p*a+f*s+m*u,e[1]=p*n+f*l+m*c,e[2]=p*o+f*h+m*d,e[3]=_*a+g*s+y*u,e[4]=_*n+g*l+y*c,e[5]=_*o+g*h+y*d,e[6]=x*a+v*s+b*u,e[7]=x*n+v*l+b*c,e[8]=x*o+v*h+b*d,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e[6]=i[6]-r[6],e[7]=i[7]-r[7],e[8]=i[8]-r[8],e}return es.mul=a,es.sub=n,es}var eh,eu={};function ec(){if(eh)return eu;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}
1eh=1,Object.defineProperty(eu,"__esModule",{value:!0}),eu.create=function(){var e=new i.ARRAY_TYPE(16);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},eu.clone=function(e){var r=new i.ARRAY_TYPE(16);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},eu.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},eu.fromValues=function(e,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){var y=new i.ARRAY_TYPE(16);return y[0]=e,y[1]=r,y[2]=a,y[3]=n,y[4]=o,y[5]=s,y[6]=l,y[7]=h,y[8]=u,y[9]=c,y[10]=d,y[11]=p,y[12]=f,y[13]=m,y[14]=_,y[15]=g,y},eu.set=function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e[8]=u,e[9]=c,e[10]=d,e[11]=p,e[12]=f,e[13]=m,e[14]=_,e[15]=g,e},eu.identity=a,eu.transpose=function(e,i){if(e===i){var r=i[1],a=i[2],n=i[3],o=i[6],s=i[7],l=i[11];e[1]=i[4],e[2]=i[8],e[3]=i[12],e[4]=r,e[6]=i[9],e[7]=i[13],e[8]=a,e[9]=o,e[11]=i[14],e[12]=n,e[13]=s,e[14]=l}else e[0]=i[0],e[1]=i[4],e[2]=i[8],e[3]=i[12],e[4]=i[1],e[5]=i[5],e[6]=i[9],e[7]=i[13],e[8]=i[2],e[9]=i[6],e[10]=i[10],e[11]=i[14],e[12]=i[3],e[13]=i[7],e[14]=i[11],e[15]=i[15];return e},eu.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*s,v=r*h-n*s,b=r*u-o*s,w=a*h-n*l,T=a*u-o*l,S=n*u-o*h,M=c*_-d*m,E=c*g-p*m,A=c*y-f*m,I=d*g-p*_,C=d*y-f*_,P=p*y-f*g,z=x*P-v*C+b*I+w*A-T*E+S*M;return z?(e[0]=(l*P-h*C+u*I)*(z=1/z),e[1]=(n*C-a*P-o*I)*z,e[2]=(_*S-g*T+y*w)*z,e[3]=(p*T-d*S-f*w)*z,e[4]=(h*A-s*P-u*E)*z,e[5]=(r*P-n*A+o*E)*z,e[6]=(g*b-m*S-y*v)*z,e[7]=(c*S-p*b+f*v)*z,e[8]=(s*C-l*A+u*M)*z,e[9]=(a*A-r*C-o*M)*z,e[10]=(m*T-_*b+y*x)*z,e[11]=(d*b-c*T-f*x)*z,e[12]=(l*E-s*I-h*M)*z,e[13]=(r*I-a*E+n*M)*z,e[14]=(_*v-m*w-g*x)*z,e[15]=(c*w-d*v+p*x)*z,e):null},eu.adjoint=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15];return e[0]=l*(p*y-f*g)-d*(h*y-u*g)+_*(h*f-u*p),e[1]=-(a*(p*y-f*g)-d*(n*y-o*g)+_*(n*f-o*p)),e[2]=a*(h*y-u*g)-l*(n*y-o*g)+_*(n*u-o*h),e[3]=-(a*(h*f-u*p)-l*(n*f-o*p)+d*(n*u-o*h)),e[4]=-(s*(p*y-f*g)-c*(h*y-u*g)+m*(h*f-u*p)),e[5]=r*(p*y-f*g)-c*(n*y-o*g)+m*(n*f-o*p),e[6]=-(r*(h*y-u*g)-s*(n*y-o*g)+m*(n*u-o*h)),e[7]=r*(h*f-u*p)-s*(n*f-o*p)+c*(n*u-o*h),e[8]=s*(d*y-f*_)-c*(l*y-u*_)+m*(l*f-u*d),e[9]=-(r*(d*y-f*_)-c*(a*y-o*_)+m*(a*f-o*d)),e[10]=r*(l*y-u*_)-s*(a*y-o*_)+m*(a*u-o*l),e[11]=-(r*(l*f-u*d)-s*(a*f-o*d)+c*(a*u-o*l)),e[12]=-(s*(d*g-p*_)-c*(l*g-h*_)+m*(l*p-h*d)),e[13]=r*(d*g-p*_)-c*(a*g-n*_)+m*(a*p-n*d),e[14]=-(r*(l*g-h*_)-s*(a*g-n*_)+m*(a*h-n*l)),e[15]=r*(l*p-h*d)-s*(a*p-n*d)+c*(a*h-n*l),e},eu.determinant=function(e){var i=e[0],r=e[1],a=e[2],n=e[3],o=e[4],s=e[5],l=e[6],h=e[7],u=e[8],c=e[9],d=e[10],p=e[11],f=e[12],m=e[13],_=e[14],g=e[15];return(i*s-r*o)*(d*g-p*_)-(i*l-a*o)*(c*g-p*m)+(i*h-n*o)*(c*_-d*m)+(r*l-a*s)*(u*g-p*f)-(r*h-n*s)*(u*_-d*f)+(a*h-n*l)*(u*m-c*f)},eu.multiply=n,eu.translate=function(e,i,r){var a,n,o,s,l,h,u,c,d,p,f,m,_=r[0],g=r[1],y=r[2];return i===e?(e[12]=i[0]*_+i[4]*g+i[8]*y+i[12],e[13]=i[1]*_+i[5]*g+i[9]*y+i[13],e[14]=i[2]*_+i[6]*g+i[10]*y+i[14],e[15]=i[3]*_+i[7]*g+i[11]*y+i[15]):(n=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],e[0]=a=i[0],e[1]=n,e[2]=o,e[3]=s,e[4]=l,e[5]=h,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=f,e[11]=m,e[12]=a*_+l*g+d*y+i[12],e[13]=n*_+h*g+p*y+i[13],e[14]=o*_+u*g+f*y+i[14],e[15]=s*_+c*g+m*y+i[15]),e},eu.scale=function(e,i,r){var a=r[0],n=r[1],o=r[2];return e[0]=i[0]*a,e[1]=i[1]*a,e[2]=i[2]*a,e[3]=i[3]*a,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=i[7]*n,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=i[11]*o,e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},eu.rotate=function(e,r,a,n){var o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P=n[0],z=n[1],D=n[2],R=Math.hypot(P,z,D);return R<i.EPSILON?null:(P*=R=1/R,z*=R,D*=R,o=Math.sin(a),s=Math.cos(a),u=r[1],c=r[2],d=r[3],f=r[5],m=r[6],_=r[7],y=r[9],x=r[10],v=r[11],b=P*P*(l=1-s)+s,S=P*z*l-D*o,M=z*z*l+s,E=D*z*l+P*o,A=P*D*l+z*o,I=z*D*l-P*o,C=D*D*l+s,e[0]=(h=r[0])*b+(p=r[4])*(w=z*P*l+D*o)+(g=r[8])*(T=D*P*l-z*o),e[1]=u*b+f*w+y*T,e[2]=c*b+m*w+x*T,e[3]=d*b+_*w+v*T,e[4]=h*S+p*M+g*E,e[5]=u*S+f*M+y*E,e[6]=c*S+m*M+x*E,e[7]=d*S+_*M+v*E,e[8]=h*A+p*I+g*C,e[9]=u*A+f*I+y*C,e[10]=c*A+m*I+x*C,e[11]=d*A+_*I+v*C,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)},eu.rotateX=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[4],s=i[5],l=i[6],h=i[7],u=i[8],c=i[9],d=i[10],p=i[11];return i!==e&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[4]=o*n+u*a,e[5]=s*n+c*a,e[6]=l*n+d*a,e[7]=h*n+p*a,e[8]=u*n-o*a,e[9]=c*n-s*a,e[10]=d*n-l*a,e[11]=p*n-h*a,e},eu.rotateY=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[0],s=i[1],l=i[2],h=i[3],u=i[8],c=i[9],d=i[10],p=i[11];return i!==e&&(e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=o*n-u*a,e[1]=s*n-c*a,e[2]=l*n-d*a,e[3]=h*n-p*a,e[8]=o*a+u*n,e[9]=s*a+c*n,e[10
1]=l*a+d*n,e[11]=h*a+p*n,e},eu.rotateZ=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),o=i[0],s=i[1],l=i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7];return i!==e&&(e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=o*n+u*a,e[1]=s*n+c*a,e[2]=l*n+d*a,e[3]=h*n+p*a,e[4]=u*n-o*a,e[5]=c*n-s*a,e[6]=d*n-l*a,e[7]=p*n-h*a,e},eu.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e},eu.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=i[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.fromRotation=function(e,r,a){var n,o,s,l=a[0],h=a[1],u=a[2],c=Math.hypot(l,h,u);return c<i.EPSILON?null:(l*=c=1/c,h*=c,u*=c,n=Math.sin(r),o=Math.cos(r),e[0]=l*l*(s=1-o)+o,e[1]=h*l*s+u*n,e[2]=u*l*s-h*n,e[3]=0,e[4]=l*h*s-u*n,e[5]=h*h*s+o,e[6]=u*h*s+l*n,e[7]=0,e[8]=l*u*s+h*n,e[9]=h*u*s-l*n,e[10]=u*u*s+o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},eu.fromXRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.fromYRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.fromZRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.fromRotationTranslation=o,eu.fromQuat2=function(e,r){var a=new i.ARRAY_TYPE(3),n=-r[0],s=-r[1],l=-r[2],h=r[3],u=r[4],c=r[5],d=r[6],p=r[7],f=n*n+s*s+l*l+h*h;return f>0?(a[0]=2*(u*h+p*n+c*l-d*s)/f,a[1]=2*(c*h+p*s+d*n-u*l)/f,a[2]=2*(d*h+p*l+u*s-c*n)/f):(a[0]=2*(u*h+p*n+c*l-d*s),a[1]=2*(c*h+p*s+d*n-u*l),a[2]=2*(d*h+p*l+u*s-c*n)),o(e,r,a),e},eu.getTranslation=function(e,i){return e[0]=i[12],e[1]=i[13],e[2]=i[14],e},eu.getScaling=s,eu.getRotation=function(e,r){var a=new i.ARRAY_TYPE(3);s(a,r);var n=1/a[0],o=1/a[1],l=1/a[2],h=r[0]*n,u=r[1]*o,c=r[2]*l,d=r[4]*n,p=r[5]*o,f=r[6]*l,m=r[8]*n,_=r[9]*o,g=r[10]*l,y=h+p+g,x=0;return y>0?(x=2*Math.sqrt(y+1),e[3]=.25*x,e[0]=(f-_)/x,e[1]=(m-c)/x,e[2]=(u-d)/x):h>p&&h>g?(x=2*Math.sqrt(1+h-p-g),e[3]=(f-_)/x,e[0]=.25*x,e[1]=(u+d)/x,e[2]=(m+c)/x):p>g?(x=2*Math.sqrt(1+p-h-g),e[3]=(m-c)/x,e[0]=(u+d)/x,e[1]=.25*x,e[2]=(f+_)/x):(x=2*Math.sqrt(1+g-h-p),e[3]=(u-d)/x,e[0]=(m+c)/x,e[1]=(f+_)/x,e[2]=.25*x),e},eu.fromRotationTranslationScale=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=i[3],h=n+n,u=o+o,c=s+s,d=n*h,p=n*u,f=n*c,m=o*u,_=o*c,g=s*c,y=l*h,x=l*u,v=l*c,b=a[0],w=a[1],T=a[2];return e[0]=(1-(m+g))*b,e[1]=(p+v)*b,e[2]=(f-x)*b,e[3]=0,e[4]=(p-v)*w,e[5]=(1-(d+g))*w,e[6]=(_+y)*w,e[7]=0,e[8]=(f+x)*T,e[9]=(_-y)*T,e[10]=(1-(d+m))*T,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e},eu.fromRotationTranslationScaleOrigin=function(e,i,r,a,n){var o=i[0],s=i[1],l=i[2],h=i[3],u=o+o,c=s+s,d=l+l,p=o*u,f=o*c,m=o*d,_=s*c,g=s*d,y=l*d,x=h*u,v=h*c,b=h*d,w=a[0],T=a[1],S=a[2],M=n[0],E=n[1],A=n[2],I=(1-(_+y))*w,C=(f+b)*w,P=(m-v)*w,z=(f-b)*T,D=(1-(p+y))*T,R=(g+x)*T,L=(m+v)*S,O=(g-x)*S,k=(1-(p+_))*S;return e[0]=I,e[1]=C,e[2]=P,e[3]=0,e[4]=z,e[5]=D,e[6]=R,e[7]=0,e[8]=L,e[9]=O,e[10]=k,e[11]=0,e[12]=r[0]+M-(I*M+z*E+L*A),e[13]=r[1]+E-(C*M+D*E+O*A),e[14]=r[2]+A-(P*M+R*E+k*A),e[15]=1,e},eu.fromQuat=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r+r,l=a+a,h=n+n,u=r*s,c=a*s,d=a*l,p=n*s,f=n*l,m=n*h,_=o*s,g=o*l,y=o*h;return e[0]=1-d-m,e[1]=c+y,e[2]=p-g,e[3]=0,e[4]=c-y,e[5]=1-u-m,e[6]=f+_,e[7]=0,e[8]=p+g,e[9]=f-_,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},eu.frustum=function(e,i,r,a,n,o,s){var l=1/(r-i),h=1/(n-a),u=1/(o-s);return e[0]=2*o*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*h,e[6]=0,e[7]=0,e[8]=(r+i)*l,e[9]=(n+a)*h,e[10]=(s+o)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*u,e[15]=0,e},eu.perspectiveNO=l,eu.perspectiveZO=function(e,i,r,a,n){var o,s=1/Math.tan(i/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=n*(o=1/(a-n)),e[14]=n*a*o):(e[10]=-1,e[14]=-a),e},eu.perspectiveFromFieldOfView=function(e,i,r,a){var n=Math.tan(i.upDegrees*Math.PI/180),o=Math.tan(i.downDegrees*Math.PI/180),s=Math.tan(i.leftDegrees*Math.PI/180),l=Math.tan(i.rightDegrees*Math.PI/180),h=2/(s+l),u=2/(n+o);return e[0]=h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(s-l)*h*.5,e[9]=(n-o)*u*.5,e[10]=a/(r-a),e[11]=-1,e[12]=0,e[13]=0,e[14]=a*r/(r-a),e[15]=0,e},eu.orthoNO=h,eu.orthoZO=function(e,i,r,a,n,o,s){var l=1/(i-r),h=1/(a-n),u=1/(o-s);return e[0]=-2*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*h,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
1]=u,e[11]=0,e[12]=(i+r)*l,e[13]=(n+a)*h,e[14]=o*u,e[15]=1,e},eu.lookAt=function(e,r,n,o){var s,l,h,u,c,d,p,f,m,_,g=r[0],y=r[1],x=r[2],v=o[0],b=o[1],w=o[2],T=n[0],S=n[1],M=n[2];return Math.abs(g-T)<i.EPSILON&&Math.abs(y-S)<i.EPSILON&&Math.abs(x-M)<i.EPSILON?a(e):(p=g-T,f=y-S,m=x-M,s=b*(m*=_=1/Math.hypot(p,f,m))-w*(f*=_),(_=Math.hypot(s,l=w*(p*=_)-v*m,h=v*f-b*p))?(s*=_=1/_,l*=_,h*=_):(s=0,l=0,h=0),(_=Math.hypot(u=f*h-m*l,c=m*s-p*h,d=p*l-f*s))?(u*=_=1/_,c*=_,d*=_):(u=0,c=0,d=0),e[0]=s,e[1]=u,e[2]=p,e[3]=0,e[4]=l,e[5]=c,e[6]=f,e[7]=0,e[8]=h,e[9]=d,e[10]=m,e[11]=0,e[12]=-(s*g+l*y+h*x),e[13]=-(u*g+c*y+d*x),e[14]=-(p*g+f*y+m*x),e[15]=1,e)},eu.targetTo=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=a[0],h=a[1],u=a[2],c=n-r[0],d=o-r[1],p=s-r[2],f=c*c+d*d+p*p;f>0&&(c*=f=1/Math.sqrt(f),d*=f,p*=f);var m=h*p-u*d,_=u*c-l*p,g=l*d-h*c;return(f=m*m+_*_+g*g)>0&&(m*=f=1/Math.sqrt(f),_*=f,g*=f),e[0]=m,e[1]=_,e[2]=g,e[3]=0,e[4]=d*g-p*_,e[5]=p*m-c*g,e[6]=c*_-d*m,e[7]=0,e[8]=c,e[9]=d,e[10]=p,e[11]=0,e[12]=n,e[13]=o,e[14]=s,e[15]=1,e},eu.str=function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},eu.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},eu.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e[8]=i[8]+r[8],e[9]=i[9]+r[9],e[10]=i[10]+r[10],e[11]=i[11]+r[11],e[12]=i[12]+r[12],e[13]=i[13]+r[13],e[14]=i[14]+r[14],e[15]=i[15]+r[15],e},eu.subtract=u,eu.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=i[11]*r,e[12]=i[12]*r,e[13]=i[13]*r,e[14]=i[14]*r,e[15]=i[15]*r,e},eu.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e[6]=i[6]+r[6]*a,e[7]=i[7]+r[7]*a,e[8]=i[8]+r[8]*a,e[9]=i[9]+r[9]*a,e[10]=i[10]+r[10]*a,e[11]=i[11]+r[11]*a,e[12]=i[12]+r[12]*a,e[13]=i[13]+r[13]*a,e[14]=i[14]+r[14]*a,e[15]=i[15]+r[15]*a,e},eu.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]&&e[9]===i[9]&&e[10]===i[10]&&e[11]===i[11]&&e[12]===i[12]&&e[13]===i[13]&&e[14]===i[14]&&e[15]===i[15]},eu.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=e[4],h=e[5],u=e[6],c=e[7],d=e[8],p=e[9],f=e[10],m=e[11],_=e[12],g=e[13],y=e[14],x=e[15],v=r[0],b=r[1],w=r[2],T=r[3],S=r[4],M=r[5],E=r[6],A=r[7],I=r[8],C=r[9],P=r[10],z=r[11],D=r[12],R=r[13],L=r[14],O=r[15];return Math.abs(a-v)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-b)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-w)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-T)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-S)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(h-M)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(u-E)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-A)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-I)<=i.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-C)<=i.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(f-P)<=i.EPSILON*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(m-z)<=i.EPSILON*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(_-D)<=i.EPSILON*Math.max(1,Math.abs(_),Math.abs(D))&&Math.abs(g-R)<=i.EPSILON*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(y-L)<=i.EPSILON*Math.max(1,Math.abs(y),Math.abs(L))&&Math.abs(x-O)<=i.EPSILON*Math.max(1,Math.abs(x),Math.abs(O))},eu.sub=eu.mul=eu.ortho=eu.perspective=void 0;var i=function(i){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=r(void 0);if(a&&a.has(i))return a.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,a&&a.set(i,n),n}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
1]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e,i,r){var a=i[0],n=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],g=i[13],y=i[14],x=i[15],v=r[0],b=r[1],w=r[2],T=r[3];return e[0]=v*a+b*l+w*d+T*_,e[1]=v*n+b*h+w*p+T*g,e[2]=v*o+b*u+w*f+T*y,e[3]=v*s+b*c+w*m+T*x,e[4]=(v=r[4])*a+(b=r[5])*l+(w=r[6])*d+(T=r[7])*_,e[5]=v*n+b*h+w*p+T*g,e[6]=v*o+b*u+w*f+T*y,e[7]=v*s+b*c+w*m+T*x,e[8]=(v=r[8])*a+(b=r[9])*l+(w=r[10])*d+(T=r[11])*_,e[9]=v*n+b*h+w*p+T*g,e[10]=v*o+b*u+w*f+T*y,e[11]=v*s+b*c+w*m+T*x,e[12]=(v=r[12])*a+(b=r[13])*l+(w=r[14])*d+(T=r[15])*_,e[13]=v*n+b*h+w*p+T*g,e[14]=v*o+b*u+w*f+T*y,e[15]=v*s+b*c+w*m+T*x,e}function o(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=a+a,h=n+n,u=o+o,c=a*l,d=a*h,p=a*u,f=n*h,m=n*u,_=o*u,g=s*l,y=s*h,x=s*u;return e[0]=1-(f+_),e[1]=d+x,e[2]=p-y,e[3]=0,e[4]=d-x,e[5]=1-(c+_),e[6]=m+g,e[7]=0,e[8]=p+y,e[9]=m-g,e[10]=1-(c+f),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function s(e,i){var r=i[4],a=i[5],n=i[6],o=i[8],s=i[9],l=i[10];return e[0]=Math.hypot(i[0],i[1],i[2]),e[1]=Math.hypot(r,a,n),e[2]=Math.hypot(o,s,l),e}function l(e,i,r,a,n){var o,s=1/Math.tan(i/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+a)*(o=1/(a-n)),e[14]=2*n*a*o):(e[10]=-1,e[14]=-2*a),e}function h(e,i,r,a,n,o,s){var l=1/(i-r),h=1/(a-n),u=1/(o-s);return e[0]=-2*l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*h,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(i+r)*l,e[13]=(n+a)*h,e[14]=(s+o)*u,e[15]=1,e}function u(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e[6]=i[6]-r[6],e[7]=i[7]-r[7],e[8]=i[8]-r[8],e[9]=i[9]-r[9],e[10]=i[10]-r[10],e[11]=i[11]-r[11],e[12]=i[12]-r[12],e[13]=i[13]-r[13],e[14]=i[14]-r[14],e[15]=i[15]-r[15],e}return eu.perspective=l,eu.ortho=h,eu.mul=n,eu.sub=u,eu}var ed,ep={},ef={};function em(){if(ed)return ef;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}ed=1,Object.defineProperty(ef,"__esModule",{value:!0}),ef.create=n,ef.clone=function(e){var i=new r.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i},ef.length=o,ef.fromValues=function(e,i,a){var n=new r.ARRAY_TYPE(3);return n[0]=e,n[1]=i,n[2]=a,n},ef.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},ef.set=function(e,i,r,a){return e[0]=i,e[1]=r,e[2]=a,e},ef.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e},ef.subtract=s,ef.multiply=l,ef.divide=h,ef.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e},ef.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e},ef.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e[2]=Math.min(i[2],r[2]),e},ef.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e[2]=Math.max(i[2],r[2]),e},ef.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e},ef.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e},ef.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e},ef.distance=u,ef.squaredDistance=c,ef.squaredLength=d,ef.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e},ef.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e},ef.normalize=function(e,i){var r=i[0],a=i[1],n=i[2],o=r*r+a*a+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=i[0]*o,e[1]=i[1]*o,e[2]=i[2]*o,e},ef.dot=p,ef.cross=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[0],l=r[1],h=r[2];return e[0]=n*h-o*l,e[1]=o*s-a*h,e[2]=a*l-n*s,e},ef.lerp=function(e,i,r,a){var n=i[0],o=i[1],s=i[2];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e[2]=s+a*(r[2]-s),e},ef.hermite=function(e,i,r,a,n,o){var s=o*o,l=s*(2*o-3)+1,h=s*(o-2)+o,u=s*(o-1),c=s*(3-2*o);return e[0]=i[0]*l+r[0]*h+a[0]*u+n[0]*c,e[1]=i[1]*l+r[1]*h+a[1]*u+n[1]*c,e[2]=i[2]*l+r[2]*h+a[2]*u+n[2]*c,e},ef.bezier=function(e,i,r,a,n,o){var s=1-o,l=s*s,h=o*o,u=l*s,c=3*o*l,d=3*h*s,p=h*o;return e[0]=i[0]*u+r[0]*c+a[0]*d+n[0]*p,e[1]=i[1]*u+r[1]*c+a[1]*d+n[1]*p,e[2]=i[2]*u+r[2]*c+a[2]*d+n[2]*p,e},ef.random=function(e,i){i=i||1;var a=2*r.RANDOM()*Math.PI,n=2*r.RANDOM()-1,o=Math.sqrt(1-n*n)*i;return e[0]=Math.cos(a)*o,e[1]=Math.sin(a)*o,e[2]=n*i,e},ef.transformMat4=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[3]*a+r[7]*n+r[11]*o+r[15];return e[0]=(r[0]*a+r[4]*n+r[8]*o+r[12])/(s=s||1),e[1]=(r[1]*a+r[5]*n+r[9]*o+r[13])/s,e[2]=(r[2]*a+r[6]*n+r[10]*o+r[14])/s,e},ef.transformMat3=function(e,i,r){var a=i[0],n=i[1],o=i[2];return e[0]=a*r[0]+n*r[3]+o*r[6],e[1]=a*r[1]+n*r[4]+o*r[7],e[2]=a*r[2]+n*r[5]+o*r[8],e},ef.transformQuat=function(e,i,r){var a=r[0],n=r[1],o=r[2],s=i[0],l=i[1],h=i[2],u=n*h-o*l,c=o*s-a*h,d=a*l-n*s,p=n*d-o*c,f=o*u-a*d,m=a*c-n*u,_=2*r[3];return c*=_,d*=_,f*=2,m*=2,e[0]=s+(u*=_)+(p*=2),e[1]=l+c+f,e[2]=h+d+m,e},ef.rotateX=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(a)-n[2]*Math.sin(a),o[2]=n[1]*Math.sin(a)+n[2]*
1Math.cos(a),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},ef.rotateY=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[2]*Math.sin(a)+n[0]*Math.cos(a),o[1]=n[1],o[2]=n[2]*Math.cos(a)-n[0]*Math.sin(a),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},ef.rotateZ=function(e,i,r,a){var n=[],o=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],o[0]=n[0]*Math.cos(a)-n[1]*Math.sin(a),o[1]=n[0]*Math.sin(a)+n[1]*Math.cos(a),o[2]=n[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},ef.angle=function(e,i){var r=e[0],a=e[1],n=e[2],o=i[0],s=i[1],l=i[2],h=Math.sqrt(r*r+a*a+n*n)*Math.sqrt(o*o+s*s+l*l);return Math.acos(Math.min(Math.max(h&&p(e,i)/h,-1),1))},ef.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},ef.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},ef.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]},ef.equals=function(e,i){var a=e[0],n=e[1],o=e[2],s=i[0],l=i[1],h=i[2];return Math.abs(a-s)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(s))&&Math.abs(n-l)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-h)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))},ef.forEach=ef.sqrLen=ef.len=ef.sqrDist=ef.dist=ef.div=ef.mul=ef.sub=void 0;var i,r=function(i){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var r=a(void 0);if(r&&r.has(i))return r.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,r&&r.set(i,n),n}(et());function a(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:i})(e)}function n(){var e=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function o(e){return Math.hypot(e[0],e[1],e[2])}function s(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e}function l(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e[2]=i[2]*r[2],e}function h(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e[2]=i[2]/r[2],e}function u(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2])}function c(e,i){var r=i[0]-e[0],a=i[1]-e[1],n=i[2]-e[2];return r*r+a*a+n*n}function d(e){var i=e[0],r=e[1],a=e[2];return i*i+r*r+a*a}function p(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]}return ef.sub=s,ef.mul=l,ef.div=h,ef.dist=u,ef.sqrDist=c,ef.len=o,ef.sqrLen=d,i=n(),ef.forEach=function(e,r,a,n,o,s){var l,h;for(r||(r=3),a||(a=0),h=n?Math.min(n*r+a,e.length):e.length,l=a;l<h;l+=r)i[0]=e[l],i[1]=e[l+1],i[2]=e[l+2],o(i,i,s),e[l]=i[0],e[l+1]=i[1],e[l+2]=i[2];return e},ef}var e_,eg,ey={};function ex(){if(e_)return ey;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}e_=1,Object.defineProperty(ey,"__esModule",{value:!0}),ey.create=n,ey.clone=function(e){var i=new r.ARRAY_TYPE(4);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i},ey.fromValues=function(e,i,a,n){var o=new r.ARRAY_TYPE(4);return o[0]=e,o[1]=i,o[2]=a,o[3]=n,o},ey.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},ey.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},ey.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e},ey.subtract=o,ey.multiply=s,ey.divide=l,ey.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e[3]=Math.ceil(i[3]),e},ey.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e[3]=Math.floor(i[3]),e},ey.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e[2]=Math.min(i[2],r[2]),e[3]=Math.min(i[3],r[3]),e},ey.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e[2]=Math.max(i[2],r[2]),e[3]=Math.max(i[3],r[3]),e},ey.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e[3]=Math.round(i[3]),e},ey.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e},ey.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e},ey.distance=h,ey.squaredDistance=u,ey.length=c,ey.squaredLength=d,ey.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=-i[3],e},ey.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e[3]=1/i[3],e},ey.normalize=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*r+a*a+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=a*s,e[2]=n*s,e[3]=o*s,e},ey.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]+e[3]*i[3]},ey.cross=function(e,i,r,a){var n=r[0]*a[1]-r[1]*a[0],o=r[0]*a[2]-r[2]*a[0],s=r[0]*a[3]-r[3]*a[0],l=r[1]*a[2]-r[2]*a[1],h=r[1]*a[3]-r[3]*a[1],u=r[2]*a[3]-r[3]*a[2],c=i[0],d=i[1],p=i[2],f=i[3];return e[0]=d*u-p*h+f*l,e[1]=-c*u+p*s-f*o,e[2]=c*h-d*s+f*n,e[3]=-c*l+d*o-p*n,e},ey.lerp=function(e,i,r,a){var n=i[0],o=i[1],s=i[2],l=i[3];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e[2]=s+a*(r[2]-s),e[3]=l+a*(r[3]-l),e},ey.random=function(e,i){i=i||1;do l=(a=2*r.RANDOM()-1)*a+(n=2*r.RANDOM()-1)*n;while(l>=1);do h=(o=2*r.RANDOM()-1)*o+(s=2*r.RANDOM()-1)*s;while(h>=1);var a,n,o,s,l,h,u=Math.sqrt((1-l)/h);return e[0]=i*a,e[1]=i*n,e[2]=i*o*u,e[3]=i*s*u,e},ey.transformMat4=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3];return e[0]=r[0]*a+r[4]*n+r[8]*o+r[12]*s,e[1]=r[1]*a+r[5]*n+r[9]*o+r[13]*s,e[2]=r[2]*a+r[6]*n+r[10]*o+r[14]*s,e[3]=r[3]*a+r[7]*n+r[11]*o+r[15]*s,e},ey.transformQuat=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=r[0],l=r[1],h=r[2],u=r[3],c=u*a+l*o-h*n,d=u*n+h*
1a-s*o,p=u*o+s*n-l*a,f=-s*a-l*n-h*o;return e[0]=c*u+-(f*s)+-(d*h)- -(p*l),e[1]=d*u+-(f*l)+-(p*s)- -(c*h),e[2]=p*u+-(f*h)+-(c*l)- -(d*s),e[3]=i[3],e},ey.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},ey.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},ey.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},ey.equals=function(e,i){var a=e[0],n=e[1],o=e[2],s=e[3],l=i[0],h=i[1],u=i[2],c=i[3];return Math.abs(a-l)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-h)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(o-u)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(s-c)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))},ey.forEach=ey.sqrLen=ey.len=ey.sqrDist=ey.dist=ey.div=ey.mul=ey.sub=void 0;var i,r=function(i){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var r=a(void 0);if(r&&r.has(i))return r.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,r&&r.set(i,n),n}(et());function a(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:i})(e)}function n(){var e=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function o(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e}function s(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e[2]=i[2]*r[2],e[3]=i[3]*r[3],e}function l(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e[2]=i[2]/r[2],e[3]=i[3]/r[3],e}function h(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2],i[3]-e[3])}function u(e,i){var r=i[0]-e[0],a=i[1]-e[1],n=i[2]-e[2],o=i[3]-e[3];return r*r+a*a+n*n+o*o}function c(e){return Math.hypot(e[0],e[1],e[2],e[3])}function d(e){var i=e[0],r=e[1],a=e[2],n=e[3];return i*i+r*r+a*a+n*n}return ey.sub=o,ey.mul=s,ey.div=l,ey.dist=h,ey.sqrDist=u,ey.len=c,ey.sqrLen=d,i=n(),ey.forEach=function(e,r,a,n,o,s){var l,h;for(r||(r=4),a||(a=0),h=n?Math.min(n*r+a,e.length):e.length,l=a;l<h;l+=r)i[0]=e[l],i[1]=e[l+1],i[2]=e[l+2],i[3]=e[l+3],o(i,i,s),e[l]=i[0],e[l+1]=i[1],e[l+2]=i[2],e[l+3]=i[3];return e},ey}function ev(){if(eg)return ep;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}eg=1,Object.defineProperty(ep,"__esModule",{value:!0}),ep.create=f,ep.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},ep.setAxisAngle=m,ep.getAxisAngle=function(e,i){var r=2*Math.acos(i[3]),a=Math.sin(r/2);return a>l.EPSILON?(e[0]=i[0]/a,e[1]=i[1]/a,e[2]=i[2]/a):(e[0]=1,e[1]=0,e[2]=0),r},ep.getAngle=function(e,i){var r=w(e,i);return Math.acos(2*r*r-1)},ep.multiply=_,ep.rotateX=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+s*l,e[1]=n*h+o*l,e[2]=o*h-n*l,e[3]=s*h-a*l,e},ep.rotateY=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h-o*l,e[1]=n*h+s*l,e[2]=o*h+a*l,e[3]=s*h-n*l,e},ep.rotateZ=function(e,i,r){r*=.5;var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);return e[0]=a*h+n*l,e[1]=n*h-a*l,e[2]=o*h+s*l,e[3]=s*h-o*l,e},ep.calculateW=function(e,i){var r=i[0],a=i[1],n=i[2];return e[0]=r,e[1]=a,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-a*a-n*n)),e},ep.exp=g,ep.ln=y,ep.pow=function(e,i,r){return y(e,i),b(e,e,r),g(e,e),e},ep.slerp=x,ep.random=function(e){var i=l.RANDOM(),r=l.RANDOM(),a=l.RANDOM(),n=Math.sqrt(1-i),o=Math.sqrt(i);return e[0]=n*Math.sin(2*Math.PI*r),e[1]=n*Math.cos(2*Math.PI*r),e[2]=o*Math.sin(2*Math.PI*a),e[3]=o*Math.cos(2*Math.PI*a),e},ep.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*r+a*a+n*n+o*o,l=s?1/s:0;return e[0]=-r*l,e[1]=-a*l,e[2]=-n*l,e[3]=o*l,e},ep.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e},ep.fromMat3=v,ep.fromEuler=function(e,i,r,a){var n=.5*Math.PI/180;i*=n,r*=n,a*=n;var o=Math.sin(i),s=Math.cos(i),l=Math.sin(r),h=Math.cos(r),u=Math.sin(a),c=Math.cos(a);return e[0]=o*h*c-s*l*u,e[1]=s*l*c+o*h*u,e[2]=s*h*u-o*l*c,e[3]=s*h*c+o*l*u,e},ep.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},ep.setAxes=ep.sqlerp=ep.rotationTo=ep.equals=ep.exactEquals=ep.normalize=ep.sqrLen=ep.squaredLength=ep.len=ep.length=ep.lerp=ep.dot=ep.scale=ep.mul=ep.add=ep.set=ep.copy=ep.fromValues=ep.clone=void 0;var i,r,a,n,o,s,l=p(et()),h=p(el()),u=p(em()),c=p(ex());function d(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:i})(e)}function p(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=d(r);if(a&&a.has(i))return a.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,a&&a.set(i,n),n}function f(){var e=new l.ARRAY_TYPE(4);return l.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function m(e,i,r){var a=Math.sin(r*=.5);return e[0]=a*i[0],e[1]=a*i[1],e[2]=a*i[2],e[3]=Math.cos(r),e}function _(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*c+s*l+n*u-o*h,e[1]=n*c+s*h+o*l-a*u,e[2]=o*c+s*u+a*h-n*l,e[3]=s*c-a*l-n*h-o*u,e}function g(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=Math.sqrt(r*r+a*a+n*n),l=Math.exp(o),h=s>0?l*Math.sin(s)/s:0;return e[0]=r*h,e[1]=a*h,e[2]=n*h,e[3]=l*Math.cos(s),e}function y(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=Math.sqrt(r*r+a*a+n*n),l=s>0?Math.atan2(s,o)/s:0;return e[0]=r*l,e[1]=a*l,e[2]=n*l,e[3]=.5*Math.log(r*r+a*a+n*n+o*o),e}function x(e,i,r,a){var n,o,s,h,u,c=i[0],d=i[1],p=i[2],f=i[3],m=r[0],_=r[1],g=r[2],y=r[3];return(o=c*m+d*_+p*g+f*y)<0&&(o=-o,m=-m,_=-_,g=-g,y=-y),1-o>l.EPSILON?(s=Math.sin(n=Math.acos(o)),h=Math.sin((1-a)*n)/s,u=Math.sin(a*n)/s):(h=1-a,u=a),e[0]=h*c+u*m,e[1]=h*d+u*_,e[2]=h*p+u*g,e[3]=h*f+u*y,e}function v(e,i){var r,a=i[0]+i[4]+i[8];if(a>0)r=Math.sqrt(a+1),e[3]=.5*r,e[0]=(i[5]-i[7])*(r=.5/r),e[1]=(i[6]-i[2])*r,e[2]=(i[1]-i[3])*r;else{var n=0;i[4]>i[0]&&(n=1),i[8]>i[3*n+n]&&(n=2);var o=(n+1)%3,s=(n+2)%3;r=Math.sqrt(i[3*n+n]-i[3*o+o]-i[3*s+s]+1),e[n]=.5*r,e[3]=(i[3*o+s]-i[3*s+o])*(r=.5/r),e[o]=(i[3*o+n]+i[3*n+o])*r,e[s]=(i[3*s+n]+i[3*n+s])*r}return e}ep.clone=c.clone,ep.fromValues=c.fromValues,ep.copy=c.copy,ep.set=c.set,ep.add=c.add,ep.mul=_;var b=c.scale;ep.scale=b;var w=c.dot;ep.dot=w,ep.lerp=c.lerp;var T=c.length;ep.length=T,ep.len=T;var S=c.squaredLength;ep.squaredLength=S,ep.sqrLen=S;var M=c.normalize;return ep.normalize=M,ep.exactEquals=c.exactEquals,ep.equals=c.equals,i=u.create(),r=u.fromValues(1,0,0),a=u.fromValues(0,1,0),ep.rotationTo=function(e,n,o){var s=u.dot(n,o);return s<-.999999?(u.cross(i,r,n),1e-6>u.len(i)&&u.cross(i,a,n),u.normalize(i,i),m(e,i,Math.PI),e):s>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(u.cross(i,n,o),e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=1+s,M(e,e))},n=f(),o=f(),ep.sqlerp=function(e,i,r,a,s,l){return x(n,i,s,l),x(o,r,a,l),x(e,n,o,2*l*(1-l)),e},s=h.create(),ep.setAxes=function(e,i,r,a){return s[0]=r[0],s[3]=r[1],s[6]=r[2],s[1]=a[0],s[4]=a[1],s[7]=a[2],s[2]=-i[0],s[5]=-i[1],s[8]=-i[2],M(e,v(e,s))},ep}var eb,ew,eT,eS,eM,eE,eA,eI={},eC={},eP=function(){if(eT)return Q;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}function i(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,a=new WeakMap;return(i=function(e){return e?a:r})(e)}function r(r,a){if(r&&r.__esModule)return r;if(null===r||"object"!==e(r)&&"function"!=typeof r)return{default:r};var n=i(a);if(n&&n.has(r))return n.get(r);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in r)if("default"!==l&&Object.prototype.hasOwnProperty.call(r,l)){var h=s?Object.getOwnPropertyDescriptor(r,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=r[l]}return o.default=r,n&&n.set(r,o),o}return eT=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.vec4=Q.vec3=Q.vec2=Q.quat2=Q.quat=Q.mat4=Q.mat3=Q.mat2d=Q.mat2=Q.glMatrix=void 0,Q.glMatrix=r(et()),Q.mat2=r(function(){if(ei)return en;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}ei=1,Object.defineProperty(en,"__esModule",{value:!0}),en.create=function(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},en.clone=function(e){var r=new i.ARRAY_TYPE(4);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},en.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},en.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},en.fromValues=function(e,r,a,n){var o=new i.ARRAY_TYPE(4);return o[0]=e,o[1]=r,o[2]=a,o[3]=n,o},en.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},en.transpose=function(e,i){if(e===i){var r=i[1];e[1]=i[2],e[2]=r}else e[0]=i[0],e[1]=i[2],e[2]=i[1],e[3]=i[3];return e},en.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=r*o-n*a;return s?(e[0]=o*(s=1/s),e[1]=-a*s,e[2]=-n*s,e[3]=r*s,e):null},en.adjoint=function(e,i){var r=i[0];return e[0]=i[3],e[1]=-i[1],e[2]=-i[2],e[3]=r,e},en.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},en.multiply=a,en.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=Math.sin(r),h=Math.cos(r);
1return e[0]=a*h+o*l,e[1]=n*h+s*l,e[2]=-(a*l)+o*h,e[3]=-(n*l)+s*h,e},en.scale=function(e,i,r){var a=i[1],n=i[2],o=i[3],s=r[0],l=r[1];return e[0]=i[0]*s,e[1]=a*s,e[2]=n*l,e[3]=o*l,e},en.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=-r,e[3]=a,e},en.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e},en.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},en.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},en.LDU=function(e,i,r,a){return e[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-e[2]*r[1],[e,i,r]},en.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e},en.subtract=n,en.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},en.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=r[0],h=r[1],u=r[2],c=r[3];return Math.abs(a-l)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-h)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(o-u)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(s-c)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))},en.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e},en.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e},en.sub=en.mul=void 0;var i=function(i){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=r(void 0);if(a&&a.has(i))return a.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,a&&a.set(i,n),n}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*l+o*h,e[1]=n*l+s*h,e[2]=a*u+o*c,e[3]=n*u+s*c,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e}return en.mul=a,en.sub=n,en}()),Q.mat2d=r(function(){if(er)return eo;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}er=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.create=function(){var e=new i.ARRAY_TYPE(6);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},eo.clone=function(e){var r=new i.ARRAY_TYPE(6);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r},eo.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e},eo.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},eo.fromValues=function(e,r,a,n,o,s){var l=new i.ARRAY_TYPE(6);return l[0]=e,l[1]=r,l[2]=a,l[3]=n,l[4]=o,l[5]=s,l},eo.set=function(e,i,r,a,n,o,s){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e},eo.invert=function(e,i){var r=i[0],a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=r*o-a*n;return h?(e[0]=o*(h=1/h),e[1]=-a*h,e[2]=-n*h,e[3]=r*h,e[4]=(n*l-o*s)*h,e[5]=(a*s-r*l)*h,e):null},eo.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},eo.multiply=a,eo.rotate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=Math.sin(r),c=Math.cos(r);return e[0]=a*c+o*u,e[1]=n*c+s*u,e[2]=-(a*u)+o*c,e[3]=-(n*u)+s*c,e[4]=l,e[5]=h,e},eo.scale=function(e,i,r){var a=i[1],n=i[2],o=i[3],s=i[4],l=i[5],h=r[0],u=r[1];return e[0]=i[0]*h,e[1]=a*h,e[2]=n*u,e[3]=o*u,e[4]=s,e[5]=l,e},eo.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=r[0],c=r[1];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=a*u+o*c+l,e[5]=n*u+s*c+h,e},eo.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=-r,e[3]=a,e[4]=0,e[5]=0,e},eo.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e[4]=0,e[5]=0,e},eo.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=i[0],e[5]=i[1],e},eo.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},eo.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},eo.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e},eo.subtract=n,eo.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e},eo.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e},eo.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]},eo.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=e[4],h=e[5],u=r[0],c=r[1],d=r[2],p=r[3],f=r[4],m=r[5];return Math.abs(a-u)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(n-c)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(o-d)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(s-p)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(l-f)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(f))&&Math.abs(h-m)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(m))},eo.sub=eo.mul=void 0;var i=function(i){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=r(void 0);if(a&&a.has(i))return a.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,a&&a.set(i,n),n}(et());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=i[4],h=i[5],u=r[0],c=r[1],d=r[2],p=r[3],f=r[4],m=r[5];return e[0]=a*u+o*c,e[1]=n*u+s*c,e[2]=a*d+o*p,e[3]=n*d+s*p,e[4]=a*f+o*m+l,e[5]=n*f+s*m+h,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e}return eo.mul=a,eo.sub=n,eo}()),Q.mat3=r(el()),Q.mat4=r(ec()),Q.quat=r(ev()),Q.quat2=r(function(){if(eb)return eI;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}eb=1,Object.defineProperty(eI,"__esModule",{value:!0}),eI.create=function(){var e=new i.ARRAY_TYPE(8);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0),e[3]=1,e},eI.clone=function(e){var r=new i.ARRAY_TYPE(8);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r},eI.fromValues=function(e,r,a,n,o,s,l,h){var u=new i.ARRAY_TYPE(8);return u[0]=e,u[1]=r,u[2]=a,u[3]=n,u[4]=o,u[5]=s,u[6]=l,u[7]=h,u},eI.fromRotationTranslationValues=function(e,r,a,n,o,s,l){var h=new i.ARRAY_TYPE(8);h[0]=e,h[1]=r,h[2]=a,h[3]=n;var u=.5*o,c=.5*s,d=.5*l;return h[4]=u*n+c*a-d*r,h[5]=c*n+d*e-u*a,h[6]=d*n+u*r-c*e,h[7]=-u*e-c*r-d*a,h},eI.fromRotationTranslation=s,eI.fromTranslation=function(e,i){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*i[0],e[5]=.5*i[1],e[6]=.5*i[2],e[7]=0,e},eI.fromRotation=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},eI.fromMat4=function(e,n){var o=r.create();a.getRotation(o,n);var l=new i.ARRAY_TYPE(3);return a.getTranslation(l,n),s(e,o,l),e},eI.copy=l,eI.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},eI.set=function(e,i,r,a,n,o,s,l,h){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=o,e[5]=s,e[6]=l,e[7]=h,e},eI.getDual=function(e,i){return e[0]=i[4],e[1]=i[5],e[2]=i[6],e[3]=i[7],e},eI.setDual=function(e,i){return e[4]=i[0],e[5]=i[1],e[6]=i[2],e[7]=i[3],e},eI.getTranslation=function(e,i){var r=i[4],a=i[5],n=i[6],o=i[7],s=-i[0],l=-i[1],h=-i[2],u=i[3];return e[0]=2*(r*u+o*s+a*h-n*l),e[1]=2*(a*u+o*l+n*s-r*h),e[2]=2*(n*u+o*h+r*l-a*s),e},eI.translate=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=.5*r[0],h=.5*r[1],u=.5*r[2],c=i[4],d=i[5],p=i[6],f=i[7];return e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=s*l+n*u-o*h+c,e[5]=s*h+o*l-a*u+d,e[6]=s*u+a*h-n*l+p,e[7]=-a*l-n*h-o*u+f,e},eI.rotateX=function(e,i,a){var n=-i[0],o=-i[1],s=-i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=h*l+d*n+u*s-c*o,f=u*l+d*o+c*n-h*s,m=c*l+d*s+h*o-u*n,_=d*l-h*n-u*o-c*s;
1return r.rotateX(e,i,a),e[4]=p*(l=e[3])+_*(n=e[0])+f*(s=e[2])-m*(o=e[1]),e[5]=f*l+_*o+m*n-p*s,e[6]=m*l+_*s+p*o-f*n,e[7]=_*l-p*n-f*o-m*s,e},eI.rotateY=function(e,i,a){var n=-i[0],o=-i[1],s=-i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=h*l+d*n+u*s-c*o,f=u*l+d*o+c*n-h*s,m=c*l+d*s+h*o-u*n,_=d*l-h*n-u*o-c*s;return r.rotateY(e,i,a),e[4]=p*(l=e[3])+_*(n=e[0])+f*(s=e[2])-m*(o=e[1]),e[5]=f*l+_*o+m*n-p*s,e[6]=m*l+_*s+p*o-f*n,e[7]=_*l-p*n-f*o-m*s,e},eI.rotateZ=function(e,i,a){var n=-i[0],o=-i[1],s=-i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=h*l+d*n+u*s-c*o,f=u*l+d*o+c*n-h*s,m=c*l+d*s+h*o-u*n,_=d*l-h*n-u*o-c*s;return r.rotateZ(e,i,a),e[4]=p*(l=e[3])+_*(n=e[0])+f*(s=e[2])-m*(o=e[1]),e[5]=f*l+_*o+m*n-p*s,e[6]=m*l+_*s+p*o-f*n,e[7]=_*l-p*n-f*o-m*s,e},eI.rotateByQuatAppend=function(e,i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=i[0],h=i[1],u=i[2],c=i[3];return e[0]=l*s+c*a+h*o-u*n,e[1]=h*s+c*n+u*a-l*o,e[2]=u*s+c*o+l*n-h*a,e[3]=c*s-l*a-h*n-u*o,e[4]=(l=i[4])*s+(c=i[7])*a+(h=i[5])*o-(u=i[6])*n,e[5]=h*s+c*n+u*a-l*o,e[6]=u*s+c*o+l*n-h*a,e[7]=c*s-l*a-h*n-u*o,e},eI.rotateByQuatPrepend=function(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[0],h=r[1],u=r[2],c=r[3];return e[0]=a*c+s*l+n*u-o*h,e[1]=n*c+s*h+o*l-a*u,e[2]=o*c+s*u+a*h-n*l,e[3]=s*c-a*l-n*h-o*u,e[4]=a*(c=r[7])+s*(l=r[4])+n*(u=r[6])-o*(h=r[5]),e[5]=n*c+s*h+o*l-a*u,e[6]=o*c+s*u+a*h-n*l,e[7]=s*c-a*l-n*h-o*u,e},eI.rotateAroundAxis=function(e,r,a,n){if(Math.abs(n)<i.EPSILON)return l(e,r);var o=Math.hypot(a[0],a[1],a[2]),s=Math.sin(n*=.5),h=s*a[0]/o,u=s*a[1]/o,c=s*a[2]/o,d=Math.cos(n),p=r[0],f=r[1],m=r[2],_=r[3];e[0]=p*d+_*h+f*c-m*u,e[1]=f*d+_*u+m*h-p*c,e[2]=m*d+_*c+p*u-f*h,e[3]=_*d-p*h-f*u-m*c;var g=r[4],y=r[5],x=r[6],v=r[7];return e[4]=g*d+v*h+y*c-x*u,e[5]=y*d+v*u+x*h-g*c,e[6]=x*d+v*c+g*u-y*h,e[7]=v*d-g*h-y*u-x*c,e},eI.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e},eI.multiply=h,eI.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e},eI.lerp=function(e,i,r,a){var n=1-a;return 0>u(i,r)&&(a=-a),e[0]=i[0]*n+r[0]*a,e[1]=i[1]*n+r[1]*a,e[2]=i[2]*n+r[2]*a,e[3]=i[3]*n+r[3]*a,e[4]=i[4]*n+r[4]*a,e[5]=i[5]*n+r[5]*a,e[6]=i[6]*n+r[6]*a,e[7]=i[7]*n+r[7]*a,e},eI.invert=function(e,i){var r=d(i);return e[0]=-i[0]/r,e[1]=-i[1]/r,e[2]=-i[2]/r,e[3]=i[3]/r,e[4]=-i[4]/r,e[5]=-i[5]/r,e[6]=-i[6]/r,e[7]=i[7]/r,e},eI.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e[4]=-i[4],e[5]=-i[5],e[6]=-i[6],e[7]=i[7],e},eI.normalize=function(e,i){var r=d(i);if(r>0){r=Math.sqrt(r);var a=i[0]/r,n=i[1]/r,o=i[2]/r,s=i[3]/r,l=i[4],h=i[5],u=i[6],c=i[7],p=a*l+n*h+o*u+s*c;e[0]=a,e[1]=n,e[2]=o,e[3]=s,e[4]=(l-a*p)/r,e[5]=(h-n*p)/r,e[6]=(u-o*p)/r,e[7]=(c-s*p)/r}return e},eI.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},eI.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]},eI.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=e[3],l=e[4],h=e[5],u=e[6],c=e[7],d=r[0],p=r[1],f=r[2],m=r[3],_=r[4],g=r[5],y=r[6],x=r[7];return Math.abs(a-d)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(n-p)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(o-f)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-m)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-_)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(h-g)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(g))&&Math.abs(u-y)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-x)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(x))},eI.sqrLen=eI.squaredLength=eI.len=eI.length=eI.dot=eI.mul=eI.setReal=eI.getReal=void 0;var i=o(et()),r=o(ev()),a=o(ec());function n(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:i})(e)}function o(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=n(r);if(a&&a.has(i))return a.get(i);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(o,l,h):o[l]=i[l]}return o.default=i,a&&a.set(i,o),o}function s(e,i,r){var a=.5*r[0],n=.5*r[1],o=.5*r[2],s=i[0],l=i[1],h=i[2],u=i[3];return e[0]=s,e[1]=l,e[2]=h,e[3]=u,e[4]=a*u+n*h-o*l,e[5]=n*u+o*s-a*h,e[6]=o*u+a*l-n*s,e[7]=-a*s-n*l-o*h,e}function l(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e}function h(e,i,r){var a=i[0],n=i[1],o=i[2],s=i[3],l=r[4],h=r[5],u=r[6],c=r[7],d=i[4],p=i[5],f=i[6],m=i[7],_=r[0],g=r[1],y=r[2],x=r[3];return e[0]=a*x+s*_+n*y-o*g,e[1]=n*x+s*g+o*_-a*y,e[2]=o*x+s*y+a*g-n*_,e[3]=s*x-a*_-n*g-o*y,e[4]=a*c+s*l+n*u-o*h+d*x+m*_+p*y-f*g,e[5]=n*c+s*h+o*l-a*u+p*x+m*g+f*_-d*y,e[6]=o*c+s*u+a*h-n*l+f*x+m*y+d*g-p*_,e[7]=s*c-a*l-n*h-o*u+m*x-d*_-p*g-f*y,e}eI.getReal=r.copy,eI.setReal=r.copy,eI.mul=h;var u=r.dot;eI.dot=u;var c=r.length;eI.length=c,eI.len=c;var d=r.squaredLength;return eI.squaredLength=d,eI.sqrLen=d,eI}()),Q.vec2=r(function(){if(ew)return eC;function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}ew=1,Object.defineProperty(eC,"__esModule",{value:!0}),eC.create=n,eC.clone=function(e){var i=new r.ARRAY_TYPE(2);return i[0]=e[0],i[1]=e[1],i},eC.fromValues=function(e,i){var a=new r.ARRAY_TYPE(2);return a[0]=e,a[1]=i,a},eC.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e}
1,eC.set=function(e,i,r){return e[0]=i,e[1]=r,e},eC.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e},eC.subtract=o,eC.multiply=s,eC.divide=l,eC.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e},eC.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e},eC.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e},eC.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e},eC.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e},eC.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e},eC.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e},eC.distance=h,eC.squaredDistance=u,eC.length=c,eC.squaredLength=d,eC.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e},eC.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e},eC.normalize=function(e,i){var r=i[0],a=i[1],n=r*r+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=i[0]*n,e[1]=i[1]*n,e},eC.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]},eC.cross=function(e,i,r){var a=i[0]*r[1]-i[1]*r[0];return e[0]=e[1]=0,e[2]=a,e},eC.lerp=function(e,i,r,a){var n=i[0],o=i[1];return e[0]=n+a*(r[0]-n),e[1]=o+a*(r[1]-o),e},eC.random=function(e,i){i=i||1;var a=2*r.RANDOM()*Math.PI;return e[0]=Math.cos(a)*i,e[1]=Math.sin(a)*i,e},eC.transformMat2=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[2]*n,e[1]=r[1]*a+r[3]*n,e},eC.transformMat2d=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[2]*n+r[4],e[1]=r[1]*a+r[3]*n+r[5],e},eC.transformMat3=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[3]*n+r[6],e[1]=r[1]*a+r[4]*n+r[7],e},eC.transformMat4=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[4]*n+r[12],e[1]=r[1]*a+r[5]*n+r[13],e},eC.rotate=function(e,i,r,a){var n=i[0]-r[0],o=i[1]-r[1],s=Math.sin(a),l=Math.cos(a);return e[0]=n*l-o*s+r[0],e[1]=n*s+o*l+r[1],e},eC.angle=function(e,i){var r=e[0],a=e[1],n=i[0],o=i[1],s=Math.sqrt(r*r+a*a)*Math.sqrt(n*n+o*o);return Math.acos(Math.min(Math.max(s&&(r*n+a*o)/s,-1),1))},eC.zero=function(e){return e[0]=0,e[1]=0,e},eC.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},eC.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]},eC.equals=function(e,i){var a=e[0],n=e[1],o=i[0],s=i[1];return Math.abs(a-o)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(o))&&Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))},eC.forEach=eC.sqrLen=eC.sqrDist=eC.dist=eC.div=eC.mul=eC.sub=eC.len=void 0;var i,r=function(i){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var r=a(void 0);if(r&&r.has(i))return r.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if("default"!==s&&Object.prototype.hasOwnProperty.call(i,s)){var l=o?Object.getOwnPropertyDescriptor(i,s):null;l&&(l.get||l.set)?Object.defineProperty(n,s,l):n[s]=i[s]}return n.default=i,r&&r.set(i,n),n}(et());function a(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:i})(e)}function n(){var e=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function o(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e}function s(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e}function l(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e}function h(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1])}function u(e,i){var r=i[0]-e[0],a=i[1]-e[1];return r*r+a*a}function c(e){return Math.hypot(e[0],e[1])}function d(e){var i=e[0],r=e[1];return i*i+r*r}return eC.len=c,eC.sub=o,eC.mul=s,eC.div=l,eC.dist=h,eC.sqrDist=u,eC.sqrLen=d,i=n(),eC.forEach=function(e,r,a,n,o,s){var l,h;for(r||(r=2),a||(a=0),h=n?Math.min(n*r+a,e.length):e.length,l=a;l<h;l+=r)i[0]=e[l],i[1]=e[l+1],o(i,i,s),e[l]=i[0],e[l+1]=i[1];return e},eC}()),Q.vec3=r(em()),Q.vec4=r(ex()),Q}(),ez=K(function(){if(eM)return eS;function e(e,i,r,a){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=a}return eM=1,eS=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(void 0===i&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,a=0;a<8;a++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<i)return r;var o=this.sampleCurveDerivativeX(r);if(1e-6>Math.abs(o))break;r-=n/o}var s=0,l=1;for(r=e,a=0;a<20&&!(Math.abs((n=this.sampleCurveX(r))-e)<i);a++)e>n?s=r:l=r,r=.5*(l-s)+s;return r}
1,solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},eS}());function eD(){if(eA)return eE;function e(e,i){this.x=e,this.y=i}return eA=1,eE=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,i){return this.clone()._rotateAround(e,i)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var i=e.x-this.x,r=e.y-this.y;return i*i+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,i){return Math.atan2(this.x*i-this.y*e,this.x*e+this.y*i)},_matMult:function(e){var i=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var i=Math.cos(e),r=Math.sin(e),a=r*this.x+i*this.y;return this.x=i*this.x-r*this.y,this.y=a,this},_rotateAround:function(e,i){var r=Math.cos(e),a=Math.sin(e),n=i.y+a*(this.x-i.x)+r*(this.y-i.y);return this.x=i.x+r*(this.x-i.x)-a*(this.y-i.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(i){return i instanceof e?i:Array.isArray(i)?new e(i[0],i[1]):i},eE}var eR=K(eD());function eL(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!eL(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i||Object.keys(e).length!==Object.keys(i).length)return!1;for(let r in e)if(!eL(e[r],i[r]))return!1;return!0}return e===i}let eO=Math.PI/180,ek=180/Math.PI,eF=[[0,0],[1,0],[1,1],[0,1]];function eB(e){if(e<=0)return 0;if(e>=1)return 1;let i=e*e,r=i*e;return 4*(e<.5?r:3*(e-i)+r-.75)}function eN(e,i,r,a){let n=new ez(e,i,r,a);return function(e){return n.solve(e)}}let eV=eN(.25,.1,.25,1);function eU(e,i,r){return Math.min(r,Math.max(i,e))}function ej(e,i,r){return(r=eU((r-e)/(i-e),0,1))*r*(3-2*r)}function eG(e,i,r){let a=r-i,n=((e-i)%a+a)%a+i;return n===i?r:n}function eq(e,i,r){if(!e.length)return r(null,[]);let a=e.length,n=Array(e.length),o=null;e.forEach((e,s)=>{i(e,(e,i)=>{e&&(o=e),n[s]=i,0==--a&&r(o,n)})})}function eZ(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}let eH=1;function e$(){return eH++}function eW(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function eX(e,i){e.forEach(e=>{i[e]&&(i[e]=i[e].bind(i))})}function eY(e,i,r){let a={};for(let r in e)a[r]=i.call(this,e[r],r,e);return a}function eK(e,i,r){let a={};for(let r in e)i.call(this,e[r],r,e)&&(a[r]=e[r]);return a}function eJ(e){return Array.isArray(e)?e.map(eJ):"object"==typeof e&&e?eY(e,eJ):e}let eQ={};function e0(e){eQ[e]||("u">typeof console&&console.warn(e),eQ[e]=!0)}function e1(e,i,r){return(r.y-e.y)*(i.x-e.x)>(i.y-e.y)*(r.x-e.x)}function e2([e,i,r]){let a=(i+90)*eO,n=r*eO;return{x:e*Math.cos(a)*Math.sin(n),y:e*Math.sin(a)*Math.sin(n),z:e*Math.cos(n),azimuthal:i,polar:r}}function e3(){return"u">typeof WorkerGlobalScope&&"u">typeof self&&self instanceof WorkerGlobalScope}function e4(e){let i={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,a,n)=>{let o=a||n;return i[r]=!o||o.toLowerCase(),""}),i["max-age"]){let e=parseInt(i["max-age"],10);isNaN(e)?delete i["max-age"]:i["max-age"]=e}return i}let e5=null;function e6(e,i){return[e[4*i],e[4*i+1],e[4*i+2],e[4*i+3]]}function e8(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<a?i=n+1:r=n}return i}function e9(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<=a?i=n+1:r=n}return i}function e7(e){return e>0?1/(1.001-e):1+e}function te(e){return e>0?1-1/(1.001-e):-e}let tt={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!tt.API_URL)return null;try{let e=new URL(tt.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){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:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MES
1HOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function ti(e){return tt.API_URL_REGEX.test(e)}function tr(e){return tt.API_SPRITE_REGEX.test(e)}function ta(){return null==i&&(i=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),i}let tn={now:()=>void 0!==n?n:performance.now(),setNow(e){n=e},restoreNow(){n=void 0},frame(e){let i=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(i)}},getImageData(e,i=0){let{width:r,height:a}=e;o||(o=document.createElement("canvas"));let n=o.getContext("2d",{willReadFrequently:!0});if(!n)throw Error("failed to create canvas 2d context");return(r>o.width||a>o.height)&&(o.width=r,o.height=a),n.clearRect(-i,-i,r+2*i,a+2*i),n.drawImage(e,0,0,r,a),n.getImageData(-i,-i,r+2*i,a+2*i)},resolveURL:e=>(r||(r=document.createElement("a")),r.href=e,r.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==a&&(a=window.matchMedia("(prefers-reduced-motion: reduce)")),a.matches)},hasCanvasFingerprintNoise(){if(void 0!==s)return s;if(!ta())return s=!1,!1;let e=new OffscreenCanvas(85,1),i=e.getContext("2d",{willReadFrequently:!0}),r=0;for(let a=0;a<e.width;++a)i.fillStyle=`rgba(${r++},${r++},${r++}, 255)`,i.fillRect(a,0,1,1);let a=i.getImageData(0,0,e.width,e.height);r=0;for(let e=0;e<a.data.length;++e)if(e%4!=3&&r++!==a.data[e])return s=!0,!0;return s=!1,!1}};function to(e,i){let r=e.indexOf("?");if(r<0)return`${e}?${new URLSearchParams(i).toString()}`;let a=new URLSearchParams(e.slice(r));for(let e in i)a.set(e,i[e]);return`${e.slice(0,r)}?${a.toString()}`}
1function ts(e,i={persistentParams:[]}){let r=e.indexOf("?");if(r<0)return e;let a=new URLSearchParams,n=new URLSearchParams(e.slice(r));for(let e of i.persistentParams){let i=n.get(e);i&&a.set(e,i)}let o=a.toString();return`${e.slice(0,r)}${o.length>0?`?${o}`:""}`}let tl="mapbox-tiles",th=500,tu=50,tc=["language","worldview","jobid"];function td(){try{return caches}catch(e){}}function tp(){let e=td();e&&null==l&&(l=e.open(tl))}let tf=1/0,tm={supported:!1,testSupport:function(e){!ty&&tg&&(tx?tb(e):t_=e)}},t_,tg,ty=!1,tx=!1,tv="u">typeof self?self:{};function tb(e){let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,tg),e.isContextLost())return;tm.supported=!0}catch(e){}e.deleteTexture(i),ty=!0}tv.document&&((tg=tv.document.createElement("img")).onload=function(){t_&&tb(t_),t_=null,tx=!0},tg.onerror=function(){ty=!0,t_=null},tg.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let tw={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(tw);class tT extends Error{constructor(e,i,r){401===i&&ti(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let tS=e3()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,tM=function(e,i){var r,a;if(!(/^file:/.test(r=e.url)||/^file:/.test(tS())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal")){let r,n,o,s,u,c,d;return r=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:tS(),referrerPolicy:e.referrerPolicy,signal:r.signal}),o=!1,s=!1,u=(a=n.url).indexOf("sku=")>0&&ti(a),"json"===e.type&&n.headers.set("Accept","application/json"),c=(r,a,o)=>
1{if(s)return;if(r&&"SecurityError"!==r.message&&e0(r.toString()),a&&o)return d(a);let l=Date.now();fetch(n).then(r=>{if(r.ok){let e=u?r.clone():null;return d(r,e,l)}return i(new tT(r.statusText,r.status,e.url))}).catch(r=>{"AbortError"!==r.name&&i(Error(`${r.message} ${e.url}`))})},d=(r,a,u)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then(e=>{s||(a&&u&&function(e,i,r){if(tp(),null==l)return;let a=e4(i.headers.get("Cache-Control")||"");if(a["no-store"])return;let n={status:i.status,statusText:i.statusText,headers:new Headers};i.headers.forEach((e,i)=>n.headers.set(i,e)),a["max-age"]&&n.headers.set("Expires",new Date(r+1e3*a["max-age"]).toUTCString());let o=n.headers.get("Expires");if(!o||new Date(o).getTime()-r<42e4)return;let s=ts(e.url,{persistentParams:tc});if(206===i.status){let i=e.headers.get("Range");if(!i)return;n.status=200,s=to(s,{range:i})}var u=e=>{var r;let a=new Response(200!==(r=i.status)&&404!==r&&[101,103,204,205,304].includes(r)?null:e,n);tp(),null!=l&&l.then(e=>e.put(s,a)).catch(e=>e0(e.message))};if(void 0===h)try{new Response(new ReadableStream),h=!0}catch(e){h=!1}h?u(i.body):i.blob().then(u)}(n,a,u),o=!0,i(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))}).catch(e=>{s||i(Error(e.message))})},u?function(e,i){if(tp(),null==l)return i(null);l.then(r=>
1{let a=ts(e.url,{persistentParams:tc}),n=e.headers.get("Range");n&&(a=to(a,{range:n})),r.match(a).then(e=>{let n=function(e){if(!e)return!1;let i=new Date(e.headers.get("Expires")||0),r=e4(e.headers.get("Cache-Control")||"");return i>Date.now()&&!r["no-cache"]}(e);r.delete(a),n&&r.put(a,e.clone()),i(null,e,n)}).catch(i)}).catch(i)}(n,c):c(null,null),{cancel:()=>{s=!0,o||r.abort()}}}if(e3()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,i,void 0,!0)}let n=new XMLHttpRequest;for(let i in n.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(n.responseType="arraybuffer"),e.headers)n.setRequestHeader(i,e.headers[i]);return"json"===e.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let r=n.response;if("json"===e.type)try{r=JSON.parse(n.response)}catch(e){return i(e)}i(null,r,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else i(new tT(n.statusText,n.status,e.url))},n.send(e.body),{cancel:()=>n.abort()}},tE=function(e,i){return tM(eZ(e,{type:"arrayBuffer"}),i)},tA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";u=[],c=0;let tI=function(e,i){if(tm.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),c>=tt.MAX_PARALLEL_IMAGE_REQUESTS){let r={requestParameters:e,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return u.push(r),r}c++;let r=!1,a=()=>{if(!r)for(r=!0,c--;u.length&&c<tt.MAX_PARALLEL_IMAGE_REQUESTS;){let e=u.shift(),{requestParameters:i,callback:r,cancelled:a}=e;a||(e.cancel=tI(i,r).cancel)}},n=tE(e,(e,r,n,o)=>{let s,l;a(),e?i(e):r&&(self.createImageBitmap?createImageBitmap(new Blob([new Uint8Array(r)],{type:"image/png"})).then(e=>{((e,r)=>i(e,r,n,o))(null,e)}).catch(e=>{((e,r)=>i(e,r,n,o))(Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}):((s=new Image).onload=()=>{((e,r)=>i(e,r,n,o))(null,s),URL.revokeObjectURL(s.src),s.onload=null,requestAnimationFrame(()=>{s.src=tA})},s.onerror=()=>((e,r)=>i(e,r,n,o))(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),l=new Blob([new Uint8Array(r)],{type:"image/png"}),s.src=r.byteLength?URL.createObjectURL(l):tA))});return{cancel:()=>{n.cancel(),a()}}};var tC,tP,tz,tD={exports:{}},tR={exports:{}},tL={exports:{}},tO=K(function(){if(tz)return tD.exports;tz=1;var e=(tC||(tC=1,tR.exports=function(e,i){var r,a,n,o,s,l;for(a=e.length-(r=3&e.length),n=i,l=0;l<a;)s=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,n=27492+(65535&(o=5*(65535&(n=(n^=s=(65535&(s=(s=(65535&s)*0xcc9e2d51+(((s>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|s>>>17))*0x1b873593+(((s>>>16)*0x1b873593&65535)<<16)|0)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)|0))+((58964+(o>>>16)&65535)<<16);switch(s=0,r){case 3:s^=(255&e.charCodeAt(l+2))<<16;case 2:s^=(255&e.charCodeAt(l+1))<<8;case 1:n^=s=(65535&(s=(s=(65535&(s^=255&e.charCodeAt(l)))*0xcc9e2d51+(((s>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|s>>>17))*0x1b873593+(((s>>>16)*0x1b873593&65535)<<16)|0}return n^=e.length,n=0x85ebca6b*(65535&(n^=n>>>16))+((0x85ebca6b*(n>>>16)&65535)<<16)|0,n=0xc2b2ae35*(65535&(n^=n>>>13))+((0xc2b2ae35*(n>>>16)&65535)<<16)|0,(n^=n>>>16)>>>0}),tR.exports),i=(tP||(tP=1,tL.exports=function(e,i){for(var r,a=e.length,n=i^a,o=0;a>=4;)r=0x5bd1e995*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((0x5bd1e995*(r>>>16)&65535)<<16),n=0x5bd1e995*(65535&n)+((0x5bd1e995*(n>>>16)&65535)<<16)^(r=0x5bd1e995*(65535&(r^=r>>>24))+((0x5bd1e995*(r>>>16)&65535)<<16)),a-=4,++o;switch(a){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=0x5bd1e995*(65535&(n^=255&e.charCodeAt(o)))+((0x5bd1e995*(n>>>16)&65535)<<16)}return n=0x5bd1e995*(65535&(n^=n>>>13))+((0x5bd1e995*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}
1),tL.exports);return tD.exports=e,tD.exports.murmur3=e,tD.exports.murmur2=i,tD.exports}());class tk{constructor(e,...i){eZ(this,i[0]||{}),this.type=e}}class tF extends tk{constructor(e,i={}){super("error",eZ({error:e},i))}}function tB(e,i,r){r[e]&&-1!==r[e].indexOf(i)||(r[e]=r[e]||[],r[e].push(i))}function tN(e,i,r){if(r&&r[e]){let a=r[e].indexOf(i);-1!==a&&r[e].splice(a,1)}}class tV{on(e,i){return this._listeners=this._listeners||{},tB(e,i,this._listeners),this}off(e,i){return tN(e,i,this._listeners),tN(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},tB(e,i,this._oneTimeListeners),this):new Promise(i=>{this.once(e,i)})}fire(e,i){let r="string"==typeof e?new tk(e,i):e,a=r.type;if(this.listens(a)){for(let e of(r.target=this,this._listeners&&this._listeners[a]?this._listeners[a].slice():[]))e.call(this,r);for(let e of this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[])tN(a,e,this._oneTimeListeners),e.call(this,r);let e=this._eventedParent;e&&(eZ(r,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),e.fire(r))}else r instanceof tF&&console.error(r.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class tU{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new tU(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){let[i,r]=e.split("\x1f");return new tU({name:i,iconsetId:r})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return tU.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var tj,tG={},tq=function(){if(tj)return tG;tj=1;var e={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 i(e){return(e=Math.round(e))<0?0:e>255?255:e}function r(e){return i("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function a(e){var i;return(i="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:i>1?1:i}function n(e,i,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(i-e)*r*6:2*r<1?i:3*r<2?e+(i-e)*(2/3-r)*6:e}try{tG.parseCSSColor=function(o){var s,l=o.replace(/ /g,"").toLowerCase();if(l in e)return e[l].slice();if("#"===l[0])return 4===l.length?(s=parseInt(l.substr(1),16))>=0&&s<=4095?[(3840&s)>>4|(3840&s)>>8,240&s|(240&s)>>4,15&s|(15&s)<<4,1]:null:7===l.length&&(s=parseInt(l.substr(1),16))>=0&&s<=0xffffff?[(0xff0000&s)>>16,(65280&s)>>8,255&s,1]:null;var h=l.indexOf("("),u=l.indexOf(")");if(-1!==h&&u+1===l.length){var c=l.substr(0,h),d=l.substr(h+1,u-(h+1)).split(","),p=1;switch(c){case"rgba":if(4!==d.length)break;p=a(d.pop());case"rgb":return 3!==d.length?null:[r(d[0]),r(d[1]),r(d[2]),p];case"hsla":if(4!==d.length)break;p=a(d.pop());case"hsl":if(3!==d.length)break;var f=(parseFloat(d[0])%360+360)%360/360,m=a(d[1]),_=a(d[2]),g=_<=.5?_*(m+1):_+m-_*m,y=2*_-g;return[i(255*n(y,g,f+1/3)),i(255*n(y,g,f)),i(255*n(y,g,f-1/3)),p]}}return null}}catch(e){}return tG}();class tZ{constructor(e,i,r,a=1){this.r=e,this.g=i,this.b=r,this.a=a}static parse(e){if(!e)return;if(e instanceof tZ)return e;if("string"!=typeof e)return;let i=tq.parseCSSColor(e);return i?new tZ(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toStringPremultipliedAlpha(){let[e,i,r,a]=0===this.a?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(r)},${a})`}toString(){let[e,i,r,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*r)},${a})`}toRenderColor(e){let{r:i,g:r,b:a,a:n}=this;return new tH(e,i,r,a,n)}clone(){return new tZ(this.r,this.g,this.b,this.a)}}class tH{constructor(e,i,r,a,n){if(e){const o=e.image.height,s=o*o;i=0===n?0:i/n*(o-1),r=0===n?0:r/n*(o-1),a=0===n?0:a/n*(o-1);const l=Math.floor(i),h=Math.floor(r),u=Math.floor(a),c=Math.ceil(i),d=Math.ceil(r),p=Math.ceil(a),f=i-l,m=r-h,_=a-u,g=e.image.data,y=4*(l+h*s+u*o),x=4*(l+h*s+p*o),v=4*(l+d*s+u*o),b=4*(l+d*s+p*o),w=4*(c+h*s+u*o),T=4*(c+h*s+p*o),S=4*(c+d*s+u*o),M=4*(c+d*s+p*o);if(y<0||M>=g.length)throw Error("out of range");this.r=t$(t$(t$(g[y],g[x],_),t$(g[v],g[b],_),m),t$(t$(g[w],g[T],_),t$(g[S],g[M],_),m),f)/255*n,this.g=t$(t$(t$(g[y+1],g[x+1],_),t$(g[v+1],g[b+1],_),m),t$(t$(g[w+1],g[T+1],_),t$(g[S+1],g[M+1],_),m),f)/255*n,this.b=t$(t$(t$(g[y+2],g[x+2],_),t$(g[v+2],g[b+2],_),m),t$(t$(g[w+2],g[T+2],_),t$(g[S+2],g[M+2],_),m),f)/255*n,this.a=n}
1else this.r=i,this.g=r,this.b=a,this.a=n}toArray(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[255*e/a,255*i/a,255*r/a,a]}toHslaArray(){if(0===this.a)return[0,0,0,0];let{r:e,g:i,b:r,a:a}=this,n=Math.min(Math.max(e/a,0),1),o=Math.min(Math.max(i/a,0),1),s=Math.min(Math.max(r/a,0),1),l=Math.min(n,o,s),h=Math.max(n,o,s),u=(l+h)/2;if(l===h)return[0,0,100*u,a];let c=h-l,d=0;return h===n?d=(o-s)/c+6*(o<s):h===o?d=(s-n)/c+2:h===s&&(d=(n-o)/c+4),[Math.min(Math.max(d*=60,0),360),Math.min(Math.max(100*(u>.5?c/(2-h-l):c/(h+l)),0),100),Math.min(Math.max(100*u,0),100),a]}toArray01(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[e/a,i/a,r/a,a]}toArray01Scaled(e){let{r:i,g:r,b:a,a:n}=this;return 0===n?[0,0,0]:[i/n*e,r/n*e,a/n*e]}toArray01PremultipliedAlpha(){let{r:e,g:i,b:r,a:a}=this;return[e,i,r,a]}toArray01Linear(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[Math.pow(e/a,2.2),Math.pow(i/a,2.2),Math.pow(r/a,2.2),a]}}function t$(e,i,r){return e*(1-r)+i*r}function tW(e,i,r){return e.map((e,a)=>t$(e,i[a],r))}function tX(e){return e*e*e*e*e}tZ.black=new tZ(0,0,0,1),tZ.white=new tZ(1,1,1,1),tZ.transparent=new tZ(0,0,0,0),tZ.red=new tZ(1,0,0,1),tZ.blue=new tZ(0,0,1,1);var tY=Object.freeze({__proto__:null,array:tW,color:function(e,i,r){return new tZ(t$(e.r,i.r,r),t$(e.g,i.g,r),t$(e.b,i.b,r),t$(e.a,i.a,r))},easeIn:tX,number:t$});function tK(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}class tJ extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class tQ{constructor(e,i=[]){for(const[r,a]of(this.parent=e,this.bindings={},i))this.bindings[r]=a}concat(e){return new tQ(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let t0={kind:"null"},t1={kind:"number"},t2={kind:"string"},t3={kind:"boolean"},t4={kind:"color"},t5={kind:"object"},t6={kind:"value"},t8={kind:"collator"},t9={kind:"formatted"},t7={kind:"resolvedImage"};function ie(e,i){return{kind:"array",itemType:e,N:i}}function it(e){if("array"===e.kind){let i=it(e.itemType);return"number"==typeof e.N?`array<${i}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${i}>`}return e.kind}let ii=[t0,t1,t2,t3,t4,t9,t5,ie(t6),t7];function ir(e,i){if("error"===i.kind)return null;if("array"===e.kind){if("array"===i.kind&&(0===i.N&&"value"===i.itemType.kind||!ir(e.itemType,i.itemType))&&("number"!=typeof e.N||e.N===i.N))return null}else{if(e.kind===i.kind)return null;if("value"===e.kind){for(let e of ii)if(!ir(e,i))return null}}return`Expected ${it(e)} but found ${it(i)} instead.`}function ia(e,i){return i.some(i=>i.kind===e.kind)}function io(e,i){return i.some(i=>"null"===i?null===e:"array"===i?Array.isArray(e):"object"===i?e&&!Array.isArray(e)&&"object"==typeof e:i===typeof e)}class is{constructor(e,i,r){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class il{constructor(e,i,r,a,n){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=r,this.fontStack=a,this.textColor=n}}class ih{constructor(e){this.sections=e}static fromString(e){return new ih([new il(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof ih?e:ih.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){let e=["format"];for(let i of this.sections){if(i.image){let r=i.image.getPrimary().id.toString();e.push(["image",r]);continue}e.push(i.text);let r={};i.fontStack&&(r["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(r["font-scale"]=i.scale),i.textColor&&(r["text-color"]=["rgba"].concat(i.textColor.toRenderColor(null).toArray())),e.push(r)}return e}}class iu{constructor(e,i={}){if(this.id=tU.from(e),this.options=Object.assign({},i),i.transform){const{a:e,b:r,c:a,d:n,e:o,f:s}=i.transform;this.options.transform=new DOMMatrix([e,r,a,n,o,s])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){let{a:e,b:i,c:r,d:a,e:n,f:o}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:i,c:r,d:a,e:n,f:o}})}static parse(e){let i,r,a,n;try{({name:i,iconsetId:r,params:a,transform:n}=JSON.parse(e)||{})}catch(e){return null}if(!i)return null;let{a:o,b:s,c:l,d:h,e:u,f:c}=n||{};return new iu({name:i,iconsetId:r},{params:a,transform:new DOMMatrix([o,s,l,h,u,c])})}scaleSelf(e){return this.options.transform.scaleSelf(e),this}}class ic{constructor(e,i,r,a,n=!1){this.primaryId=tU.from(e),this.primaryOptions=i,r&&(this.secondaryId=tU.from(r)),this.secondaryOptions=a,this.available=n}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new iu(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new iu(this.secondaryId,this.secondaryOptions):null}static from(e){return"string"==typeof e?ic.build({name:e}):e}static build(e,i,r,a){return e&&("object"!=typeof e||"name"in e)?new ic(e,r,i,a):null}}function id(e,i,r,a){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[e,i,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[e,i,r,a]:[e,i,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ip(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof tZ||e instanceof is||e instanceof ih||e instanceof ic)return!0;
1if(Array.isArray(e)){for(let i of e)if(!ip(i))return!1;return!0}if("object"==typeof e){for(let i in e)if(!ip(e[i]))return!1;return!0}return!1}function im(e){if(null===e)return t0;if("string"==typeof e)return t2;if("boolean"==typeof e)return t3;if("number"==typeof e)return t1;if(e instanceof tZ)return t4;if(e instanceof is)return t8;if(e instanceof ih)return t9;if(e instanceof ic)return t7;if(Array.isArray(e)){let i,r=e.length;for(let r of e){let e=im(r);if(i){if(i===e)continue;i=t6;break}i=e}return ie(i||t6,r)}return t5}function i_(e){let i=typeof e;return null===e?"":"string"===i||"number"===i||"boolean"===i?String(e):e instanceof tZ?e.toStringPremultipliedAlpha():e instanceof ih||e instanceof ic?e.toString():JSON.stringify(e)}class ig{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(2!==e.length)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ip(e[1]))return i.error("invalid value");let r=e[1],a=im(r),n=i.expectedType;return"array"===a.kind&&0===a.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(a=n),new ig(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof tZ?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof ih?this.value.serialize():this.value}}class iy{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}let ix={string:t2,number:t1,boolean:t3,object:t5};class iv{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r,a=1,n=e[0];if("array"===n){let n,o;if(e.length>2){let r=e[1];if("string"!=typeof r||!(r in ix)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);n=ix[r],a++}else n=t6;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);o=e[2],a++}r=ie(n,o)}else r=ix[n];let o=[];for(;a<e.length;a++){let r=i.parse(e[a],a,t6);if(!r)return null;o.push(r)}return new iv(r,o)}evaluate(e){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(e);if(!ir(this.type,im(r)))return r;if(i===this.args.length-1)throw new iy(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${it(im(r))} but was expected to be of type ${it(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=this.type,i=[e.kind];if("array"===e.kind){let r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){i.push(r.kind);let a=e.N;("number"==typeof a||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(e=>e.serialize()))}}class ib{constructor(e){this.type=t9,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");let a=[],n=!1;for(let r=1;r<=e.length-1;++r){let o=e[r];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&!(e=i.parseObjectValue(o["font-scale"],r,"font-scale",t1)))return null;let s=null;if(o["text-font"]&&!(s=i.parseObjectValue(o["text-font"],r,"text-font",ie(t2))))return null;let l=null;if(o["text-color"]&&!(l=i.parseObjectValue(o["text-color"],r,"text-color",t4)))return null;let h=a[a.length-1];h.scale=e,h.font=s,h.textColor=l}else{let o=i.parse(e[r],r,t6);if(!o)return null;let s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,a.push({content:o,scale:null,font:null,textColor:null})}}return new ib(a)}evaluate(e){return new ih(this.sections.map(i=>{let r=i.content.evaluate(e);return im(r)===t7?new il("",r,null,null,null):new il(i_(r),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(let i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){let e=["format"];for(let i of this.sections){e.push(i.content.serialize());let r={};i.scale&&(r["font-scale"]=i.scale.serialize()),i.font&&(r["text-font"]=i.font.serialize()),i.textColor&&(r["text-color"]=i.textColor.serialize()),e.push(r)}return e}}class iw{constructor(e,i,r,a){this._imageWarnHistory={},this.type=t7,this.namePrimary=e,this.nameSecondary=i,r&&(this.paramsPrimary=r.params,this.iconsetIdPrimary=r.iconset?r.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let r=1,a=[];for(let n=0;n<2;n++)if(!function(){if(r<e.length){let n=i.parse(e[r],r++,t2);return n?(a.push({image:n,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}()||!function(){if(r<e.length){let n=e[r];if(null===n||"object"!=typeof n||Array.isArray(n))return!0;let o=n.params,s=n.iconset,l=i.concat(r);if(!o&&!s)return r++,!0;if(o){if("object"!=typeof o||o.constructor!==Object)return l.error('Image options "params" should be an object'),!1;let e={},i=l.concat(void 0,"params");
1for(let r in o){if(!r)return i.error("Image parameter name should be non-empty"),!1;let a=i.concat(void 0,r).parse(o[r],void 0,t4,void 0,{typeAnnotation:"coerce"});if(!a)return!1;e[r]=a}a[a.length-1].options.params=e}if(s){if("object"!=typeof s||s.constructor!==Object)return l.error('Image options "iconset" should be an object'),!1;if(!s.id)return l.error('Image options "iconset" should have an "id" property'),!1;a[a.length-1].options.iconset=s}return r++,!0}return!0}())return;return new iw(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){let r={};if(i){for(let a in i)if(i[a])try{r[a]=i[a].evaluate(e)}catch(e){continue}if(0!==Object.keys(r).length)return{params:r}}}evaluate(e){let i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},r=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=ic.build(i,r,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){let i=a.getPrimary().id;if(a.available=e.availableImages.some(e=>tU.isEqual(e,i)),a.available){let i=a.getSecondary()?a.getSecondary().id:null;i&&(a.available=e.availableImages.some(e=>tU.isEqual(e,i)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(let i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(let i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){let r={};if(i&&(r.iconset={id:i}),e)for(let i in r.params={},e)e[i]&&(r.params[i]=e[i].serialize());return Object.keys(r).length>0?r:void 0}serialize(){let e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){let i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){let i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function iT(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}let iS={"to-boolean":t3,"to-color":t4,"to-number":t1,"to-string":t2};class iM{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[0],a=[],n=t0;if("to-array"===r){if(!Array.isArray(e[1]))return null;let r=e[1].length;if(i.expectedType){if("array"!==i.expectedType.kind)return i.error(`Expected ${i.expectedType.kind} but found array.`);n=ie(i.expectedType.itemType,r)}else{if(!(r>0&&ip(e[1][0])))return null;n=ie(im(e[1][0]),r)}for(let o=0;o<r;o++){let r,s=e[1][o];if("array"===iT(s))r=i.parse(s,void 0,n.itemType);else{let e=iT(s);if(e!==n.itemType.kind)return i.error(`Expected ${n.itemType.kind} but found ${e}.`);r=i.registry.literal.parse(["literal",void 0===s?null:s],i)}if(!r)return null;a.push(r)}}else{if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return i.error("Expected one argument.");n=iS[r];for(let r=1;r<e.length;r++){let n=i.parse(e[r],r,t6);if(!n)return null;a.push(n)}}return new iM(n,a)}evaluate(e){if("boolean"===this.type.kind)return!!this.args[0].evaluate(e);if("color"===this.type.kind){let i,r;for(let a of this.args){if(i=a.evaluate(e),r=null,i instanceof tZ)return i;if("string"==typeof i){let r=e.parseColor(i);if(r)return r}else if(Array.isArray(i)&&!(r=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:id(i[0],i[1],i[2],i[3])))return new tZ(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new iy(r||`Could not parse color from value '${"string"==typeof i?i:String(JSON.stringify(i))}'`)}if("number"===this.type.kind){let i=null;for(let r of this.args){if(null===(i=r.evaluate(e)))return 0;let a=Number(i);if(!isNaN(a))return a}throw new iy(`Could not convert ${JSON.stringify(i)} to number.`)}return"formatted"===this.type.kind?ih.fromString(i_(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?ic.build(i_(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(i=>i.evaluate(e)):i_(this.args[0].evaluate(e))}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if("formatted"===this.type.kind)return new ib([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new iw(this.args[0]).serialize();let e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}let iE=["Unknown","Point","LineString","Polygon"];class iA{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?iE[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:r,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=tZ.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class iI{constructor(e,i,r,a,n){this.name=e,this.type=i,this._evaluate=r,this.args=a,this._overloadIndex=n}evaluate(e){if(!this._evaluate){let e=iI.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){let r=e[0],a=iI.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,o=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,s=[],l=null,h=-1;for(let[a,u]of o){if(Array.isArray(a)&&a.length!==e.length-1)continue;s.push(a),h++,l=new r_(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);let o=[],c=!1;for(let i=1;i<e.length;i++){let r=e[i],n=Array.isArray(a)?a[i-1]:a.type,s=l.parse(r,1+o.length,n);if(!s){c=!0;break}o.push(s)}if(!c)if(Array.isArray(a)&&a.length!==o.length)l.error(`Expected ${a.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){let i=Array.isArray(a)?a[e]:a.type,r=o[e];l.concat(e+1).checkSubtype(i,r.type)}if(0===l.errors.length)return new iI(r,n,u,o,h)}}if(1===s.length)i.errors.push(...l.errors);else{let r=(s.length?s:o.map(([e])=>e)).map(iC).join(" | "),a=[];for(let r=1;r<e.length;r++){let n=i.parse(e[r],1+a.length);if(!n)return null;a.push(it(n.type))}i.error(`Expected arguments of type ${r}, but found (${a.join(", ")}) instead.`)}return null}static register(e,i){for(let r in iI.definitions=i,i)e[r]=iI}}function iC(e){return Array.isArray(e)?`(${e.map(it).join(", ")})`:`(${it(e.type)}...)`}class iP{constructor(e,i,r){this.type=t8,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(2!==e.length)return i.error("Expected one argument.");let r=e[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=void 0===r["case-sensitive"]?i.parse(!1,1,t3):i.parseObjectValue(r["case-sensitive"],1,"case-sensitive",t3);if(!a)return null;let n=void 0===r["diacritic-sensitive"]?i.parse(!1,1,t3):i.parseObjectValue(r["diacritic-sensitive"],1,"diacritic-sensitive",t3);if(!n)return null;let o=null;return!r.locale||(o=i.parseObjectValue(r.locale,1,"locale",t2))?new iP(a,n,o):null}evaluate(e){return new is(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){let e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function iz(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function iD(e,i){e[0]=Math.min(e[0],i[0]),e[1]=Math.min(e[1],i[1]),e[2]=Math.max(e[2],i[0]),e[3]=Math.max(e[3],i[1])}function iR(e,i){return!(e[0]<=i[0]||e[2]>=i[2]||e[1]<=i[1]||e[3]>=i[3])}function iL(e,i,r=!1){let a=!1;for(let n=0,o=i.length;n<o;n++){let o=i[n];for(let i=0,n=o.length,s=n-1;i<n;s=i++){let n=o[s],l=o[i];if(function(e,i,r){let a=e[0]-i[0],n=e[1]-i[1],o=e[0]-r[0],s=e[1]-r[1];return a*s-o*n==0&&a*o<=0&&n*s<=0}(e,n,l))return r;n[1]>e[1]!=l[1]>e[1]&&e[0]<(l[0]-n[0])*(e[1]-n[1])/(l[1]-n[1])+n[0]&&(a=!a)}}return a}function iO(e,i,r,a){let n=a[0]-r[0],o=a[1]-r[1],s=(e[0]-r[0])*o-n*(e[1]-r[1]),l=(i[0]-r[0])*o-n*(i[1]-r[1]);return s>0&&l<0||s<0&&l>0}function ik(e,i,r,a){var n,o;return 0!=(n=[a[0]-r[0],a[1]-r[1]])[0]*(o=[i[0]-e[0],i[1]-e[1]])[1]-n[1]*o[0]&&!(!iO(e,i,r,a)||
1!iO(r,a,e,i))}function iF(e,i){for(let r=0;r<e.length;++r)if(!iL(e[r],i))return!1;for(let r=0;r<e.length-1;++r)if(function(e,i,r){for(let a of r)for(let r=0,n=a.length,o=n-1;r<n;o=r++)if(ik(e,i,a[o],a[r]))return!0;return!1}(e[r],e[r+1],i))return!1;return!0}function iB(e,i,r){let a=[];for(let n=0;n<e.length;n++){let o=[];for(let a=0;a<e[n].length;a++){let s=function(e,i){let r=(180+e[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,i.z);return[Math.round(r*n*8192),Math.round(a*n*8192)]}(e[n][a],r);iD(i,s),o.push(s)}a.push(o)}return a}function iN(e,i,r){let a=[];for(let n=0;n<e.length;n++){let o=iB(e[n],i,r);a.push(o)}return a}function iV(e,i,r,a){if(e[0]<r[0]||e[0]>r[2]){let i=.5*a,n=e[0]-r[0]>i?-a:r[0]-e[0]>i?a:0;0===n&&(n=e[0]-r[2]>i?-a:r[2]-e[0]>i?a:0),e[0]+=n}iD(i,e)}function iU(e,i,r,a){let n=8192*Math.pow(2,a.z),o=[8192*a.x,8192*a.y],s=[];if(!e)return s;for(let a of e)for(let e of a){let a=[e.x+o[0],e.y+o[1]];iV(a,i,r,n),s.push(a)}return s}function ij(e,i,r,a){let n=8192*Math.pow(2,a.z),o=[8192*a.x,8192*a.y],s=[];if(!e)return s;for(let r of e){let e=[];for(let a of r){let r=[a.x+o[0],a.y+o[1]];iD(i,r),e.push(r)}s.push(e)}if(i[2]-i[0]<=n/2)for(let e of(i[0]=i[1]=1/0,i[2]=i[3]=-1/0,s))for(let a of e)iV(a,i,r,n);return s}class iG{constructor(e,i){this.type=t3,this.geojson=e,this.geometries=i}static parse(e,i){if(2!==e.length)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ip(e[1])){let i=e[1];if("FeatureCollection"===i.type)for(let e=0;e<i.features.length;++e){let r=i.features[e].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new iG(i,i.features[e].geometry)}else if("Feature"===i.type){let e=i.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new iG(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new iG(i,i)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===i.type){let o=iB(i.coordinates,a,n),s=iU(e.geometry(),r,a,n);if(!iR(r,a))return!1;for(let e of s)if(!iL(e,o))return!1}if("MultiPolygon"===i.type){let o=iN(i.coordinates,a,n),s=iU(e.geometry(),r,a,n);if(!iR(r,a))return!1;for(let e of s)if(!function(e,i){for(let r=0;r<i.length;r++)if(iL(e,i[r]))return!0;return!1}(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===i.type){let o=iB(i.coordinates,a,n),s=ij(e.geometry(),r,a,n);if(!iR(r,a))return!1;for(let e of s)if(!iF(e,o))return!1}if("MultiPolygon"===i.type){let o=iN(i.coordinates,a,n),s=ij(e.geometry(),r,a,n);if(!iR(r,a))return!1;for(let e of s)if(!function(e,i){for(let r=0;r<i.length;r++)if(iF(e,i[r]))return!0;return!1}(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}let iq={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},iZ=1/298.257223563*(2-1/298.257223563),iH=Math.PI/180;class i${static fromTile(e,i,r){let a=Math.PI*(1-2*(e+.5)/Math.pow(2,i));return new i$(Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/iH,r)}static get units(){return iq}constructor(e,i){if(void 0===e)throw Error("No latitude given.");if(i&&!iq[i])throw Error(`Unknown unit ${i}. Use one of: ${Object.keys(iq).join(", ")}`);const r=6378.137*iH*(i?iq[i]:1),a=Math.cos(e*iH),n=1/(1-iZ*(1-a*a)),o=Math.sqrt(n);this.kx=r*o*a,this.ky=r*o*n*(1-iZ)}distance(e,i){let r=iY(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(r*r+a*a)}bearing(e,i){return Math.atan2(iY(i[0]-e[0])*this.kx,(i[1]-e[1])*this.ky)/iH}destination(e,i,r){let a=r*iH;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,r){return[e[0]+i/this.kx,e[1]+r/this.ky]}lineDistance(e){let i=0;for(let r=0;r<e.length-1;r++)i+=this.distance(e[r],e[r+1]);return i}area(e){let i=0;for(let r=0;r<e.length;r++){let a=e[r];for(let e=0,n=a.length,o=n-1;e<n;o=e++)i+=iY(a[e][0]-a[o][0])*(a[e][1]+a[o][1])*(r?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let r=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){let n=e[a],o=e[a+1],s=this.distance(n,o);if((r+=s)>i)return iX(n,o,(i-(r-s))/s)}return e[e.length-1]}pointToSegmentDistance(e,i,r){let[a,n]=i,o=iY(r[0]-a)*this.kx,s=(r[1]-n)*this.ky;if(0!==o||0!==s){let i=(iY(e[0]-a)*this.kx*o+(e[1]-n)*this.ky*s)/(o*o+s*s);i>1?(a=r[0],n=r[1]):i>0&&(a+=o/this.kx*i,n+=s/this.ky*i)}return Math.sqrt((o=iY(e[0]-a)*this.kx)*o+(s=(e[1]-n)*this.ky)*s)}pointOnLine(e,i){let r=1/0,a=e[0][0],n=e[0][1],o=0,s=0;for(let l=0;l<e.length-1;
1l++){let h=e[l][0],u=e[l][1],c=iY(e[l+1][0]-h)*this.kx,d=(e[l+1][1]-u)*this.ky,p=0;0===c&&0===d||((p=(iY(i[0]-h)*this.kx*c+(i[1]-u)*this.ky*d)/(c*c+d*d))>1?(h=e[l+1][0],u=e[l+1][1]):p>0&&(h+=c/this.kx*p,u+=d/this.ky*p));let f=(c=iY(i[0]-h)*this.kx)*c+(d=(i[1]-u)*this.ky)*d;f<r&&(r=f,a=h,n=u,o=l,s=p)}return{point:[a,n],index:o,t:Math.max(0,Math.min(1,s))}}lineSlice(e,i,r){let a=this.pointOnLine(r,e),n=this.pointOnLine(r,i);if(a.index>n.index||a.index===n.index&&a.t>n.t){let e=a;a=n,n=e}let o=[a.point],s=a.index+1,l=n.index;!iW(r[s],o[0])&&s<=l&&o.push(r[s]);for(let e=s+1;e<=l;e++)o.push(r[e]);return iW(r[l],n.point)||o.push(n.point),o}lineSliceAlong(e,i,r){let a=0,n=[];for(let o=0;o<r.length-1;o++){let s=r[o],l=r[o+1],h=this.distance(s,l);if((a+=h)>e&&0===n.length&&n.push(iX(s,l,(e-(a-h))/h)),a>=i)return n.push(iX(s,l,(i-(a-h))/h)),n;a>e&&n.push(l)}return n}bufferPoint(e,i){let r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[0]+a,e[1]+r]}bufferBBox(e,i){let r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[2]+a,e[3]+r]}insideBBox(e,i){return iY(e[0]-i[0])>=0&&0>=iY(e[0]-i[2])&&e[1]>=i[1]&&e[1]<=i[3]}}function iW(e,i){return e[0]===i[0]&&e[1]===i[1]}function iX(e,i,r){let a=iY(i[0]-e[0]);return[e[0]+a*r,e[1]+(i[1]-e[1])*r]}function iY(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class iK{constructor(e=[],i=(e,i)=>e<i?-1:+(e>i)){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:i,compare:r}=this,a=i[e];for(;e>0;){let n=e-1>>1,o=i[n];if(r(a,o)>=0)break;i[e]=o,e=n}i[e]=a}_down(e){let{data:i,compare:r}=this,a=this.length>>1,n=i[e];for(;e<a;){let a=1+(e<<1),o=a+1;if(o<this.length&&0>r(i[o],i[a])&&(a=o),r(i[a],n)>=0)break;i[e]=i[a],e=a}i[e]=n}}function iJ(e,i){return i.dist-e.dist}function iQ(e){let i=[1/0,1/0,-1/0,-1/0];if(i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(i[r]!==e[r])return!1;return!0}function i0(e){return e[1]-e[0]+1}function i1(e,i){let r=e[1]>=e[0]&&e[1]<i;return r||console.warn("Distance Expression: Index is out of range"),r}function i2(e,i){if(e[0]>e[1])return[null,null];let r=i0(e);if(i){if(2===r)return[e,null];let i=Math.floor(r/2);return[[e[0],e[0]+i],[e[0]+i,e[1]]]}{if(1===r)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}}function i3(e,i){let r=[1/0,1/0,-1/0,-1/0];if(!i1(i,e.length))return r;for(let a=i[0];a<=i[1];++a)iD(r,e[a]);return r}function i4(e){let i=[1/0,1/0,-1/0,-1/0];for(let r=0;r<e.length;++r)for(let a=0;a<e[r].length;++a)iD(i,e[r][a]);return i}function i5(e,i,r){if(iQ(e)||iQ(i))return NaN;let a=0,n=0;return e[2]<i[0]&&(a=i[0]-e[2]),e[0]>i[2]&&(a=e[0]-i[2]),e[1]>i[3]&&(n=e[1]-i[3]),e[3]<i[1]&&(n=i[1]-e[3]),r.distance([0,0],[a,n])}function i6(e,i){let r=Math.pow(2,i.z),a=(e.y/8192+i.y)/r;return[360*((e.x/8192+i.x)/r)-180,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90]}function i8(e,i,r){let a=r.pointOnLine(i,e).point;return r.distance(e,a)}function i9(e,i,r,a,n){let o=r.slice(a[0],a[1]+1),s=1/0;for(let r=i[0];r<=i[1];++r)if(0===(s=Math.min(s,i8(e[r],o,n))))return 0;return s}function i7(e,i,r,a,n){return Math.min(Math.min(n.pointToSegmentDistance(e,r,a),n.pointToSegmentDistance(i,r,a)),Math.min(n.pointToSegmentDistance(r,e,i),n.pointToSegmentDistance(a,e,i)))}function re(e,i){for(let r of e)for(let e=0;e<=r.length-1;++e)if(iL(r[e],i,!0))return!0;return!1}function rt(e,i,r,a,n,o,s){if(null===o||null===s)return;let l=i5(i3(a,o),i3(n,s),r);l<i&&e.push({dist:l,range1:o,range2:s})}function ri(e,i,r,a,n,o=1/0){let s=Math.min(o,n.distance(e[0],r[0]));if(0===s)return s;let l=new iK([{dist:0,range1:[0,e.length-1],range2:[0,r.length-1]}],iJ),h=i?50:100,u=a?50:100;for(;l.length;){let o=l.pop();if(o.dist>=s)continue;let c=o.range1,d=o.range2;if(i0(c)<=h&&i0(d)<=u){if(!i1(c,e.length)||!i1(d,r.length))return NaN;if(i&&a?s=Math.min(s,function(e,i,r,a,n){if(!i1(i,e.length)||!i1(a,r.length))return NaN;let o=1/0;for(let s=i[0];s<i[1];++s)for(let i=a[0];i<a[1];++i){if(ik(e[s],e[s+1],r[i],r[i+1]))return 0;o=Math.min(o,i7(e[s],e[s+1],r[i],r[i+1],n))}return o}
1(e,c,r,d,n)):i||a?i&&!a?s=Math.min(s,i9(r,d,e,c,n)):!i&&a&&(s=Math.min(s,i9(e,c,r,d,n))):s=Math.min(s,function(e,i,r,a,n){if(!i1(i,e.length)||!i1(a,r.length))return NaN;let o=1/0;for(let s=i[0];s<=i[1];++s)for(let i=a[0];i<=a[1];++i)if(0===(o=Math.min(o,n.distance(e[s],r[i]))))return o;return o}(e,c,r,d,n)),0===s)break}else{let o=i2(c,i),h=i2(d,a);rt(l,s,n,e,r,o[0],h[0]),rt(l,s,n,e,r,o[0],h[1]),rt(l,s,n,e,r,o[1],h[0]),rt(l,s,n,e,r,o[1],h[1])}}return s}function rr(e,i,r,a,n=1/0){let o=n,s=i3(e,[0,e.length-1]);for(let n of r)if(!(o!==1/0&&i5(s,i3(n,[0,n.length-1]),a)>=o)&&0===(o=Math.min(o,ri(e,i,n,!0,a,o))))break;return o}function ra(e,i,r,a,n=1/0){let o=n,s=i3(e,[0,e.length-1]);for(let n of r){if(o!==1/0&&i5(s,i4(n),a)>=o)continue;let r=function(e,i,r,a,n=1/0){let o=Math.min(a.distance(e[0],r[0][0]),n);if(0===o)return o;let s=new iK([{dist:0,range1:[0,e.length-1],range2:[0,0]}],iJ),l=i?50:100,h=i4(r);for(;s.length;){let n=s.pop();if(n.dist>=o)continue;let u=n.range1;if(i0(u)<=l){if(!i1(u,e.length))return NaN;if(i){if(0===(o=Math.min(o,function(e,i,r,a){if(!i1(i,e.length))return NaN;for(let a=i[0];a<=i[1];++a)if(iL(e[a],r,!0))return 0;let n=1/0;for(let o=i[0];o<i[1];++o)for(let i of r)for(let r=0,s=i.length,l=s-1;r<s;l=r++){if(ik(e[o],e[o+1],i[l],i[r]))return 0;n=Math.min(n,i7(e[o],e[o+1],i[l],i[r],a))}return n}(e,u,r,a))))break}else for(let i=u[0];i<=u[1];++i)if(0===(o=Math.min(o,function(e,i,r){if(iL(e,i,!0))return 0;let a=1/0;for(let n of i){let i=n.length;if(i<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(n[0]!==n[i-1]&&0===(a=Math.min(a,r.pointToSegmentDistance(e,n[i-1],n[0])))||0===(a=Math.min(a,i8(e,n,r))))break}return a}(e[i],r,a))))return o}else{let r=i2(u,i);if(null!==r[0]){let i=i5(i3(e,r[0]),h,a);i<o&&s.push({dist:i,range1:r[0],range2:[0,0]})}if(null!==r[1]){let i=i5(i3(e,r[1]),h,a);i<o&&s.push({dist:i,range1:r[1],range2:[0,0]})}}}return o}(e,i,n,a,o);if(isNaN(r))return r;if(0===(o=Math.min(o,r)))break}return o}function rn(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class ro{constructor(e,i){this.type=t1,this.geojson=e,this.geometries=i}static parse(e,i){if(2!==e.length)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(ip(e[1])){let i=e[1];if("FeatureCollection"===i.type){for(let e=0;e<i.features.length;++e)if(rn(i.features[e].geometry.type))return new ro(i,i.features[e].geometry)}else if("Feature"===i.type){if(rn(i.geometry.type))return new ro(i,i.geometry)}else if(rn(i.type))return new ro(i,i)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){let i=e.geometry(),r=e.canonicalID();if(null!=i&&null!=r){if("Point"===e.geometryType()){var a=this.geometries;let e=[];for(let a of i)for(let i of a)e.push(i6(i,r));let n=new i$(e[0][1],"meters");return"Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type?ri(e,!1,"Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n):"MultiLineString"===a.type?rr(e,!1,a.coordinates,n):"Polygon"===a.type||"MultiPolygon"===a.type?ra(e,!1,"Polygon"===a.type?[a.coordinates]:a.coordinates,n):null}if("LineString"===e.geometryType())return function(e,i,r){let a=[];for(let r of e){let e=[];for(let a of r)e.push(i6(a,i));a.push(e)}let n=new i$(a[0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return rr("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,a,n);if("MultiLineString"===r.type){let e=1/0;for(let i=0;i<r.coordinates.length;i++){let o=rr(r.coordinates[i],!0,a,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}if("Polygon"===r.type||"MultiPolygon"===r.type){let e=1/0;for(let i=0;i<a.length;i++){let o=ra(a[i],!0,"Polygon"===r.type?[r.coordinates]:r.coordinates,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}return null}(i,r,this.geometries);if("Polygon"===e.geometryType())return function(e,i,r){let a=[];for(let r of function(e){let i,r,a=e.length;if(a<=1)return[e];let n=[];for(let o=0;o<a;o++){let a=function(e){let i=0;for(let r,a,n=0,o=e.length,s=o-1;n<o;s=n++)r=e[n],i+=((a=e[s]).x-r.x)*(r.y+a.y);return i}(e[o]);0!==a&&(e[o].area=Math.abs(a),void 0===r&&(r=a<0),r===a<0?(i&&n.push(i),i=[e[o]]):i.push(e[o]))}return i&&n.push(i),n}(e)){let e=[];for(let a=0;a<r.length;++a)e.push(function(e,i){let r=[];for(let a=0;a<e.length;++a)r.push(i6(e[a],i));return r}(r[a],i));a.push(e)}
1let n=new i$(a[0][0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return ra("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,a,n);if("MultiLineString"===r.type){let e=1/0;for(let i=0;i<r.coordinates.length;i++){let o=ra(r.coordinates[i],!0,a,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))break}return e}return"Polygon"===r.type||"MultiPolygon"===r.type?function(e,i,r){let a=1/0;for(let n of e)for(let e of i){let i=function(e,i,r,a=1/0){let n=i4(e),o=i4(i);if(a!==1/0&&i5(n,o,r)>=a)return a;if(iR(n,o)){if(re(e,i))return 0}else if(re(i,e))return 0;let s=a;for(let a of e)for(let e=0,n=a.length,o=n-1;e<n;o=e++)for(let n of i)for(let i=0,l=n.length,h=l-1;i<l;h=i++){if(ik(a[o],a[e],n[h],n[i]))return 0;s=Math.min(s,i7(a[o],a[e],n[h],n[i],r))}return s}(n,e,r,a);if(isNaN(i))return i;if(0===(a=Math.min(a,i)))return a}return a}("Polygon"===r.type?[r.coordinates]:r.coordinates,a,n):null}(i,r,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function rs(e,i){switch(e){case"string":return i_(i);case"number":return+i;case"boolean":return!!i;case"color":return tZ.parse(i);case"formatted":return ih.fromString(i_(i));case"resolvedImage":return ic.build(i_(i))}return i}function rl(e,i,r,a){return void 0!==a&&(e=a*Math.round(e/a)),void 0!==i&&e<i&&(e=i),void 0!==r&&e>r&&(e=r),e}class rh{constructor(e,i,r){this.type=e,this.key=i,this.scope=r}static parse(e,i){let r=i.expectedType;if(null==r&&(r=t6),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");let a=i.parse(e[1],1);if(!(a instanceof ig))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){let n=i.parse(e[2],2);return n instanceof ig?new rh(r,i_(a.value),i_(n.value)):i.error("Scope of 'config' expression must be a string literal.")}return new rh(r,i_(a.value))}evaluate(e){let i=[this.key,this.scope,e.scope].filter(Boolean).join("\x1f"),r=e.getConfig(i);if(!r)return null;let{type:a,value:n,values:o,minValue:s,maxValue:l,stepValue:h}=r,u=r.default.evaluate(e),c=u;if(n){let i=e.scope;e.scope=(i||"").split("\x1f").slice(1).join("\x1f"),c=n.evaluate(e),e.scope=i}return a&&(c=rs(a,c)),void 0===c||void 0===s&&void 0===l&&void 0===h||("number"==typeof c?c=rl(c,s,l,h):Array.isArray(c)&&(c=c.map(e=>"number"==typeof e?rl(e,s,l,h):e))),void 0!==n&&void 0!==c&&o&&!o.includes(c)&&(c=u,a&&(c=rs(a,c))),(a&&a!==this.type||void 0!==c&&im(c)!==this.type)&&(c=rs(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){let e=["config",this.key];return this.scope&&e.concat(this.key),e}}function ru(e){if(e instanceof iI&&("get"===e.name&&1===e.args.length||"feature-state"===e.name||"has"===e.name&&1===e.args.length||"properties"===e.name||"geometry-type"===e.name||"id"===e.name||/^filter-/.test(e.name))||e instanceof iG||e instanceof ro)return!1;let i=!0;return e.eachChild(e=>{i&&!ru(e)&&(i=!1)}),i}function rc(e){if(e instanceof iI&&"feature-state"===e.name)return!1;let i=!0;return e.eachChild(e=>{i&&!rc(e)&&(i=!1)}),i}function rd(e){if(e instanceof rh)return new Set([e.key]);let i=new Set;return e.eachChild(e=>{i=new Set([...i,...rd(e)])}),i}function rp(e,i){if(e instanceof iI&&i.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!rp(e,i)&&(r=!1)}),r}class rf{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(2!==e.length||"string"!=typeof e[1])return i.error("'var' expression requires exactly one string literal argument.");let r=e[1];return i.scope.has(r)?new rf(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class rm{constructor(e,i=[],r,a=new tQ,n=[],o,s){this.registry=e,this.path=i,this.key=i.map(e=>"string"==typeof e?`['${e}']`:`[${e}]`).join(""),this.scope=a,this.errors=n,this.expectedType=r,this._scope=o,this.options=s}parse(e,i,r,a,n={}){return i||r?this.concat(i,null,r,a)._parse(e,n):this._parse(e,n)}parseObjectValue(e,i,r,a,n,o={}){return this.concat(i,r,a,n)._parse(e,o)}_parse(e,i){function r(e,i,r){return"assert"===r?new iv(i,[e]):"coerce"===r?new iM(i,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let a="string"==typeof e[0]?this.registry[e[0]]:void 0;if(a){let n=a.parse(e,this);if(!n)return null;if(this.expectedType){let e=this.expectedType,a=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(e,a))return null}else n=r(n,e,i.typeAnnotation||"coerce");else n=r(n,e,i.typeAnnotation||"assert")}if(!(n instanceof ig)&&"resolvedImage"!==n.type.kind&&function e(i){if(i instanceof rf)return e(i.boundExpression);if(i instanceof iI&&"error"===i.name||i instanceof iP||i instanceof iG||i instanceof ro||i instanceof rh)return!1;
1let r=i instanceof iM||i instanceof iv,a=!0;return i.eachChild(i=>{a=r?a&&e(i):a&&i instanceof ig}),!!a&&ru(i)&&rp(i,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}(n)){let e=new iA(this._scope,this.options);try{n=new ig(n.type,n.evaluate(e))}catch(e){return this.error(e.message),null}}return n}return iM.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,r,a){let n="number"==typeof e?this.path.concat(e):this.path;n="string"==typeof i?n.concat(i):n;let o=a?this.scope.concat(a):this.scope;return new rm(this.registry,n,r||null,o,this.errors,this._scope,this.options)}error(e,...i){let r=`${this.key}${i.map(e=>`[${e}]`).join("")}`;this.errors.push(new tJ(r,e))}checkSubtype(e,i){let r=ir(e,i);return r&&this.error(r),r}}var r_=rm;function rg(e,i){let r=e.length-1,a,n,o=0,s=r,l=0;for(;o<=s;)if(a=e[l=Math.floor((o+s)/2)],n=e[l+1],a<=i){if(l===r||i<n)return l;o=l+1}else{if(!(a>i))throw new iy("Input is not a number.");s=l-1}return 0}class ry{constructor(e,i,r){for(const[a,n]of(this.type=e,this.input=i,this.labels=[],this.outputs=[],r))this.labels.push(a),this.outputs.push(n)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(e[1],1,t1);if(!r)return null;let a=[],n=null;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);for(let r=1;r<e.length;r+=2){let o=1===r?-1/0:e[r],s=e[r+1],l=r,h=r+1;if("number"!=typeof o)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',l);if(a.length&&a[a.length-1][0]>=o)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);let u=i.parse(s,h,n);if(!u)return null;n=n||u.type,a.push([o,u])}return new ry(n,r,a)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return r[0].evaluate(e);let n=i.length;return a>=i[n-1]?r[n-1].evaluate(e):r[rg(i,a)].evaluate(e)}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}let rx=4/29,rv=6/29,rb=6/29*3*(6/29),rw=6/29*(6/29)*(6/29),rT=Math.PI/180,rS=180/Math.PI;function rM(e){return e>rw?Math.pow(e,1/3):e/rb+rx}function rE(e){return e>rv?e*e*e:rb*(e-rx)}function rA(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function rI(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function rC(e){let i=rI(e.r),r=rI(e.g),a=rI(e.b),n=rM((.4124564*i+.3575761*r+.1804375*a)/.95047),o=rM((.2126729*i+.7151522*r+.072175*a)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-rM((.0193339*i+.119192*r+.9503041*a)/1.08883)),alpha:e.a}}function rP(e){let i=(e.l+16)/116,r=isNaN(e.a)?i:i+e.a/500,a=isNaN(e.b)?i:i-e.b/200;return i=+rE(i),new tZ(rA(3.2404542*(r=.95047*rE(r))-1.5371385*i-.4985314*(a=1.08883*rE(a))),rA(-.969266*r+1.8760108*i+.041556*a),rA(.0556434*r-.2040259*i+1.0572252*a),e.alpha)}let rz={forward:rC,reverse:rP,interpolate:function(e,i,r){return{l:t$(e.l,i.l,r),a:t$(e.a,i.a,r),b:t$(e.b,i.b,r),alpha:t$(e.alpha,i.alpha,r)}}},rD={forward:function(e){let{l:i,a:r,b:a}=rC(e),n=Math.atan2(a,r)*rS;return{h:n<0?n+360:n,c:Math.sqrt(r*r+a*a),l:i,alpha:e.a}},reverse:function(e){let i=e.h*rT,r=e.c;return rP({l:e.l,a:Math.cos(i)*r,b:Math.sin(i)*r,alpha:e.alpha})},interpolate:function(e,i,r){var a,n;let o;return{h:(a=e.h,n=i.h,o=n-a,a+r*(o>180||o<-180?o-360*Math.round(o/360):o)),c:t$(e.c,i.c,r),l:t$(e.l,i.l,r),alpha:t$(e.alpha,i.alpha,r)}}};var rR=Object.freeze({__proto__:null,hcl:rD,lab:rz});
1class rL{constructor(e,i,r,a,n){for(const[o,s]of(this.type=e,this.operator=i,this.interpolation=r,this.input=a,this.labels=[],this.outputs=[],n))this.labels.push(o),this.outputs.push(s)}static interpolationFactor(e,i,r,a){let n=0;if("exponential"===e.name)n=rO(i,e.base,r,a);else if("linear"===e.name)n=rO(i,1,r,a);else if("cubic-bezier"===e.name){let o=e.controlPoints;n=new ez(o[0],o[1],o[2],o[3]).solve(rO(i,1,r,a))}return n}static parse(e,i){let[r,a,n,...o]=e;if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let e=a[1];if("number"!=typeof e)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:e}}else{if("cubic-bezier"!==a[0])return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{let e=a.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(n=i.parse(n,2,t1)))return null;let s=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=t4:i.expectedType&&"value"!==i.expectedType.kind&&(l=i.expectedType);for(let e=0;e<o.length;e+=2){let r=o[e],a=o[e+1],n=e+3,h=e+4;if("number"!=typeof r)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(s.length&&s[s.length-1][0]>=r)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let u=i.parse(a,h,l);if(!u)return null;l=l||u.type,s.push([r,u])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new rL(l,r,a,n,s):i.error(`Type ${it(l)} is not interpolatable.`)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return r[0].evaluate(e);let n=i.length;if(a>=i[n-1])return r[n-1].evaluate(e);let o=rg(i,a),s=rL.interpolationFactor(this.interpolation,a,i[o],i[o+1]),l=r[o].evaluate(e),h=r[o+1].evaluate(e);return"interpolate"===this.operator?tY[this.type.kind.toLowerCase()](l,h,s):"interpolate-hcl"===this.operator?rD.reverse(rD.interpolate(rD.forward(l),rD.forward(h),s)):rz.reverse(rz.interpolate(rz.forward(l),rz.forward(h),s))}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];let i=[this.operator,e,this.input.serialize()];for(let e=0;e<this.labels.length;e++)i.push(this.labels[e],this.outputs[e].serialize());return i}}function rO(e,i,r,a){let n=a-r,o=e-r;return 0===n?0:1===i?o/n:(Math.pow(i,o)-1)/(Math.pow(i,n)-1)}class rk{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let r=null,a=i.expectedType;a&&"value"!==a.kind&&(r=a);let n=[];for(let a of e.slice(1)){let e=i.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,n.push(e)}return new rk(a&&n.some(e=>ir(a,e.type))?t6:r,n)}evaluate(e){let i,r=null,a=0;for(let n of this.args){if(a++,(r=n.evaluate(e))&&r instanceof ic&&!r.available&&(i||(i=r),r=null,a===this.args.length))return i;if(null!==r)break}return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class rF{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let r=[];for(let a=1;a<e.length-1;a+=2){let n=e[a];if("string"!=typeof n)return i.error(`Expected string, but found ${typeof n} instead.`,a);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let o=i.parse(e[a+1],a+1);if(!o)return null;
1r.push([n,o])}let a=i.parse(e[e.length-1],e.length-1,i.expectedType,r);return a?new rF(r,a):null}outputDefined(){return this.result.outputDefined()}serialize(){let e=["let"];for(let[i,r]of this.bindings)e.push(i,r.serialize());return e.push(this.result.serialize()),e}}class rB{constructor(e,i,r){this.type=e,this.index=i,this.input=r}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t1),a=i.parse(e[2],2,ie(i.expectedType||t6));return r&&a?new rB(a.type.itemType,r,a):null}evaluate(e){let i=this.index.evaluate(e),r=this.input.evaluate(e);if(i<0)throw new iy(`Array index out of bounds: ${i} < 0.`);if(i>=r.length)throw new iy(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i!==Math.floor(i))throw new iy(`Array index must be an integer, but found ${i} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return r[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class rN{constructor(e,i,r){this.type=e,this.index=i,this.input=r}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t1),a=i.parse(e[2],2,ie(i.expectedType||t6));return r&&a?new rN(a.type.itemType,r,a):null}evaluate(e){let i=this.index.evaluate(e),r=this.input.evaluate(e);if(i<0)throw new iy(`Array index out of bounds: ${i} < 0.`);if(i>r.length-1)throw new iy(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i===Math.floor(i))return r[i];let a=Math.floor(i),n=Math.ceil(i),o=r[a],s=r[n];if("number"!=typeof o||"number"!=typeof s)throw new iy(`Cannot interpolate between non-number values at index ${i}.`);let l=i-a;return o*(1-l)+s*l}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class rV{constructor(e,i){this.type=t3,this.needle=e,this.haystack=i}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t6),a=i.parse(e[2],2,t6);return r&&a?ia(r.type,[t3,t2,t1,t0,t6])?new rV(r,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`):null}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!io(i,["boolean","string","number","null"]))throw new iy(`Expected first argument to be of type boolean, string, number or null, but found ${it(im(i))} instead.`);if(!io(r,["string","array"]))throw new iy(`Expected second argument to be of type array or string, but found ${it(im(r))} instead.`);return r.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class rU{constructor(e,i,r){this.type=t1,this.needle=e,this.haystack=i,this.fromIndex=r}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t6),a=i.parse(e[2],2,t6);if(!r||!a)return null;if(!ia(r.type,[t3,t2,t1,t0,t6]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,t1);return n?new rU(r,a,n):null}return new rU(r,a)}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!io(i,["boolean","string","number","null"]))throw new iy(`Expected first argument to be of type boolean, string, number or null, but found ${it(im(i))} instead.`);if(!io(r,["string","array"]))throw new iy(`Expected second argument to be of type array or string, but found ${it(im(r))} instead.`);if(this.fromIndex){let a=this.fromIndex.evaluate(e);return r.indexOf(i,a)}return r.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class rj{constructor(e,i,r,a,n,o){this.inputType=e,this.type=i,this.input=r,this.cases=a,this.outputs=n,this.otherwise=o}static parse(e,i){let r,a;
1if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);let n={},o=[];for(let s=2;s<e.length-1;s+=2){let l=e[s],h=e[s+1];Array.isArray(l)||(l=[l]);let u=i.concat(s);if(0===l.length)return u.error("Expected at least one branch label.");for(let e of l){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,im(e)))return null}else r=im(e);if(void 0!==n[String(e)])return u.error("Branch labels must be unique.");n[String(e)]=o.length}let c=i.parse(h,s,a);if(!c)return null;a=a||c.type,o.push(c)}let s=i.parse(e[1],1,t6);if(!s)return null;let l=i.parse(e[e.length-1],e.length-1,a);return l?"value"!==s.type.kind&&i.concat(1).checkSubtype(r,s.type)?null:new rj(r,a,s,n,o,l):null}evaluate(e){let i=this.input.evaluate(e);return(im(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),r=[],a={};for(let e of i){let i=a[this.cases[e]];void 0===i?(a[this.cases[e]]=r.length,r.push([this.cases[e],[e]])):r[i][1].push(e)}let n=e=>"number"===this.inputType.kind?Number(e):e;for(let[i,a]of r)e.push(1===a.length?n(a[0]):a.map(n)),e.push(this.outputs[i].serialize());return e.push(this.otherwise.serialize()),e}}class rG{constructor(e,i,r){this.type=e,this.branches=i,this.otherwise=r}static parse(e,i){let r;if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);let a=[];for(let n=1;n<e.length-1;n+=2){let o=i.parse(e[n],n,t3);if(!o)return null;let s=i.parse(e[n+1],n+1,r);if(!s)return null;a.push([o,s]),r=r||s.type}let n=i.parse(e[e.length-1],e.length-1,r);return n?new rG(r,a,n):null}evaluate(e){for(let[i,r]of this.branches)if(i.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[i,r]of this.branches)e(i),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class rq{constructor(e,i,r,a){this.type=e,this.input=i,this.beginIndex=r,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,t6),a=i.parse(e[2],2,t1);if(!r||!a)return null;if(!ia(r.type,[ie(t6),t2,t6]))return i.error(`Expected first argument to be of type array or string, but found ${it(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,t1);return n?new rq(r.type,r,a,n):null}return new rq(r.type,r,a)}evaluate(e){let i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!io(i,["string","array"]))throw new iy(`Expected first argument to be of type array or string, but found ${it(im(i))} instead.`);if(this.endIndex){let a=this.endIndex.evaluate(e);return i.slice(r,a)}return i.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function rZ(e,i){return"=="===e||"!="===e?"boolean"===i.kind||"string"===i.kind||"number"===i.kind||"null"===i.kind||"value"===i.kind:"string"===i.kind||"number"===i.kind||"value"===i.kind}function rH(e,i,r,a){return 0===a.compare(i,r)}function r$(e,i,r){let a="=="!==e&&"!="!==e;
1return class n{constructor(e,i,r){this.type=t3,this.lhs=e,this.rhs=i,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===i.type.kind}static parse(e,i){if(3!==e.length&&4!==e.length)return i.error("Expected two or three arguments.");let r=e[0],o=i.parse(e[1],1,t6);if(!o)return null;if(!rZ(r,o.type))return i.concat(1).error(`"${r}" comparisons are not supported for type '${it(o.type)}'.`);let s=i.parse(e[2],2,t6);if(!s)return null;if(!rZ(r,s.type))return i.concat(2).error(`"${r}" comparisons are not supported for type '${it(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return i.error(`Cannot compare types '${it(o.type)}' and '${it(s.type)}'.`);a&&("value"===o.type.kind&&"value"!==s.type.kind?o=new iv(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new iv(o.type,[s])));let l=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return i.error("Cannot use collator to compare non-string types.");if(!(l=i.parse(e[3],3,t8)))return null}return new n(o,s,l)}evaluate(n){let o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(a&&this.hasUntypedArgument){let i=im(o),r=im(s);if(i.kind!==r.kind||"string"!==i.kind&&"number"!==i.kind)throw new iy(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${i.kind}, ${r.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let e=im(o),r=im(s);if("string"!==e.kind||"string"!==r.kind)return i(n,o,s)}return this.collator?r(n,o,s,this.collator.evaluate(n)):i(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){let i=[e];return this.eachChild(e=>{i.push(e.serialize())}),i}}}let rW=r$("==",function(e,i,r){return i===r},rH),rX=r$("!=",function(e,i,r){return i!==r},function(e,i,r,a){return!rH(0,i,r,a)}),rY=r$("<",function(e,i,r){return i<r},function(e,i,r,a){return 0>a.compare(i,r)}),rK=r$(">",function(e,i,r){return i>r},function(e,i,r,a){return a.compare(i,r)>0}),rJ=r$("<=",function(e,i,r){return i<=r},function(e,i,r,a){return 0>=a.compare(i,r)}),rQ=r$(">=",function(e,i,r){return i>=r},function(e,i,r,a){return a.compare(i,r)>=0});class r0{constructor(e,i,r,a,n,o){this.type=t2,this.number=e,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,i){if(3!==e.length)return i.error("Expected two arguments.");let r=i.parse(e[1],1,t1);if(!r)return null;let a=e[2];if("object"!=typeof a||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&!(n=i.parseObjectValue(a.locale,2,"locale",t2)))return null;let o=null;if(a.currency&&!(o=i.parseObjectValue(a.currency,2,"currency",t2)))return null;let s=null;if(a.unit&&!(s=i.parseObjectValue(a.unit,2,"unit",t2)))return null;let l=null;if(a["min-fraction-digits"]&&!(l=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",t1)))return null;let h=null;return!a["max-fraction-digits"]||(h=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",t1))?new r0(r,n,o,s,l,h):null}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class r1{constructor(e){this.type=t1,this.input=e}static parse(e,i){if(2!==e.length)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);let r=i.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?i.error(`Expected argument of type string or array, but found ${it(r.type)} instead.`):new r1(r):null}evaluate(e){let i=this.input.evaluate(e);if("string"==typeof i||Array.isArray(i))return i.length;throw new iy(`Expected value to be of type string or array, but found ${it(im(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){let e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function r2(e){return function(){let i=Math.imul((e=0x6d2b79f5+(e|=0)|0)^e>>>15,1|e);return(((i=i+Math.imul(i^i>>>7,61|i)^i)^i>>>14)>>>0)/0x100000000}}let r3={"==":rW,"!=":rX,">":rK,"<":rY,">=":rQ,"<=":rJ,array:iv,at:rB,"at-interpolated":rN,boolean:iv,case:rG,coalesce:rk,collator:iP,format:ib,image:iw,in:rV,"index-of":rU,interpolate:rL,"interpolate-hcl":rL,"interpolate-lab":rL,length:r1,let:rF,literal:ig,match:rj,number:iv,"number-format":r0,object:iv,slice:rq,step:ry,string:iv,"to-boolean":iM,"to-color":iM,"to-number":iM,"to-string":iM,var:rf,within:iG,distance:ro,config:rh};function r4(e,[i,r,a,n]){i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let o=n?n.evaluate(e):1,s=id(i,r,a,o);if(s)throw new iy(s);return new tZ(i/255*o,r/255*o,a/255*o,o)}function r5(e,[i,r,a,n]){var o,s,l;i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let h=n?n.evaluate(e):1,u=(o=i,s=r,l=a,"number"==typeof o&&o>=0&&o<=360?"number"==typeof s&&s>=0&&s<=100&&"number"==typeof l&&l>=0&&l<=100?void 0===h||"number"==typeof h&&h>=0&&h<=1?null:`Invalid hsla value [${[o,s,l,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof h?[o,s,l,h]:[o,s,l]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof h?[o,s,l,h]:[o,s,l]).join(", ")}]: 'h' must be between 0 and 360.`);if(u)throw new iy(u);let c=`hsla(${i}, ${r}%, ${a}%, ${h})`,d=tZ.parse(c);if(!d)throw new iy(`Failed to parse HSLA color: ${c}`);return d}function r6(e,i){let r=i[e];return void 0===r?null:r}function r8(e){return{type:e}}function r9(e){return{result:"success",value:e}}function r7(e){return{result:"error",value:e}}function ae(e,i){return!!e&&!!e.parameters&&e.parameters.indexOf(i)>-1}function at(e){return"data-driven"===e["property-type"]}function ai(e){return ae(e.expression,"measure-light")}function ar(e){return ae(e.expression,"zoom")}function aa(e){return!!e.expression&&e.expression.interpolated}function an(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ao(e){return e}function as(e,i,r){return void 0!==e?e:void 0!==i?i:void 0!==r?r:void 0}function al(e,i,r,a,n){return as(typeof r===n?a[r]:void 0,e.default,i.default)}function ah(e,i,r){if("number"!==iT(r))return as(e.default,i.default);let a=e.stops.length;if(1===a||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[a-1][0])return e.stops[a-1][1];let n=rg(e.stops.map(e=>e[0]),r);return e.stops[n][1]}function au(e,i,r){var a;
1let n,o,s=void 0!==e.base?e.base:1;if("number"!==iT(r))return as(e.default,i.default);let l=e.stops.length;if(1===l||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[l-1][0])return e.stops[l-1][1];let h=rg(e.stops.map(e=>e[0]),r),u=(a=e.stops[h][0],n=e.stops[h+1][0]-a,o=r-a,0===n?0:1===s?o/n:(Math.pow(s,o)-1)/(Math.pow(s,n)-1)),c=e.stops[h][1],d=e.stops[h+1][1],p=tY[i.type]||ao;if(e.colorSpace&&"rgb"!==e.colorSpace){let i=rR[e.colorSpace];p=(e,r)=>i.reverse(i.interpolate(i.forward(e),i.forward(r),u))}return"function"==typeof c.evaluate?{evaluate(...e){let i=c.evaluate.apply(void 0,e),r=d.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return p(i,r,u)}}:p(c,d,u)}function ac(e,i,r){return"color"===i.type?r=tZ.parse(r):"formatted"===i.type?r=ih.fromString(r.toString()):"resolvedImage"===i.type?r=ic.build(r.toString()):iT(r)===i.type||"enum"===i.type&&i.values[r]||(r=void 0),as(r,e.default,i.default)}iI.register(r3,{error:[{kind:"error"},[t2],(e,[i])=>{throw new iy(i.evaluate(e))}],typeof:[t2,[t6],(e,[i])=>it(im(i.evaluate(e)))],"to-rgba":[ie(t1,4),[t4],(e,[i])=>i.evaluate(e).toRenderColor(null).toArray()],"to-hsla":[ie(t1,4),[t4],(e,[i])=>i.evaluate(e).toRenderColor(null).toHslaArray()],rgb:[t4,[t1,t1,t1],r4],rgba:[t4,[t1,t1,t1,t1],r4],hsl:[t4,[t1,t1,t1],r5],hsla:[t4,[t1,t1,t1,t1],r5],has:{type:t3,overloads:[[[t2],(e,[i])=>i.evaluate(e)in e.properties()],[[t2,t5],(e,[i,r])=>i.evaluate(e)in r.evaluate(e)]]},get:{type:t6,overloads:[[[t2],(e,[i])=>r6(i.evaluate(e),e.properties())],[[t2,t5],(e,[i,r])=>r6(i.evaluate(e),r.evaluate(e))]]},"feature-state":[t6,[t2],(e,[i])=>r6(i.evaluate(e),e.featureState||{})],properties:[t5,[],e=>e.properties()],"geometry-type":[t2,[],e=>e.geometryType()],id:[t6,[],e=>e.id()],zoom:[t1,[],e=>e.globals.zoom],pitch:[t1,[],e=>e.globals.pitch||0],"distance-from-center":[t1,[],e=>e.distanceFromCenter()],"measure-light":[t1,[t2],(e,[i])=>e.measureLight(i.evaluate(e))],"heatmap-density":[t1,[],e=>e.globals.heatmapDensity||0],"line-progress":[t1,[],e=>e.globals.lineProgress||0],"raster-value":[t1,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[t1,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[t1,[],e=>e.globals.skyRadialProgress||0],accumulated:[t6,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[t1,r8(t1),(e,i)=>{let r=0;for(let a of i)r+=a.evaluate(e);return r}],"*":[t1,r8(t1),(e,i)=>{let r=1;for(let a of i)r*=a.evaluate(e);return r}],"-":{type:t1,overloads:[[[t1,t1],(e,[i,r])=>i.evaluate(e)-r.evaluate(e)],[[t1],(e,[i])=>-i.evaluate(e)]]},"/":[t1,[t1,t1],(e,[i,r])=>i.evaluate(e)/r.evaluate(e)],"%":[t1,[t1,t1],(e,[i,r])=>i.evaluate(e)%r.evaluate(e)],ln2:[t1,[],()=>Math.LN2],pi:[t1,[],()=>Math.PI],e:[t1,[],()=>Math.E],"^":[t1,[t1,t1],(e,[i,r])=>Math.pow(i.evaluate(e),r.evaluate(e))],sqrt:[t1,[t1],(e,[i])=>Math.sqrt(i.evaluate(e))],log10:[t1,[t1],(e,[i])=>Math.log(i.evaluate(e))/Math.LN10],ln:[t1,[t1],(e,[i])=>Math.log(i.evaluate(e))],log2:[t1,[t1],(e,[i])=>Math.log(i.evaluate(e))/Math.LN2],sin:[t1,[t1],(e,[i])=>Math.sin(i.evaluate(e))],cos:[t1,[t1],(e,[i])=>Math.cos(i.evaluate(e))],tan:[t1,[t1],(e,[i])=>Math.tan(i.evaluate(e))],asin:[t1,[t1],(e,[i])=>Math.asin(i.evaluate(e))],acos:[t1,[t1],(e,[i])=>Math.acos(i.evaluate(e))],atan:[t1,[t1],(e,[i])=>Math.atan(i.evaluate(e))],min:[t1,r8(t1),(e,i)=>Math.min(...i.map(i=>i.evaluate(e)))],max:[t1,r8(t1),(e,i)=>Math.max(...i.map(i=>i.evaluate(e)))],abs:[t1,[t1],(e,[i])=>Math.abs(i.evaluate(e))],round:[t1,[t1],(e,[i])=>{let r=i.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[t1,[t1],(e,[i])=>Math.floor(i.evaluate(e))],ceil:[t1,[t1],(e,[i])=>Math.ceil(i.evaluate(e))],"filter-==":[t3,[t2,t6],(e,[i,r])=>e.properties()[i.value]===r.value],"filter-id-==":[t3,[t6],(e,[i])=>e.id()===i.value],"filter-type-==":[t3,[t2],(e,[i])=>e.geometryType()===i.value],"filter-<":[t3,[t2,t6],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<n}],"filter-id-<":[t3,[t6],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<a}],"filter->":[t3,[t2,t6],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>n}],"filter-id->":[t3,[t6],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>a}],"filter-<=":[t3,[t2,t6],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<=n}],"filter-id-<=":[t3,[t6],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<=a}],"filter->=":[t3,[t2,t6],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>=n}],"filter-id->=":[t3,[t6],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>=a}],"filter-has":[t3,[t6],(e,[i])=>i.value in e.properties()],"filter-has-id":[t3,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[t3,[ie(t2)],(e,[i])=>i.value.indexOf(e.geometryType())>=0],"filter-id-in":[t3,[ie(t6)],(e,[i])=>i.value.indexOf(e.id())>=0],"filter-in-small":[t3,[t2,ie(t6)],(e,[i,r])=>r.value.indexOf(e.properties()[i.value])>=0],"filter-in-large":[t3,[t2,ie(t6)],(e,[i,r])=>(function(e,i,r,a){for(;r<=a;){let n=r+a>>1;if(i[n]===e)return!0;
1i[n]>e?a=n-1:r=n+1}return!1})(e.properties()[i.value],r.value,0,r.value.length-1)],all:{type:t3,overloads:[[[t3,t3],(e,[i,r])=>i.evaluate(e)&&r.evaluate(e)],[r8(t3),(e,i)=>{for(let r of i)if(!r.evaluate(e))return!1;return!0}]]},any:{type:t3,overloads:[[[t3,t3],(e,[i,r])=>i.evaluate(e)||r.evaluate(e)],[r8(t3),(e,i)=>{for(let r of i)if(r.evaluate(e))return!0;return!1}]]},"!":[t3,[t3],(e,[i])=>!i.evaluate(e)],"is-supported-script":[t3,[t2],(e,[i])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[t2,[t2],(e,[i])=>i.evaluate(e).toUpperCase()],downcase:[t2,[t2],(e,[i])=>i.evaluate(e).toLowerCase()],concat:[t2,r8(t6),(e,i)=>i.map(i=>i_(i.evaluate(e))).join("")],"resolved-locale":[t2,[t8],(e,[i])=>i.evaluate(e).resolvedLocale()],random:[t1,[t1,t1,t6],(e,i)=>{let r,[a,n,o]=i.map(i=>i.evaluate(e));if(a>n||a===n)return a;if("string"==typeof o)r=function(e){let i=0;if(0===e.length)return i;for(let r=0;r<e.length;r++)i=(i<<5)-i+e.charCodeAt(r)|0;return i}(o);else{if("number"!=typeof o)throw new iy(`Invalid seed input: ${o}`);r=o}return a+r2(r)()*(n-a)}]});class ad{constructor(e,i,r,a){this.expression=e,this._warningHistory={},this._evaluator=new iA(r,a),this._defaultValue=i?function(e){return"color"===e.type&&(an(e.default)||Array.isArray(e.default))?new tZ(0,0,0,0):"color"===e.type?tZ.parse(e.default)||null:void 0===e.default?null:e.default}(i):null,this._enumValues=i&&"enum"===i.type?i.values:null,this.configDependencies=rd(e)}evaluateWithoutErrorHandling(e,i,r,a,n,o,s,l){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=a||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=l||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,r,a,n,o,s,l){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=l||null;try{let e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new iy(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"u">typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function ap(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in r3}function af(e,i,r,a){let n,o=new r_(r3,[],i?(n={color:t4,string:t2,number:t1,enum:t2,boolean:t3,formatted:t9,resolvedImage:t7},"array"===i.type?ie(n[i.value]||t6,i.length):n[i.type]):void 0,void 0,void 0,r,a),s=o.parse(e,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return s?r9(new ad(s,i,r,a)):r7(o.errors)}class am{constructor(e,i,r,a){this.kind=e,this._styleExpression=i,this.isLightConstant=r,this.isLineProgressConstant=a,this.isStateDependent="constant"!==e&&!rc(i.expression),this.configDependencies=rd(i.expression)}evaluateWithoutErrorHandling(e,i,r,a,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,o)}evaluate(e,i,r,a,n,o){return this._styleExpression.evaluate(e,i,r,a,n,o)}}class a_{constructor(e,i,r,a,n,o){this.kind=e,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==e&&!rc(i.expression),this.isLightConstant=n,this.isLineProgressConstant=o,this.configDependencies=rd(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,r,a,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,o)}evaluate(e,i,r,a,n,o){return this._styleExpression.evaluate(e,i,r,a,n,o)}interpolationFactor(e,i,r){return this.interpolationType?rL.interpolationFactor(this.interpolationType,e,i,r):0}}function ag(e,i,r,a){if("error"===(e=af(e,i,r,a)).result)return e;let n=e.value.expression,o=ru(n);if(!o&&!at(i))return r7([new tJ("","data expressions not supported")]);let s=rp(n,["zoom","pitch","distance-from-center"]);if(!s&&!ar(i))return r7([new tJ("","zoom expressions not supported")]);let l=rp(n,["measure-light"]);if(!l&&!ai(i))return r7([new tJ("","measure-light expression not supported")]);let h=rp(n,["line-progress"]);if(!h&&!ae(i.expression,"line-progress"))return r7([new tJ("","line-progress expression not supported")]);let u=i.expression&&i.expression.relaxZoomRestriction,c=function e(i){let r=null;if(i instanceof rF)r=e(i.result);else if(i instanceof rk){for(let a of i.args)if(r=e(a))break}else(i instanceof ry||i instanceof rL)&&i.input instanceof iI&&"zoom"===i.input.name&&(r=i);return r instanceof tJ||i.eachChild(i=>{let a=e(i);a instanceof tJ?r=a:r&&a&&r!==a&&(r=new tJ("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}(n);return c||s||u?c instanceof tJ?r7([c]):c instanceof rL&&!aa(i)?r7([new tJ("",'"interpolate" expressions cannot be used with this property')]):r9(c?new a_(o&&h?"camera":"composite",e.value,c.labels,c instanceof rL?c.interpolation:void 0,l,h):new am(o&&h?"constant":"source",e.value,l,h)):r7([new tJ("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ay{constructor(e,i){this._parameters=e,this._specification=i,tK(this,function e(i,r){let a,n,o,s="color"===r.type,l=i.stops&&"object"==typeof i.stops[0][0],h=l||!(l||void 0!==i.property),u=i.type||(aa(r)?"exponential":"interval");if(s&&((i=tK({},i)).stops&&(i.stops=i.stops.map(e=>[e[0],tZ.parse(e[1])])),i.default=tZ.parse(i.default?i.default:r.default)),i.colorSpace&&"rgb"!==i.colorSpace&&!rR[i.colorSpace])throw Error(`Unknown color space: ${i.colorSpace}`);if("exponential"===u)a=au;else if("interval"===u)a=ah;else if("categorical"===u){for(let e of(a=al,n=Object.create(null),i.stops))n[e[0]]=e[1];o=typeof i.stops[0][0]}else{if("identity"!==u)throw Error(`Unknown function type "${u}"`);a=ac}if(l){let a={},n=[];for(let e=0;e<i.stops.length;e++){let r=i.stops[e],o=r[0].zoom;void 0===a[o]&&(a[o]={zoom:o,type:i.type,property:i.property,default:i.default,stops:[]},n.push(o)),a[o].stops.push([r[0].value,r[1]])}let o=[];for(let i of n)o.push([a[i].zoom,e(a[i],r)]);let s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:rL.interpolationFactor.bind(void 0,s),zoomStops:o.map(e=>e[0]),evaluate:({zoom:e},a)=>au({stops:o,base:i.base},r,e).evaluate(e,a)}}if(h){let e="exponential"===u?{name:"exponential",base:void 0!==i.base?i.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:rL.interpolationFactor.bind(void 0,e),zoomStops:i.stops.map(e=>e[0]),evaluate:({zoom:e})=>a(i,r,e,n,o)}}return{kind:"source",evaluate(e,s){let l=s&&s.properties?s.properties[i.property]:void 0;return void 0===l?as(i.default,r.default):a(i,r,l,n,o)}}}(this._parameters,this._specification))}static deserialize(e){return new ay(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}var ax,av,ab=K(function(){if(av)return ax;function e(e,i,r){var a=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(i=n[1])+2*(r=n[2]);for(var o=0;o<this.d*this.d;
1o++){var s=n[3+o],l=n[3+o+1];a.push(s===l?null:n.subarray(s,l))}var h=n[3+a.length+1];this.keys=n.subarray(n[3+a.length],h),this.bboxes=n.subarray(h),this.insert=this._insertReadonly}else{this.d=i+2*r;for(var u=0;u<this.d*this.d;u++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=r,this.scale=i/e,this.uid=0;var c=r/i*e;this.min=-c,this.max=e+c}return av=1,ax=e,e.prototype.insert=function(e,i,r,a,n){this._forEachCell(i,r,a,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(e,i,r,a,n,o){this.cells[n].push(o)},e.prototype.query=function(e,i,r,a,n){var o=this.min,s=this.max;if(e<=o&&i<=o&&s<=r&&s<=a&&!n)return Array.prototype.slice.call(this.keys);var l=[];return this._forEachCell(e,i,r,a,this._queryCell,l,{},n),l},e.prototype._queryCell=function(e,i,r,a,n,o,s,l){var h=this.cells[n];if(null!==h)for(var u=this.keys,c=this.bboxes,d=0;d<h.length;d++){var p=h[d];if(void 0===s[p]){var f=4*p;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):e<=c[f+2]&&i<=c[f+3]&&r>=c[f+0]&&a>=c[f+1])?(s[p]=!0,o.push(u[p])):s[p]=!1}}},e.prototype._forEachCell=function(e,i,r,a,n,o,s,l){for(var h=this._convertToCellCoord(e),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a),p=h;p<=c;p++)for(var f=u;f<=d;f++){var m=this.d*f+p;if((!l||l(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&n.call(this,e,i,r,a,m,o,s,l))return}},e.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},e.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,i=3+this.cells.length+1+1,r=0,a=0;a<this.cells.length;a++)r+=this.cells[a].length;var n=new Int32Array(i+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;for(var o=i,s=0;s<e.length;s++){var l=e[s];n[3+s]=o,n.set(l,o),o+=l.length}return n[3+e.length]=o,n.set(this.keys,o),n[3+e.length+1]=o+=this.keys.length,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer},ax}());let aw={};function aT(e,i,r={}){Object.defineProperty(e,"_classRegistryKey",{value:i,writable:!1}),aw[i]={klass:e,omit:r.omit||[]}}for(let e in aT(Object,"Object"),ab.serialize=function(e,i){let r=e.toArrayBuffer();return i&&i.add(r),{buffer:r}},ab.deserialize=function(e){return new ab(e.buffer)},Object.defineProperty(ab,"name",{value:"Grid"}),aT(ab,"Grid"),"u">typeof DOMMatrix&&aT(DOMMatrix,"DOMMatrix"),aT(tZ,"Color"),aT(Error,"Error"),aT(ih,"Formatted"),aT(il,"FormattedSection"),aT(tT,"AJAXError"),aT(ic,"ResolvedImage"),aT(ay,"StylePropertyFunction"),aT(ad,"StyleExpression",{omit:["_evaluator"]}),aT(tU,"ImageId"),aT(iu,"ImageVariant"),aT(a_,"ZoomDependentExpression"),aT(am,"ZoomConstantExpression"),aT(iI,"CompoundExpression",{omit:["_evaluate"]}),r3)aw[r3[e]._classRegistryKey]||aT(r3[e],`Expression${e}`);function aS(e){return e&&"u">typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function aM(e){return self.ImageBitmap&&e instanceof ImageBitmap}function aE(e,i){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(aS(e)||aM(e))return i&&i.add(e),e;if(ArrayBuffer.isView(e))return i&&i.add(e.buffer),e;if(e instanceof ImageData)return i&&i.add(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let a of e)r.push(aE(a,i));return r}if(e instanceof Map){let i={$name:"Map",entries:[]};for(let[r,a]of e.entries())i.entries.push(aE(r),aE(a));return i}if(e instanceof Set){let i={$name:"Set"},r=0;for(let a of e.values())i[++r]=aE(a);return i}if(e instanceof DOMMatrix){let i={$name:"DOMMatrix"};for(let r of["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"])i[r]=e[r];return i}if("bigint"==typeof e)return{$name:"BigInt",value:e.toString()};if("object"==typeof e){let r=e.constructor,a=r._classRegistryKey;if(!a)throw Error(`Can't serialize object of unregistered class "${r.name}".`);let n=r.serialize?r.serialize(e,i):{};if(!r.serialize){for(let r in e)e.hasOwnProperty(r)&&(aw[a].omit.indexOf(r)>=0||(n[r]=aE(e[r],i)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(n.$name=a),n}throw Error("can't serialize object of type "+typeof e)}function aA(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||aS(e)||aM(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(aA);
1if("object"==typeof e){let i=e.$name||"Object";if("Map"===i){let i=e.entries||[],r=new Map;for(let e=0;e<i.length;e+=2)r.set(aA(i[e]),aA(i[e+1]));return r}if("Set"===i){let i=new Set;for(let r of Object.keys(e))"$name"!==r&&i.add(aA(e[r]));return i}if("DOMMatrix"===i)return new DOMMatrix(e.is2D?[e.a,e.b,e.c,e.d,e.e,e.f]:[e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44]);if("BigInt"===i)return BigInt(e.value);let{klass:r}=aw[i];if(!r)throw Error(`Can't deserialize unregistered class "${i}".`);if(r.deserialize)return r.deserialize(e);let a=Object.create(r.prototype);for(let i of Object.keys(e))"$name"!==i&&(a[i]=aA(e[i]));return a}throw Error("can't deserialize object of type "+typeof e)}let aI=e=>e>=1536&&e<=1791,aC=e=>e>=1872&&e<=1919,aP=e=>e>=2208&&e<=2303,az=e=>e>=6016&&e<=6143,aD=e=>e>=11904&&e<=12031,aR=e=>e>=12032&&e<=12255,aL=e=>e>=12272&&e<=12287,aO=e=>e>=12288&&e<=12351,ak=e=>e>=12352&&e<=12447,aF=e=>e>=12448&&e<=12543,aB=e=>e>=12544&&e<=12591,aN=e=>e>=12704&&e<=12735,aV=e=>e>=12736&&e<=12783,aU=e=>e>=12784&&e<=12799,aj=e=>e>=12800&&e<=13055,aG=e=>e>=13056&&e<=13311,aq=e=>e>=13312&&e<=19903,aZ=e=>e>=19968&&e<=40959,aH=e=>e>=40960&&e<=42127,a$=e=>e>=42128&&e<=42191,aW=e=>e>=44032&&e<=55215,aX=e=>e>=63744&&e<=64255,aY=e=>e>=64336&&e<=65023,aK=e=>e>=65040&&e<=65055,aJ=e=>e>=65072&&e<=65103,aQ=e=>e>=65104&&e<=65135,a0=e=>e>=65136&&e<=65279,a1=e=>e>=65280&&e<=65519;function a2(e){for(let i of e)if(a3(i.charCodeAt(0)))return!0;return!1}function a3(e){let i,r,a,n,o,s,l,h;return!(746!==e&&747!==e&&(e<4352||!(aN(e)||aB(e)||aJ(e)&&!(e>=65097&&e<=65103)||aX(e)||aG(e)||aD(e)||aV(e)||!(!aO(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||aq(e)||aZ(e)||aj(e)||(i=e)>=12592&&i<=12687||(r=e)>=43360&&r<=43391||(a=e)>=55216&&a<=55295||(n=e)>=4352&&n<=4607||aW(e)||ak(e)||aL(e)||(o=e)>=12688&&o<=12703||aR(e)||aU(e)||aF(e)&&12540!==e||!(!a1(e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!aQ(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||(s=e)>=5120&&s<=5759||(l=e)>=6320&&l<=6399||aK(e)||(h=e)>=19904&&h<=19967||aH(e)||a$(e))))}function a4(e){let i,r,a,n,o,s,l,h,u,c,d,p;return!(a3(e)||(i=e)>=128&&i<=255&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||(r=e)>=8192&&r<=8303&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||(a=e)>=8448&&a<=8527||(n=e)>=8528&&n<=8591||(o=e)>=8960&&o<=9215&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||(s=e)>=9216&&s<=9279&&9251!==e||(l=e)>=9280&&l<=9311||(h=e)>=9312&&h<=9471||(u=e)>=9632&&u<=9727||(c=e)>=9728&&c<=9983&&!(e>=9754&&e<=9759)||(d=e)>=11008&&d<=11263&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||aO(e)||aF(e)||(p=e)>=57344&&p<=63743||aJ(e)||aQ(e)||a1(e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}function a5(e){return e>=1424&&e<=2303||aY(e)||a0(e)}let a6="deferred",a8="loading",a9="loaded",a7=null,ne="unavailable",nt=null,ni=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(ne="error"),a7&&a7(e)};function nr(){na.fire(new tk("pluginStateChange",{pluginStatus:ne,pluginURL:nt}))}let na=new tV,nn=function(){return ne},no=function(){if(ne!==a6||!nt)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ne=a8,nr(),nt&&tE({url:nt},e=>{e?ni(e):(ne=a9,nr())})},ns={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ne===a9||null!=ns.applyArabicShaping,isLoading:()=>ne===a8,setState(e){ne=e.pluginStatus,nt=e.pluginURL},isParsed:()=>null!=ns.applyArabicShaping&&null!=ns.processBidirectionalText&&null!=ns.processStyledBidirectionalText,getPluginURL:()=>nt};class nl{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){var i,r=ns.isLoaded();
1for(let a of e)if(i=a.charCodeAt(0),!r&&a5(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||az(i))return!1;return!0}}class nh{constructor(e,i,r,a){this.property=e,this.value=i,this.expression=function(e,i,r,a){if(an(e))return new ay(e,i);if(ap(e)||Array.isArray(e)&&e.length>0){let n=ag(e,i,r,a);if("error"===n.result)throw Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return n.value}{let r=e;return"string"==typeof e&&"color"===i.type&&(r=tZ.parse(e)),{kind:"constant",configDependencies:new Set,evaluate:()=>r}}}(void 0===i?e.specification.default:i,e.specification,r,a)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,i,r){return this.property.possiblyEvaluate(this,e,i,r)}}class nu{constructor(e,i,r){this.property=e,this.value=new nh(e,void 0,i,r)}transitioned(e,i){return new nd(this.property,this.value,i,eZ({},e.transition,this.transition),e.now)}untransitioned(){return new nd(this.property,this.value,null,{},0)}}class nc{constructor(e,i,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=r,this.configDependencies=new Set}getValue(e){return eJ(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new nu(this._values[e].property,this._scope,this._options)),this._values[e].value=new nh(this._values[e].property,null===i?void 0:eJ(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);let r=this._properties.properties;if(e)for(let i in e){let a=e[i];if(i.endsWith("-transition")){let e=i.slice(0,-11);r[e]&&this.setTransition(e,a)}else r.hasOwnProperty(i)&&this.setValue(i,a)}}getTransition(e){return eJ(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new nu(this._values[e].property)),this._values[e].transition=eJ(i)||void 0}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r);let a=this.getTransition(i);void 0!==a&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){let r=new np(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(e,i._values[a]);return r}untransitioned(){let e=new np(this._properties);for(let i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class nd{constructor(e,i,r,a,n){const o=a.delay||0,s=a.duration||0;n=n||0,this.property=e,this.value=i,this.begin=n+o,this.end=this.begin+s,e.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(e,i,r){let a=e.now||0,n=this.value.possiblyEvaluate(e,i,r),o=this.prior;if(o){if(a>this.end||this.value.isDataDriven())return this.prior=null,n;if(a<this.begin)return o.possiblyEvaluate(e,i,r);{let s=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,i,r),n,eB(s))}}return n}}class np{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,r){let a=new n_(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class nf{constructor(e,i,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=r,this.configDependencies=new Set}getValue(e){return eJ(this._values[e].value)}setValue(e,i){this._values[e]=new nh(this._values[e].property,null===i?void 0:eJ(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r)}return e}possiblyEvaluate(e,i,r){let a=new n_(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}}class nm{constructor(e,i,r){this.property=e,this.value=i,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,i,r,a){return this.property.evaluate(this.value,this.parameters,e,i,r,a)}}class n_{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class ng{constructor(e){this.specification=e}
vendor: 6,647 bytes, line 1
1possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,r){let a=tY[this.specification.type];return a?a(e,i,r):e}}class ny{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,r,a){return new nm(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(i,null,{},r,a)}:e.expression,i)}interpolate(e,i,r){if("constant"!==e.value.kind||"constant"!==i.value.kind)return e;if(void 0===e.value.value||void 0===i.value.value)return new nm(this,{kind:"constant",value:void 0},e.parameters);let a=tY[this.specification.type];return a?new nm(this,{kind:"constant",value:a(e.value.value,i.value.value,r)},e.parameters):e}evaluate(e,i,r,a,n,o){return"constant"===e.kind?e.value:e.evaluate(i,r,a,n,o)}}class nx{constructor(e){this.specification=e}possiblyEvaluate(e,i,r,a){return!!e.expression.evaluate(i,null,{},r,a)}interpolate(){return!1}}class nv{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new nl(0,{});for(const r in e){const a=e[r];a.specification.overridable&&this.overridableProperties.push(r);const n=this.defaultPropertyValues[r]=new nh(a,void 0),o=this.defaultTransitionablePropertyValues[r]=new nu(a);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=n.possiblyEvaluate(i)}}}aT(ny,"DataDrivenProperty"),aT(ng,"DataConstantProperty"),aT(nx,"ColorRampProperty");var nb=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow","experimental":true},"rain":{"type":"rain","experimental":true},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor","experimental":true},"imports":{"type":"array","value":"import"},"iconsets":{"experimental":true,"type":"iconsets"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"experimental":true,"type":"featuresets"}},"featuresets":{"experimental":true,"*":{"type":"featureset"}},"featureset":{"experimental":true,"metadata":{"experimental":true,"type":"*"},"selectors":{"experimental":true,"type":"array","value":"selector"}},"selector":{"experimental":true,"layer":{"experimental":true,"type":"string","required":true},"properties":{"experimental":true,"type":"selectorProperty","required":false},"featureNamespace":{"experimental":true,"type":"string","required":false},"_uniqueFeatureID":{"experimental":true,"type":"boolean","private":true,"required":false}},"selectorProperty":{"experimental":true,"*":{"experimental":true,"type":"*"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","property-type":"data-constant","expression":{},"required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"property-type":"data-constant"},"shadow-quality":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]},"experimental":true},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"required":true,"type":"enum","values":{"sprite":1}},"url":{"required":true,"type":"string"}},"iconset_source":{"type":{"required":true,"type":"enum","values":{"source":1}}
1,"source":{"required":true,"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":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"experimental":true,"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"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":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{"experimental":true},"hillshade":{},"model":{"experimental":true},"background":{},"sky":{},"slot":{},"clip":{}},"required":true},"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"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{},"property-type":"data-constant"},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{},"property-type":"data-constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","experimental":true,"private":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","experimental":true,"expression":{},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","experimental":true,"default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","experimental":true,"expression":{},"property-type":"data-constant"},"line-cross-slope":{"type":"number","experimental":true,"expression":{},"property-type":"constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","experimental":true,"private":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","experimental":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","property-type":"data-constant","default":0.4,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","property-type":"data-constant","default":0.71,"minimum":0,"maximum":5,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"center-thinning":{"type":"number","property-type":"data-constant","default":0.57,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","property-type":"data-constant","default":0.7,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","experimental":true,"property-type":"data-constant","expression":{}},"buildingFeaturesetId":{"type":"string","experimental":true,"property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_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"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":
1{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","experimental":true,"private":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","transition":true,"experimental":true,"private":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"flat","property-type":"data-constant"},"fill-extrusion-base-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"terrain","property-type":"data-constant"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"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":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]},"experimental":true,"property-type":"data-constant"},"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":
1{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"*"}}}');function nw(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function nT(e){if(Array.isArray(e))return e.map(nT);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let i={};for(let r in e)i[r]=nT(e[r]);return i}return nw(e)}function nS(e){if(!0===e||!1===e)return!0;
1if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let i of e.slice(1))if(!nS(i)&&"boolean"!=typeof i)return!1;return!0;default:return!0}}function nM(e,i="",r=null,a="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};nS(e)||(e=function e(i){if(!i)return!0;let r=i[0];return i.length<=1?"any"!==r:"=="===r?nC(i[1],i[2],"=="):"!="===r?nD(nC(i[1],i[2],"==")):"<"===r||">"===r||"<="===r||">="===r?nC(i[1],i[2],r):"any"===r?["any"].concat(i.slice(1).map(e)):"all"===r?["all"].concat(i.slice(1).map(e)):"none"===r?["all"].concat(i.slice(1).map(e).map(nD)):"in"===r?nP(i[1],i.slice(2)):"!in"===r?nD(nP(i[1],i.slice(2))):"has"===r?nz(i[1]):"!has"!==r||nD(nz(i[1]))}(e));let n=e,o=!0;try{o=function(e){if(!nE(e))return e;let i=nT(e);return function e(i){let r=!1,a=[];if("case"===i[0]){for(let e=1;e<i.length-1;e+=2)r=r||nE(i[e]),a.push(i[e+1]);a.push(i[i.length-1])}else if("match"===i[0]){r=r||nE(i[1]);for(let e=2;e<i.length-1;e+=2)a.push(i[e+1]);a.push(i[i.length-1])}else if("step"===i[0]){r=r||nE(i[1]);for(let e=1;e<i.length-1;e+=2)a.push(i[e+1])}r&&(i.length=0,i.push("any",...a));for(let r=1;r<i.length;r++)e(i[r])}(i),i=function e(i){if(!Array.isArray(i))return i;let r=function(e){if(nA.has(e[0])){for(let i=1;i<e.length;i++)if(nE(e[i]))return!0}return e}(i);return!0===r?r:r.map(i=>e(i))}(i)}(n)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(n,null,2)} 7 `)}let s=null,l=null;if("background"!==a&&"sky"!==a&&"slot"!==a){let e=af(o,l=nb[`filter_${a}`],i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));s=(i,r,a)=>e.value.evaluate(i,r,{},a)}let h=null,u=null;if(o!==n){let e=af(n,l,i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));h=(i,r,a,n,o)=>e.value.evaluate(i,r,{},a,void 0,void 0,n,o),u=!ru(e.value.expression)}return{filter:s,dynamicFilter:h||void 0,needGeometry:function e(i){if(!Array.isArray(i))return!1;if("within"===i[0]||"distance"===i[0])return!0;for(let r=1;r<i.length;r++)if(e(i[r]))return!0;return!1}(o),needFeature:!!u}}function nE(e){var i;if(!Array.isArray(e))return!1;if("pitch"===(i=e[0])||"distance-from-center"===i)return!0;for(let i=1;i<e.length;i++)if(nE(e[i]))return!0;return!1}let nA=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function nI(e,i){return e<i?-1:+(e>i)}function nC(e,i,r){switch(e){case"$type":return[`filter-type-${r}`,i];case"$id":return[`filter-id-${r}`,i];default:return[`filter-${r}`,e,i]}}function nP(e,i){if(0===i.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(e=>typeof e!=typeof i[0])?["filter-in-large",e,["literal",i.sort(nI)]]:["filter-in-small",e,["literal",i]]}}function nz(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function nD(e){return["!",e]}function nR(e,i){return i?`${e}�${i}`:e}let nL="-transition",nO=new Set(["fill","line","background","hillshade","raster"]);class nk extends tV{constructor(e,i,r,a,n){if(super(),this.id=e.id,this.fqid=nR(this.id,r),this.type=e.type,this.scope=r,this.lut=a,this.options=n,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const i=af(this.filter,nb[`filter_${e.type}`]);"error"!==i.result&&(this.configDependencies=new Set([...this.configDependencies,...i.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new nf(i.layout,this.scope,n),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){for(const r in this._transitionablePaint=new nc(i.paint,this.scope,n),e.paint)this.setPaintProperty(r,e.paint[r]);for(const i in e.layout)this.setLayoutProperty(i,e.layout[i]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new n_(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&nO.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if("custom"===this.type&&"visibility"===e)return void(this.visibility=i);let r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...r.configDependencies]),"visibility"===e&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(nL)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){let r=this._transitionablePaint,a=r._properties.properties;if(e.endsWith(nL)){let n=e.slice(0,-11);return a[n]&&r.setTransition(n,i||void 0),!1}if(!a[e])return!1;let n=r._values[e],o=n.value.isDataDriven(),s=n.value;r.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...r.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);let l=r._values[e].value,h=l.isDataDriven(),u=e.endsWith("pattern")||"line-dasharray"===e;return h||o||u||this._handleOverridablePaintPropertyUpdate(e,s,l)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,r){return null}_handleOverridablePaintPropertyUpdate(e,i,r){return!1}
7isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return eK({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()},(e,i)=>!(void 0===e||"layout"===i&&!Object.keys(e).length||"paint"===i&&!Object.keys(e).length))}is3D(e){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(let e in this.paint._values){let i=this.paint.get(e);if(i instanceof nm&&at(i.property.specification)&&("source"===i.value.kind||"composite"===i.value.kind)&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=nM(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,r,a,n,o,s,l,h){}}let nF={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
7class nB{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class nN{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let i=this.uint8;this._refreshViews(),i&&this.uint8.set(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 nV(e,i=1){let r=0,a=0;return{members:e.map(e=>{let n=nF[e.type].BYTES_PER_ELEMENT,o=r=nU(r,Math.max(i,n)),s=e.components||1;return a=Math.max(a,n),r+=n*s,{name:e.name,type:e.type,components:s,offset:o}}),size:nU(r,Math.max(a,i)),alignment:i}}function nU(e,i){return Math.ceil(e/i)*i}class nj extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.int16[a+0]=i,this.int16[a+1]=r,e}}nj.prototype.bytesPerElement=4,aT(nj,"StructArrayLayout2i4");class nG extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,e}}nG.prototype.bytesPerElement=6,aT(nG,"StructArrayLayout3i6");class nq extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.int16[o+0]=i,this.int16[o+1]=r,this.int16[o+2]=a,this.int16[o+3]=n,e}}nq.prototype.bytesPerElement=8,aT(nq,"StructArrayLayout4i8");class nZ extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[+e+0]=i,e}}nZ.prototype.bytesPerElement=4,aT(nZ,"StructArrayLayout1f4");class nH extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=4*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.float32[2*e+1]=a,e}}nH.prototype.bytesPerElement=8,aT(nH,"StructArrayLayout2i1f8");class n$ extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=4*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,e}}n$.prototype.bytesPerElement=8,aT(n$,"StructArrayLayout3i8");class nW extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=5*e;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,this.int16[s+3]=n,this.int16[s+4]=o,e}}nW.prototype.bytesPerElement=10,aT(nW,"StructArrayLayout5i10");class nX extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=6*e,u=12*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.uint8[u+4]=a,this.uint8[u+5]=n,this.uint8[u+6]=o,this.uint8[u+7]=s,this.float32[3*e+2]=l,e}}nX.prototype.bytesPerElement=12,aT(nX,"StructArrayLayout2i4ub1f12");class nY extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,e}}nY.prototype.bytesPerElement=12,aT(nY,"StructArrayLayout3f12");class nK extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=6*e;return this.uint16[s+0]=i,this.uint16[s+1]=r,this.uint16[s+2]=a,this.uint16[s+3]=n,this.float32[3*e+2]=o,e}}nK.prototype.bytesPerElement=12,aT(nK,"StructArrayLayout4ui1f12");class nJ extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.uint16[o+0]=i,this.uint16[o+1]=r,this.uint16[o+2]=a,this.uint16[o+3]=n,e}}nJ.prototype.bytesPerElement=8,aT(nJ,"StructArrayLayout4ui8");class nQ extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=6*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=o,this.int16[l+5]=s,e}}nQ.prototype.bytesPerElement=12,aT(nQ,"StructArrayLayout6i12");class n0 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,e,i,r,a,n,o,s,l,h,u,c,d)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=12*e;return this.int16[f+0]=i,this.int16[f+1]=r,this.int16[f+2]=a,this.int16[f+3]=n,this.uint16[f+4]=o,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=h,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=d,this.int16[f+11]=p,e}}n0.prototype.bytesPerElement=24,aT(n0,"StructArrayLayout4i4ui4i24");class n1 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=10*e,h=5*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,e}}n1.prototype.bytesPerElement=20,aT(n1,"StructArrayLayout3i3f20");class n2 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=4*e;return this.float32[o+0]=i,this.float32[o+1]=r,this.float32[o+2]=a,this.float32[o+3]=n,e}}n2.prototype.bytesPerElement=16,aT(n2,"StructArrayLayout4f16");class n3 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[+e+0]=i,e}}n3.prototype.bytesPerElement=4,aT(n3,"StructArrayLayout1ul4");class n4 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;
7return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=r,e}}n4.prototype.bytesPerElement=4,aT(n4,"StructArrayLayout2ui4");class n5 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,a,n,o,s,l,h,u,c,d,p)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f){let m=20*e,_=10*e;return this.int16[m+0]=i,this.int16[m+1]=r,this.int16[m+2]=a,this.int16[m+3]=n,this.int16[m+4]=o,this.float32[_+3]=s,this.float32[_+4]=l,this.float32[_+5]=h,this.float32[_+6]=u,this.int16[m+14]=c,this.uint32[_+8]=d,this.uint16[m+18]=p,this.uint16[m+19]=f,e}}n5.prototype.bytesPerElement=40,aT(n5,"StructArrayLayout5i4f1i1ul2ui40");class n6 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=8*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=a,this.int16[h+4]=n,this.int16[h+5]=o,this.int16[h+6]=s,this.int16[h+7]=l,e}}n6.prototype.bytesPerElement=16,aT(n6,"StructArrayLayout3i2i2i16");class n8 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=4*e,l=8*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.int16[l+6]=n,this.int16[l+7]=o,e}}n8.prototype.bytesPerElement=16,aT(n8,"StructArrayLayout2f1f2i16");class n9 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n,o)}emplace(e,i,r,a,n,o,s){let l=20*e,h=5*e;return this.uint8[l+0]=i,this.uint8[l+1]=r,this.float32[h+1]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,e}}n9.prototype.bytesPerElement=20,aT(n9,"StructArrayLayout2ub4f20");class n7 extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.uint16[n+0]=i,this.uint16[n+1]=r,this.uint16[n+2]=a,e}}n7.prototype.bytesPerElement=6,aT(n7,"StructArrayLayout3ui6");class oe extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=this.length;return this.resize(w+1),this.emplace(w,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=30*e,S=15*e,M=60*e;return this.int16[T+0]=i,this.int16[T+1]=r,this.int16[T+2]=a,this.float32[S+2]=n,this.float32[S+3]=o,this.uint16[T+8]=s,this.uint16[T+9]=l,this.uint32[S+5]=h,this.uint32[S+6]=u,this.uint32[S+7]=c,this.uint16[T+16]=d,this.uint16[T+17]=p,this.uint16[T+18]=f,this.float32[S+10]=m,this.float32[S+11]=_,this.uint8[M+48]=g,this.uint8[M+49]=y,this.uint8[M+50]=x,this.uint32[S+13]=v,this.int16[T+28]=b,this.uint8[M+58]=w,e}}oe.prototype.bytesPerElement=60,aT(oe,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class ot extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,z,D,R){let L=this.length;return this.resize(L+1),this.emplace(L,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,z,D,R)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,z,D,R,L){let O=20*e,k=40*e;return this.float32[O+0]=i,this.float32[O+1]=r,this.int16[k+4]=a,this.int16[k+5]=n,this.int16[k+6]=o,this.int16[k+7]=s,this.int16[k+8]=l,this.int16[k+9]=h,this.int16[k+10]=u,this.int16[k+11]=c,this.int16[k+12]=d,this.uint16[k+13]=p,this.uint16[k+14]=f,this.uint16[k+15]=m,this.uint16[k+16]=_,this.uint16[k+17]=g,this.uint16[k+18]=y,this.uint16[k+19]=x,this.uint16[k+20]=v,this.uint16[k+21]=b,this.uint16[k+22]=w,this.uint16[k+23]=T,this.uint16[k+24]=S,this.uint16[k+25]=M,this.uint16[k+26]=E,this.uint16[k+27]=A,this.uint32[O+14]=I,this.float32[O+15]=C,this.float32[O+16]=P,this.float32[O+17]=z,this.float32[O+18]=D,this.uint8[80*e+76]=R,this.uint16[k+39]=L,e}}ot.prototype.bytesPerElement=80,aT(ot,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class oi extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,i,r,a,n)}emplace(e,i,r,a,n,o){let s=5*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.float32[s+3]=n,this.float32[s+4]=o,e}}oi.prototype.bytesPerElement=20,aT(oi,"StructArrayLayout5f20");class or extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=7*e;return this.float32[h+0]=i,this.float32[h+1]=r,this.float32[h+2]=a,this.float32[h+3]=n,this.float32[h+4]=o,this.float32[h+5]=s,this.float32[h+6]=l,e}}or.prototype.bytesPerElement=28,aT(or,"StructArrayLayout7f28");class oa extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,i,r,a,n,o,s,l,h,u,c)}emplace(e,i,r,a,n,o,s,l,h,u,c,d){let p=11*e;return this.float32[p+0]=i,this.float32[p+1]=r,this.float32[p+2]=a,this.float32[p+3]=n,this.float32[p+4]=o,this.float32[p+5]=s,this.float32[p+6]=l,this.float32[p+7]=h,this.float32[p+8]=u,this.float32[p+9]=c,this.float32[p+10]=d,e}}oa.prototype.bytesPerElement=44,aT(oa,"StructArrayLayout11f44");class on extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,e,i,r,a,n,o,s,l,h)}emplace(e,i,r,a,n,o,s,l,h,u){let c=9*e;return this.float32[c+0]=i,this.float32[c+1]=r,this.float32[c+2]=a,this.float32[c+3]=n,this.float32[c+4]=o,this.float32[c+5]=s,this.float32[c+6]=l,this.float32[c+7]=h,this.float32[c+8]=u,e}}on.prototype.bytesPerElement=36,aT(on,"StructArrayLayout9f36");class oo extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;
7return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.float32[a+0]=i,this.float32[a+1]=r,e}}oo.prototype.bytesPerElement=8,aT(oo,"StructArrayLayout2f8");class os extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let o=6*e;return this.uint32[3*e+0]=i,this.uint16[o+2]=r,this.uint16[o+3]=a,this.uint16[o+4]=n,e}}os.prototype.bytesPerElement=12,aT(os,"StructArrayLayout1ul3ui12");class ol extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[+e+0]=i,e}}ol.prototype.bytesPerElement=2,aT(ol,"StructArrayLayout1ui2");class oh extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=this.length;return this.resize(g+1),this.emplace(g,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=16*e;return this.float32[y+0]=i,this.float32[y+1]=r,this.float32[y+2]=a,this.float32[y+3]=n,this.float32[y+4]=o,this.float32[y+5]=s,this.float32[y+6]=l,this.float32[y+7]=h,this.float32[y+8]=u,this.float32[y+9]=c,this.float32[y+10]=d,this.float32[y+11]=p,this.float32[y+12]=f,this.float32[y+13]=m,this.float32[y+14]=_,this.float32[y+15]=g,e}}oh.prototype.bytesPerElement=64,aT(oh,"StructArrayLayout16f64");class ou extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,o,s)}emplace(e,i,r,a,n,o,s,l){let h=10*e,u=5*e;return this.uint16[h+0]=i,this.uint16[h+1]=r,this.uint16[h+2]=a,this.uint16[h+3]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,e}}ou.prototype.bytesPerElement=20,aT(ou,"StructArrayLayout4ui3f20");class oc extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[+e+0]=i,e}}oc.prototype.bytesPerElement=2,aT(oc,"StructArrayLayout1i2");class od extends nN{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[+e+0]=i,e}}od.prototype.bytesPerElement=1,aT(od,"StructArrayLayout1ub1");class op extends nB{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]}}op.prototype.size=40;class of extends n5{get(e){return new op(this,e)}}aT(of,"CollisionBoxArray");class om extends nB{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]}
7get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}om.prototype.size=60;class o_ extends oe{get(e){return new om(this,e)}}aT(o_,"PlacedSymbolArray");class og extends nB{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}og.prototype.size=80;class oy extends ot{get(e){return new og(this,e)}}aT(oy,"SymbolInstanceArray");class ox extends nZ{getoffsetX(e){return this.float32[+e+0]}}aT(ox,"GlyphOffsetArray");class ov extends nj{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}aT(ov,"SymbolLineVertexArray");class ob extends nB{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]}}ob.prototype.size=12;class ow extends os{get(e){return new ob(this,e)}}aT(ow,"FeatureIndexArray");class oT extends n4{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}aT(oT,"FillExtrusionCentroidArray");class oS extends nB{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]}}oS.prototype.size=6;class oM extends nG{get(e){return new oS(this,e)}}aT(oM,"FillExtrusionWallArray");let oE=nV([{name:"a_pos",components:2,type:"Int16"}],4),oA=nV([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class oI{constructor(e=[]){this.segments=e}_prepareSegment(e,i,r,a){let n=this.segments[this.segments.length-1];return e>oI.MAX_VERTEX_ARRAY_LENGTH&&e0(`Max vertices per segment is ${oI.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>oI.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a)&&(n={vertexOffset:i,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==a&&(n.sortKey=a),this.segments.push(n)),n}prepareSegment(e,i,r,a){return this._prepareSegment(e,i.length,r.length,a)}get(){return this.segments}destroy(){for(let e of this.segments)for(let i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,r,a){return new oI([{vertexOffset:e,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}}function oC(e,i){return 256*(e=eU(Math.floor(e),0,255))+eU(Math.floor(i),0,255)}oI.MAX_VERTEX_ARRAY_LENGTH=65535,aT(oI,"SegmentVector");let oP=nV([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),oz=nV([{name:"a_dash",components:4,type:"Uint16"}]);class oD{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
7add(e,i,r,a){this.ids.push(oR(e)),this.positions.push(i,r,a)}eachPosition(e,i){let r=oR(e),a=0,n=this.ids.length-1;for(;a<n;){let e=a+n>>1;this.ids[e]>=r?n=e:a=e+1}for(;this.ids[a]===r;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){let r=new Float64Array(e.ids),a=new Uint32Array(e.positions);return function e(i,r,a,n){for(;a<n;){let o=i[a+n>>1],s=a-1,l=n+1;for(;;){do s++;while(i[s]<o);do l--;while(i[l]>o);if(s>=l)break;oL(i,s,l),oL(r,3*s,3*l),oL(r,3*s+1,3*l+1),oL(r,3*s+2,3*l+2)}l-a<n-l?(e(i,r,a,l),a=l+1):(e(i,r,l+1,n),n=l)}}(r,a,0,r.length-1),i&&(i.add(r.buffer),i.add(a.buffer)),{ids:r,positions:a}}static deserialize(e){let i,r=new oD;for(let a of(r.ids=e.ids,r.positions=e.positions,r.ids))a!==i&&r.uniqueIds.push(a),i=a;return r.indexed=!0,r}}function oR(e){let i=+e;return!isNaN(i)&&Number.MIN_SAFE_INTEGER<=i&&i<=Number.MAX_SAFE_INTEGER?i:tO(String(e))}function oL(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}aT(oD,"FeaturePositionMap");class oO{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,r){throw Error("Uniform#set() must be implemented by each concrete Uniform")}}class ok extends oO{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}}class oF extends oO{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class oB extends oO{constructor(e){super(e),this.current=[0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])))}}class oN extends oO{constructor(e){super(e),this.current=[0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])))}}class oV extends oO{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class oU extends oO{constructor(e){super(e),this.current=tZ.transparent.toRenderColor(null)}set(e,i,r){this.fetchUniformLocation(e,i)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}let oj=new Float32Array(16);class oG extends oO{constructor(e){super(e),this.current=oj}set(e,i,r){if(this.fetchUniformLocation(e,i)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}let oq=new Float32Array(9),oZ=new Float32Array(4);class oH extends oO{constructor(e){super(e),this.current=oZ}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let e=0;e<4;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}}function o$(e){return[oC(255*e.r,255*e.g),oC(255*e.b,255*e.a)]}class oW{constructor(e,i,r,a){this.value=e,this.uniformNames=i.map(e=>`u_${e}`),this.type=r,this.context=a}setUniform(e,i,r,a,n){let o=a.constantOr(this.value);i.set(e,n,o instanceof tZ?o.toRenderColor(this.lutExpression&&"none"===this.lutExpression.value?null:this.context.lut):o)}getBinding(e,i){return"color"===this.type?new oU(e):new oF(e)}}class oX{constructor(e,i){this.uniformNames=i.map(e=>`u_${e}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,r,a,n){let o="u_pattern"===n||"u_dash"===n?this.pattern:"u_pixel_ratio"===n?this.pixelRatio:null;o&&i.set(e,n,o)}getBinding(e,i){return"u_pattern"===i||"u_dash"===i?new oV(e):new oF(e)}}class oY{constructor(e,i,r,a){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,r,a,n,o,s){let l=this.paintVertexArray.length,h="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new nl(0,{brightness:o}),i,{},n,a,s):"constant"===this.expression.kind&&this.expression.value,u=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new nl(0,{brightness:o}),i,{},n,a,s):this.lutExpression.value);this.paintVertexArray.resize(e),this._setPaintValue(l,e,h,u?null:this.context.lut)}updatePaintArray(e,i,r,a,n,o,s){let l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:s},r,a,void 0,n):"constant"===this.expression.kind&&this.expression.value,h=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new nl(0,{brightness:s}),r,a,void 0,n):this.lutExpression.value);this._setPaintValue(e,i,l,h?null:this.context.lut)}_setPaintValue(e,i,r,a){if("color"===this.type){let n=o$(r.toRenderColor(a));for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let a=e;a<i;a++)this.paintVertexArray.emplace(a,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&"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 oK{constructor(e,i,r,a,n,o){this.expression=e,this.uniformNames=i.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=a,this.context=n,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate(new nl(this.context.zoom,{brightness:o}),i,{},n,a,s),h=this.expression.evaluate(new nl(this.context.zoom+1,{brightness:o}),i,{},n,a,s),u=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new nl(0,{brightness:o}),i,{}
7,n,a,s):this.lutExpression.value),c=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(c,e,l,h,u?null:this.context.lut)}updatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate({zoom:this.context.zoom,brightness:s},r,a,void 0,n),h=this.expression.evaluate({zoom:this.context.zoom+1,brightness:s},r,a,void 0,n),u=!!this.lutExpression&&"none"===("composite"===this.lutExpression.kind||"source"===this.lutExpression.kind?this.lutExpression.evaluate(new nl(0,{brightness:s}),r,a,void 0,n):this.lutExpression.value);this._setPaintValue(e,i,l,h,u?null:this.context.lut)}_setPaintValue(e,i,r,a,n){if("color"===this.type){let a=o$(r.toRenderColor(n)),o=o$(r.toRenderColor(n));for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,a[0],a[1],o[0],o[1])}else{for(let n=e;n<i;n++)this.paintVertexArray.emplace(n,r,a);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,r,a,n){let o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,s=eU(this.expression.interpolationFactor(o,this.context.zoom,this.context.zoom+1),0,1);i.set(e,n,s)}getBinding(e,i){return new oF(e)}}class oJ{constructor(e,i,r,a,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===r?oz:oP).members;for(let e=0;e<i.length;++e);this.paintVertexArray=new a}populatePaintArray(e,i,r,a){let n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(n,e,i.patterns&&i.patterns[this.layerId],r)}updatePaintArray(e,i,r,a,n,o,s){this._setPaintValues(e,i,r.patterns&&r.patterns[this.layerId],o)}_setPaintValues(e,i,r,a){if(!a||!r)return;let n=a[r];if(!n)return;let{tl:o,br:s,pixelRatio:l}=n;for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,o[0],o[1],s[0],s[1],l)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class oQ{constructor(e,i,r=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const n in e.paint._values){const o=e.paint.get(n);if(n.endsWith("-use-theme")||!r(n)||!(o instanceof nm&&at(o.property.specification)))continue;const s=function(e,i){return o1[e]||[e.replace(`${i}-`,"").replace(/-/g,"_")]}(n,e.type),l=o.value,h=o.property.specification.type,u=!!o.property.useIntegerZoom,c="line-dasharray"===n||n.endsWith("pattern"),d=e.paint.get(`${n}-use-theme`),p="line-dasharray"===n&&"constant"!==e.layout.get("line-cap").value.kind||d&&"constant"!==d.value.kind;if("constant"!==l.kind||p)if("source"===l.kind||p||c){const i=o4(n,h,"source");this.binders[n]=c?new oJ(l,s,h,i,e.id):new oY(l,s,h,i),a.push(`/a_${n}`)}else{const e=o4(n,h,"composite");this.binders[n]=new oK(l,s,h,u,i,e),a.push(`/z_${n}`)}else this.binders[n]=c?new oX(l.value,s):new oW(l.value,s,h,i),a.push(`/u_${n}`);d&&(this.binders[n].lutExpression=d.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){let i=this.binders[e];return i instanceof oY||i instanceof oK?i.maxValue:0}populatePaintArrays(e,i,r,a,n,o,s){for(let l in this.binders){let h=this.binders[l];h.context=this.context,(h instanceof oY||h instanceof oK||h instanceof oJ)&&h.populatePaintArray(e,i,r,a,n,o,s)}}setConstantPatternPositions(e){for(let i in this.binders){let r=this.binders[i];r instanceof oX&&r.setConstantPatternPositions(e)}}updatePaintArrays(e,i,r,a,n,o,s,l,h){let u=!1,c=Object.keys(e),d=0!==c.length&&!l,p=d?c:i.uniqueIds;for(let l in this.context.lut=n.lut,this.binders){let c=this.binders[l];if(c.context=this.context,(c instanceof oY||c instanceof oK||c instanceof oJ)&&c.expression&&c.expression.kind&&"constant"!==c.expression.kind&&(!0===c.expression.isStateDependent||!1===c.expression.isLightConstant)){for(let r of(c.expression=n.paint.get(l).value,p)){let n=e[r.toString()];i.eachPosition(r,(e,i,r)=>{let l=a.feature(e);c.updatePaintArray(i,r,l,n,o,s,h)})}if(!d)for(let i of r.uniqueIds){let n=e[i.toString()];r.eachPosition(i,(e,i,r)=>{let l=a.feature(e);c.updatePaintArray(i,r,l,n,o,s,h)})}u=!0}}return u}defines(){let e=[];for(let i in this.binders){let r=this.binders[i];(r instanceof oW||r instanceof oX)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof oY||r instanceof oK||r instanceof oJ)for(let i=0;i<r.paintVertexAttributes.length;i++)e.push(r.paintVertexAttributes[i].name)}return e}getBinderUniforms(){let e=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof oW||r instanceof oX||r instanceof oK)for(let i of r.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){let i=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof oW||a instanceof oX||a instanceof oK)for(let n of a.uniformNames)i.push({name:n,property:r,binding:a.getBinding(e,n)})}return i}setUniforms(e,i,r,a,n){for(let{name:i,property:o,binding:s}of r)this.binders[o].setUniform(e,s,n,a.get(o),i)}updatePaintBuffers(){for(let e in this._buffers=[],this.binders){let i=this.binders[e];(i instanceof oY||i instanceof oK||i instanceof oJ)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let i in this.binders){let r=this.binders[i];(r instanceof oY||r instanceof oK||r instanceof oJ)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let i=this.binders[e];(i instanceof oY||i instanceof oK||i instanceof oJ)&&i.destroy()}}}class o0{constructor(e,i,r=()=>!0){for(const a of(this.programConfigurations={},e))this.programConfigurations[a.id]=new oQ(a,i,r);this.needsUpload=!1,this._featureMap=new oD,this._featureMapWithoutIds=new oD,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,r,a,n,o,s,l){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,i,a,n,o,s,l);void 0!==i.id?this._featureMap.add(i.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,r,a,n,o,s){for(let l of r)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,l,a,n,o,s||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}let o1={"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"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]},o2={"line-pattern":{source:nK,composite:nK},"fill-pattern":{source:nK,composite:nK},"fill-extrusion-pattern":{source:nK,composite:nK},"line-dasharray":{source:nJ,composite:nJ}},o3={color:{source:oo,composite:n2},number:{source:nZ,composite:oo}};function o4(e,i,r){let a=o2[e];return a&&a[r]||o3[i][r]}aT(oW,"ConstantBinder"),aT(oX,"PatternConstantBinder"),aT(oY,"SourceExpressionBinder"),aT(oJ,"PatternCompositeBinder"),aT(oK,"CompositeExpressionBinder"),aT(oQ,"ProgramConfiguration",{omit:["_buffers"]}),aT(o0,"ProgramConfigurationSet");let o5=8192/Math.PI/2,o6=[64,32,16],o8=-o5;function o9(e,i,r,a=o5){return[e*Math.sin(r*=eO)*a,-i*a,e*Math.cos(r)*a]}function o7(e,i,r){return o9(Math.cos(e*eO),Math.sin(e*eO),i,r)}let se=2*Math.PI*6371008.8;class st{constructor(e,i){if(isNaN(e)||isNaN(i))throw Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new st(eG(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let i=Math.PI/180,r=this.lat*i,a=e.lat*i;return 6371008.8*Math.acos(Math.min(Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((e.lng-this.lng)*i),1))}toBounds(e=0){let i=360*e/0x2637f09,r=i/Math.cos(Math.PI/180*this.lat);return new si({lng:this.lng-r,lat:this.lat-i},{lng:this.lng+r,lat:this.lat+i})}toEcef(e){return o7(this.lat,this.lng,o5+e*o5/6371008.8)}static convert(e){if(e instanceof st)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new st(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new st(Number("lng"in e?e.lng:e.lon),Number(e.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 si{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof st?new st(e.lng,e.lat):st.convert(e),this}setSouthWest(e){return this._sw=e instanceof st?new st(e.lng,e.lat):st.convert(e),this}extend(e){let i,r,a=this._sw,n=this._ne;if(e instanceof st)i=e,r=e;else{if(!(e instanceof si))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(si.convert(e)):this.extend(st.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(st.convert(e)):this;if(i=e._sw,r=e._ne,!i||!r)return this}return a||n?(a.lng=Math.min(i.lng,a.lng),a.lat=Math.min(i.lat,a.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new st(i.lng,i.lat),this._ne=new st(r.lng,r.lat)),this}getCenter(){return new st((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new st(this.getWest(),this.getNorth())}getSouthEast(){return new st(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:i,lat:r}=st.convert(e),a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&a}static convert(e){if(e)return e instanceof si?e:new si(e)}}function sr(e){return se*Math.cos(e*Math.PI/180)}function sa(e){return(180+e)/360}function sn(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function so(e){return 360*e-180}function ss(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180)
7)-90}function sl(e,i){return e*sr(ss(i))}function sh(e){return Math.cos(eU(e,-85.051129,85.051129)*eO)}function su(e,i){let r=Math.pow(2,eU(i,0,25.5));return sh(e)*se/(512*r)}function sc(e){return 1/Math.cos(e*Math.PI/180)}function sd(e,i=0){let r=Math.exp(Math.PI*(1-(e.y+i/8192)/(1<<e.z)*2));return 0x4c6fe12*r/(r*r+1)/8192/(1<<e.z)}class sp{constructor(e,i,r=0){this.x=+e,this.y=+i,this.z=+r}static fromLngLat(e,i=0){let r=st.convert(e);return new sp(sa(r.lng),sn(r.lat),i/sr(r.lat))}toLngLat(){return new st(so(this.x),ss(this.y))}toAltitude(){return sl(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/se*sc(ss(this.y))}}function sf(e,i,r){let a=e[0],n=a.x,o=a.y;i(a);let s=[a];for(let l=1;l<e.length;l++){let h=e[l],{x:u,y:c}=h;i(h),function e(i,r,a,n,o,s,l,h,u){var c,d,p,f,m,_;let g,y,x=(r+n)/2,v=(a+o)/2,b=new eR(x,v);h(b),(c=b.x,d=b.y,p=s.x,f=s.y,m=l.x,_=l.y,g=p-m,y=f-_,Math.abs((f-d)*g-(p-c)*y)/Math.hypot(g,y)>=u)?(e(i,r,a,x,v,s,b,h,u),e(i,x,v,n,o,b,l,h,u)):i.push(l)}(s,n,o,u,c,a,h,i,r),n=u,o=c,a=h}return s}let sm=-16383-1;function s_(e,i,r){let a=e.loadGeometry(),n=e.extent,o=8192/n;if(i&&r&&r.projection.isReprojectedInTileSpace){let o=1<<i.z,{scale:s,x:l,y:h,projection:u}=r,c=e=>{let r=so((i.x+e.x/n)/o),a=ss((i.y+e.y/n)/o),c=u.project(r,a);e.x=(c.x*s-l)*n,e.y=(c.y*s-h)*n};for(let i=0;i<a.length;i++)if(1!==e.type)a[i]=sf(a[i],c,1);else{let e=[];for(let r of a[i])r.x<0||r.x>=n||r.y<0||r.y>=n||(c(r),e.push(r));a[i]=e}}for(let e of a)for(let i of e)!function(e,i){let r=Math.round(e.x*i),a=Math.round(e.y*i);e.x=eU(r,sm,16383),e.y=eU(a,sm,16383),(r<e.x||r>e.x+1||a<e.y||a>e.y+1)&&e0("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(i,o);return a}function sg(e,i){return{type:e.type,id:e.id,properties:e.properties,geometry:i?s_(e):[]}}function sy(e,i,r,a,n){e.emplaceBack(2*i+(a+1)/2,2*r+(n+1)/2)}function sx(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class sv{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new nj,this.indexArray=new n7,this.segments=new oI,this.programConfigurations=new o0(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}updateFootprints(e,i){}populate(e,i,r,a){let n=this.layers[0],o=[],s=null;for(let{feature:i,id:l,index:h,sourceLayerIndex:u}of("circle"===n.type&&(s=n.layout.get("circle-sort-key")),e)){let e=this.layers[0]._featureFilter.needGeometry,n=sg(i,e);if(!this.layers[0]._featureFilter.filter(new nl(this.zoom),n,r))continue;let c=s?s.evaluate(n,{},r):void 0,d={id:l,properties:i.properties,type:i.type,sourceLayerIndex:u,index:h,geometry:e?n.geometry:s_(i,r,a),patterns:{},sortKey:c};o.push(d)}s&&o.sort((e,i)=>e.sortKey-i.sortKey);let l=null;for(let n of("globe"===a.projection.name&&(this.globeExtVertexArray=new nQ,l=a.projection),o)){let{geometry:a,index:o,sourceLayerIndex:s}=n,h=e[o].feature;this.addFeature(n,a,o,i.availableImages,r,l,i.brightness),i.featureIndex.insert(h,a,o,s,this.index)}}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,oE.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,oA.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,r,a,n,o,s){for(let r of i)for(let i of r){let r=i.x,a=i.y;if(r<0||r>=8192||a<0||a>=8192)continue;if(o){let e=o.projectTilePoint(r,a,n),i=o.upVector(n,r,a),s=this.globeExtVertexArray;sx(s,e,i),sx(s,e,i),sx(s,e,i),sx(s,e,i)}let s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),l=s.vertexLength;sy(this.layoutVertexArray,r,a,-1,-1),sy(this.layoutVertexArray,r,a,1,-1),sy(this.layoutVertexArray,r,a,1,1),sy(this.layoutVertexArray,r,a,-1,1),this.indexArray.emplaceBack(l,l+1,l+2),this.indexArray.emplaceBack(l,l+2,l+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},a,n,s)}}
7function sb(e,i){for(let r=0;r<e.length;r++)if(sA(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(sA(e,i[r]))return!0;return!!sT(e,i)}function sw(e,i){if(1===e.length)return sE(i,e[0]);for(let r=0;r<i.length;r++){let a=i[r];for(let i=0;i<a.length;i++)if(sA(e,a[i]))return!0}for(let r=0;r<e.length;r++)if(sE(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(sT(e,i[r]))return!0;return!1}function sT(e,i){if(0===e.length||0===i.length)return!1;for(let s=0;s<e.length-1;s++){let l=e[s],h=e[s+1];for(let e=0;e<i.length-1;e++){var r,a,n,o;if(r=l,a=h,n=i[e],e1(r,n,o=i[e+1])!==e1(a,n,o)&&e1(r,a,n)!==e1(r,a,o))return!0}}return!1}function sS(e,i,r){let a=r*r;if(1===i.length)return e.distSqr(i[0])<a;for(let r=1;r<i.length;r++)if(sM(e,i[r-1],i[r])<a)return!0;return!1}function sM(e,i,r){let a=i.distSqr(r);if(0===a)return e.distSqr(i);let n=((e.x-i.x)*(r.x-i.x)+(e.y-i.y)*(r.y-i.y))/a;return e.distSqr(n<0?i:n>1?r:r.sub(i)._mult(n)._add(i))}function sE(e,i){let r,a,n,o=!1;for(let s=0;s<e.length;s++){r=e[s];for(let e=0,s=r.length-1;e<r.length;s=e++)a=r[e],n=r[s],a.y>i.y!=n.y>i.y&&i.x<(n.x-a.x)*(i.y-a.y)/(n.y-a.y)+a.x&&(o=!o)}return o}function sA(e,i){let r=!1;for(let a=0,n=e.length-1;a<e.length;n=a++){let o=e[a],s=e[n];o.y>i.y!=s.y>i.y&&i.x<(s.x-o.x)*(i.y-o.y)/(s.y-o.y)+o.x&&(r=!r)}return r}function sI(e,i,r,a,n){for(let o of e)if(i<=o.x&&r<=o.y&&a>=o.x&&n>=o.y)return!0;let o=[new eR(i,r),new eR(i,n),new eR(a,n),new eR(a,r)];if(e.length>2){for(let i of o)if(sA(e,i))return!0}for(let i=0;i<e.length-1;i++)if(sC(e[i],e[i+1],o))return!0;return!1}function sC(e,i,r){let a=r[0],n=r[2];if(e.x<a.x&&i.x<a.x||e.x>n.x&&i.x>n.x||e.y<a.y&&i.y<a.y||e.y>n.y&&i.y>n.y)return!1;let o=e1(e,i,r[0]);return o!==e1(e,i,r[1])||o!==e1(e,i,r[2])||o!==e1(e,i,r[3])}function sP(e,i,r,a,n,o){let s=i.y-e.y,l=e.x-i.x;if(o=o||0){let e=s*s+l*l;if(0===e)return!0;let i=Math.sqrt(e);s/=i,l/=i}return!((r.x-e.x)*s+(r.y-e.y)*l-o<0||(a.x-e.x)*s+(a.y-e.y)*l-o<0||(n.x-e.x)*s+(n.y-e.y)*l-o<0)}function sz(e,i,r,a,n,o,s){return!(sP(e,i,a,n,o,s)||sP(i,r,a,n,o,s)||sP(r,e,a,n,o,s)||sP(a,n,e,i,r,s)||sP(n,o,e,i,r,s)||sP(o,a,e,i,r,s))}function sD(e,i,r){let a=i.paint.get(e).value;return"constant"===a.kind?a.value:r.programConfigurations.get(i.id).getMaxValue(e)}function sR(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function sL(e,i,r,a,n){if(!i[0]&&!i[1])return e;let o=eR.convert(i)._mult(n);"viewport"===r&&o._rotate(-a);let s=[];for(let i=0;i<e.length;i++)s.push(e[i].sub(o));return s}function sO(e,i,r,a){let n=eR.convert(e)._mult(a);return"viewport"===i&&n._rotate(-r),n}aT(sv,"CircleBucket",{omit:["layers"]});var sk,sF={},sB=(sk||(sk=1,function(e){function i(e,i,a){var n=r(256*e,256*(i=Math.pow(2,a)-i-1),a),o=r(256*(e+1),256*(i+1),a);return n[0]+","+n[1]+","+o[0]+","+o[1]}function r(e,i,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[e*a-2*Math.PI*6378137/2,i*a-2*Math.PI*6378137/2]}e.getURL=function(e,r,a,n,o,s){return s=s||{},e+"?"+["bbox="+i(a,n,o),"format="+(s.format||"image/png"),"service="+(s.service||"WMS"),"version="+(s.version||"1.1.1"),"request="+(s.request||"GetMap"),"srs="+(s.srs||"EPSG:3857"),"width="+(s.width||256),"height="+(s.height||256),"layers="+r].join("&")},e.getTileBBox=i,e.getMercCoords=r,Object.defineProperty(e,"__esModule",{value:!0})}(sF)),sF);class sN{constructor(e,i,r){this.z=e,this.x=i,this.y=r,this.key=sj(0,e,e,i,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){let r=sB.getTileBBox(this.x,this.y,this.z),a=function(e,i,r){let a,n="";for(let o=e;o>0;o--)n+=(i&(a=1<<o-1)?1:0)+(r&a?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class sV{constructor(e,i){this.wrap=e,this.canonical=i,this.key=sj(e,i.z,i.z,i.x,i.y)}}class sU{constructor(e,i,r,a,n){this.overscaledZ=e,this.wrap=i,this.canonical=new sN(r,+a,+n),this.key=0===i&&e===r?this.canonical.key:sj(i,e,r,a,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){let i=this.canonical.z-e;return e>this.canonical.z?new sU(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sU(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return sj(this.wrap*i,e,this.canonical.z,this.canonical.x,this.canonical.y);{let r=this.canonical.z-e;return sj(this.wrap*i,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;let i=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new sU(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=2*this.canonical.x,a=2*this.canonical.y;return[new sU(i,this.wrap,i,r,a),new sU(i,this.wrap,i,r+1,a),new sU(i,this.wrap,i,r,a+1),new sU(i,this.wrap,i,r+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>
7e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new sU(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sU(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new sV(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function sj(e,i,r,a,n){let o=1<<Math.min(r,22),s=n%o*o+a%o;return e&&r<22&&(s+=o*o*((e<0?-2*e-1:2*e)%(1<<2*(22-r)))),16*(32*s+r)+(i-r)}let sG=[e=>{let i=e.canonical.x-1,r=e.wrap;return i<0&&(i=(1<<e.canonical.z)-1,r--),new sU(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>{let i=e.canonical.x+1,r=e.wrap;return i===1<<e.canonical.z&&(i=0,r++),new sU(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>new sU(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new sU(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];aT(sN,"CanonicalTileID"),aT(sU,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});let{members:sq}=nV([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),sZ=nV([{name:"a_pos_3",components:3,type:"Int16"}]);var sH=nV([{name:"a_pos",type:"Int16",components:2}]);class s${constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,r){let a=eP.vec2.dot(i,this.dir);if(1e-6>Math.abs(a))return!1;let n=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return r[0]=this.pos[0]+this.dir[0]*n,r[1]=this.pos[1]+this.dir[1]*n,!0}}class sW{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,r){let a=eP.vec3.dot(i,this.dir);if(1e-6>Math.abs(a))return!1;let n=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return r[0]=this.pos[0]+this.dir[0]*n,r[1]=this.pos[1]+this.dir[1]*n,r[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(e,i,r){if(eP.vec3.equals(this.pos,e)||0===i)return r[0]=r[1]=r[2]=0,!1;let[a,n,o]=this.dir,s=this.pos[0]-e[0],l=this.pos[1]-e[1],h=this.pos[2]-e[2],u=a*a+n*n+o*o,c=2*(s*a+l*n+h*o),d=c*c-4*u*(s*s+l*l+h*h-i*i);if(d<0){let e=Math.max(-c/2,0),u=s+a*e,d=l+n*e,p=h+o*e,f=Math.hypot(u,d,p);return r[0]=u*i/f,r[1]=d*i/f,r[2]=p*i/f,!1}{let e=(-c-Math.sqrt(d))/(2*u);if(e<0){let e=Math.hypot(s,l,h);return r[0]=s*i/e,r[1]=l*i/e,r[2]=h*i/e,!1}return r[0]=s+a*e,r[1]=l+n*e,r[2]=h+o*e,!0}}}class sX{constructor(e,i,r,a,n){this.TL=e,this.TR=i,this.BR=r,this.BL=a,this.horizon=n}static fromInvProjectionMatrix(e,i,r){let a=[-1,1,1],n=[1,1,1],o=[1,-1,1],s=[-1,-1,1];return new sX(eP.vec3.transformMat4(a,a,e),eP.vec3.transformMat4(n,n,e),eP.vec3.transformMat4(o,o,e),eP.vec3.transformMat4(s,s,e),i/r)}}function sY(e,i,r){let a=1/0,n=-1/0,o=[];for(let s of e){eP.vec3.sub(o,s,i);let e=eP.vec3.dot(o,r);a=Math.min(a,e),n=Math.max(n,e)}return[a,n]}function sK(e,i){let r=!0;for(let a=0;a<e.planes.length;a++){let n=e.planes[a],o=0;for(let e=0;e<i.length;e++)o+=eP.vec3.dot(n,i[e])+n[3]>=0;if(0===o)return 0;o!==i.length&&(r=!1)}return r?2:1}function sJ(e,i){for(let r of e.projections){let a=sY(i,e.points[0],r.axis);if(r.projection[1]<a[0]||r.projection[0]>a[1])return 0}return 1}function sQ(e,i){let r=0,a=[0,0,0,0];for(let n=0;n<e.length;n++)a[0]=e[n][0],a[1]=e[n][1],a[2]=e[n][2],a[3]=1,eP.vec4.dot(a,i)>=0&&r++;return r}class s0{constructor(e,i){for(const r of(this.points=e||Array(8).fill([0,0,0]),this.planes=i||Array(6).fill([0,0,0,0]),this.bounds=s1.fromPoints(this.points),this.projections=[],this.frustumEdges=[eP.vec3.sub([],this.points[2],this.points[3]),eP.vec3.sub([],this.points[0],this.points[3]),eP.vec3.sub([],this.points[4],this.points[0]),eP.vec3.sub([],this.points[5],this.points[1]),eP.vec3.sub([],this.points[6],this.points[2]),eP.vec3.sub([],this.points[7],this.points[3])],this.frustumEdges)){const e=[0,-r[2],r[1]],i=[r[2],0,-r[0]];this.projections.push({axis:e,projection:sY(this.points,this.points[0],e)}),this.projections.push({axis:i,projection:sY(this.points,this.points[0],i)})}}static fromInvProjectionMatrix(e,i,r,a){let n=Math.pow(2,r),o=[[-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(r=>{let o=eP.vec4.transformMat4([],r,e),s=1/o[3]/i*n;return eP.vec4.mul(o,o,[s,s,a?1/o[3]:s,s])}),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(e=>{let i=eP.vec3.sub([],o[e[0]],o[e[1]]),r=eP.vec3.sub([],o[e[2]],o[e[1]]),a=eP.vec3.normalize([],eP.vec3.cross([],i,r)),n=-eP.vec3.dot(a,o[e[1]]);return a.concat(n)}),l=[];for(let e=0;e<o.length;e++)l.push([o[e][0],o[e][1],o[e][2]]);return new s0(l,s)}intersectsPrecise(e,i,r){for(let r=0;r<i.length;r++)if(!sQ(e,i[r]))return 0;for(let i=0;i<this.planes.length;i++)if(!sQ(e,this.planes[i]))return 0;for(let i of r)for(let r of this.frustumEdges){let a=eP.vec3.cross([],i,r),n=eP.vec3.length(a);if(0===n)continue;eP.vec3.scale(a,a,1/n);let o=sY(this.points,this.points[0],a),s=sY(e,this.points[0],a);if(o[0]>s[1]||s[0]>
7o[1])return 0}return 1}containsPoint(e){for(let i of this.planes){let r=i[3];if(eP.vec3.dot([i[0],i[1],i[2]],e)+r<0)return!1}return!0}}class s1{static fromPoints(e){let i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let a of e)eP.vec3.min(i,i,a),eP.vec3.max(r,r,a);return new s1(i,r)}static fromTileIdAndHeight(e,i,r){let a=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new s1([n/a,o/a,i],[(n+1)/a,(o+1)/a,r])}static applyTransform(e,i){let r=e.getCorners();for(let e=0;e<r.length;++e)eP.vec3.transformMat4(r[e],r[e],i);return s1.fromPoints(r)}static applyTransformFast(e,i){let r=[i[12],i[13],i[14]],a=[...r];for(let n=0;n<3;n++)for(let o=0;o<3;o++){let s=i[4*o+n],l=s*e.min[o],h=s*e.max[o];r[n]+=Math.min(l,h),a[n]+=Math.max(l,h)}return new s1(r,a)}static projectAabbCorners(e,i){let r=e.getCorners();for(let e=0;e<r.length;++e)eP.vec3.transformMat4(r[e],r[e],i);return r}constructor(e,i){this.min=e,this.max=i,this.center=eP.vec3.scale([],eP.vec3.add([],this.min,this.max),.5)}quadrant(e){let i=[e%2==0,e<2],r=eP.vec3.clone(this.min),a=eP.vec3.clone(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],a[e]=i[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new s1(r,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){let e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?sK(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?sK(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?sJ(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?sJ(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function s2(e){return e*o5/6371008.8}aT(s1,"Aabb");let s3=[new s1([o8,o8,o8],[o5,o5,o5]),new s1([o8,o8,o8],[0,0,o5]),new s1([0,o8,o8],[o5,0,o5]),new s1([o8,0,o8],[0,o5,o5]),new s1([0,0,o8],[o5,o5,o5])];function s4(e,i,r,a=!0){let n,o=eP.vec3.scale([],e._camera.position,e.worldSize),s=[i,r,1,1];eP.vec4.transformMat4(s,s,e.pixelMatrixInverse),eP.vec4.scale(s,s,1/s[3]);let l=eP.vec3.sub([],s,o),h=eP.vec3.normalize([],l),u=e.globeMatrix,c=[u[12],u[13],u[14]],d=eP.vec3.sub([],c,o),p=eP.vec3.length(d),f=eP.vec3.normalize([],d),m=e.worldSize/(2*Math.PI),_=eP.vec3.dot(f,h),g=Math.asin(m/p);if(g<Math.acos(_)){if(!a)return null;let e=[],i=[];eP.vec3.scale(e,h,p/_),eP.vec3.normalize(i,eP.vec3.sub(i,e,d)),eP.vec3.normalize(h,eP.vec3.add(h,d,eP.vec3.scale(h,i,Math.tan(g)*p)))}let y=[];new sW(o,h).closestPointOnSphere(c,m,y);let x=eP.vec3.normalize([],e6(u,0)),v=eP.vec3.normalize([],e6(u,1)),b=eP.vec3.normalize([],e6(u,2)),w=eP.vec3.dot(x,y),T=eP.vec3.dot(v,y),S=eP.vec3.dot(b,y),M=Math.asin(-T/m)*ek,E=Math.atan2(w,S)*ek;return new sp(sa(E=e.center.lng+((n=(E-e.center.lng+180)%360-180)<-180?n+360:n)),eU(sn(M),0,1))}class s5{constructor(e,i,r){this.a=eP.vec3.sub([],e,r),this.b=eP.vec3.sub([],i,r),this.center=r;const a=eP.vec3.normalize([],this.a),n=eP.vec3.normalize([],this.b);this.angle=Math.acos(eP.vec3.dot(a,n))}}function s6(e,i){var r,a,n,o;let s,l;return 0===e.angle?null:(s=0===e.a[i]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[i]/e.a[i]/Math.sin(e.angle)-1/Math.tan(e.angle)))<0||s>1?null:(r=e.a[i],a=e.b[i],n=e.angle,o=eU(s,0,1),l=Math.sin(n),Math.sin((1-o)*n)/l*r+Math.sin(o*n)/l*a+e.center[i])}function s8(e){if(e.z<=1)return s3[e.z+2*e.y+e.x];let i=li(lt(e));return s1.fromPoints(i)}function s9(e,i,r){return eP.vec3.scale(e,e,1-r),eP.vec3.scaleAndAdd(e,e,i,r)}function s7(e,i,r){for(let a of e)eP.vec3.transformMat4(a,a,i),eP.vec3.scale(a,a,r)}function le(e,i,r,a){let n=i/e.worldSize,o=e.globeMatrix;if(r.z<=1){let e=s8(r).getCorners();return s7(e,o,n),s1.fromPoints(e)}let s=lt(r,a),l=li(s,o5+s2(e._tileCoverLift));s7(l,o,n);let h=Number.MAX_VALUE,u=[-h,-h,-h],c=[h,h,h];if(s.contains(e.center)){for(let e of l)eP.vec3.min(c,c,e),eP.vec3.max(u,u,e);u[2]=0;let i=e.point,r=[i.x*n,i.y*n,0];return eP.vec3.min(c,c,r),eP.vec3.max(u,u,r),new s1(c,u)}if(e._tileCoverLift>0){for(let e of l)eP.vec3.min(c,c,e),eP.vec3.max(u,u,e);return new s1(c,u)}let d=[o[12]*n,o[13]*n,o[14]*n],p=s.getCenter(),f=eU(e.center.lat,-85.051129,85.051129),m=eU(p.lat,-85.051129,85.051129),_=sa(e.center.lng),g=sn(f),y=_-sa(p.lng),x=g-sn(m);y>.5?y-=1:y<-.5&&(y+=1);let v=0;if(Math.abs(y)>Math.abs(x))v=y>=0?1:3;else{v=x>=0?0:2;let e=[o[4]*n,o[5]*n,o[6]*n],i=-Math.sin((x>=0?s.getSouth():s.getNorth())*eO)*o5;eP.vec3.scaleAndAdd(d,d,e,i)}let b=l[v],w=l[(v+1)%4],T=new s5(b,w,d),S=[s6(T,0)||b[0],s6(T,1)||b[1],s6(T,2)||b[2]],M=lc(e.zoom);if(M>0){let a=function({x:e,y:i,z:r},a,n,o,s){let l=1/(1<<r),h=e*l,u=h+l,c=i*l,d=c+l,p=0,f=(h+u)/2-o;return f>.5?p=-1:f<-.5&&(p=1),h=((h+p)*a-(o*=a))*n+o,u=((u+p)*a-o)*n+o,c=(c*a-(s*=a))*n+s,[[h,d=(d
7*a-s)*n+s,0],[u,d,0],[u,c,0],[h,c,0]]}(r,i,e._pixelsPerMercatorPixel,_,g);for(let e=0;e<l.length;e++)s9(l[e],a[e],M);let n=eP.vec3.add([],a[v],a[(v+1)%4]);eP.vec3.scale(n,n,.5),s9(S,n,M)}for(let e of l)eP.vec3.min(c,c,e),eP.vec3.max(u,u,e);return c[2]=Math.min(b[2],w[2]),eP.vec3.min(c,c,S),eP.vec3.max(u,u,S),new s1(c,u)}function lt({x:e,y:i,z:r},a=!1){let n=1/(1<<r);return new si(new st(so(e*n),i===(1<<r)-1&&a?-90:ss((i+1)*n)),new st(so((e+1)*n),0===i&&a?90:ss(i*n)))}function li(e,i=o5){let r=e.getNorth()*eO,a=e.getSouth()*eO,n=Math.cos(r),o=Math.cos(a),s=Math.sin(r),l=Math.sin(a),h=e.getWest(),u=e.getEast();return[o9(o,l,h,i),o9(o,l,u,i),o9(n,s,u,i),o9(n,s,h,i)]}function lr(e,i,r,a){let n=1<<r.z,o=(e/8192+r.x)/n;return o7(ss((i/8192+r.y)/n),so(o),a)}function la({min:e,max:i}){return 16383/Math.max(i[0]-e[0],i[1]-e[1],i[2]-e[2])}let ln=new Float64Array(16);function lo(e){let i=la(e),r=eP.mat4.fromScaling(ln,[i,i,i]);return eP.mat4.translate(r,r,eP.vec3.negate([],e.min))}function ls(e){let i=eP.mat4.fromTranslation(ln,e.min),r=1/la(e);return eP.mat4.scale(i,i,[r,r,r])}function ll(e){return e/(2*Math.PI)/(8192/(2*Math.PI))}function lh(e,i){return 8192/(512*Math.pow(2,e))*la(s8(i))}function lu(e,i,r,a,n){let o=ll(r),s=[e,i,-r/(2*Math.PI)],l=eP.mat4.identity(new Float64Array(16));return eP.mat4.translate(l,l,s),eP.mat4.scale(l,l,[o,o,o]),eP.mat4.rotateX(l,l,-n*eO),eP.mat4.rotateY(l,l,-a*eO),l}function lc(e){return ej(5,6,e)}function ld(e,i){let r,a,n,o,s,l=o7(i.lat,i.lng),h=(r=o7(e._center.lat,e._center.lng),a=eP.vec3.fromValues(0,1,0),n=eP.vec3.cross([],a,r),o=eP.mat4.fromRotation([],-e.angle,r),n=eP.vec3.transformMat4(n,n,o),eP.mat4.fromRotation(o,-e._pitch,n),s=eP.vec3.normalize([],r),eP.vec3.scale(s,s,s2(e.cameraToCenterDistance/e.pixelsPerMeter)),eP.vec3.transformMat4(s,s,o),eP.vec3.add([],r,s)),u=eP.vec3.subtract([],h,l);return eP.vec3.angle(u,l)}function lp(e,i){return ld(e,i)>Math.PI/2*1.01}let lf=85*eO,lm=Math.cos(lf),l_=Math.sin(lf),lg=eP.mat4.create(),ly=e=>{let i=[];return"map"===e.paint.get("circle-pitch-alignment")&&i.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&i.push("SCALE_WITH_MAP"),i};function lx(e,i,r,a,n,o,s,l,h){if(o&&e.queryGeometry.isAboveHorizon)return!1;o&&(h*=e.pixelToTileUnitsFactor);let u=e.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(let p of i)for(let i of p){var d;let p=i.add(l),f=n&&r.elevation?r.elevation.exaggeration()*n.getElevationAt(p.x,p.y,!0):0,m=r.projection.projectTilePoint(p.x,p.y,u);if(f>0){let e=r.projection.upVector(u,p.x,p.y);m.x+=e[0]*c*f,m.y+=e[1]*c*f,m.z+=e[2]*c*f}let _=o?p:function(e,i,r,a){let n=eP.vec4.transformMat4([],[e,i,r,1],a);return new eR(n[0]/n[3],n[1]/n[3])}(m.x,m.y,m.z,a),g=o?e.tilespaceRays.map(e=>(function(e,i){let r=eP.vec3.create();return lv[2]=i,e.intersectsPlane(lv,lb,r),new eR(r[0],r[1])})(e,f)):e.queryGeometry.screenGeometry,y=eP.vec4.transformMat4([],[m.x,m.y,m.z,1],a);if(!s&&o?h*=y[3]/r.cameraToCenterDistance:s&&!o&&(h*=r.cameraToCenterDistance/y[3]),o){let e=ss((i.y/8192+u.y)/(1<<u.z));h/=r.projection.pixelsPerMeter(e,1)/(1/sr(e))}if(d=h,sA(g,_)||sS(_,g,d))return!0}return!1}let lv=eP.vec3.fromValues(0,0,0),lb=eP.vec3.fromValues(0,0,1);class lw extends sv{}function lT(e,{width:i,height:r}
7,a,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*r*a)throw RangeError("mismatched image size")}else n=new Uint8Array(i*r*a);return e.width=i,e.height=r,e.data=n,e}function lS(e,i,r){let{width:a,height:n}=i;a===e.width&&n===e.height||(lM(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,a),height:Math.min(e.height,n)},r,null),e.width=a,e.height=n,e.data=i.data)}function lM(e,i,r,a,n,o,s,l){if(0===n.width||0===n.height)return i;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>i.width||n.height>i.height||a.x>i.width-n.width||a.y>i.height-n.height)throw RangeError("out of range destination coordinates for image copy");let h=e.data,u=i.data,c=4===o&&l;for(let l=0;l<n.height;l++){let d=((r.y+l)*e.width+r.x)*o,p=((a.y+l)*i.width+a.x)*o;if(c)for(let e=0;e<n.width;e++){let i=d+e*o+3,r=p+e*o;u[r+0]=255,u[r+1]=255,u[r+2]=255,u[r+3]=h[i]}else if(s)for(let e=0;e<n.width;e++){let i=d+e*o,r=p+e*o,a=h[i+3],n=new tZ(h[i+0]/255*a,h[i+1]/255*a,h[i+2]/255*a,a).toRenderColor(s).toArray();u[r+0]=n[0],u[r+1]=n[1],u[r+2]=n[2],u[r+3]=n[3]}else for(let e=0;e<n.width*o;e++)u[p+e]=h[d+e]}return i}aT(lw,"HeatmapBucket",{omit:["layers"]});class lE{constructor(e,i){lT(this,e,1,i)}resize(e){lS(this,new lE(e),1)}clone(){return new lE({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n){lM(e,i,r,a,n,1,null)}}class lA{constructor(e,i){lT(this,e,4,i)}resize(e){lS(this,new lA(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new lA({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n,o,s){lM(e,i,r,a,n,4,o,s)}}class lI{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function lC(e){let i={},r=e.resolution||256,a=e.clips?e.clips.length:1,n=e.image||new lA({width:r,height:a}),o=(r,a,o)=>{i[e.evaluationKey]=o;let s=e.expression.evaluate(i);s&&(n.data[r+a+0]=Math.floor(255*s.r/s.a),n.data[r+a+1]=Math.floor(255*s.g/s.a),n.data[r+a+2]=Math.floor(255*s.b/s.a),n.data[r+a+3]=Math.floor(255*s.a))};if(e.clips)for(let i=0,n=0;i<a;++i,n+=4*r)for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1),{start:h,end:u}=e.clips[i];o(n,s,h*(1-l)+u*l)}else for(let e=0,i=0;e<r;e++,i+=4)o(0,i,e/(r-1));return n}aT(lE,"AlphaImage"),aT(lA,"RGBAImage");let lP=nV([{name:"a_pos",components:2,type:"Int16"}],4),lz=nV([{name:"a_road_z_offset",components:1,type:"Float32"}],4),lD=nV([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),lR=nV([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function lL(e,i,r=2){let a,n,o,s=i&&i.length,l=s?i[0]*r:e.length,h=lO(e,0,l,r,!0),u=[];if(!h||h.next===h.prev)return u;if(s&&(h=function(e,i,r,a){let n=[];for(let r=0,o=i.length;r<o;r++){let s=lO(e,i[r]*a,r<o-1?i[r+1]*a:e.length,a,!1);s===s.next&&(s.steiner=!0),n.push(function(e){let i=e,r=e;do(i.x<r.x||i.x===r.x&&i.y<r.y)&&(r=i),i=i.next;while(i!==e);return r}(s))}n.sort(lF);for(let e=0;e<n.length;e++)r=function(e,i){let r=function(e,i){let r=i,a=e.x,n=e.y,o,s=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let e=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y
7);if(e<=a&&e>s&&(s=e,o=r.x<r.next.x?r:r.next,e===a))return o}r=r.next}while(r!==i);if(!o)return null;let l=o,h=o.x,u=o.y,c=1/0;r=o;do{if(a>=r.x&&r.x>=h&&a!==r.x&&lN(n<u?a:s,n,h,u,n<u?s:a,n,r.x,r.y)){var d,p;let i=Math.abs(n-r.y)/(a-r.x);lZ(r,e)&&(i<c||i===c&&(r.x>o.x||r.x===o.x&&(d=o,p=r,0>lV(d.prev,d,p.prev)&&0>lV(p.next,d,d.next))))&&(o=r,c=i)}r=r.next}while(r!==l);return o}(e,i);if(!r)return i;let a=lH(r,e);return lk(a,a.next),lk(r,r.next)}(n[e],r);return r}(e,i,h,r)),e.length>80*r){a=1/0,n=1/0;let i=-1/0,s=-1/0;for(let o=r;o<l;o+=r){let r=e[o],l=e[o+1];r<a&&(a=r),l<n&&(n=l),r>i&&(i=r),l>s&&(s=l)}o=0!==(o=Math.max(i-a,s-n))?32767/o:0}return function e(i,r,a,n,o,s,l){if(!i)return;!l&&s&&function(e,i,r,a){let n=e;do 0===n.z&&(n.z=lB(n.x,n.y,i,r,a)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let i,r=1;do{let a,n=e;e=null;let o=null;for(i=0;n;){i++;let s=n,l=0;for(let e=0;e<r&&(l++,s=s.nextZ);e++);let h=r;for(;l>0||h>0&&s;)0!==l&&(0===h||!s||n.z<=s.z)?(a=n,n=n.nextZ,l--):(a=s,s=s.nextZ,h--),o?o.nextZ=a:e=a,a.prevZ=o,o=a;n=s}o.nextZ=null,r*=2}while(i>1)}(n)}(i,n,o,s);let h=i;for(;i.prev!==i.next;){let u=i.prev,c=i.next;if(s?function(e,i,r,a){let n=e.prev,o=e.next;if(lV(n,e,o)>=0)return!1;let s=n.x,l=e.x,h=o.x,u=n.y,c=e.y,d=o.y,p=s<l?s<h?s:h:l<h?l:h,f=u<c?u<d?u:d:c<d?c:d,m=s>l?s>h?s:h:l>h?l:h,_=u>c?u>d?u:d:c>d?c:d,g=lB(p,f,i,r,a),y=lB(m,_,i,r,a),x=e.prevZ,v=e.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==o&&lN(s,u,l,c,h,d,x.x,x.y)&&lV(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==o&&lN(s,u,l,c,h,d,v.x,v.y)&&lV(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==o&&lN(s,u,l,c,h,d,x.x,x.y)&&lV(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==o&&lN(s,u,l,c,h,d,v.x,v.y)&&lV(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}(i,n,o,s):function(e){let i=e.prev,r=e.next;if(lV(i,e,r)>=0)return!1;let a=i.x,n=e.x,o=r.x,s=i.y,l=e.y,h=r.y,u=a<n?a<o?a:o:n<o?n:o,c=s<l?s<h?s:h:l<h?l:h,d=a>n?a>
7o?a:o:n>o?n:o,p=s>l?s>h?s:h:l>h?l:h,f=r.next;for(;f!==i;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&lN(a,s,n,l,o,h,f.x,f.y)&&lV(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}(i))r.push(u.i,i.i,c.i),lW(i),i=c.next,h=c.next;else if((i=c)===h){l?1===l?e(i=function(e,i){let r=e;do{let a=r.prev,n=r.next.next;!lU(a,n)&&lj(a,r,r.next,n)&&lZ(a,n)&&lZ(n,a)&&(i.push(a.i,r.i,n.i),lW(r),lW(r.next),r=e=n),r=r.next}while(r!==e);return lk(r)}(lk(i),r),r,a,n,o,s,2):2===l&&function(i,r,a,n,o,s){let l=i;do{let i=l.next.next;for(;i!==l.prev;){var h,u;if(l.i!==i.i&&(h=l,u=i,h.next.i!==u.i&&h.prev.i!==u.i&&!function(e,i){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==i.i&&r.next.i!==i.i&&lj(r,r.next,e,i))return!0;r=r.next}while(r!==e);return!1}(h,u)&&(lZ(h,u)&&lZ(u,h)&&function(e,i){let r=e,a=!1,n=(e.x+i.x)/2,o=(e.y+i.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(a=!a),r=r.next;while(r!==e);return a}(h,u)&&(lV(h.prev,h,u.prev)||lV(h,u.prev,u))||lU(h,u)&&lV(h.prev,h,h.next)>0&&lV(u.prev,u,u.next)>0))){let h=lH(l,i);return l=lk(l,l.next),h=lk(h,h.next),e(l,r,a,n,o,s,0),void e(h,r,a,n,o,s,0)}i=i.next}l=l.next}while(l!==i)}(i,r,a,n,o,s):e(lk(i),r,a,n,o,s,1);break}}}(h,u,r,a,n,o,0),u}function lO(e,i,r,a,n){let o;if(n===function(e,i,r,a){let n=0;for(let o=i,s=r-a;o<r;o+=a)n+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return n}(e,i,r,a)>0)for(let n=i;n<r;n+=a)o=l$(n/a|0,e[n],e[n+1],o);else for(let n=r-a;n>=i;n-=a)o=l$(n/a|0,e[n],e[n+1],o);return o&&lU(o,o.next)&&(lW(o),o=o.next),o}function lk(e,i){if(!e)return e;i||(i=e);let r,a=e;do if(r=!1,a.steiner||!lU(a,a.next)&&0!==lV(a.prev,a,a.next))a=a.next;else{if(lW(a),(a=i=a.prev)===a.next)break;r=!0}while(r||a!==i);return i}function lF(e,i){return e.x-i.x}function lB(e,i,r,a,n){return(e=0x55555555&((e=0x33333333&((e=0xf0f0f0f&((e=0xff00ff&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(i=0x55555555&((i=0x33333333&((i=0xf0f0f0f&((i=0xff00ff&((i=(i-a)*n|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function lN(e,i,r,a,n,o,s,l){return(n-s)*(i-l)>=(e-s)*(o-l)&&(e-s)*(a-l)>=(r-s)*(i-l)&&(r-s)*(o-l)>=(n-s)*(a-l)}function lV(e,i,r){return(i.y-e.y)*(r.x-i.x)-(i.x-e.x)*(r.y-i.y)}function lU(e,i){return e.x===i.x&&e.y===i.y}function lj(e,i,r,a){let n=lq(lV(e,i,r)),o=lq(lV(e,i,a)),s=lq(lV(r,a,e)),l=lq(lV(r,a,i));return n!==o&&s!==l||!(0!==n||!lG(e,r,i))||!(0!==o||!lG(e,a,i))||!(0!==s||!lG(r,e,a))||!(0!==l||!lG(r,i,a))}function lG(e,i,r){return i.x<=Math.max(e.x,r.x)&&i.x>=Math.min(e.x,r.x)&&i.y<=Math.max(e.y,r.y)&&i.y>=Math.min(e.y,r.y)}function lq(e){return e>0?1:e<0?-1:0}function lZ(e,i){return 0>lV(e.prev,e,e.next)?lV(e,i,e.next)>=0&&lV(e,e.prev,i)>=0:0>lV(e,i,e.prev)||0>lV(e,e.next,i)}function lH(e,i){let r=lX(e.i,e.x,e.y),a=lX(i.i,i.x,i.y),n=e.next,o=i.prev;return e.next=i,i.prev=e,r.next=n,n.prev=r,a.next=r,r.prev=a,o.next=a,a.prev=o,a}function l$(e,i,r,a){let n=lX(e,i,r);return a?(n.next=a.next,n.prev=a,a.next.prev=n,a.next=n):(n.prev=n,n.next=n),n}function lW(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function lX(e,i,r){return{i:e,x:i,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function lY(e,i){let r,a,n=e.length;if(n<=1)return[e];let o=[];for(let i=0;i<n;i++){let n=function(e){let i=0;for(let r,a,n=0,o=e.length,s=o-1;n<o;s=n++)r=e[n],i+=((a=e[s]).x-r.x)*(r.y+a.y);return i}(e[i]);0!==n&&(e[i].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[e[i]]):r.push(e[i]))}if(r&&o.push(r),i>1)for(let e=0;e<o.length;e++)o[e].length<=i||(function e(i,r,a=0,n=i.length-1,o=function(e,i){return e<i?-1:+(e>i)}){for(;n>a;){if(n-a>600){let s=n-a+1,l=r-a+1,h=Math.log(s),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(s-u)/s)*(l-s/2<0?-1:1);e(i,r,Math.max(a,Math.floor(r-l*u/s+c)),Math.min(n,Math.floor(r+(s-l)*u/s+c)),o)}let s=i[r],l=a,h=n;for(iz(i,a,r),o(i[n],s)>0&&iz(i,a,n);l<h;){for(iz(i,l,h),l++,h--;0>o(i[l],s);)l++;for(;o(i[h],s)>0;)h--}0===o(i[a],s)?iz(i,a,h):iz(i,++h,n),h<=r&&(a=h+1),r<=h&&(n=h-1)}}(o[e],i,1,o[e].length-1,lK),o[e]=o[e].slice(0,i));return o}function lK(e,i){return i.area-e.area}function lJ(e,i,r=1){if(!e)return null;let a="string"==typeof e?ic.from(e).getPrimary():e.getPrimary(),n=a.id.toString();return i.has(n)||i.set(n,[]),a.scaleSelf(r),i.get(n).push(a),a.toString()}function lQ(e,i,r,a){let n=a.patternDependencies,o=!1;for(let a of i){let i=a.paint.get(`${e}-pattern`);i.isConstant()||(o=!0),lJ(i.constantOr(null),n,r)&&(o=!0)}return o}function l0(e,i,r,a,n,o){let s=o.patternDependencies;for(let l of i){let i=l.paint.get(`${e}-pattern`).value;if("constant"!==i.kind){let e=i.evaluate({zoom:a},r,{},o.availableImages),h=lJ(e=e&&e.name?e.name:e,s,n);h&&(r.patterns[l.id]=h)}}return r}var l1,l2,l3,l4,l5,l6,l8,l9={};function l7(){if(l2)return l1;l2=1;var e=eD();function i(e,i,a,n,o){this.properties={},this.extent=a,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(r,this,i)}function r(e,i,r){1==e?i.id=r.readVarint():2==e?function(e,i){for(var r=e.readVarint()+e.pos;e.pos<r;){var a=i._keys[e.readVarint()],n=i._values[e.readVarint()];i.properties[a]=n}}(r,i):3==e?i.type=r.readVarint():4==e&&(i._geometry=r.pos)}return l1=i,i.types=["Unknown","Point","LineString","Polygon"],i.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var r,a=i.readVarint()+i.pos,n=1,o=0,s=0,l=0,h=[];i.pos<a;){if(o<=0){var u=i.readVarint();n=7&u,o=u>>3}if(o--,1===n||2===n)s+=i.readSVarint(),l+=i.readSVarint(),1===n&&(r&&h.push(r),r=[]),r.push(new e(s,l));else{if(7!==n)throw Error("unknown command "+n);r&&r.push(r[0].clone())}}return r&&h.push(r),h},i.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var i=e.readVarint()+e.pos,r=1,a=0,n=0,o=0,s=1/0,l=-1/0,h=1/0,u=-1/0;e.pos<i;){if(a<=0){var c=e.readVarint();r=7&c,a=c>>3}if(a--,1===r||2===r)(n+=e.readSVarint())<s&&(s=n),n>l&&(l=n),(o+=e.readSVarint())<h&&(h=o),o>u&&(u=o);else if(7!==r)throw Error("unknown command "+r)}return[s,h,l,u]},i.prototype.toGeoJSON=function(e,r,a){var n,o,s=this.extent*Math.pow(2,a),l=this.extent*e,h=this.extent*r,u=this.loadGeometry(),c=i.types[this.type];function d(e){for(var i=0;i<e.length;i++){var r=e[i];e[i]=[360*(r.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+h)/s)*Math.PI/180)
7)-90]}}switch(this.type){case 1:var p=[];for(n=0;n<u.length;n++)p[n]=u[n][0];d(u=p);break;case 2:for(n=0;n<u.length;n++)d(u[n]);break;case 3:for(u=function(e){var i=e.length;if(i<=1)return[e];for(var r,a,n=[],o=0;o<i;o++){var s=function(e){for(var i,r,a=0,n=0,o=e.length,s=o-1;n<o;s=n++)a+=((r=e[s]).x-(i=e[n]).x)*(i.y+r.y);return a}(e[o]);0!==s&&(void 0===a&&(a=s<0),a===s<0?(r&&n.push(r),r=[e[o]]):r.push(e[o]))}return r&&n.push(r),n}(u),n=0;n<u.length;n++)for(o=0;o<u[n].length;o++)d(u[n][o])}1===u.length?u=u[0]:c="Multi"+c;var f={type:"Feature",geometry:{type:c,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f},l1}function he(){if(l4)return l3;l4=1;var e=l7();function i(e,i){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(r,this,i),this.length=this._features.length}function r(e,i,r){15===e?i.version=r.readVarint():1===e?i.name=r.readString():5===e?i.extent=r.readVarint():2===e?i._features.push(r.pos):3===e?i._keys.push(r.readString()):4===e&&i._values.push(function(e){for(var i=null,r=e.readVarint()+e.pos;e.pos<r;){var a=e.readVarint()>>3;i=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return i}(r))}return l3=i,i.prototype.feature=function(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,r,this.extent,this._keys,this._values)},l3}function ht(){return l8||(l8=1,l9.VectorTile=function(){if(l6)return l5;l6=1;var e=he();function i(i,r,a){if(3===i){var n=new e(a,a.readVarint()+a.pos);n.length&&(r[n.name]=n)}}return l5=function(e,r){this.layers=e.readFields(i,{},r)}}(),l9.VectorTileFeature=l7(),l9.VectorTileLayer=he()),l9}var hi=ht();let hr="3d_elevation_id",ha="level";class hn{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,r){return this.get(e,!0,i,r)}optional(e,i,r){return this.get(e,!1,i,r)}success(){return this._valid}get(e,i,r,a){let n=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&void 0!==n?r(a?a(n):n):i&&(this._valid=!1),this}}class ho{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,r){return this.featureFunc(e,i,r)}parseVertex(e,i,r){return this.vertexFunc(e,i,r)}}let hs=new ho((e,i,r)=>e.reset(i).require(hr,e=>{r.id=e}).optional("fixed_height_relative",e=>{r.constantHeight=e},hh.decodeRelativeHeight).geometry(e=>{r.bounds=e},hh.computeBounds).success(),(e,i,r)=>e.reset(i).require(hr,e=>{r.id=e}).require("elevation_idx",e=>{r.idx=e}).require("extent",e=>{r.extent=e}).require("height_relative",e=>{r.height=e},hh.decodeRelativeHeight).geometry(e=>{r.position=e},hh.getPoint).success()),hl=new ho((e,i,r)=>e.reset(i).require(hr,e=>{r.id=e}).optional("fixed_height",e=>{r.constantHeight=e},hh.decodeMetricHeight).geometry(e=>{r.bounds=e},hh.computeBounds).success(),(e,i,r)=>e.reset(i).require(hr,e=>{r.id=e}).require("elevation_idx",e=>{r.idx=e}).require("extent",e=>{r.extent=e}).require("height",e=>{r.height=e},hh.decodeMetricHeight).geometry(e=>{r.position=e},hh.getPoint).success());class hh{static computeBounds(e){let i=new eR(1/0,1/0),r=new eR(-1/0,-1/0);for(let a of e[0])i.x>a.x&&(i.x=a.x),i.y>a.y&&(i.y=a.y),r.x<a.x&&(r.x=a.x),r.y<a.y&&(r.y=a.y);return{min:i,max:r}}static getPoint(e){return eP.vec2.fromValues(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){let i=[],r=[],a=e.length,n=new hn;for(let o=0;o<a;o++){let a=e.feature(o),s=a.properties.hasOwnProperty("version")?String(a.properties.version):void 0,l=s?"1.0.1"===s?hl:void 0:hs;if(void 0===l){e0(`Unknown elevation feature version number ${s||"(unknown)"}`);continue}let h=a.properties.hasOwnProperty("type")?a.properties.type:void 0;if(h){if("Point"===hi.VectorTileFeature.types[a.type]&&"curve_point"===h){let e={};l.parseVertex(n,a,e)&&i.push(e)}else if("Polygon"===hi.VectorTileFeature.types[a.type]&&"curve_meta"===h){let e={};l.parseFeature(n,a,e)&&r.push(e)}}}return{vertices:i,features:r}}}class hu{constructor(e,i,r,a,n,o){if(this.vertices=[],this.vertexProps=[],this.edges=[],this.edgeProps=[],this.id=e,this.heightRange={min:r,max:r},this.safeArea=i,this.constantHeight=r,null==this.constantHeight&&(null!=this.constantHeight||0!==a.length)){for(const e of(this.vertices=a,this.edges=n,this.edges=this.edges.filter(e=>e.a<this.vertices.length&&e.b<this.vertices.length&&!eP.vec2.exactEquals(this.vertices[e.a].position,this.vertices[e.b].position)),this.heightRange={min:1/0,max:-1/0},this.vertices))this.vertexProps.push({dir:eP.vec2.fromValues(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,e.height),this.heightRange.max=Math.max(this.heightRange.max,e.height);for(const e of this.edges){const i=this.vertices[e.a].position,r=this.vertices[e.b].position,a=eP.vec2.subtract(eP.vec2.create(),r,i),n=eP.vec2.length(a),o=eP.vec2.scale(eP.vec2.create(),a,1/n);this.edgeProps.push({vec:a,dir:o,len:n});const s=this.vertexProps[e.a].dir,l=this.vertexProps[e.b].dir;eP.vec2.add(s,s,o),eP.vec2.add(l,l,o)}for(const e of this.vertexProps)0===e.dir[0]&&0===e.dir[1]||eP.vec2.normalize(e.dir,e.dir);this.tessellate(o)}}pointElevation(e){let i;if(null!=this.constantHeight)return this.constantHeight;let r=this.getClosestEdge(e);if(null==r)return 0;let[a,n]=r;return i=this.vertices[this.edges[a].a].height,(1-n)*i+n*this.vertices[this.edges[a].b].height}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(0===this.edges.length)return;let i=0,r=1/0,a=0,n=eP.vec2.fromValues(e.x,e.y);for(let e=0;e<this.edges.length;e++){let o=this.edges[e],s=this.edgeProps[e].dir,l=new s$(n,this.edgeProps[e].dir),h=this.vertices[o.a].position,u=this.vertices[o.b].position,c=eP.vec2.create(),d=eP.vec2.create(),p=l.intersectsPlane(h,this.vertexProps[o.a].dir,c),f=l.intersectsPlane(u,this.vertexProps[o.b].dir,d);if(!p||!f)continue;let m=eP.vec2.subtract(eP.vec2.create(),d,c),_=eP.vec2.subtract(eP.vec2.create(),n,c),g=eP.vec2.dot(m,m),y=g>0?eP.vec2.dot(_,m)/g:0,x=eU(y,0,1),v=Math.abs((y-x)*this.edgeProps[e].len),b=eP.vec2.subtract(eP.vec2.create(),n,h),w=v+Math.abs(eP.vec2.dot(b,eP.vec2.fromValues(s[1],-s[0])));w<r&&(i=e,r=w,a=x)}return[i,a]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){let r=this.edges[i].a,a=this.edges[i].b,{position:n,height:o,extent:s}=this.vertices[r],{position:l,height:h,extent:u}=this.vertices[a],c=this.vertexProps[r].dir,d=this.vertexProps[a].dir,p=eP.vec3.fromValues(n[0]/e,n[1]/e,o),f=eP.vec3.fromValues(l[0]/e,l[1]/e,h),m=eP.vec3.fromValues(c[1],-c[0],0);eP.vec3.scale(m,m,s);let _=eP.vec3.fromValues(d[1],-d[0],0);if(eP.vec3.scale(_,_,u),this.distSqLines(eP.vec3.fromValues(p[0]+.5*m[0],p[1]+.5*m[1],p[2]+.5*m[2]),eP.vec3.fromValues(f[0]-.5*_[0],f[1]-.5*_[1],f[2]-.5*_[2]),eP.vec3.fromValues(p[0]-.5*m[0],p[1]-.5*m[1],p[2]-.5*m[2]),eP.vec3.fromValues(f[0]+.5*_[0],f[1]+.5*_[1],f[2]+.5*_[2]))<=.05*.05)continue;let g=this.vertices.length,y=eP.vec2.add(eP.vec2.create(),n,l);this.vertices.push({position:eP.vec2.scale(y,y,.5),height:.5*(o+h),extent:.5*(s+u)});let x=eP.vec2.add(eP.vec2.create(),c,d);this.vertexProps.push({dir:eP.vec2.normalize(x,x)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:r,b:g}),this.edges.push({a:g,b:a});let v=eP.vec2.subtract(eP.vec2.create(),this.vertices[g].position,n),b=eP.vec2.length(v),w={vec:v,dir:eP.vec2.scale(eP.vec2.create(),v,1/b),len:b};this.edgeProps.push(w),this.edgeProps.push(w)}}distSqLines(e,i,r,a){let n=eP.vec3.subtract(eP.vec3.create(),i,e),o=eP.vec3.subtract(eP.vec3.create(),a,r),s=eP.vec3.subtract(eP.vec3.create(),e,r),l=eP.vec3.dot(n,n),h=eP.vec3.dot(n,o),u=eP.vec3.dot(n,s),c=eP.vec3.dot(o,o),d=eP.vec3.dot(o,s),p=l*c-h*h;if(0===p){let i=eP.vec3.dot(s,o)/eP.vec3.dot(o,o),n=eP.vec3.lerp(eP.vec3.create(),r,a,i);return eP.vec3.squaredDistance(n,e)}let f=eP.vec3.lerp(eP.vec3.create(),e,i,(h*d-u*c)/p),m=eP.vec3.lerp(eP.vec3.create(),r,a,(l*d-h*u)/p);return eP.vec3.squaredDistance(f,m)}}class hc{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*8192,this.yOffset=(e.y*this.zScale-i.y)*8192)}constantElevation(e,i){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,r){let a=this.constantElevation(i,r);return null!=a?a:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),r))}computeBiasedHeight(e,i){return i<=0?e:e+i*ej(0,i,e>=0?e:Math.abs(.5*e))}}aT(hu,"ElevationFeature");class hd{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(let[i,r]of e.polygons)this.add(i,...r)}}class hp{constructor(){this.portals=[]}static evaluate(e){if(0===e.length)return new hp;let i=[];for(let r of e)i.push(...r.portals);if(0===i.length)return new hp;let r=(e,i)=>e<=0&&i<=0||e>=8192&&i>=8192;for(let e of i){let i=e.va,a=e.vb;(r(i.x,a.x)||r(i.y,a.y))&&(e.type="border")}let a=i.filter(e=>"unevaluated"!==e.type),n=i.filter(e=>"unevaluated"===e.type);if(0===n.length)return new hp;n.sort((e,i)=>e.hash===i.hash?e.isTunnel===i.isTunnel?0:e.isTunnel?-1:1:e.hash<i.hash?1:-1),i=a.concat(n);let o=a.length,s=o,l=o;do if(++s===i.length||i[o].hash!==i[s].hash){if(s-o==2){l<o&&(i[l]=i[o],i[o]=null);let e=i[l],r=i[s-1];e.type=e.isTunnel!==r.isTunnel?"tunnel":"polygon",e.connection={a:e.connection.a,b:r.connection.a},l++}o=s}while(o!==i.length);return i.splice(l),i.sort((e,i)=>e.hash<i.hash?1:-1),{portals:i}}}aT(hp,"ElevationPortalGraph"),aT(hd,"ElevationPolygons");class hf{constructor(e,i,r){this.outPositions=e,this.outNormals=i,this.outIndices=r,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,r){let a=e[2];null!=r&&(a*=r);let n=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),o=this.vertexLookup.get(n);if(null!=o)return o;let s=this.outPositions.length;this.vertexLookup.set(n,s);let l=Math.trunc(16384*i[0]),h=Math.trunc(16384*i[1]),u=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(l,h,u),s}addVertices(e,i,...r){let a=[];for(let n of r){let r=this.addVertex(n,e,i);a.push(r)}return a}
7addTriangles(e,i,r){if(i&&r){let a=1===r.length,n=eP.vec3.fromValues(0,0,0);for(let o=0;o<e.length;o+=3){let s=i[e[o+0]],l=i[e[o+1]],h=i[e[o+2]],u=a?r[0]:r[e[o+1]],c=a?r[0]:r[e[o+2]],d=this.addVertex(eP.vec3.fromValues(s.x,s.y,a?r[0]:r[e[o+0]]),n),p=this.addVertex(eP.vec3.fromValues(l.x,l.y,u),n),f=this.addVertex(eP.vec3.fromValues(h.x,h.y,c),n);this.outIndices.emplaceBack(d,p,f)}}else for(let i=0;i<e.length;i+=3)this.outIndices.emplaceBack(e[i+0],e[i+1],e[i+2])}addQuad(e,i){let[r,a,n,o]=this.addVertices(i,void 0,...e.map(e=>eP.vec3.fromValues(e.coord.x,e.coord.y,e.height)));this.addTriangles([r,a,n,n,o,r])}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class hm{constructor(e){this.unevaluatedPortals=new hp,this.portalPolygons=new hd,this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new nH,this.vertexNormals=new n$,this.indexArray=new n7,this.tileToMeters=sd(e)}addVertices(e,i){let r=this.unevalVertices.length;for(let r=0;r<e.length;r++)this.unevalVertices.push(e[r]),this.unevalHeights.push(i[r]);return r}
7addTriangles(e,i,r){let a=r?this.unevalTunnelTriangles:this.unevalTriangles;for(let r of e)a.push(r+i)}addRenderableRing(e,i,r,a,n){let o=[new eR(n.min.x,n.min.y),new eR(n.max.x,n.min.y),new eR(n.max.x,n.max.y),new eR(n.min.x,n.max.y)];for(let s=0;s<r-1;s++){let r=i+s,l=r+1,h=this.unevalVertices[r],u=this.unevalVertices[l];if(!(h.x>=n.min.x&&h.x<=n.max.x&&h.y>=n.min.y&&h.y<=n.max.y||u.x>=n.min.x&&u.x<=n.max.x&&u.y>=n.min.y&&u.y<=n.max.y||sC(h,u,o))||this.isOnBorder(h.x,u.x)||this.isOnBorder(h.y,u.y))continue;let c=hm.computeEdgeHash(this.unevalVertices[r],this.unevalVertices[l]),d,p=this.vertexHashLookup.get(hm.computePosHash(h));d=null!=p?p.next:null!=(p=this.vertexHashLookup.get(hm.computePosHash(u)))?p.prev:c,this.unevalEdges.push({polygonIdx:e,a:r,b:l,hash:c,portalHash:d,isTunnel:a,type:"unevaluated"})}}addPortalCandidates(e,i,r,a,n){if(0===i.length)return;this.portalPolygons.add(e,{geometry:i,zLevel:n});let o=i[0];this.vertexHashLookup.clear();let s=hm.computeEdgeHash(o[o.length-2],o[o.length-1]);for(let i=0;i<o.length-1;i++){let n=o[i+0],l=o[i+1],h=eP.vec2.fromValues(l.x-n.x,l.y-n.y),u=eP.vec2.length(h);if(0===u)continue;let c="unevaluated",d=a.pointElevation(n),p=a.pointElevation(l);.01>Math.abs(d)&&.01>Math.abs(p)?c="entrance":(this.isOnBorder(n.x,l.x)||this.isOnBorder(n.y,l.y))&&(c="border");let f=hm.computeEdgeHash(n,l);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:n,vb:l,vab:h,length:u,hash:f,isTunnel:r,type:c});let m=hm.computePosHash(n);this.vertexHashLookup.set(m,{prev:s,next:f}),s=f}}construct(e){if(0===this.unevalVertices.length)return;let i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),r=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset},a=new hf(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);let n=i(),o=i(),s=i(),l=(e,i)=>{e.sort((e,r)=>e.type===i&&r.type!==i?-1:+(e.type!==i&&r.type===i));let r=e.findIndex(e=>e.type!==i);return r>=0?r:e.length},h=0;this.unevalEdges.length>0&&(h=l(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:h},this.tileToMeters));let u=i();if(this.unevalEdges.length>0){let e=this.unevalEdges.splice(h),i=l(e,"tunnel")+h;this.unevalEdges.push(...e),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:h},{min:h,max:i})}r(s),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),r(u),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),r(o),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),r(n),this.maskSegments=oI.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.depthSegments=oI.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableSegments=oI.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.shadowCasterSegments=oI.simpleSegment(0,n.primitiveOffset,0,n.primitiveLength)}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,lD.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,lR.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableSegments.destroy(),this.shadowCasterSegments.destroy())}computeVertexConnections(e,i,r,a){let n=new Map;for(let o=r;o<a;o++){let r=i[o],a=r.a,s=r.b;n.has(a)||n.set(a,{}),n.has(s)||n.set(s,{});let l=n.get(a),h=n.get(s);e[s]>0&&(l.to=s),e[a]>0&&(h.from=a)}return n}constructBridgeStructures(e,i,r,a,n,o){let s=this.computeVertexConnections(r,a,n.min,n.max),l=1/o,h=.5*l,u=e=>eP.vec3.fromValues(i[e].x,i[e].y,r[e]*l),c=e=>{let i=s.get(e),r=i.from,a=i.to;if(!r||!a)return;let n=u(r),o=u(e),l=u(a),h=eP.vec3.fromValues(0,0,0);if(!eP.vec3.exactEquals(n,o)){let e=eP.vec3.sub(eP.vec3.create(),o,n);eP.vec3.add(h,h,eP.vec3.normalize(e,e))}if(!eP.vec3.exactEquals(l,o)){let e=eP.vec3.sub(eP.vec3.create(),l,o);eP.vec3.add(h,h,eP.vec3.normalize(e,e))}let c=eP.vec3.len(h);return c>0?eP.vec3.scale(h,h,1/c):void 0};for(let s=n.min;s<n.max;s++){let n=a[s],u=this.prepareEdgePoints(i,r,n,(e,i)=>e>=i);if(null==u)continue;let d=u[0],p=u[1],f=eP.vec3.fromValues(d.coord.x,d.coord.y,l*d.height),m=eP.vec3.fromValues(p.coord.x,p.coord.y,l*p.height);if(eP.vec3.exactEquals(f,m))continue;let _=eP.vec3.sub(eP.vec3.create(),m,f);eP.vec3.normalize(_,_);let g=e=>eP.vec3.normalize(e,e),y=c(n.a)||_,x=c(n.b)||_,v=g(eP.vec3.fromValues(y[1],-y[0],0)),b=g(eP.vec3.fromValues(x[1],-x[0],0)),w=g(eP.vec3.cross(eP.vec3.create(),v,y)),T=g(eP.vec3.cross(eP.vec3.create(),b,x)),S=eP.vec3.create(),M=[eP.vec3.add(eP.vec3.create(),f,eP.vec3.scale(S,eP.vec3.sub(S,v,w),h)),eP.vec3.add(eP.vec3.create(),f,eP.vec3.scale(S,eP.vec3.add(S,v,w),h)),eP.vec3.add(eP.vec3.create(),f,eP.vec3.scale(S,w,h)),f],E=[eP.vec3.add(eP.vec3.create(),m,eP.vec3.scale(S,eP.vec3.sub(S,b,T),h)),eP.vec3.add(eP.vec3.create(),m,eP.vec3.scale(S,eP.vec3.add(S,b,T),h)),eP.vec3.add(eP.vec3.create(),m,eP.vec3.scale(S,T,h)),m],[A,I]=e.addVertices(v,o,M[0],M[1]),[C,P]=e.addVertices(b,o,E[0],E[1]);e.addTriangles([A,I,C,I,P,C]);let[z,D]=e.addVertices(w,o,M[1],M[2]),[R,L]=e.addVertices(T,o,E[1],E[2]);e.addTriangles([z,D,R,D,L,R]);let[O,k]=e.addVertices(eP.vec3.negate(v,v),o,M[2],M[3]),[F,B]=e.addVertices(eP.vec3.negate(b,b),o,E[2],E[3]);e.addTriangles([O,k,F,k,B,F])}}constructTunnelStructures(e,i,r,a,n,o){let s=e=>eP.vec3.normalize(e,e);for(let o=n.min;o<n.max;o++){let n=this.prepareEdgePoints(i,r,a[o],(e,i)=>e<=i);if(null==n)continue;let[l,h]=n,u=s(eP.vec3.fromValues(h.coord.y-l.coord.y,-(h.coord.x-l.coord.x),0));e.addQuad([l,h,{coord:h.coord,height:a[o].isTunnel?-.1:0},{coord:l.coord,height:a[o].isTunnel?-.1:0}],u)}for(let n=o.min;n<o.max;n++){let o=a[n],l=i[o.a],h=i[o.b],u=s(eP.vec3.fromValues(h.y-l.y,-(h.x-l.x),0
7));e.addQuad([{coord:h,height:0},{coord:l,height:0},{coord:l,height:r[o.a]+4},{coord:h,height:r[o.b]+4}],u),e.addQuad([{coord:l,height:0},{coord:h,height:0},{coord:h,height:r[o.b]+4},{coord:l,height:r[o.a]+4}],u)}}prepareEdgePoints(e,i,r,a){let n=e[r.a],o=e[r.b],s=i[r.a],l=i[r.b];if(!(0!==s&&a(s,0)||0!==l&&a(l,0)))return;let h=n.clone(),u=o.clone();if(a(s,0)){if(!a(l,0)){let e=l/(l-s);u.x=t$(u.x,h.x,e),u.y=t$(u.y,h.y,e),l=t$(l,s,e)}}else{let e=s/(s-l);h.x=t$(h.x,u.x,e),h.y=t$(h.y,u.y,e),s=t$(s,l,e)}return[{coord:h,height:s},{coord:u,height:l}]}prepareEdges(e,i){if(0===i.length)return;i.sort((e,i)=>e.hash===i.hash?i.polygonIdx-e.polygonIdx:i.hash>e.hash?1:-1);let r=0,a=0,n=0,o=i[0].polygonIdx;do(++a===i.length||i[r].hash!==i[a].hash)&&((1==a-r||i[a-1].polygonIdx!==o)&&(n<r&&(i[n]=i[r],i[r]=null),i[n].type="none",n++),(r=a)!==i.length&&(o=i[r].polygonIdx));while(r!==i.length);if(i.splice(n),0!==i.length&&0!==e.length){i.sort((e,i)=>e.hash<i.hash?1:-1);let r=0,a=0;for(;r!==i.length&&a!==e.length;){let n=i[r],o=e[a];n.portalHash>o.hash?r++:o.hash>n.portalHash?a++:(n.type=o.type,r++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=8192&&i>=8192}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(hm.computePosHash(e))<<32n|BigInt(hm.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}class h_{constructor(e,i){this.layoutVertexArray=new nj,this.indexArray=new n7,this.lineIndexArray=new n4,this.triangleSegments=new oI,this.lineSegments=new oI,this.programConfigurations=new o0(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new nZ)}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,lP.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,lz.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,r,a,n,o){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,r,a,n,o)}}class hg{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.bufferData=new h_(e,!1),this.elevationBufferData=new h_(e,!0),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference")}updateFootprints(e,i){}populate(e,i,r,a){this.hasPattern=lQ("fill",this.layers,this.pixelRatio,i);let n=this.layers[0].layout.get("fill-sort-key"),o=[];for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of e){let e=this.layers[0]._featureFilter.needGeometry,c=sg(s,e);if(!this.layers[0]._featureFilter.filter(new nl(this.zoom),c,r))continue;let d=n?n.evaluate(c,{},r,i.availableImages):void 0,p={id:l,properties:s.properties,type:s.type,sourceLayerIndex:u,index:h,geometry:e?c.geometry:s_(s,r,a),patterns:{},sortKey:d};o.push(p)}for(let a of(n&&o.sort((e,i)=>e.sortKey-i.sortKey),o)){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(this.hasPattern){let e=l0("fill",this.layers,a,this.zoom,this.pixelRatio,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,i,r,a,n,o,s){this.bufferData.update(e,i,r,a,n,o,s),this.elevationBufferData.update(e,i,r,a,n,o,s)}addFeatures(e,i,r,a,n,o){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,i,r,a,o,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}
7addFeature(e,i,r,a,n,o=[],s,l){let h=lY(i,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(e,h,a,r,l):this.addGeometry(h,this.bufferData),this.bufferData.populatePaintArrays(e,r,n,o,a,s),this.elevationBufferData.populatePaintArrays(e,r,n,o,a,s)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e){this.elevatedStructures&&this.elevatedStructures.construct(e)}addElevatedRoadFeature(e,i,r,a,n){let o=[],s=this.getElevationFeature(e,n);if(s){for(let n of(o.push({polygons:i,elevationFeature:s,elevationTileID:r}),o))if(n.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new hm(n.elevationTileID));let i=n.elevationFeature.isTunnel(),r=0;for(let a of(e.properties.hasOwnProperty(ha)&&(r=+e.properties[ha]),n.polygons))this.elevatedStructures.addPortalCandidates(n.elevationFeature.id,a,i,n.elevationFeature,r)}let i=new hc(r,n.elevationTileID);this.addElevatedGeometry(n.polygons,i,n.elevationFeature,.05*("hd-road-base"!==this.elevationMode),a)}}else this.addGeometry(i,this.bufferData)}addElevatedGeometry(e,i,r,a,n){let[o,s]=this.addGeometry(e,this.elevationBufferData,{elevation:r,elevationSampler:i,bias:a,index:n});null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:o,max:s}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,o),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,s))}addGeometry(e,i,r){let a=1/0,n=-1/0,o=null;r&&null!=(o=r.elevationSampler.constantElevation(r.elevation,r.bias))&&(a=o,n=o);let s=(e,s,l)=>{if(null!=r)if(s.push(e),null!=o)i.elevatedLayoutVertexArray.emplaceBack(o),l.push(o);else{let o=r.elevationSampler.pointElevation(e,r.elevation,r.bias);i.elevatedLayoutVertexArray.emplaceBack(o),l.push(o),a=Math.min(a,o),n=Math.max(n,o)}};for(let a of e){let e=0;for(let i of a)e+=i.length;let n=i.triangleSegments.prepareSegment(e,i.layoutVertexArray,i.indexArray),o=n.vertexLength,l=[],h=[],u=[],c=[],d=[],p=i.layoutVertexArray.length;for(let e of a){if(0===e.length)continue;e!==a[0]&&h.push(l.length/2);let n=i.lineSegments.prepareSegment(e.length,i.layoutVertexArray,i.lineIndexArray),o=n.vertexLength;r&&d.push(i.layoutVertexArray.length-p),s(e[0],u,c),i.layoutVertexArray.emplaceBack(e[0].x,e[0].y),i.lineIndexArray.emplaceBack(o+e.length-1,o),l.push(e[0].x),l.push(e[0].y);for(let r=1;r<e.length;r++)s(e[r],u,c),i.layoutVertexArray.emplaceBack(e[r].x,e[r].y),i.lineIndexArray.emplaceBack(o+r-1,o+r),l.push(e[r].x),l.push(e[r].y);n.vertexLength+=e.length,n.primitiveLength+=e.length}let f=lL(l,h);for(let e=0;e<f.length;e+=3)i.indexArray.emplaceBack(o+f[e],o+f[e+1],o+f[e+2]);if(r&&"hd-road-base"===this.elevationMode){let e=r.elevation.isTunnel(),i=r.elevation.safeArea,a=this.elevatedStructures.addVertices(u,c);this.elevatedStructures.addTriangles(f,a,e);let n=d.length;if(n>0){for(let o=0;o<n-1;o++)this.elevatedStructures.addRenderableRing(r.index,d[o]+a,d[o+1]-d[o],e,i);this.elevatedStructures.addRenderableRing(r.index,d[n-1]+a,u.length-d[n-1],e,i)}}n.vertexLength+=e,n.primitiveLength+=f.length/3}return[a,n]}getElevationFeature(e,i){if(!i)return;let r=+e.properties[hr];return null!=r?i.find(e=>e.id===r):void 0}}aT(hg,"FillBucket",{omit:["layers","patternFeatures"]}),aT(h_,"FillBufferData"),aT(hm,"ElevatedStructures");class hy{constructor(e,i,r,a){if(this.triangleCount=i.length/3,this.min=new eR(0,0),this.max=new eR(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[n,o]=[e[0].clone(),e[0].clone()];for(let i=1;i<e.length;++i){const r=e[i];n.x=Math.min(n.x,r.x),n.y=Math.min(n.y,r.y),o.x=Math.max(o.x,r.x),o.y=Math.max(o.y,r.y)}if(a&&(r=Math.max(r,Math.ceil(Math.max(o.x-n.x,o.y-n.y)/a))),0===r)return;this.min=n,this.max=o;const s=this.max.sub(this.min);s.x=Math.max(s.x,1),s.y=Math.max(s.y,1);const l=Math.max(s.x,s.y)/r;this.cellsX=Math.max(1,Math.ceil(s.x/l)),this.cellsY=Math.max(1,Math.ceil(s.y/l)),this.xScale=1/l,this.yScale=1/l;const h=[];for(let r=0;r<this.triangleCount;r++){const a=e[i[3*r+0]].sub(this.min),n=e[i[3*r+1]].sub(this.min),o=e[i[3*r+2]].sub(this.min),s=hx(Math.floor(Math.min(a.x,n.x,o.x)),this.xScale,this.cellsX),u=hx(Math.floor(Math.max(a.x,n.x,o.x)),this.xScale,this.cellsX),c=hx(Math.floor(Math.min(a.y,n.y,o.y)),this.yScale,this.cellsY),d=hx(Math.floor(Math.max(a.y,n.y,o.y)),this.yScale,this.cellsY),p=new eR(0,0),f=new eR(0,0),m=new eR(0,0),_=new eR(0,0);for(let e=c;e<=d;++e){p.y=f.y=e*l,m.y=_.y=(e+1)*l;for(let i=s;i<=u;++i)p.x=m.x=i*l,f.x=_.x=(i+1)*l,(sz(a,n,o,p,f,_)||sz(a,n,o,p,_,m))&&h.push({cellIdx:e*this.cellsX+i,triIdx:r})}}if(0===h.length)return;h.sort((e,i)=>e.cellIdx-i.cellIdx||e.triIdx-i.triIdx);let u=0;for(;u<h.length;){const e=h[u].cellIdx,i={start:this.payload.length,len:0};for(;u<h.length&&h[u].cellIdx===e;)++i.len,this.payload.push(h[u++].triIdx);this.cells[e]=i}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(0===this.triangleCount||0===this.cells.length||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;let r=hx(e.x-this.min.x,this.xScale,this.cellsX),a=hx(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[a*this.cellsX+r];if(n){this._lazyInitLookup();for(let e=0;e<n.len;e++){let r=this.payload[n.start+e],a=Math.floor(r/8),o=1<<r%8;if(!(this.lookup[a]&o)&&(this.lookup[a]|=o,i.push(r),i.length===this.triangleCount))return}}}query(e,i,r){if(0===this.triangleCount||0===this.cells.length||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();let a=hx(e.x-this.min.x,this.xScale,this.cellsX),n=hx(i.x-this.min.x,this.xScale,this.cellsX),o=hx(e.y-this.min.y,this.yScale,this.cellsY),s=hx(i.y-this.min.y,this.yScale,this.cellsY);for(let e=o;e<=s;e++)for(let i=a;i<=n;
7i++){let a=this.cells[e*this.cellsX+i];if(a)for(let e=0;e<a.len;e++){let i=this.payload[a.start+e],n=Math.floor(i/8),o=1<<i%8;if(!(this.lookup[n]&o)&&(this.lookup[n]|=o,r.push(i),r.length===this.triangleCount))return}}}}function hx(e,i,r){return Math.max(0,Math.min(r-1,Math.floor(e*i)))}aT(hy,"TriangleGridIndex");class hv{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.footprints=[]}updateFootprints(e,i){for(let r of this.footprints)i.push({footprint:r,id:e})}populate(e,i,r,a){let n=[];for(let{feature:i,id:o,index:s,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,h=sg(i,e);if(!this.layers[0]._featureFilter.filter(new nl(this.zoom),h,r))continue;let u={id:o,properties:i.properties,type:i.type,sourceLayerIndex:l,index:s,geometry:e?h.geometry:s_(i,r,a),patterns:{}};n.push(u)}for(let a of n){let{geometry:n,index:o,sourceLayerIndex:s}=a;this.addFeature(a,n,o,r,{},i.availableImages,i.brightness),i.featureIndex.insert(e[o].feature,n,o,s,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,i,r,a,n,o,s){}destroy(){}addFeature(e,i,r,a,n,o=[],s){for(let e of lY(i,2)){let i=[],r=[],a=[],n=new eR(1/0,1/0),o=new eR(-1/0,-1/0);for(let s of e)if(0!==s.length){s!==e[0]&&a.push(r.length/2);for(let e=0;e<s.length;e++)r.push(s[e].x),r.push(s[e].y),i.push(s[e]),n.x=Math.min(n.x,s[e].x),n.y=Math.min(n.y,s[e].y),o.x=Math.max(o.x,s[e].x),o.y=Math.max(o.y,s[e].y)}let s=lL(r,a),l=new hy(i,s,8,256);this.footprints.push({vertices:i,indices:s,grid:l,min:n,max:o})}}}aT(hv,"ClipBucket",{omit:["layers"]});let hb=nV([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),hw=nV([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),hT=nV([{name:"a_centroid_pos",components:2,type:"Uint16"}]),hS=nV([{name:"a_join_normal_inside",components:3,type:"Int16"}]),hM=nV([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),hE=nV([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:hA}=hb;class hI extends eR{constructor(e,i,r){super(e,i),this.z=r}}class hC extends hI{constructor(e,i,r,a){super(e,i,r),this.w=a}}function hP(e,i,r,a){let n=[],o=0===a?(e,i,r,a,n,o)=>{e.push(new eR(o,r+(o-i)/(a-i)*(n-r)))}:(e,i,r,a,n,o)=>{e.push(new eR(i+(o-r)/(n-r)*(a-i),o))};for(let s of e){let e=[];for(let n of s){if(n.length<=2)continue;let s=[];for(let e=0;e<n.length-1;e++){let l=n[e].x,h=n[e].y,u=n[e+1].x,c=n[e+1].y,d=0===a?l:h,p=0===a?u:c;d<i?p>i&&o(s,l,h,u,c,i):d>r?p<r&&o(s,l,h,u,c,r):s.push(n[e]),p<i&&d>=i&&o(s,l,h,u,c,i),p>r&&d<=r&&o(s,l,h,u,c,r)}let l=n[n.length-1],h=0===a?l.x:l.y;h>=i&&h<=r&&s.push(l),s.length&&(l=s[s.length-1],s[0].x===l.x&&s[0].y===l.y||s.push(s[0]),e.push(s))}e.length&&n.push(e)}return n}function hz(e,i,r,a){let n="x"===r?"y":"x",o=(a-e[r])/(i[r]-e[r]);e[n]=e[n]+(i[n]-e[n])*o,e[r]=a,e.hasOwnProperty("z")&&(e.z=t$(e.z,i.z,o)),e.hasOwnProperty("w")&&(e.w=t$(e.w,i.w,o))}function hD(e,i,r,a){for(let n of["x","y"]){let o=e,s=i;o[n]>=s[n]&&(o=i,s=e),o[n]<r&&s[n]>r&&hz(o,s,n,r),o[n]<a&&s[n]>a&&hz(s,o,n,a)}}let hR=Number.MAX_SAFE_INTEGER;function hL(e,i,r,a){var n;return e.order<i||e.order===hR||!(e.clipMask&r)||0!==(n=e.clipScope).length&&void 0===n.find(e=>e===a)}function hO(e,i){return e.x-i.x||e.y-i.y}function hk(e,i){return 0===hO(e.min,i.min)&&0===hO(e.max,i.max)}function hF(e,i){return!(e.min.x>i.max.x||e.max.x<i.min.x||e.min.y>i.max.y||e.max.y<i.min.y)}function hB(e,i){if(e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(e[r].sourceId!==i[r].sourceId||!hk(e[r],i[r])||e[r].order!==i[r].order||e[r].clipMask!==i[r].clipMask||!eL(e[r].clipScope,i[r].clipScope))return!1;return!0}function hN(e,i,r){let a=1/(1<<r.canonical.z),n=(1220703125e-13*i.x+r.canonical.x)*a+r.wrap,o=(1220703125e-13*i.y+r.canonical.y)*a;return{min:new eR((1220703125e-13*e.x+r.canonical.x)*a+r.wrap,(1220703125e-13*e.y+r.canonical.y)*a),max:new eR(n,o)}}function hV(e,i,r,a,n,o,s){let l=e.indices,h=e.vertices,u=[];for(let c=a;c<a+n;c+=3){let a=i[r[c+0]+o],n=i[r[c+1]+o],d=i[r[c+2]+o],p=Math.min(a.x,n.x,d.x),f=Math.max(a.x,n.x,d.x),m=Math.min(a.y,n.y,d.y),_=Math.max(a.y,n.y,d.y);u.length=0,e.grid.query(new eR(p,m),new eR(f,_),u);for(let e=0;e<u.length;e++){let i=u[e];
7if(sz(h[l[3*i+0]],h[l[3*i+1]],h[l[3*i+2]],a,n,d,s))return!0}}return!1}function hU(e,i,r,a){let n=Math.pow(2,a.z-r.z);return new eR((e+8192*r.x)*n-8192*a.x,(i+8192*r.y)*n-8192*a.y)}function hj(e,i){let r=[];i.grid.queryPoint(e,r);let a=i.indices,n=i.vertices;for(let i=0;i<r.length;i++){let o=r[i];if(sA([n[a[3*o+0]],n[a[3*o+1]],n[a[3*o+2]]],e))return!0}return!1}let hG=[new eR(0,0),new eR(8192,0),new eR(8192,8192),new eR(0,8192)];function hq(e,i){let r=[],a=[];if(!i||e.length<2)return[e];if(2===e.length)return sC(e[0],e[1],hG)?[e]:[];for(let i=0;i<e.length+2;i++){let n=e[i%e.length],o=e[(i+1)%e.length],s=sC(0===i?e[e.length-1]:e[(i-1)%e.length],n,hG),l=sC(n,o,hG),h=s||l;h&&a.push(n),h&&l||a.length>0&&(a.length>1&&r.push(a),a=[])}return a.length>1&&r.push(a),r}let hZ=hi.VectorTileFeature.types,hH=["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"],h$=["fill-extrusion-flood-light-ground-radius"],hW=new eR(0,1);function hX(e,i,r,a,n,o,s,l){e.emplaceBack((i<<1)+s,(r<<1)+o,(Math.floor(8192*a)<<1)+n,Math.round(l))}function hY(e,i,r){e.emplaceBack(8192*i.x,8192*i.y,+!!r)}function hK(e,i,r,a,n,o){e.emplaceBack(i.x,i.y,(r.x<<1)+a,(r.y<<1)+n,o)}function hJ(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class hQ{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class h0{constructor(){this.centroidXY=new eR(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 eR(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new eR(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new eR(this.max.x-this.min.x,this.max.y-this.min.y)}}class h1{constructor(){this.acc=new eR(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,r){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),a&&this.checkBorderIntersection(i,r)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,t$(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>8192!=e.x>8192&&this.addBorderIntersection(1,t$(i.y,e.y,(8192-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,t$(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>8192!=e.y>8192&&this.addBorderIntersection(3,t$(i.x,e.x,(8192-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);let r=this.borders[e];i<r[0]&&(r[0]=i),i>r[1]&&(r[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;let r=+(0!==e.x);this.addBorderIntersection(r,i.y),this.addBorderIntersection(r,e.y)}else{let r=0===e.y?2:3;this.addBorderIntersection(r,i.x),this.addBorderIntersection(r,e.x)}}centroid(){return 0===this.accCount?new eR(0,0):new eR(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function h2(e,i){let r=e.add(i)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(eU(e.x*r.x+e.y*r.y,-1,1)))))/4*32767*(e.x*i.y-e.y*i.x<0?-1:1)}let h3=[e=>e.x<0,e=>e.x>8192,e=>e.y<0,e=>e.y>8192];class h4{constructor(e){this.vertexArray=new nW,this.indexArray=new n7,this.programConfigurations=new o0(e.layers,{zoom:e.zoom,lut:e.lut},e=>h$.includes(e)),this._segments=new oI,this.hiddenByLandmarkVertexArray=new od,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new oI}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,i,r,a=!1){let n=e.length;if(n>2){let o,s=Math.max(0,this._segments.get().length-1),l=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{let i=e[0],r=e[1];o=h2(i.sub(e[n-1])._perp()._unit(),r.sub(i)._perp()._unit())}for(let h=0;h<n;h++){let u=h===n-1?0:h+1,c=e[h],d=e[u],p=e[u===n-1?0:u+1],f=d.sub(c)._perp()._unit(),m=h2(f,p.sub(d)._perp()._unit()),_=o;if(h9(c,d,i)||a&&h7(c,i)&&h7(d,i)){o=m;continue}let g=l.vertexLength;
7for(let e of(hK(this.vertexArray,c,d,1,1,_),hK(this.vertexArray,c,d,1,0,_),hK(this.vertexArray,c,d,0,1,m),hK(this.vertexArray,c,d,0,0,m),l.vertexLength+=4,function(e,i,r,a){let n=[4];if(0===a)return n;r._mult(a);let o=e.sub(r),s=i.sub(r),l=[e,i,o,s];for(let e=0;e<4;e++)for(let i of l)if(h3[e](i)){n.push(e);break}return n}(c,d,f,r)))this._segmentToGroundQuads[s].push({id:g,region:e}),this._segmentToRegionTriCounts[s][e]+=2,l.primitiveLength+=2;o=m}}}prepareBorderSegments(){if(!this.hasData())return;let e=this._segments.get(),i=e.length;for(let e=0;e<i;e++)this._segmentToGroundQuads[e].sort((e,i)=>e.region-i.region);for(let r=0;r<i;r++){let i=this._segmentToGroundQuads[r],a=e[r],n=this._segmentToRegionTriCounts[r];n.reduce((e,i)=>e+i,0);let o=0;for(let e=0;e<=4;e++){let i=n[e];if(0!==i){let r=this.regionSegments[e];r||(r=this.regionSegments[e]=new oI);let n={vertexOffset:a.vertexOffset,primitiveOffset:a.primitiveOffset+o,vertexLength:a.vertexLength,primitiveLength:i};r.get().push(n)}o+=i}for(let e=0;e<i.length;e++){let r=i[e].id;this.indexArray.emplaceBack(r,r+1,r+3),this.indexArray.emplaceBack(r,r+3,r+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,r,a,n,o){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,r,a,n,o)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,hw.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,r,a,n,o,s){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,r,a,n,o,s)}updateHiddenByLandmark(e){if(!this.hasData())return;let i=e.groundVertexCount+e.groundVertexArrayOffset;if(0===e.groundVertexCount)return;let r=0x80000000&e.flags?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,r);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,hM.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._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){let i=this.regionSegments[e];i&&i.destroy()}}}}class h5{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new n7,this.footprintVertices=new nj,this.footprintSegments=[],this.layoutVertexArray=new nq,this.centroidVertexArray=new oT,this.wallVertexArray=new oM,this.indexArray=new n7,this.programConfigurations=new o0(e.layers,{zoom:e.zoom,lut:e.lut},e=>hH.includes(e)),this.segments=new oI,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new h4(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,r,a){for(let{feature:n,id:o,index:s,sourceLayerIndex:l}of(this.features=[],this.hasPattern=lQ("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=sd(r),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),e)){let e=this.layers[0]._featureFilter.needGeometry,h=sg(n,e);if(!this.layers[0]._featureFilter.filter(new nl(this.zoom),h,r))continue;let u={id:o,sourceLayerIndex:l,index:s,geometry:e?h.geometry:s_(n,r,a),properties:n.properties,type:n.type,patterns:{}},c=this.layoutVertexArray.length,d="Polygon"===hZ[u.type];if(this.hasPattern)this.features.push(l0("fill-extrusion",this.layers,u,this.zoom,this.pixelRatio,i));else if(this.wallMode)for(let e of u.geometry)for(let n of hq(e,d))this.addFeature(u,[n],s,r,{},i.availableImages,a,i.brightness);else this.addFeature(u,u.geometry,s,r,{},i.availableImages,a,i.brightness);i.featureIndex.insert(n,u.geometry,s,l,this.index,c)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,r,a,n,o){for(let e of this.features){let s="Polygon"===hZ[e.type],{geometry:l}=e;if(this.wallMode)for(let h of l)for(let l of hq(h,s))this.addFeature(e,[l],e.index,i,r,a,n,o);else this.addFeature(e,l,e.index,i,r,a,n,o)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s),this.groundEffect.update(e,i,n,r,a,o,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hA),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,hS.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,hE.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,hT.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,r,a,n,o,s,l){var h;let u,c,d=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,p=[new eR(0,0),new eR(8192,8192)],f=s.projection,m="globe"===f.name,_=this.wallMode||"Polygon"===hZ[e.type],g=new h1;g.centroidDataIndex=this.centroidData.length;let y=new h0,x=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a),v=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);if(y.height=v,y.vertexArrayOffset=this.layoutVertexArray.length,y.groundVertexArrayOffset=this.groundEffect.vertexArray.length,m&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new nQ),this.wallMode){if(m)return void e0("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==i.length)return;i=[(u=function(e){let i=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;(function(e){let i=0,r=e.length;for(let a=0;a<r;a++)i+=(e[(a+1)%r].x-e[a].x)*(e[(a+1)%r].y+e[a].y);return i>=0})(e)||(e=e.reverse());let r={geometry:[],joinNormals:[],indices:[]},a=[],n=[],o=[],s=e.length;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;if(s<(i?3:2))return r;let l,h,u,c,d,p=0;for(;p<s-1&&e[p].equals(e[p+1]);)p++;i&&(l=e[s-2],d=e[p].sub(l)._unit()._perp());for(let r=p;r<s;r++){if((u=r===s-1?i?e[p+1]:void 0:e[r+1])&&e[r].equals(u))continue;d&&(c=d),l&&(h=l),l=e[r],d=u?u.sub(l)._unit()._perp():c;let f=(c=c||d).add(d);0===f.x&&0===f.y||f._unit();let m=f.x*d.x+f.y*d.y,_=0!==m?1/m:1/0,g=c.x*d.y-c.y*d.x>0,y="miter";
7"miter"===y&&_>2&&(y="bevel"),"bevel"===y&&(_>100&&(y="flipbevel"),_<2&&(y="miter"));let x=(e,i,r,s)=>{let l=new eR(e.x,e.y),h=new eR(e.x,e.y);l.x+=i.x*s,l.y+=i.y*s,h.x-=i.x*Math.max(r,1),h.y-=i.y*Math.max(r,1),o.push(i),a.push(l),n.push(h)};if("miter"===y)f._mult(_),x(l,f,0,0);else if("flipbevel"===y)x(l,f=d.mult(-1),0,0),x(l,f.mult(-1),0,0);else{let e=-Math.sqrt(_*_-1),i=g?e:0,r=g?0:e;h&&x(l,c,i,r),u&&x(l,d,i,r)}}r.geometry=[...a,...n.reverse(),a[0]],r.joinNormals=[...o,...o.reverse(),o[o.length-1]];let f=r.geometry.length-1;for(let e=0;e<f/2;e++)if(e+1<f/2){let i=e,a=e+1,n=f-1-e,o=f-2-e;i=0===i?f-1:i-1,a=0===a?f-1:a-1,n=0===n?f-1:n-1,o=0===o?f-1:o-1,r.indices.push(n),r.indices.push(a),r.indices.push(i),r.indices.push(n),r.indices.push(o),r.indices.push(a)}return r}(i[0])).geometry]}let b=(e,i)=>e<(i.length-1)/2||e===i.length-1,w=this.wallMode?[i]:lY(i,500);for(let e=w.length-1;e>=0;e--){let i=w[e];(0===i.length||(h=i[0]).every(e=>e.x<=0)||h.every(e=>e.x>=8192)||h.every(e=>e.y<=0)||h.every(e=>e.y>=8192))&&w.splice(e,1)}if(m)c=ur(w,p,a);else for(let e of(c=[],w))c.push({polygon:e,bounds:p});let T=_?this.edgeRadius:0,S=T>0&&this.zoom<17,M=(e,i)=>{if(0===e.length)return!1;let r=e[e.length-1];return i.x===r.x&&i.y===r.y};for(let{polygon:e,bounds:i}of c){let r=0,n=0;for(let i of e)_&&!i[0].equals(i[i.length-1])&&i.push(i[0]),n+=_?i.length-1:i.length;let o=this.segments.prepareSegment((_?5:4)*n,this.layoutVertexArray,this.indexArray);y.footprintSegIdx<0&&(y.footprintSegIdx=this.footprintSegments.length),y.polygonSegIdx<0&&(y.polygonSegIdx=this.polygonSegments.length);let s={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},l=new hQ;if(l.vertexOffset=this.footprintVertices.length,l.indexOffset=3*this.footprintIndices.length,l.ringIndices=[],_){let n=[],s=[];r=o.vertexLength;for(let r=0;r<e.length;r++){let h,c,p=e[r];p.length&&0!==r&&s.push(n.length/2);let _=[];h=p[1].sub(p[0])._perp()._unit(),l.ringIndices.push(p.length-1);for(let e=1;e<p.length;e++){let i=p[e],r=p[e===p.length-1?1:e+1],s=i.clone();if(T){c=r.sub(i)._perp()._unit();let e=h.add(c)._unit(),a=T*Math.min(4,1/(h.x*e.x+h.y*e.y));s.x+=a*e.x,s.y+=a*e.y,s.x=Math.round(s.x),s.y=Math.round(s.y),h=c}if(!x||0!==T&&!S||M(_,s)||_.push(s),hX(this.layoutVertexArray,s.x,s.y,0,0,1,1,0),this.wallMode){let i=b(e,p);hY(this.wallVertexArray,u.joinNormals[e],!i)}o.vertexLength++,this.footprintVertices.emplaceBack(i.x,i.y),n.push(i.x,i.y),m&&hJ(this.layoutVertexExtArray,f.projectTilePoint(s.x,s.y,a),f.upVector(a,s.x,s.y))}x&&(0===T||S)&&(0!==_.length&&M(_,_[0])&&_.pop(),this.groundEffect.addData(_,i,d))}let h=this.wallMode?u.indices:lL(n,s);for(let e=0;e<h.length;e+=3)this.footprintIndices.emplaceBack(l.vertexOffset+h[e+0],l.vertexOffset+h[e+1],l.vertexOffset+h[e+2]),this.indexArray.emplaceBack(r+h[e],r+h[e+2],r+h[e+1]),o.primitiveLength++;l.indexCount+=h.length,l.vertexCount+=this.footprintVertices.length-l.vertexOffset}for(let n=0;n<e.length;n++){let s,l,h,c=e[n];g.startRing(y,c[0]);let p=c.length>4&&ue(c[c.length-2],c[0],c[1]),v=T?function(e,i,r,a){let n=i.sub(e)._perp()._unit(),o=r.sub(i)._perp()._unit();return h8(e,i,r,h6(n,o),a)}(c[c.length-2],c[0],c[1],T):0,w=[];l=c[1].sub(c[0])._perp()._unit();let S=!0;for(let e=1,n=0;e<c.length;e++){let d=c[e-1],_=c[e],E=c[e===c.length-1?1:e+1];if(g.appendEdge(y,_,d),h9(_,d,i)){T&&(l=E.sub(_)._perp()._unit(),S=!S);continue}let A=_.sub(d)._perp(),I=A.x/(Math.abs(A.x)+Math.abs(A.y)),C=+(A.y>0),P=d.dist(_);if(n+P>32768&&(n=0),T){h=E.sub(_)._perp()._unit();let e=h8(d,_,E,h6(l,h),T);isNaN(e)&&(e=0);let i=_.sub(d)._unit();d=d.add(i.mult(v))._round(),_=_.add(i.mult(-e))._round(),v=e,l=h,x&&this.zoom>=17&&(M(w,d)||w.push(d),M(w,_)||w.push(_))}let z=o.vertexLength,D=c.length>4&&ue(d,_,E),R=ut(n,p,S);if(hX(this.layoutVertexArray,d.x,d.y,I,C,0,0,R),hX(this.layoutVertexArray,d.x,d.y,I,C,0,1,R),this.wallMode){let i=b(e-1,c),r=u.joinNormals[e-1];hY(this.wallVertexArray,r,i),hY(this.wallVertexArray,r,i)}if(n+=P,R=ut(n,D,!S),p=D,hX(this.layoutVertexArray,_.x,_.y,I,C,0,0,R),hX(this.layoutVertexArray,_.x,_.y,I,C,0,1,R),this.wallMode){let i=b(e,c),r=u.joinNormals[e];hY(this.wallVertexArray,r,i),hY(this.wallVertexArray,r,i)}if(o.vertexLength+=4,this.indexArray.emplaceBack(z+0,z+1,z+2),this.indexArray.emplaceBack(z+1,z+3,z+2),o.primitiveLength+=2,T){let a=r+(1===e?c.length-2:e-2),n=1===e?r:a+1;if(this.indexArray.emplaceBack(z+1,a,z+3),this.indexArray.emplaceBack(a,n,z+3),o.primitiveLength+=2,void 0===s&&(s=z),!h9(E,c[e],i)){let i=e===c.length-1?s:o.vertexLength;this.indexArray.emplaceBack(z+2,z+3,i),this.indexArray.emplaceBack(z+3,i+1,i),this.indexArray.emplaceBack(z+3,n,i+1),o.primitiveLength+=3}S=!S}if(m){let e=this.layoutVertexExtArray,i=f.projectTilePoint(d.x,d.y,a),r=f.projectTilePoint(_.x,_.y,a),n=f.upVector(a,d.x,d.y),o=f.upVector(a,_.x,_.y);hJ(e,i,n),hJ(e,i,n),hJ(e,r,o),hJ(e,r,o)}}_&&(r+=c.length-1),x&&T&&this.zoom>=17&&(0!==w.length&&M(w,w[0])&&w.pop(),this.groundEffect.addData(w,i,d,T>0))}this.footprintSegments.push(l),s.triangleCount=this.indexArray.length-s.triangleArrayOffset,this.polygonSegments.push(s),++y.footprintSegLen,++y.polygonSegLen}if(y.vertexCount=this.layoutVertexArray.length-y.vertexArrayOffset,y.groundVertexCount=this.groundEffect.vertexArray.length-y.groundVertexArrayOffset,0!==y.vertexCount){if(y.centroidXY=g.borders?hW:this.encodeCentroid(g,y),this.centroidData.push(y),g.borders){this.featuresOnBorder.push(g);let e=this.featuresOnBorder.length-1;for(let i=0;i<g.borders.length;i++)g.borders[i][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[i].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,l),this.groundEffect.addPaintPropertiesData(e,r,n,o,a,l),this.maxHeight=Math.max(this.maxHeight,v)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,r)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[r].borders[e][0])}splitToSubtiles(){let e=[];for(let i=0;i<this.centroidData.length;i++){let r=this.centroidData[i],a=+(r.min.y+r.max.y>8192),n=2*a+(r.min.x+r.max.x>8192^a);for(let a=0;a<r.polygonSegLen;a++){let o=r.polygonSegIdx+a;e.push({centroidIdx:i,subtile:n,polygonSegmentIdx:o,triangleSegmentIdx:this.polygonSegments[o].triangleSegIdx})}}let i=new n7;e.sort((e,i)=>e.triangleSegmentIdx===i.triangleSegmentIdx?e.subtile-i.subtile:e.triangleSegmentIdx-i.triangleSegmentIdx);let r=0,a=0,n=0;
7for(let i of e){if(i.triangleSegmentIdx!==r)break;n++}let o=e.length;for(;a!==e.length;){r=e[a].triangleSegmentIdx;let s=0,l=a,h=a;for(let i=l;i<n&&e[i].subtile===s;i++)h++;for(;l!==n;){let a=e[l];s=a.subtile;let o=this.centroidData[a.centroidIdx].min.clone(),u=this.centroidData[a.centroidIdx].max.clone(),c={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let r=l;r<h;r++){let a=e[r],n=this.polygonSegments[a.polygonSegmentIdx],s=this.centroidData[a.centroidIdx].min,l=this.centroidData[a.centroidIdx].max,h=this.indexArray.uint16;for(let e=n.triangleArrayOffset;e<n.triangleArrayOffset+n.triangleCount;e++)i.emplaceBack(h[3*e],h[3*e+1],h[3*e+2]);c.primitiveLength+=n.triangleCount,o.x=Math.min(o.x,s.x),o.y=Math.min(o.y,s.y),u.x=Math.max(u.x,l.x),u.y=Math.max(u.y,l.y)}c.primitiveLength>0&&this.triangleSubSegments.push({segment:c,min:o,max:u}),l=h;for(let i=l;i<n&&e[i].subtile===e[l].subtile;i++)h++}a=n;for(let i=a;i<o&&e[i].triangleSegmentIdx===e[a].triangleSegmentIdx;i++)n++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,r){let a,n=new oI;if(this.wallMode){for(let e of this.triangleSubSegments)n.segments.push(e.segment);return n}let o=0,s=0,l=1<<e.canonical.z;if(i){let r=i.getMinMaxForTile(e);r&&(o=r.min,s=r.max)}s+=this.maxHeight;let h=e.toUnwrapped(),u=[h.canonical.x/l+h.wrap,h.canonical.y/l],c=[(h.canonical.x+1)/l+h.wrap,(h.canonical.y+1)/l],d=(e,i,r)=>[e[0]*(1-r[0])+i[0]*r[0],e[1]*(1-r[1])+i[1]*r[1]],p=[],f=[];for(let e of this.triangleSubSegments){p[0]=e.min.x/8192,p[1]=e.min.y/8192,f[0]=e.max.x/8192,f[1]=e.max.y/8192;let i=d(u,c,p),l=d(u,c,f);if(0===new s1([i[0],i[1],o],[l[0],l[1],s]).intersectsPrecise(r)){a&&(n.segments.push(a),a=void 0);continue}let h=e.segment;a&&a.vertexOffset!==h.vertexOffset&&(n.segments.push(a),a=void 0),a?(a.vertexLength+=h.vertexLength,a.primitiveLength+=h.primitiveLength):a={vertexOffset:h.vertexOffset,primitiveLength:h.primitiveLength,vertexLength:h.vertexLength,primitiveOffset:h.primitiveOffset,sortKey:void 0,vaos:{}}}return a&&n.segments.push(a),n}encodeCentroid(e,i){let r=e.centroid(),a=i.span(),n=Math.min(7,Math.round(a.x*this.tileToMeter/10)),o=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new eR(eU(r.x,1,8191)<<3|n,eU(r.y,1,8191)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new eR(0,0);let i=e.borders,r=Number.MAX_VALUE;if(i[0][0]!==r||i[1][0]!==r){let e=+(i[0][0]===r);return new eR(6|65528*(i[0][0]===r),(i[e][0]+i[e][1])/2<<3|6)}{let e=i[2][0]!==r?2:3;return new eR((i[e][0]+i[e][1])/2<<3|6,6|65528*(i[2][0]===r))}}showCentroid(e){let i=this.centroidData[e.centroidDataIndex];i.flags&=0x80000000,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);let i=e.vertexArrayOffset,r=e.vertexCount+e.vertexArrayOffset,a=0x80000000&e.flags?hW:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||n!==a.x){for(let e=i;e<r;++e)this.centroidVertexArray.emplace(e,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){for(let e of(this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.centroidData))this.writeCentroidToBuffer(e)}updateReplacement(e,i,r){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let a=i.getReplacementRegionsForTile(e.toUnwrapped());if(hB(this.activeReplacements,a))return;if(this.activeReplacements=a,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(let e of this.centroidData)e.flags&=0x7fffffff;let n=[];for(let i of this.activeReplacements){if(i.order<r)continue;let a=Math.max(1,Math.pow(2,i.footprintTileId.canonical.z-e.canonical.z));for(let r of this.centroidData)if(!(0x80000000&r.flags||i.min.x>r.max.x||r.min.x>i.max.x||i.min.y>r.max.y||r.min.y>i.max.y))for(let o=0;o<r.footprintSegLen;o++){let s=this.footprintSegments[r.footprintSegIdx+o];if(n.length=0,function(e,i,r,a,n,o){let s=Math.pow(2,a.z-n.z);for(let l=0;l<r;l++){let r=e.int16[2*(l+i)+0],h=e.int16[2*(l+i)+1];r=(r+8192*n.x)*s-8192*a.x,h=(h+8192*n.y)*s-8192*a.y,o.push(new eR(r,h))}}(this.footprintVertices,s.vertexOffset,s.vertexCount,i.footprintTileId.canonical,e.canonical,n),hV(i.footprint,n,this.footprintIndices.uint16,s.indexOffset,s.indexCount,-s.vertexOffset,
7-a)){r.flags|=0x80000000;break}}}for(let e of this.centroidData)this.writeCentroidToBuffer(e);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,r){let a=!1;for(let n=0;n<r.footprintSegLen;n++){let o=this.footprintSegments[r.footprintSegIdx+n],s=0;for(let r of o.ringIndices){for(let n=s,l=r+s-1;n<r+s;l=n++){let r=this.footprintVertices.int16[2*(n+o.vertexOffset)+0],s=this.footprintVertices.int16[2*(n+o.vertexOffset)+1],h=this.footprintVertices.int16[2*(l+o.vertexOffset)+1];s>i!=h>i&&e<(this.footprintVertices.int16[2*(l+o.vertexOffset)+0]-r)*(i-s)/(h-s)+r&&(a=!a)}s=r}}return a}getHeightAtTileCoord(e,i){let r=-1/0,a=!0,n=4*(e+8192)*8192+(i+8192);if(this.partLookup.hasOwnProperty(n)){let e=this.partLookup[n];return e?{height:e.height,hidden:!!(0x80000000&e.flags)}:void 0}for(let o of this.centroidData)e>o.max.x||o.min.x>e||i>o.max.y||o.min.y>i||this.footprintContainsPoint(e,i,o)&&o&&o.height>r&&(r=o.height,this.partLookup[n]=o,a=!!(0x80000000&o.flags));if(r!==-1/0)return{height:r,hidden:a};this.partLookup[n]=void 0}}function h6(e,i){let r=e.add(i)._unit();return e.x*r.x+e.y*r.y}function h8(e,i,r,a,n){let o=Math.sqrt(1-a*a);return Math.min(e.dist(i)/3,i.dist(r)/3,n*o/a)}function h9(e,i,r){return e.x<r[0].x&&i.x<r[0].x||e.x>r[1].x&&i.x>r[1].x||e.y<r[0].y&&i.y<r[0].y||e.y>r[1].y&&i.y>r[1].y}function h7(e,i){return e.x<i[0].x||e.x>i[1].x||e.y<i[0].y||e.y>i[1].y}function ue(e,i,r){if(e.x<0||e.x>=8192||i.x<0||i.x>=8192||r.x<0||r.x>=8192)return!1;let a=r.sub(i),n=a.perp(),o=e.sub(i);return(a.x*o.x+a.y*o.y)/Math.sqrt((a.x*a.x+a.y*a.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function ut(e,i,r){let a=i?2|e:-3&e;return r?1|a:-2&a}function ui(){let e=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*e*e)-6371008.8}function ur(e,i,r){let a=1<<r.z,n=so(r.x/a);return function(e,i,r,a,n=0,o){let s=[];if(!e.length||!r||!a)return s;let l=(e,i)=>{for(let r of e)s.push({polygon:r,bounds:i})},h=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(a)),c=h-u,d=[];for(let e=0;e<Math.abs(c);e++)d.push(c>0?0:1);for(let e=0;e<Math.min(h,u);e++)d.push(0),d.push(1);let p=e;if(p=hP(p,i[0].y-n,i[1].y+n,1),!(p=hP(p,i[0].x-n,i[1].x+n,0)).length)return s;let f=[];for(d.length?f.push({polygons:p,bounds:i,depth:0}):l(p,i);f.length;){let e=f.pop(),i=e.depth,r=d[i],a=e.bounds[0],s=e.bounds[1],h=0===r?a.x:a.y,u=0===r?s.x:s.y,c=o?o(r,h,u):.5*(h+u),p=hP(e.polygons,h-n,c+n,r),m=hP(e.polygons,c-n,u+n,r);if(p.length){let e=[a,new eR(0===r?c:s.x,1===r?c:s.y)];d.length>i+1?f.push({polygons:p,bounds:e,depth:i+1}):l(p,e)}if(m.length){let e=[new eR(0===r?c:a.x,1===r?c:a.y),s];d.length>i+1?f.push({polygons:m,bounds:e,depth:i+1}):l(m,e)}}return s}(e,i,Math.ceil((so((r.x+1)/a)-n)/11.25),Math.ceil((ss(r.y/a)-ss((r.y+1)/a))/11.25),1,(e,i,n)=>{if(0===e)return .5*(i+n);{let e=ss((r.y+i/8192)/a);return(sn(.5*(ss((r.y+n/8192)/a)+e))*a-r.y)*8192}})}function ua(e,i){return e.x*i.x+e.y*i.y}function un(e,i){if(1===e.length){let r,a=0,n=i[a++];for(;!r||n.equals(r);)if(!(r=i[a++]))return 1/0;for(;a<i.length;a++){let o=i[a],s=e[0],l=r.sub(n),h=o.sub(n),u=s.sub(n),c=ua(l,l),d=ua(l,h),p=ua(h,h),f=ua(u,l),m=ua(u,h),_=c*p-d*d,g=(p*f-d*m)/_,y=(c*m-d*f)/_,x=n.z*(1-g-y)+r.z*g+o.z*y;if(isFinite(x))return x}return 1/0}{let e=1/0;for(let r of i)e=Math.min(e,r.z);return e}}function uo(e,i,r,a,n,o,s,l){var h,u;let c,d,p,f,m,_,g,y,x,v,b,w,T,S,M=s*n.getElevationAt(e,i,!0,!0),E=0!==o[0],A=E?0===o[1]?s*(o[0]/7-450):s*(c=Math.floor(o[0]/8),d=Math.floor(o[1]/8),p=10*(o[0]-8*c),f=10*(o[1]-8*d),m=n.getElevationAt(c,d,!0,!0),g=Math.floor(.5*(p*(_=n.getMeterToDEM(l))-1)),y=Math.floor(.5*(f*_-1)),x=n.tileCoordToPixel(c,d),v=2*g+1,b=2*y+1,h=x.x-g,u=x.y-y,T=Math.abs((w=[n.getElevationAtPixel(h,u,!0),n.getElevationAtPixel(h+b,u,!0),n.getElevationAtPixel(h,u+b,!0),n.getElevationAtPixel(h+v,u+b,!0)])[0]-w[1]),S=Math.abs(w[2]-w[3]),m+Math.max(Math.min(.25,.5*_*(T+S)/v)*p,Math.min(.25,.5*_*(Math.abs(w[0]-w[2])+Math.abs(w[1]-w[3]))/b)*f)):M;return{base:M+(0===r?-1:r),top:E?Math.max(A+a,M+r+2):M+a}}aT(h5,"FillExtrusionBucket",{omit:["layers","features"]}),aT(h0,"PartData"),aT(hQ,"FootprintSegment"),aT(h1,"BorderCentroidData"),aT(h4,"GroundEffect");let us=nV([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),ul=nV([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:uh}=us,{members:uu}=nV([{name:"a_packed",components:3,type:"Float32"}]),{members:uc}=nV([{name:"a_pattern_data",components:3,type:"Float32"}]);class ud{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new lE({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){let r=this.getKey(e,i);return this.positions[r]}trim(){let e=this.width,i=this.height=eW(this.nextRow);this.image.resize({width:e,height:i})}
7getKey(e,i){return e.join(",")+i}getDashRanges(e,i,r){let a=[],n=e.length%2==1?-e[e.length-1]*r:0,o=e[0]*r,s=!0;a.push({left:n,right:o,isDash:s,zeroLength:0===e[0]});let l=e[0];for(let i=1;i<e.length;i++){s=!s;let h=e[i];n=l*r,l+=h,o=l*r,a.push({left:n,right:o,isDash:s,zeroLength:0===h})}return a}addRoundDash(e,i,r){let a=i/2;for(let i=-r;i<=r;i++){let n=this.width*(this.nextRow+r+i),o=0,s=e[0];for(let l=0;l<this.width;l++){let h;l/s.right>1&&(s=e[++o]);let u=Math.min(Math.abs(l-s.left),Math.abs(l-s.right)),c=i/r*(a+1);if(s.isDash){let e=a-Math.abs(c);h=Math.sqrt(u*u+e*e)}else h=a-Math.sqrt(u*u+c*c);this.image.data[n+l]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,i){for(let i=e.length-1;i>=0;--i){let r=e[i],a=e[i+1];r.zeroLength?e.splice(i,1):a&&a.isDash===r.isDash&&(a.left=r.left,e.splice(i,1))}let r=e[0],a=e[e.length-1];r.isDash===a.isDash&&(r.left=a.left-this.width,a.right=r.right+this.width);let n=this.width*this.nextRow,o=0,s=e[0];for(let r=0;r<this.width;r++){r/s.right>1&&(s=e[++o]);let a=Math.min(Math.abs(r-s.left),Math.abs(r-s.right));this.image.data[n+r]=Math.max(0,Math.min(255,(s.isDash?a:-a)+i+128))}}addDash(e,i){let r=this.getKey(e,i);if(this.positions[r])return this.positions[r];let a="round"===i,n=7*!!a,o=2*n+1;if(this.nextRow+o>this.height)return e0("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let i=0;i<e.length;i++)e[i]<0&&(e0("Negative value is found in line dasharray, replacing values with 0"),e[i]=0),s+=e[i];if(0!==s){let r=this.width/s,o=this.getDashRanges(e,this.width,r);a?this.addRoundDash(o,r,n):this.addRegularDash(o,"square"===i?.5*r:0)}let l=this.nextRow+n;this.nextRow+=o;let h={tl:[l,n],br:[s,0]};return this.positions[r]=h,h}}aT(ud,"LineAtlas");let up=hi.VectorTileFeature.types,uf=Math.cos(Math.PI/180*37.5),um=Math.cos(Math.PI/180*5);class u_{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new nX,this.layoutVertexArray2=new nY,this.patternVertexArray=new nY,this.indexArray=new n7,this.programConfigurations=new o0(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new oI,this.maxLineLength=0,this.zOffsetVertexArray=new nY,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128}updateFootprints(e,i){}populate(e,i,r,a){this.hasPattern=lQ("line",this.layers,this.pixelRatio,i);let n=this.layers[0].layout.get("line-sort-key");this.tileToMeter=sd(r);let o=this.layers[0].layout.get("line-z-offset"),s=o.isConstant()&&!o.constantOr(0),l=this.layers[0].layout.get("line-elevation-reference");this.hasZOffset="sea"===l||"ground"===l||!s&&"none"===l,this.hasZOffset&&"none"===l&&e0(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`);let h=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.hasZOffset&&void 0!==h;let u=[];for(let{feature:i,id:o,index:s,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,h=sg(i,e);if(!this.layers[0]._featureFilter.filter(new nl(this.zoom),h,r))continue;let c=n?n.evaluate(h,{},r):void 0,d={id:o,properties:i.properties,type:i.type,sourceLayerIndex:l,index:s,geometry:e?h.geometry:s_(i,r,a),patterns:{},sortKey:c};u.push(d)}n&&u.sort((e,i)=>e.sortKey-i.sortKey);let{lineAtlas:c,featureIndex:d}=i,p=this.addConstantDashes(c);for(let a of u){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(p&&this.addFeatureDashes(a,c),this.hasPattern){let e=l0("line",this.layers,a,this.zoom,this.pixelRatio,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,c.positions,i.availableImages,i.brightness);d.insert(e[o].feature,n,o,s,this.index)}}addConstantDashes(e){let i=!1;for(let r of this.layers){let a=r.paint.get("line-dasharray").value,
7n=r.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==n.kind)i=!0;else{let i=n.value,r=a.value;if(!r)continue;e.addDash(r,i)}}return i}addFeatureDashes(e,i){let r=this.zoom;for(let a of this.layers){let n,o,s=a.paint.get("line-dasharray").value,l=a.layout.get("line-cap").value;if("constant"!==s.kind||"constant"!==l.kind){if("constant"===s.kind){if(!(n=s.value))continue}else n=s.evaluate({zoom:r},e);o="constant"===l.kind?l.value:l.evaluate({zoom:r},e),i.addDash(n,o),e.patterns[a.id]=i.getKey(n,o)}}}update(e,i,r,a,n,o,s){this.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s)}addFeatures(e,i,r,a,n,o){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,i,r,a,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,uu)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,uc)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,ul.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uh),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,r,a,n,o,s){let l=this.layers[0].layout,h=l.get("line-join").evaluate(e,{}),u=l.get("line-cap").evaluate(e,{}),c=l.get("line-miter-limit"),d=l.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=l.get("line-z-offset").value;let p=this.layers[0].paint.get("line-width").value;for(let r of("constant"!==p.kind&&!1===p.isLineProgressConstant&&(this.variableWidthValue=p),i))this.addLine(r,e,a,h,u,c,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,s)}addLine(e,i,r,a,n,o,s){let l,h,u,c,d,p;this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;let f="none"===a;if(this.patternJoinNone=this.hasPattern&&f,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let i=0;i<e.length-1;i++)this.totalDistance+=e[i].dist(e[i+1]);this.totalFeatureLength=this.totalDistance/(this.lineClips.end-this.lineClips.start),this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let m="Polygon"===up[i.type],_=e.length;for(;_>=2&&e[_-1].equals(e[_-2]);)_--;let g=0;for(;g<_-1&&e[g].equals(e[g+1]);)g++;if(_<(m?3:2))return;"bevel"===a&&(o=1.05);let y=this.segments.prepareSegment(10*_,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,m&&(l=e[_-2],d=e[g].sub(l)._unit()._perp());for(let i=g;i<_;i++){if((u=i===_-1?m?e[g+1]:void 0:e[i+1])&&e[i].equals(u))continue;d&&(c=d),l&&(h=l),l=e[i],p=this.evaluateLineProgressFeatures(h?h.dist(l):0),d=u?u.sub(l)._unit()._perp():c,c=c||d;let r=h&&u,x=r?a:m||f?"butt":n,v=c.x*d.x+c.y*d.y;if(f){let e=function(e){if(e.patternJoinNone){let i=e.segmentPoints.length/2,r=e.lineSoFar-e.segmentStart;for(let a=0;a<i;++a){let i=e.segmentPoints[2*a+1],n=Math.round(e.segmentPoints[2*a])+.5+.25*i;e.patternVertexArray.emplaceBack(n,r,e.segmentStart),e.patternVertexArray.emplaceBack(n,r,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(r&&v<um){this.updateDistance(h,l),this.addCurrentVertex(l,c,1,1,y,p),e(this),this.addCurrentVertex(l,d,-1,-1,y,p);continue}if(h){if(!u){this.updateDistance(h,l),this.addCurrentVertex(l,c,1,1,y,p),e(this);continue}x="miter"}}let b=c.add(d);0===b.x&&0===b.y||b._unit();let w=b.x*d.x+b.y*d.y,T=0!==w?1/w:1/0,S=2*Math.sqrt(2-2*w),M=w<uf&&h&&u,E=c.x*d.y-c.y*d.x>0,A=this.overscaling<=16?122880/(512*this.overscaling):0;
7if(r&&"round"===x){if(T<s)x="miter";else if(T<=2){let e=ug(l,-10,8202);x=this.hasZOffset&&(e||this.hasCrossSlope)?"miter":"fakeround"}}if("miter"===x&&T>o&&(x="bevel"),"bevel"===x&&(T>2&&(x="flipbevel"),T<o&&(x="miter")),h&&!("miter"===x&&M)&&this.updateDistance(h,l),"miter"===x)if(M){let e=l.dist(h);if(e>2*A){let i=l.sub(l.sub(h)._mult(A/e)._round());this.updateDistance(h,i),this.addCurrentVertex(i,c,0,0,y,p),h=i}this.updateDistance(h,l),b._mult(T),this.addCurrentVertex(l,b,0,0,y,p);let i=l.dist(u);if(i>2*A){let e=l.add(u.sub(l)._mult(A/i)._round());this.updateDistance(l,e),this.addCurrentVertex(e,d,0,0,y,p),l=e}}else b._mult(T),this.addCurrentVertex(l,b,0,0,y,p);else if("flipbevel"===x){if(T>100)b=d.mult(-1);else{let e=T*c.add(d).mag()/c.sub(d).mag();b._perp()._mult(e*(E?-1:1))}this.addCurrentVertex(l,b,0,0,y,p),this.addCurrentVertex(l,b.mult(-1),0,0,y,p)}else if("bevel"===x||"fakeround"===x){null!=p&&h&&this.addCurrentVertex(l,c,-1,-1,y,p);let e=l.dist(h)<=2*A&&"bevel"!==x,i=b.mult(E?1:-1);i._mult(T);let r=d.mult(E?-1:1),a=c.mult(E?-1:1),n=this.evaluateLineProgressFeatures(this.distance);if(null==p&&(this.addHalfVertex(l,i.x,i.y,!1,!E,0,y,n),e||this.addHalfVertex(l,i.x+2*a.x,i.y+2*a.y,!1,E,0,y,n)),"fakeround"===x){let e=Math.round(180*S/Math.PI/20);this.addHalfVertex(l,a.x,a.y,!1,E,0,y,n);for(let i=0;i<e;i++){let o=i/e;if(.5!==o){let e=o-.5;o+=o*e*(o-1)*((1.0904+v*(v*(3.55645-1.43519*v)-3.2452))*e*e+(.848013+v*(.215638*v-1.06021)))}let s=r.sub(a)._mult(o)._add(a)._unit();this.addHalfVertex(l,s.x,s.y,!1,E,0,y,n)}this.addHalfVertex(l,r.x,r.y,!1,E,0,y,n)}e||null!=p||this.addHalfVertex(l,i.x+2*r.x,i.y+2*r.y,!1,E,0,y,n),null!=p&&u&&this.addCurrentVertex(l,d,1,1,y,p)}else"butt"===x?this.addCurrentVertex(l,b,0,0,y,p):"square"===x?(h||this.addCurrentVertex(l,b,-1,-1,y,p),this.addCurrentVertex(l,b,0,0,y,p),h&&this.addCurrentVertex(l,b,1,1,y,p)):"round"===x&&(h&&(this.addCurrentVertex(l,c,0,0,y,p),this.addCurrentVertex(l,c,1,1,y,p,!0)),u&&(this.addCurrentVertex(l,d,-1,-1,y,p,!0),this.addCurrentVertex(l,d,0,0,y,p)))}}addVerticesTo(e,i,r,a,n,o,s,l,h,u){let c=(i.w-e.w)/this.tessellationStep|0,d=0,p=this.scaledDistance;if(c>1){this.lineSoFar=e.w;let p=(i.x-e.x)/c,f=(i.y-e.y)/c,m=(i.z-e.z)/c,_=(i.w-e.w)/c;for(let i=1;i<c;++i){e.x+=p,e.y+=f,e.z+=m,this.lineSoFar+=_,d+=_;let i=this.evaluateLineProgressFeatures(this.prevDistance+d);this.scaledDistance=(this.prevDistance+d)/this.totalDistance,this.addHalfVertex(e,r,a,u,!1,s,h,i),this.addHalfVertex(e,n,o,u,!0,-l,h,i)}}this.lineSoFar=i.w,this.scaledDistance=p;let f=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,r,a,u,!1,s,h,f),this.addHalfVertex(i,n,o,u,!0,-l,h,f)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&!this.hasZOffset)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):e0(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.hasZOffset?"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}:{zOffset:0,variableWidth:i}}addCurrentVertex(e,i,r,a,n,o,s=!1){let l=i.x+i.y*r,h=i.y-i.x*r,u=i.y*a-i.x,c=-i.y-i.x*a;if(null!=o){let i=this.hasZOffset,d=o.zOffset,p=new hC(e.x,e.y,d,this.lineSoFar),f=!!i&&ug(e,-10,8202),m=this.lineSoFar,_=this.distance;if(this.currentVertex)if(f){let i=this.currentVertexIsOutside,o=this.currentVertex,f=new hC(e.x,e.y,d,this.lineSoFar);if(hD(o,f,-10,8202),!ug(f,-10,8202)){if(i){this.e1=this.e2=-1,this.distance-=o.dist(p),this.lineSoFar=o.w;let e=this.evaluateLineProgressFeatures(o.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(o,l,h,s,!1,r,n,e),this.addHalfVertex(o,u,c,s,!0,-a,n,e),this.prevDistance=this.distance}this.distance=this.prevDistance+o.dist(f),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(o,f,l,h,u,c,r,a,n,s),this.distance=_,this.scaledDistance=this.distance/this.totalDistance}}else{let e=this.currentVertex;if(this.currentVertexIsOutside){hD(e,p,-10,8202),this.e1=this.e2=-1,this.distance-=e.dist(p),this.scaledDistance=this.distance/this.totalDistance,this.lineS
7oFar=e.w;let i=this.evaluateLineProgressFeatures(e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(e,l,h,s,!1,r,n,i),this.addHalfVertex(e,u,c,s,!0,-a,n,i),this.prevDistance=this.distance,this.distance=_,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(e,p,l,h,u,c,r,a,n,s)}else f||(this.addHalfVertex(e,l,h,s,!1,r,n,o),this.addHalfVertex(e,u,c,s,!0,-a,n,o));this.currentVertex=p,this.currentVertexIsOutside=f,this.lineSoFar=m}else this.addHalfVertex(e,l,h,s,!1,r,n,o),this.addHalfVertex(e,u,c,s,!0,-a,n,o)}addHalfVertex({x:e,y:i},r,a,n,o,s,l,h){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),o||this.segmentPoints.push(this.lineSoFar-this.segmentStart,s)),this.layoutVertexArray.emplaceBack((e<<1)+ +!!n,(i<<1)+ +!!o,Math.round(63*r)+128,Math.round(63*a)+128,1+(0===s?0:s<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){let e=t$(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,e)}let u=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),l.primitiveLength++),o?this.e2=u:this.e1=u,null!=h&&this.zOffsetVertexArray.emplaceBack(h.zOffset,h.variableWidth,h.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function ug(e,i,r){return e.x<i||e.x>r||e.y<i||e.y>r}function uy(e,i,r){return i*(8192/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}aT(u_,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let ux=(e,i,r)=>(1-r)*e+r*i;function uv(e,i){return 1/uy(e,1,i.tileZoom)}function ub(e,i,r,a){return e.translatePosMatrix(a||i.tileID.projMatrix,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let uw=e=>{let i=[];uT(e)&&i.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&i.push("RENDER_LINE_GRADIENT");let r=e.paint.get("line-trim-offset");0===r[0]&&0===r[1]||i.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&i.push("RENDER_LINE_BORDER");let a="none"===e.layout.get("line-join").constantOr("miter"),n=!!e.paint.get("line-pattern").constantOr(1);return a&&n&&i.push("LINE_JOIN_NONE"),i};function uT(e){let i=e.paint.get("line-dasharray").value;return i.value||"constant"!==i.kind}let uS=()=>E||(E={layout:S||(S=new nv({"line-cap":new ny(nb.layout_line["line-cap"]),"line-join":new ny(nb.layout_line["line-join"]),"line-miter-limit":new ng(nb.layout_line["line-miter-limit"]),"line-round-limit":new ng(nb.layout_line["line-round-limit"]),"line-sort-key":new ny(nb.layout_line["line-sort-key"]),"line-z-offset":new ny(nb.layout_line["line-z-offset"]),"line-elevation-reference":new ng(nb.layout_line["line-elevation-reference"]),"line-cross-slope":new ng(nb.layout_line["line-cross-slope"]),visibility:new ng(nb.layout_line.visibility),"line-width-unit":new ng(nb.layout_line["line-width-unit"])})),paint:M||(M=new nv({"line-opacity":new ny(nb.paint_line["line-opacity"]),"line-color":new ny(nb.paint_line["line-color"]),"line-translate":new ng(nb.paint_line["line-translate"]),"line-translate-anchor":new ng(nb.paint_line["line-translate-anchor"]),"line-width":new ny(nb.paint_line["line-width"]),"line-gap-width":new ny(nb.paint_line["line-gap-width"]),"line-offset":new ny(nb.paint_line["line-offset"]),"line-blur":new ny(nb.paint_line["line-blur"]),"line-dasharray":new ny(nb.paint_line["line-dasharray"]),"line-pattern":new ny(nb.paint_line["line-pattern"]),"line-gradient":new nx(nb.paint_line["line-gradient"]),"line-trim-offset":new ng(nb.paint_line["line-trim-offset"]),"line-trim-fade-range":new ng(nb.paint_line["line-trim-fade-range"]),"line-trim-color":new ng(nb.paint_line["line-trim-color"]),"line-emissive-strength":new ng(nb.paint_line["line-emissive-strength"]),"line-border-width":new ny(nb.paint_line["line-border-width"]),"line-border-color":new ny(nb.paint_line["line-border-color"]),"line-occlusion-opacity":new ng(nb.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}
7),"line-gradient-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))});class uM extends ny{possiblyEvaluate(e,i){return i=new nl(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,r,a){return i=eZ({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,r,a)}}let uE=nV([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),uA=nV([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),uI=nV([{name:"a_projected_pos",components:4,type:"Float32"}],4);nV([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let uC=nV([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),uP=nV([{name:"a_texb",components:2,type:"Uint16"}]),uz=nV([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),uD=nV([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);nV([{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 uR=nV([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),uL=nV([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function uO(e,i,r,a,n){return"camera"===e.kind?e.maxSize:"composite"===e.kind?Math.max(i.possiblyEvaluate(new nl(e.maxZoom),r).evaluate(n,{},r),i.possiblyEvaluate(new nl(e.minZoom),r).evaluate(n,{},r)):i.possiblyEvaluate(new nl(a)).evaluate(n,{},r)}function uk(e,i){let{expression:r}=i;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new nl(e+1))};if("source"===r.kind)return{kind:"source"};{let{zoomStops:i,interpolationType:a}=r,n=0;for(;n<i.length&&i[n]<=e;)n++;let o=n=Math.max(0,n-1);for(;o<i.length&&i[o]<e+1;)o++;o=Math.min(i.length-1,o);let s=i[n],l=i[o];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:a}:{kind:"camera",minZoom:s,maxZoom:l,minSize:r.evaluate(new nl(s)),maxSize:r.evaluate(new nl(l)),interpolationType:a}}}function uF(e,{uSize:i,uSizeT:r},{lowerSize:a,upperSize:n}){return"source"===e.kind?a/128:"composite"===e.kind?t$(a/128,n/128,r):i}function uB(e,i,r=1){let a=0,n=0;if("constant"===e.kind)n=e.layoutSize*r;else if("source"!==e.kind){let{interpolationType:o,minZoom:s,maxZoom:l}=e,h=o?eU(rL.interpolationFactor(o,i,s,l),0,1):0;"camera"===e.kind?n=t$(e.minSize,e.maxSize,h)*r:a=h*r}return{uSizeT:a,uSize:n}}nV([{name:"triangle",components:3,type:"Uint16"}]),nV([{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"}]),nV([{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]),nV([{type:"Float32",name:"offsetX"}]),nV([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var uN=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:128,evaluateSizeForFeature:uF,evaluateSizeForZoom:uB,getRasterizedIconSize:uO,getSizeData:uk});let uV={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};var uU,uj,uG,uq={};function uZ(){if(uG)return uj;uG=1,uj=i;var e=(uU||(uU=1,uq.read=function(e,i,r,a,n){var o,s,l=8*n-a-1,h=(1<<l)-1,u=h>>1,c=-7,d=r?n-1:0,p=r?-1:1,f=e[i+d];for(d+=p,o=f&(1<<-c)-1,f>>=-c,c+=l;c>0;o=256*o+e[i+d],d+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=a;c>0;s=256*s+e[i+d],d+=p,c-=8);if(0===o)o=1-u;else{if(o===h)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,a),o-=u}return(f?-1:1)*s*Math.pow(2,o-a)},uq.write=function(e,i,r,a,n,o){var s,l,h,u=8*o-n-1,c=(1<<u)-1,d=c>>1,p=5960464477539062e-23*(23===n),f=a?0:o-1,m=a?1:-1,_=+(i<0||0===i&&1/i<0);for(isNaN(i=Math.abs(i))||i===1/0?(l=+!!isNaN(i),s=c):(s=Math.floor(Math.log(i)/Math.LN2),i*(h=Math.pow(2,-s))<1&&(s--,h*=2),(i+=s+d>=1?p/h:p*Math.pow(2,1-d))*h>=2&&(s++,h/=2),s+d>=c?(l=0,s=c):s+d>=1?(l=(i*h-1)*Math.pow(2,n),s+=d):(l=i*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;e[r+f]=255&l,f+=m,l/=256,n-=8);for(s=s<<n|l,u+=n;u>0;e[r+f]=255&s,f+=m,s/=256,u-=8);e[r+f-m]|=128*_}),uq);function i(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var r="u"<typeof TextDecoder?null:new TextDecoder("utf8");function a(e){return e.type===i.Bytes?e.readVarint()+e.pos:e.pos+1}function n(e,i,r){var a=i<=16383?1:i<=2097151?2:i<=0xfffffff?3:Math.floor(Math.log(i)/(7*Math.LN2));r.realloc(a);for(var n=r.pos-1;n>=e;n--)r.buf[n+a]=r.buf[n]}function o(e,i){for(var r=0;r<e.length;r++)i.writeVarint(e[r])}function s(e,i){for(var r=0;r<e.length;r++)i.writeSVarint(e[r])}function l(e,i){for(var r=0;r<e.length;r++)i.writeFloat(e[r])}function h(e,i){for(var r=0;r<e.length;r++)i.writeDouble(e[r])}function u(e,i){for(var r=0;r<e.length;r++)i.writeBoolean(e[r])}function c(e,i){for(var r=0;r<e.length;r++)i.writeFixed32(e[r])}function d(e,i){for(var r=0;r<e.length;r++)i.writeSFixed32(e[r])}function p(e,i){for(var r=0;r<e.length;r++)i.writeFixed64(e[r])}function f(e,i){for(var r=0;r<e.length;r++)i.writeSFixed64(e[r])}function m(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16)+0x1000000*e[i+3]}function _(e,i,r){e[r]=i,e[r+1]=i>>>8,e[r+2]=i>>>16,e[r+3]=i>>>24}function g(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16)+(e[i+3]<<24)}return i.prototype={destroy:function(){this.buf=null},readFields:function(e,i,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),n=a>>3,o=this.pos;this.type=7&a,e(n,i,this),this.pos===o&&this.skip(a)}return i},readMessage:function(e,i){return this.readFields(e,i,this.readVarint()+this.pos)},readFixed32:function(){var e=m(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=g(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=m(this.buf,this.pos)+0x100000000*m(this.buf,this.pos+4);return this.pos+=8,e},readSFixed64:function(){var e=m(this.buf,this.pos)+0x100000000*g(this.buf,this.pos+4);return this.pos+=8,e},readFloat:function(){var i=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(e){var i,r,a=this.buf;return i=127&(r=a[this.pos++]),r<128?i:(i|=(127&(r=a[this.pos++]))<<7,r<128?i:(i|=(127&(r=a[this.pos++]))<<14,r<128?i:(i|=(127&(r=a[this.pos++]))<<21,r<128?i:function(e,i,r){var a,n,o,s,l=r.buf;if(o=(112&(s=l[r.pos++]))>>4,s<128||(o|=(127&(s=l[r.pos++]))<<3,s<128)||(o|=(127&(s=l[r.pos++]))<<10,s<128)||(o|=(127&(s=l[r.pos++]))<<17,s<128)||(o|=(127&(s=l[r.pos++]))<<24,s<128)||(o|=(1&(s=l[r.pos++]))<<31,s<128)){return a=e,n=o,i?0x100000000*n+(a>>>0):0x100000000*(n>>>0)+(a>>>0)}throw Error("Expected varint not more than 10 bytes")}(i|=(15&(r=a[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?-((e+1)/2):e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e,i=this.readVarint()+this.pos,a=this.pos;return this.pos=i,i-a>=12&&r?(e=this.buf,r.decode(e.subarray(a,i))):function(e,i,r){for(var a="",n=i;n<r;){var o,s,l,h=e[n],u=null,c=h>239?4:h>223?3:h>191?2:1;if(n+c>r)break;
71===c?h<128&&(u=h):2===c?128==(192&(o=e[n+1]))&&(u=(31&h)<<6|63&o)<=127&&(u=null):3===c?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((u=(15&h)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=e[n+2],l=e[n+3],128==(192&(o=e[n+1]))&&128==(192&s)&&128==(192&l)&&((u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&l)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,a+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),a+=String.fromCharCode(u),n+=c}return a}(this.buf,a,i)},readBytes:function(){var e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i},readPackedVarint:function(e,r){if(this.type!==i.Bytes)return e.push(this.readVarint(r));var n=a(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(r));return e},readPackedSVarint:function(e){if(this.type!==i.Bytes)return e.push(this.readSVarint());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==i.Bytes)return e.push(this.readBoolean());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==i.Bytes)return e.push(this.readFloat());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==i.Bytes)return e.push(this.readDouble());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed32());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed32());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed64());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed64());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSFixed64());return e},skip:function(e){var r=7&e;if(r===i.Varint)for(;this.buf[this.pos++]>127;);else if(r===i.Bytes)this.pos=this.readVarint()+this.pos;else if(r===i.Fixed32)this.pos+=4;else{if(r!==i.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(e,i){this.writeVarint(e<<3|i)},realloc:function(e){for(var i=this.length||16;i<this.pos+e;)i*=2;if(i!==this.length){var r=new Uint8Array(i);r.set(this.buf),this.buf=r,this.length=i}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),_(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),_(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),_(this.buf,-1&e,this.pos),_(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),_(this.buf,-1&e,this.pos),_(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>0xfffffff||e<0?function(e,i){var r,a,n,o,s;if(e>=0?(r=e%0x100000000|0,a=e/0x100000000|0):(a=~(-e/0x100000000),0xffffffff^(r=~(-e%0x100000000))?r=r+1|0:(r=0,a=a+1|0)),e>=0xffffffffffffffff||e<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");i.realloc(10),n=r,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,i.buf[i.pos]=127&(n>>>=7),s=(7&(o=a))<<4,i.buf[i.pos++]|=s|128*!!(o>>>=3),o&&(i.buf[i.pos++]=127&o|128*!!(o>>>=7),o&&(i.buf[i.pos++]=127&o|128*!!(o>>>=7),o&&(i.buf[i.pos++]=127&o|128*!!(o>>>=7),o&&(i.buf[i.pos++]=127&o|128*!!(o>>>=7),o&&(i.buf[i.pos++]=127&o)))))}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|128*(e>127),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|128*(e>127),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|128*(e>127),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?-(2*e)-1:2*e)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var i=this.pos;this.pos=function(e,i,r){for(var a,n,o=0;o<i.length;o++){if((a=i.charCodeAt(o))>55295&&a<57344){if(!n){a>
756319||o+1===i.length?(e[r++]=239,e[r++]=191,e[r++]=189):n=a;continue}if(a<56320){e[r++]=239,e[r++]=191,e[r++]=189,n=a;continue}a=n-55296<<10|a-56320|65536,n=null}else n&&(e[r++]=239,e[r++]=191,e[r++]=189,n=null);a<128?e[r++]=a:(a<2048?e[r++]=a>>6|192:(a<65536?e[r++]=a>>12|224:(e[r++]=a>>18|240,e[r++]=a>>12&63|128),e[r++]=a>>6&63|128),e[r++]=63&a|128)}return r}(this.buf,e,this.pos);var r=this.pos-i;r>=128&&n(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),e.write(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),e.write(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var i=e.length;this.writeVarint(i),this.realloc(i);for(var r=0;r<i;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,i){this.pos++;var r=this.pos;e(i,this);var a=this.pos-r;a>=128&&n(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(e,r,a){this.writeTag(e,i.Bytes),this.writeRawMessage(r,a)},writePackedVarint:function(e,i){i.length&&this.writeMessage(e,o,i)},writePackedSVarint:function(e,i){i.length&&this.writeMessage(e,s,i)},writePackedBoolean:function(e,i){i.length&&this.writeMessage(e,u,i)},writePackedFloat:function(e,i){i.length&&this.writeMessage(e,l,i)},writePackedDouble:function(e,i){i.length&&this.writeMessage(e,h,i)},writePackedFixed32:function(e,i){i.length&&this.writeMessage(e,c,i)},writePackedSFixed32:function(e,i){i.length&&this.writeMessage(e,d,i)},writePackedFixed64:function(e,i){i.length&&this.writeMessage(e,p,i)},writePackedSFixed64:function(e,i){i.length&&this.writeMessage(e,f,i)},writeBytesField:function(e,r){this.writeTag(e,i.Bytes),this.writeBytes(r)},writeFixed32Field:function(e,r){this.writeTag(e,i.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(e,r){this.writeTag(e,i.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(e,r){this.writeTag(e,i.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(e,r){this.writeTag(e,i.Fixed64),this.writeSFixed64(r)},writeVarintField:function(e,r){this.writeTag(e,i.Varint),this.writeVarint(r)},writeSVarintField:function(e,r){this.writeTag(e,i.Varint),this.writeSVarint(r)},writeStringField:function(e,r){this.writeTag(e,i.Bytes),this.writeString(r)},writeFloatField:function(e,r){this.writeTag(e,i.Fixed32),this.writeFloat(r)},writeDoubleField:function(e,r){this.writeTag(e,i.Fixed64),this.writeDouble(r)},writeBooleanField:function(e,i){this.writeVarintField(e,!!i)}},uj}var uH=K(uZ());function u$(e,i,r){i.glyphs=[],1===e&&r.readMessage(uW,i)}function uW(e,i,r){if(3===e){let{id:e,bitmap:a,width:n,height:o,left:s,top:l,advance:h}=r.readMessage(uX,{});i.glyphs.push({id:e,bitmap:new lE({width:n+6,height:o+6},a),metrics:{width:n,height:o,left:s,top:l,advance:h}})}else 4===e?i.ascender=r.readSVarint():5===e&&(i.descender=r.readSVarint())}function uX(e,i,r){1===e?i.id=r.readVarint():2===e?i.bitmap=r.readBytes():3===e?i.width=r.readVarint():4===e?i.height=r.readVarint():5===e?i.left=r.readSVarint():6===e?i.top=r.readSVarint():7===e&&(i.advance=r.readVarint())}let uY={horizontal:1,vertical:2,horizontalOnly:3};class uK{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){let r=new uK;return r.scale=e||1,r.fontStack=i,r}static forImage(e){let i=new uK;return i.image=e,i}}class uJ{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,r){let a=new uJ;for(let n=0;n<e.sections.length;n++){let o=e.sections[n];o.image?a.addImageSection(o,r):a.addTextSection(o,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,i){let r="";for(let a=0;a<e.length;a++){let n=e.charCodeAt(a+1)||null,o=e.charCodeAt(a-1)||null;r+=!i&&(n&&a4(n)&&!uV[e[a+1]]||o&&a4(o)&&!uV[e[a-1]])||!uV[e[a]]?e[a]:uV[e[a]]}return r}(this.text,e)}trim(){let e=0;for(let i=0;i<this.text.length&&u0[this.text.charCodeAt(i)];i++)e++;let i=this.text.length;for(let r=this.text.length-1;r>=0&&r>=e&&u0[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){let r=new uJ;return r.text=this.text.substring(e,i),r.sectionIndex=this.sectionIndex.slice(e,i),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(uK.forText(e.scale,e.fontStack||i));let r=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(r)}addImageSection(e,i){let r=e.image?e.image.getPrimary():null;if(!r)return void e0("Can't add FormattedSection with an empty image.");r.scaleSelf(i);let a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(uK.forImage(r)),this.sectionIndex.push(this.sections.length-1)):e0("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function uQ(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_=1){let g=uJ.fromFeature(e,n,_);d===uY.vertical&&g.verticalizePunctuation(p);let y=[],x=function(e,i,r,a,n,o){if(!e)return[];let s=[],l=function(e,i,r,a,n,o){let s=0;for(let r=0;r<e.length();r++){let l=e.getSection(r);s+=u2(e.getCodePoint(r),l,a,n,i,o)}return s/Math.max(1,Math.ceil(s/r))}(e,i,r,a,n,o),h=e.text.indexOf("â")>=0,u=0;for(let r=0;r<e.length();r++){let c=e.getSection(r),d=e.getCodePoint(r);if(u0[d]||(u+=u2(d,c,a,n,i,o)),r<e.length()-1){let i=!(d<11904||!(aN(d)||aB(d)||aJ(d)||aX(d)||aG(d)||aD(d)||aV(d)||aO(d)||aq(d)||aZ(d)||aj(d)||a1(d)||ak(d)||aL(d)||aR(d)||aU(d)||aF(d)||aK(d)||a$(d)||aH(d)));(u1[d]||i||c.image)&&s.push(u4(r+1,u,l,s,function(e,i,r){let a=0;return 10===e&&(a-=1e4),r&&(a+=150),40!==e&&65288!==e||(a+=50),41!==i&&65289!==i||(a+=50),a}(d,e.getCodePoint(r+1),i&&h),!1))}}return function e(i){return i?e(i.priorBreak).concat(i.index):[]}(u4(e.length(),u,l,s,0,!0))}(g,u,o,i,a,f),{processBidirectionalText:v,processStyledBidirectionalText:b}=ns;if(v&&1===g.sections.length)for(let e of v(g.toString(),x)){let i=new uJ;i.text=e,i.sections=g.sections;for(let r=0;r<e.length;r++)i.sectionIndex.push(0);y.push(i)}else if(b)for(let e of b(g.text,g.sectionIndex,x)){let i=new uJ;i.text=e[0],i.sectionIndex=e[1],i.sections=g.sections,y.push(i)}else y=function(e,i){let r=[],a=e.text,n=0;for(let a of i)r.push(e.substring(n,a)),n=a;return n<a.length&&r.push(e.substring(n,a.length)),r}(g,x);let w=[],T={positionedLines:w,text:g.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:d,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(e,i,r,a,n,o,s,l,h,u,c,d){let p=0,f=0,m=0,_="right"===l?1:.5*("left"!==l),g=!1;for(let e of n){for(let r of e.getSections()){if(r.image)continue;let e=i[r.fontStack];
7if(e&&!(g=void 0!==e.ascender&&void 0!==e.descender))break}if(!g)break}let y=0;for(let s of n){s.trim();let n=s.getMaxScale(),l=(n-1)*24,x={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=x;let v=x.positionedGlyphs,b=0;if(!s.length()){f+=o,++y;continue}let w=0,T=0;for(let o=0;o<s.length();o++){let l=s.getSection(o),m=s.getSectionIndex(o),_=s.getCodePoint(o),y=l.scale,x=null,S=null,M=null,E=24,A=0;h===uY.vertical&&(12312===_||12313===_||12316===_||12540===_||12448===_)&&(h=uY.horizontal);let I=!(h===uY.horizontal||!c&&!a3(_)||c&&(u0[_]||aI(_)||aC(_)||aP(_)||aY(_)||a0(_)));if(l.image){let i=a.get(l.image.toString());if(!i)continue;M=l.image,e.iconsInText=e.iconsInText||!0,S=i.paddedRect;let r=i.displaySize;y=24*y/d,x={width:r[0],height:r[1],left:0,top:-3,advance:I?r[1]:r[0],localGlyph:!1},A=g?-x.height*y:24*n-17-r[1]*y,E=x.advance;let o=(I?r[0]:r[1])*y-24*n;o>0&&o>b&&(b=o)}else{let e=r[l.fontStack];if(!e)continue;e[_]&&(S=e[_]);let a=i[l.fontStack];if(!a)continue;let o=a.glyphs[_];if(!o)continue;if(x=o.metrics,E=24*(8203!==_),g){let e=void 0!==a.ascender?Math.abs(a.ascender):0,i=void 0!==a.descender?Math.abs(a.descender):0,r=(e+i)*y;w<r&&(w=r,T=(e-i)/2*y),A=-e*y}else A=(n-y)*24-17}I?(e.verticalizable=!0,v.push({glyph:_,image:M,x:p,y:f+A,vertical:I,scale:y,localGlyph:x.localGlyph,fontStack:l.fontStack,sectionIndex:m,metrics:x,rect:S}),p+=E*y+u):(v.push({glyph:_,image:M,x:p,y:f+A,vertical:I,scale:y,localGlyph:x.localGlyph,fontStack:l.fontStack,sectionIndex:m,metrics:x,rect:S}),p+=x.advance*y+u)}0!==v.length&&(m=Math.max(p-u,m),g?u6(v,_,b,T,o*n/2):u6(v,_,b,0,o/2)),p=0;let S=o*n+b;x.lineOffset=Math.max(b,l),f+=S,++y}let x=f,{horizontalAlign:v,verticalAlign:b}=u5(s);(function(e,i,r,a,n,o){let s=(i-r)*n,l=-o*a;for(let i of e)for(let e of i.positionedGlyphs)e.x+=s,e.y+=l})(e.positionedLines,_,v,b,m,x),e.top+=-b*x,e.bottom=e.top+x,e.left+=-v*m,e.right=e.left+m,e.hasBaseline=g}(T,i,r,a,y,s,l,h,d,u,p,m),!function(e){for(let i of e)if(0!==i.positionedGlyphs.length)return!1;return!0}(w))return T}let u0={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},u1={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 u2(e,i,r,a,n,o){if(i.image){let e=a.get(i.image.toString());return e?e.displaySize[0]*i.scale*24/o+n:0}{let a=r[i.fontStack],o=a&&a.glyphs[e];return o?o.metrics.advance*i.scale+n:0}}function u3(e,i,r,a){let n=Math.pow(e-i,2);return a?e<i?n/2:2*n:n+Math.abs(r)*r}function u4(e,i,r,a,n,o){let s=null,l=u3(i,r,n,o);for(let e of a){let a=u3(i-e.x,r,n,o)+e.badness;a<=l&&(s=e,l=a)}return{index:e,x:i,priorBreak:s,badness:l}}function u5(e){let i=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":i=1;break;case"left":case"top-left":case"bottom-left":i=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:i,verticalAlign:r}}function u6(e,i,r,a,n){if(!(i||r||a||n))return;let o=e.length-1,s=e[o],l=(s.x+s.metrics.advance*s.scale)*i;for(let i=0;i<=o;i++)e[i].x-=l,e[i].y+=r+a+n}function u8(e,i,r,a,n,o){let s,l,h,u,c,d=e.imagePrimary;if(d.content){let e=d.content,i=d.pixelRatio||1;s=[e[0]/i,e[1]/i,d.displaySize[0]-e[2]/i,d.displaySize[1]-e[3]/i]}let p=i.left*o,f=i.right*o;"width"===r||"both"===r?(c=n[0]+p-a[3],h=n[0]+f+a[1]):h=(c=n[0]+(p+f-d.displaySize[0])/2)+d.displaySize[0];let m=i.top*o,_=i.bottom*o;return"height"===r||"both"===r?(l=n[1]+m-a[0],u=n[1]+_+a[2]):u=(l=n[1]+(m+_-d.displaySize[1])/2)+d.displaySize[1],{imagePrimary:d,imageSecondary:void 0,top:l,right:h,bottom:u,left:c,collisionPadding:s}}class u9 extends eR{constructor(e,i,r,a,n){super(e,i),this.angle=a,this.z=r,void 0!==n&&(this.segment=n)}clone(){return new u9(this.x,this.y,this.z,this.angle,this.segment)}}function u7(e,i,r,a,n){if(void 0===i.segment)return!0;let o=i,s=i.segment+1,l=0;for(;l>-r/2;){if(--s<0)return!1;l-=e[s].dist(o),o=e[s]}l+=e[s].dist(e[s+1]),s++;let h=[],u=0;for(;l<r/2;){let i=e[s],r=e[s+1];if(!r)return!1;let o=e[s-1].angleTo(i)-i.angleTo(r);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:l,angleDelta:o}),u+=o;l-h[0].distance>a;)u-=h.shift().angleDelta;if(u>n)return!1;s++,l+=i.dist(r)}return!0}function ce(e){let i=0;for(let r=0;r<e.length-1;r++)i+=e[r].dist(e[r+1]);return i}function ct(e,i){return Math.max(e?e.right-e.left:0,i?i.right-i.left:0)}function ci(e,i,r,a,n){let o=[];for(let s=0;s<e.length;s++){let l,h=e[s];for(let e=0;e<h.length-1;e++){let s=h[e],u=h[e+1];s.x<i&&u.x<i||(s.x<i?s=new eR(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<i&&(u=new eR(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<r&&u.y<r||(s.y<r?s=new eR(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round():u.y<r&&(u=new eR(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round()),s.x>=a&&u.x>=a||(s.x>=a?s=new eR(a,s.y+(a-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=a&&(u=new eR(a,s.y+(a-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=n&&u.y>=n||(s.y>=n?s=new eR(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round():u.y>=n&&(u=new eR(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(u)))))}}return o}function cr(e){let i=0,r=0;for(let a of e)i+=a.w*a.h,r=Math.max(r,a.w);e.sort((e,i)=>i.h-e.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],n=0,o=0;for(let i of e)for(let e=a.length-1;e>=0;e--){let r=a[e];if(!(i.w>r.w||i.h>
7r.h)){if(i.x=r.x,i.y=r.y,o=Math.max(o,i.y+i.h),n=Math.max(n,i.x+i.w),i.w===r.w&&i.h===r.h){let i=a.pop();e<a.length&&(a[e]=i)}else i.h===r.h?(r.x+=i.w,r.w-=i.w):(i.w===r.w||a.push({x:r.x+i.w,y:r.y,w:r.w-i.w,h:i.h}),r.y+=i.h,r.h-=i.h);break}}return{w:n,h:o,fill:i/(n*o)||0}}aT(u9,"Anchor");class ca{static getImagePositionScale(e,i,r){if(i&&e&&e.options&&e.options.transform){let i=e.options.transform;return{x:i.a,y:i.d}}return{x:r,y:r}}constructor(e,i,r,a){this.paddedRect=e;const{pixelRatio:n,version:o,stretchX:s,stretchY:l,content:h,sdf:u,usvg:c}=i;this.pixelRatio=n,this.stretchX=s,this.stretchY=l,this.content=h,this.version=o,this.padding=r,this.sdf=u,this.scale=ca.getImagePositionScale(a,c,n)}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 cn(e,i,r){let a=iu.parse(e),n=function(e,i,r=[1,1]){return{x:0,y:0,w:(e.data?e.data.width:e.width*r[0])+2*i,h:(e.data?e.data.height:e.height*r[1])+2*i}}(i,r,[a.options.transform.a,a.options.transform.d]);return{bin:n,imagePosition:new ca(n,i,r,a),imageVariant:a}}class co{constructor(e,i,r){const a=new Map,n=new Map;this.haveRenderCallbacks=[];const o=[];this.addImages(e,a,1,o),this.addImages(i,n,2,o);const{w:s,h:l}=cr(o),h=new lA({width:s||1,height:l||1});for(const[i,n]of e.entries()){const e=a.get(i).paddedRect;lA.copy(n.data,h,{x:0,y:0},{x:e.x+1,y:e.y+1},n.data,r,n.sdf)}for(const[e,a]of i.entries()){const i=n.get(e),o=i.paddedRect;let s=i.padding;const l=o.x+s,u=o.y+s,c=a.data.width,d=a.data.height;s=s>1?s-1:s,lA.copy(a.data,h,{x:0,y:0},{x:l,y:u},a.data,r),lA.copy(a.data,h,{x:0,y:d-s},{x:l,y:u-s},{width:c,height:s},r),lA.copy(a.data,h,{x:0,y:0},{x:l,y:u+d},{width:c,height:s},r),lA.copy(a.data,h,{x:c-s,y:0},{x:l-s,y:u},{width:s,height:d},r),lA.copy(a.data,h,{x:0,y:0},{x:l+c,y:u},{width:s,height:d},r),lA.copy(a.data,h,{x:c-s,y:d-s},{x:l-s,y:u-s},{width:s,height:s},r),lA.copy(a.data,h,{x:0,y:d-s},{x:l+c,y:u-s},{width:s,height:s},r),lA.copy(a.data,h,{x:0,y:0},{x:l+c,y:u+d},{width:s,height:s},r),lA.copy(a.data,h,{x:c-s,y:0},{x:l-s,y:u+d},{width:s,height:s},r)}this.lut=r,this.image=h,this.iconPositions=a,this.patternPositions=n}addImages(e,i,r,a){for(let[n,o]of e.entries()){let{bin:e,imagePosition:s,imageVariant:l}=cn(n,o,r);i.set(n,s),a.push(e),o.hasRenderCallback&&this.haveRenderCallbacks.push(l.id)}}patchUpdatedImages(e,i,r){for(let a of(this.haveRenderCallbacks=this.haveRenderCallbacks.filter(i=>e.hasImage(i,r)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r),e.getUpdatedImages(r))){for(let n of this.iconPositions.keys()){let o=iu.parse(n);if(tU.isEqual(o.id,a)){let o=e.getImage(a,r);this.patchUpdatedImage(this.iconPositions.get(n),o,i)}}for(let n of this.patternPositions.keys()){let o=iu.parse(n);if(tU.isEqual(o.id,a)){let o=e.getImage(a,r);this.patchUpdatedImage(this.patternPositions.get(n),o,i)}}}}patchUpdatedImage(e,i,r){if(!e||!i||e.version===i.version)return;e.version=i.version;let[a,n]=e.tl,o=e.sdf;if(this.lut||o){let e={width:i.data.width,height:i.data.height},s=new lA(e);lA.copy(i.data,s,{x:0,y:0},{x:0,y:0},e,this.lut,o),r.update(s,{position:{x:a,y:n}})}else r.update(i.data,{position:{x:a,y:n}})}}function cs(e,i,r,a,n,o,s,l,h){for(let u=i;u<i+a;u++)cl(e,r*o+u,o,n,s,l,h);for(let u=r;u<r+n;u++)cl(e,u*o+i,1,a,s,l,h)}function cl(e,i,r,a,n,o,s){o[0]=0,s[0]=-1e20,s[1]=1e20,n[0]=e[i];for(let l=1,h=0,u=0;l<a;l++){n[l]=e[i+l*r];let a=l*l;do{let e=o[h];u=(n[l]-n[e]+a-e*e)/(l-e)/2}while(u<=s[h]&&--h>-1);o[++h]=l,s[h]=u,s[h+1]=1e20}for(let l=0,h=0;l<a;l++){for(;s[h+1]<l;)h++;let a=o[h],u=l-a;e[i+l*r]=n[a]+u*u}}aT(ca,"ImagePosition"),aT(co,"ImageAtlas");let ch={none:0,ideographs:1,all:2};class cu{constructor(e,i,r){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=r,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,r){let a=[],n=this.urls[i]||tt.GLYPHS_URL;for(let i in e)for(let r of e[i])a.push({stack:i,id:r});eq(a,({stack:e,id:i},r)=>{let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=a.glyphs[i];if(void 0!==o)return void r(null,{stack:e,id:i,glyph:o});if(o=this._tinySDF(a,e,i))return a.glyphs[i]=o,void r(null,{stack:e,id:i,glyph:o});let s=Math.floor(i/256);if(256*s>65535)return e0("glyphs > 65535 not supported"),void r(null,{stack:e,id:i,glyph:o});if(a.ranges[s])return void r(null,{stack:e,id:i,glyph:o});let l=a.requests[s];l||(l=a.requests[s]=[],cu.loadGlyphRange(e,s,n,this.requestManager,(e,i)=>{if(i){for(let e in a.ascender=i.ascender,a.descender=i.descender,i.glyphs)this._doesCharSupportLocalGlyph(+e)||(a.glyphs[+e]=i.glyphs[+e]);a.ranges[s]=!0}for(let r of l)r(e,i);delete a.requests[s]})),l.push((a,n)=>{a?r(a):n&&r(null,{stack:e,id:i,glyph:n.glyphs[i]||null})})},(e,i)=>{if(e)r(e);else if(i){let e={};for(let{stack:r,id:a,glyph:n}of i)void 0===e[r]&&(e[r]={}),void 0===e[r].glyphs&&(e[r].glyphs={}),e[r].glyphs[a]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[r].ascender=this.entries[r].ascender,e[r].descender=this.entries[r].descender;r(null,e)}})}_doesCharSupportLocalGlyph(e){let i,r;return this.localGlyphMode!==ch.none&&(this.localGlyphMode===ch.all?!!this.localFontFamily:!!this.localFontFamily&&
7(aZ(e)||aW(e)||ak(e)||aF(e)||aO(e)||aq(e)||(i=e)>=131072&&i<=173791||(r=e)>=66736&&r<=66815))}_tinySDF(e,i,r){let a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(r))return;let n=e.tinySDF;if(!n){let r="400";/bold/i.test(i)?r="900":/medium/i.test(i)?r="500":/light/i.test(i)&&(r="200"),(n=e.tinySDF=new cu.TinySDF({fontFamily:a,fontWeight:r,fontSize:48,buffer:6,radius:16})).fontWeight=r}if(this.localGlyphs[n.fontWeight][r])return this.localGlyphs[n.fontWeight][r];let o=String.fromCodePoint(r),{data:s,width:l,height:h,glyphWidth:u,glyphHeight:c,glyphLeft:d,glyphTop:p,glyphAdvance:f}=n.draw(o);return this.localGlyphs[n.fontWeight][r]={id:r,bitmap:new lE({width:l,height:h},s),metrics:{width:u/2,height:c/2,left:d/2,top:p/2-27,advance:f/2,localGlyph:!0}}}}function cc(e,i){return e+i[1]-i[0]}function cd(e,i,r,a,n=1){let o=[],s=e.imagePrimary,l=s.pixelRatio,h=s.paddedRect.w-2,u=s.paddedRect.h-2,c=(e.right-e.left)*n,d=(e.bottom-e.top)*n,p=s.stretchX||[[0,h]],f=s.stretchY||[[0,u]],m=p.reduce(cc,0),_=f.reduce(cc,0),g=h-m,y=u-_,x=0,v=m,b=0,w=_,T=0,S=g,M=0,E=y;if(s.content&&a){let e=s.content;x=cp(p,0,e[0]),b=cp(f,0,e[1]),v=cp(p,e[0],e[2]),w=cp(f,e[1],e[3]),T=e[0]-x,M=e[1]-b,S=e[2]-e[0]-v,E=e[3]-e[1]-w}let A=(a,o,h,u)=>{var p,f,g,y,A,I,C,P,z,D,R,L,O,k,F,B;let N=(p=a.stretch-x,p/v*c+e.left*n),V=(f=a.fixed-T,g=S,y=a.stretch,f-g*y/m),U=(A=o.stretch-b,A/w*d+e.top*n),j=(I=o.fixed-M,C=E,P=o.stretch,I-C*P/_),G=(z=h.stretch-x,z/v*c+e.left*n),q=(D=h.fixed-T,R=S,L=h.stretch,D-R*L/m),Z=(O=u.stretch-b,O/w*d+e.top*n),H=(k=u.fixed-M,F=E,B=u.stretch,k-F*B/_),$=new eR(N,U),W=new eR(G,U),X=new eR(G,Z),Y=new eR(N,Z),K=new eR(V/l,j/l),J=new eR(q/l,H/l),Q=i*Math.PI/180;if(Q){let e=Math.sin(Q),i=Math.cos(Q),r=[i,-e,e,i];$._matMult(r),W._matMult(r),Y._matMult(r),X._matMult(r)}let ee=a.stretch+a.fixed,et=h.stretch+h.fixed,ei=o.stretch+o.fixed,er=u.stretch+u.fixed,ea=e.imageSecondary;return{tl:$,tr:W,bl:Y,br:X,texPrimary:{x:s.paddedRect.x+1+ee,y:s.paddedRect.y+1+ei,w:et-ee,h:er-ei},texSecondary:ea?{x:ea.paddedRect.x+1+ee,y:ea.paddedRect.y+1+ei,w:et-ee,h:er-ei}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:K,pixelOffsetBR:J,minFontScaleX:S/l/c,minFontScaleY:E/l/d,isSDF:r}};if(a&&(s.stretchX||s.stretchY)){let e=cf(p,g,m),i=cf(f,y,_);for(let r=0;r<e.length-1;r++){let a=e[r],n=e[r+1];for(let e=0;e<i.length-1;e++)o.push(A(a,i[e],n,i[e+1]))}}else o.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:h+1},{fixed:0,stretch:u+1}));return o}function cp(e,i,r){let a=0;for(let n of e)a+=Math.max(i,Math.min(r,n[1]))-Math.max(i,Math.min(r,n[0]));return a}function cf(e,i,r){let a=[{fixed:-1,stretch:0}];for(let[i,r]of e){let e=a[a.length-1];a.push({fixed:i-e.stretch,stretch:e.stretch}),a.push({fixed:i-e.stretch,stretch:e.stretch+(r-i)})}return a.push({fixed:i+1,stretch:r}),a}cu.loadGlyphRange=function(e,i,r,a,n){let o=256*i;tE(a.transformRequest(a.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",`${o}-${o+255}`),tw.Glyphs),(e,i)=>{if(e)n(e);else if(i){let e={},r=new uH(i).readFields(u$,{});for(let i of r.glyphs)e[i.id]=i;n(null,{glyphs:e,ascender:r.ascender,descender:r.descender})}})},cu.TinySDF=class{constructor({fontSize:e=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=i,this.cutoff=a,this.radius=r;const l=this.size=e+4*i,h=this._createCanvas(l),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${o} ${e}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let i=document.createElement("canvas");return i.width=i.height=e,i}draw(e){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(r),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),h=Math.min(this.size-this.buffer,s+Math.ceil(a)),u=l+2*this.buffer,c=h+2*this.buffer,d=Math.max(u*c,0),p=new Uint8ClampedArray(d),f={data:p,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:s,glyphLeft:0,glyphAdvance:i};if(0===l||0===h)return f;let{ctx:m,buffer:_,gridInner:g,gridOuter:y}=this;m.clearRect(_,_,l,h),m.fillText(e,_,_+s);let x=m.getImageData(_,_,l,h);y.fill(1e20,0,d),g.fill(0,0,d);for(let e=0;e<h;e++)for(let i=0;i<l;i++){let r=x.data[4*(e*l+i)+3]/255;if(0===r)continue;let a=(e+_)*u+i+_;if(1===r)y[a]=0,g[a]=1e20;else{let e=.5-r;y[a]=e>0?e*e:0,g[a]=e<0?e*e:0}}cs(y,0,0,u,c,u,this.f,this.v,this.z),cs(g,_,_,l,h,u,this.f,this.v,this.z);for(let e=0;e<d;e++){let i=Math.sqrt(y[e])-Math.sqrt(g[e]);p[e]=Math.round(255-255*(i/this.radius+this.cutoff))}return f}};function cm(e,i){return i.max-e.max}class c_{constructor(e,i,r,a){this.p=new eR(e,i),this.h=r,this.d=function(e,i){let r=!1,a=1/0;for(let n=0;n<i.length;n++){let o=i[n];for(let i=0,n=o.length,s=n-1;i<n;s=i++){let n=o[i],l=o[s];n.y>e.y!=l.y>e.y&&e.x<(l.x-n.x)*(e.y-n.y)/(l.y-n.y)+n.x&&(r=!r),a=Math.min(a,sM(e,n,l))}}return(r?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}let cg=1/0,cy=Math.sqrt(2);function cx(e,[i,r]){let a=0,n=0;if(r===cg){i<0&&(i=0);let r=i/cy;switch(e){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-i;break;case"top":n=i-7}switch(e){case"top-right":case"bottom-right":a=-r;break;case"top-left":case"bottom-left":a=r;break;case"left":a=i;break;case"right":a=-i}}else{switch(i=Math.abs(i),r=Math.abs(r),e){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(e){case"top-right":case"bottom-right":case"right":a=-i;break;case"top-left":case"bottom-left":case"left":a=i}}return[a,n]}function cv(e,i,r,a,n,o,s,l){if(!e)return;let h=uO(i,r,a,n,o);return e.scaleSelf(h*l*s)}function cb(e,i,r,a,n,o,s,l){return{iconPrimary:cv(e.getPrimary(),i,r,a,n,o,s,l),iconSecondary:cv(e.getSecondary(),i,r,a,n,o,s,l)}}function cw(e,i,r,a){!e||(e.imagePrimary=i.get(r.toString()),a&&(e.imageSecondary=i.get(a.toString())))}function cT(e,i){if(e){for(let r of e.positionedLines)for(let e of r.positionedGlyphs)if(null!==e.image){let r=e.image.toString();e.rect=i.get(r).paddedRect}}}function cS(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function cM(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=function(e,i,r,a,n,o,s){let l,h,u,c=[];if(0===e.positionedLines.length)return c;let d=r.layout.get("text-rotate").evaluate(n,{})*Math.PI/180,p=(l=i[0],(u=l*(h=i[1]))>0?[l,-h]:u<0?[-l,h]:0===l?[h,l]:[h,-l]),f=Math.abs(e.top-e.bottom);for(let i of e.positionedLines)f-=i.lineOffset;let m=e.positionedLines.length,_=f/m,g=e.top-i[1];for(let r=0;r<m;++r){let n=e.positionedLines[r];for(let l of(g=function(e,i,r,a){let n=i+e.positionedLines[a].lineOffset;return 0===a?r+n/2:r+(n+(i+e.positionedLines[a-1].lineOffset))/2}(e,_,g,r),n.positionedGlyphs)){let r,n,h,u;if(!l.rect)continue;let f=l.rect||{},m=4,_=!0,y=1,x=0;if(l.image){let e=o.get(l.image.toString());if(!e)continue;if(e.sdf){e0("SDF images are not supported in formatted text and will be ignored.");continue}_=!1,m=1/(y=e.pixelRatio)}let v=(a||s)&&l.vertical,b=l.metrics.advance*l.scale/2,w=l.metrics,T=l.rect;if(null===T)continue;s&&e.verticalizable&&(x=l.image?b-l.metrics.width*l.scale/2:0);let S=a?[l.x+b,l.y]:[0,0],M=[0,0],E=[0,0],A=!1;a||(v?(E=[l.x+b+p[0],l.y+p[1]-x],A=!0):M=[l.x+b+i[0],l.y+i[1]-x]);let I=T.w*l.scale/(y*(l.localGlyph?2:1)),C=T.h*l.scale/(y*(l.localGlyph?2:1));if(v){let e=l.y-g,i=new eR(-b,b-e),a=-Math.PI/2,o=new eR(...E);
7(r=new eR(-b+M[0],M[1]))._rotateAround(a,i)._add(o),r.x+=-e+b,r.y-=(w.left-m)*l.scale;let s=l.image?w.advance*l.scale:24*l.scale,c=String.fromCodePoint(l.glyph);"︶"===c||"ï¹"===c||"︸"===c||"ï¹"===c||"ï¹"===c||"︾"===c||"︼"===c||"︺"===c||"ï¸"===c||"ï¹"===c||"ï¸"===c||"ï¸"===c||"ï¸"===c||"ï½"===c||"ï¿£"===c||"ï¸"===c||"ï¸"===c?r.x+=(1-m)*l.scale:"︵"===c||"ï¹"===c||"︷"===c||"ï¹"===c||"ï¹"===c||"︽"===c||"︻"===c||"︹"===c||"ï¸"===c||"︿"===c?r.x+=s-w.height*l.scale+(-m-1)*l.scale:r.x+=l.image||w.width+2*m===T.w&&w.height+2*m===T.h?(s-C)/2:(s-(w.height+2*m)*l.scale)/2,n=new eR(r.x,r.y-I),h=new eR(r.x+C,r.y),u=new eR(r.x+C,r.y-I)}else{let e=(w.left-m)*l.scale-b+M[0],i=(-w.top-m)*l.scale+M[1],a=e+I,o=i+C;r=new eR(e,i),n=new eR(a,i),h=new eR(e,o),u=new eR(a,o)}if(d){let e;e=a?new eR(0,0):A?new eR(p[0],p[1]):new eR(i[0],i[1]),r._rotateAround(d,e),n._rotateAround(d,e),h._rotateAround(d,e),u._rotateAround(d,e)}let P=new eR(0,0),z=new eR(0,0);c.push({tl:r,tr:n,bl:h,br:u,texPrimary:f,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:S,sectionIndex:l.sectionIndex,isSDF:_,pixelOffsetTL:P,pixelOffsetBR:z,minFontScaleX:0,minFontScaleY:0})}}return c}(a,h,o,s,l,n,e.allowVerticalPlacement),v=e.textSizeData,b=null;for(let a of("source"===v.kind?(b=[128*o.layout.get("text-size").evaluate(l,{},g)*m.textScaleFactor])[0]>32640&&e0(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===v.kind&&((b=[128*m.compositeTextSizes[0].evaluate(l,{},g)*m.textScaleFactor,128*m.compositeTextSizes[1].evaluate(l,{},g)*m.textScaleFactor])[0]>32640||b[1]>32640)&&e0(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),e.addSymbols(e.text,x,b,h,s,l,c,i,r,u.lineStartIndex,u.lineLength,f,_,g,y,!1),d))p[a]=e.text.placedSymbolArray.length-1;return 4*x.length}function cE(e){for(let i in e)return e[i];return null}function cA(e,i,r,a,n,o,s,l,h,u){let c=s.top,d=s.bottom,p=s.left,f=s.right,m=s.collisionPadding;if(m&&(p-=m[0],c-=m[1],f+=m[2],d+=m[3]),h){let e=new eR(p,c),i=new eR(f,c),r=new eR(p,d),a=new eR(f,d),n=h*eO,o=new eR(0,0);u&&(o=new eR(u[0],u[1])),e._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),a._rotateAround(n,o),p=Math.min(e.x,i.x,r.x,a.x),f=Math.max(e.x,i.x,r.x,a.x),c=Math.min(e.y,i.y,r.y,a.y),d=Math.max(e.y,i.y,r.y,a.y)}return e.emplaceBack(i.x,i.y,i.z,r.x,r.y,p,c,f,d,l,a,n,o),e.length-1}function cI(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);let i=e.bottom-e.top;return i>0?Math.max(10,i):null}function cC(e,i){let r=e.fovAboveCenter,a=e.elevation?e.elevation.getMinElevationBelowMSL()*i:0,n=(e._camera.position[2]*e.worldSize-a)/Math.cos(e._pitch),o=Math.sin(r)*n/Math.sin(Math.max(Math.PI/2-e._pitch-r,.01)),s=Math.sin(e._pitch)*o+n,l=n*(1/e._horizonShift);if(!e.elevation||0===e.elevation.exaggeration()){let i=Math.max(e.zoom-17,0);e.isOrthographic&&(i/=10),s*=1+i}return Math.min(1.01*s,l)}function cP(e,i){if(!i.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:i};let r=Math.pow(2,-e.z),a=e.x*r,n=(e.x+1)*r,o=e.y*r,s=(e.y+1)*r,l=so(a),h=so(n),u=ss(o),c=ss(s),d=i.project(l,u),p=i.project(h,u),f=i.project(h,c),m=i.project(l,c),_=Math.min(d.x,p.x,f.x,m.x),g=Math.min(d.y,p.y,f.y,m.y),y=Math.max(d.x,p.x,f.x,m.x),x=Math.max(d.y,p.y,f.y,m.y),v=r/16;function b(e,r,a,n,o,s){let l=(a+o)/2,h=(n+s)/2,u=i.project(so(l),ss(h)),c=Math.max(0,_-u.x,g-u.y,u.x-y,u.y-x);_=Math.min(_,u.x),y=Math.max(y,u.x),g=Math.min(g,u.y),x=Math.max(x,u.y),c>v&&(b(e,u,a,n,l,h),b(u,r,l,h,o,s))}b(d,p,a,o,n,o),b(p,f,n,o,n,s),b(f,m,n,s,a,s),b(m,d,a,s,a,o),_-=v,g-=v,y+=v,x+=v;let w=1/Math.max(y-_,x-g);return{scale:w,x:_*w,y:g*w,x2:y*w,y2:x*w,projection:i}}function cz(e,{x:i,y:r},a=0){return new eR(((i-a)*e.scale-e.x)*8192,(r*e.scale-e.y)*8192)}let cD=eP.mat4.identity(new Float32Array(16));class cR{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new st(0,0)}projectTilePoint(e,i,r){return{x:e,y:i,z:0}}locationPoint(e,i,r,a=!0){return e._coordinatePoint(e.locationCoordinate(i,r),a)}pixelsPerMeter(e,i){return 1/sr(e)*i}pixelSpaceConversion(e,i,r){return 1}farthestPixelDistance(e){return cC(e,e.pixelsPerMeter)}pointCoordinate(e,i,r,a){let n=new eR(i,Math.max(e.horizonLineFromTop(!1),r));return e.rayIntersectionCoordinate(e.pointRayIntersection(n,a))}pointCoordinate3D(e,i,r){let a=new eR(i,r);if(e.elevation)return e.elevation.pointCoordinate(a);{let i=this.pointCoordinate(e,a.x,a.y,0);return[i.x,i.y,i.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);let r=e.horizonLineFromTop();return i.y<r}createInversionMatrix(e,i){return cD}createTileMatrix(e,i,r){let a,n,o,s=r.canonical,l=eP.mat4.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){let h=cP(s,this);a=1,n=h.x+r.wrap*h.scale,o=h.y,eP.mat4.scale(l,l,[a/h.scale,a/h.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*r.wrap)*a,o=s.y*a;return eP.mat4.translate(l,l,[n,o,0]),eP.mat4.scale(l,l,[a/8192,a/8192,1]),l}upVector(e,i,r){return[0,0,1]}upVectorScale(e,i,r){return{metersToTile:1}}}class cL extends cR{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,r]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(i*eO);this.n=(a+Math.sin(r*eO))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){let{n:r,c:a,r0:n}=this,o=(e-this.center[0])*eO,s=Math.sqrt(a-2*r*Math.sin(i*eO))/r;return{x:s*Math.sin(o*r),y:s*Math.cos(o*r)-n,z:0}}unproject(e,i){let{n:r,c:a,r0:n}=this,o=n+i,s=Math.atan2(e,Math.abs(o))*Math.sign(o);o*r<0&&(s-=Math.PI*Math.sign(e)*Math.sign(o));let l=this.center[0]*eO*r,h=eU((s=eG(s,-Math.PI-l,Math.PI-l))/r*ek+this.center[0],-180,180),u=Math.asin(eU((a-(e*e+o*o)*r*r)/(2*r),-1,1));return new st(h,eU(u*ek,-85.051129,85.051129))}}let cO=Math.sqrt(3)/2;class ck extends cR{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;let r=Math.asin(cO*Math.sin(i)),a=r*r,n=a*a*a;return{x:.5*(e*Math.cos(r)/(cO*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a)))/M
7ath.PI+.5),y:1-.5*(r*(1.340264+-.081106*a+n*(893e-6+.003796*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,a=r*r,n=a*a*a;for(let e,o,s=0;s<12&&(o=r*(1.340264+-.081106*a+n*(893e-6+.003796*a))-i,n=(a=(r=eU(r-(e=o/(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))),-Math.PI/3,Math.PI/3))*r)*a*a,!(1e-12>Math.abs(e)));++s);let o=cO*e*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))/Math.cos(r),s=Math.asin(Math.sin(r)/cO);return new st(eU(180*o/Math.PI,-180,180),eU(180*s/Math.PI,-85.051129,85.051129))}}class cF extends cR{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){return new st(360*(e-.5),eU(360*(.5-i),-85.051129,85.051129))}}let cB=Math.PI/2;function cN(e){return Math.tan((cB+e)/2)}class cV extends cR{constructor(e){super(e),this.center=e.center||[0,30];const[i,r]=this.parallels=e.parallels||[30,30];let a=i*eO,n=r*eO;this.southernCenter=a+n<0,this.southernCenter&&(a=-a,n=-n);const o=Math.cos(a),s=cN(a);this.n=a===n?Math.sin(a):Math.log(o/Math.cos(n))/Math.log(cN(n)/s),this.f=o*Math.pow(cN(a),this.n)/this.n}project(e,i){i*=eO,this.southernCenter&&(i=-i),e=(e-this.center[0])*eO;let{n:r,f:a}=this;a>0?i<-cB+1e-6&&(i=-cB+1e-6):i>cB-1e-6&&(i=cB-1e-6);let n=a/Math.pow(cN(i),r),o=n*Math.sin(r*e),s=a-n*Math.cos(r*e);return o=.5*(o/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:o,y:this.southernCenter?s:1-s,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i);let{n:r,f:a}=this,n=a-(i=(2*(1-i)-.5)*Math.PI),o=Math.sign(n),s=Math.sign(r)*Math.sqrt(e*e+n*n),l=Math.atan2(e,Math.abs(n))*o;n*r<0&&(l-=Math.PI*Math.sign(e)*o);let h=eU(l/r*ek+this.center[0],-180,180),u=eU((2*Math.atan(Math.pow(a/s,1/r))-cB)*ek,-85.051129,85.051129);return new st(h,this.southernCenter?-u:u)}}class cU extends cR{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:sa(e),y:sn(i),z:0}}unproject(e,i){return new st(so(e),ss(i))}}let cj=85.051129*eO;class cG extends cR{project(e,i){let r=(i*=eO)*i,a=r*r;return{x:.5*((e*=eO)*(.8707-.131979*r+a*(a*(.003971*r-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,a=25,n=0,o=r*r;do{let e=(o=r*r)*o;n=(r*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-i)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),r=eU(r-n,-cj,cj)}while(Math.abs(n)>1e-6&&--a>0);return new st(eU(e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))*ek,-180,180),r*ek)}}let cq=85.051129*eO;class cZ extends cR{project(e,i){i*=eO,e*=eO;let r=Math.cos(i),a=Math.acos(r*Math.cos(e/2)),n=Math.sin(a)/a;return{x:.5*((.5*(2/Math.PI*e+2*r*Math.sin(e/2)/n)||0)/Math.PI+.5),y:1-.5*((.5*(i+Math.sin(i)/n)||0)/Math.PI+1),z:0}}unproject(e,i){let r=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,n=25,o=0,s=0;do{let n=Math.cos(a),l=Math.sin(a),h=2*l*n,u=l*l,c=n*n,d=Math.cos(r/2),p=Math.sin(r/2),f=2*d*p,m=p*p,_=1-c*d*d,g=_?1/_:0,y=_?Math.acos(n*d)*Math.sqrt(1/_):0,x=.5*(2*y*n*p+2*r/Math.PI)-e,v=.5*(y*l+a)-i,b=.5*g*(c*m+y*n*d*u)+1/Math.PI,w=g*(f*h/4-y*l*p),T=.125*g*(h*p-y*l*c*f),S=.5*g*(u*d+y*m*n)+.5,M=w*T-S*b;o=(v*w-x*S)/M,s=(x*T-v*b)/M,r=eU(r-o,-Math.PI,Math.PI),a=eU(a-s,-cq,cq)}while((Math.abs(o)>1e-6||Math.abs(s)>1e-6)&&--n>0);return new st(r*ek,a*ek)}}class cH extends cR{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*eO)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){let{scale:r,cosPhi:a}=this;return{x:e*eO*a*r+.5,y:-Math.sin(i*eO)/a*r+.5,z:0}}unproject(e,i){let{scale:r,cosPhi:a}=this,n=eU((e-.5)/r*ek/a,-180,180),o=Math.asin(eU(-(i-.5)/r*a,-1,1));return new st(n,eU(o*ek,-85.051129,85.051129))}}class c$ extends cU{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,r){let a=lr(e,i,r),n=lo(s8(r));return eP.vec3.transformMat4(a,a,n),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,r){let a=o7(i.lat,i.lng),n=eP.vec3.normalize([],a),o=r?e._centerAltitude+r:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,s=1/sr(0)*8192*o;eP.vec3.scaleAndAdd(a,a,n,s);let l=eP.mat4.identity(new Float64Array(16));return eP.mat4.multiply(l,e.pixelMatrix,e.globeMatrix),eP.vec3.transformMat4(a,a,l),new eR(a[0],a[1])}pixelsPerMeter(e,i){return 1/sr(0)*i}pixelSpaceConversion(e,i,r){let a=1/sr(e)*i,n=t$(1/sr(45)*i,a,r);return this.pixelsPerMeter(e,i)/n}createTileMatrix(e,i,r){let a=ls(s8(r.canonical));return eP.mat4.multiply(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){let{center:r}=e,a=lo(s8(i));return eP.mat4.rotateY(a,a,r.lng*eO),eP.mat4.rotateX(a,a,r.lat*eO),eP.mat4.scale(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,r,a){return s4(e,i,r,!0)||new sp(0,0)}pointCoordinate3D(e,i,r){let a=this.pointCoordinate(e,i,r,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!s4(e,i.x,i.y,!1)}farthestPixelDistance(e){let i=function(e,i){let r,a=e.cameraToCenterDistance,n=e._centerAltitude*i,o=e._camera,s=e._camera.forward(),l=eP.vec3.add([],eP.vec3.scale([],s,-a),[0,0,n]),h=e.worldSize/(2*Math.PI),u=[0,0,-h],c=e.width/e.height,d=Math.tan(e.fovAboveCenter),p=eP.vec3.scale([],o.up(),d),f=eP.vec3.scale([],o.right(),d*c),m=eP.vec3.normalize([],eP.vec3.add([],eP.vec3.add([],s,p),f)),_=[];
7if(new sW(l,m).closestPointOnSphere(u,h,_)){let i=eP.vec3.add([],_,u),a=eP.vec3.sub([],i,l);r=Math.cos(e.fovAboveCenter)*eP.vec3.length(a)}else{let e=eP.vec3.sub([],l,u),i=eP.vec3.sub([],u,l);eP.vec3.normalize(i,i);let a=eP.vec3.length(e)-h,n=Math.acos((r=Math.sqrt(a*(a+2*h)))/(h+a))-Math.acos(eP.vec3.dot(s,i));r*=Math.cos(n)}return 1.01*r}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),r=lc(e.zoom);return r>0?t$(i,cC(e,1/sr(e.center.lat)*e.worldSize)+e.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(e.width,e.height)/e.worldSize*Math.PI)),Math.pow(r,10)):i}upVector(e,i,r){return lr(i,r,e,1)}upVectorScale(e){return{metersToTile:s2(la(s8(e)))}}}function cW(e){let i=e.parallels,r=!!i&&.01>Math.abs(i[0]+i[1]);switch(e.name){case"mercator":return new cU(e);case"equirectangular":return new cF(e);case"naturalEarth":return new cG(e);case"equalEarth":return new ck(e);case"winkelTripel":return new cZ(e);case"albers":return r?new cH(e):new cL(e);case"lambertConformalConic":return r?new cH(e):new cV(e);case"globe":return new c$(e)}throw Error(`Invalid projection name: ${e.name}`)}let cX=hi.VectorTileFeature.types,cY=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function cK(e,i,r,a,n,o,s,l,h,u,c,d,p){let f=l?Math.min(32640,Math.round(l[0])):0,m=l?Math.min(32640,Math.round(l[1])):0;e.emplaceBack(i,r,Math.round(32*a),Math.round(32*n),o,s,(f<<1)+ +!!h,m,16*u,16*c,256*d,256*p)}function cJ(e,i,r){e.emplaceBack(i,r)}function cQ(e,i,r,a,n,o,s){e.emplaceBack(i,r,a,n,o,s)}function c0(e,i,r,a,n){e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n)}class c1{constructor(e){this.layoutVertexArray=new n0,this.indexArray=new n7,this.programConfigurations=e,this.segments=new oI,this.dynamicLayoutVertexArray=new n2,this.opacityVertexArray=new n3,this.placedSymbolArray=new o_,this.iconTransitioningVertexArray=new n4,this.globeExtVertexArray=new n1,this.zOffsetVertexArray=new nZ}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(e,i,r,a,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uE.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,uI.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,cY,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,uP.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,uA.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,uC.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}aT(c1,"SymbolBuffers");class c2{constructor(e,i,r){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new r,this.segments=new oI,this.collisionVertexArray=new n9,this.collisionVertexArrayExt=new n2}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,uz.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,uD.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}aT(c2,"CollisionBuffers");class c3{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=eP.mat4.identity([]),this.placementViewportMatrix=eP.mat4.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=uk(this.zoom,i["text-size"]),this.iconSizeData=uk(this.zoom,i["icon-size"]);const r=this.layers[0].layout,a=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==a.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map(e=>uY[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new c1(new o0(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new c1(new o0(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new ox,this.lineVertexArray=new ov,this.symbolInstances=new oy}calculateGlyphDependencies(e,i,r,a,n){for(let r of e){let e=r.codePointAt(0);if(void 0===e)break;if(i[e]=!0,a&&n&&e<=65535){let e=uV[r];e&&(i[e.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!hB(this.activeReplacements,r)&&(this.activeReplacements=r,!0)}populate(e,i,r,a){let n=this.layers[0],o=n.layout,s="globe"===this.projection.name,l=o.get("text-font"),h=o.get("text-field"),u=o.get("icon-image"),[c,d]=o.get("icon-size-scale-range"),p=eU(i.scaleFactor||1,c,d),f=("constant"!==h.value.kind||h.value.value instanceof ih&&!h.value.value.isEmpty()||h.value.value.toString().length>0)&&("constant"!==l.value.kind||l.value.value.length>0),m="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,_=o.get("symbol-sort-key");if(this.features=[],!f&&!m)return;let g=i.iconDependencies,y=i.glyphDependencies,x=i.availableImages,v=new nl(this.zoom);for(let{feature:i,id:h,index:u,sourceLayerIndex:c}of e){let e,d,b=n._featureFilter.needGeometry,w=sg(i,b);if(!n._featureFilter.filter(v,w,r))continue;if(b||(w.geometry=s_(i,r,a)),s&&1!==i.type&&r.z<=5){let e=w.geometry,i=(e,i)=>{let a=lr(e.x,e.y,r,1),n=lr(i.x,i.y,r,1);return .98078528056>eP.vec3.dot(a,n)};for(let r=0;r<e.length;r++)e[r]=function(e,i){let r=e[0],a=[r];for(let n=1;n<e.length;n++){let o=e[n];(function e(i,r,a,n){if(n(r,a)){let o=r.add(a)._mult(.5);e(i,r,o,n),e(i,o,a,n)}else i.push(a)})(a,r,o,i),r=o}return a}(e[r],i)}if(f){let i=n.getValueAndResolveTokens("text-field",w,r,x),a=ih.factory(i);(function(e){for(let i of e.sections)if(function(e){for(let i of e)if(a5(i.charCodeAt(0)))return!0;return!1}(i.text))return!0;return!1})(a)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nn()||this.hasRTLText&&ns.isParsed())&&(e=function(e,i,r){return e.sections.forEach(e=>{var a;let n;a=e.text,"uppercase"===(n=i.layout.get("text-transform").evaluate(r,{}))?a=a.toLocaleUpperCase():"lowercase"===n&&(a=a.toLocaleLowerCase()),ns.applyArabicShaping&&(a=ns.applyArabicShaping(a)),e.text=a}),e}(a,n,w))}if(m){let e=n.getValueAndResolveTokens("icon-image",w,r,x);d=e instanceof ic?e:ic.build(e)}if(!e&&!d)continue;let T=this.sortFeaturesByKey?_.evaluate(w,{},r):void 0,S={id:h,text:e,icon:d,index:u,sourceLayerIndex:c,geometry:w.geometry,properties:i.properties,type:cX[i.type],sortKey:T};if(this.features.push(S),d){let e=this.layers[0]._unevaluatedLayout._values,{iconPrimary:i,iconSecondary:a}=cb(d,this.iconSizeData,e["icon-size"],r,this.zoom,S,this.pixelRatio,p),n=i.id.toString();if(g.has(n)?g.get(n).push(i):g.set(n,[i]),a){let e=a.id.toString();g.has(e)?g.get(e).push(a):g.set(e,[a])}}if(e){let i=l.evaluate(w,{},r).join(","),a="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");for(let r of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(uY.vertical)>=0,e.sections))if(r.image){let e=r.image.getPrimary().scaleSelf(this.pixelRatio),i=e.id.toString(),a=g.get(i)||[];a.push(e),g.set(i,a)}else{let n=a2(e.toString()),o=r.fontStack||i,s=y[o]=y[o]||{};this.calculateGlyphDependencies(r.text,s,a,this.allowVerticalPlacement,n)}}}if("line"===o.get("symbol-placement")&&(this.features=function(e){let i={},r={},a=[],n=0;function o(i){a.push(e[i]),n++}function s(e,i,n){let o=r[e];return delete r[e],r[i]=o,a[o].geometry[0].pop(),a[o].geometry[0]=a[o].geometry[0].concat(n[0]),o}function l(e,r,n){let o=i[r];return delete i[r],i[e]=o,a[o].geometry[0].shift(),a[o].geometry[0]=n[0].concat(a[o].geometry[0]),o}function h(e,i,r){let a=r?i[0][i[0].length-1]:i[0][0];return`${e}:${a.x}:${a.y}`}for(let u=0;u<e.length;u++){let c=e[u],d=c.geometry,p=c.text?c.text.toString():null;if(!p){o(u);continue}let f=h(p,d),m=h(p,d,!0);if(f in r&&m in i&&r[f]!==i[m]){let e=l(f,m,d),n=s(f,m,a[e].geometry);delete i[f],delete r[m],r[h(p,a[n].geometry,!0)]=n,a[e].geometry=null}else f in r?s(f,m,d):m in i?l(f,m,d):(o(u),i[f]=n-1,r[m]=n-1)}return a.filter(e=>e.geometry)}(this.features)),"hd-road-markup"===o.get("symbol-elevation-reference")){if(this.elevationType="road",i.elevationFeatures)for(let e of(!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map),i.elevationFeatures))this.elevationFeatureIdToIndex.set(e.id,this.elevationFeatures.length),this.elevationFeatures.push(e)}else o.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((e,i)=>
7e.sortKey-i.sortKey)}update(e,i,r,a,n,o,s){this.text.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s),this.icon.programConfigurations.updatePaintArrays(e,i,n,r,a,o,s)}updateRoadElevation(){if("road"!==this.elevationType||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let e=!1;for(let i=0;i<this.symbolInstances.length;i++){let r=this.symbolInstances.get(i);if(65535===r.elevationFeatureIndex)continue;let a=this.elevationFeatures[r.elevationFeatureIndex];if(a){let i=.05+a.pointElevation(new eR(r.tileAnchorX,r.tileAnchorY));r.zOffset!==i&&(e=!0,r.zOffset=i)}}e&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){let e=(e,i,a)=>{(r+=i)>e.length&&e.resize(r);for(let n=-i;n<0;n++)e.emplace(n+r,a)},i=(e,i,r)=>{(a+=i)>e.length&&e.resize(a);for(let n=-i;n<0;n++)e.emplace(n+a,r)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,a=0;for(let r=0;r<this.symbolInstances.length;r++){let a=this.symbolInstances.get(r),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,numIconVertices:s}=a,l=a.zOffset,h=s>0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,l),e(this.text.zOffsetVertexArray,o,l)),h){let{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:r}=a;e>=0&&i(this.icon.zOffsetVertexArray,s,l),r>=0&&i(this.icon.zOffsetVertexArray,a.numVerticalIconVertices,l)}}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(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=cW(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){let r=this.lineVertexArray.length;if(void 0!==e.segment)for(let{x:e,y:r}of i)this.lineVertexArray.emplaceBack(e,r);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=e.indexArray,y=e.layoutVertexArray,x=e.globeExtVertexArray,v=e.segments.prepareSegment(4*i.length,y,g,this.canOverlap?o.sortKey:void 0),b=this.glyphOffsetArray.length,w=v.vertexLength,T=this.allowVerticalPlacement&&s===uY.vertical?Math.PI/2:0,S=o.text&&o.text.sections;for(let a=0;a<i.length;a++){let{tl:n,tr:s,bl:u,br:c,texPrimary:d,texSecondary:b,pixelOffsetTL:w,pixelOffsetBR:M,minFontScaleX:E,minFontScaleY:A,glyphOffset:I,isSDF:C,sectionIndex:P}=i[a],z=v.vertexLength,D=I[1];if(cK(y,h.x,h.y,n.x,D+n.y,d.x,d.y,r,C,w.x,w.y,E,A),cK(y,h.x,h.y,s.x,D+s.y,d.x+d.w,d.y,r,C,M.x,w.y,E,A),cK(y,h.x,h.y,u.x,D+u.y,d.x,d.y+d.h,r,C,w.x,M.y,E,A),cK(y,h.x,h.y,c.x,D+c.y,d.x+d.w,d.y+d.h,r,C,M.x,M.y,E,A),l){let{x:i,y:r,z:a}=l.anchor,[n,o,s]=l.up;cQ(x,i,r,a,n,o,s),cQ(x,i,r,a,n,o,s),cQ(x,i,r,a,n,o,s),cQ(x,i,r,a,n,o,s),c0(e.dynamicLayoutVertexArray,i,r,a,T)}else c0(e.dynamicLayoutVertexArray,h.x,h.y,h.z,T);if(_){let i=b||d;cJ(e.iconTransitioningVertexArray,i.x,i.y),cJ(e.iconTransitioningVertexArray,i.x+i.w,i.y),cJ(e.iconTransitioningVertexArray,i.x,i.y+i.h),cJ(e.iconTransitioningVertexArray,i.x+i.w,i.y+i.h)}g.emplaceBack(z,z+1,z+2),g.emplaceBack(z+1,z+2,z+3),v.vertexLength+=4,v.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),a!==i.length-1&&P===i[a+1].sectionIndex||e.programConfigurations.populatePaintArrays(y.length,o,o.index,{},p,f,m,S&&S[P])}let M=l?l.anchor:h;e.placedSymbolArray.emplaceBack(M.x,M.y,M.z,h.x,h.y,b,this.glyphOffsetArray.length-b,w,u,c,h.segment,r?r[0]:0,r?r[1]:0,a[0],a[1],s,0,!1,0,d,0)}_commitLayoutVertex(e,i,r,a,n,o,s){e.emplaceBack(i,r,a,n,o,Math.round(s.x),Math.round(s.y))}_addCollisionDebugVertices(e,i,r,a,n,o,s){let l=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),h=l.vertexLength,u=s.tileAnchorX,c=s.tileAnchorY;for(let e=0;e<4;e++)r.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,i,e.padding,s.zOffset),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eR(e.x1,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eR(e.x2,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eR(e.x2,e.y2)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eR(e.x1,e.y2)),l.vertexLength+=4;let d=r.indexArray;d.emplaceBack(h,h+1),d.emplaceBack(h+1,h+2),d.emplaceBack(h+2,h+3),d.emplaceBack(h+3,h),l.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,r,a,n,o){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceTextSize(e,o,i,s);this._addCollisionDebugVertices(a,n,this.textCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(e,i,r,a,n,o){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceIconSize(e,i,o.placedIconSymbolIndex);this._addCollisionDebugVertices(a,n,this.iconCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,o)}}generateCollisionDebugBuffers(e,i,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new c2(n6,uR.members,n4),this.iconCollisionBox=new c2(n6,uR.members,n4);let a=uB(this.iconSizeData,e),n=uB(this.textSizeData,e,r);for(let r=0;r<this.symbolInstances.length;r++){let o=this.symbolInstances.get(r);this._addTextDebugCollisionBoxes(n,e,i,o.textBoxStartIndex,o.textBoxEndIndex,o),this._addTextDebugCollisionBoxes(n,e,i,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._addIconDebugCollisionBoxes(a,e,i,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._addIconDebugCollisionBoxes(a,e,i,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}}getSymbolInstanceTextSize(e,i,r,a){let n=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),o=uF(this.textSizeData,e,n)/24;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,i,r){let a=this.icon.placedSymbolArray.get(r),n=uF(this.iconSizeData,e,a);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,i,r,a){e.emplaceBack(i,-r,-r,a),e.emplaceBack(i,r,-r,a),e.emplaceBack(i,r,r,a),e.emplaceBack(i,-r,r,a)}_updateTextDebugCollisionBoxes(e,i,r,a,n,o,s){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceTextSize(e,o,i,s);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,a.padding,o.zOffset)}}_updateIconDebugCollisionBoxes(e,i,r,a,n,o,s){for(let s=a;s<n;s++){let a=r.get(s),n=this.getSymbolInstanceIconSize(e,i,o.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,a.padding,o.zOffset)}}updateCollisionDebugBuffers(e,i,r,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let n=uB(this.iconSizeData,e,a),o=uB(this.textSizeData,e,r);for(let s=0;s<this.symbolInstances.length;s++){let l=this.symbolInstances.get(s);this._updateTextDebugCollisionBoxes(o,e,i,l.textBoxStartIndex,l.textBoxEndIndex,l,r),this._updateTextDebugCollisionBoxes(o,e,i,l.verticalTextBoxStartIndex,l.verticalTextBoxEndIndex,l,r),this._updateIconDebugCollisionBoxes(n,e,i,l.iconBoxStartIndex,l.iconBoxEndIndex,l,a),this._updateIconDebugCollisionBoxes(n,e,i,l.verticalIconBoxStartIndex,l.verticalIconBoxEndIndex,l,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,r,a,n,o,s,l,h){let u={};if(i<r){let{x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(i);u.textBox={x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.textFeatureIndex=f}if(a<n){let{x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(a);u.verticalTextBox={x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.verticalTextFeatureIndex=f}
7if(o<s){let{x1:i,y1:r,x2:a,y2:n,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(o);u.iconBox={x1:i,y1:r,x2:a,y2:n,padding:s,projectedAnchorX:l,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.iconFeatureIndex=f}if(l<h){let{x1:i,y1:r,x2:a,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p,featureIndex:f}=e.get(l);u.verticalIconBox={x1:i,y1:r,x2:a,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:h,projectedAnchorZ:c,tileAnchorX:d,tileAnchorY:p},u.verticalIconFeatureIndex=f}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){let r=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){let r=e.placedSymbolArray.get(i),a=r.vertexStartIndex+4*r.numGlyphs;for(let i=r.vertexStartIndex;i<a;i+=4)e.indexArray.emplaceBack(i,i+1,i+2),e.indexArray.emplaceBack(i+1,i+2,i+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let i=Math.sin(e),r=Math.cos(e),a=[],n=[],o=[];for(let e=0;e<this.symbolInstances.length;++e){o.push(e);let s=this.symbolInstances.get(e);a.push(0|Math.round(i*s.tileAnchorX+r*s.tileAnchorY)),n.push(s.featureIndex)}return o.sort((e,i)=>a[e]-a[i]||n[i]-n[e]),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===i?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let i of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let e=this.symbolInstances.get(i);this.featureSortOrder.push(e.featureIndex);let{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:l}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),a>=0&&a!==r&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}aT(c3,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),c3.addDynamicAttributes=c0;class c4{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:t0,this.defaultValue=e}evaluate(e){if(e.formattedSection){let i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}aT(c4,"FormatSectionOverride",{omit:["defaultValue"]});let c5=()=>P||(P={layout:I||(I=new nv({"symbol-placement":new ng(nb.layout_symbol["symbol-placement"]),"symbol-spacing":new ng(nb.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ng(nb.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ny(nb.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ng(nb.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new ng(nb.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new ng(nb.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new ng(nb.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new ng(nb.layout_symbol["icon-ignore-placement"]),"icon-optional":new ng(nb.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ng(nb.layout_symbol["icon-rotation-alignment"]),"icon-size":new ny(nb.layout_symbol["icon-size"]),"icon-size-scale-range":new ng(nb.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new ny(nb.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ny(nb.layout_symbol["icon-text-fit-padding"]),"icon-image":new ny(nb.layout_symbol["icon-image"]),"icon-rotate":new ny(nb.layout_symbol["icon-rotate"]),"icon-padding":new ng(nb.layout_symbol["icon-padding"]),"icon-keep-upright":new ng(nb.layout_symbol["icon-keep-upright"]),"icon-offset":new ny(nb.layout_symbol["icon-offset"]),"icon-anchor":new ny(nb.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ng(nb.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ng(nb.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ng(nb.layout_symbol["text-rotation-alignment"]),"text-field":new ny(nb.layout_symbol["text-field"]),"text-font":new ny(nb.layout_symbol["text-font"]),"text-size":new ny(nb.layout_symbol["text-size"]),"text-size-scale-range":new ng(nb.layout_symbol["text-size-scale-range"]),"text-max-width":new ny(nb.layout_symbol["text-max-width"]),"text-line-height":new ny(nb.layout_symbol["text-line-height"]),"text-letter-spacing":new ny(nb.layout_symbol["text-letter-spacing"]),"text-justify":new ny(nb.layout_symbol["text-justify"]),"text-radial-offset":new ny(nb.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ng(nb.layout_symbol["text-variable-anchor"]),"text-anchor":new ny(nb.layout_symbol["text-anchor"]),"text-max-angle":new ng(nb.layout_symbol["text-max-angle"]),"text-writing-mode":new ng(nb.layout_symbol["text-writing-mode"]),"text-rotate":new ny(nb.layout_symbol["text-rotate"]),"text-padding":new ng(nb.layout_symbol["text-padding"]),"text-keep-upright":new ng(nb.layout_symbol["text-keep-upright"]),"text-transform":new ny(nb.layout_symbol["text-transform"]),"text-offset":new ny(nb.layout_symbol["text-offset"]),"text-allow-overlap":new ng(nb.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new ng(nb.layout_symbol["text-ignore-placement"]),"text-optional":new ng(nb.layout_symbol["text-optional"]),visibility:new ng(nb.layout_symbol.visibility)})),paint:C||(C=new nv({"icon-opacity":new ny(nb.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new ny(nb.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new ny(nb.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new ny(nb.paint_symbol["text-emissive-strength"]),"icon-color":new ny(nb.paint_symbol["icon-color"]),"icon-halo-color":new ny(nb.paint_symbol["icon-halo-color"]),"icon-halo-width":new ny(nb.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ny(nb.paint_symbol["icon-halo-blur"]),"icon-translate":new ng(nb.paint_symbol["icon-translate"]),"icon-translate-anchor":new ng(nb.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new ny(nb.paint_symbol["icon-image-cross-fade"]),"text-opacity":new ny(nb.paint_symbol["text-opacity"]),"text-occlusion-opacity":new ny(nb.paint_symbol["text-occlusion-opacity"]),"text-color":new ny(nb.paint_symbol["text-color"],{runtimeType:t4,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new ny(nb.paint_symbol["text-halo-color"]),"text-halo-width":new ny(nb.paint_symbol["text-halo-width"]),"text-halo-blur":new ny(nb.paint_symbol["text-halo-blur"]),"text-translate":new ng(nb.paint_symbol["text-translate"]),"text-translate-anchor":new ng(nb.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new ng(nb.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new ng(nb.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new ng(nb.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new ng(nb.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new ny(nb.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))});class c6 extends nk{constructor(e,i,r,a){super(e,c5(),i,r,a),this._colorAdjustmentMatrix=eP.mat4.identity([]),this.hasInitialOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),"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 r=this.layout.get("text-writing-mode");if(r){let e=[];for(let i of r)0>e.indexOf(i)&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,r,a){var n,o;let s,l,h,u,c;return this._saturation===e&&this._contrast===i&&this._brightnessMin===r&&this._brightnessMax===a||(this._colorAdjustmentMatrix=(n=e,o=i,n=te(n),o=e7(o),s=eP.mat4.create(),h=1-2*(l=n/3),u=.5-.5*o,c=a-r,eP.mat4.multiply(s,[c,0,0,0,0,c,0,0,0,0,c,0,r,r,r,1],[o,0,0,0,0,o,0,0,0,0,o,0,u,u,u,1]),eP.mat4.multiply(s,s,[h,l,l,0,l,h,l,0,l,l,h,0,0,0,0,1]),s),this._saturation=e,this._contrast=i,this._brightnessMin=r,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,r,a){var n;let o=this.layout.get(e).evaluate(i,{},r,a),s=this._unevaluatedLayout._values[e];return s.isDataDriven()||ap(s.value)||!o?o:(n=i.properties,o.replace(/{([^{}]+)}/g,(e,i)=>i in n?String(n[i]):""))}createBucket(e){return new c3(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let e of c5().paint.overridableProperties){if(!c6.hasPaintOverride(this.layout,e))continue;let i=this.paint.get(e),r=new ad(new c4(i),i.property.specification,this.scope,this.options),a=null;a="constant"===i.value.kind||"source"===i.value.kind?new am("source",r):new a_("composite",r,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new nm(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&c6.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){let r=e.get("text-field"),a=c5().paint.properties[i],n=!1,o=e=>{for(let i of e)if(a.overrides&&a.overrides.hasOverride(i))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof ih)o(r.value.value.sections);else if("source"===r.value.kind){let e=i=>{n||(i instanceof ig&&im(i.value)===t9?o(i.value.sections):i instanceof ib?o(i.sections):i.eachChild(e))},i=r.value;i._styleExpression&&e(i._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,r){return{config:new oQ(this,{zoom:i,lut:r}),overrideFog:!1}}}var c8=nV([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function c9(e){switch(e){case WebGL2RenderingContext.RGBA8: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(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class de{constructor(e,i,r,a){this.context=e,this.format=r,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){let r=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:o}=n,{x:s,y:l}=i&&i.position?i.position:{x:0,y:0},h=s+r,u=l+a;this.size&&(this.size[0]!==h||this.size[1]!==u)&&(o.bindTexture(o.TEXTURE_2D,null),o.deleteTexture(this.texture),this.texture=o.createTexture(),this.size=null),o.bindTexture(o.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA8&&(!i||!1!==i.premultiply));let c=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&h>0&&u>0){let e=this.useMipmap?Math.floor(Math.log2(Math.max(h,u)))+1:1;o.texStorage2D(o.TEXTURE_2D,e,this.format,h,u),this.size=[h,u]}if(this.size)if(c)o.texSubImage2D(o.TEXTURE_2D,0,s,l,c9(this.format),c7(this.format),e);else{let i=e.data;i&&o.texSubImage2D(o.TEXTURE_2D,0,s,l,r,a,c9(this.format),c7(this.format),i)}this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}bind(e,i,r=!1){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!r?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,r,a){let{context:n}=this,{gl:o}=n;
7o.bindTexture(o.TEXTURE_2D,this.texture),i!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),this.wrapS=r),a!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,a),this.wrapT=a)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class dt{constructor(e,i){this.context=e,this.texture=i}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function di(e,i,r,a,n,o,s,l){let h=[e,i,1,r,a,1,n,o,1],u=[s,l,1],c=eP.mat3.adjoint([],h),[d,p,f]=eP.vec3.transformMat3(u,u,c);return eP.mat3.multiply(h,h,[d,0,0,0,p,0,0,0,f])}function dr(e,i,r,a,n,o,s,l){let h,u,c,d=(h=di(0,0,1,0,1,1,0,1),u=di(e,i,r,a,n,o,s,l),c=eP.mat3.adjoint([],h),eP.mat3.multiply(u,u,c));return[d[2]/d[8]/8192,d[5]/d[8]/8192]}function da(e){return[e[0],Math.min(Math.max(e[1],-85.051129),85.051129)]}class dn extends tV{constructor(e,i,r,a){super(),this.id=e,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){(this._loaded=i||!1,this.fire(new tk("dataloading",{dataType:"source"})),this.url=this.options.url,this.url)?this._imageRequest=tI(this.map._requestManager.transformRequest(this.url,tw.Image),(i,r)=>{this._imageRequest=null,this._loaded=!0,i?this.fire(new tF(i)):r&&(this.image=r instanceof HTMLImageElement?tn.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())}):(e&&(this.coordinates=e),this._loaded=!0,this._finishLoading())}loaded(){return this._loaded}updateImage(e){return e.url&&(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded)),this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new dt(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new tk("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof dt||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],r=e[0][1];for(let a of e)a[1]>r&&(r=a[1]),a[1]<i&&(i=a[1]);let a=(r+i)/2;if(a>85.051129?this.onNorthPole=!0:a<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){let i=e.map(sp.fromLngLat);this.tileID=function(e){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let o of e)i=Math.min(i,o.x),r=Math.min(r,o.y),a=Math.max(a,o.x),n=Math.max(n,o.y);let o=Math.max(0,Math.floor(-Math.log(Math.max(a-i,n-r))/Math.LN2)),s=Math.pow(2,o),l=Math.floor((i+a)/2*s);return l>1&&(l-=1),new sN(o,l,Math.floor((r+n)/2*s))}(i),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new tk("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){var i,r,a,n,o,s,l,h,u;let c,d,p,f,m,_,g,y,x,v,b,w;for(let e in this.tiles){let i=this.tiles[e];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;let T=cP(new sN(0,0,0),this.map.transform.projection),S=[T.projection.project(this.coordinates[0][0],this.coordinates[0][1]),T.projection.project(this.coordinates[1][0],this.coordinates[1][1]),T.projection.project(this.coordinates[2][0],this.coordinates[2][1]),T.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(c=S[1].x-S[0].x,d=S[1].y-S[0].y,p=S[2].x-S[1].x,f=S[2].y-S[1].y,m=S[3].x-S[2].x,_=S[3].y-S[2].y,g=S[0].x-S[3].x,y=S[0].y-S[3].y,x=c*f-p*d,v=p*_-m*f,b
7=m*y-g*_,w=g*d-c*y,(!(x>0)||!(v>0)||!(b>0)||!(w>0))&&(!(x<0)||!(v<0)||!(b<0)||!(w<0)))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let M=cP(this.tileID,this.map.transform.projection),[E,A,I,C]=this.coordinates.map(e=>{let i=M.projection.project(e[0],e[1]);return cz(M,i)._round()});this.perspectiveTransform=dr(E.x,E.y,A.x,A.y,I.x,I.y,C.x,C.y);let P=this._boundsArray=new nq;P.emplaceBack(E.x,E.y,0,0),P.emplaceBack(A.x,A.y,8192,0),P.emplaceBack(C.x,C.y,0,8192),P.emplaceBack(I.x,I.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(P,c8.members),this.boundsSegments=oI.simpleSegment(0,0,4,2);let z=[],[D,R,L,O]=function(e){let i=e[0][0],r=i,a=e[0][1],n=a;for(let o=1;o<e.length;o++)e[o][0]<i?i=e[o][0]:e[o][0]>r&&(r=e[o][0]),e[o][1]<a?a=e[o][1]:e[o][1]>n&&(n=e[o][1]);return[i,a,r-i,n-a]}([da((i=this.coordinates)[0]),da(i[1]),da(i[2]),da(i[3])]);{let i,c,d,p=new nq,[f,m,_,g]=function(e){let i=e[0].x,r=i,a=e[0].y,n=a;for(let o=1;o<e.length;o++)e[o].x<i?i=e[o].x:e[o].x>r&&(r=e[o].x),e[o].y<a?a=e[o].y:e[o].y>n&&(n=e[o].y);return[i,a,r-i,n-a]}(S),y=e=>[(e.x-f)/_,(e.y-m)/g],[x,v,b,w]=S.map(y),M=(r=x[0],a=x[1],n=v[0],o=v[1],s=b[0],l=b[1],h=w[0],u=w[1],i=di(0,0,1,0,1,1,0,1),c=di(r,a,n,o,s,l,h,u),d=eP.mat3.adjoint([],c),eP.mat3.multiply(i,i,d));this.elevatedGlobePerspectiveTransform=dr(x[0],x[1],v[0],v[1],b[0],b[1],w[0],w[1]);let E=(e,i)=>{z.push(e.lng);let r=Math.round((e.lng-D)/L*8192),a=Math.round((e.lat-R)/O*8192),n=y(i),o=eP.vec3.transformMat3([],[n[0],n[1],1],M),s=Math.round(o[0]/o[2]*8192),l=Math.round(o[1]/o[2]*8192);p.emplaceBack(r,a,s,l)},A=S[3].x-S[0].x,I=S[3].y-S[0].y,C=S[2].x-S[1].x,P=S[2].y-S[1].y;for(let e=0;e<65;e++){let i=e/64,r=[S[0].x+i*A,S[0].y+i*I],a=[S[1].x+i*C,S[1].y+i*P],n=a[0]-r[0],o=a[1]-r[1];for(let e=0;e<65;e++){let i=e/64,a={x:r[0]+n*i,y:r[1]+o*i,z:0};E(T.projection.unproject(a.x,a.y),a)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(p,c8.members)}{this.maxLongitudeTriangleSize=0;let i=[],r=new n7,a=(e,a,n)=>{r.emplaceBack(e,a,n);let o=z[e],s=z[a],l=z[n],h=Math.min(Math.min(o,s),l),u=Math.max(Math.max(o,s),l)-h;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),i.push(h+u/2)};for(let e=0;e<64;e++)for(let i=0;i<64;i++){let r=65*e+i,n=r+1,o=r+65,s=o+1;a(r,o,n),a(n,o,s)}[i,r]=function(e,i){let r=Array.from({length:e.length},(e,i)=>i);r.sort((i,r)=>e[i]-e[r]);let a=[],n=new n7;for(let o=0;o<r.length;o++){let s=r[o];a.push(e[s]);let l=3*s,h=l+1;n.emplaceBack(i.uint16[l],i.uint16[h],i.uint16[h+1])}return[a,n]}(i,r),this.elevatedGlobeTrianglesCenterLongitudes=i,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(r)}this.elevatedGlobeSegments=oI.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,L/8192,0,O/8192,0,0,R,D,0])}prepare(){let e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;let i=this.map.painter.context,r=i.gl;!this._dirty||this.texture instanceof dt||(this.texture?this.texture.update(this.image):(this.texture=new de(i,this.image,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored",i(null)}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){var i;let r=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!r)return null;let a=this.elevatedGlobeTrianglesCenterLongitudes,n=(i=e+180)+360*Math.round((a[0]-i)/360),o=new oI,s=(e,i)=>{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:r.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},l=.51*this.maxLongitudeTriangleSize;if(Math.abs(a[0]-n)<=l){let e=e9(a,0,a.length,n+l);return e===a.length||s(e,e8(a,e+1,a.length,n+360-l)-e),o}n<a[0]&&(n+=360);let h=e8(a,0,a.length,n-l);if(h===a.length)return s(0,a.length),o;s(0,h-0);let u=e9(a,h+1,a.length,n+l);return u!==a.length&&s(u,a.length-u),o}}class ds extends nk{constructor(e,i,r,a){super(e,{layout:R||(R=new nv({visibility:new ng(nb.layout_raster.visibility)})),paint:L||(L=new nv({"raster-opacity":new ng(nb.paint_raster["raster-opacity"]),"raster-color":new nx(nb.paint_raster["raster-color"]),"raster-color-mix":ne
7w ng(nb.paint_raster["raster-color-mix"]),"raster-color-range":new ng(nb.paint_raster["raster-color-range"]),"raster-hue-rotate":new ng(nb.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ng(nb.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ng(nb.paint_raster["raster-brightness-max"]),"raster-saturation":new ng(nb.paint_raster["raster-saturation"]),"raster-contrast":new ng(nb.paint_raster["raster-contrast"]),"raster-resampling":new ng(nb.paint_raster["raster-resampling"]),"raster-fade-duration":new ng(nb.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new ng(nb.paint_raster["raster-emissive-strength"]),"raster-array-band":new ng(nb.paint_raster["raster-array-band"]),"raster-elevation":new ng(nb.paint_raster["raster-elevation"]),"raster-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof dn&&(e._source.onNorthPole||e._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;let i=this._transitionablePaint._values["raster-color"].value.expression,[r,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(a)||r===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=lC({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[r,a])}}class dl extends nk{constructor(e,i,r,a){super(e,{layout:O||(O=new nv({visibility:new ng(nb["layout_raster-particle"].visibility)})),paint:k||(k=new nv({"raster-particle-array-band":new ng(nb["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new ng(nb["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new nx(nb["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new ng(nb["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new ng(nb["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new ng(nb["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new ng(nb["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new ng(nb["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._updateColorRamp(),this.lastInvalidatedAt=tn.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;let e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=lC({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=tn.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class dh extends nk{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function du(e,i,r){let a=[0,0,1],n=eP.quat.identity([]);return eP.quat.rotateY(n,n,r?-(e*eO)+Math.PI:e*eO),eP.quat.rotateX(n,n,-(i*eO)),eP.vec3.transformQuat(a,a,n),eP.vec3.normalize(a,a)}function dc(e,i){var r,a;let n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S=dp(e.projection,e.zoom,e.width,e.height),M=(r=e.projection,a=e.center,n=new st(a.lng-180*
7df,a.lat),o=new st(a.lng+180*df,a.lat),s=r.project(n.lng,n.lat),h=-Math.atan2((l=r.project(o.lng,o.lat)).y-s.y,l.x-s.x),(u=sp.fromLngLat(a)).y=eU(u.y,-1+df,1-df),c=u.toLngLat(),d=r.project(c.lng,c.lat),p=sp.fromLngLat(c),p.x+=df,f=p.toLngLat(),_=d_((m=r.project(f.lng,f.lat)).x-d.x,m.y-d.y,h),g=sp.fromLngLat(c),g.y+=df,y=g.toLngLat(),v=d_((x=r.project(y.lng,y.lat)).x-d.x,x.y-d.y,h),b=Math.abs(_.x)/Math.abs(v.y),w=eP.mat4.identity([]),eP.mat4.rotateZ(w,w,-h*(1-(i?0:S))),T=eP.mat4.identity([]),eP.mat4.scale(T,T,[1,1-(1-b)*S,1]),T[4]=-v.x/v.y*S,eP.mat4.rotateZ(T,T,h),eP.mat4.multiply(T,w,T),T),E=dd(e);return eP.mat4.scale(M,M,[E,E,1]),M}function dd(e){let i=e.projection,r=dp(e.projection,e.zoom,e.width,e.height);return Math.pow(2,dm(i,e.center)*r+(1-r)*dm(i,st.convert(i.center)))}function dp(e,i,r,a,n=1/0){let o=e.range;if(!o)return 0;let s=Math.log(Math.min(n,Math.max(r,a))/1024)/Math.LN2;return ej(o[0]+s,o[1]+s,i)}let df=1/4e4;function dm(e,i){let r=eU(i.lat,-85.051129,85.051129),a=new st(i.lng-180*df,r),n=new st(i.lng+180*df,r),o=e.project(a.lng,r),s=e.project(n.lng,r),l=sp.fromLngLat(a),h=sp.fromLngLat(n),u=s.x-o.x,c=s.y-o.y,d=h.x-l.x,p=h.y-l.y;return Math.log(Math.sqrt((d*d+p*p)/(u*u+c*c)))/Math.LN2}function d_(e,i,r){let a=Math.cos(r),n=Math.sin(r);return{x:e*a-i*n,y:e*n+i*a}}function dg(e,i,r){eP.mat4.identity(e),eP.mat4.rotateZ(e,e,i[2]*eO),eP.mat4.rotateX(e,e,i[0]*eO),eP.mat4.rotateY(e,e,i[1]*eO),eP.mat4.scale(e,e,r),eP.mat4.multiply(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function dy(e,i,r,a,n,o,s,l){let h=[r[0]-i[0],r[1]-i[1],0],u=[a[0]-i[0],a[1]-i[1],0];if(1e-12>eP.vec3.length(h)||1e-12>eP.vec3.length(u))return eP.quat.identity(e);let c=eP.vec3.cross([],h,u);return eP.vec3.normalize(c,c),eP.vec3.subtract(u,a,i),h[2]=(o-n)*l,u[2]=(s-n)*l,eP.vec3.cross(h,h,u),eP.vec3.normalize(h,h),eP.quat.rotationTo(e,c,h)}function dx(e,i,r=!1){let a=lc(i.zoom),n=function(e,i,r){let a,n,o,s=i.worldSize,l=[e[12],e[13],e[14]],h=ss(l[1]/s),u=so(l[0]/s),c=eP.mat4.identity([]),d=1/sr(h)*s,p=1/sr(0)*s*su(h,i.zoom),f=1/ll(s),m=p*f;if(r){let e=dp(i.projection,i.zoom,i.width,i.height,1024);m=f*i.projection.pixelSpaceConversion(i.center.lat,s,e)}let _=o7(h,u);eP.vec3.add(_,_,eP.vec3.scale([],eP.vec3.normalize([],_),d*m*l[2]));let g=(a=[_[0],_[1],_[2]],n=[0,1,0],o=eP.vec3.cross([],n,a),eP.vec3.cross(n,a,o),0===eP.vec3.squaredLength(n)&&(n=[0,1,0],eP.vec3.cross(o,a,n)),eP.vec3.normalize(o,o),eP.vec3.normalize(n,n),eP.vec3.normalize(a,a),[o[0],o[1],o[2],0,n[0],n[1],n[2],0,a[0],a[1],a[2],0,_[0],_[1],_[2],1]);eP.mat4.scale(c,c,[m,m,m*d]),eP.mat4.translate(c,c,[-l[0],-l[1],-l[2]]);let y=eP.mat4.multiply([],i.globeMatrix,g);return eP.mat4.multiply(y,y,c),eP.mat4.multiply(y,y,e),y}(e,i,r);if(a>0){let r,o,s,l,h,u,c,d,p,f=(r=i.worldSize,o=1/sr(0)*r*su(i.center.lat,i.zoom)/ll(r),s=1/sr(i.center.lat)*r,l=eP.mat4.identity([]),eP.mat4.rotateY(l,l,i.center.lng*eO),eP.mat4.rotateX(l,l,i.center.lat*eO),eP.mat4.translate(l,l,[0,0,o5]),eP.mat4.scale(l,l,[o,o,o*s]),eP.mat4.translate(l,l,[i.point.x-.5*r,i.point.y-.5*r,0]),eP.mat4.multiply(l,l,e),eP.mat4.multiply(l,i.globeMatrix,l));return u=(h=(e,i,r)=>{let a=eP.vec3.length(e),n=eP.vec3.length(i),o=s9(e,i,r);return eP.vec3.scale(o,o,1/eP.vec3.length(o)*t$(a,n,r))})([n[0],n[1],n[2]],[f[0],f[1],f[2]],a),c=h([n[4],n[5],n[6]],[f[4],f[5],f[6]],a),d=h([n[8],n[9],n[10]],[f[8],f[9],f[10]],a),p=s9([n[12],n[13],n[14]],[f[12],f[13],f[14]],a),[u[0],u[1],u[2],0,c[0],c[1],c[2],0,d[0],d[1],d[2],0,p[0],p[1],p[2],1]}return n}function dv(e,i,r,a){let n,o=s1.projectAabbCorners(a,r),s=Number.MAX_VALUE,l=-1;for(let e=0;e<o.length;++e){let r=o[e];r[0]=(.5*r[0]+.5)*i.width,r[1]=(.5-.5*r[1])*i.height,r[2]<s&&(l=e,s=r[2])}let h=e=>new eR(o[e][0],o[e][1]);switch(l){case 0:case 6:n=[h(1),h(5),h(4),h(7),h(3),h(2),h(1)];break;case 1:case 7:n=[h(0),h(4),h(5),h(6),h(2),h(3),h(0)];break;case 3:case 5:n=[h(1),h(0),h(4),h(7),h(6),h(2),h(1)];break;default:n=[h(1),h(5),h(6),h(7),h(3),h(0),h(1)]}if(sb(e,n))return s}let db=nV([{name:"a_pos_3f",components:3,type:"Float32"}]),dw=nV([{name:"a_color_3f",components:3,type:"Float32"}]),dT=nV([{name:"a_color_4f",components:4,type:"Float32"}]),dS=nV([{name:"a_uv_2f",components:2,type:"Float32"}]),dM=nV([{name:"a_normal_3f",components:3,type:"Float32"}]),dE=nV([{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"}]),dA=nV([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),dI={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class dC{constructor(e,i,r,a){this.message=(e?`${e}: `:"")+r,a&&(this.identifier=a),null!=i&&i.__line__&&(this.line=i.__line__)}}function dP(e,i){let r=-1===e.indexOf("://");try{return new URL(e,r&&i?"http://example.com":void 0),!0}catch(e){return!1}}class dz{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class dD{constructor(){this.instancedDataArray=new oh,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class dR{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.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?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}updateFootprints(e,i){}populate(e,i,r,a){this.tileToMeter=sd(r);let n=this.layers[0]._featureFilter.needGeometry;for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of(this.lookup=new Uint8Array(this.lookupDim*this.lookupDim),e)){let e=null!=s?s:o.properties&&o.properties.hasOwnProperty("id")?o.properties.id:void 0,u=sg(o,n);if(!this.layers[0]._featureFilter.filter(new nl(this.zoom),u,r))continue;let c={id:e,sourceLayerIndex:h,index:l,geometry:n?u.geometry:s_(o,r,a),properties:o.properties,type:o.type,patterns:{}},d=this.addFeature(c,c.geometry,u);d&&i.featureIndex.insert(o,c.geometry,l,h,this.index,this.instancesPerModel[d].instancedDataArray.length,256)}this.lookup=null}update(e,i,r,a){for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i in e)r.idToFeaturesIndex.hasOwnProperty(i)&&(this.evaluate(r.features[r.idToFeaturesIndex[i]],e[i],r,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i of r.features){let a=this.layers[0],n=i.feature,o=this.canonical,s=a.paint.get("model-rotation").evaluate(n,{},o),l=a.paint.get("model-scale").evaluate(n,{},o),h=a.paint.get("model-translation").evaluate(n,{},o);eP.vec3.exactEquals(i.rotation,s)&&eP.vec3.exactEquals(i.scale,l)&&eP.vec3.exactEquals(i.translation,h)||(this.evaluate(i,i.featureStates,r,!0),e=!0)}}return e}updateReplacement(e,i,r,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;let n=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(hB(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(let i in this.instancesPerModel){let n=this.instancesPerModel[i],s=n.instancedDataArray;for(let i of n.features){let n=i.instancedDataOffset,l=i.instancedDataCount;for(let i=0;i<l;i++){let l=16*(i+n),h=s.float32[l+0],u=h>8192,c=Math.floor(h=u?h-8192:h),d=s.float32[l+1],p=!1;for(let i of this.activeReplacements)if(!hL(i,r,dI.Model,a)&&!(i.min.x>c||c>i.max.x||i.min.y>d||d>i.max.y)&&(p=hj(hU(c,d,e.canonical,i.footprintTileId.canonical),i.footprint)))break;s.float32[l]=p?h+8192:h,o=o||p!==u}}}return o}isEmpty(){for(let e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=e.createVertexBuffer(r.
7instancedDataArray,dE.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(let e in this.instancesPerModel){let i=this.instancesPerModel[e];0!==i.instancedDataArray.length&&i.instancedDataBuffer&&i.instancedDataBuffer.destroy()}let e=this.layers[0].modelManager;if(e&&this.modelUris)for(let i of this.modelUris)e.removeModel(i,"")}addFeature(e,i,r){let a=this.layers[0],n=a.layout.get("model-id").evaluate(r,{},this.canonical);if(!n)return e0(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),n;dP(n,!1)&&(this.modelUris.includes(n)||this.modelUris.push(n)),this.instancesPerModel[n]||(this.instancesPerModel[n]=new dD);let o=this.instancesPerModel[n],s=o.instancedDataArray,l=new dz(r,s.length);for(let e of i)for(let i of e){if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)continue;let e=(this.lookupDim-1)/8192,r=this.lookupDim*(i.y*e|0)+i.x*e|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}this.instanceCount++;let a=s.length;s.resize(a+1),o.instancesEvaluatedElevation.push(0),s.float32[16*a]=i.x,s.float32[16*a+1]=i.y}return l.instancedDataCount=o.instancedDataArray.length-l.instancedDataOffset,l.instancedDataCount>0&&(e.id&&(o.idToFeaturesIndex[e.id]=o.features.length),o.features.push(l),this.evaluate(l,{},o,!1)),n}getModelUris(){return this.modelUris}evaluate(e,i,r,a){let n=this.layers[0],o=e.feature,s=this.canonical,l=e.rotation=n.paint.get("model-rotation").evaluate(o,i,s),h=e.scale=n.paint.get("model-scale").evaluate(o,i,s),u=e.translation=n.paint.get("model-translation").evaluate(o,i,s),c=n.paint.get("model-color").evaluate(o,i,s);c.a=n.paint.get("model-color-mix-intensity").evaluate(o,i,s);let d=[];this.maxVerticalOffset<u[2]&&(this.maxVerticalOffset=u[2]),this.maxScale=Math.max(Math.max(this.maxScale,h[0]),Math.max(h[1],h[2])),dg(d,l,h);let p=Math.round(100*c.a)+c.b/1.05;for(let i=0;i<e.instancedDataCount;++i){let n=e.instancedDataOffset+i,o=16*n,l=r.instancedDataArray.float32,h=0;a&&(h=l[o+6]-r.instancesEvaluatedElevation[n]);let f=0|l[o+1];l[o]=(0|l[o])+c.r/1.05,l[o+1]=f+c.g/1.05,l[o+2]=p,l[o+3]=1/(s.z>10?this.tileToMeter:sd(s,f)),l[o+4]=u[0],l[o+5]=u[1],l[o+6]=u[2]+h,l[o+7]=d[0],l[o+8]=d[1],l[o+9]=d[2],l[o+10]=d[4],l[o+11]=d[5],l[o+12]=d[6],l[o+13]=d[8],l[o+14]=d[9],l[o+15]=d[10],r.instancesEvaluatedElevation[n]=u[2]}}}aT(dR,"ModelBucket",{omit:["layers"]}),aT(dD,"PerModelAttributes"),aT(dz,"ModelFeature");
7let dL={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function dO(e,i,r,a,n,o,s,l,h,u=!1){let c=r.zoom,d=r.project(a),p=su(a.lat,c),f=1/p;eP.mat4.identity(e),eP.mat4.translate(e,e,[d.x+s[0]*f,d.y+s[1]*f,s[2]]);let m=1,_=1,g=r.worldSize;if(u){if("mercator"===r.projection.name){let e=0;r.elevation&&(e=r.elevation.getAtPointOrZero(new sp(d.x/g,d.y/g),0));let i=eP.vec4.transformMat4([],[d.x,d.y,e,1],r.projMatrix)[3]/r.cameraToCenterDistance;m=i,_=i*su(r.center.lat,c)}else if("globe"===r.projection.name){let i=dx(e,r),n=eP.mat4.multiply([],r.projMatrix,i),o=[0,0,0,1];eP.vec4.transformMat4(o,o,n);let s=o[3]/r.cameraToCenterDistance,l=lc(c),h=r.projection.pixelsPerMeter(a.lat,g)*su(a.lat,c),u=r.projection.pixelsPerMeter(r.center.lat,g)*su(r.center.lat,c);m=s/t$(h,sh(r.center.lat),l),_=s*p/h,m*=u,_*=u}}else m=f;eP.mat4.scale(e,e,[m,m,_]);let y=[...e],x=i.orientation,v=[];if(dg(v,[x[0]+n[0],x[1]+n[1],x[2]+n[2]],o),eP.mat4.multiply(e,y,v),l&&r.elevation){let n=0,o=[];if(h&&r.elevation){n=function(e,i,r,a,n){let o=i.elevation;if(!o)return 0;let s=s1.projectAabbCorners(r,a),l=1/sr(n.lat)*i.worldSize,h=function(e,i){let r=[0,0,1],a=[{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 n of a){let a=e[n.corners[0]],o=e[n.corners[1]],s=e[n.corners[2]],l=[o[0]-a[0],o[1]-a[1],i*(o[2]-a[2])],h=eP.vec3.cross(l,l,[s[0]-a[0],s[1]-a[1],i*(s[2]-a[2])]);eP.vec3.normalize(h,h),n.dotProductWithUp=eP.vec3.dot(h,r)}return a.sort((e,i)=>e.dotProductWithUp-i.dotProductWithUp),a[0].corners}(s,l),u=s[h[0]],c=s[h[1]],d=s[h[2]],p=s[h[3]],f=o.getAtPointOrZero(new sp(u[0]/i.worldSize,u[1]/i.worldSize),0),m=o.getAtPointOrZero(new sp(c[0]/i.worldSize,c[1]/i.worldSize),0),_=o.getAtPointOrZero(new sp(d[0]/i.worldSize,d[1]/i.worldSize),0),g=o.getAtPointOrZero(new sp(p[0]/i.worldSize,p[1]/i.worldSize),0),y=(f+g)/2,x=(m+_)/2;return y>x?m<_?dy(e,c,p,u,m,g,f,l):dy(e,d,u,p,_,f,g,l):f<g?dy(e,u,c,d,f,m,_,l):dy(e,p,d,c,g,_,m,l),Math.max(y,x)}(o,r,i.aabb,e,a);let s=eP.mat4.fromQuat([],o),l=eP.mat4.multiply([],s,v);eP.mat4.multiply(e,y,l)}else n=r.elevation.getAtPointOrZero(new sp(d.x/g,d.y/g),0);0!==n&&(e[14]+=n)}}function dk(e,i,r=!1){e.uploaded||(e.gfxTexture=new de(i,e.image,r?i.gl.R8:i.gl.RGBA8,{useMipmap:e.sampler.minFilter>=i.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function dF(e,i,r){if(e.meshes)for(let a of e.meshes)!function(e,i,r){e.indexBuffer=i.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=i.createVertexBuffer(e.vertexArray,db.members,!1,!0),e.normalArray&&(e.normalBuffer=i.createVertexBuffer(e.normalArray,dM.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=i.createVertexBuffer(e.texcoordArray,dS.members,!1,!0)),e.colorArray&&(e.colorBuffer=i.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?dw:dT).members,!1,!0)),e.featureArray&&(e.pbrBuffer=i.createVertexBuffer(e.featureArray,dA.members,!0)),e.segments=oI.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);let a=e.material;a.pbrMetallicRoughness.baseColorTexture&&dk(a.pbrMetallicRoughness.baseColorTexture,i),a.pbrMetallicRoughness.metallicRoughnessTexture&&dk(a.pbrMetallicRoughness.metallicRoughnessTexture,i),a.normalTexture&&dk(a.normalTexture,i),a.occlusionTexture&&dk(a.occlusionTexture,i,r),a.emissionTexture&&dk(a.emissionTexture,i)}(a,i,r);if(e.children)for(let a of e.children)dF(a,i,r)}function dB(e){if(e.meshes)for(let i of e.meshes)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();if(e.children)for(let i of e.children)dB(i)}function dN(e){var i;if(e.meshes)for(let r of e.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.n
7ormalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((i=r.material).pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),i.pbrMetallicRoughness.metallicRoughnessTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),i.normalTexture&&i.normalTexture.gfxTexture&&i.normalTexture.gfxTexture.destroy(),i.emissionTexture&&i.emissionTexture.gfxTexture&&i.emissionTexture.gfxTexture.destroy(),i.occlusionTexture&&i.occlusionTexture.gfxTexture&&i.occlusionTexture.gfxTexture.destroy()));if(e.children)for(let i of e.children)dN(i)}class dV{constructor(e,i,r){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=r}static create(e,i,r){let a=r||e.findDEMTileFor(i);if(!a||!a.dem)return;let n=a.dem,o=a.tileID,s=1<<i.canonical.z-o.canonical.z;return new dV(a,n.dim/8192/s,[(i.canonical.x/s-o.canonical.x)*n.dim,(i.canonical.y/s-o.canonical.y)*n.dim])}tileCoordToPixel(e,i){let r=i*this._scale+this._offset[1];return new eR(Math.floor(e*this._scale+this._offset[0]),Math.floor(r))}getElevationAt(e,i,r,a){let n=e*this._scale+this._offset[0],o=i*this._scale+this._offset[1],s=Math.floor(n),l=Math.floor(o),h=this._dem;return a=!!a,r?t$(t$(h.get(s,l,a),h.get(s,l+1,a),o-l),t$(h.get(s+1,l,a),h.get(s+1,l+1,a),o-l),n-s):h.get(s,l,a)}getElevationAtPixel(e,i,r){return this._dem.get(e,i,!!r)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*(1/sr(e))*this._dem.stride}}let dU=new Float32Array(262144),dj=new Uint8Array(262144),dG=["","wall","door","roof","window","lamp","logo"];class dq{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:function e(i){let r=0;if(i.meshes)for(let e of i.meshes)r=Math.max(r,e.aabb.max[2]);if(i.children)for(let a of i.children)r=Math.max(r,e(a));return r}(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new s1([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0,i=new s1([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(let r of this.node.meshes)this.node.lightMeshIndex!==e&&(r.transformedAabb=s1.applyTransformFast(r.aabb,this.node.matrix),i.encapsulate(r.transformedAabb)),e++;this.aabb=i}return this.aabb}}class dZ{constructor(e,i,r,a,n,o,s){for(const l of(this.id=r,this.layers=e,this.layerIds=this.layers.map(e=>e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=dL.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=dL.HasMapboxMeshFeatures),n&&(this.modelTraits|=dL.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=o,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[],i))this.nodesInfo.push(new dq(l)),function e(i,r,a){if(i.meshes)for(let e of i.meshes){if(e.aabb.min[0]===1/0)continue;let n=s1.applyTransform(e.aabb,i.matrix);a.insert(r,n.min[0],n.min[1],n.max[0],n.max[1])}if(i.children)for(let n of i.children)e(n,r,a)}(l,s.featureIndexArray.length,s.grid),s.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,s.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(let r of this.getNodesInfo()){let a=r.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){let i=0!==Object.keys(e).length;if(i&&!this.stateDependentLayers.length)return;let r=i?this.stateDependentLayers:this.layers;if(!eL(e,this.states))for(let i of r)this.evaluate(i,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;let i=this.getNodesInfo();
7for(let r of i){let i=r.node;this.uploaded?this.updatePbrBuffer(i):dF(i,e,!0)}for(let e of i)dB(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(let r of e.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),i=!0);return i}needsReEvaluation(e,i,r){let a=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;if(!this.uploaded||this.dirty||a.name!==this.projection.name||dH(r.paint.get("model-color").value,o)||dH(r.paint.get("model-color-mix-intensity").value,o)||dH(r.paint.get("model-roughness").value,o)||dH(r.paint.get("model-emissive-strength").value,o)||dH(r.paint.get("model-height-based-emissive-strength-multiplier").value,o)){for(let e of(this.projection=a,this.brightness=n,this.getNodesInfo()))e.state=null;return!0}return!1}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;let r=this.getNodesInfo(),a=this.id.canonical;for(let e of r){let r=e.feature;e.evaluatedScale=i.paint.get("model-scale").evaluate(r,{},a)}}evaluate(e,i){for(let r of this.getNodesInfo()){if(!r.node.meshes)continue;let a=r.feature,n=i&&i[a.id];if(eL(n,r.state))continue;r.state=structuredClone(n);let o=r.node.meshes&&r.node.meshes[0].featureData,s=r.evaluatedColor[2],l=r.evaluatedRMEA[2],h=this.id.canonical;if(r.hasTranslucentParts=!1,o){for(let i=0;i<dG.length;i++){let o=dG[i];o.length&&(a.properties.part=o);let s=e.paint.get("model-color").evaluate(a,n,h).toRenderColor(null),l=e.paint.get("model-color-mix-intensity").evaluate(a,n,h);r.evaluatedColor[i]=[s.r,s.g,s.b,l],r.evaluatedRMEA[i][0]=e.paint.get("model-roughness").evaluate(a,n,h),r.evaluatedRMEA[i][2]=e.paint.get("model-emissive-strength").evaluate(a,n,h),r.evaluatedRMEA[i][3]=s.a,r.emissionHeightBasedParams[i]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(a,n,h),!r.hasTranslucentParts&&s.a<1&&(r.hasTranslucentParts=!0)}delete a.properties.part,function(e,i,r){let a=e.node,n=0,o=r&dL.HasMeshoptCompression;for(let r of a.meshes){if(a.lights&&a.lightMeshIndex===n||!r.featureData)continue;r.featureArray=new ou,r.featureArray.reserve(r.featureData.length);let s=i;for(let i of r.featureData){let n,l=o?65535&i:i>>16&65535,h=o?i>>16&65535:65535&i,u=(15&h)<8?15&h:0,c=e.evaluatedRMEA[u],d=e.evaluatedColor[u],p=e.emissionHeightBasedParams[u];if(s&&2===u&&a.lights&&(n=new ou).resize(10*a.lights.length),function(e,i,r,a,n,o,s,l){let h,u,c,d,p=(61440&i|(61440&i)>>4)>>8,f=(3840&i|(3840&i)>>4)>>4,m=240&i|(240&i)>>4;r[3]>0&&(p=t$(p,255*r[0],r[3]),f=t$(f,255*r[1],r[3]),m=t$(m,255*r[2],r[3]));let _=p<<8|f,g=m<<8|Math.floor(255*a[3]),y=Math.min(Math.round(.5*eU(a[2],0,2)*255),255)<<8|15*a[0]<<4|15*a[1],x=eU(n[0],0,1),v=eU(n[1],0,1),b=eU(n[2],0,1),w=eU(n[3],0,1);if(x!==v&&s!==o&&v!==x){let e=s-o;u=1/(e*(v-x)),c=-(o+e*x)/(e*(v-x)),d=Math.pow(10,eU(n[4],-1,1)),h=255*b<<8|255*w}else h=65535,u=0,c=1,d=1;if(e.emplaceBack(_,g,y,h,u,c,d),l){let e=l.length;l.clear();for(let i=0;i<e;i++)l.emplaceBack(_,g,y,h,u,c,d)}}(r.featureArray,l,d,c,p,r.aabb.min[2],r.aabb.max[2],n),n&&s){s=!1;let e=a.meshes[a.lightMeshIndex];e.featureArray=n,e.featureArray._trim()}}r.featureArray._trim(),n++}}(r,s!==r.evaluatedColor[2]||l!==r.evaluatedRMEA[2],this.modelTraits)}else r.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(a,n,h);r.evaluatedScale=e.paint.get("model-scale").evaluate(a,n,h),this.updatePbrBuffer(r.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,r,a){let n=e.findDEMTileFor(r);if(n&&(n.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;let i=dV.create(e,r,n);if(!i)return;for(let n of(this.modelTraits&dL.HasMapboxMeshFeatures&&this.updateDEM(e,i,r,a),this.getNodesInfo())){let e=n.node;if(!e.footprint||!e.footprint.vertices||!e.footprint.vertices.length)continue;let r=e.footprint.vertices,a=i.getElevationAt(r[0].x,r[0].y,!0,!0);for(let e=1;e<r.length;e++)a=Math.min(a,i.getElevationAt(r[e].x,r[e].y,!0,!0));e.elevation=a}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,r,a){let n=i._dem._modifiedForSources[a];if(void 0===n&&(i._dem._modifiedForSources[a]=[],n=i._dem._modifiedForSources[a]),n.includes(r.canonical))return;let o=i._dem.dim;n.push(r.canonical);let s=!1;for(let e of this.getNodesInfo()){let r=e.node;if(!r.footprint||!r.footprint.grid)continue;let a=r.footprint.grid,n=i.tileCoordToPixel(a.min.x,a.min.y),l=i.tileCoordToPixel(a.max.x,a.max.y),h=Math.min(Math.min(o-l.y,n.x),Math.min(n.y,o-l.x));if(h<0)continue;
7let u=eU(h,2,5),c=Math.max(0,n.x-u),d=Math.max(0,n.y-u),p=Math.min(l.x+u,o-1),f=Math.min(l.y+u,o-1);for(let e=d;e<=f;++e)for(let i=c;i<=p;++i)dj[e*o+i]=255;let m=0,_=0;for(let e=0;e<a.cellsY;++e)for(let r=0;r<a.cellsX;++r){if(!a.cells[e*a.cellsX+r])continue;let n=i.tileCoordToPixel(a.min.x+r/a.xScale,a.min.y+e/a.yScale),s=i.tileCoordToPixel(a.min.x+(r+1)/a.xScale,a.min.y+(e+1)/a.yScale);for(let e=n.y;e<=Math.min(s.y+1,o-1);++e)for(let r=n.x;r<=Math.min(s.x+1,o-1);++r)255===dj[e*o+r]&&(dj[e*o+r]=0,m+=i.getElevationAtPixel(r,e),_++)}let g=m/_;c=Math.max(1,n.x-u),d=Math.max(1,n.y-u),p=Math.min(l.x+u,o-2),f=Math.min(l.y+u,o-2),s=!0;for(let e=d;e<=f;++e)for(let r=c;r<=p;++r)0===dj[e*o+r]&&(dU[e*o+r]=i._dem.set(r,e,g));for(let e=1;e<u;++e){c=Math.max(1,n.x-e),d=Math.max(1,n.y-e),p=Math.min(l.x+e,o-2),f=Math.min(l.y+e,o-2);for(let r=d;r<=f;++r)for(let a=c;a<=p;++a){let n=r*o+a;if(255===dj[n]){let s=0,l=0,h=-1,c=-1;for(let i=-1;i<=1;++i)for(let n=-1;n<=1;++n){let u=(r+i)*o+a+n;if(dj[u]>=e)continue;let d=dU[u],p=Math.abs(d);p>l&&(s=d,l=p,h=n,c=i)}if(l>.1){let o=1-(e+.5*Math.abs(h*c))/u,l=i._dem.get(a,r)+s*o,d=i._dem.get(a+h,r+c),p=i._dem.get(a-h,r-c,!0);(l-d)*(l-p)>0&&(l=(d+p)/2),dU[n]=i._dem.set(a,r,l),dj[n]=e}}}}}s&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=tn.now())}setFilter(e){this.filter=e?nM(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new nl(this.id.overscaledZ),e.feature,this.id.canonical)):this.nodesInfo}destroy(){for(let e of this.getNodesInfo())dB(e.node),dN(e.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped()),a=this.getNodesInfo();for(let e=0;e<this.nodesInfo.length;e++){let i=a[e].node;a[e].hiddenByReplacement=!!i.footprint&&!r.find(e=>e.footprint===i.footprint)}}getHeightAtTileCoord(e,i){let r=this.getNodesInfo(),a=[],n=[0,0,0],o=eP.mat4.identity([]);for(let s=0;s<this.nodesInfo.length;s++){let l=r[s],h=l.node.meshes[0],u=h.transformedAabb;if(e<u.min[0]||i<u.min[1]||e>u.max[0]||i>u.max[1])continue;if(!0===l.node.hidden)return{height:1/0,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]};eP.mat4.invert(o,l.node.matrix),n[0]=e,n[1]=i,eP.vec3.transformMat4(n,n,o);let c=(n[0]-h.aabb.min[0])/(h.aabb.max[0]-h.aabb.min[0])*64|0,d=64*Math.min(63,(n[1]-h.aabb.min[1])/(h.aabb.max[1]-h.aabb.min[1])*64|0)+Math.min(63,c),p=h.heightmap[d];if(!(p<0&&l.node.footprint)){if(l.hiddenByReplacement)return;return{height:p,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]}}if(l.node.footprint.grid.query(new eR(e,i),new eR(e,i),a),a.length>0)return{height:void 0,maxHeight:l.feature.properties.height,hidden:l.hiddenByReplacement,verticalScale:l.evaluatedScale[2]}}}}function dH(e,i){return!e.isLightConstant&&i}function d$(e,i,r,a){let n=1<<e.z;i.lat=ss((a/8192+e.y)/n),i.lng=so((r/8192+e.x)/n)}aT(dZ,"Tiled3dModelBucket",{omit:["layers"]}),aT(dq,"Tiled3dModelFeature");let dW={circle:class extends nk{constructor(e,i,r,a){super(e,{layout:d||(d=new nv({"circle-sort-key":new ny(nb.layout_circle["circle-sort-key"]),"circle-elevation-reference":new ng(nb.layout_circle["circle-elevation-reference"]),visibility:new ng(nb.layout_circle.visibility)})),paint:p||(p=new nv({"circle-radius":new ny(nb.paint_circle["circle-radius"]),"circle-color":new ny(nb.paint_circle["circle-color"]),"circle-blur":new ny(nb.paint_circle["circle-blur"]),"circle-opacity":new ny(nb.paint_circle["circle-opacity"]),"circle-translate":new ng(nb.paint_circle["circle-translate"]),"circle-translate-anchor":new ng(nb.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ng(nb.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ng(nb.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ny(nb.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ny(nb.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ny(nb.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new ng(nb.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}createBucket(e){return new sv(e)}queryRadius(e){return sD("circle-radius",this,e)+sD("circle-stroke-width",this,e)+sR(this.paint.get("circle-translate"))}queryIntersectsFeature(e,i,r,a,n,o,s,l){let h=sO(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(i,r)+this.paint.get("circle-stroke-width").evaluate(i,r);return lx(e,a,o,s,l,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,u)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,i,r){let a=ly(this);return{config:new oQ(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}},heatmap:class extends nk{createBucket(e){return new lw(e)}
vendor: 5,235 bytes, line 7
7constructor(e,i,r,a){super(e,{layout:f||(f=new nv({visibility:new ng(nb.layout_heatmap.visibility)})),paint:m||(m=new nv({"heatmap-radius":new ny(nb.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ny(nb.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ng(nb.paint_heatmap["heatmap-intensity"]),"heatmap-color":new nx(nb.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ng(nb.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=lC({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)}queryRadius(e){return sD("heatmap-radius",this,e)}queryIntersectsFeature(e,i,r,a,n,o,s,l){let h=this.paint.get("heatmap-radius").evaluate(i,r);return lx(e,a,o,s,l,!0,!0,new eR(0,0),h)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,i,r){return"heatmap"===e?{config:new oQ(this,{zoom:i,lut:r}),overrideFog:!1}:{}}},hillshade:class extends nk{constructor(e,i,r,a){super(e,{layout:_||(_=new nv({visibility:new ng(nb.layout_hillshade.visibility)})),paint:g||(g=new nv({"hillshade-illumination-direction":new ng(nb.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ng(nb.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ng(nb.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ng(nb.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ng(nb.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ng(nb.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new ng(nb.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}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(e,i,r){return{overrideFog:!1}}},fill:class extends nk{constructor(e,i,r,a){super(e,{layout:y||(y=new nv({"fill-sort-key":new ny(nb.layout_fill["fill-sort-key"]),visibility:new ng(nb.layout_fill.visibility),"fill-elevation-reference":new ng(nb.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new ny(nb.layout_fill["fill-construct-bridge-guard-rail"])})),paint:x||(x=new nv({"fill-antialias":new ng(nb.paint_fill["fill-antialias"]),"fill-opacity":new ny(nb.paint_fill["fill-opacity"]),"fill-color":new ny(nb.paint_fill["fill-color"]),"fill-outline-color":new ny(nb.paint_fill["fill-outline-color"]),"fill-translate":new ng(nb.paint_fill["fill-translate"]),"fill-translate-anchor":new ng(nb.paint_fill["fill-translate-anchor"]),"fill-pattern":new ny(nb.paint_fill["fill-pattern"]),"fill-emissive-strength":new ng(nb.paint_fill["fill-emissive-strength"]),"fill-z-offset":new ny(nb.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new ny(nb.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new ny(nb.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}getProgramIds(){let e=this.paint.get("fill-pattern"),i=e&&e.constantOr(1),r=[i?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(i&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getDefaultProgramParams(e,i,r){return{config:new oQ(this,{zoom:i,lut:r}),overrideFog:!1}}recalculate(e,i){super.recalculate(e,i);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new hg(e)}queryRadius(){return sR(this.paint.get("fill-translate"))}queryIntersectsFeature(e,i,r,a,n,o){return!e.queryGeometry.isAboveHorizon&&sw(sL(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a)}isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(e){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;
7let i=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=e?i&&!e:i}},"fill-extrusion":class extends nk{constructor(e,i,r,a){super(e,{layout:w||(w=new nv({visibility:new ng(nb["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new ng(nb["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:T||(T=new nv({"fill-extrusion-opacity":new ng(nb["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ny(nb["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ng(nb["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ng(nb["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ny(nb["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ny(nb["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ny(nb["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new ng(nb["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new ng(nb["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new ng(nb["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new ng(nb["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new ng(nb["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new ng(nb["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new ng(nb["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new ng(nb["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new ng(nb["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new ng(nb["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new ny(nb["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new ny(nb["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new ng(nb["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new ng(nb["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new ng(nb["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new ng(nb["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new ny(nb["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new ny(nb["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new ng(nb["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new h5(e)}queryRadius(){return sR(this.paint.get("fill-extrusion-translate"))}is3D(e){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(e,i,r,a,n,o,s,l,h){var u,c,d,p;let f=sO(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),m=this.paint.get("fill-extrusion-height").evaluate(i,r),_=this.paint.get("fill-extrusion-base").evaluate(i,r),g=[0,0],y=l&&o.elevation,x=o.elevation?o.elevation.exaggeration():1,v=e.tile.getBucket(this);if(y&&v instanceof h5){let e=v.centroidVertexArray,i=h+1;i<e.length&&(g[0]=e.geta_centroid_pos0(i),g[1]=e.geta_centroid_pos1(i))}if(0===g[0]&&1===g[1])return!1;"globe"===o.projection.name&&(a=ur([a],[new eR(0,0),new eR(8192,8192)],e.tileID.canonical).map(e=>e.polygon).flat());let[b,w]=(u=a,c=y?l:null,d=o.center.lat,p=e.tileID.canonical,"globe"===o.projection.name?function(e,i,r,a,n,o,s,l,h,u,c){let d=[],p=[],f=e.projection.upVectorScale(c,e.center.lat,e.worldSize).metersToTile,m=[0,0,0,1],_=[0,0,0,1],g=(e,i,r,a)=>{e[0]=i,e[1]=r,e[2]=a,e[3]=1},y=ui();for(let x of(r>0&&(r+=y),a+=y,i)){let i=[],y=[];for(let d of x){let p=d.x+n.x,x=d.y+n.y,v=e.projection.projectTilePoint(p,x,c),b=e.projection.upVector(c,d.x,d.y),w=r,T=a;if(s){let e=uo(p,x,r,a,s,l,h,u);w+=e.base,T+=e.top}0!==r?g(m,v.x+b[0]*f*w,v.y+b[1]*f*w,v.z+b[2]*f*w):g(m,v.x,v.y,v.z),g(_,v.x+b[0]*f*T,v.y+b[1]*f*T,v.z+b[2]*f*T),eP.vec3.transformMat4(m,m,o),eP.vec3.transformMat4(_,_,o),i.push(new hI(m[0],m[1],m[2])),y.push(new hI(_[0],_[1],_[2]))}d.push(i),p.push(y)}
7return[d,p]}(o,u,_,m,f,s,c,g,x,d,p):c?function(e,i,r,a,n,o,s,l,h){let u=[],c=[],d=[0,0,0,1];for(let p of e){let e=[],f=[];for(let u of p){let c=u.x+a.x,p=u.y+a.y,m=uo(c,p,i,r,o,s,l,h);d[0]=c,d[1]=p,d[2]=m.base,d[3]=1,eP.vec4.transformMat4(d,d,n),d[3]=Math.max(d[3],1e-5);let _=new hI(d[0]/d[3],d[1]/d[3],d[2]/d[3]);d[0]=c,d[1]=p,d[2]=m.top,d[3]=1,eP.vec4.transformMat4(d,d,n),d[3]=Math.max(d[3],1e-5);let g=new hI(d[0]/d[3],d[1]/d[3],d[2]/d[3]);e.push(_),f.push(g)}u.push(e),c.push(f)}return[u,c]}(u,_,m,f,s,c,g,x,d):function(e,i,r,a,n){let o=[],s=[],l=n[8]*i,h=n[9]*i,u=n[10]*i,c=n[11]*i,d=n[8]*r,p=n[9]*r,f=n[10]*r,m=n[11]*r;for(let i of e){let e=[],r=[];for(let o of i){let i=o.x+a.x,s=o.y+a.y,_=n[0]*i+n[4]*s+n[12],g=n[1]*i+n[5]*s+n[13],y=n[2]*i+n[6]*s+n[14],x=n[3]*i+n[7]*s+n[15],v=_+l,b=g+h,w=y+u,T=Math.max(x+c,1e-5),S=_+d,M=g+p,E=y+f,A=Math.max(x+m,1e-5);e.push(new hI(v/T,b/T,w/T)),r.push(new hI(S/A,M/A,E/A))}o.push(e),s.push(r)}return[o,s]}(u,_,m,f,s)),T=e.queryGeometry;return function(e,i,r){let a=1/0;sw(r,i)&&(a=un(r,i[0]));for(let n=0;n<i.length;n++){let o=i[n],s=e[n];for(let e=0;e<o.length-1;e++){let i=o[e],n=[i,o[e+1],s[e+1],s[e],i];sb(r,n)&&(a=Math.min(a,un(r,n)))}}return a!==1/0&&a}(b,w,T.isPointQuery()?T.screenBounds:T.screenGeometry)}},line:class extends nk{constructor(e,i,r,a){const n=uS();super(e,n,i,r,a),n.layout&&(this.layout=new n_(n.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof ry,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=(A||((A=new uM(uS().paint.properties["line-width"].specification)).useIntegerZoom=!0),A).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new u_(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,i,r){let a=uw(this);return{config:new oQ(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}queryRadius(e){var i,r;return i=sD("line-width",this,e),((r=sD("line-gap-width",this,e))>0?r+2*i:i)/2+Math.abs(sD("line-offset",this,e))+sR(this.paint.get("line-translate"))}queryIntersectsFeature(e,i,r,a,n,o){var s,l;if(e.queryGeometry.isAboveHorizon)return!1;let h=sL(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=e.pixelToTileUnitsFactor/2*(s=this.paint.get("line-width").evaluate(i,r),(l=this.paint.get("line-gap-width").evaluate(i,r))>0?l+2*s:s),c=this.paint.get("line-offset").evaluate(i,r);return c&&(a=function(e,i){let r=[],a=new eR(0,0);for(let n=0;n<e.length;n++){let o=e[n],s=[];for(let e=0;e<o.length;e++){let r=o[e],n=o[e+1],l=0===e?a:r.sub(o[e-1])._unit()._perp(),h=e===o.length-1?a:n.sub(r)._unit()._perp(),u=l._add(h)._unit();u._mult(1/(u.x*h.x+u.y*h.y)),s.push(u._mult(i)._add(r))}r.push(s)}return r}(a,c*e.pixelToTileUnitsFactor)),function(e,i,r){for(let a=0;a<i.length;a++){let n=i[a];if(e.length>=3){for(let i=0;i<n.length;i++)if(sA(e,n[i]))return!0}if(function(e,i,r){if(e.length>1){if(sT(e,i))return!0;for(let a=0;a<i.length;a++)if(sS(i[a],e,r))return!0}for(let a=0;a<e.length;a++)if(sS(e[a],i,r))return!0;return!1}(e,n,r))return!0}return!1}(h,a,u)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(e){return!this.hasElevatedBuckets}},symbol:c6,background:class extends nk{constructor(e,i,r,a){super(e,{layout:z||(z=new nv({visibility:new ng(nb.layout_background.visibility)})),paint:D||(D=new nv({"background-pitch-alignment":new ng(nb.paint_background["background-pitch-alignment"]),"background-color":new ng(nb.paint_background["background-color"]),"background-pattern":new ng(nb.paint_background["background-pattern"]),"background-opacity":new ng(nb.paint_background["background-opacity"]),"background-emissive-strength":new ng(nb.paint_background["background-emissive-strength"]),"background-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,i,r){return{overrideFog:!1}}is3D(e){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:ds,"raster-particle":dl,sky:class extends nk{constructor(e,i,r,a){super(e,{layout:F||(F=new nv({visibility:new ng(nb.layout_sky.visibility)})),paint:B||(B=new nv({"sky-type":new ng(nb.paint_sky["sky-type"]),"sky-atmosphere-sun":new ng(nb.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new ng(nb.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new ng(nb.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new ng(nb.paint_sky["sky-gradient-radius"]),"sky-gradient":new nx(nb.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new ng(nb.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new ng(nb.paint_sky["sky-atmosphere-color"]),"sky-opacity":new ng(nb.paint_sky["sky-opacity"]),"sky-gradient-use
7-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=lC({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){let i=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==i.azimuthal||this._lightPosition.polar!==i.polar}return!1}getCenter(e,i){if("atmosphere"===this.paint.get("sky-type")){let r=this.paint.get("sky-atmosphere-sun"),a=!r,n=e.style.light,o=n.properties.get("position");return a&&"viewport"===n.properties.get("anchor")&&e0("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?du(o.azimuthal,90-o.polar,i):du(r[0],90-r[1],i)}let r=this.paint.get("sky-gradient-center");return du(r[0],90-r[1],i)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends nk{constructor(e,i,r,a){super(e,{paint:N||(N=new nv({}))},i,null)}},model:class extends nk{constructor(e,i,r,a){super(e,{layout:V||(V=new nv({visibility:new ng(nb.layout_model.visibility),"model-id":new ny(nb.layout_model["model-id"])})),paint:U||(U=new nv({"model-opacity":new ny(nb.paint_model["model-opacity"]),"model-rotation":new ny(nb.paint_model["model-rotation"]),"model-scale":new ny(nb.paint_model["model-scale"]),"model-translation":new ny(nb.paint_model["model-translation"]),"model-color":new ny(nb.paint_model["model-color"]),"model-color-mix-intensity":new ny(nb.paint_model["model-color-mix-intensity"]),"model-type":new ng(nb.paint_model["model-type"]),"model-cast-shadows":new ng(nb.paint_model["model-cast-shadows"]),"model-receive-shadows":new ng(nb.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new ng(nb.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new ny(nb.paint_model["model-emissive-strength"]),"model-roughness":new ny(nb.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new ny(nb.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new ng(nb.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new ng(nb.paint_model["model-front-cutoff"]),"model-color-use-theme":new ny({type:"string",default:"default","property-type":"data-driven"})}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new dR(e)}getProgramIds(){return["model"]}is3D(e){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return 8191*(e instanceof dZ)}queryIntersectsFeature(e,i,r,a,n,o){if(!this.modelManager)return!1;let s=this.modelManager,l=e.tile.getBucket(this);if(!(l&&l instanceof dR))return!1;for(let r in l.instancesPerModel){let a=l.instancesPerModel[r],n=void 0!==i.id?i.id:i.properties&&i.properties.hasOwnProperty("id")?i.properties.id:void 0;if(a.idToFeaturesIndex.hasOwnProperty(n)){let i=a.features[a.idToFeaturesIndex[n]],h=s.getModel(r,this.scope);if(!h)return!1;let u=eP.mat4.create(),c=new st(0,0),d=l.canonical,p=Number.MAX_VALUE;for(let r=0;r<i.instancedDataCount;++r){let n=16*(i.instancedDataOffset+r),s=a.instancedDataArray.float32,l=[s[n+4],s[n+5],s[n+6]];d$(d,c,s[n],0|s[n+1]),dO(u,h,o,c,i.rotation,i.scale,l,!1,!1,!1),"globe"===o.projection.name&&(u=dx(u,o));let f=eP.mat4.multiply([],o.projMatrix,u),m=e.queryGeometry,_=dv(m.isPointQuery()?m.screenBounds:m.screenGeometry,o,f,h.aabb);null!=_&&(p=Math.min(_,p))}return p!==Number.MAX_VALUE&&p}}return!1}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){let i=this._transitionablePaint._values[e];return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof a_}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends nk{constructor(e,i,r,a){super(e,{layout:v||(v=new nv({"clip-layer-types":ne
7w ng(nb.layout_clip["clip-layer-types"]),"clip-layer-scope":new ng(nb.layout_clip["clip-layer-scope"])})),paint:b||(b=new nv({}))},i,r,a)}recalculate(e,i){super.recalculate(e,i)}createBucket(e){return new hv(e)}is3D(e){return!0}}};class dX{constructor(e){this._callback=e,this._triggered=!1,"u">typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class dY{constructor(){this.tasks={},this.taskQueue=[],eX(["process"],this),this.invoker=new dX(this.process),this.nextId=0}add(e,i){let r=this.nextId++,a=function({type:e,isSymbolTile:i,zoom:r}){return r=r||0,"message"===e?0:"maybePrepare"!==e||i?"parseTile"!==e||i?"parseTile"===e&&i?300-r:"maybePrepare"===e&&i?400-r:500:200-r:100-r}(i);return 0===a?(e(),null):(this.tasks[r]={fn:e,metadata:i,priority:a,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}})}process(){{if(this.taskQueue=this.taskQueue.filter(e=>!!this.tasks[e]),!this.taskQueue.length)return;let e=this.pick();if(null===e)return;let i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}}pick(){let e=null,i=1/0;for(let r=0;r<this.taskQueue.length;r++){let a=this.tasks[this.taskQueue[r]];a.priority<i&&(i=a.priority,e=r)}if(null===e)return null;let r=this.taskQueue[e];return this.taskQueue.splice(e,1),r}remove(){this.invoker.remove()}}class dK{constructor(e,i,r){this.target=e,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},eX(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new dY}send(e,i,r,a,n=!1,o){let s=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=o,this.callbacks[s]=r);let l=new Set;return this.target.postMessage({id:s,type:e,hasCallback:!!r,targetMapId:a,mustQueue:n,sourceMapId:this.mapId,data:aE(i,l)},l),{cancel:()=>{r&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){let i=e.data;if(!i)return;let r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId))if("<cancel>"===i.type){let e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e.cancel()}else if(i.mustQueue||e3()){let e=this.callbacks[r],a=this.scheduler.add(()=>this.processTask(r,i),e&&e.metadata||{type:"message"});a&&(this.cancelCallbacks[r]=a)}else this.processTask(r,i)}processTask(e,i){if(delete this.cancelCallbacks[e],"<response>"===i.type){let r=this.callbacks[e];delete this.callbacks[e],r&&(i.error?r(aA(i.error)):r(null,aA(i.data)))}else{let r=new Set,a=i.hasCallback?(i,a)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:i?aE(i):null,data:aE(a,r)},r)}:()=>{},n=aA(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,n,a);else if(this.parent.getWorkerSource){let e=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,e[0],n.source,n.scope)[e[1]](n,a)}else a(Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var dJ={workerUrl:"",workerClass:null,workerParams:void 0};let dQ="mapboxgl_preloaded_worker_pool";class d0{constructor(){this.active={}}acquire(e,i=d0.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(null!=dJ.workerClass?new dJ.workerClass:new self.Worker(dJ.workerUrl,dJ.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[dQ]}numActive(){return Object.keys(this.active).length}}d0.workerCount=2;class d1{constructor(e,i,r="Worker",a=d0.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=e$();const n=this.workerPool.acquire(this.id,a);for(let e=0;e<n.length;e++){const a=new d1.Actor(n[e],i,this.id);a.name=`${r} ${e}`,this.actors.push(a)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,r){eq(this.actors,(r,a)=>{r.send(e,i,a)},r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}
7remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}function d2(){return j||(j=new d0),j}d1.Actor=dK;let d3=new tZ(0,0,0);var d4=((Z=d4||{})[Z.PATH_RULE_UNSPECIFIED=0]="PATH_RULE_UNSPECIFIED",Z[Z.PATH_RULE_NON_ZERO=1]="PATH_RULE_NON_ZERO",Z[Z.PATH_RULE_EVEN_ODD=2]="PATH_RULE_EVEN_ODD",Z),d5=((H=d5||{})[H.LINE_CAP_UNSPECIFIED=0]="LINE_CAP_UNSPECIFIED",H[H.LINE_CAP_BUTT=1]="LINE_CAP_BUTT",H[H.LINE_CAP_ROUND=2]="LINE_CAP_ROUND",H[H.LINE_CAP_SQUARE=3]="LINE_CAP_SQUARE",H),d6=(($=d6||{})[$.LINE_JOIN_UNSPECIFIED=0]="LINE_JOIN_UNSPECIFIED",$[$.LINE_JOIN_MITER=1]="LINE_JOIN_MITER",$[$.LINE_JOIN_MITER_CLIP=2]="LINE_JOIN_MITER_CLIP",$[$.LINE_JOIN_ROUND=3]="LINE_JOIN_ROUND",$[$.LINE_JOIN_BEVEL=4]="LINE_JOIN_BEVEL",$),d8=((W=d8||{})[W.PAINT_ORDER_UNSPECIFIED=0]="PAINT_ORDER_UNSPECIFIED",W[W.PAINT_ORDER_FILL_AND_STROKE=1]="PAINT_ORDER_FILL_AND_STROKE",W[W.PAINT_ORDER_STROKE_AND_FILL=2]="PAINT_ORDER_STROKE_AND_FILL",W),d9=((X=d9||{})[X.PATH_COMMAND_UNSPECIFIED=0]="PATH_COMMAND_UNSPECIFIED",X[X.PATH_COMMAND_MOVE=1]="PATH_COMMAND_MOVE",X[X.PATH_COMMAND_LINE=2]="PATH_COMMAND_LINE",X[X.PATH_COMMAND_QUAD=3]="PATH_COMMAND_QUAD",X[X.PATH_COMMAND_CUBIC=4]="PATH_COMMAND_CUBIC",X[X.PATH_COMMAND_CLOSE=5]="PATH_COMMAND_CLOSE",X),d7=((Y=d7||{})[Y.MASK_TYPE_UNSPECIFIED=0]="MASK_TYPE_UNSPECIFIED",Y[Y.MASK_TYPE_LUMINANCE=1]="MASK_TYPE_LUMINANCE",Y[Y.MASK_TYPE_ALPHA=2]="MASK_TYPE_ALPHA",Y);function pe(e,i,r){var a;1===e&&i.icons.push((a=r.readVarint()+r.pos,function(e){if(e.usvg_tree.height||(e.usvg_tree.height=e.usvg_tree.width),!e.metadata)return e;let{metadata:i}=e;if(i.content_area){let{content_area:r}=i;null==r.top&&(r.top=r.left),null==r.width&&(r.width=e.usvg_tree.width),null==r.height&&(r.height=r.width)}return i.stretch_x&&i.stretch_x.length&&pt(i,"x"),i.stretch_y&&i.stretch_y.length&&pt(i,"y"),e}(r.readFields(pi,{name:void 0},a))))}function pt(e,i){let r=[],a=e[`stretch_${i}`],n=null;for(let e=0;e<a.length;e++)null===n?n=0===r.length?a[0]:r[r.length-1][1]+a[e]:(r.push([n,n+a[e]]),n=null);e[`stretch_${i}_areas`]=r}function pi(e,i,r){var a,n;1===e?i.name=r.readString():2===e?(a=r.readVarint()+r.pos,i.metadata=r.readFields(pr,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)):3===e&&(n=r.readVarint()+r.pos,i.usvg_tree=r.readFields(po,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},n),i.data="usvg_tree")}function pr(e,i,r){var a,n;1===e?i.stretch_x=r.readPackedVarint():2===e?i.stretch_y=r.readPackedVarint():3===e?(a=r.readVarint()+r.pos,i.content_area=r.readFields(pa,{left:0},a)):4===e&&i.variables.push((n=r.readVarint()+r.pos,r.readFields(pn,{name:void 0},n)))}function pa(e,i,r){1===e?i.left=r.readVarint():2===e?i.width=r.readVarint():3===e?i.top=r.readVarint():4===e&&(i.height=r.readVarint())}function pn(e,i,r){1===e?i.name=r.readString():2===e&&(i.rgb_color=pf(r.readVarint()),i.value="rgb_color")}function po(e,i,r){var a,n,o,s;let l;1===e?i.width=i.height=r.readVarint():2===e?i.height=r.readVarint():3===e?i.children.push(ps(r,r.readVarint()+r.pos)):4===e?i.linear_gradients.push((a=r.readVarint()+r.pos,r.readFields(p_,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a))):5===e?i.radial_gradients.push((n=r.readVarint()+r.pos,r.readFields(px,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},n))):7===e?i.clip_paths.push((o=r.readVarint()+r.pos,r.readFields(pv,{children:[]},o))):8===e&&i.masks.push((s=r.readVarint()+r.pos,null==(l=r.readFields(pb,{left:0,width:20,mask_type:1,children:[]},s)).height&&(l.height=l.width),null==l.top&&(l.top=l.left),l))}function ps(e,i){return e.readFields(pl,{},i)}function pl(e,i,r){var a,n;1===e?(a=r.readVarint()+r.pos,i.group=r.readFields(ph,{opacity:255,children:[]},a),i.node="group"):2===e&&(n=r.readVarint()+r.pos,i.path=r.readFields(pd,{paint_order:1,commands:[],step:1,diffs:[],rule:1},n),i.node="path")}function ph(e,i,r){1===e?i.transform=pu(r,r.readVarint()+r.pos):2===e?i.opacity=r.readVarint():5===e?i.clip_path_idx=r.readVarint():6===e?i.mask_idx=r.readVarint():7===e&&i.children.push(ps(r,r.readVarint()+r.pos))}function pu(e,i){return e.readFields(pc,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},i)}function pc(e,i,r){1===e?i.sx=r.readFloat():2===e?i.ky=r.readFloat():3===e?i.kx=r.readFloat():4===e?i.sy=r.readFloat():5===e?i.tx=r.readFloat():6===e&&(i.ty=r.readFloat())}function pd(e,i,r){var a,n;1===e?(a=r.readVarint()+r.pos,i.fill=r.readFields(pp,{rgb_color:d3,paint:"rgb_color",opacity:255},a)):2===e?(n=r.readVarint()+r.pos,i.stroke=r.readFields(pm,{rgb_color:d3,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},n)):3===e?i.paint_order=r.readVarint():5===e?r.readPackedVarint(i.commands):6===e?i.step=r.readFloat():7===e?r.readPackedSVarint(i.diffs):8===e&&(i.rule=r.readVarint())}function pp(e,i,r){1===e?(i.rgb_color=pf(r.readVarint()),i.paint="rgb_color"):2===e?(i.linear_gradient_idx=r.readVarint(),i.paint="linear_gradient_idx"):3===e?(i.radial_gradient_idx=r.readVarint(),i.paint="radial_gradient_idx"):5===e&&(i.op
7acity=r.readVarint())}function pf(e){return new tZ((e>>16&255)/255,(e>>8&255)/255,(255&e)/255,1)}function pm(e,i,r){1===e?(i.rgb_color=pf(r.readVarint()),i.paint="rgb_color"):2===e?(i.linear_gradient_idx=r.readVarint(),i.paint="linear_gradient_idx"):3===e?(i.radial_gradient_idx=r.readVarint(),i.paint="radial_gradient_idx"):5===e?r.readPackedFloat(i.dasharray):6===e?i.dashoffset=r.readFloat():7===e?i.miterlimit=r.readFloat():8===e?i.opacity=r.readVarint():9===e?i.width=r.readFloat():10===e?i.linecap=r.readVarint():11===e&&(i.linejoin=r.readVarint())}function p_(e,i,r){1===e?i.transform=pu(r,r.readVarint()+r.pos):2===e?i.spread_method=r.readVarint():3===e?i.stops.push(pg(r,r.readVarint()+r.pos)):4===e?i.x1=r.readFloat():5===e?i.y1=r.readFloat():6===e?i.x2=r.readFloat():7===e&&(i.y2=r.readFloat())}function pg(e,i){return e.readFields(py,{offset:0,opacity:255,rgb_color:d3},i)}function py(e,i,r){1===e?i.offset=r.readFloat():2===e?i.opacity=r.readVarint():3===e&&(i.rgb_color=pf(r.readVarint()))}function px(e,i,r){1===e?i.transform=pu(r,r.readVarint()+r.pos):2===e?i.spread_method=r.readVarint():3===e?i.stops.push(pg(r,r.readVarint()+r.pos)):4===e?i.cx=r.readFloat():5===e?i.cy=r.readFloat():6===e?i.r=r.readFloat():7===e?i.fx=r.readFloat():8===e?i.fy=r.readFloat():9===e&&(i.fr=r.readFloat())}function pv(e,i,r){1===e?i.transform=pu(r,r.readVarint()+r.pos):2===e?i.clip_path_idx=r.readVarint():3===e&&i.children.push(ps(r,r.readVarint()+r.pos))}function pb(e,i,r){1===e?i.left=i.top=r.readFloat():2===e?i.width=i.height=r.readFloat():3===e?i.top=r.readFloat():4===e?i.height=r.readFloat():5===e?i.mask_type=r.readVarint():6===e?i.mask_idx=r.readVarint():7===e&&i.children.push(ps(r,r.readVarint()+r.pos))}class pw{static calculate(e={},i=[]){let r=new Map,a=new Map;if(0===Object.keys(e).length)return r;for(let[n,o]of(i.forEach(e=>{a.set(e.name,e.rgb_color||new tZ(0,0,0))}),Object.entries(e)))a.has(n)?r.set(a.get(n).toStringPremultipliedAlpha(),o):console.warn(`Ignoring unknown image variable "${n}"`);return r}}function pT(e,i=255,r){let a=e.toStringPremultipliedAlpha(),n=r.has(a)?r.get(a).clone():e.clone();return n.a*=i/255,n.toString()}function pS(e,i){if(!ta()){let r=document.createElement("canvas");return r.width=e,r.height=i,r}return new OffscreenCanvas(e,i)}function pM(e,i){let r=pw.calculate(i.params,e.metadata?e.metadata.variables:[]),a=e.usvg_tree,n=a.width,o=a.height,s=i.transform?i.transform:new DOMMatrix,l=Math.max(1,Math.round(n*s.a)),h=Math.max(1,Math.round(o*s.d)),u=new DOMMatrix([l/n,0,0,h/o,0,0]),c=pS(l,h).getContext("2d");return pE(c,u,a,a,r),c.getImageData(0,0,l,h)}function pE(e,i,r,a,n){for(let o of a.children)(function e(i,r,a,n,o){var s;let l;n.group?(i.save(),function(i,r,a,n,o){var s,l;let h=null!=n.mask_idx?a.masks[n.mask_idx]:null,u=null!=n.clip_path_idx?a.clip_paths[n.clip_path_idx]:null;if(n.transform&&(r=pD(n.transform).preMultiplySelf(r)),s=null!=u,l=null!=h,255===n.opacity&&!s&&!l)return pE(i,r,a,n,o);let c=pS(i.canvas.width,i.canvas.height),d=c.getContext("2d");pE(d,r,a,n,o),u&&function e(i,r,a,n){let o=pS(i.canvas.width,i.canvas.height);(function i(r,a,n,o){let s=o.transform?pD(o.transform).preMultiplySelf(a):a,l=pS(r.canvas.width,r.canvas.height),h=l.getContext("2d");for(let e of o.children)if(e.group)i(h,s,n,e.group);else if(e.path){let i=e.path,r=new Path2D;r.addPath(pR(i),s),h.fill(r,pI(i))}let u=null!=o.clip_path_idx?n.clip_paths[o.clip_path_idx]:null;u&&e(h,s,n,u),r.globalCompositeOperation="source-over",r.drawImage(l,0,0)})(o.getContext("2d"),r,a,n),i.globalCompositeOperation="destination-in",i.drawImage(o,0,0)}(d,r,a,u),h&&function i(r,a,n,o,s){if(0===o.children.length)return;let l=null!=o.mask_idx?n.masks[o.mask_idx]:null;l&&i(r,a,n,l,s);let h=r.canvas.width,u=r.canvas.height,c=pS(h,u),d=c.getContext("2d"),p=o.width,f=o.height,m=o.left,_=o.top,g=new Path2D,y=new Path2D;for(let i of(y.rect(m,_,p,f),g.addPath(y,a),d.clip(g),o.children))e(d,a,n,i,s);let x=d.getImageData(0,0,h,u),v=x.data;if(o.mask_type===d7.MASK_TYPE_LUMINANCE)for(let e=0;e<v.length;e+=4)v[e+3]=v[e+3]/255*(.2126*v[e]+.7152*v[e+1]+.0722*v[e+2]);d.putImageData(x,0,0),r.globalCompositeOperation="destination-in",r.drawImage(c,0,0)}(d,r,a,h,o),i.globalAlpha=n.opacity/255,i.drawImage(c,0,0)}
7(i,r,a,n.group,o),i.restore()):n.path&&(i.save(),s=n.path,l=pR(s),i.setTransform(r),s.paint_order===d8.PAINT_ORDER_FILL_AND_STROKE?(pA(i,a,s,l,o),pC(i,a,s,l,o)):(pC(i,a,s,l,o),pA(i,a,s,l,o)),i.restore())})(e,i,r,o,n)}function pA(e,i,r,a,n){let o=r.fill;if(!o)return;let s=o.opacity/255;switch(o.paint){case"rgb_color":e.fillStyle=pT(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":e.fillStyle=pP(e,i.linear_gradients[o.linear_gradient_idx],s,n);break;case"radial_gradient_idx":e.fillStyle=pz(e,i.radial_gradients[o.radial_gradient_idx],s,n)}e.fill(a,pI(r))}function pI(e){return e.rule===d4.PATH_RULE_NON_ZERO?"nonzero":e.rule===d4.PATH_RULE_EVEN_ODD?"evenodd":void 0}function pC(e,i,r,a,n){let o=r.stroke;if(!o)return;e.lineWidth=o.width,e.miterLimit=o.miterlimit,e.setLineDash(o.dasharray),e.lineDashOffset=o.dashoffset;let s=o.opacity/255;switch(o.paint){case"rgb_color":e.strokeStyle=pT(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":e.strokeStyle=pP(e,i.linear_gradients[o.linear_gradient_idx],s,n);break;case"radial_gradient_idx":e.strokeStyle=pz(e,i.radial_gradients[o.radial_gradient_idx],s,n)}switch(o.linejoin){case d6.LINE_JOIN_MITER_CLIP:case d6.LINE_JOIN_MITER:e.lineJoin="miter";break;case d6.LINE_JOIN_ROUND:e.lineJoin="round";break;case d6.LINE_JOIN_BEVEL:e.lineJoin="bevel"}switch(o.linecap){case d5.LINE_CAP_BUTT:e.lineCap="butt";break;case d5.LINE_CAP_ROUND:e.lineCap="round";break;case d5.LINE_CAP_SQUARE:e.lineCap="square"}e.stroke(a)}function pP(e,i,r,a){if(1===i.stops.length){let e=i.stops[0];return pT(e.rgb_color,e.opacity*r,a)}let n=pD(i.transform),{x1:o,y1:s,x2:l,y2:h}=i,u=n.transformPoint(new DOMPoint(o,s)),c=n.transformPoint(new DOMPoint(l,h)),d=e.createLinearGradient(u.x,u.y,c.x,c.y);for(let e of i.stops)d.addColorStop(e.offset,pT(e.rgb_color,e.opacity*r,a));return d}function pz(e,i,r,a){if(1===i.stops.length){let e=i.stops[0];return pT(e.rgb_color,e.opacity*r,a)}let n=pD(i.transform),{fx:o,fy:s,cx:l,cy:h}=i,u=n.transformPoint(new DOMPoint(o,s)),c=n.transformPoint(new DOMPoint(l,h)),d=e.createRadialGradient(u.x,u.y,0,c.x,c.y,i.r*((n.a+n.d)/2));for(let e of i.stops)d.addColorStop(e.offset,pT(e.rgb_color,e.opacity*r,a));return d}function pD(e){return e?new DOMMatrix([e.sx,e.ky,e.kx,e.sy,e.tx,e.ty]):new DOMMatrix}function pR(e){let i=new Path2D,r=e.step,a=e.diffs[0]*r,n=e.diffs[1]*r;i.moveTo(a,n);for(let o=0,s=2;o<e.commands.length;o++)switch(e.commands[o]){case d9.PATH_COMMAND_MOVE:a+=e.diffs[s++]*r,n+=e.diffs[s++]*r,i.moveTo(a,n);break;case d9.PATH_COMMAND_LINE:a+=e.diffs[s++]*r,n+=e.diffs[s++]*r,i.lineTo(a,n);break;case d9.PATH_COMMAND_QUAD:{let o=a+e.diffs[s++]*r,l=n+e.diffs[s++]*r;a=o+e.diffs[s++]*r,n=l+e.diffs[s++]*r,i.quadraticCurveTo(o,l,a,n);break}case d9.PATH_COMMAND_CUBIC:{let o=a+e.diffs[s++]*r,l=n+e.diffs[s++]*r,h=o+e.diffs[s++]*r,u=l+e.diffs[s++]*r;a=h+e.diffs[s++]*r,n=u+e.diffs[s++]*r,i.bezierCurveTo(o,l,h,u,a,n);break}case d9.PATH_COMMAND_CLOSE:i.closePath()}return i}class pL{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}aT(pL,"LRUCache");class pO{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new lA(e,e.data)}getFromCache(e,i,r){return this.cacheMap.has(r)||this.cacheMap.set(r,new pL(150)),this.cacheMap.get(r).get(nR(e.toString(),i))}setInCache(e,i,r,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new pL(150));let n=this.cacheDependenciesMap.get(a),o=nR(e.id.toString(),r);n.get(o)||n.set(o,new Set);let s=this.cacheMap.get(a),l=e.toString();n.get(o).add(l),s.put(nR(e.toString(),r),i)}removeImagesFromCacheByIds(e,i,r=0){if(!this.cacheMap.has(r)||!this.cacheDependenciesMap.has(r))return;let a=this.cacheMap.get(r),n=this.cacheDependenciesMap.get(r);for(let r of e){let e=nR(r.toString(),i);if(n.has(e)){for(let i of n.get(e))a.delete(i);n.delete(e)}}}rasterize(e,i,r,a,n=pM){let o=this.getFromCache(e,r,a);if(o)return o.clone();let s=n(i.icon,e.options),l=pO._getImage(s);return this.setInCache(e,l,r,a),l.clone()}}class pk{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){let r=this.toIdx(e,i);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function pF(e,i,r,a){let n=0,o=Number.MAX_VALUE;for(let s=0;s<3;s++)if(1e-15>Math.abs(a[s])){if(r[s]<e[s]||r[s]>i[s])return null}else{let l=1/a[s],h=(e[s]-r[s])*l,u=(i[s]-r[s])*l;if(h>u){let e=h;h=u,u=e}if(h>n&&(n=h),u<o&&(o=u),n>o)return null}return n}function pB(e,i,r,a,n,o,s,l,h,u,c){let d=a-e,p=n-i,f=o-r,m=s-e,_=l-i,g=h-r,y=c[1]*g-c[2]*_,x=c[2]*m-c[0]*g,v=c[0]*_-c[1]*m,b=d*y+p*x+f*v;if(1e-15>Math.abs(b))return null;let w=1/b,T=u[0]-e,S=u[1]-i,M=u[2]-r,E=(T*y+S*x+M*v)*w;if(E<0||E>1)return null;let A=S*f-M*p,I=M*d-T*f,C=T*p-S*d,P=(c[0]*A+c[1]*I+c[2]*C)*w;return P<0||E+P>1?null:(m*A+_*I+g*C)*w}function pN(e,i,r,a,n,o,s,l,h){let u=1<<r,c=o-a,d=s-n;l[0]=(e+0)/u*c+a,l[1]=(i+0)/u*d+n,h[0]=(e+1)/u*c+a,h[1]=(i+1)/u*d+n}class pV{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(e){let i=Math.ceil(Math.log2(e.dim/8)),r=[],a=Math.ceil(Math.pow(2,i)),n=1/a,o=(e,i,r,a,n)=>{let o=+!!a;n[0]=e*r,n[1]=i*r,n[2]=(e+1)*r-o,n[3]=(i+1)*r-o},s=new pk(a),l=[];for(let i=0;i<a*a;i++){o(i%a,Math.floor(i/a),n,!1,l);let r=pj(l[0],l[1],e),h=pj(l[2],l[1],e),u=pj(l[2],l[3],e),c=pj(l[0],l[3],e);s.minimums.push(Math.min(r,h,u,c)),s.maximums.push(Math.max(r,h,u,c)),s.leaves.push(1)}for(r.push(s),a/=2;a>=1;a/=2){let e=r[r.length-1];s=new pk(a);for(let i=0;i<a*a;i++){o(i%a,Math.floor(i/a),2,!0,l);let r=e.getElevation(l[0],l[1]),n=e.getElevation(l[2],l[1]),h=e.getElevation(l[2],l[3]),u=e.getElevation(l[0],l[3]),c=e.isLeaf(l[0],l[1]),d=e.isLeaf(l[2],l[1]),p=e.isLeaf(l[2],l[3]),f=e.isLeaf(l[0],l[3]),m=Math.min(r.min,n.min,h.min,u.min),_=Math.max(r.max,n.max,h.max,u.max),g=c&&d&&p&&f;s.maximums.push(_),s.minimums.push(m),s.leaves.push(_-m<=5&&g?1:0)}r.push(s)}return r}(this.dem),r=i.length-1,a=i[r];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,
70,0,r,0)}raycastRoot(e,i,r,a,n,o,s=1){return pF([e,i,-100],[r,a,this.maximums[0]*s],n,o)}raycast(e,i,r,a,n,o,s=1){if(!this.nodeCount)return null;let l=this.raycastRoot(e,i,r,a,n,o,s);if(null==l)return null;let h=[],u=[],c=[],d=[],p=[{idx:0,t:l,nodex:0,nodey:0,depth:0}];for(;p.length>0;){let{idx:l,t:y,nodex:x,nodey:v,depth:b}=p.pop();if(this.leaves[l]){pN(x,v,b,e,i,r,a,c,d);let l=1<<b,h=(x+0)/l,u=(x+1)/l,p=(v+0)/l,w=(v+1)/l,T=pj(h,p,this.dem)*s,S=pj(u,p,this.dem)*s,M=pj(u,w,this.dem)*s,E=pj(h,w,this.dem)*s,A=pB(c[0],c[1],T,d[0],c[1],S,d[0],d[1],M,n,o),I=pB(d[0],d[1],M,c[0],d[1],E,c[0],c[1],T,n,o),C=Math.min(null!==A?A:Number.MAX_VALUE,null!==I?I:Number.MAX_VALUE);if(C!==Number.MAX_VALUE)return C;{var f,m,_,g;let e=eP.vec3.scaleAndAdd([],n,o,y);if(pU(T,S,E,M,(f=e[0],(f-(m=c[0]))/(d[0]-m)),(_=e[1],(_-(g=c[1]))/(d[1]-g)))>=e[2])return y}continue}let w=0;for(let p=0;p<this._siblingOffset.length;p++){pN((x<<1)+this._siblingOffset[p][0],(v<<1)+this._siblingOffset[p][1],b+1,e,i,r,a,c,d),c[2]=-100,d[2]=this.maximums[this.childOffsets[l]+p]*s;let f=pF(c,d,n,o);if(null!=f){h[p]=f;let e=!1;for(let i=0;i<w&&!e;i++)f>=h[u[i]]&&(u.splice(i,0,p),e=!0);e||(u[w]=p),w++}}for(let e=0;e<w;e++){let i=u[e];p.push({idx:this.childOffsets[l]+i,t:h[i],nodex:(x<<1)+this._siblingOffset[i][0],nodey:(v<<1)+this._siblingOffset[i][1],depth:b+1})}}return null}_addNode(e,i,r){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,r,a,n){if(1===e[a].isLeaf(i,r))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);let o=a-1,s=e[o],l=0,h=0;for(let e=0;e<this._siblingOffset.length;e++){let a=2*i+this._siblingOffset[e][0],n=2*r+this._siblingOffset[e][1],o=s.getElevation(a,n),u=s.isLeaf(a,n),c=this._addNode(o.min,o.max,u);u&&(l|=1<<e),h||(h=c)}for(let a=0;a<this._siblingOffset.length;a++)l&1<<a||this._construct(e,2*i+this._siblingOffset[a][0],2*r+this._siblingOffset[a][1],o,h+a)}}function pU(e,i,r,a,n,o){return t$(t$(e,r,o),t$(i,a,o),n)}function pj(e,i,r){let a=r.dim,n=eU(e*a-.5,0,a-1),o=eU(i*a-.5,0,a-1),s=Math.floor(n),l=Math.floor(o),h=Math.min(s+1,a-1),u=Math.min(l+1,a-1);return pU(r.get(s,l),r.get(h,l),r.get(s,u),r.get(h,u),n-s,o-l)}let pG={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function pq(e,i,r){return(256*e*256+256*i+r)/10-1e4}function pZ(e,i,r){return 256*e+i+r/256-32768}class pH{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,r,a=!1){if(this.uid=e,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void e0(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const n=this.dim=i.height-2,o=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let e=0;e<n;e++)o[this._idx(-1,e)]=o[this._idx(0,e)],o[this._idx(n,e)]=o[this._idx(n-1,e)],o[this._idx(e,-1)]=o[this._idx(e,0)],o[this._idx(e,n)]=o[this._idx(e,n-1)];o[this._idx(-1,-1)]=o[this._idx(0,0)],o[this._idx(n,-1)]=o[this._idx(n-1,0)],o[this._idx(-1,n)]=o[this._idx(0,n-1)],o[this._idx(n,n)]=o[this._idx(n-1,n-1)]}const s="terrarium"===r?pZ:pq;for(let e=0;e<o.length;++e){const i=4*e;this.floatView[e]=s(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}this._timestamp=tn.now()}_buildQuadTree(){this._tree=new pV(this)}get(e,i,r=!1){r&&(e=eU(e,-1,this.dim),i=eU(i,-1,this.dim));let a=this._idx(e,i);return this.floatView[a]}set(e,i,r){let a=this._idx(e,i),n=this.floatView[a];return this.floatView[a]=r,r-n}static getUnpackVector(e){return pG[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){let r=[0,0,0,0],a=pH.getUnpackVector(i),n=Math.floor((e+a[3])/a[2]);return r[2]=n%256,n=Math.floor(n/256),r[1]=n%256,n=Math.floor(n/256),r[0]=n,r}getPixels(){return new lI({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,r){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let a=i*this.dim,n=i*this.dim+this.dim,o=r*this.dim,s=r*this.dim+this.dim;switch(i){case -1:a=n-1;break;case 1:n=a+1}switch(r){case -1:o=s-1;break;case 1:s=o+1}let l=-i*this.dim,h=-r*this.dim;for(let i=o;i<s;i++)for(let r=a;r<n;r++){let a=4*this._idx(r,i),n=4*this._idx(r+l,i+h);this.pixels[a+0]=e.pixels[n+0],this.pixels[a+1]=e.pixels[n+1],this.pixels[a+2]=e.pixels[n+2],this.pixels[a+3]=e.pixels[n+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function p$(e,i,r){var a;1===e?i.headerLength=r.readFixed32():2===e?i.x=r.readVarint():3===e?i.y=r.readVarint():4===e?i.z=r.readVarint():5===e&&i.layers.push((a=r.readVarint()+r.pos,r.readFields(pJ,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)))}function pW(e,i,r){var a;1===e?(a=r.readVarint()+r.pos,i.delta_filter=r.readFields(pX,{blockSize:0},a),i.filter="delta_filter"):2===e?(r.readVarint(),i.filter="zigzag_filter"):3===e?(r.readVarint(),i.filter="bitshuffle_filter"):4===e&&(r.readVarint(),i.filter="byteshuffle_filter")}function pX(e,i,r){1===e&&(i.blockSize=r.readVarint())}function pY(e,i,r){1===e?(r.readVarint(),i.codec="gzip_data"):2===e?(r.readVarint(),i.codec="jpeg_image"):3===e?(r.readVarint(),i.codec="webp_image"):4===e&&(r.readVarint(),i.codec="png_image")}function pK(e,i,r){var a,n;let o=0,s=0;1===e?i.firstByte=r.readFixed64():2===e?i.lastByte=r.readFixed64():3===e?i.filters.push((a=r.readVarint()+r.pos,r.readFields(pW,{},a))):4===e?(n=r.readVarint()+r.pos,i.codec=r.readFields(pY,{},n)):5===e?s=r.readFloat():6===e?o=r.readFloat():7===e?i.bands.push(r.readString()):8===e?i.offset=r.readDouble():9===e&&(i.scale=r.readDouble()),0===i.offset&&(i.offset=s),0===i.scale&&(i.scale=o)}function pJ(e,i,r){var a;1===e?i.version=r.readVarint():2===e?i.name=r.readString():3===e?i.units=r.readString():4===e?i.tileSize=r.readVarint():5===e?i.buffer=r.readVarint():6===e?i.pixelFormat=r.readVarint():7===e&&i.dataIndex.push((a=r.readVarint()+r.pos,r.readFields(pK,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)))}function pQ(e,i,r){if(2===e){var a;a=r.readVarint()+r.pos,r.readFields(p0,i,a)}else if(3===e)throw Error("Not implemented")}function p0(e,i,r){if(1===e){let e=0,a=r.readVarint()+r.pos;for(;r.pos<a;)i[e++]=r.readVarint()}}aT(pH,"DEMData"),aT(pV,"DemMinMaxQuadTree",{omit:["dem"]});var p1=Uint8Array,p2=Uint16Array,p3=Int32Array,p4=new p1([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]),p5=new p1([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]),p6=new p1([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p8=function(e,i){for(var r=new p2(31),a=0;a<31;++a)r[a]=i+=1<<e[a-1];var n=new p3(r[30]);for(a=1;a<30;++a)for(var o=r[a];o<r[a+1];++o)n[o]=o-r[a]<<5|a;return{b:r,r:n}},p9=p8(p4,2),p7=p9.b,fe=p9.r;p7[28]=258,fe[258]=28;for(var ft=p8(p5,0).b,fi=new p2(32768),fr=0;fr<32768;++fr){var fa=(43690&fr)>>1|(21845&fr)<<1;fi[fr]=((65280&(fa=(61680&(fa=(52428&fa)>>2|(13107&fa)<<2))>>4|(3855&fa)<<4))>>8|(255&fa)<<8)>>1}var fn=function(e,i,r){for(var a=e.length,n=0,o=new p2(i);n<a;++n)e[n]&&++o[e[n]-1];var s,l=new p2(i);for(n=1;n<i;++n)l[n]=l[n-1]+o[n-1]<<1;s=new p2(1<<i);var h=15-i;for(n=0;n<a;++n)if(e[n])for(var u=n<<4|e[n],c=i-e[n],d=l[e[n]-1]++<<c,p=d|(1<<c)-1;d<=p;++d)s[fi[d]>>h]=u;return s},fo=new p1(288);for(fr=0;fr<144;++fr)fo[fr]=8;for(fr=144;fr<256;++fr)fo[fr]=9;for(fr=256;fr<280;++fr)fo[fr]=7;for(fr=280;fr<288;++fr)fo[fr]=8;var fs=new p1(32);for(fr=0;fr<32;++fr)fs[fr]=5;var fl=fn(fo,9),fh=fn(fs,5),fu=function(e){for(var i=e[0],r=1;r<e.length;++r)e[r]>i&&(i=e[r]);return i},fc=function(e,i,r){var a=i/8|0;return(e[a]|e[a+1]<<8)>>(7&i)&r},fd=function(e,i){var r=i/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&i)}
7,fp=["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"],ff=function(e,i,r){var a=Error(i||fp[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,ff),!r)throw a;return a},fm=new p1(0),f_="u">typeof TextDecoder&&new TextDecoder;try{f_.decode(fm,{stream:!0})}catch(e){}let fg={gzip_data:"gzip"};class fy extends Error{constructor(e){super(e),this.name="MRTError"}}let fx={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},fv={uint32:1,uint16:2,uint8:4},fb={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class fw{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){let i=this.layers[e];if(!i)throw new fy(`Layer '${e}' not found`);return i}getHeaderLength(e){let i=new Uint8Array(e),r=new DataView(e);if(13!==i[0])throw new fy("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(e){let i=new Uint8Array(e),r=this.getHeaderLength(e);if(i.length<r)throw new fy(`Expected header with length >= ${r} but got buffer of length ${i.length}`);let a=new q(i.subarray(0,r)).readFields(p$,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new fy(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);for(let e of(this.x=a.x,this.y=a.y,this.z=a.z,a.layers))this.layers[e.name]=new fT(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){let i=[],r=this.getLayer(e.layerName);for(let a of e.blockIndices){let n=r.dataIndex[a],o=n.firstByte-e.firstByte,s=n.lastByte-e.firstByte;if(r._blocksInProgress.has(a))continue;let l={layerName:r.name,firstByte:o,lastByte:s,pixelFormat:r.pixelFormat,blockIndex:a,blockShape:[n.bands.length].concat(r.bandShape),buffer:r.buffer,codec:n.codec.codec,filters:n.filters.map(e=>e.filter)};r._blocksInProgress.add(a),i.push(l)}return new fS(i,()=>{i.forEach(e=>r._blocksInProgress.delete(e.blockIndex))},(e,a)=>{if(i.forEach(e=>r._blocksInProgress.delete(e.blockIndex)),e)throw e;a.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class fT{constructor({version:e,name:i,units:r,tileSize:a,pixelFormat:n,buffer:o,dataIndex:s},l){if(this.version=e,1!==this.version)throw new fy(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=r,this.tileSize=a,this.buffer=o,this.pixelFormat=fx[n],this.dataIndex=s,this.bandShape=[a+2*o,a+2*o,fv[this.pixelFormat]],this._decodedBlocks=new pL(l?l.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return fv[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){let i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(let[r,a]of this.dataIndex.entries()){for(let[n,o]of a.bands.entries())if(o===e)return{bandIndex:i+n,blockIndex:r,blockBandIndex:n};i+=a.bands.length}break;case"number":for(let[r,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:r,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new fy(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new fy(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let i=1/0,r=-1/0,a=[],n=new Set;for(let o of e){let{blockIndex:e}=this.getBlockForBand(o);if(e<0)throw new fy(`Invalid band: ${JSON.stringify(o)}`);let s=this.dataIndex[e];a.includes(e)||a.push(e),n.add(e),i=Math.min(i,s.firstByte),r=Math.max(r,s.lastByte)}if(n.size>this.cacheSize)throw new fy(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:r,blockIndices:a}}hasBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){let{blockIndex:i,blockBandIndex:r}=this.getBlockForBand(e),a=this._decodedBlocks.get(i.toString());if(!a)throw new fy(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);let n=this.dataIndex[i],o=this.bandShape.reduce((e,i)=>e*i,1),s=r*o,l=a.subarray(s,s+o);return{data:l,bytes:new Uint8Array(l.buffer).subarray(l.byteOffset,l.byteOffset+l.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}fw.setPbf=function(e){q=e};class fS{constructor(e,i,r){this.tasks=e,this._onCancel=i,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}fw.performDecoding=function(e,i){let r=new Uint8Array(e);return Promise.all(i.tasks.map(e=>
7{let{layerName:i,firstByte:a,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:l,filters:h,codec:u}=e,c=r.subarray(a,n+1),d=new Uint32Array(s[0]*s[1]*s[2]);if("gzip_data"!==u)throw new fy(`Unhandled codec: ${u}`);return(function(e,i){var r,a;if(!globalThis.DecompressionStream&&"gzip_data"===i)return Promise.resolve(((a=function(e){31==e[0]&&139==e[1]&&8==e[2]||ff(6,"invalid gzip data");var i=e[3],r=10;4&i&&(r+=2+(e[10]|e[11]<<8));for(var a=(i>>3&1)+(i>>4&1);a>0;a-=!e[r++]);return r+(2&i)}(e))+8>e.length&&ff(6,"invalid gzip data"),function(e,i,r){var a=e.length;if(!a||i.f&&!i.l)return r||new p1(0);var n=!r,o=n||2!=i.i,s=i.i;n&&(r=new p1(3*a));var l,h,u=function(e){var i=r.length;if(e>i){var a=new p1(Math.max(2*i,e));a.set(r),r=a}},c=i.f||0,d=i.p||0,p=i.b||0,f=i.l,m=i.d,_=i.m,g=i.n,y=8*a;do{if(!f){c=fc(e,d,1);var x=fc(e,d+1,3);if(d+=3,!x){var v=e[(z=4+((d+7)/8|0))-4]|e[z-3]<<8,b=z+v;if(b>a){s&&ff(0);break}o&&u(p+v),r.set(e.subarray(z,b),p),i.b=p+=v,i.p=d=8*b,i.f=c;continue}if(1==x)f=fl,m=fh,_=9,g=5;else if(2==x){var w=fc(e,d,31)+257,T=fc(e,d+10,15)+4,S=w+fc(e,d+5,31)+1;d+=14;for(var M=new p1(S),E=new p1(19),A=0;A<T;++A)E[p6[A]]=fc(e,d+3*A,7);d+=3*T;var I=fu(E),C=(1<<I)-1,P=fn(E,I);for(A=0;A<S;){var z,D=P[fc(e,d,C)];if(d+=15&D,(z=D>>4)<16)M[A++]=z;else{var R=0,L=0;for(16==z?(L=3+fc(e,d,3),d+=2,R=M[A-1]):17==z?(L=3+fc(e,d,7),d+=3):18==z&&(L=11+fc(e,d,127),d+=7);L--;)M[A++]=R}}var O=M.subarray(0,w),k=M.subarray(w);_=fu(O),g=fu(k),f=fn(O,_),m=fn(k,g)}else ff(1);if(d>y){s&&ff(0);break}}o&&u(p+131072);for(var F=(1<<_)-1,B=(1<<g)-1,N=d;;N=d){var V=(R=f[fd(e,d)&F])>>4;if((d+=15&R)>y){s&&ff(0);break}if(R||ff(2),V<256)r[p++]=V;else{if(256==V){N=d,f=null;break}var U=V-254;V>264&&(U=fc(e,d,(1<<(q=p4[A=V-257]))-1)+p7[A],d+=q);var j=m[fd(e,d)&B],G=j>>4;if(j||ff(3),d+=15&j,k=ft[G],G>3){var q=p5[G];k+=fd(e,d)&(1<<q)-1,d+=q}if(d>y){s&&ff(0);break}o&&u(p+131072);var Z=p+U;if(p<k){var H=0-k,$=Math.min(k,Z);for(H+p<0&&ff(3);p<$;++p)r[p]=(void 0)[H+p]}for(;p<Z;++p)r[p]=r[p-k]}}i.l=f,i.p=N,i.b=p,i.f=c,f&&(c=1,i.m=_,i.d=m,i.n=g)}while(!c);return p!=r.length&&n?(l=r,(null==(h=p)||h>l.length)&&(h=l.length),new p1(l.subarray(0,h))):r.subarray(0,p)}(e.subarray(a,-8),{i:2},new p1((e[(r=e.length)-4]|e[r-3]<<8|e[r-2]<<16|e[r-1]<<24)>>>0))));let n=fg[i];if(!n)throw Error(`Unhandled codec: ${i}`);let o=new globalThis.DecompressionStream(n);return new Response(new Blob([e]).stream().pipeThrough(o)).arrayBuffer().then(e=>new Uint8Array(e))})(c,u).then(e=>{var i;return i=new q(e),i.readFields(pQ,d),new(0,fb[o])(d.buffer)}).then(e=>{for(let i=h.length-1;i>=0;i--)switch(h[i]){case"delta_filter":!function(e,i){if(4!==i.length)throw Error(`Expected data of dimension 4 but got ${i.length}.`);let r=i[3];for(let a=2;a>=1;a--){let n=+(1===a),o=+(2===a);for(let a=0;a<i[0];a++){let s=i[1]*a;for(let a=n;a<i[1];a++){let n=i[2]*(a+s);for(let a=o;a<i[2];a++){let o=i[3]*(a+n);for(let a=0;a<i[3];a++){let i=o+a;e[i]+=e[i-r]}}}}r*=i[a]}}(e,s);break;case"zigzag_filter":var r=e;for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);break;case"bitshuffle_filter":!function(e,i){switch(i){case"uint32":return;case"uint16":for(let i=0;i<e.length;i+=2){let r=e[i],a=e[i+1];e[i]=(240&r)>>4|(61440&r)>>8|(240&a)<<4|61440&a,e[i+1]=15&r|(3840&r)>>4|(15&a)<<8|(3840&a)<<4}return;case"uint8":for(let i=0;i<e.length;i+=4){let r=e[i],a=e[i+1],n=e[i+2],o=e[i+3];e[i+0]=(192&r)>>6|(192&a)>>4|(192&n)>>2|192&o,e[i+1]=(48&r)>>4|(48&a)>>2|48&n|(48&o)<<2,e[i+2]=(12&r)>>2|12&a|(12&n)<<2|(12&o)<<4,e[i+3]=3&r|(3&a)<<2|(3&n)<<4|(3&o)<<6}return;default:throw Error(`Invalid pixel format, "${i}"`)}}(e,o);break;
7default:throw new fy(`Unhandled filter "${h[i]}"`)}return{layerName:i,blockIndex:l,data:e}}).catch(e=>{throw e})}))},aT(fS,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),aT(fw,"MapboxRasterTile"),aT(fT,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let fM,fE,fA,fI,fC,fP=null;function fz(){return e3()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:fE||tt.DRACO_URL}function fD(){if(e3()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(fI)return fI;let e=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]);if("object"!=typeof WebAssembly)throw Error("WebAssembly not supported, cannot instantiate meshoptimizer");return fI=WebAssembly.validate(e)?tt.MESHOPT_SIMD_URL:tt.MESHOPT_URL}let fR={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},fL={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},fO={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function fk(e,i,r){let a=r.json.bufferViews.length,n=r.buffers.length;i.bufferView=a,r.json.bufferViews[a]={buffer:n,byteLength:e.byteLength},r.buffers[n]=e}let fF="KHR_draco_mesh_compression",fB="EXT_meshopt_compression",fN=new TextDecoder("utf8");function fV(e,i){return new URL(e,i).href}function fU(e,i){let r=e.json.bufferViews[i];return new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function fj(e,i=0,r){let a={json:null,images:[],buffers:[]};if(0x46546c67===new Uint32Array(e,i,1)[0]){let r=new Uint32Array(e,i),n=2,o=(r[n++]>>2)-3,s=r[n++]>>2;if(n++,a.json=JSON.parse(fN.decode(r.subarray(n,n+s))),(n+=s)<o){let o=r[n++],s=i+(++n<<2);a.buffers[0]=e.slice(s,s+o)}}else a.json=JSON.parse(fN.decode(new Uint8Array(e,i)));let{buffers:n,images:o,meshes:s,extensionsUsed:l,bufferViews:h}=a.json,u=Promise.resolve();if(n){let e=[];for(let i=0;i<n.length;i++){let o=n[i];o.uri?e.push(function(e,i,r,a){return fetch(fV(e.uri,a)).then(e=>e.arrayBuffer()).then(e=>{i.buffers[r]=e})}(o,a,i,r)):a.buffers[i]||(a.buffers[i]=null)}u=Promise.all(e)}return u.then(()=>{let e=[],i=l&&l.includes(fF),n=l&&l.includes(fB);if(i&&e.push(function(){if(!fA)return null!=fM?fM:(fM=function(e){let i,r=null;function a(){i=new Uint8Array(r.buffer)}function n(){throw Error("Unexpected Draco error.")}let o={a:{a:n,d:function(e,r,a){return i.copyWithin(e,r,r+a)},c:function(e){let n=i.length,o=Math.ceil((Math.max(e>>>0,Math.ceil(1.2*n))-n)/65536);try{return r.grow(o),a(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,o))).then(e=>{let n,o,s,l,{Rb:h,Qb:u,P:c,T:d,X:p,Ja:f,La:m,Qa:_,Va:g,Wa:y,eb:x,jb:v,f:b,e:w,yb:T,zb:S,Ab:M,Bb:E,Db:A,Gb:I}=e.instance.exports;r=w;let C=(n=0,o=0,s=0,l=0,e=>{s&&(h(l),h(n),o+=s,s=n=0),n||(o+=128,n=u(o));let r=e.length+7&-8,a=n;r>=o&&(s=r,a=l=u(r));for(let r=0;r<e.length;r++)i[a+r]=e[r];return a});return a(),b(),{memory:w,_free:h,_malloc:u,Mesh:class{constructor(){this.ptr=c()}destroy(){d(this.ptr)}},Decoder:class{constructor(){this.ptr=f()}destroy(){v(this.ptr)}DecodeArrayToMesh(e,i,r){let a=C(e);return!!p(m(this.ptr,a,i,r.ptr))}GetAttributeByUniqueId(e,i){return{ptr:_(this.ptr,e.ptr,i)}}GetTrianglesUInt16Array(e,i,r){g(this.ptr,e.ptr,i,r)}GetTrianglesUInt32Array(e,i,r){y(this.ptr,e.ptr,i,r)}GetAttributeDataArrayForAllPoints(e,i,r,a,n){x(this.ptr,e.ptr,i.ptr,r,a,n)}},DT_INT8:T(),DT_UINT8:S(),DT_INT16:M(),DT_UINT16:E(),DT_UINT32:A(),DT_FLOAT32:I()}})}(fetch(fz()))).then(e=>{fA=e,fM=void 0})}()),n&&e.push(function(){var e;let i,r,a,n;if(fC)return;let o=(e=fetch(fD()),r=WebAssembly.instantiateStreaming(e,{}).then(e=>{(i=e.instance).exports.__wasm_call_ctors()}),a={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},{ready:r,supported:!0,decodeGltfBuffer(e,r,o,s,l,h){!function(e,i,r,a,n,o,s){let l=e.exp
7orts.sbrk,h=a+3&-4,u=l(h*n),c=l(o.length),d=new Uint8Array(e.exports.memory.buffer);d.set(o,c);let p=i(u,a,n,c,o.length);if(0===p&&s&&s(u,h,n),r.set(d.subarray(u,u+a*n)),l(u-l(0)),0!==p)throw Error(`Malformed buffer data: ${p}`)}(i,i.exports[n[l]],e,r,o,s,i.exports[a[h]])}});return o.ready.then(()=>{fC=o})}()),o)for(let i=0;i<o.length;i++)e.push(function(e,i,r,a){return e.uri?fetch(fV(e.uri,a)).then(e=>e.blob()).then(e=>createImageBitmap(e)).then(e=>{i.images[r]=e}):void 0!==e.bufferView?createImageBitmap(new Blob([fU(i,e.bufferView)],{type:e.mimeType})).then(e=>{i.images[r]=e}):void 0}(o[i],a,i,r));return(e.length?Promise.all(e):Promise.resolve()).then(()=>{if(i&&s)for(let{primitives:e}of s)for(let i of e)!function(e,i){let r=e.extensions&&e.extensions[fF];if(!r)return;let a=new fA.Decoder,n=fU(i,r.bufferView),o=new fA.Mesh;if(!a.DecodeArrayToMesh(n,n.byteLength,o))throw Error("Failed to decode Draco mesh");let s=i.json.accessors[e.indices],l=fR[s.componentType],h=s.count*l.BYTES_PER_ELEMENT,u=fA._malloc(h);for(let n of(l===Uint16Array?a.GetTrianglesUInt16Array(o,h,u):a.GetTrianglesUInt32Array(o,h,u),fk(fA.memory.buffer.slice(u,u+h),s,i),fA._free(u),Object.keys(r.attributes))){let s=a.GetAttributeByUniqueId(o,r.attributes[n]),l=i.json.accessors[e.attributes[n]],h=fL[l.componentType],u=l.count*fO[l.type]*fR[l.componentType].BYTES_PER_ELEMENT,c=fA._malloc(u);a.GetAttributeDataArrayForAllPoints(o,s,fA[h],u,c),fk(fA.memory.buffer.slice(c,c+u),l,i),fA._free(c)}a.destroy(),o.destroy(),delete e.extensions[fF]}(i,a);if(n&&s&&h)for(let e of h)!function(e,i){if(!e.extensions||!e.extensions[fB])return;let r=e.extensions[fB],a=new Uint8Array(i.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),n=new Uint8Array(r.count*r.byteStride);fC.decodeGltfBuffer(n,r.count,r.byteStride,a,r.mode,r.filter),e.buffer=i.buffers.length,e.byteOffset=0,i.buffers[e.buffer]=n.buffer,delete e.extensions[fB]}(e,a);return a})})}function fG(e,i){let r=e.json.bufferViews[i.bufferView],a=fR[i.componentType];return new a(e.buffers[r.buffer],(i.byteOffset||0)+(r.byteOffset||0),i.count*(r.byteStride&&r.byteStride!==fO[i.type]*a.BYTES_PER_ELEMENT?r.byteStride/a.BYTES_PER_ELEMENT:fO[i.type]))}function fq(e,i,r,a){let n=fR[i.componentType],o=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),s=e.json.bufferViews[i.bufferView],l=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:fO[i.type],h=r.float32,u=h.length/r.capacity;for(let e=0,r=0;e<i.count*l;e+=l,r+=u)for(let i=0;i<u;i++)h[r+i]=a[e+i]*o;r._trim()}function fZ(e){let i=function(e,i){let r=[],a=WebGL2RenderingContext;if(e.json.textures)for(let n of e.json.textures){let o={magFilter:a.LINEAR,minFilter:a.NEAREST,wrapS:a.REPEAT,wrapT:a.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),r.push({image:i[n.source],sampler:o,uploaded:!1})}return r}(e,e.images),r=function(e,i){let r=[];for(let a of e.json.meshes){let n=[];for(let r of a.primitives)n.push(function(e,i,r){let a=e.indices,n=e.attributes,o={};o.indexArray=new n7;let s=i.json.accessors[a],l=s.count/3;o.indexArray.reserve(l);let h=fG(i,s);for(let e=0;e<l;e++)o.indexArray.emplaceBack(h[3*e],h[3*e+1],h[3*e+2]);o.indexArray._trim(),o.vertexArray=new nY;let u=i.json.accessors[n.POSITION];o.vertexArray.reserve(u.count);let c=fG(i,u);for(let e=0;e<u.count;e++)o.vertexArray.emplaceBack(c[3*e],c[3*e+1],c[3*e+2]);if(o.vertexArray._trim(),o.aabb=new s1(u.min,u.max),o.centroid=function(e,i){let r=[0,0,0],a=e.length;if(a>0){for(let n=0;n<a;n++){let a=3*e[n];r[0]+=i[a],r[1]+=i[a+1],r[2]+=i[a+2]}r[0]/=a,r[1]/=a,r[2]/=a}return r}(h,c),void 0!==n.COLOR_0){let e=i.json.accessors[n.COLOR_0],r=fO[e.type],a=fG(i,e);o.colorArray=3===r?new nY:new n2,o.colorArray.resize(e.count),fq(i,e,o.colorArray,a)}if(void 0!==n.NORMAL){o.normalArray=new nY;let e=i.json.accessors[n.NORMAL];o.normalArray.resize(e.count);let r=fG(i,e);fq(i,e,o.normalArray,r)}if(void 0!==n.TEXCOORD_0&&r.length>0){o.texcoordArray=new oo;let e=i.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);let r=fG(i,e);fq(i,e,o.texcoordArray,r)}if(void 0!==n._FEATURE_ID_RGBA4444){let e=i.json.accessors[n._FEATURE_ID_RGBA4444];i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=fG(i,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(fG(i,i.json.accessors[n._FEATURE_RGBA4444]).buffer));let d=e.material;return o.material=function(e,i){let{emissiveFactor:r=[0,0,0],alphaMode:a="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:l,doubleSided:h}=e,{baseColorFactor:u=[1,1,1,1],metallicFactor:c=1,roughnessFactor:d=1,baseColorTexture:p,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},m=s?i[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&m){let e=s.extensions.KHR_texture_transform;m.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new tZ(...u),metallicFactor:c,roughnessFactor:d,baseColorTexture:p?i[p.index]:void 0,metallicRoughnessTexture:f?i[f.index]:void 0},doubleSided:h,emissiveFactor:r,alphaMode:a,alphaCutoff:n,normalTexture:o?i[o.index]:void 0,occlusionTexture:m,emissionTexture:l?i[l.index]:void 0,defined:void 0===e.defined}}(void 0!==d?i.json.materials[d]:{defined:!1},r),o}(r,e,i));r.push(n)}return r}(e,i),{scenes:a,scene:n,nodes:o}=e.json,s=a?a[n||0].nodes:o,l=[];for(let i of s)l.push(function e(i,r,a){let{matrix:n,rotation:o,translation:s,scale:l,mesh:h,extras:u,children:c}=i,d={};if(d.matrix=n||eP.mat4.fromRotationTranslationScale([],o||[0,0,0,1],s||[0,0,0],l||[1,1,1]),void 0!==h){d.meshes=a[h];let e=d.anchor=[0,0];for(let i of d.meshes){let{min:r,max:a}=i.aabb;e[0]+=r[0]+a[0],e[1]+=r[1]+a[1]}e[0]=Math.floor(e[0]/d.meshes.length/2),e[1]=Math.floor(e[1]/d.meshes.length/2)}if(u&&(u.id&&(d.id=u.id),u.lights&&(d.lights=function(e){if(!e.length)return[];let i=function(e){let i=atob(e),r=new Uint8Array(i.length);for(let e=0;e<i.length;
7e++)r[e]=i.codePointAt(e);return r}(e),r=[],a=i.length/24,n=new Uint16Array(i.buffer),o=new Float32Array(i.buffer);for(let e=0;e<a;e++){let i=n[2*e*6]/30,a=n[2*e*6+1]/30,s=n[2*e*6+10]/100,l=o[6*e+1],h=o[6*e+2],u=o[6*e+3],c=o[6*e+4],d=u-l,p=c-h,f=Math.hypot(d,p);r.push({pos:[l+.5*d,h+.5*p,a],normal:[p/f,-d/f,0],width:f,height:i,depth:s,points:[l,h,u,c]})}return r}(u.lights))),c){let i=[];for(let n of c)i.push(e(r.json.nodes[n],r,a));d.children=i}return d}(o[i],e,r));return function(e,i,r){let a={},n=new Set;for(let o=0;o<e.length;o++){let e=r[i[o]];if(!e.extras)continue;let s=e.extras["mapbox:footprint:version"],l=e.extras["mapbox:footprint:id"];(s||l)&&n.add(o),"1.0.0"===s&&l&&(a[l]=o)}for(let o=0;o<e.length;o++){if(n.has(o))continue;let s=e[o],l=r[i[o]];if(!l.extras)continue;let h=null;s.id in a&&(h=function(e,i){let r=[],a=[],n=0,o=[];for(let s of e){n=r.length;let e=s.vertexArray.float32,l=s.indexArray.uint16;for(let a=0;a<s.vertexArray.length;a++)o[0]=e[3*a+0],o[1]=e[3*a+1],o[2]=e[3*a+2],eP.vec3.transformMat4(o,o,i),r.push(new eR(o[0],o[1]));for(let e=0;e<3*s.indexArray.length;e++)a.push(l[e]+n)}if(a.length%3!=0)return null;for(let e=0;e<a.length;e+=3){let i=r[a[e+0]],n=r[a[e+1]],o=r[a[e+2]];(i.x-n.x)*(o.y-n.y)-(o.x-n.x)*(i.y-n.y)>0&&([a[e+1],a[e+2]]=[a[e+2],a[e+1]])}return{vertices:r,indices:a}}(e[a[s.id]].meshes,s.matrix)),h||(h=function(e){if(!e.extras||!e.extras.ground)return null;let i=e.extras.ground;if(!i||!Array.isArray(i)||0===i.length)return null;let r=i[0];if(!r||!Array.isArray(r)||0===r.length)return null;let a=[];for(let e of r){if(!Array.isArray(e)||2!==e.length)continue;let i=e[0],r=e[1];"number"==typeof i&&"number"==typeof r&&a.push(new eR(i,r))}if(a.length<3)return null;a.length>1&&a[a.length-1].equals(a[0])&&a.pop();let n=0;for(let e=0;e<a.length;e++){let i=a[e],r=a[(e+1)%a.length],o=a[(e+2)%a.length];n+=(i.x-r.x)*(o.y-r.y)-(o.x-r.x)*(i.y-r.y)}n>0&&a.reverse();let o=lL(a.flatMap(e=>[e.x,e.y]),[]);return 0===o.length?null:{vertices:a,indices:o}}(l)),h&&(s.footprint=function(e){if(0===e.vertices.length||0===e.indices.length)return null;let i=new hy(e.vertices,e.indices,8,256),[r,a]=[i.min.clone(),i.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:i,min:r,max:a}}(h))}if(n.size>0){let i=Array.from(n.values()).sort((e,i)=>e-i);for(let r=i.length-1;r>=0;r--)e.splice(i[r],1)}}(l,s,e.json.nodes),l}class fH{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const r=e[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}let f$=["id","tile","layer","source","sourceLayer","state"];class fW{constructor(e,i,r,a,n){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=r,this._y=a,this.properties=e.properties,this.id=n}clone(){let e=new fW(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(let i of f$)void 0!==this[i]&&(e[i]=this[i]);return e}}class fX{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ab(8192,16,0),this.featureIndexArray=new ow,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,r,a,n,o=0,s=0){let l=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,a,n,o);let h=this.grid;for(let e=0;e<i.length;e++){let r=i[e],a=[1/0,1/0,-1/0,-1/0];for(let e=0;e<r.length;e++){let i=r[e];a[0]=Math.min(a[0],i.x),a[1]=Math.min(a[1],i.y),a[2]=Math.max(a[2],i.x),a[3]=Math.max(a[3],i.y)}
70!==s&&(a[0]-=s,a[1]-=s,a[2]+=s,a[3]+=s),a[0]<8192&&a[1]<8192&&a[2]>=0&&a[3]>=0&&h.insert(l,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(let e in this.vtLayers=new hi.VectorTile(new uH(this.rawTileData)).layers,this.sourceLayerCoder=new fH(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}query(e,i){let r,{tilespaceGeometry:a,transform:n,tileTransform:o,pixelPosMatrix:s,availableImages:l}=i;this.loadVTLayers(),this.serializedLayersCache.clear();let h=a.bufferedTilespaceBounds,u=this.grid.query(h.min.x,h.min.y,h.max.x,h.max.y,(e,i,r,n)=>sI(a.bufferedTilespaceGeometry,e,i,r,n));u.sort(fK);let c=null;n.elevation&&u.length>0&&(c=dV.create(n.elevation,this.tileID));let d={};for(let i=0;i<u.length;i++){let h=u[i];if(h===r)continue;r=h;let p=this.featureIndexArray.get(h),f=null;this.is3DTile?this.loadMatchingModelFeature(d,p,e,a,n):this.loadMatchingFeature(d,p,e,l,(e,i,r,l=0)=>(f||(f=s_(e,this.tileID.canonical,o)),i.queryIntersectsFeature(a,e,r,f,this.z,n,s,c,l)))}return d}loadMatchingFeature(e,i,r,a,n){let{featureIndex:o,bucketIndex:s,sourceLayerIndex:l,layoutVertexArrayOffset:h}=i,u=this.bucketLayerIDs[s],c=r.layers,d=Object.keys(c);if(d.length&&!function(e,i){for(let r=0;r<e.length;r++)if(i.indexOf(e[r])>=0)return!0;return!1}(d,u))return;let p=r.sourceCache,f=this.sourceLayerCoder.decode(l),m=this.vtLayers[f].feature(o),_=this.getId(m,f);for(let i=0;i<u.length;i++){let r=u[i];if(!c[r])continue;let{styleLayer:s,targets:l}=c[r],d={};void 0!==_&&(d=p.getFeatureState(s.sourceLayer,_));let f=!n||n(m,s,d,h);if(!f)continue;let g=new fW(m,this.z,this.x,this.y,_);g.tile=this.tileID.canonical,g.state=d;let y=this.serializedLayersCache.get(r);y||((y=s.serialize()).id=r,this.serializedLayersCache.set(r,y)),g.source=y.source,g.sourceLayer=y["source-layer"],g.layer=eZ({},y),g.layer.paint=fY(y.paint,s.paint,m,d,a),g.layer.layout=fY(y.layout,s.layout,m,d,a);let x=!1;for(let e of l){this.updateFeatureProperties(g,e);let{filter:i}=e;if(i){if(m.properties=g.properties,i.needGeometry){let e=sg(m,!0);if(!i.filter(new nl(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!i.filter(new nl(this.tileID.overscaledZ),m))continue}x=!0,e.targetId&&this.addFeatureVariant(g,e)}x&&this.appendToResult(e,r,o,g,f)}}loadMatchingModelFeature(e,i,r,a,n){let o=this.bucketLayerIDs[0][0],s=r.layers;if(!s[o])return;let{styleLayer:l,targets:h}=s[o];if("model"!==l.type)return;let u=a.tile,c=i.featureIndex,d=u.getBucket(l);if(!(d&&d instanceof dZ))return;let p=function(e,i,r,a){let n=e.getNodesInfo()[i];if(n.hiddenByReplacement||!n.node.meshes)return;let o=Number.MAX_VALUE,s=n.node,l=r.tile,h=a.calculatePosMatrix(l.tileID.toUnwrapped(),a.worldSize),u=n.evaluatedScale,c=0;a.elevation&&s.elevation&&(c=s.elevation*a.elevation.exaggeration()),eP.mat4.translate(h,h,[(s.anchor?s.anchor[0]:0)*(u[0]-1),(s.anchor?s.anchor[1]:0)*(u[1]-1),c]),eP.mat4.scale(h,h,u);let d=r.queryGeometry,p=d.isPointQuery()?d.screenBounds:d.screenGeometry,f=function(e){let i=eP.mat4.multiply([],h,e.matrix);eP.mat4.multiply(i,a.expandedFarZProjMatrix,i);for(let r=0;r<e.meshes.length;++r){let n=e.meshes[r];if(r===e.lightMeshIndex)continue;let s=dv(p,a,i,n.aabb);null!=s&&(o=Math.min(s,o))}if(e.children)for(let i of e.children)f(i)};if(f(s),o===Number.MAX_VALUE)return;let m=new st(0,0);return d$(l.tileID.canonical,m,n.node.anchor[0],n.node.anchor[1]),{intersectionZ:o,position:m,feature:n.feature}}(d,c,a,n);if(!p)return;let{z:f,x:m,y:_}=u.tileID.canonical,{feature:g,intersectionZ:y,position:x}=p,v={};void 0!==g.id&&(v=r.sourceCache.getFeatureState(l.sourceLayer,g.id));let b=new fW({},f,m,_,g.id);b.tile=this.tileID.canonical,b.state=v,b.properties=g.properties,b.geometry={type:"Point",coordinates:[x.lng,x.lat]};let w=this.serializedLayersCache.get(o);w||((w=l.serialize()).id=o,this.serializedLayersCache.set(o,w)),b.source=w.source,b.sourceLayer=w["source-layer"],b.layer=eZ({},w);let T=!1;for(let e of h){this.updateFeatureProperties(b,e);let{filter:i}=e;if(i){if(g.properties=b.properties,i.needGeometry){if(!i.filter(new nl(this.tileID.overscaledZ
7),g,this.tileID.canonical))continue}else if(!i.filter(new nl(this.tileID.overscaledZ),g))continue}T=!0,e.targetId&&this.addFeatureVariant(b,e)}T&&this.appendToResult(e,o,c,b,y)}updateFeatureProperties(e,i,r){if(i.properties){let a={};for(let n in i.properties){let o=i.properties[n].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,r);null!=o&&(a[n]=o)}e.properties=a}}addFeatureVariant(e,i,r){let a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,r,a,n){let o=e[i];void 0===o&&(o=e[i]=[]),o.push({featureIndex:r,feature:a,intersectionZ:n})}lookupSymbolFeatures(e,i,r,a,n){let o={};for(let s of(this.loadVTLayers(),e))this.loadMatchingFeature(o,{bucketIndex:i,sourceLayerIndex:r,featureIndex:s,layoutVertexArrayOffset:0},a,n);return o}loadFeature(e){let{featureIndex:i,sourceLayerIndex:r}=e;this.loadVTLayers();let a=this.sourceLayerCoder.decode(r),n=this.vtFeatures[a];if(n[i])return n[i];let o=this.vtLayers[a].feature(i);return n[i]=o,o}hasLayer(e){for(let i of this.bucketLayerIDs)for(let r of i)if(e===r)return!0;return!1}getId(e,i){let r=e.id;if(this.promoteId){let a=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[i];if(null!=a)if(Array.isArray(a)){if(!this.promoteIdExpression){let e=af(a);if("success"!==e.result){let i=e.value.map(e=>`${e.key}: ${e.message}`).join(", ");return void e0(`Failed to create expression for promoteId: ${i}`)}this.promoteIdExpression=e.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new iA),r=this.promoteIdExpression.evaluate({zoom:0},e)}else r=e.properties[a];"boolean"==typeof r&&(r=Number(r))}return r}}function fY(e,i,r,a,n){return eY(e,(e,o)=>{let s=i instanceof n_?i.get(o):null;return s&&s.evaluate?s.evaluate(r,a,n):s})}function fK(e,i){return i-e}aT(fX,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let fJ=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class fQ{static from(e){if(!(e instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(e,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let n=fJ[15&r];if(!n)throw Error("Unrecognized array type.");let[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new fQ(s,o,n,e)}constructor(e,i=64,r=Float64Array,a){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=fJ.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${r}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+l,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+l),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=i,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return function e(i,r,a,n,o,s){if(o-n<=a)return;let l=n+o>>1;(function e(i,r,a,n,o,s){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);e(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[2*a+s],h=n,u=o;for(f0(i,r,n,a),r[2*o+s]>l&&f0(i,r,n,o);h<u;){for(f0(i,r,h,u),h++,u--;r[2*h+s]<l;)h++;for(;r[2*u+s]>l;)u--}r[2*n+s]===l?f0(i,r,n,u):f0(i,r,++u,o),u<=a&&(n=u+1),a<=u&&(o=u-1)}})(i,r,l,n,o,s),e(i,r,a,n,l-1,1-s),e(i,r,a,l+1,o,1-s)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:s}=this,l=[0,n.length-1,0],h=[];for(;l.length;){let u=l.pop()||0,c=l.pop()||0,d=l.pop()||0;if(c-d<=s){for(let s=d;s<=c;s++){let l=o[2*s],u=o[2*s+1];l>=e&&l<=r&&u>=i&&u<=a&&h.push(n[s])}continue}let p=d+c>>1,f=o[2*p],m=o[2*p+1];f>=e&&f<=r&&m>=i&&m<=a&&h.push(n[p]),(0===u?e<=f:i<=m)&&(l.push(d),l.push(p-1),l.push(1-u)),(0===u?r>=f:a>=m)&&(l.push(p+1),l.push(c),l.push(1-u))}return h}within(e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:o}=this,s=[0,a.length-1,0],l=[],h=r*r;for(;s.length;){let u=s.pop()||0,c=s.pop()||0,d=s.pop()||0;
7if(c-d<=o){for(let r=d;r<=c;r++)f2(n[2*r],n[2*r+1],e,i)<=h&&l.push(a[r]);continue}let p=d+c>>1,f=n[2*p],m=n[2*p+1];f2(f,m,e,i)<=h&&l.push(a[p]),(0===u?e-r<=f:i-r<=m)&&(s.push(d),s.push(p-1),s.push(1-u)),(0===u?e+r>=f:i+r>=m)&&(s.push(p+1),s.push(c),s.push(1-u))}return l}}function f0(e,i,r,a){f1(e,r,a),f1(i,2*r,2*a),f1(i,2*r+1,2*a+1)}function f1(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function f2(e,i,r,a){let n=e-r,o=i-a;return n*n+o*o}e.$=iI,e.A=tk,e.B=iu,e.C=nR,e.D=d1,e.E=tV,e.F=2,e.G=ca,e.H=cr,e.I=tU,e.J=class extends dC{},e.K=iT,e.L=tK,e.M=nw,e.N=aa,e.O=at,e.P=eR,e.Q=ar,e.R=tw,e.S=ap,e.T=de,e.U=nT,e.V=dC,e.W=ag,e.X=af,e.Y=rc,e.Z=rp,e._=ru,e.a=function(e){return tt.API_CDN_URL_REGEX.test(e)},e.a$=sg,e.a0=tq,e.a1=nS,e.a2=an,e.a3=ai,e.a4=function(e){let i=e.value,r=[];if(!i)return r;let a=iT(i);return"string"!==a?r=r.concat([new dC(e.key,i,`string expected, "${a}" found`)]):(dP(i,!0)||(r=r.concat([new dC(e.key,i,`invalid url "${i}"`)])),r)},e.a5=nb,e.a6=nc,e.a7=nv,e.a8=ng,e.a9=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e2(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t$(e.x,i.x,r),y:t$(e.y,i.y,r),z:t$(e.z,i.z,r),azimuthal:t$(e.azimuthal,i.azimuthal,r),polar:t$(e.polar,i.polar,r)}}},e.aA=function(e,i){let r={};for(let a=0;a<i.length;a++){let n=i[a];n in e&&(r[n]=e[n])}return r},e.aB=si,e.aC=sn,e.aD=class{constructor(e){this.entries={},this.scheduler=e}request(e,i,r,a){let n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){let[e,r]=n.result;return this.scheduler?this.scheduler.add(()=>{a(e,r)},i):a(e,r),()=>{}}return n.callbacks.push(a),n.cancel||(n.cancel=r((r,a)=>{for(let e of(n.result=[r,a],n.callbacks))this.scheduler?this.scheduler.add(()=>{e(r,a)},i):e(r,a);setTimeout(()=>delete this.entries[e],3e3)})),()=>{n.result||(n.callbacks=n.callbacks.filter(e=>e!==a),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.aE=function(e,i,r){let a=JSON.stringify(e.request);return e.data&&(this.deduped.entries[a]={result:[null,e.data]}),this.deduped.request(a,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},i=>{let a=tE(e.request,(e,a,n,o)=>{e?i(e):a&&i(null,{vectorTile:r?void 0:new hi.VectorTile(new uH(a)),rawData:a,cacheControl:n,expires:o})});return()=>{a.cancel(),i()}},i)},e.aF=function(e){++tf>tu&&(e.getActor().send("enforceCacheSizeLimit",th),tf=0)},e.aG=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.aH=sU,e.aI=ds,e.aJ=dl,e.aK=dn,e.aL=function(e,i){let r=document.createElement("video");r.muted=!0,r.onloadstart=function(){i(null,r)};for(let i=0;i<e.length;i++){let a=document.createElement("source");(function(e){let i=document.createElement("a");return i.href=e,i.protocol===location.protocol&&i.host===location.host})(e[i])||(r.crossOrigin="Anonymous"),a.src=e[i],r.appendChild(a)}return{cancel:()=>{}}},e.aM=dt,e.aN=function(e){return fetch(e).then(e=>e.arrayBuffer()).then(i=>fj(i,0,e))},e.aO=fZ,e.aP=class{constructor(e,i,r,a){this.id=e,this.position=null!=i?new st(i[0],i[1]):new st(0,0),this.orientation=null!=r?r:[0,0,0],this.nodes=a,this.uploaded=!1,this.aabb=new s1([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){if(eP.mat4.multiply(e.matrix,i,e.matrix),e.meshes)for(let i of e.meshes){let r=s1.applyTransformFast(i.aabb,e.matrix);this.aabb.encapsulate(r)}if(e.children)for(let i of e.children)this._applyTransformations(i,e.matrix)}computeBoundsAndApplyParent(){let e=eP.mat4.identity([]);for(let i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,r,a,n,o,s=!1){dO(this.matrix,this,e.transform,this.position,i,r,a,n,o,s)}upload(e){if(!this.uploaded){for(let i of this.nodes)dF(i,e);for(let e of this.nodes)dB(e);this.uploaded=!0}}destroy(){for(let e of this.nodes)dN(e)}},e.aQ=eX,e.aR=cP,e.aS=so,e.aT=ss,e.aU=nq,e.aV=n7,e.aW=e$,e.aX=of,e.aY=c3,e.aZ=function(){ns.isLoading()||ns.isLoaded()||"deferred"!==nn()||no()},e.a_=nM,e.aa=nl,e.ab=a_,e.ac=sp,e.ad=eP,e.ae=ej,e.af=n_,e.ag=lc,e.ah=t$,e.ai=8192,e.aj=tW,e.ak=function(e){return e*eO},e.al=tZ,e.am=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return function([e,i]){let r=e2([1,e,i]);return{x:r.x,y:r.y,z:r.z}}(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t$(e.x,i.x,r),y:t$(e.y,i.y,r),z:t$(e.z,i.z,r)}}},e.an=function(e,i,r=0,a=!0){let n=new eR(r,r),o=e.sub(n),s=i.add(n),l=[o,new eR(s.x,o.y),s,new eR(o.x,s.y)];return a&&l.push(o.clone()),l},e.ao=function(e,i){let r=[];for(let a=0;a<e.length;a++){let n=eG(a-1,-1,e.length-1),o=eG(a+1,-1,e.length-1),s=e[a],l=e[o],h=e[n].sub(s).unit(),u=l.sub(s).unit(),c=u.angleWithSep(h.x,h.y),d=h.add(u).unit().mult(-1*i/Math.sin(c/2));
7r.push(s.add(d))}return r},e.ap=cz,e.aq=sI,e.ar=function(e,i,r=0){return eP.vec3.fromValues(((i.x-r)*e.scale-e.x)*8192,(i.y*e.scale-e.y)*8192,sl(i.z,i.y))},e.as=sW,e.at=uy,e.au=function(e){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let o of e)i=Math.min(i,o.x),r=Math.min(r,o.y),a=Math.max(a,o.x),n=Math.max(n,o.y);return{min:new eR(i,r),max:new eR(a,n)}},e.av=sa,e.aw=sA,e.ax=sf,e.ay=eU,e.az=o5,e.b=function(e){return tt.API_FONTS_REGEX.test(e)},e.b$=dp,e.b0=fW,e.b1=e4,e.b2=u_,e.b3=hg,e.b4=s_,e.b5=nj,e.b6=ol,e.b7=sH,e.b8=oI,e.b9=lL,e.bA=hj,e.bB=cS,e.bC=cx,e.bD=u5,e.bE=fQ,e.bF=eG,e.bG=e6,e.bH=function(e,i){return e/sr(i)},e.bI=function(e,i,r){e[4*i+0]=r[0],e[4*i+1]=r[1],e[4*i+2]=r[2],e[4*i+3]=r[3]},e.bJ=oG,e.bK=oB,e.bL=oN,e.bM=oF,e.bN=ok,e.bO=st,e.bP=cW,e.bQ=sV,e.bR=s0,e.bS=dd,e.bT=sN,e.bU=le,e.bV=function(e,i,r,a,n,o,s,l,h){if("globe"===h.name)return le(e,i,new sN(r,a,n),!1);let u=cP({z:r,x:a,y:n},h);return new s1([(o+u.x/u.scale)*i,i*(u.y/u.scale),s],[(o+u.x2/u.scale)*i,i*(u.y2/u.scale),l])},e.bW=function(e,i,r){let a=0;for(let r=0;r<2;++r)e[r]>0&&(a+=(e[r]-0)*(e[r]-0)),i[r]<0&&(a+=(0-i[r])*(0-i[r]));return a},e.bX=85.051129,e.bY=6,e.bZ=function(e){let i=eP.mat4.identity(new Float64Array(16));eP.mat4.multiply(i,e.pixelMatrix,e.globeMatrix);let r=[0,o8,0],a=[0,o5,0];return eP.vec3.transformMat4(r,r,i),eP.vec3.transformMat4(a,a,i),[r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!lp(e,new st(e.center.lat,90)),a[0]>0&&a[0]<=e.width&&a[1]>0&&a[1]<=e.height&&!lp(e,new st(e.center.lat,-90))]},e.b_=function(e,i){let{scale:r}=e.tileTransform,a=8192*r/(e.tileSize*Math.pow(2,i.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return eP.mat2.scale(new Float32Array(4),i.inverseAdjustmentMatrix,[a,a])},e.ba=c8,e.bb=function(e,i){let r=lc(i.zoom);if(0===r)return s8(e);let a=lt(e),n=li(a),o=sa(a.getWest())*i.worldSize,s=sa(a.getEast())*i.worldSize,l=sn(a.getNorth())*i.worldSize,h=sn(a.getSouth())*i.worldSize,u=[o,l,0],c=[s,l,0],d=[o,h,0],p=[s,h,0],f=eP.mat4.invert([],i.globeMatrix);return eP.vec3.transformMat4(u,u,f),eP.vec3.transformMat4(c,c,f),eP.vec3.transformMat4(d,d,f),eP.vec3.transformMat4(p,p,f),n[0]=s9(n[0],d,r),n[1]=s9(n[1],p,r),n[2]=s9(n[2],c,r),n[3]=s9(n[3],u,r),s1.fromPoints(n)},e.bc=lo,e.bd=lr,e.be=s9,e.bf=nG,e.bg=sZ,e.bh=fw,e.bi=uH,e.bj=tE,e.bk=function(e,i){let r=[];for(let a in e)a in i||r.push(a);return r},e.bl=eq,e.bm=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.bn=eL,e.bo=function(e,i){let{x:r,y:a}=e.point,n=lu(r,a,e.worldSize/e._pixelsPerMercatorPixel,0,0);return eP.mat4.multiply(n,n,ls(s8(i)))},e.bp=uB,e.bq=uY,e.br=uF,e.bs=function(e,i,r,a,n){let o=5*i+2;e.float32[o+0]=r,e.float32[o+1]=a,e.float32[o+2]=n},e.bt=c0,e.bu=ci,e.bv=sb,e.bw=24,e.bx=hL,e.by=dI,e.bz=hU,e.c=tr,e.c$=uw,e.c0=dc,e.c1=function(e){let i=dc(e,!0);return eP.mat2.invert([],[i[0],i[1],i[4],i[5]])},e.c2=sX,e.c3=function(e){let{x:i,y:r}=e.point,{lng:a,lat:n}=e._center;return lu(i,r,e.worldSize,a,n)},e.c4=function(e){return e*ek},e.c5=sj,e.c6=5,e.c7=function(e){return eF[Math.round((e+45+360)%360/90)%4]},e.c8=45,e.c9=tX,e.cA=oU,e.cB=class extends oO{constructor(e){super(e),this.current=oq}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let e=0;e<9;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}}},e.cC=eB,e.cD=function(e,i,r){let a=lc(r.zoom),n=e.style.map._antialias,o=e.terrain&&e.terrain.exaggeration()>0;return 0===a&&!n&&!o},e.cE=function(e){let i=e.pixelsPerMeter,r=i/(1/sr(e.center.lat)),a=eP.mat4.identity(new Float64Array(16));return eP.mat4.translate(a,a,[e.point.x,e.point.y,0]),eP.mat4.scale(a,a,[r,r,i]),Float32Array.from(a)},e.cF=lt,e.cG=function(e){return Math.round(Math.pow(Math.abs(Math.sin((e=eU(e,-80.051129,80.051129)/80.051129*90)*eO)),3)*(o6.length-1))},e.cH=function(e,i,r,a){let n=i.getNorth(),o=i.getSouth(),s=i.getWest(),l=i.getEast(),h=1<<e.z,u=l-s,c=n-o,d=u/64,p=-c/o6[r],f=[0,d,0,p,0,0,n,s,0];if(e.z>0){let e=180/a;eP.mat3.multiply(f,f,[e/u+1,0,0,0,e/c+1,0,-.5*e/d,.5*e/p,1])}return f[2]=h,f[5]=e.x,f[8]=e.y,f},e.cI=s8,e.cJ=function(e,i,r){let a=eP.mat4.identity(new Float64Array(16)),n=(i/(1<<e)-.5)*Math.PI*2;return eP.mat4.rotateY(a,r.globeMatrix,n),Float32Array.from(a)},e.cK=class{isDataAvailableAtPoint(e){let i=this._source();if(this.isUsingMockSource()||!i||e.y<0||e.y>1)return!1;let r=i.getSource().maxzoom,a=1<<r,n=Math.floor(e.x),o=Math.floor((e.x-n)*a),s=Math.floor(e.y*a),l=this.findDEMTileFor(new sU(r,n,r,o,s));return!(!l||!l.dem)}
7getAtPointOrZero(e,i=0){return this.getAtPoint(e,i)||0}getAtPoint(e,i,r=!0){if(this.isUsingMockSource())return null;null==i&&(i=null);let a=this._source();if(!a||e.y<0||e.y>1)return i;let n=a.getSource().maxzoom,o=1<<n,s=Math.floor(e.x),l=e.x-s,h=new sU(n,s,n,Math.floor(l*o),Math.floor(e.y*o)),u=this.findDEMTileFor(h);if(!u||!u.dem)return i;let c=u.dem,d=1<<u.tileID.canonical.z,p=(l*d-u.tileID.canonical.x)*c.dim,f=(e.y*d-u.tileID.canonical.y)*c.dim,m=Math.floor(p),_=Math.floor(f);return(r?this.exaggeration():1)*t$(t$(c.get(m,_),c.get(m,_+1),f-_),t$(c.get(m+1,_),c.get(m+1,_+1),f-_),p-m)}getAtTileOffset(e,i,r){let a=1<<e.canonical.z;return this.getAtPointOrZero(new sp(e.wrap+(e.canonical.x+i/8192)/a,(e.canonical.y+r/8192)/a))}getAtTileOffsetFunc(e,i,r,a){return n=>{let o=this.getAtTileOffset(e,n.x,n.y),s=a.upVector(e.canonical,n.x,n.y),l=a.upVectorScale(e.canonical,i,r).metersToTile;return eP.vec3.scale(s,s,o*l),s}}getForTilePoints(e,i,r,a){if(this.isUsingMockSource())return!1;let n=dV.create(this,e,a);return!!n&&(i.forEach(e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],r)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;let i=this.findDEMTileFor(e);if(!i||!i.dem)return null;let r=i.dem.tree,a=i.tileID,n=1<<e.canonical.z-a.canonical.z,o=e.canonical.x/n-a.canonical.x,s=e.canonical.y/n-a.canonical.y,l=0;for(let i=0;i<e.canonical.z-a.canonical.z&&!r.leaves[l];i++){let e=2*Math.floor(s*=2)+Math.floor(o*=2);l=r.childOffsets[l]+e,o%=1,s%=1}return{min:this.exaggeration()*r.minimums[l],max:this.exaggeration()*r.maximums[l]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(e,i,r){throw Error("Pure virtual method called.")}pointCoordinate(e){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(e){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){let e=this.visibleDemTiles;if(0===e.length)return null;let i=!1,r=Number.MAX_VALUE,a=5e-324;for(let n of e){let e=this.getMinMaxForTile(n.tileID);e&&(r=Math.min(r,e.min),a=Math.max(a,e.max),i=!0)}return i?{min:r,max:a}:null}},e.cL=lI,e.cM=s2,e.cN=function(e,i){return[Math.pow(e[0],2.2)*i,Math.pow(e[1],2.2)*i,Math.pow(e[2],2.2)*i]},e.cO=lh,e.cP=te,e.cQ=e7,e.cR=256,e.cS=function(e,i){let r=[0,0,0],a=lo(s8(i.canonical));return eP.vec3.transformMat4(r,r,a),eP.vec3.transformMat4(r,r,e),r},e.cT=e=>({u_camera_to_center_distance:new oF(e),u_extrude_scale:new oH(e),u_device_pixel_ratio:new oF(e),u_matrix:new oG(e),u_inv_rot_matrix:new oG(e),u_merc_center:new oB(e),u_tile_id:new oN(e),u_zoom_transition:new oF(e),u_up_dir:new oN(e),u_emissive_strength:new oF(e)}),e.cU=e=>({u_matrix:new oG(e),u_pixels_to_tile_units:new oH(e),u_device_pixel_ratio:new oF(e),u_width_scale:new oF(e),u_floor_width_scale:new oF(e),u_units_to_pixels:new oB(e),u_dash_image:new ok(e),u_gradient_image:new ok(e),u_image_height:new oF(e),u_texsize:new oB(e),u_tile_units_to_pixels:new oF(e),u_alpha_discard_threshold:new oF(e),u_trim_offset:new oB(e),u_trim_fade_range:new oB(e),u_trim_color:new oV(e),u_emissive_strength:new oF(e),u_zbias_factor:new oF(e),u_tile_to_meter:new oF(e)}),e.cV=e=>({u_matrix:new oG(e),u_texsize:new oB(e),u_pixels_to_tile_units:new oH(e),u_device_pixel_ratio:new oF(e),u_width_scale:new oF(e),u_floor_width_scale:new oF(e),u_image:new ok(e),u_units_to_pixels:new oB(e),u_tile_units_to_pixels:new oF(e),u_alpha_discard_threshold:new oF(e),u_trim_offset:new oB(e),u_trim_fade_range:new oB(e),u_trim_color:new oV(e),u_emissive_strength:new oF(e),u_zbias_factor:new oF(e),u_tile_to_meter:new oF(e)}),e.cW=n8,e.cX=uL,e.cY=uN,e.cZ=ly,e.c_=(e,i,r,a,n,o)=>{let s,l=e.transform,h="globe"===l.projection.name;if("map"===o.paint.get("circle-pitch-alignment"))if(h){let e=lh(l.zoom,i.canonical)*l._pixelsPerMercatorPixel;s=Float32Array.from([e,0,0,e])}else s=l.calculatePixelsToTileUnitsMatrix(r);else s=new Float32Array([l.pixelsToGLUnits[0],0,0,l.pixelsToGLUnits[1]]);let u={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(l.projection),u_matrix:e.translatePosMatrix(i.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:tn.devicePixelRatio,u_extrude_scale:s,u_inv_rot_matrix:lg,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(h){u.u_inv_rot_matrix=a,u.u_merc_center=n,u.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],u.u_zoom_transition=lc(l.zoom);let e=8192*n[0],r=8192*n[1];u.u_up_dir=l.projection.upVector(new sN(0,0,0),e,r)}return u},e.ca=sr,e.cb=oV,e.cc=function(e,i,r){let a=Math.sqrt(e*e+i*i+r*r),n=a>0?Math.acos(r/a)*ek:0,o=0!==e||0!==i?Math.atan2(-i,-e)*ek+90:0;return o<0&&(o+=360),[a,o,n]},e.cd=sd,e.ce=s1,e.cf=e2,e.cg=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.ch=function(e,i){return e.readFields(pe,{icons:[]},i)},e.ci=function(e){return e({pluginStatus:ne,pluginURL:nt}),na.on("pluginStateChange",e),e},e.cj=d2,e.ck=cu,e.cl=ch,e.cm=tS,e.cn=ni,e.co=ts,e.cp=tO,e.cq=eJ,e.cr=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(0,i):e},e.cs=function(e){return e.indexOf("\x1f")>=0},e.ct=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(i+1):""},e.cu=function(e){let i=[],r=e.id;return void 0===r&&i.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&i.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&i.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),i},e.cv=function(e,i,r,a){return"custom"===e.type?new dh(e,i):new dW[e.type](e,i,r,a)},e.cw=eK,e.cx=class extends fW{constructor(e,i){super(e._vectorTileFeature,e._z,e._x,e._y,e.id),e.state&&(this.state=Object.assign({},e.state)),this.target=i.target,this.namespace=i.namespace,i.properties&&(this.properties=i.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=e.source,this.sourceLayer=e.sourceLayer,this.layer=e.layer)}toJSON(){let e=super.toJSON();return e.target=this.target,e.namespace=this.namespace,e}},e.cy=na,e.cz=tM,e.d=function(e){return tt.API_TILEJSON_REGEX.test(e)},e.d$=fH,e.d0=ic,e.d1=(e,i,r,a,n,o,s,l)=>{let h=e.transform,u=h.pitch<15?ux(.07,.7,eU((14-h.zoom)/5,0,1)):.07,c="none"===r.paint.get("line-trim-color-use-theme").
7constantOr("default");return{u_matrix:ub(e,i,r,a),u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:h.calculatePixelsToTileUnitsMatrix(i),u_device_pixel_ratio:n,u_width_scale:o,u_floor_width_scale:s,u_image:0,u_tile_units_to_pixels:uv(i,h),u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toRenderColor(c?null:r.lut).toArray01(),u_emissive_strength:r.paint.get("line-emissive-strength"),u_zbias_factor:u,u_tile_to_meter:sd(i.tileID.canonical,0)}},e.d2=(e,i,r,a,n,o,s,l,h)=>{let u=e.transform,c=u.calculatePixelsToTileUnitsMatrix(i),d="none"===r.paint.get("line-trim-color-use-theme").constantOr("default"),p=u.pitch<15?ux(.07,.7,eU((14-u.zoom)/5,0,1)):.07;return{u_matrix:ub(e,i,r,a),u_pixels_to_tile_units:c,u_device_pixel_ratio:o,u_width_scale:s,u_floor_width_scale:l,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:uT(r)&&i.lineAtlasTexture?i.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:uv(i,e.transform),u_alpha_discard_threshold:0,u_trim_offset:h,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toRenderColor(d?null:r.lut).toArray01(),u_emissive_strength:r.paint.get("line-emissive-strength"),u_zbias_factor:p,u_tile_to_meter:sd(i.tileID.canonical,0)}},e.d3=eW,e.d4=lC,e.d5=sl,e.d6=ui,e.d7=sG,e.d8=h5,e.d9=0x80000000,e.dA=hR,e.dB=eN,e.dC=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.dD=eV,e.dE=sc,e.dF=o7,e.dG=function([e,i,r]){let a=Math.hypot(e,i,r);return new st(Math.atan2(e,r)*ek,(.5*Math.PI-Math.acos(-i/a))*ek)},e.dH=dm,e.dI=function(e){let i=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==e5){let i=e.navigator?e.navigator.userAgent:null;e5=!!e.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return e5}(e)&&i&&(i.match("Version/15.4")||i.match("Version/15.5")||i.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.dJ=function(e,i){th=e,tu=i},e.dK=lp,e.dL=ld,e.dM=function(e){let i=[0,0,0],r=eP.mat4.identity(new Float64Array(16));return eP.mat4.multiply(r,e.pixelMatrix,e.globeMatrix),eP.vec3.transformMat4(i,i,r),new eR(i[0],i[1])},e.dN=function(e,i,r=!1){if(ne===a6||ne===a8||ne===a9)throw Error("setRTLTextPlugin cannot be called multiple times.");nt=tn.resolveURL(e),ne=a6,a7=i,nr(),r||no()},e.dO=nn,e.dP=function(){d2().acquire(dQ)},e.dQ=function(){let e=j;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(dQ),j=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()"))},e.dR=d0,e.dS=function(e){let i=td();if(!i)return;let r=i.delete(tl);e&&r.catch(e).then(()=>e())},e.dT=dJ,e.dU=fz,e.dV=function(e){fE=tn.resolveURL(e),fP||(fP=new d1(d2(),new tV)),fP.broadcast("setDracoUrl",fE)},e.dW=fD,e.dX=function(e){fI=tn.resolveURL(e),fP||(fP=new d1(d2(),new tV)),fP.broadcast("setMeshoptUrl",fI)},e.dY=aT,e.dZ=lE,e.d_=2,e.da=450,e.db=7,e.dc=.0038760859073359074,e.dd=nV,e.de=oc,e.df=256,e.dg=ls,e.dh=nY,e.di=oi,e.dj=or,e.dk=function(e,i,r,a,n){return eU((e-i)/(r-i)*(n-a)+a,a,n)},e.dl=r2,e.dm=su,e.dn=class{constructor(e,i,r,a){this.context=e,this.format=a,this.size=r,this.texture=e.gl.createTexture();const[n,o,s]=this.size,{gl:l}=e;l.bindTexture(l.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),l.texImage3D(l.TEXTURE_3D,0,this.format,n,o,s,0,c9(this.format),c7(this.format),i.data)}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_3D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_3D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_3D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_3D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_3D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.dp=dx,e.dq=[1,1,1],e.dr=dV,e.ds=dL,e.dt=n4,e.du=oo,e.dv=6371008.8,e.dw=on,e.dx=oa,e.dy=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new eR(1/0,1/0),max:new eR(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,i=!1){let r=hN(new eR(0,0),new eR(8192,8192),e),a=[];if(i&&!hF(r,this._globalClipBounds))return a;for(let i of this._activeRegions){if(i.hiddenByOverlap||!hF(r,i))continue;let n=function(e,i,r){let a=1<<r.canonical.z,n=((i.x-r.wrap)*a-r.canonical.x)*8192,o=(i.y*a-r.canonical.y)*8192;return{min:new eR(((e.x-r.wrap)*a-r.canonical.x)*8192,(e.y*a-r.canonical.y)*8192),max:new eR(n,o)}}(i.min,i.max,e);a.push({min:n.min,max:n.max,sourceId:this._sourceIds[i.priority],footprint:i.footprint,footprintTileId:i.tileId,order:i.order,clipMask:i.clipMask,clipScope:i.clipScope})}return a}setSources(e){this._setSources(e.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{let i=[];for(let r of e.cache.getVisibleCoordinates()){let a=e.cache.getTile(r).buckets[e.layer];a&&a.updateFootprints(r.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(e){let i=e.getFootprints();if(0===i.length)return;let r=e.getOrder(),a=e.getClipMask(),n=e.getClipScope();for(let e of i){if(!e.footprint)continue;let i=hN(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:i.min,max:i.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:r,clipMask:a,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>{var r,a;let n;return e.priority-i.priority||hO(e.min,i.min)||hO(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(r=e.clipScope,a=i.clipScope,n=(e,i)=>e+i,r.length-a.length||r.reduce(n,"").localeCompare(a.reduce(n,"")))});let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let i=0;for(;!e&&i!==this._activeRegions.length;){let r=this._activeRegions[i],a=this._prevRegions[i];e=r.priority!==a.priority||!hk(r,a)||r.order!==a.order||r.clipMask!==a.clipMask||!eL(r.clipScope,a.
7clipScope),++i}}if(e){for(let e of(++this._updateTime,this._activeRegions))e.order!==hR&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));let e=e=>{let i=this._activeRegions;if(e>=i.length)return e;let r=i[e].priority;for(;e<i.length&&i[e].priority===r;)++e;return e};if(this._sourceIds.length>1){let i=0,r=e(0);for(;i!==r;){let a=i,n=i;for(;a!==r;){let e=this._activeRegions[a];e.hiddenByOverlap=!1;for(let i=0;i<n;i++){let r=this._activeRegions[i];if(!r.hiddenByOverlap&&e.order===hR&&hF(e,r)&&(e.hiddenByOverlap=function e(i,r,a,n){if(!i||!a)return!1;let o=i.vertices;if(!r.canonical.equals(n.canonical)||r.wrap!==n.wrap){if(a.vertices.length<i.vertices.length)return e(a,n,i,r);let s=r.canonical,l=n.canonical,h=Math.pow(2,l.z-s.z);o=i.vertices.map(e=>new eR((e.x+8192*s.x)*h-8192*l.x,(e.y+8192*s.y)*h-8192*l.y))}return hV(a,o,i.indices,0,i.indices.length,0,0)}(e.footprint,e.tileId,r.footprint,r.tileId),e.hiddenByOverlap))break}++a}r=e(i=r)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let i=e.length-1;i>=0;i--)this._addSource(e[i]);this._computeReplacement()}},e.dz=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){for(let e of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))e.destroy();for(let e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,i){let r=new nj,a=new n7,n=[],o=e+1+2,s=i[0]+1,l=i[0]+1+(1+i.length),h=(e,i,r)=>{let a=e===o-1?e-2:0===e?e:e-1;return[a+=24575*!!r,i]};for(let e=0;e<o;++e)r.emplaceBack(...h(e,0,!0));for(let e=0;e<s;++e)for(let i=0;i<o;++i)r.emplaceBack(...h(i,e,0===i||i===o-1));for(let e=0;e<i.length;++e){let a=i[e];for(let e=0;e<o;++e)r.emplaceBack(...h(e,a,!0))}for(let e=0;e<i.length;++e){let s=a.length,h=i[e]+1+2,u=new n7;for(let r=0;r<h-1;r++){let n=r===h-2,s=n?o*(l-i.length+e-r):o;for(let e=0;e<o-1;e++){let i=r*o+e;0===r||n||0===e||e===o-2?(u.emplaceBack(i+1,i,i+s),u.emplaceBack(i+s,i+s+1,i+1)):(a.emplaceBack(i+1,i,i+s),a.emplaceBack(i+s,i+s+1,i+1))}}let c=oI.simpleSegment(0,s,r.length,a.length-s);for(let e=0;e<u.uint16.length;e+=3)a.emplaceBack(u.uint16[e],u.uint16[e+1],u.uint16[e+2]);let d=oI.simpleSegment(0,s,r.length,a.length-s);n.push({withoutSkirts:c,withSkirts:d})}return{vertices:r,indices:a,segments:n}}_createGrid(e){let i=this._fillGridMeshWithLods(64,o6);this._gridSegments=i.segments,this._gridBuffer=e.createVertexBuffer(i.vertices,sH.members),this._gridIndexBuffer=e.createIndexBuffer(i.indices,!0)}_createPoles(e){let i=new n7;for(let e=0;e<=64;e++)i.emplaceBack(0,e+1,e+2);this._poleIndexBuffer=e.createIndexBuffer(i,!0);let r=new oi,a=new oi,n=new oi,o=new oi;this._poleSegments=[];for(let e=0,i=0;e<5;e++){let s=360/(1<<e);r.emplaceBack(0,-o5,0,.5,0),a.emplaceBack(0,-o5,0,.5,1),n.emplaceBack(0,-o5,0,.5,.5),o.emplaceBack(0,-o5,0,.5,.5);for(let e=0;e<=64;e++){let i=e/64,l=0,h=t$(0,s,i),[u,c,d]=o9(lm,l_,h,o5);r.emplaceBack(u,c,d,i,l),a.emplaceBack(u,c,d,i,1-l);let p=h*eO;i=.5+.5*Math.sin(p),l=.5+.5*Math.cos(p),n.emplaceBack(u,c,d,i,l),o.emplaceBack(u,c,d,i,1-l)}this._poleSegments.push(oI.simpleSegment(i,0,66,64)),i+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,sq,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(a,sq,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,sq,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(o,sq,!1)}getGridBuffers(e,i){return[this._gridBuffer,this._gridIndexBuffer,i?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}getPoleBuffers(e,i){return[i?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,i?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},e.e=tt,e.e0=fX,e.e1=ud,e.e2=hr,e.e3="hd_road_elevation",e.e4=class{static parseFrom(e,i){let r=hh.parse(e);if(!r)return[];let{vertices:a,features:n}=r,o=1/sd(i);n.sort((e,i)=>e.id-i.id),a.sort((e,i)=>e.id-i.id||e.idx-i.idx);let s=[],l=0,h=(a=a.filter((e,i,r)=>i===r.findIndex(i=>i.id===e.id&&i.idx===e.idx))).length;for(let e of n){if(e.constantHeight){s.push(new hu(e.id,e.bounds,e.constantHeight));continue}for(;l!==h&&a[l].id<e.id;)l++;if(l===h||a[l].id!==e.id)continue;let i=[],r=[],n=l;for(;l!==h&&a[l].id===e.id;){let e=a[l];if(i.push({position:e.position,height:e.height,extent:e.extent}),l!==n&&a[l-1].idx===e.idx-1){let e=l-n;r.push({a:e-1,b:e})}l++}s.push(new hu(e.id,e.bounds,void 0,i,r,o))}return s}},e.e5=eY,e.e6=hp,e.e7=cn,e.e8=1,e.e9=function(e,i,r,a,n,o,s,l=1,h){e.createArrays(),e.tilePixelRatio=8192/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;let u=e.layers[0].layout,c=e.layers[0]._unevaluatedLayout._values,d={};d.scaleFactor=l,d.textSizeScaleRange=u.get("text-size-scale-range"),d.iconSizeScaleRange=u.get("icon-size-scale-range");let[p,f]=d.textSizeScaleRange,[m,_]=d.iconSizeScaleRange;d.textScaleFactor=eU(d.scaleFactor,p,f),d.iconScaleFactor=eU(d.scaleFactor,m,_);let g=c["text-size"],y=c["icon-size"];
7if("composite"===e.textSizeData.kind){let{minZoom:i,maxZoom:r}=e.textSizeData;d.compositeTextSizes=[g.possiblyEvaluate(new nl(i),o),g.possiblyEvaluate(new nl(r),o)]}if("composite"===e.iconSizeData.kind){let{minZoom:i,maxZoom:r}=e.iconSizeData;d.compositeIconSizes=[y.possiblyEvaluate(new nl(i),o),y.possiblyEvaluate(new nl(r),o)]}d.layoutTextSize=g.possiblyEvaluate(new nl(s+1),o),d.layoutIconSize=y.possiblyEvaluate(new nl(s+1),o),d.textMaxSize=g.possiblyEvaluate(new nl(18),o);let x=u.get("symbol-placement"),v="map"===u.get("text-rotation-alignment")&&"point"!==x,b=u.get("text-size"),w=!1,T=[];for(let s of e.features){let l=u.get("text-font").evaluate(s,{},o).join(","),p=b.evaluate(s,{},o)*d.textScaleFactor,f=d.layoutTextSize.evaluate(s,{},o)*d.textScaleFactor,m=d.layoutIconSize.evaluate(s,{},o)*d.iconScaleFactor,_={horizontal:{},vertical:void 0},g=s.text,y,S=[0,0];if(g){let a=g.toString(),c=24*u.get("text-letter-spacing").evaluate(s,{},o),d=24*u.get("text-line-height").evaluate(s,{},o),m=!function(e){for(let r of e){var i;if(aI(i=r.charCodeAt(0))||aC(i)||aP(i)||aY(i)||a0(i))return!1}return!0}(a)?0:c,y=u.get("text-anchor").evaluate(s,{},o),b=u.get("text-variable-anchor");if(!b){let e=u.get("text-radial-offset").evaluate(s,{},o);S=e?cx(y,[24*e,cg]):u.get("text-offset").evaluate(s,{},o).map(e=>24*e)}let w=v?"center":u.get("text-justify").evaluate(s,{},o),T="point"===x,M=T?24*u.get("text-max-width").evaluate(s,{},o):1/0,E=o=>{e.allowVerticalPlacement&&a2(a)&&(_.vertical=uQ(g,i,r,n,l,M,d,y,o,m,S,uY.vertical,!0,f,p,h))};if(!v&&b){let e="auto"===w?b.map(e=>cS(e)):[w],a=!1;for(let o=0;o<e.length;o++){let s=e[o];if(!_.horizontal[s])if(a)_.horizontal[s]=_.horizontal[0];else{let e=uQ(g,i,r,n,l,M,d,"center",s,m,S,uY.horizontal,!1,f,p,h);e&&(_.horizontal[s]=e,a=1===e.positionedLines.length)}}E("left")}else{if("auto"===w&&(w=cS(y)),T||u.get("text-writing-mode").indexOf("horizontal")>=0||!a2(a)){let e=uQ(g,i,r,n,l,M,d,y,w,m,S,uY.horizontal,!1,f,p,h);e&&(_.horizontal[w]=e)}E(T?"left":w)}}let M,E,A,I,C,P=!1;if(s.icon&&s.icon.hasPrimary()){let i=cb(s.icon,e.iconSizeData,c["icon-size"],o,e.zoom,s,h,d.iconScaleFactor);M=i.iconPrimary,E=i.iconSecondary;let r=M.toString(),l=a.get(r);l&&(A=u.get("icon-offset").evaluate(s,{},o),I=u.get("icon-anchor").evaluate(s,{},o),C=u.get("icon-text-fit").evaluate(s,{},o),y=function(e,i,r,a){let{horizontalAlign:n,verticalAlign:o}=u5(a),s=r[0]-e.displaySize[0]*n,l=r[1]-e.displaySize[1]*o;return{imagePrimary:e,imageSecondary:i,top:l,bottom:l+e.displaySize[1],left:s,right:s+e.displaySize[0]}}(n.get(r),E?n.get(E.toString()):void 0,A,I),P=l.sdf,void 0===e.sdfIcons?e.sdfIcons=l.sdf:e.sdfIcons!==l.sdf&&e0("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(l.pixelRatio!==e.pixelRatio||0!==u.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}w=w||!(!s.icon||!s.icon.hasSecondary());let z=cE(_.horizontal)||_.vertical;e.iconsInText||(e.iconsInText=!!z&&z.iconsInText);let{defaultShapedIcon:D,verticallyShapedIcon:R}=function(e,i,r,a,n,o,s,l,h){let u=cE(o.horizontal)||o.vertical,c=r.get("icon-text-fit-padding").evaluate(a,{},n),d,p=i;return i&&"none"!==h&&(e.allowVerticalPlacement&&o.vertical&&(d=u8(i,o.vertical,h,c,l,s)),u&&(p=u8(i,u,h,c,l,s))),{defaultShapedIcon:p,verticallyShapedIcon:d}}(e,y,u,s,o,_,f*d.textScaleFactor/24,A,C);y=D,T.push({feature:s,shapedTextOrientations:_,shapedText:z,shapedIcon:y,iconPrimary:M,iconSecondary:E,iconOffset:A,iconAnchor:I,verticallyShapedIcon:R,layoutTextSize:f,layoutIconSize:m,textOffset:S,isSDFIcon:P,iconTextFit:C})}return{featureData:T,sizes:d,hasAnySecondaryIcon:w,textAlongLine:v,symbolPlacement:x}},e.ea=co,e.eb=function(e,i,r,a,n,o,s,l,h,u){let{featureData:c,hasAnySecondaryIcon:d,sizes:p,textAlongLine:f,symbolPlacement:m}=i;for(let i of c){let{shapedIcon:r,verticallyShapedIcon:o,feature:c,shapedTextOrientations:_,shapedText:g,layoutTextSize:y,textOffset:x,isSDFIcon:v,iconPrimary:b,iconSecondary:w,iconTextFit:T,iconOffset:S}=i;cw(r,u.iconPositions,b,w),cw(o,u.iconPositions,b,w),function(e,i){for(let r in e.horizontal)cT(e.horizontal[r],i);cT(e.vertical,i)}(_,u.iconPositions),(g||r)&&function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x){var v;let b=s.textMaxSize.evaluate(i,{},d);void 0===b?b=l*s.textScaleFactor:b*=s.textScaleFactor;let w=e.layers[0].layout,T=cE(r.horizontal)||r.vertical,S="globe"===p.name,M=e.tilePixelRatio*b/24,E=(v=e.overscaling,e.zoom>18&&v>2&&(v>>=1),Math.max(8192/(512*v),1)*w.get("symbol-spacing")),A=w.get("text-padding")*e.tilePixelRatio,I=w.get("icon-padding")*e.tilePixelRatio,C=w.get("text-max-angle")*eO,P="map"===w.get("icon-rotation-alignment")&&"point"!==x,z=E/2;!1===e.hasAnyIconTextFit&&"none"!==_&&(e.hasAnyIconTextFit=!0);let D=i.properties?+i.properties[hr]:null,R=D&&e.elevationFeatureIdToIndex?e.elevationFeatureIdToIndex.get(D):65535,L=(l,x,v)=>{if(x.x<0||x.x>=8192||x.y<0||x.y>=8192)return;let b=null;if(S){let{x:e,y:i,z:r}=p.projectTilePoint(x.x,x.y,v);b={anchor:new u9(e,i,r,0,void 0),up:p.upVector(v,x.x,x.y)}}!function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I){let C=e.addToLineVertexArray(i,a),P,z,D,R,L,O,k,F=0,B=0,N=0,V=0,U=-1,j=-1,G={},q=tO(""),Z=r?r.anchor:i,H="none"!==A,$=0,W=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")?[$,W]=h.layout.get("text-offset").evaluate(v,{},S).map(e=>24*e):($=24*h.layout.get("text-radial-offset").evaluate(v,{},S),W=cg),e.allowVerticalPlacement&&n.vertical){let e=n.vertical;if(m)O=cI(e),l&&(k=cI(l));else{let r=h.layout.get("text-rotate").evaluate(v,{},S)+90;D=cA(u,Z,i,c,d,p,e,f,r,_),l&&(R=cA(u,Z,i,c,d,p,l,g,r))}}if(o){let a=e.iconSizeData,n=h.layout.get("icon-rotate").evaluate(v,{},S),s=cd(o,n,w,H,b.iconScaleFactor),f=l?cd(l,n,w,H,b.iconScaleFactor):void 0;z=cA(u,Z,i,c,d,p,o,g,n,null),F=4*s.length;let m=null;"source"===a.kind?(m=[128*h.layout.get("icon-size").evaluate(v,{},S)*b.iconScaleFactor])[0]>32640&&e0(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===a.kind&&((m=[128*b.compositeIconSizes[0].evaluate(v,{},S)*b.iconScaleFactor,128*b.compositeIconSizes[1].evaluate(v,{},S)*b.iconScaleFactor])[0]>32640||m[1]>32640)&&e0(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),e.addSymbols(e.icon,s,m,x,y,v,!1,r,i,C.lineStartIndex,C.lineLength,-1,T,S,M,E),U=e.icon.placedSymbolArray.length-1,f&&(B=4*f.length,e.addSymbols(e.icon,f,m,x,y,v,uY.vertical,r,i,C.lineStartIndex,C.lineLength,-1,T,S,M,E),j=e.icon.placedSymbolArray.length-1)}for(let a in n.horizontal){let o=n.horizontal[a];P||(q=tO(o.text),m?L=cI(o):P=cA(u,Z,i,c,d,p,o,f,h.layout.get("text-rotate").evaluate(v,{},S),_));let l=1===o.positionedLines.length;if(N+=cM(e,r,i,o,s,h,m,v,_,C,n.vertical?uY.horizontal:uY.horizontalOnly,l?Object.keys(n.horizontal):[a],G,U,b,T,S,M),l)break}n.vertical&&(V+=cM(e,r,i,n.vertical,s,h,m,v,_,C,uY.vertical,["vertical"],G,j,b,T,S,M));let X=-1,Y=(e,i)=>e?Math.max(e,i):i;X=Y(L,-1),X=Y(O,X);let K=+((X=Y(k,X))>-1);e.glyphOffsetArray.length>=65535&&e0("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==v.sortKey&&e.addToSortKey
7Ranges(e.symbolInstances.length,v.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,Z.x,Z.y,Z.z,G.right>=0?G.right:-1,G.center>=0?G.center:-1,G.left>=0?G.left:-1,G.vertical>=0?G.vertical:-1,U,j,q,void 0!==P?P:e.collisionBoxArray.length,void 0!==P?P+1:e.collisionBoxArray.length,void 0!==D?D:e.collisionBoxArray.length,void 0!==D?D+1:e.collisionBoxArray.length,void 0!==z?z:e.collisionBoxArray.length,void 0!==z?z+1:e.collisionBoxArray.length,R||e.collisionBoxArray.length,R?R+1:e.collisionBoxArray.length,c,N,V,F,B,K,0,$,W,X,0,+!!H,I)}(e,x,b,l,r,a,o,n,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,A,y,h,I,P,g,i,s,u,c,d,f,m,_,R)};if("line"===x)for(let n of ci(i.geometry,0,0,8192,8192))for(let i of function(e,i,r,a,n,o,s){let l=a?14.399999999999999*o:0,h=ct(a,n),u=h*o,c=0===e[0].x||8192===e[0].x||0===e[0].y||8192===e[0].y;return i-u<i/4&&(i=u+i/4),function e(i,r,a,n,o,s,l,h,u){let c=s/2,d=ce(i),p=0,f=r-a,m=[];for(let e=0;e<i.length-1;e++){let r=i[e],l=i[e+1],h=r.dist(l),_=l.angleTo(r);for(;f+a<p+h;){let g=((f+=a)-p)/h,y=t$(r.x,l.x,g),x=t$(r.y,l.y,g);if(y>=0&&y<u&&x>=0&&x<u&&f-c>=0&&f+c<=d){let r=new u9(y,x,0,_,e);n&&!u7(i,r,s,n,o)||m.push(r)}}p+=h}return h||m.length||l||(m=e(i,p/2,a,n,o,s,l,!0,u)),m}(e,c?i/2*s%i:(h/2+48)*o*s%i,i,l,r,u,c,!1,8192)}(n,E,C,r.vertical||T,a,M,e.overscaling))T&&function(e,i,r,a){let n=e.compareText;if(i in n){let e=n[i];for(let i=e.length-1;i>=0;i--)if(a.dist(e[i])<r)return!0}else n[i]=[];return n[i].push(a),!1}(e,T.text,z,i)||L(n,i,d);else if("line-center"===x){for(let e of i.geometry)if(e.length>1){let i=function(e,i,r,a,n){let o=r?14.399999999999999*n:0,s=ct(r,a)*n,l=0,h=ce(e)/2;for(let r=0;r<e.length-1;r++){let a=e[r],n=e[r+1],u=a.dist(n);if(l+u>h){let c=(h-l)/u,d=new u9(t$(a.x,n.x,c),t$(a.y,n.y,c),0,n.angleTo(a),r);return!o||u7(e,d,s,o,i)?d:void 0}l+=u}}(e,C,r.vertical||T,a,M);i&&L(e,i,d)}}else if("Polygon"===i.type)for(let e of lY(i.geometry,0)){let i=function(e,i=1,r=!1){let a=1/0,n=1/0,o=-1/0,s=-1/0,l=e[0];for(let e=0;e<l.length;e++){let i=l[e];(!e||i.x<a)&&(a=i.x),(!e||i.y<n)&&(n=i.y),(!e||i.x>o)&&(o=i.x),(!e||i.y>s)&&(s=i.y)}let h=Math.min(o-a,s-n),u=h/2,c=new iK([],cm);if(0===h)return new eR(a,n);for(let i=a;i<o;i+=h)for(let r=n;r<s;r+=h)c.push(new c_(i+u,r+u,u,e));let d=function(e){let i=0,r=0,a=0,n=e[0];for(let e=0,o=n.length,s=o-1;e<o;s=e++){let o=n[e],l=n[s],h=o.x*l.y-l.x*o.y;r+=(o.x+l.x)*h,a+=(o.y+l.y)*h,i+=3*h}return new c_(r/i,a/i,0,e)}(e),p=c.length;for(;c.length;){let a=c.pop();(a.d>d.d||!d.d)&&(d=a,r&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,p)),a.max-d.d<=i||(u=a.h/2,c.push(new c_(a.p.x-u,a.p.y-u,u,e)),c.push(new c_(a.p.x+u,a.p.y-u,u,e)),c.push(new c_(a.p.x-u,a.p.y+u,u,e)),c.push(new c_(a.p.x+u,a.p.y+u,u,e)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}(e,16);L(e[0],new u9(i.x,i.y,0,0,void 0),d)}else if("LineString"===i.type)for(let e of i.geometry)L(e,new u9(e[0].x,e[0].y,0,0,void 0),d);else if("Point"===i.type)for(let e of i.geometry)for(let i of e)L([i],new u9(i.x,i.y,0,0,void 0),d)}(e,c,_,r,o,h,p,y,x,v,a,n,s,l,d,T,S,f,m)}r&&e.generateCollisionDebugBuffers(o,e.collisionBoxArray,p.textScaleFactor)},e.ec=hi,e.ed=pH,e.ee=eD,e.ef=ht,e.eg=uZ,e.eh=K,e.ei=function(e){let i=0;if(0x46546c67!==new Uint32Array(e,0,1)[0]){let r=new Uint32Array(e,0,7),[,,a,n,o,s]=r;i=r.byteLength+n+o+s+o,(a!==e.byteLength||i>=e.byteLength)&&e0("Invalid b3dm header information.")}return fj(e,i)},e.ej=function(e,i){let r=fZ(e);for(let e of r){for(let i of e.meshes)!function(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);let i=e.vertexArray.float32,r=e.aabb.min[0]-1,a=e.aabb.min[1]-1,n=64/(e.aabb.max[0]-r+2),o=64/(e.aabb.max[1]-a+2);for(let s=0;s<i.length;s+=3){let l=i[s+2],h=(i[s+0]-r)*n|0,u=(i[s+1]-a)*o|0;l>e.heightmap[64*u+h]&&(e.heightmap[64*u+h]=l)}}(i);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(function(e,i){let r={};r.indexArray=new n7,r.indexArray.reserve(4*e.length),r.vertexArray=new nY,r.vertexArray.reserve(10*e.length),r.colorArray=new n2,r.vertexArray.reserve(10*e.length);let a=0;for(let n of e){let e=Math.min(10,Math.max(4,1.3*n.height))*i,o=[-n.normal[1],n.normal[0],0],s=Math.min(.29,.1*n.width/n.depth),l=n.width-2*n.depth*i*(s+.01),h=eP.vec3.scaleAndAdd([],n.pos,o,l/2),u=eP.vec3.scaleAndAdd([],n.pos,o,-l/2),c=[h[0],h[1],h[2]+n.height],d=[u[0],u[1],u[2]+n.height],p=eP.vec3.scaleAndAdd([],n.normal,o,s);eP.vec3.scale(p,p,e);let f=eP.vec3.scaleAndAdd([],n.normal,o,-s);eP.vec3.scale(f,f,e),eP.vec3.add(p,h,p),eP.vec3.add(f,u,f),h[2]+=.1,u[2]+=.1,r.vertexArray.emplaceBack(p[0],p[1],p[2]),r.vertexArray.emplaceBack(f[0],f[1],f[2]),r.vertexArray.emplaceBack(h[0],h[1],h[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(c[0],c[1],c[2]),r.vertexArray.emplaceBack(d[0],d[1],d[2]),r.vertexArray.emplaceBack(h[0],h[1],h[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(p[0],p[1],p[2]),r.vertexArray.emplaceBack(f[0],f[1],f[2]);let m=l/e/2;r.colorArray.emplaceBack(-m-s,-1,m,.8),r.colorArray.emplaceBack(m+s,-1,m,.8),r.colorArray.emplaceBack(-m,0,m,1.3),r.colorArray.emplaceBack(m,0,m,1.3),r.colorArray.emplaceBack(m+s,-.8,m,.7),r.colorArray.emplaceBack(m+s,-.8,m,.7),r.colorArray.emplaceBack(0,0,m,1.3),r.colorArray.emplaceBack(0,0,m,1.3),r.colorArray.emplaceBack(m+s,-1.2,m,.8),r.colorArray.emplaceBack(m+s,-1.2,m,.8),r.indexArray.emplaceBack(6+a,4+a,8+a),r.indexArray.emplaceBack(7+a,9+a,5+a),r.indexArray.emplaceBack(0+a,1+a,2+a),r.indexArray.emplaceBack(1+a,3+a,2+a),a+=10}let n={defined:!0,emissiveFactor:[0,0,0]},o={};return o.baseColorFactor=tZ.white,n.pbrMetallicRoughness=o,r.material=n,r.aabb=new s1([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}(e.lights,i)))}return r},e.ek=dZ,e.el=dK,e.em=ns,e.en=function(e){tp(),null!=l&&l.then(i=>{i.keys().then(r=>{for(let a=0;a<r.length-e;a++)i.delete(r[a])})})},e.f=function(e){return 0===e.indexOf("mapbox:")},e.g=function(e,i){return tM(eZ(e,{method:"GET"}),i)},e.h=ti,e.i=function(e){return tt.API_STYLE_REGEX.test(e)&&!tr(e)},e.j=function(e){return decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},e.k=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(Number("0x"+i))))},e.l=eZ,e.m=tm,e.n=function(e,i){return tM(eZ(e,{type:"json"}),i)},e.o=tI,e.p=function(e,i){return tM(eZ(e,{method:"POST"}),i)},e.q=tn,e.r=lA,e.s=function(e){try{let i=self[e];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=ta,e.u=function(){return function e(i){return i?(i^Math.random()*(16>>i/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=e0,e.x=function(){return G||(G=new d0),G},e.y=pO,e.z=tF}),a(["./shared"],function(e){function i(e){let i=e?e.url.toString():void 0;return i?performance.getEntriesByName(i):[]}function r(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(let a of e)i+=`${r(a)},`;return`${i}]`}let i="{";for(let a of Object.keys(e).sort())i+=`${a}:${r(e[a])},`;return`${i}}`}class a{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,i){this._layerConfigs={},this._layers={},this.update(e,[],i)}update(i,a,n){for(let r of(this._options=n,i))this._layerConfigs[r.id]=r,(this._layers[r.id]=e.cv(r,this.scope,null,this._options)).compileFilter(n),this.keyCache[r.id]&&delete this.keyCache[r.id];for(let e of a)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];for(let i of(this.familiesBySource={},function(i,a){let n={};for(let o=0;o<i.length;o++){let s=i[o],l=a&&a[s.id];!l&&(l=function(i){let a="";for(let n of e.bm)("model"!==i.type||"minzoom"!==n&&"maxzoom"!==n)&&(a+=`/${r(i[n])}`);return a}(s),"line"===s.type&&s.paint)&&function e(i){return"string"==typeof i&&"line-progress"===i||(Array.isArray(i)?i.some(e):!(!i||"object"!=typeof i)&&Object.values(i).some(e))}(s.paint["line-width"])&&(l+=`/${r(s.paint["line-width"])}`),a&&(a[s.id]=l);let h=n[l];h||(h=n[l]=[]),h.push(s)}let o=[];for(let e in n)o.push(n[e]);return o}(Object.values(this._layerConfigs),this.keyCache))){let e=i.map(e=>
7this._layers[e.id]),r=e[0];if("none"===r.visibility)continue;let a=r.source||"",n=this.familiesBySource[a];n||(n=this.familiesBySource[a]={});let o=r.sourceLayer||"_geojsonTileLayer",s=n[o];s||(s=n[o]=[]),s.push(e)}}}let n=+e.d_;class o{constructor(i){const r={},a=[];for(const e in i){const o=i[e],s=r[e]={};for(const e in o.glyphs){const i=o.glyphs[+e];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const r=i.metrics.localGlyph?n:1,l={x:0,y:0,w:i.bitmap.width+2*r,h:i.bitmap.height+2*r};a.push(l),s[e]=l}}const{w:o,h:s}=e.H(a),l=new e.dZ({width:o||1,height:s||1});for(const a in i){const o=i[a];for(const i in o.glyphs){const s=o.glyphs[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const h=r[a][i],u=s.metrics.localGlyph?n:1;e.dZ.copy(s.bitmap,l,{x:0,y:0},{x:h.x+u,y:h.y+u},s.bitmap)}}this.image=l,this.positions=r}}e.dY(o,"GlyphAtlas");class s{constructor(i){this.tileID=new e.aH(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.collectResourceTiming=!!i.request&&i.request.collectResourceTiming,this.promoteId=i.promoteId,this.isSymbolTile=i.isSymbolTile,this.tileTransform=e.aR(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}parse(i,r,a,n,s){let h,u,c,d,p,f;this.status="parsing",this.data=i,this.collisionBoxArray=new e.aX;let m=new e.d$(Object.keys(i.layers).sort()),_=new e.e0(this.tileID,this.promoteId);_.bucketLayerIDs=[];let g={},y=new e.e1(256,256),x={featureIndex:_,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:y,availableImages:a,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},v=r.familiesBySource[this.source];for(let r in v){let n=i.layers[r];if(!n)continue;let o=!1,s=!1,h=!1;for(let e of v[r])"symbol"===e[0].type?o=!0:s=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h||!0===this.isSymbolTile&&!o||!1===this.isSymbolTile&&!s)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let u=m.encode(r),c=[],d=!1;for(let i=0,a=0;i<n.length;i++){let o=n.feature(i),s=_.getId(o,r);if(this.localizableLayerIds&&this.localizableLayerIds.has(r)){let e=o.properties?o.properties.worldview:null;if(this.worldview&&"string"==typeof e)if("all"===e)o.properties.$localized=!0;else{if(!e.split(",").includes(this.worldview))continue;o.properties.$localized=!0,o.properties.worldview=this.worldview}}!d&&o.properties&&o.properties.hasOwnProperty(e.e2)&&(d=!0),c.push({feature:o,id:s,index:a,sourceLayerIndex:u}),a++}for(let n of(d&&!x.elevationFeatures&&i.layers.hasOwnProperty(e.e3)&&(x.elevationFeatures=e.e4.parseFrom(i.layers[e.e3],this.canonical)),v[r])){let i=n[0];(!this.extraShadowCaster||i.is3D()&&"model"!==i.type)&&(void 0!==this.isSymbolTile&&"symbol"===i.type!==this.isSymbolTile||i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(l(n,this.zoom,x.brightness,a),(g[i.id]=i.createBucket({index:_.bucketLayerIDs.length,layers:n,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:u,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(c,x,this.tileID.canonical,this.tileTransform),_.bucketLayerIDs.push(n.map(i=>e.C(i.id,i.scope)))))}}y.trim();let b={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},w=()=>{if(h)return this.status="done",s(h);if(this.extraShadowCaster)this.status="done",s(null,{buckets:Object.values(g).filter(e=>!e.isEmpty()),featureIndex:_,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:x.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(u&&c&&d){let i=new o(u),r=new Map;for(let[i,a]of c.entries()){let{imagePosition:n}=e.e7(i,a,e.e8);r.set(i,n)}let s={};for(let n in g){let o=g[n];o instanceof e.aY&&(l(o.layers,this.zoom,x.brightness,a),s[n]=e.e9(o,u,i.positions,c,r,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio))}let h={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(n,c,p,()=>{h.iconsPending=!1,T(s,i,h)}),this.rasterizeIfNeeded(n,d,f,()=>{h.patternsPending=!1,T(s,i,h)})}},T=(i,r,n,o)=>
7{if(n.iconsPending||n.patternsPending)return;let h=new e.ea(c,d,this.lut);for(let r in g){let n=g[r];if(r in i)e.eb(n,i[r],this.showCollisionBoxes,a,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,c,h);else if(n.hasPattern&&(n instanceof e.b2||n instanceof e.b3||n instanceof e.d8)){l(n.layers,this.zoom,x.brightness,a);let e=Object.fromEntries(h.patternPositions);n.addFeatures(x,this.tileID.canonical,e,a,this.tileTransform,this.brightness)}}this.status="done",s(null,{buckets:Object.values(g).filter(e=>!e.isEmpty()),featureIndex:_,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:r.image,lineAtlas:y,imageAtlas:h,brightness:x.brightness})};if(!this.extraShadowCaster){let i=e.e5(x.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(i).length?n.send("getGlyphs",{uid:this.uid,stacks:i,scope:this.scope},(e,i)=>{h||(h=e,u=i,w())},void 0,!1,b):u={};let r=Array.from(x.iconDependencies.keys()).map(i=>e.I.parse(i));r.length?n.send("getImages",{images:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,i)=>{h||(h=e,c=new Map,p=this.updateImageMapAndGetImageTaskQueue(c,i,x.iconDependencies),w())},void 0,!1,b):(c=new Map,p=new Map);let a=Array.from(x.patternDependencies.keys()).map(i=>e.I.parse(i));a.length?n.send("getImages",{images:a,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,i)=>{h||(h=e,d=new Map,f=this.updateImageMapAndGetImageTaskQueue(d,i,x.patternDependencies),w())},void 0,!1,b):(d=new Map,f=new Map)}if(x.elevationFeatures&&x.elevationFeatures.length>0){let i=[];for(let r of Object.values(g))if(r instanceof e.b3){let e=r.getUnevaluatedPortalGraph();e&&i.push(e)}let r=e.e6.evaluate(i);for(let i of Object.values(g))i instanceof e.b3&&i.setEvaluatedPortalGraph(r)}w()}rasterizeIfNeeded(e,i,r,a){Array.from(i.values()).some(e=>e.usvg)?this.rasterize(e,i,r,a):a()}updateImageMapAndGetImageTaskQueue(e,i,r){let a=new Map;for(let n of i.keys())for(let o of r.get(n)||[]){let r=o.toString(),n=i.get(o.id.toString());n.usvg?a.has(r)||(a.set(r,o),e.set(r,Object.assign({},n))):e.set(r,n)}return a}rasterize(e,i,r,a){this.rasterizeTask=e.send("rasterizeImages",{scope:this.scope,tasks:r},(e,r)=>{if(!e)for(let[e,a]of r.entries()){let r=Object.assign(i.get(e),{data:a});i.set(e,r)}a()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function l(i,r,a,n){let o=new e.aa(r,{brightness:a});for(let e of i)e.recalculate(o,n)}class h extends e.E{constructor(i,r,a,n,o,s){super(),this.actor=i,this.layerIndex=r,this.availableImages=a,this.loadVectorData=o||e.aE,this.loading={},this.loaded={},this.deduped=new e.aD(i.scheduler),this.isSpriteLoaded=n,this.scheduler=i.scheduler,this.brightness=s}loadTile(r,a){let n=r.uid,o=r&&r.request,l=o&&o.collectResourceTiming,h=this.loading[n]=new s(r);h.abort=this.loadVectorData(r,(s,u)=>{let c=!this.loading[n];if(delete this.loading[n],h.cancelRasterize(),c||s||!u)return h.status="done",c||(this.loaded[n]=h),a(s);let d=u.rawData,p={};u.expires&&(p.expires=u.expires),u.cacheControl&&(p.cacheControl=u.cacheControl),h.vectorTile=u.vectorTile||new e.ec.VectorTile(new e.bi(d));let f=()=>{h.parse(h.vectorTile,this.layerIndex,this.availableImages,this.actor,(r,n)=>{if(r||!n)return a(r);let s={};if(l){let e=i(o);e.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(e)))}a(null,e.l({rawTileData:d.slice(0)},n,p,s))})};this.isSpriteLoaded?f():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(f,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom}
7):f()}),this.loaded=this.loaded||{},this.loaded[n]=h})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let o=a[n];o.scaleFactor=i.scaleFactor,o.showCollisionBoxes=i.showCollisionBoxes,o.projection=i.projection,o.brightness=i.brightness,o.tileTransform=e.aR(i.tileID.canonical,i.projection),o.extraShadowCaster=i.extraShadowCaster,o.lut=i.lut;let s=(e,i)=>{let a=o.reloadCallback;a&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a)),r(e,i)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}else r(null,void 0)}abortTile(e,i){let r=e.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r]),i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}class u{loadTile(i,r){let{uid:a,encoding:n,rawImageData:o,padding:s}=i,l=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;r(null,new e.ed(a,l,n,s<1))}reloadTile(e,i){i(null,null)}abortTile(e,i){i()}removeTile(e,i){i()}getImageData(e,i){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);let r=this.offscreenCanvasContext.getImageData(-i,-i,e.width+2*i,e.height+2*i);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),r}}e.bh.setPbf(e.bi);class c{constructor(i){this._mrt=new e.bh(i.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=i.uid,this.tileID=i.tileID,this.source=i.source}parse(i,r){let a=this._mrt;this.status="parsing",this._entireBuffer=i;try{a.parseHeader(i),this._isHeaderLoaded=!0;let n=[];for(let r in a.layers){let o=a.getLayer(r),s=o.getDataRange(o.getBandList()),l=a.createDecodingTask(s),h=i.slice(s.firstByte,s.lastByte+1),u=e.bh.performDecoding(h,l).then(e=>l.complete(null,e)).catch(e=>l.complete(e,null));n.push(u)}Promise.allSettled(n).then(()=>r(null,a))}catch(e){r(e)}}}class d{constructor(e){this.actor=e,this.loading={},this.loaded={}}loadTile(i,r){let a=i.uid,n=i.request,o=this.loading[a]=new c(i),{cancel:s}=e.bj(n,(e,i,n,s)=>{let l=!this.loading[a];if(delete this.loading[a],l||e||!i)return o.status="done",l||(this.loaded[a]=o),r(e);o.parse(i,(e,i)=>{if(e||!i)return r(e);r(null,i,n,s)}),this.loaded[a]=o});o.abort=s}reloadTile(e,i){i(null,void 0)}abortTile(e,i){let r=e.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r]),i()}removeTile(e,i){let r=e.uid;this.loaded[r]&&delete this.loaded[r],i()}decodeRasterArray({task:i,buffer:r},a){e.bh.performDecoding(r,i).then(e=>a(null,e)).catch(e=>a(e))}}let p=e.ec.VectorTileFeature.prototype.toGeoJSON;class f{constructor(i){this._feature=i,this.extent=e.ai,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){if(1===this._feature.type){let i=[];for(let r of this._feature.geometry)i.push([new e.P(r[0],r[1])]);return i}{let i=[];for(let r of this._feature.geometry){let a=[];for(let i of r)a.push(new e.P(i[0],i[1]));i.push(a)}return i}}toGeoJSON(e,i,r){return p.call(this,e,i,r)}}class m{constructor(i){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.ai,this.length=i.length,this._features=i}feature(e){return new f(this._features[e])}}let _=64/4096;class g{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],i){for(let r of e){let e=r.id;if(null==e)continue;let a=this.features.get(e);a&&this.updateCache(a,i),r.geometry?(a=function(e){let{id:i,geometry:r,properties:a}=e;if(!r)return;if("GeometryCollection"===r.type)throw Error("GeometryCollection not supported in dynamic mode.");let{type:n,coordinates:o}=r,s={id:i,type:1,geometry:[],tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},l=s.geometry;if("Point"===n)x(o,l,s);else if("MultiPoint"===n)for(let e of o)x(e,l,s);else if("LineString"===n)s.type=2,v(o,l,s);else if("MultiLineString"===n)s.type=2,b(o,l,s);else if("Polygon"===n)s.type=3,b(o,l,s,!0);else{if("MultiPolygon"!==n)throw Error("Input data is not a valid GeoJSON object.");for(let e of(s.type=3,o))b(e,l,s,!0)}return s}(r),this.updateCache(a,i),this.features.set(e,a)):this.features.delete(e),this.updateCache(a,i)}}updateCache(e,i){for(let{canonical:r,uid:a}of Object.values(i)){let{z:n,x:o,y:s}=r;y(e,Math.pow(2,n),o,s)&&delete i[a]}}getTile(i,r,a){let n=Math.pow(2,i),o=[];for(let i of this.features.values())y(i,n,r,a)&&o.push(function(i,r,a,n){let{id:o,type:s,geometry:l,tags:h}=i,u=[];
7if(1===s)for(let i=0;i<l.length;i+=2){let o=Math.round(e.ai*(l[i+0]*r-a)),s=Math.round(e.ai*(l[i+1]*r-n));u.push([o,s])}else for(let i of l)!function(i,r,a,n,o){let s,l=e.ai+128;for(let h=0;h<i.length-2;h+=2){let u=Math.round(e.ai*(i[h+0]*r-a)),c=Math.round(e.ai*(i[h+1]*r-n)),d=Math.round(e.ai*(i[h+2]*r-a)),p=Math.round(e.ai*(i[h+3]*r-n)),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>=l&&d>=l||(u>=l?(c+=Math.round((l-u)/f*m),u=l):d>=l&&(p=c+Math.round((l-u)/f*m),d=l),c>=l&&p>=l||(c>=l?(u+=Math.round((l-c)/m*f),c=l):p>=l&&(d=u+Math.round((l-c)/m*f),p=l),s&&u===s[s.length-1][0]&&c===s[s.length-1][1]||(s=[[u,c]],o.push(s)),s.push([d,p])))))}}(i,r,a,n,u);return{id:o,type:s,geometry:u,tags:h}}(i,n,r,a));return{features:o}}getFeatures(){return[...this.features.values()]}}function y({minX:e,minY:i,maxX:r,maxY:a},n,o,s){return e<(o+1+_)/n&&i<(s+1+_)/n&&r>(o-_)/n&&a>(s-_)/n}function x([i,r],a,n){let o=e.av(i),s=e.aC(r);s=s<0?0:s>1?1:s,a.push(o,s),n.minX=Math.min(n.minX,o),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,o),n.maxY=Math.max(n.maxY,s)}function v(e,i,r,a=!1,n=!1){let o=[];for(let i of e)x(i,o,r);i.push(o),a&&function(e,i){let r=0;for(let i=0,a=e.length,n=a-2;i<a;n=i,i+=2)r+=(e[i]-e[n])*(e[i+1]+e[n+1]);if(r>0===i)for(let i=0,r=e.length;i<r/2;i+=2){let a=e[i],n=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=a,e[r-1-i]=n}}(o,n)}function b(e,i,r,a=!1){for(let n=0;n<e.length;n++)v(e[n],i,r,a,0===n)}var w,T,S,M,E={exports:{}},A=function(){if(M)return E.exports;M=1;var i=e.eg(),r=function(){if(S)return T;S=1;
7var i=e.ee(),r=e.ef().VectorTileFeature;function a(e,i){this.options=i||{},this.features=e,this.length=e.length}function n(e,i){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=i||4096}return T=a,a.prototype.feature=function(e){return new n(this.features[e],this.options.extent)},n.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var r=0;r<e.length;r++){for(var a=e[r],n=[],o=0;o<a.length;o++)n.push(new i(a[o][0],a[o][1]));this.geometry.push(n)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,i=1/0,r=-1/0,a=1/0,n=-1/0,o=0;o<e.length;o++)for(var s=e[o],l=0;l<s.length;l++){var h=s[l];i=Math.min(i,h.x),r=Math.max(r,h.x),a=Math.min(a,h.y),n=Math.max(n,h.y)}return[i,a,r,n]},n.prototype.toGeoJSON=r.prototype.toGeoJSON,T}();function a(e){var r=new i;return function(e,i){for(var r in e.layers)i.writeMessage(3,n,e.layers[r])}(e,r),r.finish()}function n(e,i){i.writeVarintField(15,e.version||1),i.writeStringField(1,e.name||""),i.writeVarintField(5,e.extent||4096);var r,a={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<e.length;r++)a.feature=e.feature(r),i.writeMessage(2,o,a);var n=a.keys;for(r=0;r<n.length;r++)i.writeStringField(3,n[r]);var s=a.values;for(r=0;r<s.length;r++)i.writeMessage(4,h,s[r])}function o(e,i){var r=e.feature;void 0!==r.id&&i.writeVarintField(1,r.id),i.writeMessage(2,s,e),i.writeVarintField(3,r.type),i.writeMessage(4,l,r)}function s(e,i){var r=e.feature,a=e.keys,n=e.values,o=e.keycache,s=e.valuecache;for(var l in r.properties){var h=r.properties[l],u=o[l];if(null!==h){void 0===u&&(a.push(l),o[l]=u=a.length-1),i.writeVarint(u);var c=typeof h;"string"!==c&&"boolean"!==c&&"number"!==c&&(h=JSON.stringify(h));var d=c+":"+h,p=s[d];void 0===p&&(n.push(h),s[d]=p=n.length-1),i.writeVarint(p)}}}function l(e,i){for(var r=e.loadGeometry(),a=e.type,n=0,o=0,s=r.length,l=0;l<s;l++){var h=r[l],u=1;1===a&&(u=h.length),i.writeVarint((u<<3)+1);for(var c=3===a?h.length-1:h.length,d=0;d<c;d++){1===d&&1!==a&&i.writeVarint((c-1<<3)+2);var p=h[d].x-n,f=h[d].y-o;i.writeVarint(p<<1^p>>31),i.writeVarint(f<<1^f>>31),n+=p,o+=f}3===a&&i.writeVarint(15)}}function h(e,i){var r=typeof e;"string"===r?i.writeStringField(1,e):"boolean"===r?i.writeBooleanField(7,e):"number"===r&&(e%1!=0?i.writeDoubleField(3,e):e<0?i.writeSVarintField(6,e):i.writeVarintField(5,e))}return E.exports=a,E.exports.fromVectorTileJs=a,E.exports.fromGeojsonVt=function(e,i){i=i||{};var n={};for(var o in e)n[o]=new r(e[o].features,i),n[o].name=o,n[o].version=i.version,n[o].extent=i.extent;return a({layers:n})},E.exports.GeoJSONWrapper=r,E.exports}(),I=e.eh(A);let C={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},P=Math.fround||(w=new Float32Array(1),e=>(w[0]=+e,w[0]));class z{constructor(e){this.options=Object.assign(Object.create(C),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:i,minZoom:r,maxZoom:a}=this.options;i&&console.time("total time");let n=`prepare ${e.length} points`;i&&console.time(n),this.points=e;let o=[];for(let i=0;i<e.length;i++){let r=e[i];if(!r.geometry)continue;let[a,n]=r.geometry.coordinates,s=P(L(a)),l=P(O(n));o.push(s,l,1/0,i,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[a+1]=this._createTree(o);i&&console.timeEnd(n);for(let e=a;e>=r;e--){let r=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),i&&console.log("z%d: %d clusters in %dms",e,s.numItems,Date.now()-r)}return i&&console.timeEnd("total time"),this}getClusters(e,i){let r=((e[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[1])),n=180===e[2]?180:((e[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,n=180;else if(r>n){let e=this.getClusters([r,a,180,o],i),s=this.getClusters([-180,a,n,o],i);return e.concat(s)}let s=this.trees[this._limitZoom(i)],l=s.range(L(r),O(o),L(n),O(a)),h=s.data,u=[];for(let e of l){let i=this.stride*e;u.push(h[i+5]>1?D(h,i,this.clusterProps):this.points[h[i+3]])}return u}getChildren(e){let i=this._getOriginId(e),r=this._getOriginZoom(e),a="No cluster with the specified id.",n=this.trees[r];if(!n)throw Error(a);let o=n.data;if(i*this.stride>=o.length)throw Error(a);let s=this.options.radius/(this.options.extent*Math.pow(2,r-1)),l=n.within(o[i*this.stride],o[i*this.stride+1],s),h=[];for(let i of l){let r=i*this.stride;o[r+4]===e&&h.push(o[r+5]>1?D(o,r,this.clusterProps):this.points[o[r+3]])}if(0===h.length)throw Error(a);return h}getLeaves(e,i,r){let a=[];return this._appendLeaves(a,e,i=i||10,r=r||0,0),a}getTile(e,i,r){let a=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,l=s/o,h=(r-l)/n,u=(r+1+l)/n,c={features:[]};return this._addTileFeatures(a.range((i-l)/n,h,(i+1+l)/n,u),a.data,i,r,n,c),0===i&&this._addTileFeatures(a.range(1-l/n,h,1,u),a.data,n,r,n,c),i===n-1&&this._addTileFeatures(a.range(0,h,l/n,u),a.data,-1,r,n,c),c.features.length?c:null}getClusterExpansionZoom(e){let i=this._getOriginZoom(e)-1;for(;i<=this.options.maxZoom;){let r=this.getChildren(e);if(i++,1!==r.length)break;e=r[0].properties.cluster_id}return i}_appendLeaves(e,i,r,a,n){for(let o of this.getChildren(i)){let i=o.properties;if(i&&i.cluster?n+i.point_count<=a?n+=i.point_count:n=this._appendLeaves(e,i.cluster_id,r,a,n):n<a?n++:e.push(o),e.length===r)break}return n}_createTree(i){let r=new e.bE(i.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<i.length;e+=this.stride)r.add(i[e],i[e+1]);return r.finish(),r.data=i,r}_addTileFeatures(e,i,r,a,n,o){for(let s of e){let e,l,h,u,c=s*this.stride,d=i[c+5]>1;if(d)e=R(i,c,this.clusterProps),l=i[c],h=i[c+1];else{let r=this.points[i[c+3]];e=r.properties;let[a,n]=r.geometry.coordinates;l=L(a),h=O(n)}let p={type:1,geometry:[[Math.round(this.options.extent*(l*n-r)),Math.round(this.options.extent*(h*n-a))]],tags:e};void 0!==(u=d||this.options.generateId?i[c+3]:this.points[i[c+3]].id)&&(p.id=u),o.features.push(p)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,i){let{radius:r,extent:a,reduce:n,minPoints:o}=this.options,s=r/(a*Math.pow(2,i)),l=e.data,h=[],u=this.stride;for(let r=0;r<l.length;r+=u){if(l[r+2]<=i)continue;l[r+2]=i;let a=l[r],c=l[r+1],d=e.within(l[r],l[r+1],s),p=l[r+5],f=p;for(let e of d){let r=e*u;l[r+2]>i&&(f+=l[r+5])}if(f>p&&f>=o){let e,o=a*p,s=c*p,m=-1,_=(r/u<<5)+(i+1)+this.points.length;for(let a of d){let h=a*u;if(l[h+2]<=i)continue;l[h+2]=i;let c=l[h+5];o+=l[h]*c,s+=l[h+1]*c,l[h+4]=_,n&&(e||(e=this._map(l,r,!0),m=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(l,h)))}l[r+4]=_,h.push(o/f,s/f,1/0,_,-1,f),n&&h.push(m)}else{for(let e=0;e<u;e++)h.push(l[r+e]);if(f>1)for(let e of d){let r=e*u;if(!(l[r+2]<=i)){l[r+2]=i;for(let e=0;e<u;e++)h.push(l[r+e])}}}}return h}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,i,r){if(e[i+5]>1){let a=this.clusterProps[e[i+6]];return r?Object.assign({},a):a}let a=this.points[e[i+3]].properties,n=this.options.map(a);return r&&n===a?Object.assign({},n):n}}function D(e,i,r){return{type:"Feature",id:e[i+3],properties:R(e,i,r),geometry:{type:"Point",coordinates:[360*(e[i]-.5),360*Math.atan(Math.exp((180-360*e[i+1])*Math.PI/180)
7)/Math.PI-90]}}}function R(e,i,r){let a=e[i+5],n=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a,o=e[i+6];return Object.assign(-1===o?{}:Object.assign({},r[o]),{cluster:!0,cluster_id:e[i+3],point_count:a,point_count_abbreviated:n})}function L(e){return e/360+.5}function O(e){let i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function k(e,i,r,a){let n={id:e??null,type:i,geometry:r,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===i||"MultiPoint"===i||"LineString"===i)F(n,r);else if("Polygon"===i)F(n,r[0]);else if("MultiLineString"===i)for(let e of r)F(n,e);else if("MultiPolygon"===i)for(let e of r)F(n,e[0]);return n}function F(e,i){for(let r=0;r<i.length;r+=3)e.minX=Math.min(e.minX,i[r]),e.minY=Math.min(e.minY,i[r+1]),e.maxX=Math.max(e.maxX,i[r]),e.maxY=Math.max(e.maxY,i[r+1])}function B(e,i,r,a){if(!i.geometry)return;let n=i.geometry.coordinates;if(n&&0===n.length)return;let o=i.geometry.type,s=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),l=[],h=i.id;if(r.promoteId?h=i.properties[r.promoteId]:r.generateId&&(h=a||0),"Point"===o)N(n,l);else if("MultiPoint"===o)for(let e of n)N(e,l);else if("LineString"===o)V(n,l,s,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(let r of n)V(r,l=[],s,!1),e.push(k(h,"LineString",l,i.properties));return}U(n,l,s,!1)}else if("Polygon"===o)U(n,l,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(let n of i.geometry.geometries)B(e,{id:h,geometry:n,properties:i.properties},r,a);return}throw Error("Input data is not a valid GeoJSON object.")}for(let e of n){let i=[];U(e,i,s,!0),l.push(i)}}e.push(k(h,o,l,i.properties))}function N(e,i){i.push(e[0]/360+.5,j(e[1]),0)}function V(e,i,r,a){let n,o,s=0;for(let r=0;r<e.length;r++){let l=e[r][0]/360+.5,h=j(e[r][1]);i.push(l,h,0),r>0&&(s+=a?(n*h-l*o)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(h-o,2))),n=l,o=h}let l=i.length-3;i[2]=1,function e(i,r,a,n){let o=n,s=r+(a-r>>1),l,h=a-r,u=i[r],c=i[r+1],d=i[a],p=i[a+1];for(let e=r+3;e<a;e+=3){let r=function(e,i,r,a,n,o){let s=n-r,l=o-a;if(0!==s||0!==l){let h=((e-r)*s+(i-a)*l)/(s*s+l*l);h>1?(r=n,a=o):h>0&&(r+=s*h,a+=l*h)}return(s=e-r)*s+(l=i-a)*l}(i[e],i[e+1],u,c,d,p);if(r>o)l=e,o=r;else if(r===o){let i=Math.abs(e-s);i<h&&(l=e,h=i)}}o>n&&(l-r>3&&e(i,r,l,n),i[l+2]=o,a-l>3&&e(i,l,a,n))}(i,0,l,r),i[l+2]=1,i.size=Math.abs(s),i.start=0,i.end=i.size}function U(e,i,r,a){for(let n=0;n<e.length;n++){let o=[];V(e[n],o,r,a),i.push(o)}}function j(e){let i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function G(e,i,r,a,n,o,s,l){if(a/=i,o>=(r/=i)&&s<a)return e;if(s<r||o>=a)return null;let h=[];for(let i of e){let e=i.geometry,o=i.type,s=0===n?i.minX:i.minY,m=0===n?i.maxX:i.maxY;if(s>=r&&m<a){h.push(i);continue}if(m<r||s>=a)continue;let _=[];
7if("Point"===o||"MultiPoint"===o){var u=e,c=_,d=r,p=a,f=n;for(let e=0;e<u.length;e+=3){let i=u[e+f];i>=d&&i<=p&&$(c,u[e],u[e+1],u[e+2])}}else if("LineString"===o)q(e,_,r,a,n,!1,l.lineMetrics);else if("MultiLineString"===o)H(e,_,r,a,n,!1);else if("Polygon"===o)H(e,_,r,a,n,!0);else if("MultiPolygon"===o)for(let i of e){let e=[];H(i,e,r,a,n,!0),e.length&&_.push(e)}if(_.length){if(l.lineMetrics&&"LineString"===o){for(let e of _)h.push(k(i.id,o,e,i.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===_.length?(o="LineString",_=_[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===_.length?"Point":"MultiPoint"),h.push(k(i.id,o,_,i.tags))}}return h.length?h:null}function q(e,i,r,a,n,o,s){let l=Z(e),h=0===n?W:X,u,c,d=e.start;for(let p=0;p<e.length-3;p+=3){let f=e[p],m=e[p+1],_=e[p+2],g=e[p+3],y=e[p+4],x=0===n?f:m,v=0===n?g:y,b=!1;s&&(u=Math.sqrt(Math.pow(f-g,2)+Math.pow(m-y,2))),x<r?v>r&&(c=h(l,f,m,g,y,r),s&&(l.start=d+u*c)):x>a?v<a&&(c=h(l,f,m,g,y,a),s&&(l.start=d+u*c)):$(l,f,m,_),v<r&&x>=r&&(c=h(l,f,m,g,y,r),b=!0),v>a&&x<=a&&(c=h(l,f,m,g,y,a),b=!0),!o&&b&&(s&&(l.end=d+u*c),i.push(l),l=Z(e)),s&&(d+=u)}let p=e.length-3,f=e[p],m=e[p+1],_=0===n?f:m;_>=r&&_<=a&&$(l,f,m,e[p+2]),p=l.length-3,o&&p>=3&&(l[p]!==l[0]||l[p+1]!==l[1])&&$(l,l[0],l[1],l[2]),l.length&&i.push(l)}function Z(e){let i=[];return i.size=e.size,i.start=e.start,i.end=e.end,i}function H(e,i,r,a,n,o){for(let s of e)q(s,i,r,a,n,o,!1)}function $(e,i,r,a){e.push(i,r,a)}function W(e,i,r,a,n,o){let s=(o-i)/(a-i);return $(e,o,r+(n-r)*s,1),s}function X(e,i,r,a,n,o){let s=(o-r)/(n-r);return $(e,i+(a-i)*s,o,1),s}function Y(e,i){let r=[];for(let a=0;a<e.length;a++){let n,o=e[a],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)n=K(o.geometry,i);else if("MultiLineString"===s||"Polygon"===s)for(let e of(n=[],o.geometry))n.push(K(e,i));else if("MultiPolygon"===s)for(let e of(n=[],o.geometry)){let r=[];for(let a of e)r.push(K(a,i));n.push(r)}r.push(k(o.id,s,n,o.tags))}return r}function K(e,i){let r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(let a=0;a<e.length;a+=3)r.push(e[a]+i,e[a+1],e[a+2]);return r}function J(e,i){if(e.transformed)return e;let r=1<<e.z,a=e.x,n=e.y;for(let o of e.features){let e=o.geometry,s=o.type;if(o.geometry=[],1===s)for(let s=0;s<e.length;s+=2)o.geometry.push(Q(e[s],e[s+1],i,r,a,n));else for(let s=0;s<e.length;s++){let l=[];for(let o=0;o<e[s].length;o+=2)l.push(Q(e[s][o],e[s][o+1],i,r,a,n));o.geometry.push(l)}}return e.transformed=!0,e}function Q(e,i,r,a,n,o){return[Math.round(r*(e*a-n)),Math.round(r*(i*a-o))]}function ee(e,i,r,a,n,o){let s=a*a;if(a>0&&i.size<(n?s:a))return void(r.numPoints+=i.length/3);let l=[];for(let e=0;e<i.length;e+=3)(0===a||i[e+2]>s)&&(r.numSimplified++,l.push(i[e],i[e+1])),r.numPoints++;n&&function(e,i){let r=0;for(let i=0,a=e.length,n=a-2;i<a;n=i,i+=2)r+=(e[i]-e[n])*(e[i+1]+e[n+1]);if(r>0===i)for(let i=0,r=e.length;i<r/2;i+=2){let a=e[i],n=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=a,e[r-1-i]=n}}(l,o),e.push(l)}let et={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ei{constructor(e,i){const r=(i=this.options=function(e,i){for(let r in i)e[r]=i[r];return e}(Object.create(et),i)).debug;if(r&&console.time("preprocess data"),i.maxZoom<0||i.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(i.promoteId&&i.generateId)throw Error("promoteId and generateId cannot be used together.");let a=function(e,i){let r=[];if("FeatureCollection"===e.type)for(let a=0;a<e.features.length;a++)B(r,e.features[a],i,a);else B(r,"Feature"===e.type?e:{geometry:e},i);return r}(e,i);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",i.indexMaxZoom,i.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(a=function(e,i){let r=i.buffer/i.extent,a=e,n=G(e,1,-1-r,r,0,-1,2,i),o=G(e,1,1-r,2+r,0,-1,2,i);return(n||o)&&(a=G(e,1,-r,1+r,0,-1,2,i)||[],n&&(a=Y(n,1).concat(a)),o&&(a=a.concat(Y(o,-1)))),a}(a,i)).length&&this.splitTile(a,0,0,0),r&&(a.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,i,r,a,n,o,s){let l=[e,i,r,a],h=this.options,u=h.debug;for(;l.length;){a=l.pop(),r=l.pop(),i=l.pop(),e=l.pop();let c=1<<i,d=er(i,r,a),p=this.tiles[d];if(!p&&(u>1&&console.time("creation"),p=this.tiles[d]=function(e,i,r,a,n){let o=i===n.maxZoom?0:n.tolerance/((1<<i)*n.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:r,y:a,z:i,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};
7for(let i of e)!function(e,i,r,a){let n=i.geometry,o=i.type,s=[];if(e.minX=Math.min(e.minX,i.minX),e.minY=Math.min(e.minY,i.minY),e.maxX=Math.max(e.maxX,i.maxX),e.maxY=Math.max(e.maxY,i.maxY),"Point"===o||"MultiPoint"===o)for(let i=0;i<n.length;i+=3)s.push(n[i],n[i+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)ee(s,n,e,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let i=0;i<n.length;i++)ee(s,n[i],e,r,"Polygon"===o,0===i);else if("MultiPolygon"===o)for(let i=0;i<n.length;i++){let a=n[i];for(let i=0;i<a.length;i++)ee(s,a[i],e,r,!0,0===i)}if(s.length){let r=i.tags||null;if("LineString"===o&&a.lineMetrics){for(let e in r={},i.tags)r[e]=i.tags[e];r.mapbox_clip_start=n.start/n.size,r.mapbox_clip_end=n.end/n.size}let l={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:r};null!==i.id&&(l.id=i.id),e.features.push(l)}}(s,i,o,n);return s}(e,i,r,a,h),this.tileCoords.push({z:i,x:r,y:a}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,r,a,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let e=`z${i}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(p.source=e,null==n){if(i===h.indexMaxZoom||p.numPoints<=h.indexMaxPoints)continue}else{if(i===h.maxZoom||i===n)continue;if(null!=n){let e=n-i;if(r!==o>>e||a!==s>>e)continue}}if(p.source=null,0===e.length)continue;u>1&&console.time("clipping");let f=.5*h.buffer/h.extent,m=.5-f,_=.5+f,g=1+f,y=null,x=null,v=null,b=null,w=G(e,c,r-f,r+_,0,p.minX,p.maxX,h),T=G(e,c,r+m,r+g,0,p.minX,p.maxX,h);e=null,w&&(y=G(w,c,a-f,a+_,1,p.minY,p.maxY,h),x=G(w,c,a+m,a+g,1,p.minY,p.maxY,h),w=null),T&&(v=G(T,c,a-f,a+_,1,p.minY,p.maxY,h),b=G(T,c,a+m,a+g,1,p.minY,p.maxY,h),T=null),u>1&&console.timeEnd("clipping"),l.push(y||[],i+1,2*r,2*a),l.push(x||[],i+1,2*r,2*a+1),l.push(v||[],i+1,2*r+1,2*a),l.push(b||[],i+1,2*r+1,2*a+1)}}getTile(e,i,r){e*=1,i*=1,r*=1;let{extent:a,debug:n}=this.options;if(e<0||e>24)return null;let o=1<<e,s=er(e,i=i+o&o-1,r);if(this.tiles[s])return J(this.tiles[s],a);n>1&&console.log("drilling down to z%d-%d-%d",e,i,r);let l,h=e,u=i,c=r;for(;!l&&h>0;)h--,u>>=1,c>>=1,l=this.tiles[er(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,e,i,r),n>1&&console.timeEnd("drilling down"),this.tiles[s]?J(this.tiles[s],a):null):null}}function er(e,i,r){return 32*((1<<e)*r+i)+e}function ea(e,i){let r=e.tileID.canonical;if(!this._geoJSONIndex)return void i(null,null);let a=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!a)return void i(null,null);let n=new m(a.features),o=I(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),i(null,{vectorTile:n,rawData:o.buffer})}class en extends h{constructor(e,i,r,a,n,o){super(e,i,r,a,ea,o),n&&(this.loadGeoJSON=n),this._dynamicIndex=new g}loadData(r,a){let n=r&&r.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(r,(s,l)=>{if(s||!l)return a(s);if("object"!=typeof l)return a(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{try{var h,u;if(r.filter){let i=e.X(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));l.features=l.features.filter(e=>i.value.evaluate({zoom:0},e))}r.dynamic?("Feature"===l.type&&(l={type:"FeatureCollection",features:[l]}),r.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(l.features,this.loaded),r.cluster&&(l.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=r.cluster?new z(function({superclusterOptions:i,clusterProperties:r}){if(!r||!i)return i;let a={},n={},o={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r);for(let i of l){let[o,s]=r[i],l=e.X(s),h=e.X("string"==typeof o?[o,["accumulated"],["get",i]]:o);a[i]=l.value,n[i]=h.value}return i.map=e=>{s.properties=e;let i={};for(let e of l)i[e]=a[e].evaluate(o,s);return i},i.reduce=(e,i)=>{for(let r of(s.properties=i,l))o.accumulated=e[r],e[r]=n[r].evaluate(o,s)},i}(r)).load(l.features):r.dynamic?this._dynamicIndex:(h=l,u=r.geojsonVtOptions,new ei(h,u))}catch(e){return a(e)}let s={};if(o){let e=i(n);e&&(s.resourceTiming={},s.resourceTiming[r.source]=JSON.parse(JSON.stringify(e)))}a(null,s)}})}reloadTile(e,i){let r=this.loaded;return r&&r[e.uid]?e.partial?i(null,void 0):super.reloadTile(e,i):this.loadTile(e,i)}loadGeoJSON(i,r){if(i.request)e.n(i.request,r);else{if("string"!=typeof i.data)return r(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));try{return r(null,JSON.parse(i.data))}catch(e){return r(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,i){try{i(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){i(e)}}getClusterChildren(e,i){try{i(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){i(e)}}getClusterLeaves(e,i){try{i(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){i(e)}}}class eo{constructor(i,r){this.tileID=new e.aH(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=r}parse(i,r,a,n){this.status="parsing";let o=new e.aH(a.tileID.overscaledZ,a.tileID.wrap,a.tileID.canonical.z,a.tileID.canonical.x,a.tileID.canonical.y),s=[],l=r.familiesBySource[a.source],h=new e.e0(o,a.promoteId);return h.bucketLayerIDs=[],h.is3DTile=!0,e.ei(i).then(i=>{if(!i)return n(Error("Could not parse tile"));let r=e.ej(i,1/e.cd(a.tileID.canonical)),u=i.json.extensionsUsed&&i.json.extensionsUsed.includes("MAPBOX_mesh_features")||i.json.asset.extras&&i.json.asset.extras.MAPBOX_mesh_features,c=i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression"),d=new e.aa(this.zoom,{brightness:this.brightness});for(let i in l)for(let a of l[i]){let i=a[0];h.bucketLayerIDs.push(a.map(i=>e.C(i.id,i.scope))),i.recalculate(d,[]);let n=new e.ek(a,r,o,u,c,this.brightness,h);u||(n.needsUpload=!0),s.push(n),n.evaluate(i)}this.status="done",n(null,{buckets:s,featureIndex:h,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(e=>n(Error(e.message)))}}class es{constructor(e,i,r,a,n,o){this.actor=e,this.layerIndex=i,this.availableImages=r,this.brightness=o,this.loading={},this.loaded={}}loadTile(i,r){let a=i.uid,n=this.loading[a]=new eo(i,this.brightness);e.bj(i.request,(e,o)=>{let s=!this.loading[a];return delete this.loading[a],s||e?(n.status="done",s||(this.loaded[a]=n),r(e)):o&&0!==o.byteLength?void n.parse(o,this.layerIndex,i,(e,i)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[a]=n,e||!i?r(e):r(null,i)}):(n.status="done",this.loaded[a]=n,r())})}reloadTile(e,i){let r=this.loaded,a=e.uid;if(r&&r[a]){let n=r[a];n.projection=e.projection,n.brightness=e.brightness;let o=(r,a)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,i)),i(r,a)};"parsing"===n.status?n.reloadCallback=o:"done"===n.status&&this.loadTile(e,i)}}abortTile(e,i){let r=e.uid;this.loading[r]&&delete this.loading[r],i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}
7class el{constructor(i){this.self=i,this.actor=new e.el(i,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.imageRasterizer=new e.y,this.projections={},this.defaultProjection=e.bP({name:"mercator"}),this.workerSourceTypes={vector:h,geojson:en,"raster-dem":u,"raster-array":d,"batched-model":es},this.workerSources={},this.self.registerWorkerSource=(e,i)=>{if(this.workerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=i},this.self.registerRTLTextPlugin=i=>{if(e.em.isParsed())throw Error("RTL text plugin already registered.");e.em.applyArabicShaping=i.applyArabicShaping,e.em.processBidirectionalText=i.processBidirectionalText,e.em.processStyledBidirectionalText=i.processStyledBidirectionalText}}clearCaches(e,i,r){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],r()}checkIfReady(e,i,r){r()}setReferrer(e,i){this.referrer=i}spriteLoaded(i,{scope:r,isLoaded:a}){if(this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={}),this.isSpriteLoaded[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){let r=o[i];r instanceof h&&(r.isSpriteLoaded=a,r.fire(new e.A("isSpriteLoaded")))}}}setImages(e,{scope:i,images:r},a){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][i]=r,this.workerSources[e]&&this.workerSources[e][i]){for(let a in this.workerSources[e][i]){let n=this.workerSources[e][i][a];for(let e in n)n[e].availableImages=r}a()}else a()}setProjection(i,r){this.projections[i]=e.bP(r)}setBrightness(e,i,r){this.brightness=i,r()}setLayers(e,i,r){this.getLayerIndex(e,i.scope).replace(i.layers,i.options),r()}updateLayers(e,i,r){this.getLayerIndex(e,i.scope).update(i.layers,i.removedIds,i.options),r()}loadTile(e,i,r){i.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source,i.scope).loadTile(i,r)}decodeRasterArray(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).decodeRasterArray(i,r)}reloadTile(e,i,r){i.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source,i.scope).reloadTile(i,r)}abortTile(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).abortTile(i,r)}removeTile(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).removeTile(i,r)}removeSource(e,i,r){if(!(this.workerSources[e]&&this.workerSources[e][i.scope]&&this.workerSources[e][i.scope][i.type]&&this.workerSources[e][i.scope][i.type][i.source]))return;let a=this.workerSources[e][i.scope][i.type][i.source];delete this.workerSources[e][i.scope][i.type][i.source],void 0!==a.removeSource?a.removeSource(i,r):r()}loadWorkerSource(e,i,r){try{this.self.importScripts(i.url),r()}catch(e){r(e.toString())}}syncRTLPluginState(i,r,a){try{e.em.setState(r);let i=e.em.getPluginURL();if(e.em.isLoaded()&&!e.em.isParsed()&&null!=i){this.self.importScripts(i);let r=e.em.isParsed();a(r?void 0:Error(`RTL Text Plugin failed to import scripts from ${i}`),r)}}catch(e){a(e.toString())}}setDracoUrl(e,i){this.dracoUrl=i}getAvailableImages(e,i){this.availableImages[e]||(this.availableImages[e]={});let r=this.availableImages[e][i];return r||(r=[]),r}getLayerIndex(e,i){this.layerIndexes[e]||(this.layerIndexes[e]={});let r=this.layerIndexes[e][i];return r||((r=this.layerIndexes[e][i]=new a).scope=i),r}getWorkerSource(e,i,r,a){let n=this.workerSources;return n[e]||(n[e]={}),n[e][a]||(n[e][a]={}),n[e][a][i]||(n[e][a][i]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),n[e][a][i][r]||(n[e][a][i][r]=new this.workerSourceTypes[i]({send:(i,r,a,n,o,s)=>{this.actor.send(i,r,a,e,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(e,a),this.getAvailableImages(e,a),this.isSpriteLoaded[e][a],void 0,this.brightness)),n[e][a][i][r]}rasterizeImages(e,i,r){let a=new Map;for(let[r,{image:n,imageVariant:o}]of i.tasks.entries()){let s=this.imageRasterizer.rasterize(o,n,i.scope,e);a.set(r,s)}r(void 0,a)}removeRasterizedImages(e,i,r){this.imageRasterizer.removeImagesFromCacheByIds(i.imageIds,i.scope,e),r()}enforceCacheSizeLimit(i,r){e.en(r)}getWorkerPerformanceMetrics(e,i,r){r(void 0,void 0)}}return"u">typeof WorkerGlobalScope&&"u">typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new el(self)),el}),a(["./shared"],function(e){let i,r,a;var n="3.11.0";let o={create:"create",load:"load",fullLoad:"fullLoad"},s={mark(e){performance.mark(e)},measure(e,i,r){performance.measure(e,i,r)}};function l(i){let r=i.name.split("?")[0];return e.a(r)&&r.includes("mapbox-gl.js")?"javascript":e.a(r)&&r.includes("mapbox-gl.css")?"css":e.b(r)?"fontRange":e.c(r)?"sprite":e.i(r)?"style":e.d(r)?"tilejson":"other"}var h,u={},c=function(){if(h)return u;function e(e){return!i(e)}function i(i){var a;return"u"<typeof window||"u"<typeof document?"not a browser":!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,i,r=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(r);try{i=new Worker(a),e=!0}catch(i){e=!1}return i&&i.terminate(),URL.revokeObjectURL(a),e}()?"insufficient worker support":!function(){var e=document.createElement("canvas");e.width=e.height=1;var i=e.getContext("2d");if(!i)return!1;var r=i.getImageData(0,0,1,1);return r&&r.width===e.width}
7()?"insufficient Canvas/getImageData support":(void 0===r[a=i&&i.failIfMajorPerformanceCaveat]&&(r[a]=function(i){var r,a,n,o=(r=document.createElement("canvas"),(a=Object.create(e.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.getContext("webgl2",a));if(!o)return!1;try{n=o.createShader(o.VERTEX_SHADER)}catch(e){return!1}return!(!n||o.isContextLost())&&(o.shaderSource(n,"void main() {}"),o.compileShader(n),!0===o.getShaderParameter(n,o.COMPILE_STATUS))}(a)),r[a]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support")}h=1,u.supported=e,u.notSupportedReason=i;var r={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},u}();function d(e,i,r){let a=document.createElement(e);return null!=i&&(a.className=i),r&&r.appendChild(a),a}function p(e,i,r){let a=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e of Object.keys(i))a.setAttributeNS(null,e,String(i[e]));return r&&r.appendChild(a),a}let f="u">typeof document?document.documentElement&&document.documentElement.style:null,m=f&&void 0!==f.userSelect?"userSelect":"WebkitUserSelect";function _(){f&&m&&(i=f[m],f[m]="none")}function g(){f&&m&&(f[m]=i)}function y(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",y,!0)}function x(){window.addEventListener("click",y,!0),window.setTimeout(()=>{window.removeEventListener("click",y,!0)},0)}function v(e,i){let r=e.getBoundingClientRect();return T(e,r,i)}function b(e,i){let r=e.getBoundingClientRect(),a=[];for(let n=0;n<i.length;n++)a.push(T(e,r,i[n]));return a}function w(e){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&2===e.button&&e.ctrlKey?0:e.button}function T(i,r,a){let n=i.offsetWidth===r.width?1:i.offsetWidth/r.width;return new e.P((a.clientX-r.left)*n,(a.clientY-r.top)*n)}let S="NO_ACCESS_TOKEN";class M{constructor(e,i,r){this._transformRequestFn=e,this._customAccessToken=i,this._silenceAuthErrors=!!r,this._createSkuToken()}_createSkuToken(){let e=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}normalizeStyleURL(i,r){if(!e.f(i))return i;let a=A(i);return a.params.push(`sdk=js-${n}`),a.path=`/styles/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!e.f(i))return i;let a=A(i);return a.path=`/fonts/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeModelURL(i,r){if(!e.f(i))return i;let a=A(i);return a.path=`/models/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeSourceURL(i,r,a,n){if(!e.f(i))return i;let o=A(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=A(i);return e.f(i)?(a.path=`/styles/v1${a.path}/iconset.pbf`,this._makeAPIURL(a,this._customAccessToken||r)):I(a)}normalizeSpriteURL(i,r,a,n){let o=A(i);return e.f(i)?(o.path=`/styles/v1${o.path}/sprite${r}${a}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${r}${a}`,I(o))}normalizeTileURL(i,r,a){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!e.f(i))return i;let n=A(i);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||a&&"raster"!==n.authority&&512===a?"@2x":""}${e.m.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${e.e.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${e.e.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${e.e.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${e.e.TILE_URL_VERSION}${n.path}`);let o=this._customAccessToken||function(e){for(let i of e){let e=i.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||e.e.ACCESS_TOKEN;return e.e.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(i,r){let a=A(i);if(!a.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!a.path.match(/\.[\w]+$/))return i;let n="mapbox://";a.path.match(/^\/raster\/v1\//)?n+=`raster/${a.path.replace(`/${e.e.RASTER_URL_PREFIX}/`,"")}`:a.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${a.path.replace(`/${e.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${a.path.replace(`/${e.e.TILE_URL_VERSION}/`,"")}`;let o=a.params;return r&&(o=o.filter(e=>!e.match(/^access_token=/))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(i,r){let a=!!r&&e.f(r),n=[];for(let r of i.tiles||[])e.h(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=A(e.e.API_URL);if(i.protocol=n.protocol,i.authority=n.authority,"http"===i.protocol){let e=i.params.indexOf("secure");e>=0&&i.params.splice(e,1)}if("/"!==n.path&&(i.path=`${n.path}${i.path}`),!e.e.REQUIRE_ACCESS_TOKEN)return I(i);if(r=r||e.e.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(e=>-1===e.indexOf("access_token")),i.params.push(`access_token=${r||""}`),I(i)}}let E=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function A(e){let i=e.match(E);if(!i)throw Error("Unable to parse URL object");return{protocol:i[1],authority:i[2],path:i[3]||"/",params:i[4]?i[4].split("&"):[]}}function I(e){let i=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${i}`}let C="mapbox.eventData";function P(i){if(!i)return null;let r=i.split(".");if(!r||3!==r.length)return null;
7try{return JSON.parse(e.j(r[1]))}catch(e){return null}}class z{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){let r=P(e.e.ACCESS_TOKEN),a="";return a=r&&r.u?e.k(r.u):e.e.ACCESS_TOKEN||"",i?`${C}.${i}:${a}`:`${C}:${a}`}fetchEventData(){let i=e.s("localStorage"),r=this.getStorageKey(),a=this.getStorageKey("uuid");if(i)try{let e=localStorage.getItem(r);e&&(this.eventData=JSON.parse(e));let i=localStorage.getItem(a);i&&(this.anonId=i)}catch(i){e.w("Unable to read from LocalStorage")}}saveEventData(){let i=e.s("localStorage"),r=this.getStorageKey(),a=this.getStorageKey("uuid"),n=this.anonId;if(i&&n)try{localStorage.setItem(a,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(r,JSON.stringify(this.eventData))}catch(i){e.w("Unable to write to LocalStorage")}}processRequests(e){}postEvent(i,r,a,n){if(!e.e.EVENTS_URL)return;let o=A(e.e.EVENTS_URL);o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);let s={event:this.type,created:new Date(i).toISOString()},l=r?e.l(s,r):s,h={url:I(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=e.p(h,e=>{this.pendingRequest=null,a(e),this.saveEventData(),this.processRequests(n)})}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}let D=new class extends z{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(i,r){e.e.EVENTS_URL&&e.e.ACCESS_TOKEN&&Array.isArray(i)&&i.some(i=>e.f(i)||e.h(i))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let r=P(e.e.ACCESS_TOKEN),a=r?r.u:e.e.ACCESS_TOKEN,o=a!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),o=!0);let s=this.queue.shift();if(this.eventData.lastSuccess){let e=new Date(this.eventData.lastSuccess),i=new Date(s),r=(s-this.eventData.lastSuccess)/864e5;o=o||r>=1||r<-1||e.getDate()!==i.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:"01","enabled.telemetry":!1,userId:this.anonId},e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=a)},i):this.processRequests()}},R=D.postTurnstileEvent.bind(D),L=new class extends z{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,a,n){this.skuToken=r,this.errorCb=n,e.e.EVENTS_URL&&(a||e.e.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},a):this.errorCb(Error(S)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:a}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),e.v(this.anonId)||(this.anonId=e.u()),this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:n,skuId:"01",skuToken:this.skuToken,userId:this.anonId},e=>{e?this.errorCb(e):r&&(this.success[r]=!0)},i))}remove(){this.errorCb=null}},O=L.postMapLoadEvent.bind(L),k=new class extends z{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(i){let r=this.mapInstanceIdMap.get(i);return r||(r=e.u(),this.mapInstanceIdMap.set(i,r)),r}getEventId(e){let i=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,i+1),i}postStyleLoadEvent(i,r){let{map:a,style:n,importedStyles:o}=r;if(!e.e.EVENTS_URL||!i&&!e.e.ACCESS_TOKEN)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(e){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:i,payload:r}=this.queue.shift();this.postEvent(i,r,()=>{},e)}},F=k.postStyleLoadEvent.bind(k),B=new class extends z{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){e.e.EVENTS_URL&&(i||e.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,performanceData:a}=this.queue.shift(),s=function(i){let r=performance.getEntriesByType("resource"),a=performance.getEntriesByType("mark"),s=function(e){let i={};if(e){for(let r in e)if("other"!==r)for(let a of e[r]){let e=`${r}ResolveRangeMin`,n=`${r}ResolveRangeMax`,o=`${r}RequestCount`,s=`${r}RequestCachedCount`;i[e]=Math.min(i[e]||1/0,a.startTime),i[n]=Math.max(i[n]||-1/0,a.responseEnd);let l=e=>{void 0===i[e]&&(i[e]=0),++i[e]};void 0!==a.transferSize&&0===a.transferSize&&l(s),l(o)}}return i}(function(e,i){let r={};if(e)for(let a of e){let e=i(a);void 0===r[e]&&(r[e]=[]),r[e].push(a)}return r}(r,l)),h=window.devicePixelRatio,u=navigator.connection||navigator.mozConnection||navigator.webkitConnection,c=u?u.effectiveType:void 0,d={counters:[],metadata:[],attributes:[]},p=(e,i,r)=>{null!=r&&e.push({name:i,value:r.toString()})};for(let e in s)p(d.counters,e,s[e]);if(i.interactionRange[0]!==1/0&&i.interactionRange[1]!==-1/0&&(p(d.counters,"interactionRangeMin",i.interactionRange[0]),p(d.counters,"interactionRangeMax",i.interactionRange[1])),a)for(let e of Object.keys(o)){let i=o[e],r=a.find(e=>e.name===i);
7r&&p(d.counters,i,r.startTime)}return p(d.counters,"visibilityHidden",i.visibilityHidden),p(d.attributes,"style",function(i){if(i)for(let r of i){let i=r.name.split("?")[0];if(e.i(i)){let e=i.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(r)),p(d.attributes,"terrainEnabled",i.terrainEnabled?"true":"false"),p(d.attributes,"fogEnabled",i.fogEnabled?"true":"false"),p(d.attributes,"projection",i.projection),p(d.attributes,"zoom",i.zoom),p(d.metadata,"devicePixelRatio",h),p(d.metadata,"connectionEffectiveType",c),p(d.metadata,"navigatorUserAgent",navigator.userAgent),p(d.metadata,"screenWidth",window.screen.width),p(d.metadata,"screenHeight",window.screen.height),p(d.metadata,"windowWidth",window.innerWidth),p(d.metadata,"windowHeight",window.innerHeight),p(d.metadata,"mapWidth",i.width/h),p(d.metadata,"mapHeight",i.height/h),p(d.metadata,"webglRenderer",i.renderer),p(d.metadata,"webglVendor",i.vendor),p(d.metadata,"sdkVersion",n),p(d.metadata,"sdkIdentifier","mapbox-gl-js"),d}(a);for(let e of s.metadata);for(let e of s.counters);for(let e of s.attributes);this.postEvent(r,s,()=>{},i)}},N=B.postPerformanceEvent.bind(B),V=new class extends z{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,a,n){if(!e.e.API_URL||!e.e.SESSION_PATH)return;let o=A(e.e.API_URL+e.e.SESSION_PATH);o.params.push(`sku=${r||""}`),o.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);let s={url:I(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e.g(s,e=>{this.pendingRequest=null,a(e),this.saveEventData(),this.processRequests(n)})}getSessionAPI(i,r,a,n){this.skuToken=r,this.errorCb=n,e.e.SESSION_PATH&&e.e.API_URL&&(a||e.e.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},a):this.errorCb(Error(S)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;let{id:i,timestamp:r}=this.queue.shift();i&&this.success[i]||this.getSession(r,this.skuToken,e=>{e?this.errorCb(e):i&&(this.success[i]=!0)},e)}remove(){this.errorCb=null}},U=V.getSessionAPI.bind(V),j=new Set;function G(e,i){i?j.add(e):j.delete(e)}class q{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,i){this._updatedSourceCaches[e]=i,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){let i=e.scope;this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._updatedLayers[i].add(e.id),this.setDirty()}removeLayer(e){let i=e.scope;this._removedLayers[i]=this._removedLayers[i]||{},this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._removedLayers[i][e.id]=e,this._updatedLayers[i].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){let e={};for(let i in this._updatedLayers)e[i]=e[i]||{},e[i].updatedIds=Array.from(this._updatedLayers[i].values());for(let i in this._removedLayers)e[i]=e[i]||{},e[i].removedIds=Object.keys(this._removedLayers[i]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(i){this._updatedImages.add(e.I.toString(i)),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}class Z extends e.E{constructor(i){super(),this._images={},this._iconsets={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.patternsInFlight=new Set,this.atlasImage={},this.atlasTexture={},this.dirty=!0,this.spriteFormat=i,"raster"!==i&&e.t()&&(this.imageRasterizerDispatcher=new e.D(e.x(),this,"Image Rasterizer Worker",1))}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new e.y
7),this._imageRasterizer}createScope(i){this._images[i]={},this._iconsets[i]={},this.loaded[i]=!1,this.updatedImages[i]=new Set,this.patterns[i]={},this.callbackDispatchedThisFrame[i]=new Set,this.atlasImage[i]=new e.r({width:1,height:1})}createIconset(e,i){this._iconsets[e][i]={}}isLoaded(){for(let e in this.loaded)if(!this.loaded[e])return!1;return!0}setLoaded(e,i){if(this.loaded[i]!==e&&(this.loaded[i]=e,e)){for(let{ids:e,callback:r}of this.requestors)this._notify(e,i,r);this.requestors=[]}}hasImage(e,i){return!!this.getImage(e,i)}getImage(e,i){return(e.iconsetId?this._iconsets[i][e.iconsetId]:this._images[i])[e.name]}addImage(e,i,r){let a=e.iconsetId?this._iconsets[i][e.iconsetId]:this._images[i];this._validate(e,r)&&(a[e.name]=r)}_validate(i,r){let a=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new e.z(Error(`Image "${i.name}" has invalid "stretchX" value`))),a=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new e.z(Error(`Image "${i.name}" has invalid "stretchY" value`))),a=!1),this._validateContent(r.content,r)||(this.fire(new e.z(Error(`Image "${i.name}" has invalid "content" value`))),a=!1),a}_validateStretch(e,i){if(!e)return!0;let r=0;for(let a of e){if(a[0]<r||a[1]<a[0]||i<a[1])return!1;r=a[1]}return!0}_validateContent(e,i){return!e||4===e.length&&(!!i.usvg||!(e[0]<0)&&!(i.data.width<e[0])&&!(e[1]<0)&&!(i.data.height<e[1])&&!(e[2]<0)&&!(i.data.width<e[2])&&!(e[3]<0)&&!(i.data.height<e[3]))&&!(e[2]<e[0]||e[3]<e[1])}updateImage(e,i,r){let a=e.iconsetId?this._iconsets[i][e.iconsetId]:this._images[i];r.version=a[e.name].version+1,a[e.name]=r,this.updatedImages[i].add(e),this.removeFromImageRasterizerCache(e,i)}clearUpdatedImages(e){this.updatedImages[e].clear()}removeFromImageRasterizerCache(i,r){"raster"!==this.spriteFormat&&(e.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[i],scope:r}):this.imageRasterizer.removeImagesFromCacheByIds([i],r))}removeImage(e,i){let r=e.iconsetId?this._iconsets[i][e.iconsetId]:this._images[i],a=r[e.name];delete r[e.name],delete this.patterns[i][e.name],this.removeFromImageRasterizerCache(e,i),a.userImage&&a.userImage.onRemove&&a.userImage.onRemove()}listImages(i){let r=[];for(let a of Object.keys(this._images[i]))r.push(new e.I(a));for(let a in this._iconsets[i])for(let n of Object.keys(this._iconsets[i][a]))r.push(new e.I({name:n,iconsetId:a}));return r}getImages(e,i,r){let a=!0,n=!!this.loaded[i];if(!n)for(let r of e)(r.iconsetId?this._iconsets[i][r.iconsetId]:this._images[i])[r.name]||(a=!1);n||a?this._notify(e,i,r):this.requestors.push({ids:e,scope:i,callback:r})}rasterizeImages({scope:e,tasks:i},r){let a=new Map;for(let[r,n]of i.entries()){let i=this.getImage(n.id,e);i&&a.set(r,{image:i,imageVariant:n})}this._rasterizeImages(e,a,r)}_rasterizeImages(i,r,a){if(e.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImages",{tasks:r,scope:i},a);else{let e=new Map;for(let[a,{image:n,imageVariant:o}]of r.entries())e.set(a,this.imageRasterizer.rasterize(o,n,i,0));a(void 0,e)}}getUpdatedImages(e){return this.updatedImages[e]||new Set}_notify(i,r,a){let n=new Map;for(let a of i){a.iconsetId&&(this._iconsets[r][a.iconsetId]=this._iconsets[r][a.iconsetId]||{});let i=(a.iconsetId?this._iconsets[r][a.iconsetId]:this._images[r])[a.name];if(!i){if(a.iconsetId)continue;e.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.`),this.fire(new e.A("styleimagemissing",{id:a.name}));continue}let o={data:i.usvg?null:i.data.clone(),pixelRatio:i.pixelRatio,sdf:i.sdf,usvg:i.usvg,version:i.version,stretchX:i.stretchX,stretchY:i.stretchY,content:i.content,hasRenderCallback:!!(i.userImage&&i.userImage.render)};i.usvg&&Object.assign(o,{width:i.icon.usvg_tree.width,height:i.icon.usvg_tree.height}),n.set(e.I.toString(a),o)}a(null,n)}getPixelSize(e){let{width:i,height:r}=this.atlasImage[e];return{width:i,height:r}}getPattern(i,r,a){let n=this.patterns[r][i.name],o=this.getImage(i,r);if(!o)return null;if(n){if(n.position.version===o.version)return n.position;n.position.version=o.version}else{if(o.usvg&&!o.data){let n=this.getPatternInFlightId(i.toString(),r);if(this.patternsInFlight.has(n))return null;this.patternsInFlight.add(n);let s=new e.B(i).scaleSelf(e.q.devicePixelRatio),l=new Map([[s.toString(),{image:o,imageVariant:s}]]);return this._rasterizeImages(r,l,(e,i)=>this.storePatternImage(s,r,o,a,i)),null}this.storePattern(i,r,o)}return this._updatePatternAtlas(r,a),this.patterns[r][i.name].position}getPatternInFlightId(i,r){return e.C(i,r)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(e,i,r,a,n){let o=e.toString(),s=n?n.get(o):void 0;s&&(r.data=s,this.storePattern(e.id,i,r),this._updatePatternAtlas(i,a),this.patternsInFlight.delete(this.getPatternInFlightId(e.id.toString(),i)))}storePattern(i,r,a){let n={w:a.data.width+2*e.F,h:a.data.height+2*e.F,x:0,y:0},o=new e.G(n,a,e.F);this.patterns[r][i.name]={bin:n,position:o}}bind(i,r){let a=i.gl,n=this.atlasTexture[r];n?this.dirty&&(n.update(this.atlasImage[r]),this.dirty=!1):(n=new e.T(i,this.atlasImage[r],a.RGBA8),this.atlasTexture[r]=n),n.bind(a.LINEAR,a.CLAMP_TO_EDGE)}_updatePatternAtlas(i,r){let a=[];for(let e in this.patterns[i])a.push(this.patterns[i][e].bin);let{w:n,h:o}=e.H(a),s=this.atlasImage[i];for(let a in s.resize({width:n||1,height:o||1}),this.patterns[i]){let{bin:n,position:o}=this.patterns[i][a],l=o.padding,h=n.x+l,u=n.y+l,c=this._images[i][a].data,d=c.width,p=c.height;l=l>1?l-1:l,e.r.copy(c,s,{x:0,y:0},{x:h,y:u},{width:d,height:p},r),e.r.copy(c,s,{x:0,y:p-l},{x:h,y:u-l},{width:d,height:l},r),e.r.copy(c,s,{x:0,y:0},{x:h,y:u+p},{width:d,height:l},r),e.r.copy(c,s,{x:d-l,y:0},{x:h-l,y:u},{width:l,height:p},r),e.r.copy(c,s,{x:0,y:0},{x:h+d,y:u},{width:l,height:p},r),e.r.copy(c,s,{x:d-l,y:p-l},{x:h-l,y:u-l},{width:l,height:l},r),e.r.copy(c,s,{x:0,y:p-l},{x:h+d,y:u-l},{width:l,height:l},r),e.r.copy(c,s,{x:0,y:0},{x:h+d,y:u+p},{width:l,height:l},r),e.r.copy(c,s,{x:d-l,y:0},{x:h-l,y:u+p},{width:l,height:l},r)}this.dirty=!0}beginFrame(){for(let e in this._images)this.callbackDispatchedThisFrame[e]=new Set}dispatchRenderCallbacks(e,i){for(let r of e){if(this.callbackDispatchedThisFrame[i].has(r.toString()))continue;this.callbackDispatchedThisFrame[i].add(r.toString());let e=(r.iconsetId?this._iconsets[i][r.iconsetId]:this._images[i])[r.name];(function(e){let{userImage:i}=e;return!!(i&&i.render&&i.render())&&(e.data.replace(new Uint8Array(i.data.buffer)),!0)})(e)&&this.updateImage(r,i,e)}}}
7function H(i){let r=i.key,a=i.value,n=i.valueSpec||{},o=i.objectElementValidators||{},s=i.style,l=i.styleSpec,h=[],u=e.K(a);if("object"!==u)return[new e.V(r,a,`object expected, ${u} found`)];for(let i in a){let u,c=i.split(".")[0];o[c]?u=o[c]:n[c]?u=ec:o["*"]?u=o["*"]:n["*"]&&(u=ec),u?h=h.concat(u({key:(r?`${r}.`:r)+i,value:a[i],valueSpec:n[c]||n["*"],style:s,styleSpec:l,object:a,objectKey:i},a)):h.push(new e.J(r,a[i],`unknown property "${i}"`))}for(let i in n)o[i]||n[i].required&&void 0===n[i].default&&void 0===a[i]&&h.push(new e.V(r,a,`missing required property "${i}"`));return h}function $(i){let r=i.value,a=i.valueSpec,n=i.style,o=i.styleSpec,s=i.key,l=i.arrayElementValidator||ec;if("array"!==e.K(r))return[new e.V(s,r,`array expected, ${e.K(r)} found`)];if(a.length&&r.length!==a.length)return[new e.V(s,r,`array length ${a.length} expected, length ${r.length} found`)];if(a["min-length"]&&r.length<a["min-length"])return[new e.V(s,r,`array length at least ${a["min-length"]} expected, length ${r.length} found`)];let h={type:a.value,values:a.values,minimum:a.minimum,maximum:a.maximum,function:void 0};o.$version<7&&(h.function=a.function),"object"===e.K(a.value)&&(h=a.value);let u=[];for(let e=0;e<r.length;e++)u=u.concat(l({array:r,arrayIndex:e,value:r[e],valueSpec:h,style:n,styleSpec:o,key:`${s}[${e}]`},!0));return u}function W(i){let r=i.key,a=i.value,n=i.valueSpec,o=e.K(a);if("number"===o&&a!=a&&(o="NaN"),"number"!==o)return[new e.V(r,a,`number expected, ${o} found`)];if("minimum"in n){let o=n.minimum;if("array"===e.K(n.minimum)&&(o=n.minimum[i.arrayIndex]),a<o)return[new e.V(r,a,`${a} is less than the minimum value ${o}`)]}if("maximum"in n){let o=n.maximum;if("array"===e.K(n.maximum)&&(o=n.maximum[i.arrayIndex]),a>o)return[new e.V(r,a,`${a} is greater than the maximum value ${o}`)]}return[]}function X(i){let r=i.valueSpec,a=e.M(i.value.type),n,o,s,l={},h="categorical"!==a&&void 0===i.value.property,u="array"===e.K(i.value.stops)&&"array"===e.K(i.value.stops[0])&&"object"===e.K(i.value.stops[0][0]),c=H({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(i){if("identity"===a)return[new e.V(i.key,i.value,'identity function may not have a "stops" property')];let r=[],n=i.value;return r=r.concat($({key:i.key,value:n,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:d})),"array"===e.K(n)&&0===n.length&&r.push(new e.V(i.key,n,"array must have at least one stop")),r},default:function(e){return ec({key:e.key,value:e.value,valueSpec:r,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&h&&c.push(new e.V(i.key,i.value,'missing required property "property"')),"identity"===a||i.value.stops||c.push(new e.V(i.key,i.value,'missing required property "stops"')),"exponential"===a&&i.valueSpec.expression&&!e.N(i.valueSpec)&&c.push(new e.V(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(h||e.O(i.valueSpec)?h&&!e.Q(i.valueSpec)&&c.push(new e.V(i.key,i.value,"zoom functions not supported")):c.push(new e.V(i.key,i.value,"property functions not supported"))),("categorical"===a||u)&&void 0===i.value.property&&c.push(new e.V(i.key,i.value,'"property" property is required')),c;function d(i){let a=[],n=i.value,h=i.key;if("array"!==e.K(n))return[new e.V(h,n,`array expected, ${e.K(n)} found`)];if(2!==n.length)return[new e.V(h,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==e.K(n[0]))return[new e.V(h,n,`object expected, ${e.K(n[0])} found`)];if(void 0===n[0].zoom)return[new e.V(h,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new e.V(h,n,"object stop key must have value")];let r=e.M(n[0].zoom);if("number"!=typeof r)return[new e.V(h,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>r)return[new e.V(h,n[0].zoom,"stop zoom values must appear in ascending order")];r!==s&&(s=r,o=void 0,l={}),a=a.concat(H({key:`${h}[0]`,value:n[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:W,value:p}}))}else a=a.concat(p({key:`${h}[0]`,value:n[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},n));return e.S(e.U(n[1]))?a.concat([new e.V(`${h}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(ec({key:`${h}[1]`,value:n[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}
7function p(i,s){let h=e.K(i.value),u=e.M(i.value),c=null!==i.value?i.value:s;if(n){if(h!==n)return[new e.V(i.key,c,`${h} stop domain type must match previous stop domain type ${n}`)]}else n=h;if("number"!==h&&"string"!==h&&"boolean"!==h&&"number"!=typeof u&&"string"!=typeof u&&"boolean"!=typeof u)return[new e.V(i.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==h&&"categorical"!==a){let n=`number expected, ${h} found`;return e.O(r)&&void 0===a&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(i.key,c,n)]}return"categorical"!==a||"number"!==h||"number"==typeof u&&isFinite(u)&&Math.floor(u)===u?"categorical"!==a&&"number"===h&&"number"==typeof u&&"number"==typeof o&&void 0!==o&&u<o?[new e.V(i.key,c,"stop domain values must appear in ascending order")]:(o=u,"categorical"===a&&u in l?[new e.V(i.key,c,"stop domain values must be unique")]:(l[u]=!0,[])):[new e.V(i.key,c,`integer expected, found ${String(u)}`)]}}function Y(i){let r=("property"===i.expressionContext?e.W:e.X)(e.U(i.value),i.valueSpec);if("error"===r.result)return r.value.map(r=>new e.V(`${i.key}${r.key}`,i.value,r.message));let a=r.value.expression||r.value._styleExpression.expression;if("property"===i.expressionContext&&"text-font"===i.propertyKey&&!a.outputDefined())return[new e.V(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===i.expressionContext&&"layout"===i.propertyType&&!e.Y(a))return[new e.V(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===i.expressionContext)return function i(r,a){let n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(a.valueSpec&&a.valueSpec.expression)for(let e of a.valueSpec.expression.parameters)n.delete(e);if(0===n.size)return[];let o=[];return r instanceof e.$&&n.has(r.name)?[new e.V(a.key,a.value,`["${r.name}"] expression is not supported in a filter for a ${a.object.type} layer with id: ${a.object.id}`)]:(r.eachChild(e=>{o.push(...i(e,a))}),o)}(a,i);if(i.expressionContext&&0===i.expressionContext.indexOf("cluster")){if(!e.Z(a,["zoom","feature-state"]))return[new e.V(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===i.expressionContext&&!e._(a))return[new e.V(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function K(i){let r=i.key,a=i.value,n=i.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.M(a))&&o.push(new e.V(r,a,`expected one of [${n.values.join(", ")}], ${JSON.stringify(a)} found`)):-1===Object.keys(n.values).indexOf(e.M(a))&&o.push(new e.V(r,a,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(a)} found`)),o}function J(i){return e.a1(e.U(i.value))?Y(e.L({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):function i(r){let a=r.value,n=r.key;if("array"!==e.K(a))return[new e.V(n,a,`array expected, ${e.K(a)} found`)];let o=r.styleSpec,s,l=[];if(a.length<1)return[new e.V(n,a,"filter array must have at least 1 element")];switch(l=l.concat(K({key:`${n}[0]`,value:a[0],valueSpec:o.filter_operator,style:r.style,styleSpec:r.styleSpec})),e.M(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===e.M(a[1])&&l.push(new e.V(n,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":3!==a.length&&l.push(new e.V(n,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&"string"!==(s=e.K(a[1]))&&l.push(new e.V(`${n}[1]`,a[1],`string expected, ${s} found`));for(let i=2;i<a.length;i++)s=e.K(a[i]),"$type"===e.M(a[1])?l=l.concat(K({key:`${n}[${i}]`,value:a[i],valueSpec:o.geometry_type,style:r.style,styleSpec:r.styleSpec})):"string"!==s&&"number"!==s&&"boolean"!==s&&l.push(new e.V(`${n}[${i}]`,a[i],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let e=1;e<a.length;e++)l=l.concat(i({key:`${n}[${e}]`,value:a[e],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":s=e.K(a[1]),2!==a.length?l.push(new e.V(n,a,`filter array for "${a[0]}" operator must have 2 elements`)):"string"!==s&&l.push(new e.V(`${n}[1]`,a[1],`string expected, ${s} found`))}return l}(i)}function Q(i,r){let a,n=i.key,o=i.style,s=i.layer,l=i.styleSpec,h=i.value,u=i.objectKey,c=l[`${r}_${i.layerType}`];if(!c)return[];let d=u.match(/^(.*)-use-theme$/);if("paint"===r&&d&&c[d[1]])return e.S(h)?[].concat(ec({key:i.key,value:h,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:o,styleSpec:l,expressionContext:"property",propertyType:r,propertyKey:u})):ec({key:n,value:h,valueSpec:{type:"string"},style:o,styleSpec:l});let p=u.match(/^(.*)-transition$/);if("paint"===r&&p&&c[p[1]]&&c[p[1]].transition)return ec({key:n,value:h,valueSpec:l.transition,style:o,styleSpec:l});let f=i.valueSpec||c[u];if(!f)return[new e.J(n,h,`unknown property "${u}"`)];if("string"===e.K(h)&&e.O(f)&&!f.tokens&&(a=/^{([^}]+)}$/.exec(h))){let i=`\`{ "type": "identity", "property": ${a?JSON.stringify(a[1]):'"_"'} }\``;return[new e.V(n,h,`"${u}" does not support interpolation syntax 8Use an identity property function instead: ${i}.`)]}let m=[];
8if("symbol"===i.layerType)"text-field"!==u||!o||o.glyphs||o.imports||m.push(new e.V(n,h,'use of "text-field" requires a style "glyphs" property')),"text-font"===u&&e.a2(e.U(h))&&"identity"===e.M(h.type)&&m.push(new e.V(n,h,'"text-font" does not support identity functions'));else if("model"===i.layerType&&"paint"===r&&s&&s.layout&&s.layout.hasOwnProperty("model-id")&&e.O(f)&&(e.a3(f)||e.Q(f))){let i=e.W(e.U(h),f),r=i.value.expression||i.value._styleExpression.expression;r&&!e.Z(r,["measure-light"])&&("model-emissive-strength"===u&&e._(r)&&e.Y(r)||m.push(new e.V(n,h,`${u} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return m.concat(ec({key:i.key,value:h,valueSpec:f,style:o,styleSpec:l,expressionContext:"property",propertyType:r,propertyKey:u}))}function ee(e){return Q(e,"paint")}function et(e){return Q(e,"layout")}function ei(i){let r=[],a=i.value,n=i.key,o=i.style,s=i.styleSpec;a.type||a.ref||r.push(new e.V(n,a,'either "type" or "ref" is required'));let l=e.M(a.type),h=e.M(a.ref);if(a.id){let s=e.M(a.id);for(let l=0;l<i.arrayIndex;l++){let i=o.layers[l];e.M(i.id)===s&&r.push(new e.V(n,a.id,`duplicate layer id "${a.id}", previously used at line ${i.id.__line__}`))}}if("ref"in a){let i;["type","source","source-layer","filter","layout"].forEach(i=>{i in a&&r.push(new e.V(n,a[i],`"${i}" is prohibited for ref layers`))}),o.layers.forEach(r=>{e.M(r.id)===h&&(i=r)}),i?i.ref?r.push(new e.V(n,a.ref,"ref cannot reference another ref layer")):l=e.M(i.type):"string"==typeof h&&r.push(new e.V(n,a.ref,`ref layer "${h}" not found`))}else if("background"!==l&&"sky"!==l&&"slot"!==l)if(a.source){let i=o.sources&&o.sources[a.source],s=i&&e.M(i.type);i?"vector"===s&&"raster"===l?r.push(new e.V(n,a.source,`layer "${a.id}" requires a raster source`)):"raster"===s&&"raster"!==l?r.push(new e.V(n,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==s||a["source-layer"]?"raster-dem"===s&&"hillshade"!==l?r.push(new e.V(n,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==s||["raster","raster-particle"].includes(l)?"line"===l&&a.paint&&(
8a.paint["line-gradient"]||a.paint["line-trim-offset"])&&("geojson"!==s||!i.lineMetrics)?r.push(new e.V(n,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):"raster-particle"===l&&"raster-array"!==s&&r.push(new e.V(n,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new e.V(n,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new e.V(n,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new e.V(n,a.source,`source "${a.source}" not found`))}else r.push(new e.V(n,a,'missing required property "source"'));return r=r.concat(H({key:n,value:a,valueSpec:s.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ec({key:`${n}.type`,value:a.type,valueSpec:s.layer.type,style:i.style,styleSpec:i.styleSpec,object:a,objectKey:"type"}),filter:i=>J(e.L({layerType:l},i)),layout:i=>H({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>et(e.L({layerType:l},i))}}),paint:i=>H({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>ee(e.L({layerType:l,layer:a},i))}})}}))}function er(i){let r=i.value,a=i.key,n=e.K(r);return"string"!==n?[new e.V(a,r,`string expected, ${n} found`)]:[]}let ea={promoteId:function i({key:r,value:a}){if("string"===e.K(a))return er({key:r,value:a});if(Array.isArray(a)){let i=[],n=e.U(a),o=e.X(n);return"error"===o.result&&o.value.forEach(a=>{i.push(new e.V(`${r}${a.key}`,null,`${a.message}`))}),e.Z(o.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"])||i.push(new e.V(`${r}`,null,"promoteId expression should be only feature dependent")),i}{let e=[];for(let n in a)e.push(...i({key:`${r}.${n}`,value:a[n]}));return e}}};function en(i){let r=i.value,a=i.key,n=i.styleSpec,o=i.style;if(!r.type)return[new e.V(a,r,'"type" is required')];let s=e.M(r.type),l=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&(r.url||r.tiles||l.push(new e.J(a,r,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return l.concat(H({key:a,value:r,valueSpec:n[`source_${s.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:ea}));case"geojson":if(l=H({key:a,value:r,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:ea}),r.cluster)for(let e in r.clusterProperties){let[i,n]=r.clusterProperties[e],o="string"==typeof i?[i,["accumulated"],["get",e]]:i;l.push(...Y({key:`${a}.${e}.map`,value:n,expressionContext:"cluster-map"})),l.push(...Y({key:`${a}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return l;case"video":return H({key:a,value:r,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return H({key:a,value:r,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new e.V(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:var h;return K({key:`${a}.type`,value:r.type,valueSpec:{values:(h=n).source.reduce((e,i)=>{let r=h[i];return"enum"===r.type.type&&(e=e.concat(Object.keys(r.type.values))),e},[])},style:o,styleSpec:n})}}function eo(i){let r=i.value,a=i.styleSpec,n=a.light,o=i.style,s=[],l=e.K(r);if(void 0===r)return s;if("object"!==l)return s.concat([new e.V("light",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/),h=i.match(/^(.*)-use-theme$/);s=s.concat(h&&n[h[1]]?ec({key:i,value:r[i],valueSpec:{type:"string"},style:o,styleSpec:a}):l&&n[l[1]]&&n[l[1]].transition?ec({key:i,value:r[i],valueSpec:a.transition,style:o,styleSpec:a}):n[i]?ec({key:i,value:r[i],valueSpec:n[i],style:o,styleSpec:a}):[new e.V(i,r[i],`unknown property "${i}"`)])}return s}function es(i){let r=i.value,a=[];if(!r)return a;let n=e.K(r);if("object"!==n)return a.concat([new e.V("light-3d",r,`object expected, ${n} found`)]);let o=i.styleSpec,s=o["light-3d"],l=i.key,h=i.style,u=i.style.lights;for(let i of["type","id"])if(!(i in r))return a.concat([new e.V("light-3d",r,`missing property ${i} on light`)]);if(r.type&&u)for(let n=0;n<i.arrayIndex;n++){let i=e.M(r.type),o=u[n];e.M(o.type)===i&&a.push(new e.V(l,r.id,`duplicate light type "${r.type}", previously defined at line ${o.id.__line__}`))}let c=`properties_light_${r.type}`;if(!(c in o))return a.concat([new e.V("light-3d",r,`Invalid light type ${r.type}`)]);let d=o[c];for(let n in r)if("properties"===n){let s=r[n],l=e.K(s);if("object"!==l)return a.concat([new e.V("properties",s,`object expected, ${l}
8 found`)]);for(let r in s)a=a.concat(d[r]?ec({key:r,value:s[r],valueSpec:d[r],style:h,styleSpec:o}):[new e.J(i.key,s[r],`unknown property "${r}"`)])}else{let i=n.match(/^(.*)-transition$/),l=n.match(/^(.*)-use-theme$/);a=a.concat(l&&s[l[1]]?ec({key:n,value:r[n],valueSpec:{type:"string"},style:h,styleSpec:o}):i&&s[i[1]]&&s[i[1]].transition?ec({key:n,value:r[n],valueSpec:o.transition,style:h,styleSpec:o}):s[n]?ec({key:n,value:r[n],valueSpec:s[n],style:h,styleSpec:o}):[new e.J(n,r[n],`unknown property "${n}"`)])}return a}function el(i){let r=i.value,a=i.key,n=i.style,o=i.styleSpec,s=o.terrain,l=[],h=e.K(r);if(void 0===r||"null"===h)return l;if("object"!==h)return l.concat([new e.V("terrain",r,`object expected, ${h} found`)]);for(let i in r){let a=i.match(/^(.*)-transition$/),h=i.match(/^(.*)-use-theme$/);l=l.concat(h&&s[h[1]]?ec({key:i,value:r[i],valueSpec:{type:"string"},style:n,styleSpec:o}):a&&s[a[1]]&&s[a[1]].transition?ec({key:i,value:r[i],valueSpec:o.transition,style:n,styleSpec:o}):s[i]?ec({key:i,value:r[i],valueSpec:s[i],style:n,styleSpec:o}):[new e.J(i,r[i],`unknown property "${i}"`)])}if(r.source){let i=n.sources&&n.sources[r.source],o=i&&e.M(i.type);i?"raster-dem"!==o&&l.push(new e.V(a,r.source,`terrain cannot be used with a source of type ${String(o)}, it only be used with a "raster-dem" source type`)):l.push(new e.V(a,r.source,`source "${r.source}" not found`))}else l.push(new e.V(a,r,'terrain is missing required property "source"'));return l}function eh(i){let r=i.value,a=i.style,n=i.styleSpec,o=n.fog,s=[],l=e.K(r);if(void 0===r)return s;if("object"!==l)return s.concat([new e.V("fog",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/),h=i.match(/^(.*)-use-theme$/);s=s.concat(h&&o[h[1]]?ec({key:i,value:r[i],valueSpec:{type:"string"},style:a,styleSpec:n}):l&&o[l[1]]&&o[l[1]].transition?ec({key:i,value:r[i],valueSpec:n.transition,style:a,styleSpec:n}):o[i]?ec({key:i,value:r[i],valueSpec:o[i],style:a,styleSpec:n}):[new e.J(i,r[i],`unknown property "${i}"`)])}return s}let eu={"*":()=>[],array:$,boolean:function(i){let r=i.value,a=i.key,n=e.K(r);return"boolean"!==n?[new e.V(a,r,`boolean expected, ${n} found`)]:[]},number:W,color:function(i){let r=i.key,a=i.value,n=e.K(a);return"string"!==n?[new e.V(r,a,`color expected, ${n} found`)]:null===e.a0.parseCSSColor(a)?[new e.V(r,a,`color expected, "${a}" found`)]:[]},enum:K,filter:J,function:X,layer:ei,object:H,source:en,model:e.a4,light:eo,"light-3d":es,terrain:el,fog:eh,string:er,formatted:function(e){return 0===er(e).length?[]:Y(e)},resolvedImage:function(e){return 0===er(e).length?[]:Y(e)},projection:function(i){let r=i.value,a=i.styleSpec,n=a.projection,o=i.style,s=[],l=e.K(r);if("object"===l)for(let e in r)s=s.concat(ec({key:e,value:r[e],valueSpec:n[e],style:o,styleSpec:a}));else"string"!==l&&(s=s.concat([new e.V("projection",r,`object or string expected, ${l} found`)]));return s},import:function(i){let{value:r,styleSpec:a}=i,{data:n,...o}=r;Object.defineProperty(o,"__line__",{value:r.__line__,enumerable:!1});let s=H(e.L({},i,{value:o,valueSpec:a.import}));return""===e.M(o.id)&&s.push(new e.V(`${i.key}.id`,o,"import id can't be an empty string")),n&&(s=s.concat(ep(n,a,{key:`${i.key}.data`}))),s},iconset:function(i){let r=i.value,a=i.key,n=i.styleSpec,o=i.style;if(!r.type)return[new e.V(a,r,'"type" is required')];let s=e.M(r.type),l=[];if(l=l.concat(H({key:a,value:r,valueSpec:n[`iconset_${s}`],style:o,styleSpec:n})),"source"===s&&r.source){let i=o.sources&&o.sources[r.source],n=i&&e.M(i.type);i?"raster-array"!==n&&l.push(new e.V(a,r.source,`iconset cannot be used with a source of type ${String(n)}, it only be used with a "raster-array" source type`)):l.push(new e.V(a,r.source,`source "${r.source}" not found`))}return l}};function ec(i,r=!1){let a=i.value,n=i.valueSpec,o=i.styleSpec;if(n.expression&&e.a2(e.M(a)))return X(i);if(n.expression&&e.S(e.U(a)))return Y(i);if(n.type&&eu[n.type]){let a=eu[n.type](i);return!0===r&&a.length>0&&"array"===e.K(i.value)?Y(i):a}return H(e.L({},i,{valueSpec:n.type?o[n.type]:n}))}function ed(i){let r=i.value,a=i.key,n=er(i);return n.length||(-1===r.indexOf("{fontstack}")&&n.push(new e.V(a,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&n.push(new e.V(a,r,'"glyphs" url must include a "{range}" token'))),n}function ep(i,r=e.a5,a={}){return ec({key:a.key||"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:ed,"*":()=>[]}})}function ef(i,r=e.a5){return eA(ep(i,r))}let em=e=>eA(en(e)),e_=e=>eA(eo(e)),eg=e=>eA(es(e)),ey=e=>
8eA(el(e)),ex=e=>eA(eh(e)),ev=i=>eA(function(i){let r=i.value,a=i.style,n=i.styleSpec,o=n.snow,s=[],l=e.K(r);if(void 0===r)return s;if("object"!==l)return s.concat([new e.V("snow",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/);s=s.concat(l&&o[l[1]]&&o[l[1]].transition?ec({key:i,value:r[i],valueSpec:n.transition,style:a,styleSpec:n}):o[i]?ec({key:i,value:r[i],valueSpec:o[i],style:a,styleSpec:n}):[new e.J(i,r[i],`unknown property "${i}"`)])}return s}(i)),eb=i=>eA(function(i){let r=i.value,a=i.style,n=i.styleSpec,o=n.rain,s=[],l=e.K(r);if(void 0===r)return s;if("object"!==l)return s.concat([new e.V("rain",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/);s=s.concat(l&&o[l[1]]&&o[l[1]].transition?ec({key:i,value:r[i],valueSpec:n.transition,style:a,styleSpec:n}):o[i]?ec({key:i,value:r[i],valueSpec:o[i],style:a,styleSpec:n}):[new e.J(i,r[i],`unknown property "${i}"`)])}return s}(i)),ew=e=>eA(ei(e)),eT=e=>eA(J(e)),eS=e=>eA(ee(e)),eM=e=>eA(et(e)),eE=i=>eA(e.a4(i));function eA(e){return e.slice().sort((e,i)=>e.line&&i.line?e.line-i.line:0)}function eI(i,r){let a=!1;if(r&&r.length)for(let n of r)n instanceof e.J?e.w(n.message):(i.fire(new e.z(Error(n.message))),a=!0);return a}class eC extends e.E{constructor(i,a="flat"){super(),this._transitionable=new e.a6(r||(r=new e.a7({anchor:new e.a8(e.a5.light.anchor),position:new e.a9(e.a5.light.position),color:new e.a8(e.a5.light.color),intensity:new e.a8(e.a5.light.intensity)}))),this.setLight(i,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i,r={}){this._validate(e_,e,r)||(this._transitionable.setTransitionOrValue(e),this.id=i)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eI(this,i.call(ef,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}}let eP=class extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._transitionable=new e.a6(new e.a7({source:new e.a8(e.a5.terrain.source),exaggeration:new e.a8(e.a5.terrain.exaggeration)}),a,n),this._transitionable.setTransitionOrValue(i,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(e,i){this._transitionable.setTransitionOrValue(e,i)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(i){return this._transitioning.possiblyEvaluate(new e.aa(i)).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;let i=this._transitionable._values.exaggeration;if(!i)return null;let r=i.value.expression;if(!r)return null;let a=-1,n=-1,o=1;for(let i of r.zoomStops)(o=r.evaluate(new e.aa(i)))>.01?(a=i,n=-1):n=i;return o<.01&&a>0&&n>a?[a,n]:null}isZoomDependent(){let i=this._transitionable._values.exaggeration;return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof e.ab}};function ez(i,r,a,n){let o=e.ae(45,65,a),[s,l]=eD(i,n),h=1-Math.min(1,Math.exp(-((r-s)/(l-s)*6)));return h*=h*h,(h=Math.min(1,1.00747*h))*o*i.alpha}function eD(e,i){let r=.5/Math.tan(.5*i);return[e.range[0]+r,e.range[1]+r]}function eR(i,r,a,n,o){let s=e.ad.vec3.transformMat4([],[r,a,n],o.mercatorFogMatrix);return ez(i,e.ad.vec3.length(s),o.pitch,o._fov)}function eL(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=e.ad.vec3.transformMat4([],i,r),n=e.ad.vec3.length(a);h=Math.min(h,n),u=Math.max(u,n)}return[ez(i,h,l.pitch,l._fov),ez(i,u,l.pitch,l._fov)]}class eO extends e.E{constructor(i,r,a,n){super();const o=new e.a7({range:new e.a8(e.a5.fog.range),color:new e.a8(e.a5.fog.color),"color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new e.a8(e.a5.fog["high-color"]),"high-color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new e.a8(e.a5.fog["space-color"]),"space-color-use-theme":new e.a8({type:"string","property-type":"data-constant",default:"default"}
8),"horizon-blend":new e.a8(e.a5.fog["horizon-blend"]),"star-intensity":new e.a8(e.a5.fog["star-intensity"]),"vertical-range":new e.a8(e.a5.fog["vertical-range"])});this._transitionable=new e.a6(o,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this._transform=r,this.properties=new e.af(o),this.scope=a}get state(){let i=this._transform,r="globe"===i.projection.name,a=e.ag(i.zoom),n=this.properties.get("range");return{range:r?[e.ah(.5,n[0],a),e.ah(3,n[1],a)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,r,a={}){if(this._validate(ex,i,a))return;let n=e.l({},i);for(let i of Object.keys(e.a5.fog))void 0===n[i]&&(n[i]=e.a5.fog[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(i){if(!this._transform.projection.supportsFog)return 0;let r=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.ae(45,65,i))*r.a}getOpacityAtLatLng(i,r){var a;let n,o;return this._transform.projection.supportsFog?(a=this.state,n=e.ac.fromLngLat(i),o=r.elevation?r.elevation.getAtPointOrZero(n):0,eR(a,n.x,n.y,o,r)):0}getOpacityForTile(i){if(!this._transform.projection.supportsFog)return[1,1];let r=this._transform.calculateFogTileMatrix(i.toUnwrapped());return eL(this.state,r,0,0,e.ai,e.ai,this._transform)}getOpacityForBounds(e,i,r,a,n){return this._transform.projection.supportsFog?eL(this.state,e,i,r,a,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?eD(this.state,e):[0,1]}isVisibleOnFrustum(i){if(!this._transform.projection.supportsFog)return!1;for(let r of[4,5,6,7]){let a,n=i.points[r];if(n[2]>=0)a=n;else{let o=i.points[r-4];a=e.aj(o,n,o[2]/(o[2]-n[2]))}if(eR(this.state,a[0],a[1],0,this._transform)>=.05)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eI(this,i.call(ef,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}}let ek,eF,eB,eN,eV=class extends e.E{constructor(i,r,a,n){super();const o=ek||(ek=new e.a7({density:new e.a8(e.a5.snow.density),intensity:new e.a8(e.a5.snow.intensity),color:new e.a8(e.a5.snow.color),opacity:new e.a8(e.a5.snow.opacity),vignette:new e.a8(e.a5.snow.vignette),"vignette-color":new e.a8(e.a5.snow["vignette-color"]),"center-thinning":new e.a8(e.a5.snow["center-thinning"]),direction:new e.a8(e.a5.snow.direction),"flake-size":new e.a8(e.a5.snow["flake-size"])}));this._transitionable=new e.a6(o,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.af(o),this.scope=a}get state(){let i=this.properties.get("opacity"),r=this.properties.get("color"),a=this.properties.get("direction"),n=e.ak(a[0]),o=-Math.max(e.ak(a[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],l=this.properties.get("vignette"),h=this.properties.get("vignette-color");return h.a=l,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.al(r.r,r.g,r.b,r.a*i),direction:s,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:h}}get(){return this._transitionable.serialize()}set(i,r,a={}){if(this._validate(ev,i,a))return;let n=e.l({},i);for(let i of Object.keys(e.a5.snow))void 0===n[i]&&(n[i]=e.a5.snow[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}
8_validate(i,r,a){return(!a||!1!==a.validate)&&eI(this,i.call(ef,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}},eU=class extends e.E{constructor(i,r,a,n){super();const o=eF||(eF=new e.a7({density:new e.a8(e.a5.rain.density),intensity:new e.a8(e.a5.rain.intensity),color:new e.a8(e.a5.rain.color),opacity:new e.a8(e.a5.rain.opacity),vignette:new e.a8(e.a5.rain.vignette),"vignette-color":new e.a8(e.a5.rain["vignette-color"]),"center-thinning":new e.a8(e.a5.rain["center-thinning"]),direction:new e.a8(e.a5.rain.direction),"droplet-size":new e.a8(e.a5.rain["droplet-size"]),"distortion-strength":new e.a8(e.a5.rain["distortion-strength"])}));this._transitionable=new e.a6(o,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this.properties=new e.af(o),this.scope=a}get state(){let i=this.properties.get("opacity"),r=this.properties.get("color"),a=this.properties.get("direction"),n=e.ak(a[0]),o=-Math.max(e.ak(a[1]),.01),s=[Math.cos(n)*Math.cos(o),Math.sin(n)*Math.cos(o),Math.sin(o)],l=this.properties.get("vignette-color");return l.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new e.al(r.r,r.g,r.b,r.a*i),direction:s,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:l}}get(){return this._transitionable.serialize()}set(i,r,a={}){if(this._validate(eb,i,a))return;let n=e.l({},i);for(let i of Object.keys(e.a5.rain))void 0===n[i]&&(n[i]=e.a5.rain[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eI(this,i.call(ef,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e.a5})))}};class ej extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._options=i,this.properties=new e.af(r),this._transitionable=new e.a6(r,a,new Map(n)),this._transitionable.setTransitionOrValue(i.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,i){this._options=e,this._transitionable.setTransitionOrValue(e.properties,i)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}class eG{constructor(e,i,r,a){this.screenBounds=e,this.cameraPoint=i,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(i,r){let a,n;if(i instanceof e.P||"number"==typeof i[0]){let o=e.P.convert(i);a=[o],n=r.isPointAboveHorizon(o)}else{let o=e.P.convert(i[0]),s=e.P.convert(i[1]);a=[o,s],n=e.an(o,s).every(e=>r.isPointAboveHorizon(e))}return new eG(a,r.getCameraPoint(),n,r)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(i){return e.an(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],i)}bufferedCameraGeometry(i){let r=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.an(r,a,0,!1);return this.cameraPoint.y>a.y&&(this.cameraPoint.x>r.x&&this.cameraPoint.x<a.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=a.x?n[2]=this.cameraPoint:this.cameraPoint.x<=r.x&&(n[3]=this.cameraPoint)),e.ao(n,i)}bufferedCameraGeometryGlobe(i){let r=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.an(r,a,i),o=this.cameraPoint.clone();switch(3*((o.y>r.y)+(o.y>a.y))+((o.x>r.x)+(o.x>a.x))){case 0:n[0]=o,n[4]=o.clone();break;case 1:n.splice(1,0,o);break;case 2:n[1]=o;break;case 3:n.splice(4,0,o);break;case 5:n.splice(2,0,o);break;case 6:n[3]=o;break;case 7:n.splice(3,0,o);break;case 8:n[2]=o}return n}containsTile(i,r,a,n=0){var o;let s=i.queryPadding/r._pixelsPerMercatorPixel+1,l=a?this._bufferedCameraMercator(s,r):this._bufferedScreenMercator(s,r),h=i.tileID.wrap+(l.unwrapped?n:0),u=l.polygon.map(r=>e.ap(i.tileTransform,r,h));if(!e.aq(u,0,0,e.ai,e.ai))return;h=i.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);let c=this.screenGeometryMercator.polygon.map(r=>e.ar(i.tileTransform,r,h)),d=c.map(i=>new e.P(i[0],i[1])),p=r.getFreeCameraOptions().position||new e.ac(0,0,0),f=e.ar(i.tileTransform,p,h),m=c.map(i=>{let r=e.ad.vec3.sub(i,i,f);return e.ad.vec3.normalize(r,r),new e.as(f,r)}),_=e.at(i,1,r.zoom)*r._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:d,tilespaceRays:m,bufferedTilespaceGeometry:u,bufferedTilespaceBounds:((o=e.au(u)).min.x=e.ay(o.min.x,0,e.ai),o.min.y=e.ay(o.min.y,0,e.ai),o.max.x=e.ay(o.max.x,0,e.ai),o.max.y=e.ay(o.max.y,0,e.ai),o),tile:i,tileID:i.tileID,pixelToTileUnitsFactor:_}}_bufferedScreenMercator(e,i){let r=100*e|0;if(this._screenRaycastCache[r])return this._screenRaycastCache[r];{let a;return a="globe"===i.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),i):{polygon:this.bufferedScreenGeometry(e).map(e=>i.pointCoordinate3D(e)),unwrapped:!0},this._screenRaycastCache[r]=a,a}}_bufferedCameraMercator(e,i){let r=100*e|0;if(this._cameraRaycastCache[r])return this._cameraRaycastCache[r];{let a;return a="globe"===i.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),i):{polygon:this.bufferedCameraGeometry(e).map(e=>i.pointCoordinate3D(e)),unwrapped:!0},this._cameraRaycastCache[r]=a,a}}_projectAndResample(i,r){let a=function(i,r){let a=e.ad.mat4.multiply([],r.pixelMatrix,r.globeMatrix),n=[0,-e.az,0,1],o=[0,e.az,0,1],s=[0,0,0,1];e.ad.vec4.transformMat4(n,n,a),e.ad.vec4.transformMat4(o,o,a),e.ad.vec4.transformMat4(s,s,a);let l=new e.P(n[0]/n[3],n[1]/n[3]),h=new e.P(o[0]/o[3],o[1]/o[3]),u=e.aw(i,l)&&n[3]<s[3],c=e.aw(i,h)&&o[3]<s[3];if(!u&&!c)return null;let d=function(e,i,r){for(let a=1;a<e.length;a++){let n=eZ(i.pointCoordinate3D(e[a-1]).x),o=eZ(i.pointCoordinate3D(e[a]).x);
8if(r<0){if(n<o)return{idx:a,t:-n/(o-1-n)}}else if(o<n)return{idx:a,t:(1-n)/(o+1-n)}}return null}(i,r,u?-1:1);if(!d)return null;let{idx:p,t:f}=d,m=p>1?eq(i.slice(0,p),r):[],_=p<i.length?eq(i.slice(p),r):[];m=m.map(i=>new e.P(eZ(i.x),i.y)),_=_.map(i=>new e.P(eZ(i.x),i.y));let g=[...m];0===g.length&&g.push(_[_.length-1]);let y=e.ah(g[g.length-1].y,(0===_.length?m[0]:_[0]).y,f);return g.push(...u?[new e.P(0,y),new e.P(0,0),new e.P(1,0),new e.P(1,y)]:[new e.P(1,y),new e.P(1,1),new e.P(0,1),new e.P(0,y)]),0===_.length?g.push(m[0]):g.push(..._),{polygon:g.map(i=>new e.ac(i.x,i.y)),unwrapped:!1}}(i,r);if(a)return a;let n=function(i,r){let a=!1,n=-1/0,o=0;for(let e=0;e<i.length-1;e++)i[e].x>n&&(n=i[e].x,o=e);for(let e=0;e<i.length-1;e++){let r=(o+e)%(i.length-1),n=i[r],s=i[r+1];Math.abs(n.x-s.x)>.5&&(n.x<s.x?(n.x+=1,0===r&&(i[i.length-1].x+=1)):(s.x+=1,r+1===i.length-1&&(i[0].x+=1)),a=!0)}let s=e.av(r.center.lng);return a&&s<Math.abs(s-1)&&i.forEach(e=>{e.x-=1}),{polygon:i,unwrapped:a}}(eq(i,r).map(i=>new e.P(eZ(i.x),i.y)),r);return{polygon:n.polygon.map(i=>new e.ac(i.x,i.y)),unwrapped:n.unwrapped}}}function eq(i,r){return e.ax(i,e=>{let i=r.pointCoordinate3D(e);e.x=i.x,e.y=i.y},1/256)}function eZ(e){return e<0?1+e%1:e%1}function eH(i,r,a,n,o){let s=function(a,n){if(a)return o(a);if(n){if(i.url&&n.tiles&&i.tiles&&delete i.tiles,n.variants){if(!Array.isArray(n.variants))return o(Error("variants must be an array"));for(let i of n.variants){if(null==i||"object"!=typeof i||i.constructor!==Object)return o(Error("variant must be an object"));if(!Array.isArray(i.capabilities))return o(Error("capabilities must be an array"));if(1===i.capabilities.length&&"meshopt"===i.capabilities[0]){n=e.l(n,i);break}}}let a=e.aA(e.l({},n,i),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);a.tiles=r.canonicalizeTileset(a,i.url),o(null,a)}},l=function(e,i,r){if(!e)return null;if(!i&&!r)return e;r=r||e.worldview_default;let a=Object.values(e.language||{});if(0===a.length)return null;let n=Object.values(e.worldview||{});if(0===n.length)return null;let o=a.every(e=>e===i),s=n.every(e=>e===r);return o&&s?e:i in(e.language_options||{})||r in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(i.data,a,n);return l?e.q.frame(()=>s(null,l)):i.url?e.n(r.transformRequest(r.normalizeSourceURL(i.url,null,a,n),e.R.Source),s):e.q.frame(()=>{let{data:e,...r}=i;s(null,r)})}class e${constructor(i,r,a){this.bounds=e.aB.convert(this.validateBounds(i)),this.minzoom=r||0,this.maxzoom=a||24}
8validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(i){let r=Math.pow(2,i.z),a=Math.floor(e.av(this.bounds.getWest())*r),n=Math.floor(e.aC(this.bounds.getNorth())*r),o=Math.ceil(e.av(this.bounds.getEast())*r),s=Math.ceil(e.aC(this.bounds.getSouth())*r);return i.x>=a&&i.x<o&&i.y>=n&&i.y<s}}class eW extends e.E{constructor(i,r,a,n){if(super(),this.id=i,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.l(this,e.aA(r,["url","scheme","tileSize","promoteId"])),this._options=e.l({type:"vector"},r),this._collectResourceTiming=!!r.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new e.aD}load(i){this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map.getWorldview();this._tileJSONRequest=eH(this._options,this.map._requestManager,r,a,(n,o)=>{if(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&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new e.z(n));else if(o){if(e.l(this,o),this.hasWorldviews=!!o.worldview_options,o.worldview_default&&(this.worldviewDefault=o.worldview_default),o.vector_layers)for(let e of(this.vectorLayers=o.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set,o.vector_layers))this.vectorLayerIds.push(e.id),o.worldview&&o.worldview[e.source]&&this.localizableLayerIds.add(e.id);o.bounds&&(this.tileBounds=new e$(o.bounds,this.minzoom,this.maxzoom)),R(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}i&&i(n)})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}loadTile(i,r){let a=i.tileID.canonical.url(this.tiles,this.scheme),n=this.map._requestManager.normalizeTileURL(a),o=this.map._requestManager.transformRequest(n,e.R.Tile),s=this.map.style?this.map.style.getLut(this.scope):null,l=s?{image:s.image.clone()}:null,h={request:o,data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,lut:l,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:i.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor()};if(this.hasWorldviews&&e.f(a)&&(h.worldview=this.map.getWorldview()||this.worldviewDefault,h.localizableLayerIds=this.localizableLayerIds),h.request.collectResourceTiming=this._collectResourceTiming,i.actor&&"expired"!==i.state)"loading"===i.state?i.reloadCallback=r:i.request=i.actor.send("reloadTile",h,u.bind(this));else if(i.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)i.request=i.actor.send("loadTile",h,u.bind(this),void 0,!0);else{let r=e.aE.call({deduped:this._deduped},h,(e,r)=>{e||!r?u.call(this,e):(h.data={cacheControl:r.cacheControl,expires:r.expires,rawData:r.rawData.slice(0)},i.actor&&i.actor.send("loadTile",h,u.bind(this),void 0,!0))},!0);i.request={cancel:r}}function u(a,n){return delete i.request,i.aborted?r(null):a&&404!==a.status?r(a):(n&&n.resourceTiming&&(i.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&i.setExpiryData(n),i.loadVectorData(n,this.map.painter),e.aF(this.dispatcher),r(null),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(e,i){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class eX extends e.E{constructor(i,r,a,n){super(),this.id=i,this.dispatcher=a,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.l({type:"raster"},r),e.l(this,e.aA(r,["url","scheme","tileSize"]))}load(i){this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"})),this._tileJSONRequest=eH(this._options,this.map._requestManager,null,null,(r,a)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new e.z(r)):a&&(e.l(this,a),a.raster_layers&&(this.rasterLayers=a.raster_layers,this.rasterLayerIds=this.rasterLayers.map(e=>e.id)),a.bounds&&(this.tileBounds=new e$(a.bounds,this.minzoom,this.maxzoom)),R(a.tiles),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))),i&&i(r)})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(i,r){let a=e.q.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),a,this.tileSize);i.request=e.o(this.map._requestManager.transformRequest(n,e.R.Tile),(a,n,o,s)=>(delete i.request,i.aborted?(i.state="unloaded",r(null)):a?(i.state="errored",r(a)):n?(this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:o,expires:s}),i.setTexture(n,this.map.painter),i.state="loaded",e.aF(this.dispatcher),void r(null)):r(null)))}abortTile(e,i){e.request&&(e.request.cancel(),delete e.request),i&&i()}unloadTile(i,r){i.texture&&i.texture instanceof e.T?(i.destroy(!0),i.texture&&i.texture instanceof e.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),r&&r()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class eY extends eX{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=22,this.partial=!0,this.iconsets={},this._options=e.l({type:"raster-array"},r)}triggerRepaint(e){let i=this.map.painter._terrain,r=this.map.style.getSourceCache(this.id);i&&i.enabled&&r&&i._clearRenderCacheForTile(r.id,e.tileID),this.map.triggerRepaint()}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(a,e.R.Tile),o={request:n,uid:i.uid,tileID:i.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:this.partial};i.source=this.id,i.scope=this.scope,i.requestParams=n,i.actor||(i.actor=this.dispatcher.getActor());let s=(a,n,o,s)=>{if(delete i.request,i.aborted)return i.state="unloaded",r(null);if(a){if("AbortError"===a.name)return;return i.state="errored",r(a)}if(this.map._refreshExpiredTiles&&n&&i.setExpiryData({cacheControl:o,expires:s}),this.partial)i.state="empty";else{if(!n)return r(null);i.state="loaded",i._isHeaderLoaded=!0,i._mrt=n;let a=new Map;for(let r in i._mrt.layers){let n=i.getLayer(r);if(n)for(let i of n.getBandList()){let{bytes:o,tileSize:s,buffer:l}=n.getBandView(i),h=s+2*l,u={data:new e.r({width:h,height:h},o),pixelRatio:2,sdf:!1,usvg:!1,version:0};a.set(`${r}/${i}`,u)}}for(let e in this.iconsets)this.iconsets[e].addIcons(a)}r(null)};i.request=this.partial?i.fetchHeader(void 0,s.bind(this)):i.actor.send("loadTile",o,s.bind(this),void 0,!0)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(i,r){let a=i.texture;a&&a instanceof e.T?(i.destroy(!0),this.map.painter.saveTileTexture(a)):(i.destroy(),i.flushQueues(),i._isHeaderLoaded=!1,delete i._mrt,delete i.textureDescriptor),i.fbo&&(i.fbo.destroy(),delete i.fbo),delete i.request,delete i.requestParams,delete i.neighboringTiles,i.state="unloaded"}prepareTile(i,r,a){i._isHeaderLoaded&&("empty"!==i.state&&(i.state="reloading"),i.fetchBand(r,a,(r,a)=>{r?(i.state="errored",this.fire(new e.z(r)),this.triggerRepaint(i)):a&&(i._isHeaderLoaded=!0,i.setTexture(a,this.map.painter),i.state="loaded",this.triggerRepaint(i))}))}getInitialBand(e){if(!this.rasterLayers)return 0;let i=this.rasterLayers.find(({id:i})=>i===e),r=i&&i.fields,a=r&&r.bands&&r.bands;return a?a[0]:0}getTextureDescriptor(i,r,a){if(!i)return;let n=r.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let o=null;r instanceof e.aI?o=r.paint.get("raster-array-band"):r instanceof e.aJ&&(o=r.paint.get("raster-particle-array-band"));let s=o||this.getInitialBand(n);if(null!=s)if(i.textureDescriptor){if(!i.updateNeeded(n,s)||a)return Object.assign({},i.textureDescriptor,{texture:i.texture})}else this.prepareTile(i,n,s)}addIconset(e,i){this.iconsets[e]=i,this.partial=!1}}let eK={vector:eW,raster:eX,"raster-dem":class extends eX{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=e.l({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,a){e&&(i.state="errored",r(e)),a&&(i.dem=a,i.dem.onDeserialize(),i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0,i.state="loaded",r(null))}i.request=e.o(this.map._requestManager.transformRequest(a,e.R.Tile),(function(a,o,s,l){if(delete i.request,i.aborted)i.state="unloaded",r(null);else if(a)i.state="errored",r(a);else if(o){this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:s,expires:l});let r=ImageBitmap&&o instanceof ImageBitmap&&e.t(),a=1-(o.width-e.aG(o.width))/2;a<1||i.neighboringTiles||(i.neighboringTiles=this._getNeighboringTiles(i.tileID));let h=r?o:e.q.getImageData(o,a),u={uid:i.uid,tileID:i.tileID,source:this.id,type:this.t
8ype,scope:this.scope,rawImageData:h,encoding:this.encoding,padding:a};i.actor&&"expired"!==i.state||(i.actor=this.dispatcher.getActor(),i.actor.send("loadTile",u,n.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(i){let r=i.canonical,a=Math.pow(2,r.z),n=(r.x-1+a)%a,o=0===r.x?i.wrap-1:i.wrap,s=(r.x+1+a)%a,l=r.x+1===a?i.wrap+1:i.wrap,h={};return h[new e.aH(i.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},h[new e.aH(i.overscaledZ,l,r.z,s,r.y).key]={backfilled:!1},r.y>0&&(h[new e.aH(i.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},h[new e.aH(i.overscaledZ,i.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},h[new e.aH(i.overscaledZ,l,r.z,s,r.y-1).key]={backfilled:!1}),r.y+1<a&&(h[new e.aH(i.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},h[new e.aH(i.overscaledZ,i.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},h[new e.aH(i.overscaledZ,l,r.z,s,r.y+1).key]={backfilled:!1}),h}},"raster-array":eY,geojson:class extends e.E{constructor(i,r,a,n){super(),this.id=i,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=a.getActor(),this.setEventedParent(n),this._data=r.data,this._options=e.l({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),void 0!==r.minzoom&&(this.minzoom=r.minzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;const o=e.ai/this.tileSize;this.workerOptions=e.l({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(void 0!==r.buffer?r.buffer:128)*o,tolerance:(void 0!==r.tolerance?r.tolerance:.375)*o,extent:e.ai,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:void 0!==r.clusterMaxZoom?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:e.ai,radius:(void 0!==r.clusterRadius?r.clusterRadius:50)*o,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter,dynamic:r.dynamic},r.workerOptions)}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(i){if(!this._options.dynamic)return this.fire(new e.z(Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof i&&("Feature"===i.type&&(i={type:"FeatureCollection",features:[i]}),"FeatureCollection"!==i.type))return this.fire(new e.z(Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof i&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){let e=new Map;for(let i of this._data.features)e.set(i.id,i);for(let r of i.features)e.set(r.id,r);this._data.features=[...e.values()]}else this._data=i;return this._updateWorkerData(!0),this}getClusterExpansionZoom(e,i){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope},i),this}getClusterChildren(e,i){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope},i),this}getClusterLeaves(e,i,r,a){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:i,offset:r},a),this}_updateWorkerData(i=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new e.A("dataloading",{dataType:"source"})),this._loaded=!1;let r=e.l({append:i},this.workerOptions);r.scope=this.scope;let a=this._data;"string"==typeof a?(r.request=this.map._requestManager.transformRequest(e.q.resolveURL(a),e.R.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(a),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,(r,a)=>{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new e.z(r));else{let r={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&a&&a.resourceTiming&&a.resourceTiming[this.id]&&(r.resourceTiming=a.resourceTiming[this.id]),i&&(this._partialReload=!0),this.fire(new e.A("data",r)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(i),this._coalesce=!1)})}loaded(){return this._loaded}reload(){let i=e.C(this.id,this.scope);this.map.style.clearSource(i),this._updateWorkerData()}loadTile(i,r){let a=i.actor?"reloadTile":"loadTile";i.actor=this.actor;let n=this.map.style?this.map.style.getLut(this.scope):null,o=n?{image:n.image.clone()}
8:null,s=this._partialReload,l={type:this.type,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:o,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,scaleFactor:this.map.getScaleFactor(),partial:s};i.request=this.actor.send(a,l,(e,n)=>s&&!n?(i.state="loaded",r(null)):(delete i.request,i.destroy(),i.aborted?r(null):e?r(e):(i.loadVectorData(n,this.map.painter,"reloadTile"===a),r(null))),void 0,"loadTile"===a)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,i){this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.aK{constructor(e,i,r,a){super(e,i,r,a),this.roundZoom=!0,this.type="video",this.options=i}load(){this._loaded=!1;let i=this.options;for(let r of(this.urls=[],i.urls))this.urls.push(this.map._requestManager.transformRequest(r,e.R.Source).url);e.aL(this.urls,(i,r)=>{this._loaded=!0,i?this.fire(new e.z(i)):r&&(this.video=r,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(i){if(this.video){let r=this.video.seekable;i<r.start(0)||i>r.end(0)?this.fire(new e.z(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=i}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,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 i=this.map.painter.context,r=i.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(i,this.video,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(i)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.aK,model:class extends e.E{constructor(e,i,r,a){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=i}load(){let i=[];for(let r in this._options.models){let a=this._options.models[r],n=e.aN(this.map._requestManager.transformRequest(a.uri,e.R.Model).url).then(i=>{if(!i)return;let n=e.aO(i),o=new e.aP(r,a.position,a.orientation,n);o.computeBoundsAndApplyParent(),this.models.push(o)}).catch(i=>{this.fire(new e.z(Error(`Could not load model ${r} from ${a.uri}: ${i.message}`)))});i.push(n)}return Promise.allSettled(i).then(()=>{this._loaded=!0,this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this.fire(new e.z(Error(`Could not load models: ${i.message}`)))})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,i){}serialize(){return{type:"model"}}},"batched-model":class extends e.E{constructor(e,i,r,a){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=i,this.tiles=this._options.tiles,this.maxzoom=i.maxzoom||19,this.minzoom=i.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=r,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(a)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.C(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 e.A("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map.getWorldview();this._tileJSONRequest=eH(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 e.z(n))):o&&(e.l(this,o),o.bounds&&(this.tileBounds=new e$(o.bounds,this.minzoom,this.maxzoom)),R(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))),i&&i(n)})}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(a,e.R.Tile),data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:e.q.devicePixelRatio,promoteId:this.promoteId};if(i.actor&&"expired"!==i.state)if("loading"===i.state)i.reloadCallback=r;else{if(i.buckets){for(let e of Object.values(i.buckets))e.dirty=!0;return void(i.state="loaded")}i.request=i.actor.send("reloadTile",n,o.bind(this))}else i.actor=this.dispatcher.getActor(),i.request=i.actor.send("loadTile",n,o.bind(this),void 0,!0);function o(e,a){return i.aborted?r(null):e&&404!==e.status?r(e):(this.map._refreshExpiredTiles&&a&&i.setExpiryData(a),i.loadModelData(a,this.map.painter),i.state="loaded",void r(null))}}serialize(){return e.l({},this._options)}},canvas:class extends e.aK{constructor(i,r,a,n){super(i,r,a,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new e.z(new e.V(`sources.${i}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.z(new e.V(`sources.${i}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.z(new e.V(`sources.${i}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new e.z(new e.V(`sources.${i}`,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 e.z(new e.V(`sources.${i}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.z(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let i=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,i=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,i=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let r=this.map.painter.context;this.texture?!i&&!this._playing||this.texture instanceof e.aM||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(r,this.canvas,r.gl.RGBA8,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(i,r,a,n){super(),this.id=i,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=r,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.z(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.z(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new e$(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),e.l(this,e.aA(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.aA(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(i){this.map=i,this._loaded=!1,this.fire(new e.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(i),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){let{x:i,y:r,z:a}=e.canonical;return this._implementation.hasTile({x:i,y:r,z:a})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,i){let{x:r,y:a,z:n}=e.tileID.canonical,o=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:r,y:a,z:n},{signal:o.signal})).then((function(r){return delete e.request,e.aborted?(e.state="unloaded",i(null)):void 0===r?(e.state="errored",i(null)):null===r?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",i(null)):r instanceof ImageData||r instanceof HTMLCanvasElement||r instanceof ImageBitmap||r instanceof HTMLImageElement?(this.loadTileData(e,r),e.state="loaded",void i(null)):(e.state="errored",i(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(r=>{"AbortError"!==r.name&&(e.state="errored",i(r))}),e.request.cancel=()=>o.abort()}loadTileData(e,i){e.setTexture(i,this.map.painter)}unloadTile(i,r){if(i.texture&&i.texture instanceof e.T?(i.destroy(!0),i.texture&&i.texture instanceof e.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),this._implementation.unloadTile){let{x:e,y:r,z:a}=i.tileID.canonical;this._implementation.unloadTile({x:e,y:r,z:a})}r&&r()}abortTile(e,i){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),i&&i()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}))}_clearTiles(){let i=e.C(this.id,this.scope);this.map.style.clearSource(i)}
8_update(){this.fire(new e.A("data",{dataType:"source",sourceDataType:"content"}))}}},eJ=function(i,r,a,n){let o=new eK[r.type](i,r,a,n);if(o.id!==i)throw Error(`Expected Source id to be ${i} instead of ${o.id}`);return e.aQ(["load","abort","unload","serialize","prepare"],o),o};function eQ(e,i,r=""){return`${r}:${i.id||""}:${i.layer.id}:${function(e){if("layerId"in e)return`layer:${e.layerId}`;{let{featuresetId:i,importId:r}=e;return`featureset:${i}${r?`:import:${r}`:""}`}}(e.target)}`}function e0(e,i,r,a=""){if(e.uniqueFeatureID){let n=eQ(e,i,a);if(r.has(n))return!0;r.add(n)}return!1}function e1(e,i){let r=e.tileID,a=i.tileID;return r.overscaledZ-a.overscaledZ||r.canonical.y-a.canonical.y||r.wrap-a.wrap||r.canonical.x-a.canonical.x}function e2(e,i){let r={};if(!i)return r;for(let a of e){let e=a.layerIds.map(e=>i.getLayer(e)).filter(Boolean);if(0!==e.length)for(let i of(a.layers=e,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(i=>e.filter(e=>e.id===i)[0])),e))r[i.fqid]=a}return r}let e3=new Uint16Array(8184);for(let e=0;e<2046;e++){let i=e+2,r=0,a=0,n=0,o=0,s=0,l=0;for(1&i?n=o=s=32:r=a=l=32;(i>>=1)>1;){let e=r+n>>1,h=a+o>>1;1&i?(n=r,o=a,r=s,a=l):(r=n,a=o,n=s,o=l),s=e,l=h}let h=4*e;e3[h+0]=r,e3[h+1]=a,e3[h+2]=n,e3[h+3]=o}let e4=new Uint16Array(2178),e5=new Uint8Array(1089),e6=new Uint16Array(1089);function e8(e){return 0===e?-.03125:.03125*(32===e)}let e9={type:2,extent:e.ai,loadGeometry:()=>[[new e.P(0,0),new e.P(e.ai+1,0),new e.P(e.ai+1,e.ai+1),new e.P(0,e.ai+1),new e.P(0,0)]]};class e7{constructor(i,r,a,n,o){this.tileID=i,this.uid=e.aW(),this.uses=0,this.tileSize=r,this.tileZoom=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(i){let r=i+this.timeAdded;r<e.q.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=e.aR(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,a){if(this.unloadVectorData(),this.state="loaded",i){for(let n in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=e2(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){let i=this.buckets[n];if(i instanceof e.aY){if(this.hasSymbolBuckets=!0,!a)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof e.aY&&r.hasRTLText){this.hasRTLText=!0,e.aZ();break}}for(let e in this.queryPadding=0,this.buckets){let i=this.buckets[e],a=r.style.getOwnLayer(e);if(!a)continue;let n=a.queryRadius(i);this.queryPadding=Math.max(this.queryPadding,n)}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas),this._lastUpdatedBrightness=i.brightness}else this.collisionBoxArray=new e.aX}unloadVectorData(){if(this.hasData()){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),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(e,i,r){e&&(e.resourceTiming&&(this.resourceTiming=e.resourceTiming),this.buckets=Object.assign({},this.buckets,e2(e.buckets,i.style)),e.featureIndex&&(this.latestFeatureIndex=e.featureIndex))}getBucket(e){return this.buckets[e.fqid]}upload(i){for(let e in this.buckets){let r=this.buckets[e];r.uploadPending()&&r.upload(i)}let r=i.gl,a=this.imageAtlas;a&&!a.uploaded&&(this.imageAtlasTexture=new e.T(i,a.image,r.RGBA8,{useMipmap:!!a.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(i,this.glyphAtlasImage,r.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new e.T(i,this.lineAtlas.image,r.R8),this.lineAtlas.uploaded=!0)}prepare(e,i,r){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,r),!i||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;let a=i.style.getBrightness();(this._lastUpdatedBrightness||a)&&(this._lastUpdatedBrightness&&a&&.001>Math.abs(this._lastUpdatedBrightness-a)||(this.updateBuckets(i,this._lastUpdatedBrightness!==a),this._lastUpdatedBrightness=a))}queryRenderedFeatures(i,r,a,n,o,s){var l;let h;if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};let u=(l=this.tileID,h=e.ad.mat4.fromScaling([],[.5*o.width,-(.5*o.height),1]),e.ad.mat4.translate(h,h,[1,-1,0]),e.ad.mat4.multiply(h,h,o.calculateProjMatrix(l.toUnwrapped())),Float32Array.from(h)
8);return this.latestFeatureIndex.query(i,{tilespaceGeometry:r,pixelPosMatrix:u,transform:n,availableImages:a,tileTransform:this.tileTransform})}querySourceFeatures(i,r){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;let n=a.loadVTLayers(),o=r?r.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;let l=e.a_(r&&r.filter),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<s.length;r++){let n=s.feature(r);if(l.needGeometry){let i=e.a$(n,!0);if(!l.filter(new e.aa(this.tileID.overscaledZ),i,this.tileID.canonical))continue}else if(!l.filter(new e.aa(this.tileID.overscaledZ),n))continue;let p=a.getId(n,o),f=new e.b0(n,h,u,c,p);f.tile=d,i.push(f)}}loaded(){return"loaded"===this.state||"errored"===this.state}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=e.b1(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let e=Date.now(),i=!1;if(this.expirationTime>e)i=!1;else if(r)if(this.expirationTime<r)i=!0;else{let a=this.expirationTime-r;a?this.expirationTime=e+Math.max(a,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),0x7fffffff)}refreshFeatureState(e){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&e&&this.updateBuckets(e)}updateBuckets(i,r){if(!this.latestFeatureIndex||!i.style)return;let a=this.latestFeatureIndex.loadVTLayers(),n=i.style.listImages(),o=i.style.getBrightness();for(let s in this.buckets){if(!i.style.hasLayer(s))continue;let l=this.buckets[s],h=l.layers[0],u=h.sourceLayer||"_geojsonTileLayer",c=a[u],d=i.style.getLayerSourceCache(h),p={};d&&(p=d._state.getState(u,void 0));let f=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},m=Object.keys(p).length>0&&!r;(!m||l.stateDependentLayers.length||r)&&l.update(p,c,n,f,m?l.stateDependentLayers:l.layers,r,o),(l instanceof e.b2||l instanceof e.b3)&&i._terrain&&i._terrain.enabled&&d&&l.uploadPending()&&i._terrain._clearRenderCacheForTile(d.id,this.tileID);let _=i&&i.style&&i.style.getOwnLayer(s);_&&(this.queryPadding=Math.max(this.queryPadding,_.queryRadius(l)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=e.q.now()+i}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof e.T?this.texture.update(i):(this.texture=new e.T(a,i,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(e,i){let r={};for(let e of i)r[e]=!0;this.dependencies[e]=r}hasDependency(e,i){for(let r of e){let e=this.dependencies[r];if(e){for(let r of i)if(e[r])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let a=e.b4(e9,this.tileID.canonical,this.tileTransform)[0],n=new e.b5,o=new e.b6;for(let e=0;e<a.length;e++){let{x:i,y:r}=a[e];n.emplaceBack(i,r),o.emplaceBack(e)}o.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(o),this._tileDebugBuffer=i.createVertexBuffer(n,e.b7.members),this._tileDebugSegments=e.b8.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(i,r){let a,n;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=e.b4(e9,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let a=e.aR(i,r),n=Math.pow(2,i.z);for(let o=0;o<33;o++)for(let s=0;s<33;s++){let l=e.aS((i.x+(s+e8(s))/32)/n),h=e.aT((i.y+(o+e8(o))/32)/n),u=r.project(l,h),c=33*o+s;e4[2*c+0]=Math.round((u.x*a.scale-a.x)*e.ai),e4[2*c+1]=Math.round((u.y*a.scale-a.y)*e.ai)}e5.fill(0),e6.fill(0);for(let e=2045;e>=0;e--){let i=4*e,r=e3[i+0],a=e3[i+1],n=e3[i+2],o=e3[i+3],s=r+n>>1,l=a+o>>
81,h=s+l-a,u=l+r-s,c=33*a+r,d=33*o+n,p=33*l+s,f=Math.hypot((e4[2*c+0]+e4[2*d+0])/2-e4[2*p+0],(e4[2*c+1]+e4[2*d+1])/2-e4[2*p+1])>=16;e5[p]=e5[p]||+!!f,e<1022&&(e5[p]=e5[p]||e5[(a+u>>1)*33+(r+h>>1)]||e5[(o+u>>1)*33+(n+h>>1)])}let o=new e.aU,s=new e.aV,l=0;function h(i,r){let a=33*r+i;return 0===e6[a]&&(o.emplaceBack(e4[2*a+0],e4[2*a+1],i*e.ai/32,r*e.ai/32),e6[a]=++l),e6[a]-1}function u(e,i,r,a,n,o){let l=e+r>>1,c=i+a>>1;if(Math.abs(e-n)+Math.abs(i-o)>1&&e5[33*c+l])u(n,o,e,i,l,c),u(r,a,n,o,l,c);else{let l=h(e,i),u=h(r,a),c=h(n,o);s.emplaceBack(l,u,c)}}return u(0,0,32,32,32,0),u(32,32,0,0,0,32),{vertices:o,indices:s}}(this.tileID.canonical,r);a=i.vertices,n=i.indices}else{for(let{x:i,y:r}of(a=new e.aU,n=new e.aV,o))a.emplaceBack(i,r,0,0);let i=e.b9(a.int16,void 0,4);for(let e=0;e<i.length;e+=3)n.emplaceBack(i[e],i[e+1],i[e+2])}this._tileBoundsBuffer=i.createVertexBuffer(a,e.ba.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(n),this._tileBoundsSegments=e.b8.simpleSegment(0,0,a.length,n.length)}_makeGlobeTileDebugBuffers(i,r){let a,n=r.projection;if(!n||"globe"!==n.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=e.bb(o,r),l=e.bc(s),h=e.ag(r.zoom);h>0&&(a=e.ad.mat4.invert(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,o,r,l,a,h),this._makeGlobeTileDebugTextBuffer(i,o,r,l,a,h)}_globePoint(i,r,a,n,o,s,l){let h=e.bd(i,r,a);if(s){let o=1<<a.z,u=e.av(n.center.lng),c=e.aC(n.center.lat),d=(a.x+.5)/o-u,p=0;d>.5?p=-1:d<-.5&&(p=1);let f=(i/e.ai+a.x)/o+p,m=(r/e.ai+a.y)/o;f=(f-u)*n._pixelsPerMercatorPixel+u,m=(m-c)*n._pixelsPerMercatorPixel+c;let _=[f*n.worldSize,m*n.worldSize,0];e.ad.vec3.transformMat4(_,_,s),h=e.be(h,_,l)}return e.ad.vec3.transformMat4(h,h,o)}_makeGlobeTileDebugBorderBuffer(i,r,a,n,o,s){let l=new e.b5,h=new e.b6,u=new e.bf,c=(e,i,c,d,p)=>{let f=(c-e)/(p-1),m=(d-i)/(p-1),_=l.length;for(let c=0;c<p;c++){let d=e+c*f,p=i+c*m;l.emplaceBack(d,p);let g=this._globePoint(d,p,r,a,n,o,s);u.emplaceBack(g[0],g[1],g[2]),h.emplaceBack(_+c)}},d=e.ai;c(0,0,d,0,16),c(d,0,d,d,16),c(d,d,0,d,16),c(0,d,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(h),this._tileDebugBuffer=i.createVertexBuffer(l,e.b7.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(u,e.bg.members),this._tileDebugSegments=e.b8.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(i,r,a,n,o,s){let l=e.ai/4,h=new e.b5,u=new e.aV,c=new e.bf;u.reserve(32),h.reserve(25),c.reserve(25);let d=(e,i)=>25*e+i;for(let e=0;e<25;e++){let i=e*l;for(let e=0;e<25;e++){let u=e*l;h.emplaceBack(u,i);let d=this._globePoint(u,i,r,a,n,o,s);c.emplaceBack(d[0],d[1],d[2])}}for(let e=0;e<4;e++)for(let i=0;i<4;i++){let r=d(e,i),a=d(e,i+1),n=d(e+1,i),o=d(e+1,i+1);u.emplaceBack(r,a,n),u.emplaceBack(n,a,o)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(u),this._tileDebugTextBuffer=i.createVertexBuffer(h,e.b7.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(c,e.bg.members),this._tileDebugTextSegments=e.b8.simpleSegment(0,0,25,32)}destroy(i=!1){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!i&&this.texture&&this.texture instanceof e.T&&(this.texture.destroy(),delete this.texture),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"}}e.bh.setPbf(e.bi);class te extends e7{constructor(e,i,r,a,n){super(e,i,r,a,n),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}
8getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(e){return this._mrt&&this._mrt.getLayer(e)}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof e.T?this.texture.update(i,{premultiply:!1}):this.texture=new e.T(a,i,n.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(i=16384,r){let a=this._mrt=new e.bh(30),n=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(i-1)}});return this.entireBuffer=null,this.request=e.bj(n,(e,n,o,s)=>{if(e)r(e);else try{let e=a.getHeaderLength(n);if(e>i)return void(this.request=this.fetchHeader(e,r));a.parseHeader(n),this._isHeaderLoaded=!0;let l=0;for(let e of Object.values(a.layers))l=Math.max(l,e.dataIndex[e.dataIndex.length-1].lastByte);n.byteLength>=l&&(this.entireBuffer=n),r(null,this.entireBuffer||n,o,s)}catch(e){r(e)}}),this.request}fetchBand(i,r,a){let n,o=this._mrt;if(!this._isHeaderLoaded||!o)return void a(Error("Tile header is not ready"));let s=this.actor;if(!s)return void a(Error("Can't fetch tile band without an actor"));let l=(e,o)=>{n.complete(e,o),e?a(e):(this.updateTextureDescriptor(i,r),a(null,this.textureDescriptor&&this.textureDescriptor.img))},h=(e,i)=>{if(e)return a(e);let r=s.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:i,task:n},l,void 0,!0);this._workQueue.push(()=>{r&&r.cancel(),n.cancel()})},u=o.getLayer(i);if(!u)return void a(Error(`Unknown sourceLayer "${i}"`));if(u.hasDataForBand(r))return this.updateTextureDescriptor(i,r),void a(null,this.textureDescriptor?this.textureDescriptor.img:null);let c=u.getDataRange([r]);if((n=o.createDecodingTask(c))&&!n.tasks.length)a(null);else if(this.flushQueues(),this.entireBuffer)h(null,this.entireBuffer.slice(c.firstByte,c.lastByte+1));else{let i=Object.assign({},this.requestParams,{headers:{Range:`bytes=${c.firstByte}-${c.lastByte}`}}),r=e.bj(i,h);this._fetchQueue.push(()=>{r.cancel(),n.cancel()})}}updateNeeded(e,i){return(!this.textureDescriptor||this.textureDescriptor.band!==i||this.textureDescriptor.layer!==e)&&"errored"!==this.state}updateTextureDescriptor(i,r){if(!this._mrt)return;let a=this._mrt.getLayer(i);if(!a||!a.hasBand(r)||!a.hasDataForBand(r))return;let{bytes:n,tileSize:o,buffer:s,offset:l,scale:h}=a.getBandView(r),u=o+2*s,c=new e.r({width:u,height:u},n),d=this.texture;d&&d instanceof e.T&&d.update(c,{premultiply:!1}),this.textureDescriptor={layer:i,band:r,img:c,buffer:s,offset:l,tileSize:o,format:a.pixelFormat,mix:[h,256*h,65536*h,0x1000000*h]}}}class tt{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(let e in this.data)for(let i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,r){let a=e.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);let n={value:i,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(e,n)},r)),this.data[a].push(n),this.order.push(a),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){let i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;let r=e.wrapped().key,a=void 0===i?0:this.data[r].indexOf(i),n=this.data[r][a];return this.data[r].splice(a,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let i=[];for(let r in this.data)for(let a of this.data[r])e(a.value)||i.push(a);for(let e of i)this.remove(e.value.tileID,e)}}class ti{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,r,a){let n=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][n]=this.stateChanges[i][n]||{},e.l(this.stateChanges[i][n],a),null===this.deletedStates[i])for(let e in this.deletedStates[i]={},this.state[i])e!==n&&(this.deletedStates[i][e]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][n])for(let e in this.deletedStates[i][n]={},this.state[i][n])a[e]||(this.deletedStates[i][n][e]=null);else for(let e in a)this.deletedStates[i]&&this.deletedStates[i][n]&&null===this.deletedStates[i][n][e]&&delete this.deletedStates[i][n][e]}removeFeatureState(e,i,r){if(null===this.deletedStates[e])return;let a=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==i)null!==this.deletedStates[e][a]&&(this.deletedStates[e][a]=this.deletedStates[e][a]||{},this.deletedStates[e][a][r]=null);else if(void 0!==i)if(this.stateChanges[e]&&this.stateChanges[e][a])for(r in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][r]=null;else this.deletedStates[e][a]=null;else this.deletedStates[e]=null}getState(i,r){let a=this.state[i]||{},n=this.stateChanges[i]||{},o=this.deletedStates[i];if(null===o)return{};if(void 0!==r){let i=String(r),s=e.l({},a[i],n[i]);if(o){let e=o[r];if(null===e)return{};for(let i in e)delete s[i]}return s}let s=e.l({},a,n);if(o)for(let e in o)delete s[e];return s}initializeTileState(e,i){e.refreshFeatureState(i)}coalesceChanges(i,r){let a={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let r={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),e.l(this.state[i][a],this.stateChanges[i][a]),r[a]=this.state[i][a];a[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let r={};if(null===this.deletedStates[i])for(let e in this.state[i])r[e]={},this.state[i][e]={};else for(let e in this.deletedStates[i]){if(null===this.deletedStates[i][e])this.state[i][e]={};else if(this.state[i][e])for(let r of Object.keys(this.deletedStates[i][e]))delete this.state[i][e][r];r[e]=this.state[i][e]}a[i]=a[i]||{},e.l(a[i],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(let e in i)i[e].refreshFeatureState(r)}}class tr extends e.E{constructor(e,i,r){super(),this.id=e,this._onlySymbols=r,i.on("data",e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),i.on("error",()=>{this._sourceErrored=!0}),this._source=i,this._tiles={},this._cache=new tt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
8,this._minTileCacheSize=i.minTileCacheSize,this._maxTileCacheSize=i.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new ti,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let e in this._tiles)if(!this._tiles[e].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,i){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,i)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){for(let i in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let r=this._tiles[i];r.upload(e),r.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(ta).map(e=>e.key)}getRenderableIds(i,r){let a=[];for(let e in this._tiles)this._isIdRenderable(+e,i,r)&&a.push(this._tiles[e]);return i?a.sort((i,r)=>{let a=i.tileID,n=r.tileID,o=new e.P(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),s=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-n.overscaledZ||s.y-o.y||s.x-o.x}).map(e=>e.tileID.key):a.map(e=>e.tileID).sort(ta).map(e=>e.key)}hasRenderableParent(e){let i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())&&(r||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let e in this._cache.reset(),this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}_reloadTile(e,i){let r=this._tiles[e];r&&("loading"!==r.state&&(r.state=i),this._loadTile(r,this._tileLoaded.bind(this,r,e,i)))}_tileLoaded(i,r,a,n){if(n)if(i.state="errored",404!==n.status)this._source.fire(new e.z(n,{tile:i}));else{if(this._source.fire(new e.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:i})),!(i.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}else i.timeAdded=e.q.now(),"expired"===a&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new e.A("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(e){let i=this.getRenderableIds();for(let a=0;a<i.length;a++){let n=i[a];if(e.neighboringTiles&&e.neighboringTiles[n]){let i=this.getTileByID(n);r(e,i),r(i,e)}}function r(e,i){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let r=i.tileID.canonical.x-e.tileID.canonical.x,a=i.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=i.tileID.key;0===r&&0===a||Math.abs(a)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),i.dem&&e.dem&&(e.dem.backfillBorder(i.dem,r,a),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}
8getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,r,a){for(let n in this._tiles){let o=this._tiles[n];if(a[n]||!o.hasData()||o.tileID.overscaledZ<=i||o.tileID.overscaledZ>r)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>i+1;){let e=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[e.key])&&o.hasData()&&(s=e)}let l=s;for(;l.overscaledZ>i;)if(e[(l=l.scaledTo(l.overscaledZ-1)).key]){a[s.key]=s;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){let r=this._loadedParentTiles[e.key];return r&&r.tileID.overscaledZ>=i?r:null}for(let r=e.overscaledZ-1;r>=i;r--){let i=e.scaledTo(r),a=this._getLoadedTile(i);if(a)return a}}_getLoadedTile(e){let i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,i){i=i||this._source.tileSize;let r=Math.floor((Math.ceil(e.width/i)+1)*(Math.ceil(e.height/i)+1)*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,r):r,n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(n)}handleWrapJump(e){let i=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,i){let e={};for(let r in this._tiles){let a=this._tiles[r];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+i),e[a.tileID.key]=a}for(let i in this._tiles=e,this._timers)clearTimeout(this._timers[i]),delete this._timers[i];for(let e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(i,r,a,n){if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!a)return;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};let o="batched-model"===this._source.type,s,l=this._source.maxzoom,h=this.map&&this.map.painter?this.map.painter._terrain:null;if(h&&h.sourceCache===this&&h.attenuationRange()){let e=Math.floor(h.attenuationRange()[0])-Math.log2(h.getDemUpscale());l>e&&(l=e)}if(this.used||this.usedForTerrain){if(this._source.tileID)s=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new e.aH(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y));else if(0!==this.tileCoverLift){let n=i.clone();n.tileCoverLift=this.tileCoverLift,s=n.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:l,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.minzoom<=1&&"globe"===i.projection.name&&(s.push(new e.aH(1,0,1,0,0)),s.push(new e.aH(1,0,1,1,0)),s.push(new e.aH(1,0,1,0,1)),s.push(new e.aH(1,0,1,1,1)))}else if(s=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:l,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:o}),this._source.hasTile){let e=this._source.hasTile.bind(this._source);s=s.filter(i=>e(i))}}else s=[];if(s.length>0&&this.castsShadows&&n&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!tn(this._source.type)){let e=Math.min(i.coveringZoomLevel({tileSize:r||this._source.tileSize,roundZoom:this._source.roundZoom&&!a}),this._source.maxzoom);if(o)for(let r of i.extendTileCover(s,e))s.push(r);else for(let r of i.extendTileCover(s,e,n))this._shadowCasterTiles[r.key]=!0,s.push(r)}let u=this._updateRetainedTiles(s);if(tn(this._source.type)&&0!==s.length){let i={},r={};for(let a of Object.keys(u)){let n=u[a],o=this._tiles[a];if(!o||o.fadeEndTime&&o.fadeEndTime<=e.q.now())continue;let s=this.findLoadedParent(n,Math.max(n.overscaledZ-tr.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),i[s.tileID.key]=s.tileID),r[a]=n}let a=s[s.length-1].overscaledZ;for(let e in this._tiles){let i=this._tiles[e];if(u[e]||!i.hasData())continue;let n=i.tileID;for(;n.overscaledZ>a;){n=n.scaledTo(n.overscaledZ-1);let a=this._tiles[n.key];if(a&&a.hasData()&&r[n.key]){u[e]=i.tileID;break}}}for(let e in i)u[e]||(this._coveredTiles[e]=!0,u[e]=i[e])}for(let e in u)this._tiles[e].clearFadeHold();for(let i of e.bk(this._tiles,u)){let e=this._tiles[i];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+i)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){let i={};if(0===e.length)return i;let r={},a=e.reduce((e,i)=>
8Math.min(e,i.overscaledZ),1/0),n=e[0].overscaledZ,o=Math.max(n-tr.maxOverzooming,this._source.minzoom),s=Math.max(n+tr.maxUnderzooming,this._source.minzoom),l={};for(let r of e){let e=this._addTile(r);i[r.key]=r,e.hasData()||a<this._source.maxzoom&&(l[r.key]=r)}for(let n of(this._retainLoadedChildren(l,a,s,i),e)){let e=this._tiles[n.key];if(e.hasData())continue;if(n.canonical.z>=this._source.maxzoom){let e=n.children(this._source.maxzoom)[0],r=this.getTile(e);if(r&&r.hasData()){i[e.key]=e;continue}}else{let e=n.children(this._source.maxzoom);if(i[e[0].key]&&i[e[1].key]&&i[e[2].key]&&i[e[3].key])continue}let a=e.wasRequested();for(let s=n.overscaledZ-1;s>=o;--s){let o=n.scaledTo(s);if(r[o.key]||(r[o.key]=!0,(e=this.getTile(o))||!a||(e=this._addTile(o)),e&&(i[o.key]=o,a=e.wasRequested(),e.hasData())))break}}return i}_updateLoadedParentTileCache(){for(let e in this._loadedParentTiles={},this._tiles){let i=[],r,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){r=this._loadedParentTiles[a.key];break}i.push(a.key);let e=a.scaledTo(a.overscaledZ-1);if(r=this._getLoadedTile(e))break;a=e}for(let e of i)this._loadedParentTiles[e]=r}}_addTile(i){let r=this._tiles[i.key];if(r)return!0!==r.isExtraShadowCaster||this._shadowCasterTiles[i.key]||this._reloadTile(i.key,"reloading"),r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));let a=!!r;if(!a){let e=this.map?this.map.painter:null,a=this._source.tileSize*i.overscaleFactor();r="raster-array"===this._source.type?new te(i,a,this.transform.tileZoom,e,this._isRaster):new e7(i,a,this.transform.tileZoom,e,this._isRaster),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,a||this._source.fire(new e.A("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let r=i.getExpiryTimeout();r&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},r))}_removeTile(e){let i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&"reloading"!==i.state||"empty"===i.state?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}clearTiles(){for(let e in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(i,r,a){let n=[],o=this.transform;if(!o)return n;let s="globe"===o.projection.name,l=e.av(o.center.lng);for(let h in this._tiles){let u,c=this._tiles[h];if(a&&c.clearQueryDebugViz(),!c.holdingForFade()){if(s){let i=c.tileID.canonical;if(0===i.z){let r=[Math.abs(e.ay(l,...to(i,-1))-l),Math.abs(e.ay(l,...to(i,1))-l)];u=[0,2*r.indexOf(Math.min(...r))-1]}else{let r=[Math.abs(e.ay(l,...to(i,-1))-l),Math.abs(e.ay(l,...to(i,0))-l),Math.abs(e.ay(l,...to(i,1))-l)];u=[r.indexOf(Math.min(...r))-1]}}else u=[0];for(let e of u){let a=i.containsTile(c,o,r,e);a&&n.push(a)}}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,i){let r=this.getRenderableIds(e,i).map(e=>this._tiles[e].tileID),a="globe"===this.transform.projection.name;for(let e of r)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=a?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return r}sortCoordinatesByDistance(e){let i=e.slice(),r=this.transform._camera.position,a=this.transform._camera.forward(),n={};for(let e of i){let i=1/(1<<e.canonical.z);n[e.key]=((e.canonical.x+.5)*i+e.wrap-r[0])*a[0]+((e.canonical.y+.5)*i-r[1])*a[1]-r[2]*a[2]}return i.sort((e,i)=>n[e.key]-n[i.key]),i}hasTransition(){if(this._source.hasTransition())return!0;
8if(tn(this._source.type))for(let i in this._tiles){let r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=e.q.now())return!0}return!1}setFeatureState(e,i,r){this._state.updateState(e=e||"_geojsonTileLayer",i,r)}removeFeatureState(e,i,r){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,r)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,r){let a=this._tiles[e];a&&a.setDependencies(i,r)}reloadTilesForDependencies(e,i){for(let r in this._tiles)this._tiles[r].hasDependency(e,i)&&this._reloadTile(+r,"reloading");this._cache.filter(r=>!r.hasDependency(e,i))}_preloadTiles(i,r){if(!this._sourceLoaded){let e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(i,r))};return void this._source.on("data",e)}let a=new Map,n=Array.isArray(i)?i:[i],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(let e of n){for(let i of e.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}))a.set(i.key,i);this.usedForTerrain&&e.updateElevation(!1)}let l=Array.from(a.values());e.bl(l,(e,i)=>{let r=new e7(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(r,e=>{"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),i(e,r)})},r)}}function ta(e,i){let r=Math.abs(2*e.wrap)-(e.wrap<0),a=Math.abs(2*i.wrap)-(i.wrap<0);return e.overscaledZ-i.overscaledZ||a-r||i.canonical.y-e.canonical.y||i.canonical.x-e.canonical.x}function tn(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function to(e,i){let r=1<<e.z;return[e.x/r+i,(e.x+1)/r+i]}tr.maxOverzooming=10,tr.maxUnderzooming=3;class ts{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){for(let e in this.layers=[],this.style._mergedLayers){let i=this.style._mergedLayers[e];if("fill-extrusion"===i.type)this.layers.push({layer:i,visible:!1,visibilityChanged:!1});else if("model"===i.type){let e=this.style.getLayerSource(i);e&&"batched-model"===e.type&&this.layers.push({layer:i,visible:!1,visibilityChanged:!1})}}}onNewFrame(e){for(let i of(this.layersGotHidden=!1,this.layers)){let r=i.layer,a=!1;"fill-extrusion"===r.type?a=!r.isHidden(e)&&r.paint.get("fill-extrusion-opacity")>0:"model"===r.type&&(a=!r.isHidden(e)&&r.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!a&&i.visible,i.visible=a}}updateZOffset(e,i){for(let e of(this.currentBuildingBuckets=[],this.layers)){let r=e.layer,a=this.style.getLayerSourceCache(r),n=1;"fill-extrusion"===r.type&&(n=e.visible?r.paint.get("fill-extrusion-vertical-scale"):0);let o=a?a.getTile(i):null;if(!o&&a&&i.canonical.z>a.getSource().minzoom){let e=i.scaledTo(Math.min(a.getSource().maxzoom,i.overscaledZ-1));for(;e.overscaledZ>=a.getSource().minzoom&&!(o=a.getTile(e))&&0!==e.overscaledZ;)e=e.scaledTo(e.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:o?o.getBucket(r):null,tileID:o?o.tileID:i,verticalScale:n})}e.hasAnyZOffset=!1;let r=!1;for(let a=0;a<e.symbolInstances.length;a++){let n=e.symbolInstances.get(a),o=n.zOffset,s=this._getHeightAtTileOffset(i,n.tileAnchorX,n.tileAnchorY);n.zOffset=s!==-1/0?s:o,r||o===n.zOffset||(r=!0),e.hasAnyZOffset||0===n.zOffset||(e.hasAnyZOffset=!0)}r&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(i,r,a,n){let o=r,s=a;if(i.canonical.z!==n.canonical.z){let l=n.canonical,h=1/(1<<i.canonical.z-l.z);o=(r+i.canonical.x*e.ai)*h-l.x*e.ai|0,s=(a+i.canonical.y*e.ai)*h-l.y*e.ai|0}return{tileX:o,tileY:s}}_getHeightAtTileOffset(e,i,r){let a,n;for(let o=0;o<this.layers.length;++o){if("fill-extrusion"!==this.layers[o].layer.type)continue;let{bucket:s,tileID:l,verticalScale:h}=this.currentBuildingBuckets[o];if(!s)continue;let{tileX:u,tileY:c}=this._mapCoordToOverlappingTile(e,i,r,l),d=s.getHeightAtTileCoord(u,c);d&&void 0!==d.height&&(d.hidden?a=d.height:n=Math.max(d.height*h,n||0))}if(void 0!==n)return n;for(let n=0;n<this.layers.length;++n){let o=this.layers[n];if("model"!==o.layer.type||!o.visible)continue;let{bucket:s,tileID:l}=this.currentBuildingBuckets[n];if(!s)continue;let{tileX:h,tileY:u}=this._mapCoordToOverlappingTile(e,i,r,l),c=s.getHeightAtTileCoord(h,u);if(c&&!c.hidden)return void 0===c.height&&void 0!==a?Math.min(c.maxHeight,a)*c.verticalScale:c.height?c.height*c.verticalScale:-1/0}return this.layersGotHidden?0:-1/0}}function tl(i){i=i.slice();let r=Object.create(null);for(let e=0;e<i.length;e++)r[i[e].id]=i[e];for(let a=0;a<i.length;a++)"ref"in i[a]&&(i[a]=function(i,r){let a={};for(let e in i)"ref"!==e&&(a[e]=i[e]);
8return e.bm.forEach(e=>{e in r&&(a[e]=r[e])}),a}(i[a],r[i[a].ref]));return i}let th={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function tu(e,i,r){r.push({command:th.addSource,args:[e,i[e]]})}function tc(e,i,r){i.push({command:th.removeSource,args:[e]}),r[e]=!0}function td(i,r,a,n,o,s){let l;for(l in r=r||{},i=i||{})i.hasOwnProperty(l)&&(e.bn(i[l],r[l])||a.push({command:s,args:[n,l,r[l],o]}));for(l in r)r.hasOwnProperty(l)&&!i.hasOwnProperty(l)&&(e.bn(i[l],r[l])||a.push({command:s,args:[n,l,r[l],o]}))}function tp(e){return e.id}function tf(e,i){return e[i.id]=i,e}class tm{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(i){if(1===this.points.length)return this.points[0];i=e.ay(i,0,1);let r=1,a=this._distances[r],n=i*this.paddedLength+this.padding;for(;a<n&&r<this._distances.length;)a=this._distances[++r];let o=r-1,s=this._distances[o],l=a-s,h=l>0?(n-s)/l:0;return this.points[o].mult(1-h).add(this.points[r].mult(h))}}class t_{constructor(e,i,r){const a=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(i/r);for(let e=0;e<this.xCellCount*this.yCellCount;e++)a.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,r,a,n){this._forEachCell(i,r,a,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}insertCircle(e,i,r,a){this._forEachCell(i-a,r-a,i+a,r+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(r),this.circles.push(a)}_insertBoxCell(e,i,r,a,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,i,r,a,n,o){this.circleCells[n].push(o)}_query(e,i,r,a,n,o){if(r<0||e>this.width||a<0||i>this.height)return!n&&[];let s=[];if(e<=0&&i<=0&&this.width<=r&&this.height<=a){if(n)return!0;for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let i=this.circles[3*e],r=this.circles[3*e+1],a=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}return o?s.filter(o):s}return this._forEachCell(e,i,r,a,this._queryCell,s,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?s.length>0:s}_queryCircle(e,i,r,a,n){let o=e-r,s=e+r,l=i-r,h=i+r;if(s<0||o>this.width||h<0||l>this.height)return!a&&[];let u=[];return this._forEachCell(o,l,s,h,this._queryCellCircle,u,{hitTest:a,circle:{x:e,y:i,radius:r},seenUids:{box:{},circle:{}}},n),a?u.length>0:u}query(e,i,r,a,n){return this._query(e,i,r,a,!1,n)}hitTest(e,i,r,a,n){return this._query(e,i,r,a,!0,n)}hitTestCircle(e,i,r,a){return this._queryCircle(e,i,r,!0,a)}_queryCell(e,i,r,a,n,o,s,l){let h=s.seenUids,u=this.boxCells[n];if(null!==u){let n=this.bboxes;for(let c of u)if(!h.box[c]){h.box[c]=!0;let u=4*c;if(e<=n[u+2]&&i<=n[u+3]&&r>=n[u+0]&&a>=n[u+1]&&(!l||l(this.boxKeys[c]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[c],x1:n[u],y1:n[u+1],x2:n[u+2],y2:n[u+3]})}}}let c=this.circleCells[n];if(null!==c){let n=this.circles;for(let u of c)if(!h.circle[u]){h.circle[u]=!0;let c=3*u;if(this._circleAndRectCollide(n[c],n[c+1],n[c+2],e,i,r,a)&&(!l||l(this.circleKeys[u]))){if(s.hitTest)return o.push(!0),!0;{let e=n[c],i=n[c+1],r=n[c+2];o.push({key:this.circleKeys[u],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}}}}_queryCellCircle(e,i,r,a,n,o,s,l){let h=s.circle,u=s.seenUids,c=this.boxCells[n];if(null!==c){let e=this.bboxes;for(let i of c)if(!u.box[i]){u.box[i]=!0;let r=4*i;
8if(this._circleAndRectCollide(h.x,h.y,h.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!l||l(this.boxKeys[i])))return o.push(!0),!0}}let d=this.circleCells[n];if(null!==d){let e=this.circles;for(let i of d)if(!u.circle[i]){u.circle[i]=!0;let r=3*i;if(this._circlesCollide(e[r],e[r+1],e[r+2],h.x,h.y,h.radius)&&(!l||l(this.circleKeys[i])))return o.push(!0),!0}}}_forEachCell(e,i,r,a,n,o,s,l){let h=this._convertToXCellCoord(e),u=this._convertToYCellCoord(i),c=this._convertToXCellCoord(r),d=this._convertToYCellCoord(a);for(let p=h;p<=c;p++)for(let h=u;h<=d;h++)if(n.call(this,e,i,r,a,this.xCellCount*h+p,o,s,l))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,r,a,n,o){let s=a-e,l=n-i,h=r+o;return h*h>s*s+l*l}_circleAndRectCollide(e,i,r,a,n,o,s){let l=(o-a)/2,h=Math.abs(e-(a+l));if(h>l+r)return!1;let u=(s-n)/2,c=Math.abs(i-(n+u));if(c>u+r)return!1;if(h<=l||c<=u)return!0;let d=h-l,p=c-u;return d*d+p*p<=r*r}}let tg=Math.tan(85*Math.PI/180);function ty(i,r,a,n,o,s,l){let h=e.ad.mat4.create();if(a)if("globe"===s.name){let i=e.bo(o,r);e.ad.mat4.multiply(h,h,i)}else{let i=e.ad.mat2.invert([],l);h[0]=i[0],h[1]=i[1],h[4]=i[2],h[5]=i[3],n||e.ad.mat4.rotateZ(h,h,o.angle)}else e.ad.mat4.multiply(h,o.labelPlaneMatrix,i);return h}function tx(e,i,r,a,n,o,s){let l=ty(e,i,r,a,n,o,s);return"globe"===o.name&&r||(l[2]=l[6]=l[10]=l[14]=0),l}function tv(i,r,a,n,o,s,l){if(a){if("globe"===s.name){let h=ty(i,r,a,n,o,s,l);return e.ad.mat4.invert(h,h),e.ad.mat4.multiply(h,i,h),h}{let r=e.ad.mat4.clone(i),a=e.ad.mat4.identity([]);return a[0]=l[0],a[1]=l[1],a[4]=l[2],a[5]=l[3],e.ad.mat4.multiply(r,r,a),n||e.ad.mat4.rotateZ(r,r,-o.angle),r}}return o.glCoordMatrix}function tb(i,r,a,n){let o=[i,r,a,1];a?e.ad.vec4.transformMat4(o,o,n):tz(o,o,n);let s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function tw(e,i){return Math.min(.5+e/i*.5,1.5)}function tT(i,r,a,n,o,s,l,h,u,c){let d=a.transform,p=n?i.textSizeData:i.iconSizeData,f=e.bp(p,a.transform.zoom),m="globe"===d.projection.name,_=[256/a.width*2+1,256/a.height*2+1],g=n?i.text.dynamicLayoutVertexArray:i.icon.dynamicLayoutVertexArray;g.clear();let y=null;m&&(y=n?i.text.globeExtVertexArray:i.icon.globeExtVertexArray);let x=i.lineVertexArray,v=n?i.text.placedSymbolArray:i.icon.placedSymbolArray,b=a.transform.width/a.transform.height,w,T=!1;for(let n=0;n<v.length;n++){let m=v.get(n),{numGlyphs:S,writingMode:M}=m;if(M!==e.bq.vertical||T||w===e.bq.horizontal||(T=!0),w=M,(m.hidden||M===e.bq.vertical)&&!T){tP(S,g);continue}T=!1;let E=new e.P(m.tileAnchorX,m.tileAnchorY),{x:A,y:I,z:C}=d.projection.projectTilePoint(E.x,E.y,c.canonical);if(u){let[e,i,r]=u(E);A+=e,I+=i,C+=r}let P=[A,I,C,1];if(e.ad.vec4.transformMat4(P,P,r),!function(e,i){let r=e[0]/e[3],a=e[1]/e[3];return r>=-i[0]&&r<=i[0]&&a>=-i[1]&&a<=i[1]}(P,_)){tP(S,g);continue}let z=P[3],D=tw(a.transform.getCameraToCenterDistance(d.projection),z),R=e.br(p,f,m),L=l?R/D:R*D,O=tb(A,I,C,o);if(O[3]<=0){tP(S,g);continue}let k={},F=Math.cos(e.ak(i.layers[0].layout.get("text-max-angle"))),B=l?null:u,N=tE(m,L,!1,h,r,o,s,i.glyphOffsetArray,x,g,y,O,E,k,b,B,d.projection,c,l,F);T=N.useVertical,B&&N.needsFlipping&&(k={}),(N.notEnoughRoom||T||N.needsFlipping&&tE(m,L,!0,h,r,o,s,i.glyphOffsetArray,x,g,y,O,E,k,b,B,d.projection,c,l,F).notEnoughRoom)&&tP(S,g)}n?(i.text.dynamicLayoutVertexBuffer.updateData(g),y&&i.text.globeExtVertexBuffer&&i.text.globeExtVertexBuffer.updateData(y)):(i.icon.dynamicLayoutVertexBuffer.updateData(g),y&&i.icon.globeExtVertexBuffer&&i.icon.globeExtVertexBuffer.updateData(y))}function tS(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let{lineStartIndex:y,glyphStartIndex:x,segment:v}=l,b=x+l.numGlyphs,w=y+l.lineLength,T=i.getoffsetX(x),S=i.getoffsetX(b-1),M=tC(e*T,r,a,n,o,s,v,y,w,h,u,c,d,p,!0,f,m,_,g);if(!M)return null;let E=tC(e*S,r,a,n,o,s,v,y,w,h,u,c,d,p,!0,f,m,_,g);return E?{first:M,last:E}:null}function tM(i,r,a,n){return i===e.bq.horizontal&&Math.abs(n)>Math.abs(a)?{useVertical:!0}:i===e.bq.vertical?n>0?{needsFlipping:!0}:null:0!==r&&(0===a||Math.abs(n/a)>tg)?1===r?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function tE(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=r/24,T=i.lineOffsetX*w,S=i.lineOffsetY*w,{lineStartIndex:M,glyphStartIndex:E,numGlyphs:A,segment:I,writingMode:C,flipState:P}=i,z=M+i.lineLength,D=i=>{if(d){let[r,a,n]=i.up,o=c.length;e.bs(d,o+0,r,a,n),e.bs(d,o+1,r,a,n),e.bs(d,o+2,r,a,n),e.bs(d,o+3,r,a,n)}let[r,a,n]=i.point;e.bt(c,r,a,n,i.angle)};if(A>1){let e=tS(w,h,T,S,a,p,f,i,u,s,m,g,!1,y,x,v,b);if(!e)return{notEnoughRoom:!0};if(n&&!a){let[r,a,n]=e.first.point,[o,s,h]=e.last.point;[r,a]=tb(r,a,n,l),[o,s]=tb(o,s,h,l);let u=tM(C,P,(o-r)*_,s-a);if(i.flipState=u&&u.needsFlipping?1:2,u)return u}D(e.first);for(let e=E+1;e<E+A-1;e++){let i=tC(w*h.getoffsetX(e),T,S,a,p,f,I,M,z,u,s,m,g,!1,!1,y,x,v,b);if(!i)return c.length-=4*(e-E),{notEnoughRoom:!0};D(i)}D(e.last)}else{if(n&&!a){let r=tb(f.x,f.y,0,o),a=M+I+1,n=new e.P(u.getx(a),u.gety(a)),s=tb(n.x,n.y,0,o),l=s[3]>0?s:tI(f,n,r,1,o,void 0,y,x.canonical),h=tM(C,P,(l[0]-r[0])*_,l[1]-r[1]);if(i.flipState=h&&h.needsFlipping?1:2,h)return h}let r=tC(w*h.getoffsetX(E),T,S,a,p,f,I,M,z,u,s,m,g,!1,!1,y,x,v,b);if(!r)return{notEnoughRoom:!0};D(r)}return{}}function tA(e,i,r,a,n){let{x:o,y:s,z:l}=a.projectTilePoint(e.x,e.y,i);if(!n)return tb(o,s,l,r);let[h,u,c]=n(e);return tb(o+h,s+u,l+c,r)}function tI(i,r,a,n,o,s,l,h){let u=tA(i.sub(r)._unit()._add(i),h,o,l,s);return e.ad.vec3.sub(u,a,u),e.ad.vec3.normalize(u,u),e.ad.vec3.scaleAndAdd(u,a,u,n)}function tC(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=n?i-r:i+r,w=b>0?1:-1,T=0;n&&(w*=-1,T=Math.PI),w<0&&(T+=Math.PI);let S=h+l+(w>0?0:1)|0,M=o,E=o,A=0,I=0,C=Math.abs(b),P=[],z=[],D=s,R=D,L=e.ad.vec3.zero([]),O=()=>tI(R,D,E,C-A+1,d,f,g,y.canonical);for(;A+I<=C;){if((S+=w)<h||S>=u)return null;
8if(E=M,R=D,P.push(E),m&&z.push(R),D=new e.P(c.getx(S),c.gety(S)),!(M=p[S])){let e=tA(D,y.canonical,d,g,f);M=e[3]>0?p[S]=e:O()}A+=I;let i=e.ad.vec3.sub([],M,E),r=e.ad.vec3.distance(E,M);if(a&&r>0&&I>0&&e.ad.vec3.dot(L,i)/(I*r)<v)return null;I=r,L=i}_&&f&&(p[S]&&(M=O(),I=e.ad.vec3.distance(E,M),L=e.ad.vec3.sub([],M,E)),p[S]=M);let k=(C-A)/I,F=D.sub(R)._mult(k)._add(R),B=e.ad.vec3.scaleAndAdd([],E,L,k),N=[0,0,1],V=L[0],U=L[1];if(x&&(0!==(N=g.upVector(y.canonical,F.x,F.y))[0]||0!==N[1]||1!==N[2])){let i=[N[2],0,-N[0]],r=e.ad.vec3.cross([],N,i);e.ad.vec3.normalize(i,i),e.ad.vec3.normalize(r,r),V=e.ad.vec3.dot(L,i),U=e.ad.vec3.dot(L,r)}if(a){let i=e.ad.vec3.cross([],N,L);e.ad.vec3.normalize(i,i),e.ad.vec3.scaleAndAdd(B,B,i,a*w)}let j=T+Math.atan2(U,V);return P.push(B),m&&z.push(F),{point:B,angle:j,path:P,tilePath:z,up:N}}function tP(e,i){let r=i.length,a=r+4*e;i.resize(a),i.float32.fill(-1/0,4*r,4*a)}function tz(e,i,r){let a=i[0],n=i[1];return e[0]=r[0]*a+r[4]*n+r[12],e[1]=r[1]*a+r[5]*n+r[13],e[3]=r[3]*a+r[7]*n+r[15],e}class tD{constructor(e,i,r=new t_(e.width+200,e.height+200,25),a=new t_(e.width+200,e.height+200,25)){this.transform=e,this.grid=r,this.ignoredGrid=a,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=i}placeCollisionBox(e,i,r,a,n,o,s,l){let h=r.projectedAnchorX,u=r.projectedAnchorY,c=r.projectedAnchorZ,d=r.elevation,p=r.tileID,f=e.getProjection();if(d&&p){let[e,i,a]=f.upVector(p.canonical,r.tileAnchorX,r.tileAnchorY),n=f.upVectorScale(p.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;h+=e*d*n,u+=i*d*n,c+=a*d*n}let m=this.projectAndGetPerspectiveRatio(s,h,u,c,r.tileID,"globe"===f.name||!!d||this.transform.pitch>0,f),_=o*m.perspectiveRatio,g=(r.x1*i+a.x-r.padding)*_+m.point.x,y=(r.y1*i+a.y-r.padding)*_+m.point.y,x=(r.x2*i+a.x+r.padding)*_+m.point.x,v=(r.y2*i+a.y+r.padding)*_+m.point.y,b=m.perspectiveRatio<=.55||m.occluded;return!this.isInsideGrid(g,y,x,v)||!n&&this.grid.hitTest(g,y,x,v,l)||b?{box:[],offscreen:!1,occluded:m.occluded}:{box:[g,y,x,v],offscreen:this.isOffscreen(g,y,x,v),occluded:!1}}placeCollisionCircles(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=[],y=this.transform.elevation,x=i.getProjection(),v=y?y.getAtTileOffsetFunc(_,this.transform.center.lat,this.transform.worldSize,x):null,b=new e.P(a.tileAnchorX,a.tileAnchorY),{x:w,y:T,z:S}=x.projectTilePoint(b.x,b.y,_.canonical);if(v){let[e,i,r]=v(b);w+=e,T+=i,S+=r}let M="globe"===x.name,E=this.projectAndGetPerspectiveRatio(l,w,T,S,_,M||!!y||this.transform.pitch>0,x),{perspectiveRatio:A}=E,I=(d?s/A:s*A)/e.bw,C=tb(w,T,S,h),P=a.lineOffsetX*I,z=a.lineOffsetY*I,D=Math.cos(e.ak(i.layers[0].layout.get("text-max-angle"))),R=E.signedDistanceFromCamera>0?tS(I,o,P,z,!1,C,b,a,n,h,{},y&&!d?v:null,d&&!!y,x,_,d,D):null,L=!1,O=!1,k=!0;if(R&&!E.occluded){let i=.5*f*A+m,a=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new tm,{first:s,last:l}=R,h=s.path.length,d=[];for(let e=h-1;e>=1;e--)d.push(s.path[e]);for(let e=1;e<l.path.length;e++)d.push(l.path[e]);let _=2.5*i;u&&(d=d.map(([e,i,r],a)=>(v&&!M&&(r=v(a<h-1?s.tilePath[h-1-a]:l.tilePath[a-h+2])[2]),tb(e,i,r,u)))).some(e=>e[3]<=0)&&(d=[]);let y=[];if(d.length>0){let i=1/0,r=-1/0,o=1/0,s=-1/0;for(let e of d)i=Math.min(i,e[0]),o=Math.min(o,e[1]),r=Math.max(r,e[0]),s=Math.max(s,e[1]);r>=a.x&&i<=n.x&&s>=a.y&&o<=n.y&&(y=[d.map(i=>new e.P(i[0],i[1]))],(i<a.x||r>n.x||o<a.y||s>n.y)&&(y=e.bu(y,a.x,a.y,n.x,n.y)))}for(let e of y){o.reset(e,.25*i);let a=0;a=o.length<=.5*i?1:Math.ceil(o.paddedLength/_)+1;for(let e=0;e<a;e++){let n=e/Math.max(a-1,1),s=o.lerp(n),l=s.x+100,h=s.y+100;g.push(l,h,i,0);let u=l-i,d=h-i,f=l+i,m=h+i;if(k=k&&this.isOffscreen(u,d,f,m),O=O||this.isInsideGrid(u,d,f,m),!r&&this.grid.hitTestCircle(l,h,i,p)&&(L=!0,!c))return{circles:[],offscreen:!1,collisionDetected:L,occluded:!1}}}}return{circles:(c||!L)&&O?g:[],offscreen:k,collisionDetected:L,occluded:E.occluded}}queryRenderedSymbols(i){if(0===i.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let r=[],a=1/0,n=1/0,o=-1/0,s=-1/0;for(let l of i){let i=new e.P(l.x+100,l.y+100);a=Math.min(a,i.x),n=Math.min(n,i.y),o=Math.max(o,i.x),s=Math.max(s,i.y),r.push(i)}let l=this.grid.query(a,n,o,s).concat(this.ignoredGrid.query(a,n,o,s)),h={},u={};for(let i of l){let a=i.key;if(void 0===h[a.bucketInstanceId]&&(h[a.bucketInstanceId]={}),h[a.bucketInstanceId][a.featureIndex])continue;let n=[new e.P(i.x1,i.y1),new e.P(i.x2,i.y1),new e.P(i.x2,i.y2),new e.P(i.x1,i.y2)];
8e.bv(r,n)&&(h[a.bucketInstanceId][a.featureIndex]=!0,void 0===u[a.bucketInstanceId]&&(u[a.bucketInstanceId]=[]),u[a.bucketInstanceId].push(a.featureIndex))}return u}insertCollisionBox(e,i,r,a,n){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:a,collisionGroupID:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,r,a,n){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:a,collisionGroupID:n};for(let i=0;i<e.length;i+=4)o.insertCircle(s,e[i],e[i+1],e[i+2])}projectAndGetPerspectiveRatio(i,r,a,n,o,s,l){let h=[r,a,n,1],u=!1;if(n||this.transform.pitch>0){if(e.ad.vec4.transformMat4(h,h,i),this.fogState&&o&&"globe"!==l.name){var c,d,p;let i,s;c=this.fogState,d=o.toUnwrapped(),i=(p=this.transform).calculateFogTileMatrix(d),s=[r,a,n],e.ad.vec3.transformMat4(s,s,i),u=ez(c,e.ad.vec3.length(s),p.pitch,p._fov)>.9}}else tz(h,h,i);let f=h[3];return{point:new e.P((h[0]/f+1)/2*this.transform.width+100,(-h[1]/f+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(l)/f*.5,1.5),signedDistanceFromCamera:f,occluded:s&&h[2]>f||u}}isOffscreen(e,i,r,a){return r<100||e>=this.screenRightBoundary||a<100||i>this.screenBottomBoundary}isInsideGrid(e,i,r,a){return r>=0&&e<this.gridRightBoundary&&a>=0&&i<this.gridBottomBoundary}getViewportMatrix(){let i=e.ad.mat4.identity([]);return e.ad.mat4.translate(i,i,[-100,-100,0]),i}}function tR(i,r,a){let n=r.createTileMatrix(i,i.worldSize,a.toUnwrapped());return e.ad.mat4.multiply(new Float32Array(16),i.projMatrix,n)}function tL(e,i,r){return i.name===r.projection.name?e.projMatrix:tR(r,i,e)}class tO{constructor(e,i,r,a){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):a&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class tk{constructor(e,i,r,a,n,o=!1){this.text=new tO(e?e.text:null,i,r,n),this.icon=new tO(e?e.icon:null,i,a,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class tF{constructor(e,i,r,a=!1){this.text=e,this.icon=i,this.skipFade=r,this.clipped=a}}class tB{constructor(){this.invProjMatrix=e.ad.mat4.create(),this.viewportMatrix=e.ad.mat4.create(),this.circles=[]}}class tN{constructor(e,i,r,a,n){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=n}}class tV{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:e=>e.collisionGroupID===i}}return this.collisionGroups[e]}}function tU(i,r,a,n,o){let{horizontalAlign:s,verticalAlign:l}=e.bD(i),h=e.bC(i,n);return new e.P(-(s-.5)*r+h[0]*o,-(l-.5)*a+h[1]*o)}function tj(i,r,a,n,o){let s=new e.P(i,r);return a&&s._rotate(n?o:-o),s}class tG{constructor(e,i,r,a,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new tD(this.transform,n),this.buildingIndex=o,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new tV(r),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,r,a,n,o=1){var s,l,h;let u=a.getBucket(r),c=a.latestFeatureIndex;if(!u||!c||r.fqid!==u.layerIds[0])return;let d=u.layers[0].layout,p=u.layers[0].paint,f=a.collisionBoxArray,m=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),_=a.tileSize/e.ai,g=a.tileID.toUnwrapped();this.transform.setProjection(u.projection);let y=(s=a.tileID,l=u.getProjection(),h=this.transform,l.name===this.projection?h.calculateProjMatrix(s.toUnwrapped()):tR(h,l,s)),x="map"===d.get("text-pitch-alignment"),v="map"===d.get("text-rotation-alignment");r.compileFilter(r.options);let b=r.dynamicFilter(),w=r.dynamicFilterNeedsFeature(),T=this.transform.calculatePixelsToTileUnitsMatrix(a),S=tx(y,a.tileID.canonical,x,v,this.transform,u.getProjection(),T),M=null;if(x){let i=tv(y,a.tileID.canonical,x,v,this.transform,u.getProjection(),T);
8M=e.ad.mat4.multiply([],this.transform.labelPlaneMatrix,i)}let E=null;b&&a.latestFeatureIndex&&(E={unwrappedTileID:g,dynamicFilter:b,dynamicFilterNeedsFeature:w}),this.retainedQueryData[u.bucketInstanceId]=new tN(u.bucketInstanceId,c,u.sourceLayerIndex,u.index,a.tileID);let[A,I]=u.layers[0].layout.get("text-size-scale-range"),C=e.ay(o,A,I),[P,z]=d.get("icon-size-scale-range"),D=e.ay(o,P,z),R={bucket:u,layout:d,paint:p,posMatrix:y,textLabelPlaneMatrix:S,labelToScreenMatrix:M,clippingData:E,scale:m,textPixelRatio:_,holdingForFade:a.holdingForFade(),collisionBoxArray:f,partiallyEvaluatedTextSize:e.bp(u.textSizeData,this.transform.zoom,C),partiallyEvaluatedIconSize:e.bp(u.iconSizeData,this.transform.zoom,D),collisionGroup:this.collisionGroups.get(u.sourceID),latestFeatureIndex:a.latestFeatureIndex};if(n)for(let e of u.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n}=e;i.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n,parameters:R})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:R})}attemptAnchorPlacement(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let{textOffset0:x,textOffset1:v,crossTileID:b}=d,w=[x,v],T=tU(e,r,a,w,n),S=this.collisionIndex.placeCollisionBox(f,n,i,tj(T.x,T.y,o,s,this.transform.angle),c,l,h,u.predicate);if(_){let e=f.getSymbolInstanceIconSize(y,this.transform.zoom,d.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(f,e,_,tj(T.x,T.y,o,s,this.transform.angle),c,l,h,u.predicate).box.length)return}if(S.box.length>0){let i;return this.prevPlacement&&this.prevPlacement.variableOffsets[b]&&this.prevPlacement.placements[b]&&this.prevPlacement.placements[b].text&&(i=this.prevPlacement.variableOffsets[b].anchor),this.variableOffsets[b]={textOffset:w,width:r,height:a,anchor:e,textScale:n,prevAnchor:i},this.markUsedJustification(f,e,d,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,d),this.placedOrientations[b]=m),{shift:T,placedGlyphBoxes:S}}}placeLayerBucketPart(i,r,a,n,o=1){let{bucket:s,layout:l,paint:h,posMatrix:u,textLabelPlaneMatrix:c,labelToScreenMatrix:d,clippingData:p,textPixelRatio:f,holdingForFade:m,collisionBoxArray:_,partiallyEvaluatedTextSize:g,partiallyEvaluatedIconSize:y,collisionGroup:x,latestFeatureIndex:v}=i.parameters,b=l.get("text-optional"),w=l.get("icon-optional"),T=l.get("text-allow-overlap"),S=l.get("icon-allow-overlap"),M="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),A=h.get("symbol-z-offset"),I="sea"===l.get("symbol-elevation-reference"),[C,P]=l.get("text-size-scale-range"),[z,D]=l.get("icon-size-scale-range"),R=e.ay(o,C,P),L=e.ay(o,z,D);this.transform.setProjection(s.projection);let O=T&&(S||!s.hasIconData()||w),k=S&&(T||!s.hasTextData()||b),F=!A.isConstant();!s.collisionArrays&&_&&s.deserializeCollisionBoxes(_),a&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,_,R,L);let B=(i,n,h)=>{let{crossTileID:_,numVerticalGlyphVertices:C}=i,P=null;if(p&&p.dynamicFilterNeedsFeature||F){let e=this.retainedQueryData[s.bucketInstanceId];P=v.loadFeature({featureIndex:i.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.s
8ourceLayerIndex,layoutVertexArrayOffset:0})}if(p&&!(0,p.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},P,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.P(i.tileAnchorX,i.tileAnchorY),this.transform.calculateDistanceTileData(p.unwrappedTileID)))return this.placements[_]=new tF(!1,!1,!1,!0),void r.add(_);let z=A.evaluate(P,{});if(r.has(_))return;if(m)return void(this.placements[_]=new tF(!1,!1,!1));let D=!1,R=!1,L=!0,B=!1,N=!1,V=null,U={box:null,offscreen:null,occluded:null},j={box:null,offscreen:null,occluded:null},G=null,q=null,Z=null,H=0,$=0,W=0;h.textFeatureIndex?H=h.textFeatureIndex:i.useRuntimeCollisionCircles&&(H=i.featureIndex),h.verticalTextFeatureIndex&&($=h.verticalTextFeatureIndex);let X=e=>{e.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;let r=this.transform.elevation;e.elevation=I?z:z+(r?r.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0),e.elevation+=i.zOffset},Y=h.textBox;if(Y){X(Y);let r=r=>{let a=e.bq.horizontal;if(s.allowVerticalPlacement&&!r&&this.prevPlacement){let e=this.prevPlacement.placedOrientations[_];e&&(this.placedOrientations[_]=e,a=e,this.markUsedOrientation(s,a,i))}return a},a=(i,r)=>{if(s.allowVerticalPlacement&&C>0&&h.verticalTextBox){for(let a of s.writingModes)if(a===e.bq.vertical?j=U=r():U=i(),U&&U.box&&U.box.length)break}else U=i()};if(l.get("text-variable-anchor")){let o=l.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[_]){let e=this.prevPlacement.variableOffsets[_];o.indexOf(e.anchor)>0&&(o=o.filter(i=>i!==e.anchor)).unshift(e.anchor)}let c=(e,r,a)=>{let l=s.getSymbolInstanceTextSize(g,i,this.transform.zoom,n),h=(e.x2-e.x1)*l+2*e.padding,c=(e.y2-e.y1)*l+2*e.padding,d=i.hasIconTextFit&&!S?r:null;d&&X(d);let p={box:[],offscreen:!1,occluded:!1},m=T?2*o.length:o.length;for(let r=0;r<m;++r){let m=this.attemptAnchorPlacement(o[r%o.length],e,h,c,l,M,E,f,u,x,r>=o.length,i,n,s,a,d,g,y);if(m&&(p=m.placedGlyphBoxes)&&p.box&&p.box.length){D=!0,V=m.shift;break}}return p};a(()=>c(Y,h.iconBox,e.bq.horizontal),()=>{let i=h.verticalTextBox;return i&&X(i),s.allowVerticalPlacement&&!(U&&U.box&&U.box.length)&&C>0&&i?c(i,h.verticalIconBox,e.bq.vertical):{box:null,offscreen:null,occluded:null}}),U&&(D=U.box,L=U.offscreen,B=U.occluded);let d=r(!(!U||!U.box));if(!D&&this.prevPlacement){let e=this.prevPlacement.variableOffsets[_];e&&(this.variableOffsets[_]=e,this.markUsedJustification(s,e.anchor,i,d))}}else{let l=(r,a)=>{let l=s.getSymbolInstanceTextSize(g,i,this.transform.zoom,n,o),h=this.collisionIndex.placeCollisionBox(s,l,r,new e.P(0,0),T,f,u,x.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(s,a,i),this.placedOrientations[_]=a),h};a(()=>l(Y,e.bq.horizontal),()=>{let i=h.verticalTextBox;return s.allowVerticalPlacement&&C>0&&i?(X(i),l(i,e.bq.vertical)):{box:null,offscreen:null,occluded:null}}),r(!!(U&&U.box&&U.box.length))}}if(D=(G=U)&&G.box&&G.box.length>0,L=G&&G.offscreen,B=G&&G.occluded,i.useRuntimeCollisionCircles){let r=s.text.placedSymbolArray.get(i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex),n=e.br(s.textSizeData,g,r),o=l.get("text-padding");q=this.collisionIndex.placeCollisionCircles(s,T,r,s.lineVertexArray,s.glyphOffsetArray,n,u,c,d,a,E,x.predicate,i.collisionCircleDiameter*n/e.bw,o,this.retainedQueryData[s.bucketInstanceId].tileID),D=T||q.circles.length>0&&!q.collisionDetected,L=L&&q.offscreen,B=q.occluded}if(h.iconFeatureIndex&&(W=h.iconFeatureIndex),h.iconBox){let r=r=>{X(r);let a=i.hasIconTextFit&&V?tj(V.x,V.y,M,E,this.transform.angle):new e.P(0,0),n=s.getSymbolInstanceIconSize(y,this.transform.zoom,i.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,n,r,a,S,f,u,x.predicate)};R=j&&j.box&&j.box.length&&h.verticalIconBox?(Z=r(h.verticalIconBox)).box.length>0:(Z=r(h.iconBox)).box.length>0,L=L&&Z.offscreen,N=Z.occluded}let K=b||0===i.numHorizontalGlyphVertices&&0===C,J=w||0===i.numIconVertices;if(K||J?J?K||(R=R&&D):D=R&&D:R=D=R&&D,D&&G&&G.box&&this.collisionIndex.insertCollisionBox(G.box,l.get("text-ignore-placement"),s.bucketInstanceId,j&&j.box&&$?$:H,x.ID),R&&Z&&this.collisionIndex.insertCollisionBox(Z.box,l.get("icon-ignore-placement"),s.bucketInstanceId,W,x.ID),q&&(D&&this.collisionIndex.insertCollisionCircles(q.circles,l.get("text-ignore-placement"),s.bucketInstanceId,H,x.ID),a)){let e=s.bucketInstanceId,i=this.collisionCircleArrays[e];void 0===i&&(i=this.collisionCircleArrays[e]=new tB);for(let e=0;e<q.circles.length;e+=4)i.circles.push(q.circles[e+0]),i.circles.push(q.circles[e+1]),i.circles.push(q.circles[e+2]),i.circles.push(+!!q.collisionDetected)}let Q="globe"!==s.projection.name;O=O&&(Q||!B),k=k&&(Q||!N),this.placements[_]=new tF(D||O,R||k,L||s.justReloaded),r.add(_)};if("offset"===s.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(s,this.retainedQueryData[s.bucketInstanceId].tileID),"road"===s.elevationType&&s.updateRoadElevation(),s.updateZOffset(),s.sortFeaturesByY){let i=s.getSortedSymbolIndexe
8s(this.transform.angle);for(let e=i.length-1;e>=0;--e){let r=i[e];B(s.symbolInstances.get(r),r,s.collisionArrays[r])}s.hasAnyZOffset&&e.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 e=s.getSortedIndexesByZOffset();for(let i=0;i<e.length;++i){let r=e[i];B(s.symbolInstances.get(r),r,s.collisionArrays[r])}}else for(let e=i.symbolInstanceStart;e<i.symbolInstanceEnd;e++)B(s.symbolInstances.get(e),e,s.collisionArrays[e]);if(a&&s.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[s.bucketInstanceId];e.ad.mat4.invert(i.invProjMatrix,u),i.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}markUsedJustification(i,r,a,n){let{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:h,crossTileID:u}=a,c=e.bB(r),d=n===e.bq.vertical?h:"left"===c?o:"center"===c?s:"right"===c?l:-1;o>=0&&(i.text.placedSymbolArray.get(o).crossTileID=d>=0&&o!==d?0:u),s>=0&&(i.text.placedSymbolArray.get(s).crossTileID=d>=0&&s!==d?0:u),l>=0&&(i.text.placedSymbolArray.get(l).crossTileID=d>=0&&l!==d?0:u),h>=0&&(i.text.placedSymbolArray.get(h).crossTileID=d>=0&&h!==d?0:u)}markUsedOrientation(i,r,a){let n=r===e.bq.horizontal||r===e.bq.horizontalOnly?r:0,o=r===e.bq.vertical?r:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u}=a,c=i.text.placedSymbolArray;s>=0&&(c.get(s).placedOrientation=n),l>=0&&(c.get(l).placedOrientation=n),h>=0&&(c.get(h).placedOrientation=n),u>=0&&(c.get(u).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let i=this.prevPlacement,r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;let a=i?i.symbolFadeChange(e):1,n=i?i.opacities:{},o=i?i.variableOffsets:{},s=i?i.placedOrientations:{};for(let e in this.placements){let i=this.placements[e],o=n[e];o?(this.opacities[e]=new tk(o,a,i.text,i.icon,null,i.clipped),r=r||i.text!==o.text.placed||i.icon!==o.icon.placed):(this.opacities[e]=new tk(null,a,i.text,i.icon,i.skipFade,i.clipped),r=r||i.text||i.icon)}for(let e in n){let i=n[e];if(!this.opacities[e]){let n=new tk(i,a,!1,!1);n.isHidden()||(this.opacities[e]=n,r=r||i.text.placed||i.icon.placed)}}for(let e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(let e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i,r,a){let n=new Set;for(let o of i){let i=o.getBucket(e);i&&o.latestFeatureIndex&&e.fqid===i.layerIds[0]&&(this.updateBucketOpacities(i,n,o,o.collisionBoxArray,r,a,o.tileID,e.scope),"offset"===i.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(i,o.tileID),"road"===i.elevationType&&i.updateRoadElevation(),i.updateZOffset())}}updateBucketOpacities(i,r,a,n,o,s,l,h){i.hasTextData()&&i.text.opacityVertexArray.clear(),i.hasIconData()&&i.icon.opacityVertexArray.clear(),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();let u=i.layers[0].layout,c=i.layers[0].paint,d=!!i.layers[0].dynamicFilter(),p=new tk(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),m=u.get("icon-allow-overlap"),_=u.get("text-variable-anchor"),g="map"===u.get("text-rotation-alignment"),y="map"===u.get("text-pitch-alignment"),x=c.get("symbol-z-offset"),v="sea"===u.get("symbol-elevation-reference"),b=!x.isConstant(),w=new tk(null,0,f&&(m||!i.hasIconData()||u.get("icon-optional")),m&&(f||!i.hasTextData()||u.get("text-optional")),!0);!i.collisionArrays&&n&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(n);let T=(e,i,r)=>{for(let a=0;a<i/4;a++)e.opacityVertexArray.emplaceBack(r)},S=0;s&&i.updateReplacement(l,s);for(let n=0;n<i.symbolInstances.length;n++){let u=i.symbolInstances.get(n),{numHorizontalGlyphVertices:c,numVerticalGlyphVertices:f,crossTileID:m,numIconVertices:M,tileAnchorX:E,tileAnchorY:A}=u,I=null,C=this.retainedQueryData[i.bucketInstanceId];b&&u&&C&&(I=a.latestFeatureIndex.loadFeature({featureIndex:u.featureIndex,bucketIndex:C.bucketIndex,sourceLayerIndex:C.sourceLayerIndex,layoutVertexArrayOffset:0}));let P=x.evaluate(I,{}),z=r.has(m),D=this.opacities[m];z?D=p:D||(D=w,this.opacities[m]=D),r.add(m);let R=c>0||f>0,L=M>0,O=this.placedOrientations[m],k=O===e.bq.vertical,F=O===e.bq.horizontal||O===e.bq.horizontalOnly;!R&&!L||D.isHidden()||S++;let B=!1;if((R||L)&&s)for(let r of i.activeReplacements){if(e.bx(r,o,e.by.Symbol,h)||r.min.x>E||E>r.max.x||r.min.y>A||A>r.max.y)continue;let i=e.bz(E,A,l.canonical,r.footprintTileId.canonical);if(B=e.bA(i,r.footprint))break}if(R){let e=B?tH:tZ(D.text);T(i.text,c,k?tH:e),T(i.text,f,F?tH:e);let r=D.text.isHidden(),{leftJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:n,rightJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s}=u,l=i.text.placedSymbolArray,h=r||k?1:0;a>=0&&(l.get(a).hidden=h),n>=0&&(l.get(n).hidden=h),o>=0&&(l.get(o).hidden=h),s>=0&&(l.get(s).hidden=r||F?1:0);let d=this.variableOffsets[m];d&&this.markUsedJustification(i,d.anchor,u,O);let p=this.placedOrientations[m];p&&(this.markUsedJustification(i,"left",u,p),this.markUsedOrientation(i,p,u))}if(L){let e=B?tH:tZ(D.icon),{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=u,n=i.icon.placedSymbolArray,o=+!!D.icon.isHidden();r>=0&&(T(i.icon,M,k?tH:e),n.get(r).hidden=o),a>=0&&(T(i.icon,u.numVerticalIconVertices,F?tH:e),n.get(a).hidden=o)}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){let r=i.collisionArrays[n];if(r){let a=new e.P(0,0),n=!0;if(r.textBox||r.verticalTextBox){if(_){let e=this.variableOffsets[m];e?(a=tU(e.anchor,e.width,e.height,e.textOffset,e.textScale),g&&a._rotate(y?this.transform.angle:-this.transform.angle)):n=!1}d&&(n=!D.clipped),r.textBox&&tq(i.textCollisionBox.collisionVertexArray,D.text.placed,!n||k,P,v,a.x,a.y),r.verticalTextBox&&tq(i.textCollisionBox.collisionVertexArray,D.text.placed,!n||F,P,v,a.x,a.y)}let o=n&&!!(!F&&r.verticalIconBox);r.iconBox&&tq(i.iconCollisionBox.collisionVertexArray,D.icon.placed,o,P,v,u.hasIconTextFit?a.x:0,u.hasIconTextFit?a.y:0),r.verticalIconBox&&tq(i.iconCollisionBox.collisionVertexArray,D.icon.placed,!o,P,v,u.hasIconTextFit?a.x:0,u.hasIconTextFit?a.y:0)}}}if(i.fullyClipped=0===S,i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.o
8pacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=e.invProjMatrix,i.placementViewportMatrix=e.viewportMatrix,i.collisionCircleArray=e.circles,delete this.collisionCircleArrays[i.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){let r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}}function tq(e,i,r,a,n,o,s){e.emplaceBack(+!!i,+!!r,o||0,s||0,a,+!!n),e.emplaceBack(+!!i,+!!r,o||0,s||0,a,+!!n),e.emplaceBack(+!!i,+!!r,o||0,s||0,a,+!!n),e.emplaceBack(+!!i,+!!r,o||0,s||0,a,+!!n)}function tZ(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 0xffffffff;let i=+!!e.placed,r=Math.floor(127*e.opacity);return 0x2000000*r+0x1000000*i+131072*r+65536*i+512*r+256*i+2*r+i}let tH=0;class t${constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,i,r,a,n,o){let s=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(s,a,e[this._currentTileIndex],this._sortAcrossTiles,o),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((e,i)=>e.sortKey-i.sortKey));this._currentPartIndex<s.length;){let e=s[this._currentPartIndex];if(i.placeLayerBucketPart(e,this._seenCrossTileIDs,r,0===e.symbolInstanceStart,o),this._currentPartIndex++,n())return!0}return!1}}class tW{constructor(e,i,r,a,n,o,s,l,h){this.placement=new tG(e,n,o,s,l,h),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(i,r,a,n,o){let s=e.q.now(),l=()=>{let i=e.q.now()-s;return!this._forceFullPlacement&&i>2};for(;this._currentPlacementIndex>=0;){let s=r[i[this._currentPlacementIndex]],h=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=h)&&(!s.maxzoom||s.maxzoom>h)){let i=s.layout.get("symbol-z-elevate"),r=void 0!==s.layout.get("symbol-sort-key").constantOr(1),h=s.layout.get("symbol-z-order"),u="viewport-y"===h||"auto"===h&&!("viewport-y"!==h&&r),c=s.layout.get("text-allow-overlap")||s.layout.get("icon-allow-overlap")||s.layout.get("text-ignore-placement")||s.layout.get("icon-ignore-placement"),d=u&&c,p=this._inProgressLayer=this._inProgressLayer||new t$(s),f=e.C(s.source,s.scope);if(p.continuePlacement(i||d?n[f]:a[f],this.placement,this._showCollisionBoxes,s,l,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let tX=512/e.ai/2;class tY{constructor(i,r,a){this.tileID=i,this.bucketInstanceId=a,this.index=new e.bE(r.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const n=i.canonical.x*e.ai,o=i.canonical.y*e.ai;for(let e=0;e<r.length;e++){const{key:i,crossTileID:a,tileAnchorX:s,tileAnchorY:l}=r.get(e),h=Math.floor((n+s)*tX),u=Math.floor((o+l)*tX);this.index.add(h,u),this.keys.push(i),this.crossTileIDs.push(a)}this.index.finish()}findMatches(i,r,a){let n=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z),o=tX/Math.pow(2,r.canonical.z-this.tileID.canonical.z),s=r.canonical.x*e.ai,l=r.canonical.y*e.ai;for(let e=0;e<i.length;e++){let r=i.get(e);if(r.crossTileID)continue;let{key:h,tileAnchorX:u,tileAnchorY:c}=r,d=Math.floor((s+u)*o),p=Math.floor((l+c)*o);for(let e of this.index.range(d-n,p-n,d+n,p+n)){let i=this.crossTileIDs[e];if(this.keys[e]===h&&!a.has(i)){a.add(i),r.crossTileID=i;break}}}}}class tK{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class tJ{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let i=Math.round((e-this.lng)/360);if(0!==i)for(let e in this.indexes){let r=this.indexes[e],a={};for(let e in r){let n=r[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+i),a[n.tileID.key]=n}this.indexes[e]=a}this.lng=e}addBucket(e,i,r){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if
8(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<i.symbolInstances.length;e++)i.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);let a=this.usedCrossTileIDs[e.overscaledZ];for(let r in this.indexes){let n=this.indexes[r];if(Number(r)>e.overscaledZ)for(let r in n){let o=n[r];o.tileID.isChildOf(e)&&o.findMatches(i.symbolInstances,e,a)}else{let o=n[e.scaledTo(Number(r)).key];o&&o.findMatches(i.symbolInstances,e,a)}}for(let e=0;e<i.symbolInstances.length;e++){let n=i.symbolInstances.get(e);n.crossTileID||(n.crossTileID=r.generate(),a.add(n.crossTileID))}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new tY(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(let r of i.crossTileIDs)this.usedCrossTileIDs[e].delete(r)}removeStaleBuckets(e){let i=!1;for(let r in this.indexes){let a=this.indexes[r];for(let n in a)e[a[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,a[n]),delete a[n],i=!0)}return i}}class tQ{constructor(){this.layerIndexes={},this.crossTileIDs=new tK,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,r,a){let n=this.layerIndexes[e.fqid];void 0===n&&(n=this.layerIndexes[e.fqid]=new tJ);let o=!1,s={};for(let l of("globe"!==a.name&&n.handleWrapJump(r),i)){let i=l.getBucket(e);i&&e.fqid===i.layerIds[0]&&(i.bucketInstanceId||(i.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(l.tileID,i,this.crossTileIDs)&&(o=!0),s[i.bucketInstanceId]=!0)}return n.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(e){let i={};for(let r in e.forEach(e=>{i[e]=!0}),this.layerIndexes)i[r]||delete this.layerIndexes[r]}}class t0{constructor(e,i,r,a){this.blendFunction=e,this.blendColor=i,this.mask=r,this.blendEquation=a}}t0.Replace=[1,0,1,0],t0.disabled=new t0(t0.Replace,e.al.transparent,[!1,!1,!1,!1]),t0.unblended=new t0(t0.Replace,e.al.transparent,[!0,!0,!0,!0]),t0.alphaBlended=new t0([1,771,1,771],e.al.transparent,[!0,!0,!0,!0]),t0.alphaBlendedNonPremultiplied=new t0([770,771,770,771],e.al.transparent,[!0,!0,!0,!0]),t0.multiply=new t0([774,0,774,0],e.al.transparent,[!0,!0,!0,!0]);class t1{constructor(e,i,r){this.func=e,this.mask=i,this.range=r}}t1.ReadOnly=!1,t1.ReadWrite=!0,t1.disabled=new t1(519,t1.ReadOnly,[0,1]);class t2{constructor(e,i,r,a,n,o){this.test=e,this.ref=i,this.mask=r,this.fail=a,this.depthFail=n,this.pass=o}}t2.disabled=new t2({func:519,mask:0},0,0,7680,7680,7680);class t3{constructor(e,i,r){this.enable=e,this.mode=i,this.frontFace=r}}function t4(i,r){let a=e.bG(i,3);e.ad.mat4.fromQuat(i,r),e.bI(i,3,a)}function t5(i,r){let a=e.ad.quat.identity([]);return e.ad.quat.rotateZ(a,a,-r),e.ad.quat.rotateX(a,a,-i),a}function t6(i,r){let a=[i[0],i[1],0],n=[r[0],r[1],0];if(e.ad.vec3.length(a)>=1e-15){let i=e.ad.vec3.normalize([],a);e.ad.vec3.scale(n,i,e.ad.vec3.dot(n,i)),r[0]=n[0],r[1]=n[1]}let o=e.ad.vec3.cross([],r,i);if(1e-15>e.ad.vec3.len(o))return null;let s=Math.atan2(-o[1],o[0]);return t5(Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2]),s)}t3.disabled=new t3(!1,1029,2305),t3.backCCW=new t3(!0,1029,2305),t3.backCW=new t3(!0,1029,2304),t3.frontCW=new t3(!0,1028,2304),t3.frontCCW=new t3(!0,1028,2305);class t8{constructor(e,i){this.position=e,this.orientation=i}get position(){return this._position}set position(i){if(i){let r=i instanceof e.ac?i:new e.ac(i[0],i[1],i[2]);
8this._renderWorldCopies&&(r.x=e.bF(r.x,0,1)),this._position=r}else this._position=null}lookAtPoint(i,r){if(this.orientation=null,!this.position)return;let a=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.ac.fromLngLat(i)):0,o=e.ac.fromLngLat(i,n),s=[o.x-a.x,o.y-a.y,o.z-a.z];r||(r=[0,0,1]),r[2]=Math.abs(r[2]),this.orientation=t6(s,r)}setPitchBearing(i,r){this.orientation=t5(e.ak(i),e.ak(-r))}}class t9{constructor(i,r){this._transform=e.ad.mat4.identity([]),this.orientation=r,this.position=i}get mercatorPosition(){let i=this.position;return new e.ac(i[0],i[1],i[2])}get position(){let i=e.bG(this._transform,3);return[i[0],i[1],i[2]]}set position(i){i&&e.bI(this._transform,3,[i[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(i){this._orientation=i||e.ad.quat.identity([]),i&&t4(this._transform,this._orientation)}getPitchBearing(){let e=this.forward(),i=this.right();return{bearing:Math.atan2(-i[1],i[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,i){this._orientation=t5(e,i),t4(this._transform,this._orientation)}forward(){let i=e.bG(this._transform,2);return[-i[0],-i[1],-i[2]]}up(){let i=e.bG(this._transform,1);return[-i[0],-i[1],-i[2]]}right(){let i=e.bG(this._transform,0);return[i[0],i[1],i[2]]}getCameraToWorld(i,r){let a=new Float64Array(16);return e.ad.mat4.invert(a,this.getWorldToCamera(i,r)),a}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(i,r,a){let n=this.position;e.ad.vec3.scale(n,n,-i);let o=new Float64Array(16);return e.ad.mat4.fromScaling(o,[a,a,a]),e.ad.mat4.translate(o,o,n),o[10]*=r,o}getWorldToCamera(i,r){let a=new Float64Array(16),n=new Float64Array(4),o=this.position;return e.ad.quat.conjugate(n,this._orientation),e.ad.vec3.scale(o,o,-i),e.ad.mat4.fromQuat(a,n),e.ad.mat4.translate(a,a,o),a[1]*=-1,a[5]*=-1,a[9]*=-1,a[13]*=-1,a[8]*=r,a[9]*=r,a[10]*=r,a[11]*=r,a}getCameraToClipPerspective(i,r,a,n){let o=new Float64Array(16);return e.ad.mat4.perspective(o,i,r,a,n),o}getCameraToClipOrthographic(i,r,a,n,o,s){let l=new Float64Array(16);return e.ad.mat4.ortho(l,i,r,a,n,o,s),l}getDistanceToElevation(i,r=!1){let a=0===i?0:e.bH(i,r?e.aT(this.position[1]):this.position[1]),n=this.forward();return(a-this.position[2])/n[2]}clone(){return new t9([...this.position],[...this.orientation])}}class t7{constructor(e=0,i=0,r=0,a=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=r,this.right=a}interpolate(i,r,a){return null!=r.top&&null!=i.top&&(this.top=e.ah(i.top,r.top,a)),null!=r.bottom&&null!=i.bottom&&(this.bottom=e.ah(i.bottom,r.bottom,a)),null!=r.left&&null!=i.left&&(this.left=e.ah(i.left,r.left,a)),null!=r.right&&null!=i.right&&(this.right=e.ah(i.right,r.right,a)),this}getCenter(i,r){let a=e.ay((this.left+i-this.right)/2,0,i),n=e.ay((this.top+r-this.bottom)/2,0,r);return new e.P(a,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new t7(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ie{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 e.bO(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new t7,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new t9,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){let e=new ie(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForE
8xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e._allowWorldUnderZoom=this._allowWorldUnderZoom,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(e,i=!1){let r=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
8xaggeration;(null==this._seaLevelZoom||r)&&this._updateCameraOnTerrain(),(e||r)&&this._constrainCamera(i),this._calcMatrices()}getProjection(){return e.aA(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};let r=this.projection?this.getProjection():void 0;this.projection=e.bP(this.projectionOptions);let a=this.getProjection(),n=!e.bn(r,a);return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){let i=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.bP({name:"mercator"});let r=i!==this.projection.name;return r&&this._calcMatrices(),r}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){let e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){let e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.bH(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return e.bF(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(i){let r=-i*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=e.ad.mat2.create(),e.ad.mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){let r=e.ay(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=e.ak(i),this._calcMatrices())}get fovX(){return this._fov}get fovY(){let e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){let i=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==i&&(this._unmodified=!1,this._setZoom(i),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){let e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),-1/0):-1/0,i=this.elevation&&e===-1/0&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===-1/0&&(!i||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);let r=this._elevation;i||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&r.exaggeration()&&this._centerAltitudeValidForExaggeration!==r.exaggeration()?this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*r.exaggeration():this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=r.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}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 e.P(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(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let e=this._seaLevelZoom,i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),r=this.pixelsPerMeter/this.worldSize*i,a=Math.max(this._mercatorZfromZoom(e)-r,this._mercatorZfromZoom(this._maxZoom));this._setZoom(this._zoomFromMercatorZ(a))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}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=e.ad.vec3.length(e.ad.vec3.sub([],this._camera.position,r));return e.ay(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(i){if(!this.height||!i.position&&!i.orientation)return;this._updateCameraState();let r=!1;if(i.orientation&&!e.ad.quat.exactEquals(i.orientation,this._camera.orientation)&&(r=this._setCameraOrientation(i.orientation)),i.position){let a=[i.position.x,i.position.y,i.position.z];e.ad.vec3.exactEquals(a,this._camera.position)||(this._setCameraPosition(a),r=!0)}r&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let i=this._camera.position,r=new t8;return r.position=new e.ac(i[0],i[1],i[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(i){if(!e.ad.quat.length(i))return!1;e.ad.quat.normalize(i,i);let r=e.ad.vec3.transformQuat([],[0,0,-1],i),a=e.ad.vec3.transformQuat([],[0,-1,0],i);if(a[2]<0)return!1;let n=t6(r,a);return!!n&&(this._camera.orientation=n,!0)}_setCameraPosition(i){let r=this.zoomScale(this.minZoom)*this.tileSize,a=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;i[2]=e.ay(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(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,r){this._unmodified=!1,this._edgeInsets.interpolate(e,i,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){return Math.max(0,(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize)))}getVisibleUnwrappedCoordinates(i){let r=[new e.bQ(0,i)];if(this.renderWorldCopies){let a=this.pointCoordinate(new e.P(0,0)),n=this.pointCoordinate(new e.P(this.width,0)),o=this.pointCoordinate(new e.P(this.width,this.height)),s=this.pointCoordinate(new e.P(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 e.bQ(a,i))}return r}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(i,r,a){let n=[],o=void 0!==a,s=!o;if(s&&this.zoom<r||o&&0===a[0]&&0===a[1])return n;let l=new Set,h=(i,r,a,o,s)=>{let h=e.c5(r,i,a,o,s);l.has(h)||(n.push(new e.aH(i,r,a,o,s)),l.add(h))};for(let e=0;e<i.length;e++){let n=i[e];if(s&&n.canonical.z!==r)continue;let l=n.canonical,u=n.overscaledZ,c=n.wrap,d=1<<l.z,p=l.x+1<d,f=l.x>0,m=l.y+1<d,_=l.y>0,g=n.wrap-!f,y=n.wrap+ +!p,x=f?l.x-1:d-1,v=p?l.x+1:0;if(o)a[0]<0?(h(u,y,l.z,v,l.y),a[1]<0&&m&&(h(u,c,l.z,l.x,l.y+1),h(u,y,l.z,v,l.y+1)),a[1]>0&&_&&(h(u,c,l.z,l.x,l.y-1),h(u,y,l.z,v,l.y-1))):a[0]>0?(h(u,g,l.z,x,l.y),a[1]<0&&m&&(h(u,c,l.z,l.x,l.y+1),h(u,g,l.z,x,l.y+1)),a[1]>0&&_&&(h(u,c,l.z,l.x,l.y-1),h(u,g,l.z,x,l.y-1))):a[1]<0&&m?h(u,c,l.z,l.x,l.y+1):_&&h(u,c,l.z,l.x,l.y-1);else{let e=n.visibleQuadrants;1&e&&(h(u,g,l.z,x,l.y),_&&(h(u,c,l.z,l.x,l.y-1),h(u,g,l.z,x,l.y-1))),2&e&&(h(u,y,l.z,v,l.y),_&&(h(u,c,l.z,l.x,l.y-1),h(u,y,l.z,v,l.y-1))),4&e&&(h(u,g,l.z,x,l.y),m&&(h(u,c,l.z,l.x,l.y+1),h(u,g,l.z,x,l.y+1))),8&e&&(h(u,y,l.z,v,l.y),m&&(h(u,c,l.z,l.x,l.y+1),h(u,y,l.z,v,l.y+1)))}}let u=[];for(let e of n)n.some(i=>e.isChildOf(i))||u.push(e);if(n=u.filter(e=>!i.some(i=>!!(e.overscaledZ<r&&i.isChildOf(e))||e.equals(i)||e.isChildOf(i))),s){let e=1<<r,i="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),a=[e*i.x,e*i.y];n=n.filter(e=>{let i=e.canonical.x+.5-a[0],r=e.canonical.y+.5-a[1];return i*i+r*r<16})}return n}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=e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,f),_=p?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),g=c*e.bH(1,this.center.lat),y=this._camera.position[2]/e.bH(1,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 e=this._elevation.getMinMaxForVisibleTiles();r=e?e.max:this._centerAltitude}else r=this._centerAltitude;let T=i.isTerrainDEM?-r:this._elevation?this._elevation.getMinElevationBelowMSL():0,S=this.projection.isReprojectedInTileSpace?e.bS(this):1,M=i=>{let r=1/4e4,a=new e.ac(i.x+r,i.y,i.z),n=new e.ac(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},E=i=>{let a=r;return{aabb:e.bV(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=[],I=[],C=a,P=i.reparseOverscaled?n:a,z=(y-this._centerAltitude)*g,D=e=>{if(!this._elevation||!e.tileID||!l)return;let i=this._elevation.getMinMaxForTile(e.tileID),r=e.aabb;i?(r.min[2]=i.min,r.max[2]=i.max,r.center[2]=(r.min[2]+r.max[2])/2):(e.shouldSplit=L(e),e.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=this._centerAltitude))},R=(e,i)=>{if(.707*i<e)return 1;let r=i/e;return r/(1.4144271570014144+(Math.pow(1.1,r-1.4144271570014144+1)-1)/(1.1-1)-1)},L=i=>{if(i.zoom<w)return!0;
8if(i.zoom===C)return!1;if(null!=i.shouldSplit)return i.shouldSplit;let r=i.aabb.distanceX(x),a=i.aabb.distanceY(x),o=z,h=1;if(p){o=i.aabb.distanceZ(x);let r=Math.pow(2,i.zoom),a=Math.min(Math.max(u,e.aT((i.y+1)/r)),e.aT(i.y/r)),n=e.ca(a)/e.ca(u);if(h=a===u?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,n/this._mercatorScaleRatio),this.zoom<=e.c6&&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=M(new e.ac((i.x+.5)/r,(i.y+.5)/r));h=a>.85?1:a}if(!l){let e=Math.sqrt(r*r+a*a+o*o),n=(1<<C-i.zoom)*b*h;return n*=R(Math.max(o,z),e),e<n}let c=Number.MAX_VALUE,f=0,m=i.aabb.getCorners(),_=[];for(let i of m){e.ad.vec3.sub(_,i,x),p||(s?_[2]*=g:_[2]=z);let r=e.ad.vec3.dot(_,this._camera.forward());r<c&&(c=r,f=Math.abs(_[2]))}let y=(1<<C-i.zoom)*b*h;if(y*=R(Math.max(f,z),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 e=1;e<=3;e++)A.push(E(-e)),A.push(E(e));for(A.push(E(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()){let a=new e.bT(r.zoom,n,o);i=e.bU(this,c,a,!0).intersects(m)}if(0===i)continue;h=2===i}if(r.zoom!==C&&L(r))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):e.bV(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 e.aH(r.zoom+1===C?P:r.zoom+1,r.wrap,r.zoom+1,a,u),D(d)),A.push(d)}else{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()){let i=new e.bT(r.zoom,n,o);a=e.bU(this,c,i,!0).intersectsPrecise(m)}if(0===a)continue;if(i.calculateQuadrantVisibility)if(m.containsPoint(r.aabb.center))l=15;else for(let e=0;e<4;e++)0!==r.aabb.quadrant(e).intersects(m)&&(l|=1<<e)}let p=d[0]-(.5+n+(r.wrap<<r.zoom))*(1<<a-r.zoom),f=d[1]-.5-o,_=r.tileID?r.tileID:new e.aH(s,r.wrap,r.zoom,n,o);i.calculateQuadrantVisibility&&(_.visibleQuadrants=l),I.push({tileID:_,distanceSq:p*p+f*f})}}if(this.fogCullDistSq){let a=this.fogCullDistSq,n=this.horizonLineFromTop();I=I.filter(o=>{let s=[0,0,0,1],l=[e.ai,e.ai,0,1],h=this.calculateFogTileMatrix(o.tileID.toUnwrapped());e.ad.vec4.transformMat4(s,s,h),e.ad.vec4.transformMat4(l,l,h);let u=e.ad.vec4.min([],s,l),c=e.ad.vec4.max([],s,l),d=e.bW(u,c);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=e.c7(this.rotation),h=[l[0]*e.ai,l[1]*e.ai,a.max];e.ad.vec3.transformMat4(h,h,s),p=(1-h[1])*this.height*.5<n}return d<a||p})}return I.sort((e,i)=>e.distanceSq-i.distanceSq).map(e=>e.tileID)}resize(e,i){this.width=e,this.height=i,this.pixelsToGLUnits=[2/e,-2/i],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(i){let r=e.ay(i.lat,-e.bX,e.bX),a=this.projection.project(i.lng,r);return new e.P(a.x*this.worldSize,a.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.bH(1,this.center.lat)/this.worldSize}setLocationAtPoint(i,r){let a,n,o=this.centerPoint;if("globe"===this.projection.name){let e=this.worldSize;a=(r.x-o.x)/e,n=(r.y-o.y)/e}else{let e=this.pointCoordinate(r),i=this.pointCoordinate(o);a=e.x-i.x,n=e.y-i.y}let s=this.locationCoordinate(i);this.setLocation(new e.ac(s.x-a,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e,i){return this.projection.locationPoint(this,e,i)}locationPoint3D(e,i){return this.projection.locationPoint(this,e,i,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e,i){return this.coordinateLocation(this.pointCoordinate3D(e,i))}locationCoordinate(i,r){let a=r?e.bH(r,i.lat):void 0,n=this.projection.project(i.lng,i.lat);return new e.ac(n.x,n.y,a)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(i,r){let a=null!=r?r:this._centerAltitude,n=[i.x,i.y,0,1],o=[i.x,i.y,1,1];e.ad.vec4.transformMat4(n,n,this.pixelMatrixInverse),e.ad.vec4.transformMat4(o,o,this.pixelMatrixInverse);let s=o[3];
8e.ad.vec4.scale(n,n,1/n[3]),e.ad.vec4.scale(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 e.ad.vec4.transformMat4(r,r,this.pixelMatrixInverse),e.ad.vec4.transformMat4(a,a,this.pixelMatrixInverse),e.ad.vec4.scale(r,r,1/r[3]),e.ad.vec4.scale(a,a,1/a[3]),r[2]=e.bH(r[2],this._center.lat)*this.worldSize,a[2]=e.bH(a[2],this._center.lat)*this.worldSize,e.ad.vec4.scale(r,r,1/this.worldSize),e.ad.vec4.scale(a,a,1/this.worldSize),new e.as([r[0],r[1],r[2]],e.ad.vec3.normalize([],e.ad.vec3.sub([],a,r)))}rayIntersectionCoordinate(i){let{p0:r,p1:a,t:n}=i,o=e.bH(r[2],this._center.lat),s=e.bH(a[2],this._center.lat);return new e.ac(e.ah(r[0],a[0],n)/this.worldSize,e.ah(r[1],a[1],n)/this.worldSize,e.ah(o,s,n))}pointCoordinate(e,i=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,i)}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 e.ac(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=e.ah(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 e.ac(a[0],a[1],a[2]):this.pointCoordinate(i)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(i){if(i.y<0||i.y>this.height||i.x<0||i.x>this.width)return!1;if(this.elevation||this.zoom>=e.bY)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 e.ad.vec4.transformMat4(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(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 e.P(r,i)),s=this.pointLocation3D(new e.P(n,i)),l=this.pointLocation3D(new e.P(n,a)),h=this.pointLocation3D(new e.P(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 e.P(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]=e.bZ(this);i?(p=90,c=180,u=-180):r&&(d=-90,c=180,u=-180)}return new e.aB(new e.bO(u,d),new e.bO(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 e.P(n,a),h=new e.P(s,a),u=new e.P(s,o),c=new e.P(n,o),d=this.pointCoordinate(l,i),p=this.pointCoordinate(h,i),f=this.pointCoordinate(u,r),m=this.pointCoordinate(c,r),_=(e,i)=>(i.y-e.y)/(i.x-e.x);return d.y>1&&p.y>=0?d=new e.ac((1-m.y)/_(m,d)+m.x,1):d.y<0&&p.y<=1&&(d=new e.ac(-m.y/_(m,d)+m.x,0)),p.y>1&&d.y>=0?p=new e.ac((1-f.y)/_(f,p)+f.x,1):p.y<0&&d.y<=1&&(p=new e.ac(-f.y/_(f,p)+f.x,0)),(new e.aB).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(m)).extend(this.coordinateLocation(f))}_getBoundsRectangularTerrain(){let e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);let i=e.visibleDemTiles.reduce((e,i)=>{if(i.dem){let r=i.dem.tree;e.min=Math.min(e.min,r.minimums[0]),e.max=Math.max(e.max,r.maximums[0])}return e},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(i.min*e.exaggeration(),i.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){let i=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,r=this.height/2-i*(1-this._horizonShift);return e?Math.max(0,r):r}getMaxBounds(){return this.maxBounds}setMaxBounds(i){this.maxBounds=i,this.minLat=-e.bX,this.maxLat=e.bX,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=e.av(this.minLng)*this.tileSize,this.worldMaxX=e.av(this.maxLng)*this.tileSize,this.worldMinY=e.aC(this.maxLat)*this.tileSize,this.worldMaxY=e.aC(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,i){return this.projection.createTileMatrix(this,i,e)}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/e.ai*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 e.ad.mat4.multiply(n,this.worldToFogMatrix,n),a[r]=new Float32Array(n),a[r]}calculateProjMatrix(i,r=!1,a=!1){let n,o,s=i.key;if((n=a?this._expandedProjMatrixCache:r?this._alignedProjMatrixCache:this._projMatrixCache)[s])return n[s];let l=this.calculatePosMatrix(i,this.worldSize);return o=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:a?this.expandedFarZProjMatrix:r?this.alignedProjMatrix:this.projMatrix,e.ad.mat4.multiply(l,o,l),n[s]=new Float32Array(l),n[s]}calculatePixelsToTileUnitsMatrix(i){let r=i.tileID.key,a=this._pixelsToTileUnitsCache;if(a[r])return a[r];let n=e.b_(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=e.ad.mat4.fromScaling([],[i,i,i]);return e.ad.mat4.multiply(r,r,this.globeMatrix),r}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let i=this._elevation;this._updateCameraState();let r=e.bH(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(r),n=this._camera.forward(),o=e.bH(1,this._center.lat);a[2]/=o,n[2]/=o,e.ad.vec3.normalize(n,n);let s=i.raycast(a,n,i.exaggeration());if(s){let i=e.ad.vec3.scaleAndAdd([],a,n,s),r=new e.ac(i[0],i[1],e.bH(i[2],e.aT(i[1]))),l=(r.z+e.ad.vec3.length([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=e.bH(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),o=r.getAtPointOrZero(new e.ac(...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=e.ad.vec3.length(r);r[2]-=(l-h)/this._pixelsPerMercatorPixel;let o=e.ad.vec3.length(r);if(0===o)return;e.ad.vec3.scale(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=e.ay(r.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||i)||(r.lng=e.ay(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 e=this.worldMinX*this.scale,i=this.worldMaxX*this.scale,r=this.worldSize/2-(e+i)/2;(s=(a+r+this.worldSize)%this.worldSize-r)-h<e&&(s=e+h),s+h>i&&(s=i-h),i-e<this.width&&(o=Math.max(o,this.width/(i-e)),s=(i+e)/2)}s===a&&l===n||this._allowWorldUnderZoom||(this.center=this.unproject(new e.P(s,l))),o&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(o)),this._constrainCamera(),this._unmodified=r,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_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=e.bH(1,this.center.lat)/e.bH(1,e.c8));let o=e.b$(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]=e.ah(r[o],a[o],n)})(i=this._camera.getCameraToClipOrthographic(o,n,s,a,this._nearZ,this._farZ),i,h,e.c9(this.pitch>=15?1:this.pitch/15))}else i=h;let u=e.ad.mat4.mul([],h,l),c=e.ad.mat4.mul([],i,l);if(this.projection.isReprojectedInTileSpace){let i=this.locationCoordinate(this.center),r=e.ad.mat4.identity([]);e.ad.mat4.translate(r,r,[i.x*this.worldSize,i.y*this.worldSize,0]),e.ad.mat4.multiply(r,r,e.c0(this)),e.ad.mat4.translate(r,r,[-i.x*this.worldSize,-i.y*this.worldSize,0]),e.ad.mat4.multiply(c,c,r),e.ad.mat4.multiply(u,u,r),this.inverseAdjustmentMatrix=e.c1(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.ad.mat4.scale([],c,[this.worldSize,this.worldSize,this.worldSize/s,1]),this.projMatrix=c,this.invProjMatrix=e.ad.mat4.invert(new Float64Array(16),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,this.expandedFarZProjMatrix=e.ad.mat4.mul([],i,l)}else this.expandedFarZProjMatrix=this.projMatrix;let d=e.ad.mat4.invert([],i);this.frustumCorners=e.c2.fromInvProjectionMatrix(d,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a);let p=new Float32Array(16);e.ad.mat4.identity(p),e.ad.mat4.scale(p,p,[1,-1,1]),e.ad.mat4.rotateX(p,p,this._pitch),e.ad.mat4.rotateZ(p,p,this.angle);let f=e.ad.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.ad.mat4.clone(f);let m=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;f[8]=-(2*r.x)/this.width,f[9]=2*(r.y+m)/this.height,this.skyboxMatrix=e.ad.mat4.multiply(
8p,f,p);let _=this.point,g=_.x,y=_.y,x=this.width%2/2,v=this.height%2/2,b=Math.cos(this.angle),w=Math.sin(this.angle),T=g-Math.round(g)+b*x+w*v,S=y-Math.round(y)+b*v+w*x,M=new Float64Array(c);if(e.ad.mat4.translate(M,M,[T>.5?T-1:T,S>.5?S-1:S,0]),this.alignedProjMatrix=M,c=e.ad.mat4.create(),e.ad.mat4.scale(c,c,[this.width/2,-this.height/2,1]),e.ad.mat4.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=e.ad.mat4.create(),e.ad.mat4.scale(c,c,[1,-1,1]),e.ad.mat4.translate(c,c,[-1,-1,0]),e.ad.mat4.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=e.ad.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,u),this._calcFogMatrices(),this._distanceTileDataCache={},!(c=e.ad.mat4.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");if(this.pixelMatrixInverse=c,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.c3(this);let i=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.ad.vec3.transformMat4(i,i,l),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=c;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];e.ad.vec3.scale(o,o,n),e.ad.vec3.scale(a,a,-1),e.ad.vec3.multiply(a,a,o);let s=e.ad.mat4.create();e.ad.mat4.translate(s,s,a),e.ad.mat4.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(i,r,n)}_computeCameraPosition(e){let i=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,r=this._camera.forward(),a=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*i-e/this.worldSize*this._centerAltitude;return[a.x/this.worldSize-r[0]*n,a.y/this.worldSize-r[1]*n,e/this.worldSize*this._centerAltitude-r[2]*n]}_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=e.ad.vec3.scaleAndAdd([],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=e.bH(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.ak(this._maxPitch)),l=Math.max((i[2]-o)/Math.cos(a),s),h=this._zoomFromMercatorZ(l);e.ad.vec3.scaleAndAdd(i,i,r,l),this._pitch=e.ay(a,e.ak(this.minPitch),e.ak(this.maxPitch)),this.angle=e.bF(n,-Math.PI,Math.PI),this._setZoom(e.ay(h,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.ac(i[0],i[1],i[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){let e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(i){let r=0,a=e.bY,n=0,o=1/0;for(;a-r>1e-6&&a>r;){let e=r+.5*(a-r),s=this.tileSize*Math.pow(2,e),l=this.getCameraToCenterDistance(this.projection,e,s),h=this.scaleZoom(l/(i*this.tileSize)),u=Math.abs(e-h);u<o&&(o=u,n=e),e<h?r=e:a=e}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.w("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;
8if("mercator"!==this.projection.name)return!1;let l=[new e.P(a,o),new e.P(n,s),new e.P(a,s),new e.P(n,o)],h=this.renderWorldCopies?-3:0,u=this.renderWorldCopies?4:1;for(let e of l){let i=this.pointRayIntersection(e);if(i.t<0)return!0;let r=this.rayIntersectionCoordinate(i);if(r.x<h||r.y<0||r.x>u||r.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.c4(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(i,r){let a=e.ad.vec3.length(e.ad.vec3.sub([],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];e.ad.vec4.transformMat4(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 e.P(i[0],i[1])}{let i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,i))}}getCameraToCenterDistance(i,r=this.zoom,a=this.worldSize){let n=e.b$(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=e.ah(1,s,e.c9(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&&e.ad.mat4.multiply(i,i,this.globeMatrix),i}getFrustum(i){return e.bR.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,"meters"===this.projection.zAxisUnit)}}let it=(i,r)=>{if(r>0&&i.terrain&&e.w("Cutoff is currently disabled on terrain"),r<=0||i.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let a=i.transform,n=Math.max(Math.abs(a._zoom-(i.minCutoffZoom-1)),1),o=a.isLODDisabled(!1)?e.ae(60,45,a.pitch):e.ae(30,15,a.pitch),s=a._farZ-a._nearZ,l=r*a.height,h=((1-o)*a.cameraToCenterDistance+o*(a._farZ+l))*n;return{shouldRenderCutoff:o<1,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(h-a._nearZ)/s,(h-l-a._nearZ)/s]}}},ii={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class ir{constructor(e,i){this.aabb=e,this.lastCascade=i}}class ia{add(e,i){let r=this.receivers[e.key];void 0!==r?(r.aabb.min[0]=Math.min(r.aabb.min[0],i.min[0]),r.aabb.min[1]=Math.min(r.aabb.min[1],i.min[1]),r.aabb.min[2]=Math.min(r.aabb.min[2],i.min[2]),r.aabb.max[0]=Math.max(r.aabb.max[0],i.max[0]),r.aabb.max[1]=Math.max(r.aabb.max[1],i.max[1]),r.aabb.max[2]=Math.max(r.aabb.max[2],i.max[2])):this.receivers[e.key]=new ir(i,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(i,r,a){let n=e.ce.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(e.ad.vec3.transformMat4(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}}class io{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new ia,this._depthMode=new t1(e.context.gl.LEQUAL,t1.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,e.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),e.tp.registerParameter(ii,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(ii,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),e.tp.registerParameter(ii,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),e.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(let e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(i,r){let a=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!r||!r.properties)return;let n=r.properties.get("shadow-intensity");if(!r.shadowsEnabled()||n<=0||(this._shadowLayerCount=a.style.order.reduce((e,r)=>{let n=a.style._mergedLayers[r];return e+(n.hasShadowPass()&&!n.isHidden(i.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;let o=a.context,s=ii.shadowMapResolution,l=ii.shadowMapResolution;if(0===this._cascades.length||ii.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let i=0;i<ii.cascadeCount;++i){let i=a._shadowMapDebug,r=o.gl,n=o.createFramebuffer(s,l,i,"texture"),h=new e.T(o,{width:s,height:l,data:null},r.DEPTH_COMPONENT16);if(n.depthAttachment.set(h.texture),i){let i=new e.T(o,{width:s,height:l,data:null},r.RGBA8);n.colorAttachment.set(i.texture)}this._cascades.push({framebuffer:n,texture:h,matrix:[],far:0,boundingSphereRadius:0,frustum:new e.bR,scale:0})}}this.shadowDirection=il(r);let h=0;if(i.elevation){let e=i.elevation,r=[1e4,-1e4];e.visibleDemTiles.filter(e=>
8e.dem).forEach(e=>{let i=e.dem.tree;r[0]=Math.min(r[0],i.minimums[0]),r[1]=Math.max(r[1],i.maximums[0])}),1e4!==r[0]&&(h=(r[1]-r[0])*e.exaggeration())}let u=1.5*i.cameraToCenterDistance,c=3*u,d=new Float64Array(16);for(let r=0;r<this._cascades.length;++r){let a=this._cascades[r],n=i.height/50,o=1;1===ii.cascadeCount?o=c:0===r?o=u:(n=u,o=c);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=i._camera.getCameraToWorldMercator(),b=[0,0,-l*p];e.ad.vec3.transformMat4(b,b,v);let w=h*p,T=i._edgeInsets;if((0!==T.left||0!==T.top||0!==T.right||0!==T.bottom)&&(T.left!==T.right||T.top!==T.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);e.ad.mat4.mul(s,o,r);let l=new Float64Array(16);for(let r of(e.ad.mat4.invert(l,s),e.bR.fromInvProjectionMatrix(l,d,u,!0).points)){let a=(r[0]/=c,r[1]/=c,r[2]=e.bH(r[2],i._center.lat),r);w=Math.max(w,e.ad.vec3.len(e.ad.vec3.subtract([],b,a)))}}w*=o/(o-1);let S=Math.acos(r[2]),M=Math.atan2(-r[0],-r[1]),E=new t9;E.position=b,E.setPitchBearing(S,M);let A=E.getWorldToCamera(d,x),I=w*d,C=Math.min(-(i._mercatorZfromZoom(17)*d*2),-2*I),P=E.getCameraToClipOrthographic(-I,I,-I,I,C,(I+s*x)/r[2]),z=new Float64Array(16);e.ad.mat4.multiply(z,P,A);let D=e.ad.vec3.fromValues(Math.floor(1e6*b[0])/1e6*d,Math.floor(1e6*b[1])/1e6*d,0),R=.5*o,L=[0,0,0];e.ad.vec3.transformMat4(L,D,z),e.ad.vec3.scale(L,L,R);let O=[Math.floor(L[0]),Math.floor(L[1]),Math.floor(L[2])],k=[0,0,0];e.ad.vec3.sub(k,L,O),e.ad.vec3.scale(k,k,-1/R);let F=new Float64Array(16);return e.ad.mat4.identity(F),e.ad.mat4.translate(F,F,k),e.ad.mat4.multiply(z,F,z),[z,I]}(i,this.shadowDirection,n,o,ii.shadowMapResolution,h);a.scale=i.scale,a.matrix=s,a.boundingSphereRadius=l,e.ad.mat4.invert(d,a.matrix
8),a.frustum=e.bR.fromInvProjectionMatrix(d,1,0,!0),a.far=o}let p=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[p].far,this._cascades[p].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/ii.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=ii.shadowMapResolution,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=a.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});let f=a.transform.elevation;for(let e of this._groundShadowTiles){let i={min:0,max:0};if(f){let r=f.getMinMaxForTile(e);r&&(i=r)}this.addShadowReceiver(e.toUnwrapped(),i.min,i.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(e){this._enabled=e}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,ii.shadowMapResolution,ii.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:e.al.white,depth:1}),i.order)){let e=i._mergedLayers[s];if(!e.hasShadowPass()||e.isHidden(a.transform.zoom))continue;let n=i.getLayerSourceCache(e),o=n?r[n.id]:void 0;("model"===e.type||o&&o.length)&&a.renderLayer(a,n,e,o)}a.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;let e=this.painter,i=e.style,r=e.context,a=i.directionalLight,n=i.ambientLight;if(!a||!n)return;let o=[],s=it(e,e.longestCutoffRange);s.shouldRenderCutoff&&o.push("RENDER_CUTOFF"),o.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&o.push("NORMAL_OFFSET");let l=ih(i,a,n),h=new t1(r.gl.LEQUAL,t1.ReadOnly,e.depthRangeFor3D);for(let i of this._groundShadowTiles){let a=i.toUnwrapped(),n=e.isTileAffectedByFog(i),u=e.getOrCreateProgram("groundShadow",{defines:o,overrideFog:n});this.setupShadows(a,u),e.uploadCommonUniforms(r,u,a,null,s);let c={u_matrix:e.transform.calculateProjMatrix(a),u_ground_shadow_factor:l};u.draw(e,r.gl.TRIANGLES,h,t2.disabled,t0.multiply,t3.disabled,c,"ground_shadow",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,null,e.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?t0.unblended:t0.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(i){let r=this.painter.transform,a=r.calculatePosMatrix(i,r.worldSize);return e.ad.mat4.multiply(a,this._cascades[this.painter.currentShadowCascade].matrix,a),Float32Array.from(a)}calculateShadowPassMatrixFromMatrix(i){return e.ad.mat4.multiply(i,this._cascades[this.painter.currentShadowCascade].matrix,i),Float32Array.from(i)}setupShadows(i,r,a,n=0){if(!this.enabled)return;let o=this.painter.transform,s=this.painter.context,l=s.gl,h=this._uniformValues,u=new Float64Array(16),c=o.calculatePosMatrix(i,o.worldSize);for(let i=0;i<this._cascades.length;i++)e.ad.mat4.multiply(u,this._cascades[i].matrix,c),h[0===i?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(u),s.activeTexture.set(l.TEXTURE0+11+i),this._cascades[i].texture.bind(l.NEAREST,l.CLAMP_TO_EDGE);if(this.useNormalOffset=!!a,this.useNormalOffset){let r=e.cd(i.canonical),s=2/o.tileSize*e.ai/ii.shadowMapResolution,l=s*this._cascades[0].boundingSphereRadius,u=s*this._cascades[this._cascades.length-1].boundingSphereRadius,c=("vector-tile"===a?1:3)/Math.pow(2,n-i.canonical.z-(1-o.zoom+Math.floor(o.zoom)));h.u_shadow_normal_offset=[r,l*c,u*c],h.u_shadow_bias=[6e-5,.0012,.012]}else h.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(s,h)}setupShadowsFromMatrix(i,r,a=!1){if(!this.enabled)return;let n=this.painter.context,o=n.gl,s=this._uniformValues,l=new Float64Array(16);for(let r=0;r<ii.cascadeCount;r++)e.ad.mat4.multiply(l,this._cascades[r].matrix,i),s[0===r?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(l),n.activeTexture.set(o.TEXTURE0+11+r),this._cascades[r].texture.bind(o.NEAREST,o.CLAMP_TO_EDGE);if(this.useNormalOffset=a,a){let e=ii.normalOffset;s.u_shadow_normal_offset=[1,e,e],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){let o;if(n[2]>=0)return{};let s=(o=a/(1<<i.canonical.z),new e.ce([i.canonical.x*o+i.wrap*a,i.canonical.y*o+i.wrap*a,0],[(i.canonical.x+1)*o+i.wrap*a,(i.canonical.y+1)*o+i.wrap*a,r])).getCorners(),l=-(r/n[2]);n[0]<0?(e.ad.vec3.add(s[0],s[0],[n[0]*l,0,0]),e.ad.vec3.add(s[3],s[3],[n[0]*l,0,0])):n[0]>0&&(e.ad.vec3.add(s[1],s[1],[n[0]*l,0,0]),e.ad.vec3.add(s[2],s[2],[n[0]*l,0,0])),n[1]<0?(e.ad.vec3.add(s[0],s[0],[0,n[1]*l,0]),e.ad.vec3.add(s[1],s[1],[0,n[1]*l,0])):n[1]>0&&(e.ad.vec3.add(s[2],s[2],[0,n[1]*l,0]),e.ad.vec3.add(s[3],s[3],[0,n[1]*l,0]));let h={};return h.vertices=s,h.planes=[is(s[1],s[0],s[4]),is(s[2],s[1],s[5]),is(s[3],s[2],s[6]),is(s[0],s[3],s[7])],h}addShadowReceiver(i,r,a){this._receivers.add(i,e.ce.fromTileIdAndHeight(i,r,a))}getMaxCascadeForTile(e){let i=this._receivers.get(e);return i&&i.lastCascade?i.lastCascade:0}}function is(i,r,a){let n=e.ad.vec3.sub([],a,r),o=e.ad.vec3.sub([],i,r),s=e.ad.vec3.cross([],n,o),l=e.ad.vec3.length(s);return 0===l?[0,0,1,0]:(e.ad.vec3.scale(s,s,1/l),[s[0],s[1],s[2],-e.ad.vec3.dot(s,r)])}function il(i){let r=i.properties.get("direction"),a=e.cc(r.x,r.y,r.z);
8a[2]=e.ay(a[2],0,75);let n=e.cf([a[0],a[1],a[2]]);return e.ad.vec3.fromValues(n.x,n.y,n.z)}function ih(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(e.ad.vec3.dot([0,0,1],h),0),f=[0,0,0];e.ad.vec3.scale(f,c.toRenderColor(u?null:i.getLut(r.scope)).toArray01Linear().slice(0,3),d);let m=[0,0,0];return e.ad.vec3.scale(m,o.toRenderColor(n?null:i.getLut(a.scope)).toArray01Linear().slice(0,3),p*s),e.cg([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])}class iu extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.modelUris={"":{}},this.numModelsLoading={}}loadModel(i,r){return e.aN(this.requestManager.transformRequest(r,e.R.Model).url).then(r=>{if(!r)return;let a=e.aO(r),n=new e.aP(i,void 0,void 0,a);return n.computeBoundsAndApplyParent(),n}).catch(a=>{if(a&&404===a.status)return null;this.fire(new e.z(Error(`Could not load model ${i} from ${r}: ${a.message}`)))})}load(i,r,a={keepNumReferences:!1}){this.models[r]||(this.models[r]={});let n=Object.keys(i);this.numModelsLoading[r]=(this.numModelsLoading[r]||0)+n.length;let o=[];for(let e of n)o.push(this.loadModel(e,i[e]));Promise.allSettled(o).then(i=>{for(let e=0;e<i.length;e++){let{status:o,value:s}=i[e];if("fulfilled"===o&&s){let i=this.models[r][n[e]];this.models[r][n[e]]={model:s,numReferences:a.keepNumReferences&&i?i.numReferences:1}}}this.numModelsLoading[r]-=n.length,this.fire(new e.A("data",{dataType:"style"}))}).catch(i=>{this.fire(new e.z(Error(`Could not load models: ${i.message}`)))})}isLoaded(){for(let e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,i){return!!this.getModel(e,i)}getModel(e,i){return this.models[i]||(this.models[i]={}),this.models[i][e]?this.models[i][e].model:void 0}
8addModel(e,i,r){this.models[r]||(this.models[r]={}),this.modelUris[r]||(this.modelUris[r]={}),this.hasModel(e,r)&&this.models[r][e].numReferences++,this.modelUris[r][e]=this.requestManager.normalizeModelURL(i),this.load({[e]:this.modelUris[r][e]},r)}addModels(e,i){this.models[i]||(this.models[i]={}),this.modelUris[i]||(this.modelUris[i]={});let r=this.modelUris[i];for(let a in e)this.models[i][a]={},r[a]=this.requestManager.normalizeModelURL(e[a]);this.load(r,i,{keepNumReferences:!0})}reloadModels(e){this.load(this.modelUris[e],e)}addModelsFromBucket(e,i){this.models[i]||(this.models[i]={}),this.modelUris[i]||(this.modelUris[i]={});let r={};for(let a of e)this.hasModel(a,i)?this.models[i][a].numReferences++:(this.modelUris[i][a]=this.requestManager.normalizeModelURL(a),r[a]=this.modelUris[i][a]);this.load(r,i)}removeModel(e,i){if(this.models[i]&&this.models[i][e]&&(this.models[i][e].numReferences--,0===this.models[i][e].numReferences)){let r=this.models[i][e].model;delete this.models[i][e],delete this.modelUris[i][e],r.destroy()}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,i){for(let r in this.models[i]||(this.models[i]={}),this.models[i])this.models[i][r].model&&this.models[i][r].model.upload(e.context)}}let ic=new e.a7({data:new e.a8(e.a5.colorTheme.data)}),id={"mbx-indoor-active-floorplans":{default:["literal",[]]},"mbx-indoor-underground":{default:["literal",!1]},"mbx-indoor-loaded-levels":{default:["literal",[]]},"mbx-indoor-level-height":{default:["literal",{}]},"mbx-indoor-level-base":{default:["literal",{}]},"mbx-indoor-level-selected":{default:["literal",{}]},"mbx-indoor-level-overlapped":{default:["literal",{}]}};function ip(e){return Object.assign(e=e||{},id)}class im extends e.E{constructor(i){super(),this.mergeFloors=!0,this._scope=void 0,this._queryFeatureSetId=void 0,this._buildingEntryFeatureSetId=void 0,this._selectedFloorplan=void 0,this._indoorData=void 0,this._selectedLevel=void 0,this._floorplanStates={},e.aQ(["_onLoad","_onMove","_checkFloorplanVisible"],this),this._map=i,this._checkFloorplanVisible(!0),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=void 0}_onLoad(){this._map.style.forEachFragmentStyle(i=>{i.stylesheet.indoor&&(this._queryFeatureSetId?this.fire(new e.z(Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._queryFeatureSetId=i.stylesheet.indoor.floorplanFeaturesetId,this._buildingEntryFeatureSetId=i.stylesheet.indoor.buildingFeaturesetId,this._scope=i.scope))}),this._queryFeatureSetId&&this._buildingEntryFeatureSetId&&this._map.addInteraction("mbx-indoor-buildingclick",{type:"click",target:{featuresetId:this._buildingEntryFeatureSetId,importId:this._scope},handler:e=>(e.feature&&e.feature.properties.floorplan&&this.selectFloorplan(e.feature.properties.floorplan),!0)}),this._checkFloorplanVisible(!0)}_onMove(){this._checkFloorplanVisible(!1)}_checkFloorplanVisible(i){if(!this._queryFeatureSetId||!this._map.isStyleLoaded()||this._map.transform.zoom<13)return;this._indoorData&&!function(e,i){let[r,a]=e,{center:n,radius:o}=i,[s,l]=n,h=Math.abs(r-s);return Math.sqrt((h>180?360-h:h)**2+(a-l)**2)<=o}([this._map.getCenter().lng,this._map.getCenter().lat],this._indoorData.circumCircle)&&(this._indoorData=void 0,this._selectedFloorplan=void 0,this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",["literal",[]]),this.fire(new e.A("floorplangone")));let r={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},a=new e.P(this._map.transform.width/2,this._map.transform.height/2),n=[new e.P(0,0),new e.P(this._map.transform.width,this._map.transform.height)],o=this._map.queryRenderedFeatures(i?n:a,r);o.length>0&&(this._selectedFloorplan&&o[0].properties.id===this._selectedFloorplan.properties.id||(this._selectedFloorplan=o[0],this._floorplanSelected(!1)))}_floorplanSelected(i){let r;
8this._indoorData=JSON.parse(this._selectedFloorplan.properties["indoor-data"]),this._indoorData.id=this._selectedFloorplan.properties.id,this._indoorData.circumCircle=function(e){let[[i,r],[a,n]]=e,o=(a-i+360)%360,s=o>180?360-o:o;return{center:[(i+s/2+360)%360,(r+n)/2],radius:Math.sqrt(s**2+(n-r)**2)/2}}(this._indoorData.extent),this._floorplanStates[this._indoorData.id]||(this._floorplanStates[this._indoorData.id]={});let a=this._floorplanStates[this._indoorData.id].selectedBuilding,n=this._floorplanStates[this._indoorData.id].selectedLevel;if(this._map.setConfigProperty(this._scope,"mbx-indoor-active-floorplans",this._indoorData.floorplanIDs),this._selectedLevel)for(let e of this._indoorData.levels)e.id===this._selectedLevel.id&&(r=e.id);if(this.fire(new e.A("floorplanselected",{buildings:this._indoorData.buildings,levels:this._indoorData.levels,selectedLevelId:r})),a){let e=this._indoorData.buildings.find(e=>e.id===a);this._buildingSelected(e,!1)}else this._indoorData.buildings.length>0&&this._buildingSelected(this._indoorData.buildings[0],!1);if(n){let e=this._indoorData.levels.find(e=>e.id===n);this._updateLevels(e,i)}else i&&this._indoorData["default-levels"].length>0&&this.selectLevel(this._indoorData["default-levels"][0])}_buildingSelected(i,r){r&&i&&i.extent&&this._map.fitBounds(i.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),this._floorplanStates[this._indoorData.id].selectedBuilding=i?i.id:void 0;let a=this._indoorData.levels.filter(e=>i.levels.includes(e.id));this.fire(new e.A("buildingselected",{buildingId:i.id,levels:a}))}_levelSelected(i){if("overview"===i)this._updateLevels(void 0,!0);else{let e=this._indoorData.levels.find(e=>e.id===i);this._updateLevels(e,!0)}this.fire(new e.A("levelselected",{levelId:"overview"===i?void 0:i}))}_updateLevels(e,i){if(!e)return this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",[]]),this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!1),this._floorplanStates[this._indoorData.id].selectedLevel=void 0,void(i&&this._indoorData.extent&&this._map.fitBounds(this._indoorData.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}));function r(e){let i=e.indexOf("/floor/");if(-1===i)return e;let r=i+7,a=e.indexOf("/",r);return -1===a?e.slice(r):e.slice(r,a)}this._selectedLevel=e,this._floorplanStates[this._indoorData.id].selectedLevel=e?e.id:void 0;let a=[],n={},o={},s={},l={};for(let i of this._indoorData.levels)if(a.push(i.id),n[i.id]=i.height,o[i.id]=i.base,e){if(this.mergeFloors){let a=r(e.id),n=r(i.id);s[i.id]=n===a?"true":"false"}else s[i.id]=i.id===e.id?"true":"false";l[i.id]=i.base<e.base?"true":"false"}else l[i.id]=!0;if(this._map.setConfigProperty(this._scope,"mbx-indoor-loaded-levels",["literal",a]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-height",["literal",n]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-base",["literal",o]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",s]),this._map.setConfigProperty(this._scope,"mbx-indoor-level-overlapped",["literal",l]),e&&(this._map.setConfigProperty(this._scope,"mbx-indoor-underground",!!e.isUnderground),i&&e.extent)){let i=this._map.cameraForBounds(e.extent,{pitch:this._map.getPitch(),bearing:this._map.getBearing()}),r=this._map.getZoom(),a=i.zoom?Math.abs(r-i.zoom):0;this._map.fitBounds(e.extent,a>=1?{pitch:this._map.getPitch(),bearing:this._map.getBearing()}:{pitch:this._map.getPitch(),bearing:this._map.getBearing(),zoom:r})}}selectFloorplan(i){let r={target:{featuresetId:this._queryFeatureSetId,importId:this._scope}},a=[new e.P(0,0),new e.P(this._map.transform.width,this._map.transform.height)],n=this._map.queryRenderedFeatures(a,r);if(n.length>0){for(let e of n)if(JSON.parse(e.properties["indoor-data"]).floorplanIDs.includes(i)){this._selectedFloorplan=e,this._floorplanSelected(!0);break}}}selectBuilding(e){let i=this._indoorData.buildings.find(i=>i.id===e);this._buildingSelected(i,!0)}selectLevel(e){this._levelSelected(e)}}function i_(i){if(i)return i.map(([i,r])=>[i*e.q.devicePixelRatio,r*e.q.devicePixelRatio])}class ig{constructor(e,i){this.id=e,this.style=i}addIcons(i){let r=new Map;for(let[a,n]of i.entries()){let i=e.I.from({name:a,iconsetId:this.id});r.set(i,n)}this.style.addImages(r)}}let iy=(e,i)=>eI(e,i&&i.filter(e=>"source.canvas"!==e.identifier)),ix=e.aA(th,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport"]),iv=e.aA(th,["setCenter","setZoom","setBearing","setP
8itch"]),ib=new Set(["background","sky","slot","custom"]),iw={version:8,layers:[],sources:{}},iT={duration:300,delay:0};class iS extends e.E{constructor(i,r={}){super(),this.map=i,this.scope=r.scope||"",this.globalId=null,this.fragments=[],this.importDepth=r.importDepth||0,this.importsCache=r.importsCache||new Map,this.resolvedImports=r.resolvedImports||new Set,this.transition=e.l({},iT),this._buildingIndex=new ts(this),this.crossTileSymbolIndex=new tQ,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=r.styleChanges||new q,this.dispatcher=r.dispatcher?r.dispatcher:new e.D(e.cj(),this),r.imageManager?this.imageManager=r.imageManager:(this.imageManager=new Z(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=r.glyphManager?r.glyphManager:new e.ck(i._requestManager,r.localFontFamily?e.cl.all:r.localIdeographFontFamily?e.cl.ideographs:e.cl.none,r.localFontFamily||r.localIdeographFontFamily),r.modelManager?this.modelManager=r.modelManager:(this.modelManager=new iu(i._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=r.configOptions?r.configOptions:new Map,this._configDependentLayers=r.configDependentLayers?r.configDependentLayers:new Set,this._config=r.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:r.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=r.initialConfig,this.dispatcher.broadcast("setReferrer",e.cm());const a=this;this._rtlTextPluginCallback=iS.registerForPluginStateChange(i=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:i.pluginStatus,pluginURL:i.pluginURL},(i,r)=>{if(e.cn(i),r&&r.every(e=>e))for(let e in a._sourceCaches){let i=a._sourceCaches[e],r=i.getSource().type;"vector"!==r&&"geojson"!==r||i.reload()}})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let i=this.getOwnSource(e.sourceId);if(i&&i.vectorLayerIds)for(let e in this._layers){let r=this._layers[e];r.source===i.id&&this._validateLayer(r)}})}load(e){return e&&("string"==typeof e?this.loadURL(e):this.loadJSON(e)),this}_getGlobalId(i){if(!i)return null;if("string"==typeof i){if(e.f(i))return i;let r=e.co(i);if(!r.startsWith("http"))try{return new URL(r,location.href).toString()}catch(e){}return r}return`json://${e.cp(JSON.stringify(i))}`}_diffStyle(i,r,a){this.globalId=this._getGlobalId(i);let n=(e,i)=>{try{i(null,this.setState(e,a))}catch(e){i(e,!1)}};if("string"==typeof i){let a=this.map._requestManager.normalizeStyleURL(i),o=this.map._requestManager.transformRequest(a,e.R.Style);e.n(o,(i,a)=>{i?this.fire(new e.z(i)):a&&n(a,r)})}else"object"==typeof i&&n(i,r)}loadURL(i,r={}){this.fire(new e.A("dataloading",{dataType:"style"}));let a="boolean"==typeof r.validate?r.validate:!e.f(i);this.globalId=this._getGlobalId(i),i=this.map._requestManager.normalizeStyleURL(i,r.accessToken),this.resolvedImports.add(i);let n=this.importsCache.get(i);if(n)return this._load(n,a);let o=this.map._requestManager.transformRequest(i,e.R.Style);this._request=e.n(o,(r,n)=>{if(this._request=null,r)this.fire(new e.z(r));else if(n)return this.importsCache.set(i,n),this._load(n,a)})}loadJSON(i,r={}){this.fire(new e.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(i),this._request=e.q.frame(()=>{this._request=null,this._load(i,!1!==r.validate)})}loadEmpty(){this.fire(new e.A("dataloading",{dataType:"style"})),this._load(iw,!1)}_loadImports(i,r,a){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();let n=[];for(let e of i){let i=this._createFragmentStyle(e),o=new Promise(e=>{i.once("style.import.load",e),i.once("error",e)}).then(()=>this.mergeAll());if(n.push(o),this.resolvedImports.has(e.url)){i.loadEmpty();continue}let s=e.data||this.importsCache.get(e.url);s?(i.loadJSON(s,{validate:r}),this._isInternalStyle(s)&&(i.globalId=null)):e.url?i.loadURL(e.url,{validate:r}):i.loadEmpty();let l={style:i,id:e.id,config:e.config};if(a){let e=this.fragments.findIndex(({id:e})=>e===a);this.fragments=this.fragments.slice(0,e).concat(l).concat(this.fragments.slice(e))}else this.fragments.push(l)}return Promise.allSettled(n)}getImportGlobalIds(e=this,i=new Set){for(let r of e.fragments)r.style.globalId&&i.add(r.style.globalId),this.getImportGlobalIds(r.style,i);return[...i.values()]}_createFragmentStyle(i){let r,a=this.scope?e.C(i.id,this.scope):i.id,n=this._initialConfig&&this._initialConfig[a];(i.config||n)&&(r=e.l({},i.config,n));let o=new iS(this.map,{scope:a,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:r,configOptions:this.options,colorThemeOverride:i["color-theme"],configDependentLayers:this._configDependentLayers});return o.setEventedParent(this.map,{style:o}),o}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(i,r){let a=i.indoor?ip(i.schema):i.schema;if(this._isInternalStyle(i)){let a=e.l({},iw,{imports:[{id:"basemap",data:i,url:""}]});return void this._load(a,r)}if(this.updateConfig(this._config,a),r&&iy(this,ef(i)))return;this._loaded=!0,this.stylesheet=e.cq(i);let n=()=>{for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1,isInitialLoad:!0});if(i.iconsets)for(let e in i.iconsets)this.addIconset(e,i.iconsets[e]);i.sprite?this._loadIconset(i.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.setGlyphsUrl(i.glyphs);
8let a=tl(this.stylesheet.layers);if(this._order=a.map(e=>e.id),this.stylesheet.light&&e.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 e=this.stylesheet.lights[0];this.light=new eC(e.properties,e.id)}else this.setLights(this.stylesheet.lights);for(let i of(this.light||(this.light=new eC(this.stylesheet.light)),this._layers={},a)){let r=e.cv(i,this.scope,this._styleColorTheme.lut,this.options);0!==r.configDependencies.size&&this._configDependentLayers.add(r.fqid),r.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=r;let a=this.getOwnLayerSourceCache(r),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&r.canCastShadows()&&n&&(a.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);let n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(n,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 e.A("data",{dataType:"style"}));let o=this.isRootStyle();i.imports?this._loadImports(i.imports,r).then(()=>{this._reloadImports(),this.fire(new e.A(o?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new e.A(o?"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 i=this._evaluateColorThemeData(o);this._loadColorTheme(i).then(()=>{n()}).catch(i=>{e.w(`Couldn't load color theme from the stylesheet: ${i}`),n()})}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}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(e=>{if(e.stylesheet){if(null!=e.light&&(i=e.light),e.stylesheet.lights)for(let i of e.stylesheet.lights)"ambient"===i.type&&null!=e.ambientLight&&(r=e.ambientLight),"directional"===i.type&&null!=e.directionalLight&&(a=e.directionalLight);n=this._prioritizeTerrain(n,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(o=e.fog),e.stylesheet.snow&&null!=e.snow&&(s=e.snow),e.stylesheet.rain&&null!=e.rain&&(l=e.rain),null!=e.stylesheet.camera&&(c=e.stylesheet.camera),null!=e.stylesheet.projection&&(h=e.stylesheet.projection),null!=e.stylesheet.transition&&(u=e.stylesheet.transition),d[e.scope]=e._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=e.l({},iT,u),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){let i=r=>{for(let e of r.fragments)i(e.style);e(r)};i(this)}_prioritizeTerrain(e,i,r){let a=e&&0===e.drapeRenderMode;return null===r?i&&0===i.drapeRenderMode?i:a?e:null:null!=i&&(!e||a||i&&1===i.drapeRenderMode)?i:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(i=>{e=this._prioritizeTerrain(e,i.terrain,i.stylesheet.terrain)}),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle(i=>{null!=i.stylesheet.projection&&(e=i.stylesheet.projection)}),this.projection=e||{name:"mercator"}}mergeSources(){let i={},r={},a={};this.forEachFragmentStyle(n=>{for(let r in n._sourceCaches)i[e.C(r,n.scope)]=n._sourceCaches[r];for(let i in n._otherSourceCaches)r[e.C(i,n.scope)]=n._otherSourceCaches[i];for(let i in n._symbolSourceCaches)a[e.C(i,n.scope)]=n._symbolSourceCaches[i]}),this._mergedSourceCaches=i,this._mergedOtherSourceCaches=r,this._mergedSymbolSourceCaches=a}mergeLayers(){let i={},r=[],a={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(a=>{for(let n of a._order){let o=a._layers[n];if("slot"===o.type){let r=e.cr(n);if(i[r])continue;i[r]=[]}o.slot&&i[o.slot]?i[o.slot].push(o):r.push(o)}}),this._mergedOrder=[];let n=(r=[])=>{for(let o of r)if("slot"===o.type){let r=e.cr(o.id);i[r]&&n(i[r]),this._mergedSlots.push(r)}else{let i=e.C(o.id,o.scope);this._mergedOrder.push(i),a[i]=o,o.is3D(!!this.terrain)&&(this._has3DLayers=!0),"circle"===o.type&&(this._hasCircleLayers=!0),"symbol"===o.type&&(this._hasSymbolLayers=!0),"clip"===o.type&&(this._clipLayerPresent=!0)}};n(r),this._mergedOrder.sort((e,i)=>{let r=a[e],n=a[i];return r.hasInitialOcclusionOpacityProperties?+!!n.is3D(!!this.terrain):r.is3D(!!this.terrain)&&n.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=a,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=e.l({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(i){return i.data?(function(i,r,a){let n=e.l({},r);for(let i of Object.keys(e.a5.colorTheme))void 0===n[i]&&(n[i]=e.a5.colorTheme[i].default);let o=new e.a6(ic,i,new Map(a));return o.setTransitionOrValue(n,a),o.untransitioned().possiblyEvaluate(new e.aa(0))})(this.scope,i,this.options).get("data"):null}_loadColorTheme(i){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;let r=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((a,n)=>{let o="data:image/png;base64,";if(!i||0===i.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void a();let s=i;s.startsWith(o)||(s=o+s);let l=e.I.from("mapbox-reserved-lut"),h=new Image;h.src=s,h.onerror=()=>{this._styleColorTheme.lutLoading=!1,n(Error("Failed to load image data"))},h.onload=()=>
8{if(this._styleColorTheme.lutLoadingCorrelationID!==r)return void a();this._styleColorTheme.lutLoading=!1;let{width:o,height:s,data:u}=e.q.getImageData(h);if(s>32)return void n(Error("The height of the image must be less than or equal to 32 pixels."));if(o!==s*s)return void n(Error("The width of the image must be equal to the height squared."));this.getImage(l)&&this.removeImage(l),this.addImage(l,{data:new e.r({width:o,height:s},u),pixelRatio:1,sdf:!1,usvg:!1,version:0});let c=this.imageManager.getImage(l,this.scope);c?(this._styleColorTheme.lut={image:c.data,data:i},a()):n(Error("Missing LUT image."))}})}getLut(e){let i=this._styleColorThemeForScope[e];return i?i.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(i){this._spriteRequest=function(i,r,a){let n,o,s,l=e.q.devicePixelRatio>1?"@2x":"",h=e.n(r.transformRequest(r.normalizeSpriteURL(i,l,".json"),e.R.SpriteJSON),(e,i)=>{h=null,s||(s=e,n=i,c())}),u=e.o(r.transformRequest(r.normalizeSpriteURL(i,l,".png"),e.R.SpriteImage),(e,i)=>{u=null,s||(s=e,o=i,c())});function c(){if(s)a(s);else if(n&&o){let i=e.q.getImageData(o),r={};for(let a in n){let{width:o,height:s,x:l,y:h,sdf:u,pixelRatio:c,stretchX:d,stretchY:p,content:f}=n[a],m=new e.r({width:o,height:s});e.r.copy(i,m,{x:l,y:h},{x:0,y:0},{width:o,height:s},null),r[a]={data:m,pixelRatio:c,sdf:u,stretchX:d,stretchY:p,content:f,usvg:!1}}a(null,r)}}return{cancel(){h&&(h.cancel(),h=null),u&&(u.cancel(),u=null)}}}(i,this.map._requestManager,(i,r)=>{if(this._spriteRequest=null,i)this.fire(new e.z(i));else if(r){let i=new Map;for(let a in r)i.set(e.I.from(a),r[a]);this.addImages(i)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.A("data",{dataType:"style"}))})}addIconset(i,r){if("sprite"===r.type)return void this._loadSprite(r.url);let a=this.getOwnSource(r.source);if(!a)return void this.fire(new e.z(Error(`Source "${r.source}" as specified by iconset "${i}" does not exist and cannot be used as an iconset source`)));if("raster-array"!==a.type)return void this.fire(new e.z(Error(`Source "${r.source}" as specified by iconset "${i}" is not a "raster-array" source and cannot be used as an iconset source`)));this.imageManager.createIconset(this.scope,i);let n=new ig(i,this);a.addIconset(i,n)}_loadIconset(i){var r,a;if(!e.f(i)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(i);let n="auto"===this.map._spriteFormat;this._spriteRequest=(a=(r,a)=>{if(this._spriteRequest=null,r)n?this._loadSprite(i):this.fire(new e.z(r));else if(a){let i=new Map;for(let r in a)i.set(e.I.from(r),a[r]);this.addImages(i)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.A("data",{dataType:"style"}))},e.bj((r=this.map._requestManager).transformRequest(r.normalizeIconsetURL(i),e.R.Iconset),(i,r)=>{if(i)return void a(i);let n={};for(let i of e.ch(new e.bi(r)).icons){let r={version:1,pixelRatio:e.q.devicePixelRatio,content:function(i){if(!i.metadata||!i.metadata.content_area)return;let r=e.q.devicePixelRatio,{left:a,top:n,width:o,height:s}=i.metadata.content_area,l=a*r,h=n*r;return[l,h,l+o*r,h+s*r]}(i),stretchX:i.metadata?i_(i.metadata.stretch_x_areas):void 0,stretchY:i.metadata?i_(i.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:i};n[i.name]=r}a(null,n)}))}_validateLayer(i){let r=this.getOwnSource(i.source);if(!r)return;let a=i.sourceLayer;a&&("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(a))&&this.fire(new e.z(Error(`Source layer "${a}" does not exist on source "${r.id}" as specified by style layer "${i.id}"`)))}
8loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(let e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(let{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((e,i)=>{let r=this.fragments[i];return r&&r.style&&(e.data=r.style.serialize()),e})}_serializeSources(){let e={};for(let i in this._sourceCaches){let r=this._sourceCaches[i].getSource();e[r.id]||(e[r.id]=r.serialize())}return e}_serializeLayers(e){let i=[];for(let r of e){let e=this._layers[r];e&&"custom"!==e.type&&i.push(e.serialize())}return i}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 e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}_checkLayer(i){let r=this.getOwnLayer(i);if(r)return r;this.fire(new e.z(Error(`The layer '${i}' does not exist in the map's style.`)))}_checkSource(i){let r=this.getOwnSource(i);if(r)return r;this.fire(new e.z(Error(`The source '${i}' does not exist in the map's style.`)))}precompilePrograms(e,i){let r=this.map.painter;if(r)for(let a=e.minzoom||0;a<(e.maxzoom||25.5);a++){let a=e.getProgramIds();if(a)for(let n of a){let a=e.getDefaultProgramParams(n,i.zoom,this._styleColorTheme.lut);a&&(r.style=this,this.fog&&(r._fogVisible=!0,a.overrideFog=!0,r.getOrCreateProgram(n,a)),r._fogVisible=!1,a.overrideFog=!1,r.getOrCreateProgram(n,a),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(a.overrideRtt=!0,r.getOrCreateProgram(n,a)))}}}update(i){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(i),this.directionalLight&&this.directionalLight.recalculate(i);let r=this.calculateLightsBrightness();i.brightness=r||0,r!==this._brightness&&(this._brightness=r,this.dispatcher.broadcast("setBrightness",r));let a=this._changes.isDirty(),n=!1;if(this._changes.isDirty()){let e=this._changes.getLayerUpdatesByScope();for(let i in e){let{updatedIds:r,removedIds:a}=e[i];(r||a)&&(this._updateWorkerLayers(i,r,a),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(i),this.light&&this.light.updateTransitions(i),this.ambientLight&&this.ambientLight.updateTransitions(i),this.directionalLight&&this.directionalLight.updateTransitions(i),this.fog&&this.fog.updateTransitions(i),this.snow&&this.snow.updateTransitions(i),this.rain&&this.rain.updateTransitions(i),this._changes.reset()}let o={};for(let e in this._mergedSourceCaches){let i=this._mergedSourceCaches[e];o[e]=i.used,i.used=!1,i.tileCoverLift=0}for(let e of this._mergedOrder){let r=this._mergedLayers[e];if(r.recalculate(i,this._availableImages),!r.isHidden(i.zoom)){let e=this.getLayerSourceCache(r);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,r.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(r,i)}):this.precompilePrograms(r,i))}for(let e in this._mergedSourceCaches){let i=this._mergedSourceCaches[e];if(!i)continue;let r=i._source;"raster-array"===r.type&&r.iconsets&&(i.used=!0)}for(let i in this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&n&&this.mergeLayers(),o){let r=this._mergedSourceCaches[i];o[i]!==r.used&&r.getSource().fire(new e.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:r.getSource().id}))}this.light&&this.light.recalculate(i),this.terrain&&this.terrain.recalculate(i),this.fog&&this.fog.recalculate(i),this.snow&&this.snow.recalculate(i),this.rain&&this.rain.recalculate(i),this.z=i.zoom,this._markersNeedU
8pdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),a&&this.fire(new e.A("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=this._changes.getUpdatedImages();if(e.length){for(let i in this._mergedSourceCaches)this._mergedSourceCaches[i].reloadTilesForDependencies(["icons","patterns"],e);this._changes.resetUpdatedImages()}}_updateWorkerLayers(e,i,r){let a=this.getFragmentStyle(e);a&&this.dispatcher.broadcast("updateLayers",{layers:i?a._serializeLayers(i):[],scope:e,removedIds:r||[],options:a.options})}setState(i,r){if(this._checkLoaded(),iy(this,ef(i)))return!1;(i=e.cq(i)).layers=tl(i.layers);let a=(function(i,r){if(!i)return[{command:th.setStyle,args:[r]}];let a=[];try{if(!e.bn(i.version,r.version)||(e.bn(i.center,r.center)||a.push({command:th.setCenter,args:[r.center]}),e.bn(i.zoom,r.zoom)||a.push({command:th.setZoom,args:[r.zoom]}),e.bn(i.bearing,r.bearing)||a.push({command:th.setBearing,args:[r.bearing]}),e.bn(i.pitch,r.pitch)||a.push({command:th.setPitch,args:[r.pitch]}),e.bn(i.sprite,r.sprite)||a.push({command:th.setSprite,args:[r.sprite]}),e.bn(i.glyphs,r.glyphs)||a.push({command:th.setGlyphs,args:[r.glyphs]}),e.bn(i.imports,r.imports)||function(i=[],r=[],a){let n,o,s,l;r=r||[];let h=(i=i||[]).map(tp),u=r.map(tp),c=i.reduce(tf,{}),d=r.reduce(tf,{}),p=h.slice();for(n=0,o=0;n<h.length;n++)s=h[n],d.hasOwnProperty(s)?o++:(a.push({command:th.removeImport,args:[s]}),p.splice(p.indexOf(s,o),1));for(n=0,o=0;n<u.length;n++)s=u[u.length-1-n],p[p.length-1-n]!==s&&(c.hasOwnProperty(s)?(a.push({command:th.removeImport,args:[s]}),p.splice(p.lastIndexOf(s,p.length-o),1)):o++,l=p[p.length-n],a.push({command:th.addImport,args:[d[s],l]}),p.splice(p.length-n,0,s));for(let i of r){let r=c[i.id];r&&!e.bn(r,i)&&a.push({command:th.updateImport,args:[i.id,i]})}}(i.imports,r.imports,a),e.bn(i.transition,r.transition)||a.push({command:th.setTransition,args:[r.transition]}),e.bn(i.light,r.light)||a.push({command:th.setLight,args:[r.light]}),e.bn(i.fog,r.fog)||a.push({command:th.setFog,args:[r.fog]}),e.bn(i.snow,r.snow)||a.push({command:th.setSnow,args:[r.snow]}),e.bn(i.rain,r.rain)||a.push({command:th.setRain,args:[r.rain]}),e.bn(i.projection,r.projection)||a.push({command:th.setProjection,args:[r.projection]}),e.bn(i.lights,r.lights)||a.push({command:th.setLights,args:[r.lights]}),e.bn(i.camera,r.camera)||a.push({command:th.setCamera,args:[r.camera]}),!e.bn(i["color-theme"],r["color-theme"])))return[{command:th.setStyle,args:[r]}];let n={},o=[];!function(i,r,a,n){let o;for(o in r=r||{},i=i||{})i.hasOwnProperty(o)&&(r.hasOwnProperty(o)||tc(o,a,n));for(o in r){var s;if(!r.hasOwnProperty(o))continue;let l=r[o];i.hasOwnProperty(o)?e.bn(i[o],l)||("geojson"===i[o].type&&"geojson"===l.type&&function(i,r,a){let n;for(n in i[a])if(i[a].hasOwnProperty(n)&&"data"!==n&&!e.bn(i[a][n],r[a][n]))return!1;for(n in r[a])if(r[a].hasOwnProperty(n)&&"data"!==n&&!e.bn(i[a][n],r[a][n]))return!1;return!0}(i,r,o)?a.push({command:th.setGeoJSONSourceData,args:[o,l.data]}):(s=r,tc(o,a,n),tu(o,s,a))):tu(o,r,a)}}(i.sources,r.sources,o,n);let s=[];i.layers&&i.layers.forEach(e=>{e.source&&n[e.source]?a.push({command:th.removeLayer,args:[e.id]}):s.push(e)});let l=i.terrain;l&&n[l.source]&&(a.push({command:th.setTerrain,args:[void 0]}),l=void 0),a=a.concat(o),e.bn(l,r.terrain)||a.push({command:th.setTerrain,args:[r.terrain]}),function(i,r,a){let n,o,s,l,h,u,c;r=r||[];let d=(i=i||[]).map(tp),p=r.map(tp),f=i.reduce(tf,{}),m=r.reduce(tf,{}),_=d.slice(),g=Object.create(null);for(n=0,o=0;n<d.length;n++)s=d[n],m.hasOwnProperty(s)?o++:(a.push({command:th.removeLayer,args:[s]}),_.splice(_.indexOf(s,o),1));for(n=0,o=0;n<p.length;n++)s=p[p.length-1-n],_[_.length-1-n]!==s&&(f.hasOwnProperty(s)?(a.push({command:th.removeLayer,args:[s]}),_.splice(_.lastIndexOf(s,_.length-o),1)):o++,u=_[_.length-n],a.push({command:th.addLayer,args:[m[s],u]}),_.splice(_.length-n,0,s),g[s]=!0);for(n=0;n<p.length;n++)if(l=f[s=p[n]],h=m[s],!g[s]&&!e.bn(l,h))if(e.bn(l.source,h.source)&&e.bn(l["source-layer"],h["source-layer"])&&e.bn(l.type,h.type)){for(c in td(l.layout,h.layout,a,s,null,th.setLayoutProperty),td(l.paint,h.paint,a,s,null,th.setPaintProperty),e.bn(l.slot,h.slot)||a.push({command:th.setSlot,args:[s,h.slot]}),e.bn(l.filter,h.filter)||a.push({command:th.setFilter,args:[s,h.filter]}),e.bn(l.minzoom,h.minzoom)&&e.bn(l.maxzoom,h.maxzoom)||a.push({command:th.setLayerZoomRange,args:[s,h.minzoom,h.maxzoom]}),l)l.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&"slot"!==c&&(0===c.indexOf("paint.")?td(l[c],h[c],a,s,c.slice(6),th.setPaintProperty):e.bn(l[c],h[c])||a.push({command:th.setLayerProperty,args:[s,c,h[c]]}));for(c in h)h.hasOwnProperty(c)&&!l.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&"slot"!==c&&(0===c.indexOf("paint.")?td(l[c],h[c],a,s,c.slice(6),th.setPaintProperty):e.bn(l[c],h[c])||a.push({command:th.setLayerProperty,args:[s,c,h[c]]}))}else a.push({command:th.removeLayer,args:[s]}),u=_[_.lastIndexOf(s)+1],a.push({command:th.addLayer,args:[h,u]})}(s,r.layers,a)}catch(e){console.warn("Unable to compute style diff:",e),a=[{command:th.setStyle,args:[r]}]}return a})(this.serialize(),i).filter(e=>!(e.command in iv));if(0===a.length)return!1;let n=a.filter(e=>!(e.command in ix));if(n.length>0)throw Error(`Unimplemented: ${n.map(e=>e.command).join(", ")}.`);let o=[];
8return a.forEach(e=>{o.push(this[e.command].apply(this,e.args))}),r&&Promise.all(o).then(r),this.stylesheet=i,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}addImages(i){for(let[r,a]of i.entries()){if(this.getImage(r)&&!r.iconsetId)return this.fire(new e.z(Error(`An image with the name "${r.name}" already exists.`)));this.imageManager.addImage(r,this.scope,a),this._changes.updateImage(r)}return this._updateWorkerImages(),this.fire(new e.A("data",{dataType:"style"})),this}addImage(i,r){return this.getImage(i)&&!i.iconsetId?this.fire(new e.z(Error(`An image with the name "${i.name}" already exists.`))):(this.imageManager.addImage(i,this.scope,r),this._changes.updateImage(i),this._updateWorkerImages(),this.fire(new e.A("data",{dataType:"style"})),this)}updateImage(i,r,a=!1){this.imageManager.updateImage(i,this.scope,r),a&&(this._changes.updateImage(i),this._updateWorkerImages(),this.fire(new e.A("data",{dataType:"style"})))}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(i){return this.getImage(i)?(this.imageManager.removeImage(i,this.scope),this._changes.updateImage(i),this._updateWorkerImages(),this.fire(new e.A("data",{dataType:"style"})),this):this.fire(new e.z(Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,i,r={}){return this._checkLoaded(),this._validate(eE,`models.${e}`,i,null,r)||(this.modelManager.addModel(e,i,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(i){return this.hasModel(i)?(this.modelManager.removeModel(i,this.scope),this):this.fire(new e.z(Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(i,r,a={}){if(this._checkLoaded(),void 0!==this.getOwnSource(i))throw Error(`There is already a source with ID "${i}".`);if(!r.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(em,`sources.${i}`,r,null,a))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let n=eJ(i,r,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id}));let o=i=>{let r=(i?"symbol:":"other:")+n.id,a=e.C(r,this.scope),o=this._sourceCaches[r]=new tr(a,n,i);(i?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=o,o.onAdd(this.map)};o(!1),"vector"!==r.type&&"geojson"!==r.type||o(!0),n.onAdd&&n.onAdd(this.map),a.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(i){this._checkLoaded();let r=this.getOwnSource(i);if(!r)throw Error("There is no source with this ID");for(let r in this._layers)if(this._layers[r].source===i)return this.fire(new e.z(Error(`Source "${i}" cannot be removed while layer "${r}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===i)return this.fire(new e.z(Error(`Source "${i}" cannot be removed while terrain is using it.`)));for(let r of this.getOwnSourceCaches(i)){let i=e.cr(r.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(r.id),r.fire(new e.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:r.getSource().id})),r.setEventedParent(null),r.clearTiles()}return delete this._otherSourceCaches[i],delete this._symbolSourceCaches[i],this.mergeSources(),r.setEventedParent(null),r.onRemove&&r.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,i){this._checkLoaded(),this.getOwnSource(e).setData(i),this._changes.setDirty()}getOwnSource(e){let i=this.getOwnSourceCache(e);return i&&i.getSource()}getOwnSources(){let e=[];for(let i in this._otherSourceCaches){let r=this.getOwnSourceCache(i);r&&e.push(r.getSource())}return e}areTilesLoaded(){let e=this._mergedSourceCaches;for(let i in e){let r=e[i]._tiles;for(let e in r){let i=r[e];if("loaded"!==i.state&&"errored"!==i.state)return!1}}return!0}setLights(i){if(this._checkLoaded(),!i)return delete this.ambientLight,void delete this.directionalLight;let r=this._getTransitionParameters();
8for(let a of i){if(this._validate(eg,"lights",a))return;switch(a.type){case"ambient":if(this.ambientLight){let e=this.ambientLight;e.set(a),e.updateTransitions(r)}else this.ambientLight=new ej(a,eB||(eB=new e.a7({color:new e.a8(e.a5.properties_light_ambient.color),"color-use-theme":new e.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a8(e.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){let e=this.directionalLight;e.set(a),e.updateTransitions(r)}else this.directionalLight=new ej(a,eN||(eN=new e.a7({direction:new e.am(e.a5.properties_light_directional.direction),color:new e.a8(e.a5.properties_light_directional.color),"color-use-theme":new e.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new e.a8(e.a5.properties_light_directional.intensity),"cast-shadows":new e.a8(e.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new e.a8(e.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new e.a8(e.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}let a=new e.aa(this.z||0,r);this.ambientLight&&this.ambientLight.recalculate(a),this.directionalLight&&this.directionalLight.recalculate(a),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){let i=this.directionalLight,r=this.ambientLight;if(!i||!r)return;let a=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=i.properties.get("color").toRenderColor(null).toArray01(),o=i.properties.get("intensity"),s=i.properties.get("direction"),l=1-e.cc(s.x,s.y,s.z)[2]/90,h=a(n)*o*l,u=r.properties.get("color").toRenderColor(null).toArray01(),c=r.properties.get("intensity");return Number(((h+a(u)*c)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;let e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(i){if(!i)return this;if(e.cs(i)){let r=e.ct(i),a=this.fragments.find(({id:e})=>e===r);if(!a)throw Error(`Style import '${i}' not found`);let n=e.cr(i);return a.style.getFragmentStyle(n)}{let e=this.fragments.find(({id:e})=>e===i);return e?e.style:void 0}}setFeaturesetSelectors(i){if(!i)return;let r={},a=(e,i="")=>`${e}::${i}`;for(let n in this._featuresetSelectors={},i){let o=this._featuresetSelectors[n]=[];for(let s of i[n].selectors){let i;if(s.featureNamespace){let i=this.getOwnLayer(s.layer);if(!i){e.w(`Layer is undefined for selector: ${s.layer}`);continue}let o=a(i.source,i.sourceLayer);if(o in r&&r[o]!==s.featureNamespace){e.w(`"featureNamespace ${s.featureNamespace} of featureset ${n}'s selector is not associated to the same source, skip this selector`);continue}r[o]=s.featureNamespace}if(s.properties)for(let r in s.properties){let a=e.X(s.properties[r]);"success"===a.result&&((i=i||{})[r]=a.value)}o.push({layerId:s.layer,namespace:s.featureNamespace,properties:i,uniqueFeatureID:s._uniqueFeatureID})}}}getFeaturesetDescriptors(e){let i=this.getFragmentStyle(e);if(!i||!i.stylesheet.featuresets)return[];let r=[];for(let e in i.stylesheet.featuresets)r.push({featuresetId:e,importId:i.scope?i.scope:void 0});return r}getFeaturesetLayers(i,r){let a=this.getFragmentStyle(r),n=a.stylesheet.featuresets;if(!n||!n[i])return this.fire(new e.z(Error(`The featureset '${i}' does not exist in the map's style and cannot be queried.`))),[];let o=[];for(let e of n[i].selectors){let i=a.getOwnLayer(e.layer);i&&o.push(i)}return o}getConfigProperty(i,r){let a=this.getFragmentStyle(i);if(!a)return null;let n=e.C(r,a.scope),o=a.options.get(n),s=o?o.value||o.default:null;return s?s.serialize():null}setConfigProperty(i,r,a){let n,o=this.getFragmentStyle(i);if(!o)return;let s=o.stylesheet.indoor?ip(o.stylesheet.schema):o.stylesheet.schema;if(!s||!s[r])return;let l=e.X(a);if("success"!==l.result)return void iy(this,l.value);let h=l.value.expression,u=e.C(r,o.scope),c=o.options.get(u);if(!c)return;let{minValue:d,maxValue:p,stepValue:f,type:m,values:_}=s[r],g=e.X(s[r].default);"success"===g.result&&(n=g.value.expression),n?(this.options.set(u,Object.assign({},c,{value:h,default:n,minValue:d,maxValue:p,stepValue:f,type:m,values:_})),this.updateConfigDependencies(r)):this.fire(new e.z(Error(`No schema defined for the config option "${r}" in the "${i}" fragment.`)))}getConfig(i){let r=this.getFragmentStyle(i);if(!r)return null;let a=r.stylesheet.schema;if(!a)return null;let n={};for(let i in a){let a=e.C(i,r.scope),o=r.options.get(a),s=o?o.value||o.default:null;n[i]=s?s.serialize():null}return n}setConfig(e,i){let r=this.getFragmentStyle(e);r&&(r.updateConfig(i,r.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){let i=this.getFragmentStyle(e);return i?i.stylesheet.schema:null}setSchema(e,i){let r=this.getFragmentStyle(e);r&&(r.stylesheet.schema=i,r.updateConfig(r._config,i),this.updateConfigDependencies())}updateConfig(i,r){if(this._config=i,i||r)if(r)for(let a in r){let n,o,s=e.X(r[a].default);if("success"===s.result&&(n=s.value.expression),i&&void 0!==i[a]){let r=e.X(i[a]);"success"===r.result&&(o=r.value.expression)}let{minValue:l,maxValue:h,stepValue:u,type:c,values:d}=r[a];if(n){let i=e.C(a,this.scope);this.options.set(i,{default:n,value:o,minValue:l,maxValue:h,stepValue:u,type:c,values:d})}
8else this.fire(new e.z(Error(`No schema defined for config option "${a}".`)))}else this.fire(new e.z(Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(e){for(let i of this._configDependentLayers){let r=this.getLayer(i);if(r){if(e&&!r.configDependencies.has(e))continue;r.possiblyEvaluateVisibility(),this._updateLayer(r)}}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(e=>{let i=e._styleColorTheme.colorThemeOverride?e._styleColorTheme.colorThemeOverride:e._styleColorTheme.colorTheme;if(i){let r=e._evaluateColorThemeData(i);(!e._styleColorTheme.lut&&""!==r||e._styleColorTheme.lut&&r!==e._styleColorTheme.lut.data)&&e.setColorTheme(i)}}),this._changes.setDirty()}addLayer(i,r,a={}){let n;this._checkLoaded();let o=i.id;if(this._layers[o])return void this.fire(new e.z(Error(`Layer with i
8d "${o}" already exists on this map`)));if("custom"===i.type){if(iy(this,e.cu(i)))return;n=e.cv(i,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof i.source&&(this.addSource(o,i.source),i=e.cq(i),i=e.l(i,{source:o})),this._validate(ew,`layers.${o}`,i,{arrayIndex:-1},a))return;n=e.cv(i,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(n),n.setEventedParent(this,{layer:{id:o}})}0!==n.configDependencies.size&&this._configDependentLayers.add(n.fqid);let s=this._order.length;if(r){let i=this._order.indexOf(r);if(-1===i)return void this.fire(new e.z(Error(`Layer with id "${r}" does not exist on this map.`)));n.slot===this._layers[r].slot?s=i:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=n;let l=this.getOwnLayerSourceCache(n),h=!!this.directionalLight&&this.directionalLight.shadowsEnabled();l&&n.canCastShadows()&&h&&(l.castsShadows=!0);let u=this._changes.getRemovedLayer(n);if(u&&n.source&&l&&"custom"!==n.type){this._changes.discardLayerRemoval(n);let i=e.C(n.source,n.scope);u.type!==n.type?this._changes.updateSourceCache(i,"clear"):(this._changes.updateSourceCache(i,"reload"),l.pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map),n.scope=this.scope,this.mergeLayers()}moveLayer(i,r){this._checkLoaded();let a=this._checkLayer(i);if(!a||i===r)return;let n=this._order.indexOf(i);this._order.splice(n,1);let o=this._order.length;if(r){let i=this._order.indexOf(r);
8if(-1===i)return void this.fire(new e.z(Error(`Layer with id "${r}" does not exist on this map.`)));a.slot===this._layers[r].slot?o=i:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(o,0,i),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();let i=this._checkLayer(e);if(!i)return;i.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),delete this._layers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(i.fqid),this._changes.removeLayer(i);let a=this.getOwnLayerSourceCache(i);if(a&&a.castsShadows){let e=!1;for(let r in this._layers)if(this._layers[r].source===i.source&&this._layers[r].canCastShadows()){e=!0;break}a.castsShadows=e}i.onRemove&&i.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(let i in this._layers)if(this._layers[i].type===e)return!0;return!1}setLayerZoomRange(e,i,r){this._checkLoaded();let a=this._checkLayer(e);a&&(a.minzoom===i&&a.maxzoom===r||(null!=i&&(a.minzoom=i),null!=r&&(a.maxzoom=r),this._updateLayer(a)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,i){this._checkLoaded();let r=this._checkLayer(e);r&&r.slot!==i&&(r.slot=i,this._updateLayer(r))}setFilter(i,r,a={}){this._checkLoaded();let n=this._checkLayer(i);if(n&&!e.bn(n.filter,r))return null==r?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(eT,`layers.${n.id}.filter`,r,{layerType:n.type},a)||(n.filter=e.cq(r),this._updateLayer(n)))}getFilter(i){let r=this._checkLayer(i);if(r)return e.cq(r.filter)}setLayoutProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);if(o&&!e.bn(o.getLayoutProperty(r),a)){if(null!=a&&(!n||!1!==n.validate)&&iy(o,eM.call(ef,{key:`layers.${i}.layout.${r}`,layerType:o.type,objectKey:r,value:a,styleSpec:e.a5,style:{glyphs:!0,sprite:!0}})))return;o.setLayoutProperty(r,a),0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),this._updateLayer(o)}}getLayoutProperty(e,i){let r=this._checkLayer(e);if(r)return r.getLayoutProperty(i)}setPaintProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);if(!o||e.bn(o.getPaintProperty(r),a)||null!=a&&(!n||!1!==n.validate)&&iy(o,eS.call(ef,{key:`layers.${i}.paint.${r}`,layerType:o.type,objectKey:r,value:a,styleSpec:e.a5})))return;let s=o.setPaintProperty(r,a);0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),s&&this._updateLayer(o),this._changes.updatePaintProperties(o)}getPaintProperty(e,i){let r=this._checkLayer(e);if(r)return r.getPaintProperty(i)}setFeatureState(i,r){if(this._checkLoaded(),"target"in i){if("featuresetId"in i.target){let{featuresetId:e,importId:a}=i.target,n=this.getFragmentStyle(a);for(let{source:a,sourceLayer:o}of n.getFeaturesetLayers(e))n.setFeatureState({id:i.id,source:a,sourceLayer:o},r)}else if("layerId"in i.target){let{layerId:e}=i.target,a=this.getLayer(e);this.setFeatureState({id:i.id,source:a.source,sourceLayer:a.sourceLayer},r)}return}let a=i.source,n=i.sourceLayer,o=this._checkSource(a);if(!o)return;let s=o.type;if("geojson"===s&&n)return void this.fire(new e.z(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new e.z(Error("The sourceLayer parameter must be provided for vector source types.")));for(let o of(void 0===i.id&&this.fire(new e.z(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)))o.setFeatureState(n,i.id,r)}removeFeatureState(i,r){if(this._checkLoaded(),"target"in i){if("featuresetId"in i.target){let{featuresetId:e,importId:a}=i.target,n=this.getFragmentStyle(a);for(let{source:a,sourceLayer:o}of n.getFeaturesetLayers(e))n.removeFeatureState({id:i.id,source:a,sourceLayer:o},r)}else if("layerId"in i.target){let{layerId:e}=i.target,a=this.getLayer(e);this.removeFeatureState({id:i.id,source:a.source,sourceLayer:a.sourceLayer},r)}return}let a=i.source,n=this._checkSource(a);if(!n)return;let o=n.type,s="vector"===o?i.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new e.z(Error("The sourceLayer parameter must be provided for vector source types.")));if(r&&"string"!=typeof i.id&&"number"!=typeof i.id)return void this.fire(new e.z(Error("A feature id is required to remove its specific state property.")));for(let e of this.getOwnSourceCaches(a))e.removeFeatureState(s,i.id,r)}getFeatureState(i){if(this._checkLoaded(),"target"in i){let r;if("featuresetId"in i.target){let{featuresetId:a,importId:n}=i.target,o=this.getFragmentStyle(n);for(let{source:n,sourceLayer:s}of o.getFeaturesetLayers(a)){let a=o.getFeatureState({id:i.id,source:n,sourceLayer:s});if(a&&!r)r=a;else if(!e.bn(r,a))return void this.fire(new e.z(Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in i.target){let{layerId:e}=i.target,a=this.getLayer(e);r=this.getFeatureState({id:i.id,source:a.source,sourceLayer:a.sourceLayer})}return r}let r=i.source,a=i.sourceLayer,n=this._checkSource(r);if(n){if("vector"!==n.type||a)return void 0===i.id&&this.fire(new e.z(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(r)[0].getFeatureState(a,i.id);this.fire(new e.z(Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(i){return this.stylesheet.transition=e.l({},this.stylesheet.transition,i),this.transition=this.stylesheet.transition,this}getTransition(){return e.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();let i=this.getTerrain(),r=i&&this.terrain&&this.terrain.scope===this.scope?i:this.stylesheet.terrain;return e.cw({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:r,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,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)},e=>void 0!==e)}_updateFilteredLayers(e){for(let i of Object.values(this._mergedLayers))e(i)&&this._updateLayer(i)}_updateLayer(i){this._changes.updateLayer(i);let r=this.getLayerSourceCache(i),a=e.C(i.source,i.scope),n=this._changes.getUpd
8atedSourceCaches();i.source&&!n[a]&&r&&"raster"!==r.getSource().type&&(this._changes.updateSourceCache(a,"reload"),r.pause()),i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){let i=e=>this._mergedLayers[e].is3D(!!this.terrain),r=this.order,a={},n=[];for(let o=r.length-1;o>=0;o--){let s=r[o];if(i(s))for(let i of(a[s]=o,e)){let e=i[s];if(e)for(let i of e)n.push(i)}}n.sort((e,i)=>i.intersectionZ-e.intersectionZ);let o=[];for(let s=r.length-1;s>=0;s--){let l=r[s];if(i(l))for(let e=n.length-1;e>=0;e--){let i=n[e].feature;if(i.layer&&a[i.layer.id]<s)break;o.push(i),n.pop()}else for(let i of e){let e=i[l];if(e)for(let i of e)o.push(i.feature)}}return o}queryRenderedFeatures(i,r,a){let n;r&&!Array.isArray(r)&&r.filter&&(this._validate(eT,"queryRenderedFeatures.filter",r.filter,null,r),n=e.a_(r.filter));let o={},s=e=>{if(ib.has(e.type))return;let i=this.getOwnLayerSourceCache(e),r=o[i.id]=o[i.id]||{sourceCache:i,layers:{},has3DLayers:!1};e.is3D(!!this.terrain)&&(r.has3DLayers=!0),r.layers[e.fqid]=r.layers[e.fqid]||{styleLayer:e,targets:[]},r.layers[e.fqid].targets.push({filter:n})};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new e.z(Error("parameters.layers must be an Array."))),[];for(let i of r.layers){let r=this._layers[i];if(!r)return this.fire(new e.z(Error(`The layer '${i}' does not exist in the map's style and cannot be queried for features.`))),[];s(r)}}else for(let e in this._layers)s(this._layers[e]);let l=this._queryRenderedFeatures(i,o,a),h=this._flattenAndSortRenderedFeatures(l),u=[];for(let i of h)e.ct(i.layer.id)===this.scope&&u.push(i);return u}queryRenderedFeatureset(i,r,a){let n;r&&!Array.isArray(r)&&r.filter&&(this._validate(eT,"queryRenderedFeatures.filter",r.filter,null,r),n=e.a_(r.filter));let o="mock",s=[];if(r&&r.target)s.push(Object.assign({},r,{targetId:o,filter:n}));else{for(let e of this.getFeaturesetDescriptors())s.push({targetId:o,filter:n,target:e});for(let{style:e}of this.fragments)for(let i of e.getFeaturesetDescriptors())s.push({targetId:o,filter:n,target:i})}let l=this.queryRenderedTargets(i,s,a),h=[],u=new Set;for(let i of l)for(let r of i.variants[o])e0(r,i,u)||h.push(new e.cx(i,r));return h}queryRenderedTargets(i,r,a){let n={},o=(e,i,r,a)=>{let o=n[i.id]=n[i.id]||{sourceCache:i,layers:{},has3DLayers:!1};(o.layers[e.fqid]=o.layers[e.fqid]||{styleLayer:e,targets:[]},e.is3D(!!this.terrain)&&(o.has3DLayers=!0),a)?o.layers[e.fqid].targets.push(Object.assign({},r,{namespace:a.namespace,properties:a.properties,uniqueFeatureID:a.uniqueFeatureID})):(r.uniqueFeatureID=!1,o.layers[e.fqid].targets.push(r))};for(let i of r)if("featuresetId"in i.target){let{featuresetId:r,importId:a}=i.target,n=this.getFragmentStyle(a);if(!n||!n._featuresetSelectors)continue;let s=n._featuresetSelectors[r];if(!s){this.fire(new e.z(Error(`The featureset '${r}' does not exist in the map's style and cannot be queried for features.`)));continue}for(let e of s){let r=n.getOwnLayer(e.layerId);r&&!ib.has(r.type)&&o(r,n.getOwnLayerSourceCache(r),i,e)}}else if("layerId"in i.target){let{layerId:e}=i.target,r=this.getLayer(e);if(!r||ib.has(r.type))continue;o(r,this.getLayerSourceCache(r),i)}let s=this._queryRenderedFeatures(i,n,a);return this._flattenAndSortRenderedFeatures(s)}_queryRenderedFeatures(e,i,r){let a=[],n=!!this.map._showQueryGeometry,o=eG.createFromScreenPoints(e,r);for(let e in i){let s=function(e,i,r,a,n=!1){let o=i.sourceCache.transform,s=i.sourceCache.tilesIn(e,i.has3DLayers,n);s.sort(e1);let l=[];for(let e of s){let s=e.tile.queryRenderedFeatures(i,e,r,a,o,n);Object.keys(s).length&&l.push({wrappedTileID:e.tile.tileID.wrapped().key,queryResults:s})}return 0===l.length?{}:function(e){let i={},r={};for(let a of e){let e=a.queryResults,n=a.wrappedTileID,o=r[n]=r[n]||{};for(let r in e){let a=e[r],n=o[r]=o[r]||{},s=i[r]=i[r]||[];for(let e of a)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return i}(l)}(o,i[e],this._availableImages,r,n);Object.keys(s).length&&a.push(s)}if(this.placement)for(let e in i){if(!i[e].sourceCache._onlySymbols)continue;let r=function(e,i,r,a,n){let o={},s=a.queryRenderedSymbols(e),l=[];for(let e of Object.keys(s).map(Number))l.push(n[e]);for(let e of(l.sort(e1),l)){let a=e.featureIndex.lookupSymbolFeatures(s[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,i,r);for(let i in a){let r=o[i]=o[i]||[],n=a[i];for(let i of(n.sort((i,r)=>{let a=e.featureSortOrder;if(a){let e=a.indexOf(i.featureIndex);return a.indexOf(r.featureIndex)-e}return r.featureIndex-i.featureIndex}),n))r.push(i)}}return o}(o.screenGeometry,i[e],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData);Object.keys(r).length&&a.push(r)}return a}querySourceFeatures(e,i){let r=i&&i.filter;
8r&&this._validate(eT,"querySourceFeatures.filter",r,null,i);let a=[];for(let r of this.getOwnSourceCaches(e))a=a.concat(function(e,i){let r=e.getRenderableIds().map(i=>e.getTileByID(i)),a=[],n={};for(let e=0;e<r.length;e++){let o=r[e],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(a,i))}return a}(r,i));return a}addSourceType(e,i,r){return iS.getSourceType(e)?r(Error(`A source type called "${e}" already exists.`)):(iS.setSourceType(e,i),i.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:i.workerSourceURL},r):r(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(i,r,a={}){this._checkLoaded();let n=this.light.getLight(),o=!1;for(let r in i)if(!e.bn(i[r],n[r])){o=!0;break}if(!o)return;let s=this._getTransitionParameters();this.light.setLight(i,r,a),this.light.updateTransitions(s)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(i,r=1){if(this._checkLoaded(),!i)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===r&&delete this.terrain,null===i?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let a=i,n=null==i.source;if(1===r){if(this.disableElevatedTerrain)return;if("object"==typeof a.source){let i="terrain-dem-src";this.addSource(i,a.source),a=e.cq(a),a=e.l(a,{source:i})}let i=e.l({},a),r={};if(this.terrain&&n){i.source=this.terrain.get().source;let e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(r.style=e.serialize())}if(this._validate(ey,"terrain",i,r))return}if(this.terrain&&(this.terrain.scope===this.scope||n)&&(!this.terrain||r===this.terrain.drapeRenderMode)){let r=this.terrain,n=r.get();for(let i of Object.keys(e.a5.terrain))!a.hasOwnProperty(i)&&e.a5.terrain[i].default&&(a[i]=e.a5.terrain[i].default);for(let a in i)if(!e.bn(i[a],n[a])){r.set(i,this.options),this.stylesheet.terrain=i;let a=this._getTransitionParameters({duration:0});r.updateTransitions(a),this.fire(new e.A("data",{dataType:"style"}));break}}else{if(!a)return;this._createTerrain(a,r),this.fire(new e.A("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){let i=this.fog=new eO(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_createSnow(e){let i=this.snow=new eV(e,this.map.transform,this.scope,this.options);this.stylesheet.snow=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_createRain(e){let i=this.rain=new eU(e,this.map.transform,this.scope,this.options);this.stylesheet.rain=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let e of this.map._markers)e._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(i){if(this._checkLoaded(),!i)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){let r=this.fog;if(!e.bn(r.get(),i)){r.set(i,this.options),this.stylesheet.fog=r.get();let e=this._getTransitionParameters({duration:0});r.updateTransitions(e)}}else this._createFog(i);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(i){if(this._checkLoaded(),!i)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){let r=this.snow;if(!e.bn(r.get(),i)){r.set(i,this.options),this.stylesheet.snow=r.get();let e=this._getTransitionParameters({duration:0});r.updateTransitions(e)}}else this._createSnow(i);
8this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(i){if(this._checkLoaded(),!i)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){let r=this.rain;if(!e.bn(r.get(),i)){r.set(i,this.options),this.stylesheet.rain=r.get();let e=this._getTransitionParameters({duration:0});r.updateTransitions(e)}}else this._createRain(i);this._markersNeedUpdate=!0}_reloadColorTheme(){let i=()=>{for(let e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(let e in this._sourceCaches)this._sourceCaches[e].clearTiles()},r=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!r)return this._styleColorTheme.lut=null,void i();let a=this._evaluateColorThemeData(r);this._loadColorTheme(a).then(()=>{this.fire(new e.A("colorthemeset")),i()}).catch(i=>{e.w(`Couldn't set color theme: ${i}`)})}setColorTheme(i){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&e.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=i,this._reloadColorTheme()}setImportColorTheme(e,i){let r=this.getFragmentStyle(e);r&&(r._styleColorTheme.colorThemeOverride=i,r._reloadColorTheme())}_getTransitionParameters(i){return{now:e.q.now(),transition:e.l(this.transition,i)}}updateDrapeFirstLayers(){if(!this.terrain)return;let e=[],i=[];for(let r of this._mergedOrder)this.isLayerDraped(this._mergedLayers[r])?e.push(r):i.push(r);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...i)}_createTerrain(e,i){let r=this.terrain=new eP(e,i,this.scope,this.options);1===i&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_force3DLayerUpdate(){for(let e in this._layers){let i=this._layers[e];"fill-extrusion"===i.type&&this._updateLayer(i)}}_forceSymbolLayerUpdate(){for(let e in this._layers){let i=this._layers[e];"symbol"===i.type&&this._updateLayer(i)}}_validate(i,r,a,n,o={}){if(o&&!1===o.validate)return!1;let s=e.l({},this.serialize());return iy(this,i.call(ef,e.l({key:r,style:s,value:a,styleSpec:e.a5},n)))}_remove(){for(let i in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.cy.off("pluginStateChange",this._rtlTextPluginCallback),this._mergedLayers)this._mergedLayers[i].setEventedParent(null);for(let e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}
8clearSource(e){for(let i of this.getSourceCaches(e))i.clearTiles()}clearSources(){for(let e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}reloadSource(e){for(let i of this.getSourceCaches(e))i.resume(),i.reload()}reloadSources(){for(let e of this.getSources())e.reload&&e.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(e=>{e.modelManager.reloadModels(e.scope)})}updateSources(e){let i;for(let r in this.directionalLight&&(i=il(this.directionalLight)),this._mergedSourceCaches)this._mergedSourceCaches[r].update(e,void 0,void 0,i)}_generateCollisionBoxes(){for(let e in this._sourceCaches){let i=this._sourceCaches[e];i.resume(),i.reload()}}_updatePlacement(i,r,a,n,o,s,l=!1){let h=!1,u=!1,c={},d={};for(let i of this._mergedOrder){let a=this._mergedLayers[i];if("symbol"!==a.type)continue;let n=e.C(a.source,a.scope),o=c[n];if(!o){let e=this.getLayerSourceCache(a);if(!e)continue;let i=e.getRenderableIds(!0).map(i=>e.getTileByID(i));d[n]=i.slice(),o=c[n]=i.sort((e,i)=>i.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(i.tileID)?-1:1))}let s=this.crossTileSymbolIndex.addLayer(a,o,r.center.lng,r.projection);h=h||s}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),l=l||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.A("neworder")),(l||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.q.now(),r.zoom))&&(this.pauseablePlacement=new tW(r,this._mergedOrder,l,a,n,o,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,c,d,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.q.now()),u=!0),h&&this.pauseablePlacement.placement.setStale()),u||h){this._buildingIndex.onNewFrame(r.zoom);for(let i=0;i<this._mergedOrder.length;i++){let r=this._mergedLayers[this._mergedOrder[i]];if("symbol"!==r.type)continue;let a=this.isLayerClipped(r);this.placement.updateLayerOpacities(r,c[e.C(r.source,r.scope)],i,a?s:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.q.now())}}_releaseSymbolFadeTiles(){for(let e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}addImport(i,r){this._checkLoaded();let a=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==a.findIndex(({id:e})=>e===i.id))return void this.fire(new e.z(Error(`Import with id '${i.id}' already exists in the map's style.`)));if(!r)return a.push(i),this._loadImports([i],!0);let n=a.findIndex(({id:e})=>e===r);return -1===n&&this.fire(new e.z(Error(`Import with id "${r}" does not exist on this map.`))),this.stylesheet.imports=a.slice(0,n).concat(i).concat(a.slice(n)),this._loadImports([i],!0,r)}updateImport(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);return -1===n||("string"==typeof r?this.setImportUrl(i,r):(r.url&&r.url!==a[n].url&&this.setImportUrl(i,r.url),e.bn(r.config,a[n].config)||this.setImportConfig(i,r.config,r.data.schema),e.bn(r.data,a[n].data)||this.setImportData(i,r.data))),this}moveImport(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(e);if(-1===a)return this;let n=this.getImportIndex(i);if(-1===n)return this;let o=r[a],s=this.fragments[a];return r=r.filter(({id:i})=>i!==e),this.fragments=this.fragments.filter(({id:i})=>i!==e),this.stylesheet.imports=r.slice(0,n).concat(o).concat(r.slice(n)),this.fragments=this.fragments.slice(0,n).concat(s).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(e);if(-1===a)return this;r[a].url=i;let n=this.fragments[a];return n.style=this._createFragmentStyle(r[a]),n.style.on("style.import.load",()=>this.mergeAll()),n.style.loadURL(i),this}setImportData(e,i){this._checkLoaded();let r=this.getImportIndex(e),a=this.stylesheet.imports||[];return -1===r?this:i?(this.fragments[r].style.setState(i),this._reloadImports(),this):(delete a[r].data,this.setImportUrl(e,a[r].url))}setImportConfig(e,i,r){this._checkLoaded();let a=this.getImportIndex(e),n=this.stylesheet.imports||[];if(-1===a)return this;i?n[a].config=i:delete n[a].config;let o=this.fragments[a];r&&o.style.stylesheet&&(o.style.stylesheet.schema=r);let s=o.style.stylesheet&&o.style.stylesheet.schema;return o.config=i,o.style.updateConfig(i,s),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();let i=this.stylesheet.imports||[],r=this.getImportIndex(e);-1!==r&&(i.splice(r,1),this.fragments[r].style._remove(),this.fragments.splice(r,1),this._reloadImports())}getImportIndex(i){let r=(this.stylesheet.imports||[]).findIndex(e=>e.id===i);return -1===r&&this.fire(new e.z(Error(`Import '${i}' does not exist in the map's style and cannot be updated.`))),r}getLayer(e){return this._mergedLayers[e]}getSources(){let e=[];for(let i in this._mergedOtherSourceCaches){let r=this._mergedOtherSourceCaches[i];r&&e.push(r.getSource())}return e}getSource(e,i){let r=this.getSourceCache(e,i);return r&&r.getSource()}getLayerSource(e){let i=this.getLayerSourceCache(e);return i&&i.getSource()}getSourceCache(i,r){let a=e.C(i,r);return this._mergedOtherSourceCaches[a]}getLayerSourceCache(i){let r=e.C(i.source,i.scope);return"symbol"===i.type?this._mergedSymbolSourceCaches[r]:this._mergedOtherSourceCaches[r]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);let i=[];return this._mergedOtherSourceCaches[e]&&i.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&i.push(this._mergedSymbolSourceCaches[e]),i}
8updateSourceCaches(){let e=this._changes.getUpdatedSourceCaches();for(let i in e){let r=e[i];"reload"===r?this.reloadSource(i):"clear"===r&&this.clearSource(i)}}updateLayers(e){for(let i of this._changes.getUpdatedPaintProperties()){let r=this.getLayer(i);r&&r.updateTransitions(e)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(e){this.stylesheet.glyphs=e,this.glyphManager.setURL(e,this.scope)}getImages(i,r,a){this.imageManager.getImages(r.images,r.scope,a),this._updateTilesForChangedImages();let n=i=>{if(i){let a=r.images.map(i=>e.I.toString(i));i.setDependencies(r.tileID.key,r.type,a)}},o=e.C(r.source,r.scope);n(this._mergedOtherSourceCaches[o]),n(this._mergedSymbolSourceCaches[o])}rasterizeImages(e,i,r){this.imageManager.rasterizeImages(i,r)}getGlyphs(e,i,r){this.glyphManager.getGlyphs(i.stacks,i.scope,r)}getResource(i,r,a){return e.cz(r,a)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){let i=[];return this._otherSourceCaches[e]&&i.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&i.push(this._symbolSourceCaches[e]),i}_isSourceCacheLoaded(i){let r=this.getOwnSourceCaches(i);return 0===r.length?(this.fire(new e.z(Error(`There is no source with ID '${i}'`))),!1):r.every(e=>e.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,i){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type)return!1;let r="fill-extrusion"===e.type&&"building"===e.sourceLayer;if(e.is3D(!!this.terrain)){if(r||i&&"batched-model"===i.type||"model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(e=>{e.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}iS.getSourceType=function(e){return eK[e]},iS.setSourceType=function(e,i){eK[e]=i},iS.registerForPluginStateChange=e.ci;var iM="\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",iE="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\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,high
8p vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",iA="\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);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}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(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",iI="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",iC="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}
8float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
8size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;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//DEPTH_OCCLUSION",iP="#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",iz="#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;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;}
8vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",iD="#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);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\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",iR="#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;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\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;}",iL="#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];}
8\n#endif//RENDER_SHADOWS",iO="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform 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 float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef TEXTURE_GATHER\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return clamp(mix(lerpx.x,lerpx.y,f.y),0.0,1.0);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz/=light_view_pos0.w;vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";let ik=[];iU(iM,ik),iU(iA,ik),iU(iE,ik);let iF={"_prelude_fog.vertex.glsl":iP,"_prelude_terrain.vertex.glsl":iC,"_prelude_shadow.vertex.glsl":iL,"_prelude_fog.fragment.glsl":iz,"_prelude_shadow.fragment.glsl":iO,"_prelude_lighting.glsl":"\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
8));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//LIGHTING_3D_MODE","_prelude_raster_array.glsl":iD,"_prelude_raster_particle.glsl":iR},iB={};ij("",iC),ij(iz,iP),ij(iO,iL),ij(iD,""),ij(iR,"");let iN=ij(iE,iA);var iV={background:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\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;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\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(a_pos);\n#endif\n}'),backgroundPattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef 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 vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:ij('#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);
8float 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 vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 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,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),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(void) {\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=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;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(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);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);
8\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);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:ij("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:ij('#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_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 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(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(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(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=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=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:ij("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);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:ij("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 vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 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;out float v_placed;out float v_notUsed;void main() {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(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),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+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:ij("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 vec2 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;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));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=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:ij("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 vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),elevatedStructuresDepth:ij("void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=vec4(0.);\n#endif\n}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:ij("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}","in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}"),elevatedStructures:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvoid main() {vec3 color=vec3(241.0/255.0,236.0/255.0,225.0/255.0);\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);\n#ifdef RENDER_SHADOWS\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#else\ncolor=apply_lighting(color,normal);\n#endif\nif (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\nglFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;in float a_height;in vec3 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\nvoid main() {v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(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(v_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);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fill:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\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(a_pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\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);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);\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 vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);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(a_pos);\n#endif\n}'),fillOutlinePattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=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 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);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);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\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 vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);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,a_pos);v_pos_world=(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(a_pos);\n#endif\n}'),fillPattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=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 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);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*opacity;\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_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\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 vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\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(a_pos);\n#endif\n}'),fillExtrusion:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radiu
8s;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,h);\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"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 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;out 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_radiu
8s;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() {\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 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.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.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=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);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? 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;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=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#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.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_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_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)));}
8\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.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.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}'),fillExtrusionDepth:ij("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.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 vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 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\nout highp float v_depth;void main() {\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 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;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=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);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? 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\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_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);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\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\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 vec4 pattern\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 vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=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 LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
8),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 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 vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\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 vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=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.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=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);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? 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(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=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\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
8\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:ij('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\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 vec2 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(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:ij("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\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\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
8\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;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=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=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:ij("precision highp float;uniform 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 vec2 a_pos;in vec2 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=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\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 lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat 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);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
8float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_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\nfloat edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\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*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\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_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec3 a_z_offset_width;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\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 highp 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 float v_gamma_scale;out highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 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 lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 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 lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\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=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\noffset=-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);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;
8vec4 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;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_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+a_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+a_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=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),0.001);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nuniform float u_emissive_strength;\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=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 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,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset > 0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec3 a_z_offset_width;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\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 vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\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=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_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;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_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+a_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+a_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/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\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);
8\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 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#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 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;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\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);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);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=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;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)));}float tiles=u_grid_matrix[0][2];
8if (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);}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\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\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 RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:ij('#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),0.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 vec2 a_pos;in vec2 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=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:ij("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 float 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(a_index,u_particle_texture_side_len),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:ij("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 vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:ij('#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;
8vec2 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 vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:ij('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#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#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\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;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],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=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(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+(u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#else\nz+=u_pitch_with_map ? (u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\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);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#endif\n}'),terrainRaster:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in 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=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\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 vec2 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;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:ij("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:ij('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
8nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',iI),skyboxGradient:ij('#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}',iI),skyboxCapture:ij
vendor: 3,803 bytes, line 8
8("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
8Raster:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform 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;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\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:ij('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
8vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:ij('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
8Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=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_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=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_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
8Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
8y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
8\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:ij("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
8rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:ij("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_fade_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_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:ij("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);simPosLocal.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:ij("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;
8pos*=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:ij("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:ij("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 iU(e,i){for(let r of e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n"))if("#"===(r=r.trim())[0]&&r.includes("if")&&!r.includes("endif"))for(let e of(r=r.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim()).split(" "))i.includes(e)||i.push(e)}function ij(e,i){let r=/#include\s+"([^"]+)"/g,a=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,n=i.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&&(n=[...new Set(n=n.map(e=>{let i=e.split(" ");return i[i.length-1]}))]);let o={},s=[],l=[];if(e=e.replace(r,(e,i)=>(l.push(i),"")),(i=i.replace(r,(e,i)=>(s.push(i),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let h=[...ik];for(let r of(iU(e,h),iU(i,h),[...s,...l]))iF[r]||console.error(`Undefined include: ${r}`),iB[r]||(iB[r]=[],iU(iF[r],iB[r])),h=[...h,...iB[r]];return{fragmentSource:e=e.replace(a,(e,i,r,a,n)=>(o[n]=!0,"define"===i?` 9#ifndef HAS_UNIFORM_u_${n} 10in ${r} ${a} ${n}; 11#else 12uniform ${r} ${a} u_${n}; 13#endif 14`:"initialize"===i?` 15#ifdef HAS_UNIFORM_u_${n} 16 ${r} ${a} ${n} = u_${n}; 17#endif 18`:"define-attribute"===i?` 19#ifdef HAS_ATTRIBUTE_a_${n} 20 in ${r} ${a} ${n}; 21#endif 22`:"initialize-attribute"===i?"":void 0)),vertexSource:i=i.replace(a,(e,i,r,a,n)=>{let s="float"===a?"vec2":a,l=n.match(/color/)?"color":s;return"define-attribute-vertex-shader-only"===i?` 23#ifdef HAS_ATTRIBUTE_a_${n} 24in ${r} ${a} a_${n}; 25#endif 26`:o[n]?"define"===i?` 27#ifndef HAS_UNIFORM_u_${n} 28uniform lowp float u_${n}_t; 29in ${r} ${s} a_${n}; 30out ${r} ${a} ${n}; 31#else 32uniform ${r} ${a} u_${n}; 33#endif 34`:"initialize"===i?"vec4"===l?` 35#ifndef HAS_UNIFORM_u_${n} 36 ${n} = a_${n}; 37#else 38 ${r} ${a} ${n} = u_${n}; 39#endif 40`:` 41#ifndef HAS_UNIFORM_u_${n} 42 ${n} = unpack_mix_${l}(a_${n}, u_${n}_t); 43#else 44 ${r} ${a} ${n} = u_${n}; 45#endif 46`:"define-attribute"===i?` 47#ifdef HAS_ATTRIBUTE_a_${n} 48 in ${r} ${a} a_${n}; 49 out ${r} ${a} ${n}; 50#endif 51`:"initialize-attribute"===i?` 52#ifdef HAS_ATTRIBUTE_a_${n} 53 ${n} = a_${n}; 54#endif 55`:void 0:"define"===i?` 56#ifndef HAS_UNIFORM_u_${n} 57uniform lowp float u_${n}_t; 58in ${r} ${s} a_${n}; 59#else 60uniform ${r} ${a} u_${n}; 61#endif 62`:"define-instanced"===i?"mat4"===l?` 63#ifdef INSTANCED_ARRAYS 64in vec4 a_${n}0; 65in vec4 a_${n}1; 66in vec4 a_${n}2; 67in vec4 a_${n}3; 68#else 69uniform ${r} ${a} u_${n}; 70#endif 71`:` 72#ifdef INSTANCED_ARRAYS 73in ${r} ${s} a_${n}; 74#else 75uniform ${r} ${a} u_${n}; 76#endif 77`:"initialize-attribute-custom"===i?` 78#ifdef HAS_ATTRIBUTE_a_${n} 79 ${r} ${a} ${n} = a_${n}; 80#endif 81`:"vec4"===l?` 82#ifndef HAS_UNIFORM_u_${n} 83 ${r} ${a} ${n} = a_${n}; 84#else 85 ${r} ${a} ${n} = u_${n}; 86#endif 87`:` 88#ifndef HAS_UNIFORM_u_${n} 89 ${r} ${a} ${n} = unpack_mix_${l}(a_${n}, u_${n}_t); 90#else 91 ${r} ${a} ${n} = u_${n}; 92#endif 93`}),staticAttributes:n,usedDefines:h,vertexIncludes:s,fragmentIncludes:l}}class iG{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,i,r,a,n,o,s,l){this.context=e;let h=this.boundPaintVertexBuffers.length!==a.length;for(let e=0;!h&&e<a.length;e++)this.boundPaintVertexBuffers[e]!==a[e]&&(h=!0);let u=this.boundDynamicVertexBuffers.length!==s.length;for(let e=0;!u&&e<s.length;e++)this.boundDynamicVertexBuffers[e]!==s[e]&&(u=!0);if(!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||h||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==o)this.freshBind(i,r,a,n,o,s,l);else{for(let r of(e.bindVertexArrayOES.set(this.vao),s))r&&(r.bind(),l&&r.instanceCount&&r.setVertexAttribDivisor(e.gl,i,l));n&&n.dynamicDraw&&n.bind()}}freshBind(e,i,r,a,n,o,s){let l=e.numAttributes,h=this.context,u=h.gl;for(let s of(this.vao&&this.destroy(),this.vao=h.gl.createVertexArray(),h.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=a,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=o,i.enableAttributes(u,e),i.bind(),i.setVertexAttribPointers(u,e,n),r))s.enableAttributes(u,e),s.bind(),s.setVertexAttribPointers(u,e,n);for(let i of o)i&&(i.enableAttributes(u,e),i.bind(),i.setVertexAttribPointers(u,e,n),s&&i.instanceCount&&i.setVertexAttribDivisor(u,e,s));a&&a.bind(),h.currentNumAttributes=l}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function iq(i,r,a){if(!r.needsDEMTextureUpload)return;let n=i.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||i.getTileTexture(a.stride);let s=a.getPixels();r.demTexture?r.demTexture.update(s,{premultiply:!1}):r.demTexture=new e.T(n,s,o.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}class iZ{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class iH extends iZ{getDefault(){return e.al.transparent}set(e){let i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class i$ extends iZ{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class iW extends iZ{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}
93class iX extends iZ{getDefault(){return[!0,!0,!0,!0]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class iY extends iZ{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class iK extends iZ{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class iJ extends iZ{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class iQ extends iZ{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class i0 extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class i1 extends iZ{getDefault(){return[0,1]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class i2 extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class i3 extends iZ{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class i4 extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class i5 extends iZ{getDefault(){let e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class i6 extends iZ{getDefault(){return e.al.transparent}set(e){let i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class i8 extends iZ{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class i9 extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class i7 extends iZ{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class re extends iZ{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let rt=class extends iZ{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class ri extends iZ{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class rr extends iZ{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ra extends iZ{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class rn extends iZ{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ro extends iZ{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class rs extends iZ{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class rl extends iZ{getDefault(){return null}set(e){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class rh extends iZ{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class ru extends iZ{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class rc extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class rd extends iZ{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class rp extends iZ{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class rf extends rp{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class rm extends rp{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,this.attachment(),i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class r_ extends rp{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,this.attachment(),i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class rg extends rm{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}let ry=(e,i,r)=>({u_matrix:e,u_image0:0,u_skirt_height:i,u_ground_shadow_factor:r}),rx=(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:i,u_normalize_matrix:Float32Array.from(a),u_merc_matrix:r,u_zoom_transition:n,u_merc_center:o,u_image0:0,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_grid_matrix:_?Float32Array.from(_):new Float32Array(9),u_skirt_height:f,u_far_z_cutoff:m});function rv(e,i){return null!=e&&null!=i&&!(!e.hasData()||!i.hasData())&&null!=e.demTexture&&null!=i.demTexture&&e.tileID.key!==i.tileID.key}let rb=new class{constructor(){this.operations={}}newMorphing(e,i,r,a,n){if(e in this.operations){let i=this.operations[e];i.to.tileID.key!==r.tileID.key&&(i.queued=r)}else this.operations[e]={startTime:a,phase:0,duration:n,from:i,to:r,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;let i=this.operations[e];return{from:i.from,to:i.to,phase:i.phase}}update(e){for(let i in this.operations){let r=this.operations[i];for(r.phase=(e-r.startTime)/r.duration;r.phase>
93=1||!this._validOp(r);)if(!this._nextOp(r,e)){delete this.operations[i];break}}}_nextOp(e,i){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=i,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},rw={0:null,1:"TERRAIN_VERTEX_MORPHING"};function rT(e,i,r){return 0===i?0:6*Math.pow(1.5,22-e)*Math.max(i,1)*(i<1&&514===r?.25/i:1)}let rS=e=>({u_matrix:e});function rM(i,r,a,n,o){if(o>0){let s=e.q.now(),l=(s-i.timeAdded)/o,h=r?(s-r.timeAdded)/o:-1,u=a.getSource(),c=n.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),d=!r||Math.abs(r.tileID.overscaledZ-c)>Math.abs(i.tileID.overscaledZ-c),p=d&&i.refreshedUponExpiration?1:e.ay(d?l:1-h,0,1);return i.refreshedUponExpiration&&l>=1&&(i.refreshedUponExpiration=!1),r?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}class rE extends tr{constructor(i){const r=eJ("mock-dem",{type:"raster-dem",maxzoom:i.transform.maxZoom},new e.D(e.cj(),null),i.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,i){e.state="loaded",i(null)}}class rA extends tr{constructor(i){const r=eJ("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new e.D(e.cj(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,i,r){if(e.freezeTileCoverage)return;this.transform=e;let a=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((i,r)=>{if(i[r.key]="",!this._tiles[r.key]){let i=new e7(r,this._source.tileSize*r.overscaleFactor(),e.tileZoom);i.state="loaded",this._tiles[r.key]=i}return i},{});for(let e in this._tiles)e in a||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){let i=this.proxyCachedFBO[e];if(void 0!==i){let r=Object.values(i);this.renderCachePool.push(...r),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach(e=>e.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class rI extends e.aH{constructor(e,i,r){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=i,this.projMatrix=r}}class rC extends e.cK{constructor(i,r){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},i.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=i,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[a,n,o]=function(){let i=new e.b5,r=new e.aV;i.reserve(17161),r.reserve(33800);let a=e.ai/128,n=e.ai+a/2,o=n+a;for(let r=-a;r<o;r+=a)for(let s=-a;s<o;s+=a){let a=24575*(s<0||s>n||r<0||r>n),o=e.ay(Math.round(s),0,e.ai),l=e.ay(Math.round(r),0,e.ai);i.emplaceBack(o+a,l)}let s=(e,i)=>{let a=131*i+e;r.emplaceBack(a+1,a,a+131),r.emplaceBack(a+131,a+131+1,a+1)};for(let e=1;e<129;e++)for(let i=1;i<129;i++)s(i,e);return[0,129].forEach(e=>{for(let i=0;i<130;i++)s(i,e),s(e,i)}),[i,r,32768]}(),s=i.context;this.gridBuffer=s.createVertexBuffer(a,e.b7.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.b8.simpleSegment(0,0,a.length,n.length),this.gridNoSkirtSegments=e.b8.simpleSegment(0,0,a.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new rA(r.map),this.orthoMatrix=e.ad.mat4.create(),e.ad.mat4.ortho(this.orthoMatrix,.015*("globe"===this.painter.transform.projection.name),e.ai,0,e.ai,0,1);const l=s.gl;this._overlapStencilMode=new t2({func:l.GEQUAL,mask:255},0,255,l.KEEP,l.KEEP,l.REPLACE),this._previousZoom=i.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=r,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new rE(r.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(i,r,a){if(i&&i.terrain){this._style!==i&&(this.style=i,this._evaluationZoom=void 0);let n=i.terrain.properties,o=0===i.terrain.drapeRenderMode,s=i.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.q.now();let l=i.terrain&&i.terrain.scope,h=n.get("source"),u=o?this._mockSourceCache:i.getSourceCache(h,l);if(!u)return void e.w(`Couldn't find terrain source "${h}".`);if(this.sourceCache=u,this._attenuationRange=i.terrain.getAttenuationRange(),this._exaggeration=s?this.calculateExaggeration(r):n.get("exaggeration"),!r.projection.requiresDraping&&s&&0===this._exaggeration)return void this._disable();this.enabled=!0;let c=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 94This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let i=this.getScaledDemTileSize();this.sourceCache.update(r,i,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,c(),this._initializing=!0),c(),r.updateElevation(!0,a),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(r),this._emptyDEMTextureDirty=!0,this._previousZoom=r.zoom}else this._disable()}calculateExaggeration(i){if(this._attenuationRange&&i.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(i.zoom);let r=this._previousCameraAltitude,a=i.getFreeCameraOptions().position.z/i.pixelsPerMeter*i.worldSize;this._previousCameraAltitude=a;let n=null!=r?a-r:Number.MAX_VALUE;if(2>Math.abs(n))return this._exaggeration;let o=i.zoom,s=this._style.terrain;if(!this._previousUpdateTimestamp)return s.getExaggeration(o);let l=o-this._previousZoom,h=this._previousUpdateTimestamp,u=o;null!=this._evaluationZoom&&(Math.abs(o-(u=this._evaluationZoom))>.5&&(l=.5*(o-u+l)),l*n<0&&(u+=l)),this._evaluationZoom=u;let c=s.getExaggeration(u),d=c===s.getExaggeration(Math.max(0,u-.1));if(d&&.01>Math.abs(c-this._exaggeration))return c;
94let p=Math.min(.1,.00375*(this._updateTimestamp-h));return(d||c<.1||1e-4>Math.abs(l))&&(p=Math.min(.2,4*p)),e.ah(this._exaggeration,c,p)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.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 e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(e=>e.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 e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(i){var r;let a,n;if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let o=this.proxySourceCache,s=this.painter.transform;this._initializing&&(this._initializing=0===s._centerAltitude&&-1===this.getAtPointOrZero(e.ac.fromLngLat(s.center),-1),this._emptyDEMTextureDirty=!this._initializing);let l=this.proxyCoords=o.getIds().map(e=>{let i=o.getTileByID(e).tileID;return i.projMatrix=s.calculateProjMatrix(i.toUnwrapped()),i});a=(r=this.painter).transform.pointCoordinate(r.transform.getCameraPoint()),n=new e.P(a.x,a.y),l.sort((i,r)=>{if(r.overscaledZ-i.overscaledZ)return r.overscaledZ-i.overscaledZ;let a=new e.P(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),o=new e.P(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),s=n.mult(1<<i.canonical.z);return s.x-=.5,s.y-=.5,s.distSqr(a)-s.distSqr(o)});let h=this.proxyToSource||{};this.proxyToSource={},l.forEach(e=>{this.proxyToSource[e.key]={}}),this.terrainTileForTile={};let u=this._style._mergedSourceCaches;for(let e in u){let r=u[e];if(!r.used||(r!==this.sourceCache&&this.resetTileLookupCache(r.id),this._setupProxiedCoordsForOrtho(r,i[e],h),r.usedForTerrain))continue;let a=i[e];r.getSource().reparseOverscaled&&this._assignTerrainTiles(a)}this.proxiedCoords[o.id]=l.map(e=>new rI(e,e.key,this.orthoMatrix)),this._assignTerrainTiles(l),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(h),this.renderingToTexture=!1;let c={};for(let e of(this._visibleDemTiles=[],this.proxyCoords)){let i=this.terrainTileForTile[e.key];if(!i)continue;let r=i.tileID.key;r in c||(this._visibleDemTiles.push(i),c[r]=r)}}_assignTerrainTiles(e){this._initializing||e.forEach(e=>{if(this.terrainTileForTile[e.key])return;let i=this._findTileCoveringTileID(e,this.sourceCache);i&&(this.terrainTileForTile[e.key]=i)})}_prepareDEMTextures(){let e=this.painter.context,i=e.gl;for(let r in this.terrainTileForTile){let a=this.terrainTileForTile[r],n=a.dem;n&&(!a.demTexture||a.needsDEMTextureUpload)&&(e.activeTexture.set(i.TEXTURE1),iq(this.painter,a,n))}}_prepareDemTileUniforms(e,i,r,a){if(!i||null==i.demTexture)return!1;let n=e.tileID.canonical,o=Math.pow(2,i.tileID.canonical.z-n.z),s=a||"";return r[`u_dem_tl${s}`]=[n.x*o%1,n.y*o%1],r[`u_dem_scale${s}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0,i=this._visibleDemTiles.reduce((i,r)=>{if(!r.dem)return i;let a=r.dem.tree.minimums[0];return a>0&&e++,i+a},0);return e?i/e:0}_updateEmptyDEMTexture(){let i=this.painter.context,r=i.gl;i.activeTexture.set(r.TEXTURE2);let a=this._getLoadedAreaMinimum(),n=new e.cL({width:1,height:1},new Float32Array([a]));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(n,{premultiply:!1}):o=this._emptyDEMTexture=new e.T(i,n,r.R32F,{premultiply:!1}),o}setupElevationDraw(i,r,a){var n;let o=this.painter.context,s=o.gl,l={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};l.u_exaggeration=this.exaggeration();let h=null,u=null,c=1;if(a&&a.morphing&&this._useVertexMorphing){let e=a.morphing.srcDemTile,r=a.morphing.dstDemTile;
94c=a.morphing.phase,e&&r&&(this._prepareDemTileUniforms(i,e,l,"_prev")&&(u=e),this._prepareDemTileUniforms(i,r,l)&&(h=r))}let d=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?s.LINEAR:s.NEAREST,p=null;if(this.enabled?u&&h?(p=h.demTexture,o.activeTexture.set(s.TEXTURE4),u.demTexture.bind(d(u),s.CLAMP_TO_EDGE),l.u_dem_lerp=c):(h=this.terrainTileForTile[i.tileID.key],p=this._prepareDemTileUniforms(i,h,l)?h.demTexture:this.emptyDEMTexture):p=this.emptyDEMTexture,o.activeTexture.set(s.TEXTURE2),p&&(l.u_dem_size=1===(n=p).size[0]?1:n.size[0]-2,p.bind(d(h),s.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(a&&a.useDepthForOcclusion,r,l),a&&a.useMeterToDem&&h&&(l.u_meter_to_dem=(1<<h.tileID.canonical.z)*e.bH(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize),a&&a.labelPlaneMatrixInv&&(l.u_label_plane_matrix_inv=a.labelPlaneMatrixInv),r.setTerrainUniformValues(o,l),"globe"===this.painter.transform.projection.name){let e=this.globeUniformValues(this.painter.transform,i.tileID.canonical,a&&a.useDenormalizedUpVectorScale);r.setGlobeUniformValues(o,e)}}globeUniformValues(i,r,a){let n=i.projection;return{u_tile_tl_up:n.upVector(r,0,0),u_tile_tr_up:n.upVector(r,e.ai,0),u_tile_br_up:n.upVector(r,e.ai,e.ai),u_tile_bl_up:n.upVector(r,0,e.ai),u_tile_up_scale:a?e.cM(1):n.upVectorScale(r,i.center.lat,i.worldSize).metersToTile}}renderToBackBuffer(i){let r=this.painter,a=this.painter.context;0!==i.length&&(a.bindFramebuffer.set(null),a.viewport.set([0,0,r.width,r.height]),r.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(i,r,a,n,o){if("globe"===i.transform.projection.name)!function(i,r,a,n,o){let s,l,h=i.context,u=h.gl,c=i.transform,d=e.cD(i,h,c),p=(e,r)=>{if(l===r)return;let a=[rw[r],"PROJECTION_GLOBE_VIEW"];d&&a.push("CUSTOM_ANTIALIASING");let n=i.isTileAffectedByFog(e);s=i.getOrCreateProgram("globeRaster",{defines:a,overrideFog:n}),l=r},f=i.colorModeForRenderPass(),m=new t1(u.LEQUAL,t1.ReadWrite,i.depthRangeFor3D);rb.update(o);let _=e.cE(c),g=[e.av(c.center.lng),e.aC(c.center.lat)],y=i.globeSharedBuffers,x=[c.width*e.q.devicePixelRatio,c.height*e.q.devicePixelRatio],v=Float32Array.from(c.globeMatrix),b={useDenormalizedUpVectorScale:!0};{let c=i.transform,d=rT(c.zoom,r.exaggeration(),r.sourceCache._source.tileSize);l=-1;let w=u.TRIANGLES;for(let l of n){let n=a.getTile(l),T=t2.disabled,S=r.prevTerrainTileForTile[l.key],M=r.terrainTileForTile[l.key];rv(S,M)&&rb.newMorphing(l.key,S,M,o,250),h.activeTexture.set(u.TEXTURE0),n.texture&&n.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let E=rb.getMorphValuesForProxy(l.key),A=+!!E;E&&e.L(b,{morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:e.cC(E.phase)}});let I=e.cF(l.canonical),C=e.cG(I.getCenter().lat),P=e.cH(l.canonical,I,C,c.worldSize/c._pixelsPerMercatorPixel),z=e.bc(e.cI(l.canonical)),D=rx(c.expandedFarZProjMatrix,v,_,z,e.ag(c.zoom),g,c.frustumCorners.TL,c.frustumCorners.TR,c.frustumCorners.BR,c.frustumCorners.BL,c.globeCenterInViewSpace,c.globeRadius,x,d,c._farZ,P);if(p(l,A),s&&(r.setupElevationDraw(n,s,b),i.uploadCommonUniforms(h,s,l.toUnwrapped()),y)){let[e,r,a]=y.getGridBuffers(C,0!==d);s.draw(i,w,m,T,f,t3.backCCW,D,"globe_raster",e,r,a)}}}if(y&&(i.renderDefaultNorthPole||i.renderDefaultSouthPole)){let o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let l of(d&&o.push("CUSTOM_ANTIALIASING"),s=i.getOrCreateProgram("globeRaster",{defines:o}),n)){let{x:n,y:o,z:d}=l.canonical,p=0===o,_=o===(1<<d)-1,[v,w,T,S]=y.getPoleBuffers(d,!1);if(S&&(p||_)){let o=a.getTile(l);h.activeTexture.set(u.TEXTURE0),o.texture&&o.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let y=e.cJ(d,n,c),M=e.bc(e.cI(l.canonical)),E=(e,r)=>e.draw(i,u.TRIANGLES,m,t2.disabled,f,t3.disabled,rx(c.expandedFarZProjMatrix,y,y,M,0,g,c.frustumCorners.TL,c.frustumCorners.TR,c.frustumCorners.BR,c.frustumCorners.BL,c.globeCenterInViewSpace,c.globeRadius,x,0,c._farZ),"globe_pole_raster",r,T,S);r.setupElevationDraw(o,s,b),i.uploadCommonUniforms(h,s,l.toUnwrapped()),p&&i.renderDefaultNorthPole&&E(s,v),_&&i.renderDefaultSouthPole&&(y=e.ad.mat4.scale(e.ad.mat4.create(),y,[1,-1,1]),E(s,w))}}}}(i,r,a,n,o);else{let s,l,h=i.context,u=h.gl,c=i.shadowRenderer,d=it(i,i.longestCutoffRange),p=e=>{if(l===e)return;let r=[];r.push(rw[e]),d.shouldRenderCutoff&&r.push("RENDER_CUTOFF"),c&&(r.push("RENDER_SHADOWS","DEPTH_TEXTURE"),c.useNormalOffset&&r.push("NORMAL_OFFSET")),s=i.getOrCreateProgram("terrainRaster",{defines:r}),l=e},f=i.colorModeForRenderPass(),m=new t1(u.LEQUAL,t1.ReadWrite,i.depthRangeFor3D);rb.update(o);let _=i.transform,g=rT(_.zoom,r.exaggeration(),r.sourceCache._source.tileSize),y=[0,0,0];if(c){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(y=ih(i.style,e,r))}{l=-1;let x=u.TRIANGLES,[v,b]=[r.gridIndexBuffer,r.gridSegments];for(let l of n){let n,w=a.getTile(l),T=t2.disabled,S=r.prevTerrainTileForTile[l.key],M=r.terrainTileForTile[l.key];rv(S,M)&&rb.newMorphing(l.key,S,M,o,250),h.activeTexture.set(u.TEXTURE0),w.texture&&w.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let E=rb.getMorphValuesForProxy(l.key),A=+!!E;E&&(n={morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:e.cC(E.phase)}});let I=ry(l.projMatrix,!function(e,i){let r=1<<e.z;return!i&&(0===e.x||e.x===r-1)||0===e.y||e.y===r-1}(l.canonical,_.renderWorldCopies)?g:g/10,y);if(p(A),!s)continue;r.setupElevationDraw(w,s,n);let C=l.toUnwrapped();c&&c.setupShadows(C,s),i.uploadCommonUniforms(h,s,C,null,d),s.draw(i,x,m,T,f,t3.backCCW,I,"terrain_raster",r.gridBuffer,v,b)}}}}(r,this,this.proxySourceCache,i,this._updateTimestamp),this.renderingToTexture=!0,r.gpuTimingDeferredRenderEnd(),i.splice(0,i.length))}renderBatch(i){if(0===this._drapedRenderBatches.length)return i+1;this.renderingToTexture=!0;let r=this.painter,a=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),l=r.style.order,h=[],u=0;for(let c of o){let o,d=n.getTileByID(c.proxyTileKey),p=n.proxyCachedFBO[c.key]?n.proxyCachedFBO[c.key][i]:void 0,f=void 0!==p?n.renderCache[p]:this.pool[u++],m=void 0!==p;if(d.texture=f.tex,m&&!f.dirty){h.push(d.tileID);continue}a.bindFramebuffer.set(f.fb.framebuffer),this.renderedToTile=!1,f.dirty&&(a.clear({color:e.al.transparent,stencil:0}),f.dirty=!1);for(let e=s.start;e<=s.end;++e){let i=r.style._mergedLayers[l[e]];if(i.isHidden(r.transform.zoom))continue;let n=r.style.getLayerSourceCache(i),s=n?this.proxyToSource[c.key][n.id]:[c];s&&(a.viewport.set([0,0,f.fb.width,f.fb.height]),o!==(n?n.id:null)&&(this._setupStencil(f,s,i,n),o=n?n.id:null),r.renderLayer(r,n,i,s)
94)}if(0===this._drapedRenderBatches.length)for(let e of this._pendingGroundEffectLayers){let i=r.style._mergedLayers[l[e]];if(i.isHidden(r.transform.zoom))continue;let n=r.style.getLayerSourceCache(i),s=n?this.proxyToSource[c.key][n.id]:[c];s&&(a.viewport.set([0,0,f.fb.width,f.fb.height]),o!==(n?n.id:null)&&(this._setupStencil(f,s,i,n),o=n?n.id:null),r.renderLayer(r,n,i,s))}this.renderedToTile?(f.dirty=!0,h.push(d.tileID)):m||--u,5===u&&(u=0,this.renderToBackBuffer(h))}return this.renderToBackBuffer(h),this.renderingToTexture=!1,a.bindFramebuffer.set(null),a.viewport.set([0,0,r.width,r.height]),s.end+1}postRender(){}isLayerOrderingCorrect(e){let i=e.order.length,r=-1,a=i;for(let n=0;n<i;++n)this._style.isLayerDraped(e._mergedLayers[e.order[n]])?r=Math.max(r,n):a=Math.min(a,n);return a>r}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter(e=>e.dem).forEach(i=>{e=Math.min(e,i.dem.tree.minimums[0])}),0===e?e:(e-30)*this._exaggeration}raycast(e,i,r){if(!this._visibleDemTiles)return null;let a=this._visibleDemTiles.filter(e=>e.dem).map(a=>{let n=a.tileID,o=1<<n.overscaledZ,{x:s,y:l}=n.canonical,h=s/o,u=(s+1)/o,c=l/o,d=(l+1)/o;return{minx:h,miny:c,maxx:u,maxy:d,t:a.dem.tree.raycastRoot(h,c,u,d,e,i,r),tile:a}});for(let n of(a.sort((e,i)=>(null!==e.t?e.t:Number.MAX_VALUE)-(null!==i.t?i.t:Number.MAX_VALUE)),a)){if(null==n.t)break;let a=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,i,r);if(null!=a)return a}return null}_createFBO(){let i=this.painter.context,r=i.gl,a=this.drapeBufferSize;i.activeTexture.set(r.TEXTURE0);let n=new e.T(i,{width:a[0],height:a[1],data:null},r.RGBA8);n.bind(r.LINEAR,r.CLAMP_TO_EDGE);let o=i.createFramebuffer(a[0],a[1],!0,null);return o.colorAttachment.set(n.texture),o.depthAttachment=new rg(i,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=i.createRenderbuffer(i.gl.DEPTH_STENCIL,a[0],a[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),i.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),i.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax),{fb:o,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(let e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return!0;return this._style.order.some(e=>{let i=this._style._mergedLayers[e],r=i.isHidden(this.painter.transform.zoom);return"hillshade"===i.type||"custom"===i.type?!r&&i.shouldRedrape():!r&&i.hasTransition()})}_clearLineLayersFromRenderCache(){let i=!1;for(let e of this._style.getSources())if(e instanceof eW){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)&&"line"===a.type&&a.widthExpression()instanceof e.ab)for(let e of(r[n.id]=!0,this.proxyCoords)){let i=this.proxyToSource[e.key][n.id];if(i)for(let e of i)this._clearRenderCacheForTile(n.id,e)}}}_clearRasterLayersFromRenderCache(){let e=!1;for(let i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i]._source instanceof eX){e=!0;break}if(!e)return;let i={};for(let e=0;e<this._style.order.length;++e){let r=this._style._mergedLayers[this._style.order[e]],a=this._style.getLayerSourceCache(r);if(!a||i[a.id]||r.isHidden(this.painter.transform.zoom)||"raster"!==r.type)continue;let n=r.paint.get("raster-fade-duration");for(let e of this.proxyCoords){let i=this.proxyToSource[e.key][a.id];if(i)for(let e of i){let i=rM(a.getTile(e),a.findLoadedParent(e,0),a,this.painter.transform,n);(1!==i.opacity||0!==i.mix)&&this._clearRenderCacheForTile(a.id,e)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();let i=this._style.order,r=i.length;if(0===r)return;let a=[];this._pendingGroundEffectLayers=[];let n,o=0,s=this._style._mergedLayers[i[o]];for(;!this._style.isLayerDraped(s)&&s.isHidden(this.painter.transform.zoom)&&++o<r;)s=this._style._mergedLayers[i[o]];for(;o<r;++o){let e=this._style._mergedLayers[i[o]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===n&&(n=o):("fill-extrusion"===e.type&&this._pendingGroundEffectLayers.push(o),void 0!==n&&(a.push({start:n,end:o-1}),n=void 0)))}if(void 0!==n&&a.push({start:n,end:o-1}),0!==a.length){let i=a[a.length-1];this._pendingGroundEffectLayers.every(e=>e>i.end)||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=a}_setupRenderCache(e){let i=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,i.renderCache.length>i.renderCachePool.length){let e=Object.values(i.proxyCachedFBO);i.proxyCachedFBO={};for(let r=0;r<e.length;++r){let a=Object.values(e[r]);i.renderCachePool.push(...a)}}return}this._clearRasterLayersFromRenderCache();let r=this.proxyCoords,a=this._tilesDirty;for(let n=r.length-1;n>=0;n--){let o=r[n];if(i.getTileByID(o.key),void 0!==i.proxyCachedFBO[o.key]){let r=e[o.key],n=this.proxyToSource[o.key],s=0;for(let e in n){let i=n[e],o=r[e];if(!o||o.length!==i.length||i.some((i,r)=>i!==o[r]||a[e]&&a[e].hasOwnProperty(i.key))){s=-1;break}++s}for(let e in i.proxyCachedFBO[o.key])i.renderCache[i.proxyCachedFBO[o.key][e]].dirty=s<0||s!==Object.values(r).length}}let n=[...this._drapedRenderBatches];for(let e of(n.sort((e,i)=>i.end-i.start-(e.end-e.start)),n))for(let a of r){if(i.proxyCachedFBO[a.key])continue;let r=i.renderCachePool.pop();void 0===r&&i.renderCache.length<50&&(r=i.renderCache.length,i.renderCache.push(this._createFBO())),void 0!==r&&(i.proxyCachedFBO[a.key]={},i.proxyCachedFBO[a.key][e.start]=r,i.renderCache[r].dirty=!0)}this._tilesDirty={}}_setupStencil(e,i,r,a){let n;if(!a||!this._sourceTilesOverlap[a.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let o=this.painter.context,s=o.gl;if(i.length<=1)return void(this._overlapStencilType=!1);if(r.isTileClipped())n=i.length,this._overlapStencilMode.test={func:s.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(i[0].overscaledZ>
94i[i.length-1].overscaledZ))return void(this._overlapStencilType=!1);n=1,this._overlapStencilMode.test={func:s.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+n>255&&(o.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=n,this._overlapStencilMode.ref=this._stencilRef,r.isTileClipped()&&this._renderTileClippingMasks(i,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):t2.disabled}_renderTileClippingMasks(e,i){let r=this.painter,a=this.painter.context,n=a.gl;r._tileClippingMaskIDs={},a.setColorMode(t0.disabled),a.setDepthMode(t1.disabled);let o=r.getOrCreateProgram("clippingMask");for(let a of e){let e=r._tileClippingMaskIDs[a.key]=--i;o.draw(r,n.TRIANGLES,t1.disabled,new t2({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),t0.disabled,t3.disabled,rS(a.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(i){let r=this.painter.transform;if(i.x<0||i.x>r.width||i.y<0||i.y>r.height)return null;let a=[i.x,i.y,1,1];e.ad.vec4.transformMat4(a,a,r.pixelMatrixInverse),e.ad.vec4.scale(a,a,1/a[3]),a[0]/=r.worldSize,a[1]/=r.worldSize;let n=r._camera.position,o=e.bH(1,r.center.lat),s=[n[0],n[1],n[2]/o,0],l=e.ad.vec3.subtract([],a.slice(0,3),s);e.ad.vec3.normalize(l,l);let h=this.raycast(s,l,this._exaggeration);return null!==h&&h?(e.ad.vec3.scaleAndAdd(s,s,l,h),s[3]=s[2],s[2]*=o,s):null}_setupProxiedCoordsForOrtho(i,r,a){if(i.getSource()instanceof e.aK)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 e=0;e<o.length;e++){let r=o[e],s=this._findTileCoveringTileID(r,i);if(s){let e=this._createProxiedId(r,s,a[r.key]&&a[r.key][i.id]);n.push(e),this.proxyToSource[r.key][i.id]=[e]}}let s=!1,l=new Set;for(let e=0;e<r.length;e++){let o=i.getTile(r[e]);if(!o||!o.hasData())continue;let h=this._findTileCoveringTileID(o.tileID,this.proxySourceCache);if(h&&h.tileID.canonical.z!==o.tileID.canonical.z){let e=this.proxyToSource[h.tileID.key][i.id],r=this._createProxiedId(h.tileID,o,a[h.tileID.key]&&a[h.tileID.key][i.id]);e?e.splice(e.length-1,0,r):this.proxyToSource[h.tileID.key][i.id]=[r];let u=this.proxyToSource[h.tileID.key][i.id];l.has(u)||l.add(u),n.push(r),s=!0}}if(this._sourceTilesOverlap[i.id]=s,s&&this._debugParams.sortTilesHiZFirst)for(let e of l)e.sort((e,i)=>i.overscaledZ-e.overscaledZ)}
94_setupProxiedCoordsForImageSource(i,r,a){if(!i.getSource().loaded())return;let n=this.proxiedCoords[i.id]=[],o=this.proxyCoords,s=i.getSource(),l=s.tileID;if(!l)return;let h=new e.P(l.x,l.y)._div(1<<l.z),u=s.coordinates.map(e.ac.fromLngLat).reduce((e,i)=>(e.min.x=Math.min(e.min.x,i.x-h.x),e.min.y=Math.min(e.min.y,i.y-h.y),e.max.x=Math.max(e.max.x,i.x-h.x),e.max.y=Math.max(e.max.y,i.y-h.y),e),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(i,r)=>{let a=i.wrap+i.canonical.x/(1<<i.canonical.z),n=i.canonical.y/(1<<i.canonical.z),o=e.ai/(1<<i.canonical.z),s=r.wrap+r.canonical.x/(1<<r.canonical.z),l=r.canonical.y/(1<<r.canonical.z);return a+o<s+u.min.x||a>s+u.max.x||n+o<l+u.min.y||n>l+u.max.y};for(let e=0;e<o.length;e++){let s=o[e];for(let e=0;e<r.length;e++){let o=i.getTile(r[e]);if(!o||!o.hasData()||c(s,o.tileID))continue;let l=this._createProxiedId(s,o,a[s.key]&&a[s.key][i.id]),h=this.proxyToSource[s.key][i.id];h?h.push(l):this.proxyToSource[s.key][i.id]=[l],n.push(l)}}}_createProxiedId(i,r,a){let n=this.orthoMatrix;if(a){let e=a.find(e=>e.key===r.tileID.key);if(e)return e}if(r.tileID.key!==i.key){let a,o,s,l=i.canonical.z-r.tileID.canonical.z;n=e.ad.mat4.create();let h=r.tileID.wrap-i.wrap<<i.overscaledZ;l>0?(o=(a=e.ai>>l)*((r.tileID.canonical.x<<l)-i.canonical.x+h),s=a*((r.tileID.canonical.y<<l)-i.canonical.y)):(a=e.ai<<-l,o=e.ai*(r.tileID.canonical.x-(i.canonical.x+h<<-l)),s=e.ai*(r.tileID.canonical.y-(i.canonical.y<<-l))),e.ad.mat4.ortho(n,0,a,0,a,0,1),e.ad.mat4.translate(n,n,[o,s,0])}return new rI(r.tileID,i.key,n)}_findTileCoveringTileID(i,r){let a=r.getTile(i);if(a&&a.hasData())return a;let n=this._findCoveringTileCache[r.id],o=n[i.key];if((a=o?r.getTileByID(o):null)&&a.hasData()||null===o)return a;let s=a?a.tileID:i,l=s.overscaledZ,h=r.getSource().minzoom,u=[];if(!o){let n=r.getSource().maxzoom;if(i.canonical.z>=n){let a=i.canonical.z-n;r.getSource().reparseOverscaled?(l=Math.max(i.canonical.z+2,r.transform.tileZoom),s=new e.aH(l,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a)):0!==a&&(l=n,s=new e.aH(l,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a))}s.key!==i.key&&(u.push(s.key),a=r.getTile(s))}let c=e=>{u.forEach(i=>{n[i]=e}),u.length=0};for(l-=1;l>=h&&(!a||!a.hasData());l--){a&&c(a.tileID.key);let e=s.calculateScaledKey(l);if((a=r.getTileByID(e))&&a.hasData())break;let i=n[e];if(null===i)break;void 0===i?u.push(e):a=r.getTileByID(i)}return c(a?a.tileID.key:null),a&&a.hasData()?a:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,i){let r=this._tilesDirty[e];r||(r=this._tilesDirty[e]={}),r[i.key]=!0}}let rP=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],rz=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class rD{static cacheKey(e,i,r,a){let n=`${i}${a?a.cacheKey:""}`;for(let i of r)e.usedDefines.includes(i)&&(n+=`/${i}`);return n}constructor(i,r,a,n,o,s){const l=i.gl;this.program=l.createProgram(),this.configuration=n,this.name=r,this.fixedDefines=[...s];const h=n?n.getBinderAttributes():[],u=(a.staticAttributes||[]).concat(h);let c=n?n.defines():[];c=c.concat(s.map(e=>`#define ${e}`));const d="#version 300 es\n";let p=d+c.concat("precision mediump float;",iM,iN.fragmentSource).join("\n");for(const e of a.fragmentIncludes)p+=` 95${iF[e]}`;p+=` 96${a.fragmentSource}`;let f=d+c.concat("precision highp float;",iM,iN.vertexSource).join("\n");for(const e of a.vertexIncludes)f+=` 97${iF[e]}`;this.forceManualRenderingForInstanceIDShaders=i.forceManualRenderingForInstanceIDShaders&&-1!==a.vertexSource.indexOf("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&(f+="\nuniform int u_instanceID;\n"),f+=` 98${a.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(f=f.replaceAll("gl_InstanceID","u_instanceID"));const m=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(m,p),l.compileShader(m),l.attachShader(this.program,m);const _=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(_,f),l.compileShader(_),l.attachShader(this.program,_),this.attributes={},this.numAttributes=u.length;for(let e=0;e<this.numAttributes;e++)if(u[e]){const i=u[e].startsWith("a_")?u[e]:`a_${u[e]}`;l.bindAttribLocation(this.program,e,i),this.attributes[i]=e}l.linkProgram(this.program),l.deleteShader(_),l.deleteShader(m),this.fixedUniforms=o(i),this.binderUniforms=n?n.getUniforms(i):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(i=>({u_instanceID:new e.bN(i)}))(i)),(s.includes("TERRAIN")||-1!==r.indexOf("symbol")||-1!==r.indexOf("circle"))&&(this.terrainUniforms=(i=>({u_dem:new e.bN(i),u_dem_prev:new e.bN(i),u_dem_tl:new e.bK(i),u_dem_scale:new e.bM(i),u_dem_tl_prev:new e.bK(i),u_dem_scale_prev:new e.bM(i),u_dem_size:new e.bM(i),u_dem_lerp:new e.bM(i),u_exaggeration:new e.bM(i),u_depth:new e.bN(i),u_depth_size_inv:new e.bK(i),u_depth_range_unpack:new e.bK(i),u_occluder_half_size:new e.bM(i),u_occlusion_depth_offset:new e.bM(i),u_meter_to_dem:new e.bM(i),u_label_plane_matrix_inv:new e.bJ(i)}))(i)),s.includes("GLOBE")&&(this.globeUniforms=(i=>({u_tile_tl_up:new e.bL(i),u_tile_tr_up:new e.bL(i),u_tile_br_up:new e.bL(i),u_tile_bl_up:new e.bL(i),u_tile_up_scale:new e.bM(i)}))(i)),s.includes("FOG")&&(this.fogUniforms=(i=>({u_fog_matrix:new e.bJ(i),u_fog_range:new e.bK(i),u_fog_color:new e.cb(i),u_fog_horizon_blend:new e.bM(i),u_fog_vertical_limit:new e.bK(i),u_fog_temporal_offset:new e.bM(i),u_frustum_tl:new e.b
98L(i),u_frustum_tr:new e.bL(i),u_frustum_br:new e.bL(i),u_frustum_bl:new e.bL(i),u_globe_pos:new e.bL(i),u_globe_radius:new e.bM(i),u_globe_transition:new e.bM(i),u_is_globe:new e.bN(i),u_viewport:new e.bK(i)}))(i)),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(i=>({u_cutoff_params:new e.cb(i)}))(i)),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(i=>({u_lighting_ambient_color:new e.bL(i),u_lighting_directional_dir:new e.bL(i),u_lighting_directional_color:new e.bL(i),u_ground_radiance:new e.bL(i)}))(i)),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(i=>({u_light_matrix_0:new e.bJ(i),u_light_matrix_1:new e.bJ(i),u_fade_range:new e.bK(i),u_shadow_normal_offset:new e.bL(i),u_shadow_intensity:new e.bM(i),u_shadow_texel_size:new e.bM(i),u_shadow_map_resolution:new e.bM(i),u_shadow_direction:new e.bL(i),u_shadow_bias:new e.bL(i),u_shadowmap_0:new e.bN(i),u_shadowmap_1:new e.bN(i)}))(i))}}setTerrainUniformValues(e,i){if(!this.terrainUniforms)return;let r=this.terrainUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a]&&r[a].set(this.program,a,i[a])}setGlobeUniformValues(e,i){if(!this.globeUniforms)return;let r=this.globeUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a]&&r[a].set(this.program,a,i[a])}setFogUniformValues(e,i){if(!this.fogUniforms)return;let r=this.fogUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setCutoffUniformValues(e,i){if(!this.cutoffUniforms)return;let r=this.cutoffUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setLightsUniformValues(e,i){if(!this.lightsUniforms)return;let r=this.lightsUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setShadowUniformValues(e,i){if(this.failedToCreate||!this.shadowUniforms)return;let r=this.shadowUniforms;for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}_drawDebugWireframe(i,r,a,n,o,s,l,h,u,c){let d=i.options.wireframe;if(!1===d.terrain&&!1===d.layers2D&&!1===d.layers3D)return;let p=i.context;if(!(!(!d.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!d.layers2D||i._terrain&&i._terrain.renderingToTexture||!rP.includes(this.name))||!(!d.layers3D||!rz.includes(this.name))))return;let f=p.gl,m=i.wireframeDebugCache.getLinesFromTrianglesBuffer(i.frameCounter,o,p);if(!m)return;let _=[...this.fixedDefines];_.push("DEBUG_WIREFRAME");let g=i.getOrCreateProgram(this.name,{config:this.configuration,defines:_});p.program.set(g.program);let y=(e,i,r)=>{if(i[e]&&r[e])for(let a in i[e])r[e][a]&&r[e][a].set(r.program,a,i[e][a].current)};u&&u.setUniforms(g.program,p,g.binderUniforms,l,{zoom:h}),y("fixedUniforms",this,g),y("terrainUniforms",this,g),y("globeUniforms",this,g),y("fogUniforms",this,g),y("lightsUniforms",this,g),y("shadowUniforms",this,g),m.bind(),p.setColorMode(new t0([f.ONE,f.ONE_MINUS_SRC_ALPHA,f.ZERO,f.ONE],e.al.transparent,[!0,!0,!0,!1])),p.setDepthMode(new t1(r.func===f.LESS?f.LEQUAL:r.func,t1.ReadOnly,r.range)),p.setStencilMode(t2.disabled);let x=3*s.primitiveLength*2,v=3*s.primitiveOffset*4;if(this.forceManualRenderingForInstanceIDShaders){let e=c||1;for(let i=0;i<e;++i)g.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",i),f.drawElements(f.LINES,x,f.UNSIGNED_SHORT,v)}else c&&c>1?f.drawElementsInstanced(f.LINES,x,f.UNSIGNED_SHORT,v,c):f.drawElements(f.LINES,x,f.UNSIGNED_SHORT,v);o.bind(),p.program.set(this.program),p.setDepthMode(r),p.setStencilMode(a),p.setColorMode(n)}checkUniforms(e,i,r){if(this.fixedDefines.includes(i)){for(let a of Object.keys(r))if(!r[a].initialized)throw Error(`Program '${this.name}', from draw '${e}': uniform ${a} not set but required by ${i} being defined`)}}draw(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=e.context,y=g.gl;if(this.failedToCreate)return;for(let e of(g.program.set(this.program),g.setDepthMode(r),g.setStencilMode(a),g.setColorMode(n),g.setCullFace(o),Object.keys(this.fixedUniforms)))this.fixedUniforms[e].set(this.program,e,s[e]);f&&f.setUniforms(this.program,g,this.binderUniforms,d,{zoom:p});let x={[y.POINTS]:1,[y.LINES]:2,[y.TRIANGLES]:3,[y.LINE_STRIP]:1}[i];this.checkUniforms(l,"RENDER_SHADOWS",this.shadowUniforms);let v=_&&_>0?1:void 0;for(let o of c.get()){let s=o.vaos||(o.vaos={});if((s[l]||(s[l]=new iG)).bind(g,this,h,f?f.getPaintVertexBuffers():[],u,o.vertexOffset,m||[],v),this.forceManualRenderingForInstanceIDShaders){let e=_||1;for(let r=0;r<e;++r)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",r),u?y.drawElements(i,o.primitiveLength*x,y.UNSIGNED_SHORT,o.primitiveOffset*x*2):y.drawArrays(i,o.vertexOffset,o.vertexLength)}else _&&_>1?y.drawElementsInstanced(i,o.primitiveLength*x,y.UNSIGNED_SHORT,o.primitiveOffset*x*2,_):u?y.drawElements(i,o.primitiveLength*x,y.UNSIGNED_SHORT,o.primitiveOffset*x*2):y.drawArrays(i,o.vertexOffset,o.vertexLength);i===y.TRIANGLES&&u&&this._drawDebugWireframe(e,r,a,n,u,o,d,p,f,_)}
98}}function rR(i,r){let a=Math.pow(2,r.tileID.overscaledZ),n=r.tileSize*Math.pow(2,i.transform.tileZoom)/a,o=n*(r.tileID.canonical.x+r.tileID.wrap*a),s=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.at(r,1,i.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}let rL={terrain:0,flat:1},rO=e.ad.mat4.create(),rk=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x)=>{let v=r.style.light,b=v.properties.get("position"),w=[b.x,b.y,b.z],T=e.ad.mat3.create();"viewport"===v.properties.get("anchor")&&(e.ad.mat3.fromRotation(T,-r.transform.angle),e.ad.vec3.transformMat3(w,w,T));let S=v.properties.get("color"),M=r.transform,E={u_matrix:i,u_lightpos:w,u_lightintensity:v.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+a,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rO,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:rL[c],u_base_type:rL[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};return"globe"===M.projection.name&&(E.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],E.u_zoom_transition=p,E.u_inv_rot_matrix=m,E.u_merc_center=f,E.u_up_dir=M.projection.upVector(new e.bT(0,0,0),f[0]*e.ai,f[1]*e.ai),E.u_height_lift=u),E},rF=(e,i,r,a,n,o)=>({u_matrix:e,u_edge_radius:i,u_width_scale:r,u_vertical_scale:a,u_height_type:rL[n],u_base_type:rL[o]}),rB=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y)=>{let x=rk(i,r,a,n,o,s,l,h,c,d,p,f,m,_,g,y,1,[0,0,0]),v={u_height_factor:-Math.pow(2,h.overscaledZ)/u.tileSize/8};return e.l(x,rR(r,u),v)},rN=(e,i)=>({u_matrix:e,u_emissive_strength:i}),rV=(i,r,a,n)=>e.l(rN(i,r),rR(a,n)),rU=(e,i,r)=>({u_matrix:e,u_world:r,u_emissive_strength:i}),rj=(i,r,a,n,o)=>e.l(rV(i,r,a,n),{u_world:o}),rG=(e,i,r,a,n)=>({u_matrix:e,u_camera_pos:[i[0],i[1],i[2]],u_depth_bias:r,u_height_scale:a,u_reset_depth:n}),rq=(i,r,a,n)=>{let o=e.ai/a.tileSize;return{u_matrix:i,u_camera_to_center_distance:r.getCameraToCenterDistance(n),u_extrude_scale:[r.pixelsToGLUnits[0]/o,r.pixelsToGLUnits[1]/o]}},rZ=(e,i,r=1)=>({u_matrix:e,u_color:i.toRenderColor(null),u_overlay:0,u_overlay_scale:r}),rH=e.ad.mat4.create(),r$=(i,r,a,n,o,s,l)=>{let h=i.transform,u="globe"===h.projection.name,c=u?e.cO(h.zoom,r.canonical)*h._pixelsPerMercatorPixel:e.at(a,1,s),d={u_matrix:r.projMatrix,u_extrude_scale:c,u_intensity:l,u_inv_rot_matrix:rH,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(u){d.u_inv_rot_matrix=n,d.u_merc_center=o,d.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],d.u_zoom_transition=e.ag(h.zoom);let i=o[0]*e.ai,a=o[1]*e.ai;d.u_up_dir=h.projection.upVector(new e.bT(0,0,0),i,a)}return d};function rW(e,[i,r,a,n],[o,s]){if(o===s)return[0,0,0,0];let l=255*(e-1)/(e*(s-o));return[i*l,r*l,a*l,n*l]}function rX(e,i,[r,a]){return r===a?0:.5/e+(i-r)*(e-1)/(e*(a-r))}let rY=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)=>{var T;let S,M;return{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*p.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:p.paint.get("raster-brightness-min"),u_brightness_high:p.paint.get("raster-brightness-max"),u_saturation_factor:e.cP(p.paint.get("raster-saturation")),u_contrast_factor:e.cQ(p.paint.get("raster-contrast")),u_spin_weights:(S=Math.sin(T=p.paint.get("raster-hue-rotate")*(Math.PI/180)),[(2*(M=Math.cos(T))+1)/3,(-Math.sqrt(3)*S-M+1)/3,(Math.sqrt(3)*S-M+1)/3]),u_perspective_transform:f,u_raster_elevation:m,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:u,u_colorization_mix:rW(e.cR,g,x),u_colorization_offset:rX(e.cR,y,x),u_color_ramp:_,u_texture_offset:[b/(v+2*b),v/(v+2*b)],u_texture_res:[v+2*b,v+2*b],u_emissive_strength:w}},rK=(e,i,r,a,n,o,s,l,h,u,c,d)=>({u_matrix:e,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:a,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:u,u_fade_t:c.mix,u_opacity:c.opacity,u_image0:0,u_image1:1,u_raster_elevation:d,u_zoom_transition:s,u_merc_center:l,u_cutoff_params:h}),rJ=(e,i,r,a,n,o,s,l,h,u)=>({u_particle_texture:e,u_particle_texture_side_len:i,u_tile_offset:r,u_velocity:a,u_color_ramp:o,u_velocity_res:n,u_max_speed:s,u_uv_offset:l,u_data_scale:[255*h[0],255*h[1]],u_data_offset:u,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),rQ=(e,i,r,a,n,o,s,l,h,u)=>({u_particle_texture:e,u_particle_texture_side_len:i,u_velocity:r,u_velocity_res:a,u_max_speed:n,u_speed_factor:o,u_reset_rate:s,u_rand_seed:Math.random(),u_uv_offset:l,u_data_scale:[255*h[0],255*h[1]],u_data_offset:u,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),r0=e.ad.mat4.create(),r1=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T)=>{let S=o.transform,M={u_is_size_zoom_constant:+("constant"===i||"source"===i),u_is_size_feature_constant:+("constant"===i||"camera"===i),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:S.getCameraToCenterDistance(v),u_rotate_symbol:+a,u_aspect_ratio:S.width/S.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:l,u_coord_matrix:h,u_is_text:+c,u_elevation_from_sea:+!!u,u_pitch_with_map:+n,u_texsize:d,u_texsize_icon:p,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:r0,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:r0,u_up_vector:[0,-1,0],u_color_adj_mat:b,u_icon_transition:w||0,u_gamma_scale:n?o.transform.getCameraToCenterDistance(v)*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.q.devicePixelRatio,u_is_halo:+f,u_scale_factor:T||1};return"globe"===v.name&&(M.u_tile_id=[m.canonical.x,m.canonical.y,1<<m.canonical.z],M.u_zoom_transition=_,M.u_inv_rot_matrix=y,M.u_merc_center=g,M.u_camera_forward=S._camera.forward(),M.u_ecef_origin=e.cS(S.globeMatrix,m.toUnwrapped()),M.u_tile_matrix=Float32Array.from(S.globeMatrix),M.u_up_vector=x),M},r2=(e,i,r,a)=>({u_matrix:e,u_emissive_strength:i,u_opacity:r,u_color:a}),r3=(i,r,a,n,o,s,l,h,u)=>e.l(function(i,r,a,n,o){let{width:s,height:l}=a.imageManager.getPixelSize(i),h=Math.pow(2,o.tileID.overscaledZ
98),u=o.tileSize*Math.pow(2,a.transform.tileZoom)/h,c=u*(o.tileID.canonical.x+o.tileID.wrap*h),d=u*o.tileID.canonical.y;return{u_image:0,u_pattern_tl:r.tl,u_pattern_br:r.br,u_texsize:[s,l],u_pattern_size:r.displaySize,u_pattern_units_to_pixels:n?[a.transform.width,-1*a.transform.height]:[1/e.at(o,1,a.transform.tileZoom),1/e.at(o,1,a.transform.tileZoom)],u_pixel_coord_upper:[c>>16,d>>16],u_pixel_coord_lower:[65535&c,65535&d]}}(s,l,n,h,u),{u_matrix:i,u_emissive_strength:r,u_opacity:a}),r4=new Float32Array(e.ad.mat4.identity([])),r5=(i,r,a,n,o,s,l,h,u,c,d,p,f,m=[0,0,0],_)=>{let g=o.style.light,y=g.properties.get("position"),x=[-y.x,-y.y,y.z],v=e.ad.mat3.create();"viewport"===g.properties.get("anchor")&&(e.ad.mat3.fromRotation(v,-o.transform.angle),e.ad.vec3.transformMat3(x,x,v));let b="MASK"===d.alphaMode,w=g.properties.get("color").toRenderColor(null),T=f.paint.get("model-ambient-occlusion-intensity"),S=f.paint.get("model-color").constantOr(e.al.white).toRenderColor(null),M=f.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:i,u_lighting_matrix:r,u_normal_matrix:a,u_node_matrix:n||r4,u_lightpos:x,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_camera_pos:m,u_opacity:s,u_baseTextureIsAlpha:0,u_alphaMask:+b,u_alphaCutoff:d.alphaCutoff,u_baseColorFactor:[l.r,l.g,l.b,l.a],u_emissiveFactor:[h[0],h[1],h[2],1],u_metallicFactor:u,u_roughnessFactor:c,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:[S.r,S.g,S.b,M],u_aoIntensity:T,u_emissive_strength:p,u_occlusionTextureTransform:_||[0,0,0,0]}},r6=(e,i=r4,r=r4)=>({u_matrix:e,u_instance:i,u_node_matrix:r}),r8={fillExtrusion:i=>({u_matrix:new e.bJ(i),u_lightpos:new e.bL(i),u_lightintensity:new e.bM(i),u_lightcolor:new e.bL(i),u_vertical_gradient:new e.bM(i),u_opacity:new e.bM(i),u_edge_radius:new e.bM(i),u_width_scale:new e.bM(i),u_ao:new e.bK(i),u_height_type:new e.bN(i),u_base_type:new e.bN(i),u_tile_id:new e.bL(i),u_zoom_transition:new e.bM(i),u_inv_rot_matrix:new e.bJ(i),u_merc_center:new e.bK(i),u_up_dir:new e.bL(i),u_height_lift:new e.bM(i),u_flood_light_color:new e.bL(i),u_vertical_scale:new e.bM(i),u_flood_light_intensity:new e.bM(i),u_ground_shadow_factor:new e.bL(i)}),fillExtrusionDepth:i=>({u_matrix:new e.bJ(i),u_edge_radius:new e.bM(i),u_width_scale:new e.bM(i),u_vertical_scale:new e.bM(i),u_height_type:new e.bN(i),u_base_type:new e.bN(i)}),fillExtrusionPattern:i=>({u_matrix:new e.bJ(i),u_lightpos:new e.bL(i),u_lightintensity:new e.bM(i),u_lightcolor:new e.bL(i),u_vertical_gradient:new e.bM(i),u_height_factor:new e.bM(i),u_edge_radius:new e.bM(i),u_width_scale:new e.bM(i),u_ao:new e.bK(i),u_height_type:new e.bN(i),u_base_type:new e.bN(i),u_tile_id:new e.bL(i),u_zoom_transition:new e.bM(i),u_inv_rot_matrix:new e.bJ(i),u_merc_center:new e.bK(i),u_up_dir:new e.bL(i),u_height_lift:new e.bM(i),u_image:new e.bN(i),u_texsize:new e.bK(i),u_pixel_coord_upper:new e.bK(i),u_pixel_coord_lower:new e.bK(i),u_tile_units_to_pixels:new e.bM(i),u_opacity:new e.bM(i)}),fillExtrusionGroundEffect:i=>({u_matrix:new e.bJ(i),u_opacity:new e.bM(i),u_ao_pass:new e.bM(i),u_meter_to_tile:new e.bM(i),u_ao:new e.bK(i),u_flood_light_intensity:new e.bM(i),u_flood_light_color:new e.bL(i),u_attenuation:new e.bM(i),u_edge_radius:new e.bM(i),u_fb:new e.bN(i),u_fb_size:new e.bM(i),u_dynamic_offset:new e.bM(i)}),fill:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i)}),fillPattern:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_image:new e.bN(i),u_texsize:new e.bK(i),u_pixel_coord_upper:new e.bK(i),u_pixel_coord_lower:new e.bK(i),u_tile_units_to_pixels:new e.bM(i)}),fillOutline:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_world:new e.bK(i)}),fillOutlinePattern:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_world:new e.bK(i),u_image:new e.bN(i),u_texsize:new e.bK(i),u_pixel_coord_upper:new e.bK(i),u_pixel_coord_lower:new e.bK(i),u_tile_units_to_pixels:new e.bM(i)}),elevatedStructures:i=>({u_matrix:new e.bJ(i)}),elevatedStructuresDepthReconstruct:i=>({u_matrix:new e.bJ(i),u_camera_pos:new e.bL(i),u_depth_bias:new e.bM(i),u_height_scale:new e.bM(i),u_reset_depth:new e.bM(i)}),circle:e.cT,collisionBox:i=>({u_matrix:new e.bJ(i),u_camera_to_center_distance:new e.bM(i),u_extrude_scale:new e.bK(i)}),collisionCircle:i=>({u_matrix:new e.bJ(i),u_inv_matrix:new e.bJ(i),u_camera_to_center_distance:new e.bM(i),u_viewport_size:new e.bK(i)}),debug:i=>({u_color:new e.cA(i),u_matrix:new e.bJ(i),u_overlay:new e.bN(i),u_overlay_scale:new e.bM(i)}),clippingMask:i=>({u_matrix:new e.bJ(i)}),heatmap:i=>({u_extrude_scale:new e.bM(i),u_intensity:new e.bM(i),u_matrix:new e.bJ(i),u_inv_rot_matrix:new e.bJ(i),u_merc_center:new e.bK(i),u_tile_id:new e.bL(i),u_zoom_transition:new e.bM(i),u_up_dir:new e.b
98L(i)}),heatmapTexture:i=>({u_image:new e.bN(i),u_color_ramp:new e.bN(i),u_opacity:new e.bM(i)}),hillshade:i=>({u_matrix:new e.bJ(i),u_image:new e.bN(i),u_latrange:new e.bK(i),u_light:new e.bK(i),u_shadow:new e.cA(i),u_highlight:new e.cA(i),u_emissive_strength:new e.bM(i),u_accent:new e.cA(i)}),hillshadePrepare:i=>({u_matrix:new e.bJ(i),u_image:new e.bN(i),u_dimension:new e.bK(i),u_zoom:new e.bM(i)}),line:e.cU,linePattern:e.cV,raster:i=>({u_matrix:new e.bJ(i),u_normalize_matrix:new e.bJ(i),u_globe_matrix:new e.bJ(i),u_merc_matrix:new e.bJ(i),u_grid_matrix:new e.cB(i),u_tl_parent:new e.bK(i),u_scale_parent:new e.bM(i),u_fade_t:new e.bM(i),u_opacity:new e.bM(i),u_image0:new e.bN(i),u_image1:new e.bN(i),u_brightness_low:new e.bM(i),u_brightness_high:new e.bM(i),u_saturation_factor:new e.bM(i),u_contrast_factor:new e.bM(i),u_spin_weights:new e.bL(i),u_perspective_transform:new e.bK(i),u_raster_elevation:new e.bM(i),u_zoom_transition:new e.bM(i),u_merc_center:new e.bK(i),u_cutoff_params:new e.cb(i),u_colorization_mix:new e.cb(i),u_colorization_offset:new e.bM(i),u_color_ramp:new e.bN(i),u_texture_offset:new e.bK(i),u_texture_res:new e.bK(i),u_emissive_strength:new e.bM(i)}),rasterParticle:i=>({u_matrix:new e.bJ(i),u_normalize_matrix:new e.bJ(i),u_globe_matrix:new e.bJ(i),u_merc_matrix:new e.bJ(i),u_grid_matrix:new e.cB(i),u_tl_parent:new e.bK(i),u_scale_parent:new e.bM(i),u_fade_t:new e.bM(i),u_opacity:new e.bM(i),u_image0:new e.bN(i),u_image1:new e.bN(i),u_raster_elevation:new e.bM(i),u_zoom_transition:new e.bM(i),u_merc_center:new e.bK(i),u_cutoff_params:new e.cb(i)}),rasterParticleTexture:i=>({u_texture:new e.bN(i),u_opacity:new e.bM(i)}),rasterParticleDraw:i=>({u_particle_texture:new e.bN(i),u_particle_texture_side_len:new e.bM(i),u_tile_offset:new e.bK(i),u_velocity:new e.bN(i),u_color_ramp:new e.bN(i),u_velocity_res:new e.bK(i),u_max_speed:new e.bM(i),u_uv_offset:new e.bK(i),u_data_scale:new e.bK(i),u_data_offset:new e.bM(i),u_particle_pos_scale:new e.bM(i),u_particle_pos_offset:new e.bK(i)}),rasterParticleUpdate:i=>({u_particle_texture:new e.bN(i),u_particle_texture_side_len:new e.bM(i),u_velocity:new e.bN(i),u_velocity_res:new e.bK(i),u_max_speed:new e.bM(i),u_speed_factor:new e.bM(i),u_reset_rate:new e.bM(i),u_rand_seed:new e.bM(i),u_uv_offset:new e.bK(i),u_data_scale:new e.bK(i),u_data_offset:new e.bM(i),u_particle_pos_scale:new e.bM(i),u_particle_pos_offset:new e.bK(i)}),symbol:i=>({u_is_size_zoom_constant:new e.bN(i),u_is_size_feature_constant:new e.bN(i),u_size_t:new e.bM(i),u_size:new e.bM(i),u_camera_to_center_distance:new e.bM(i),u_rotate_symbol:new e.bN(i),u_aspect_ratio:new e.bM(i),u_fade_change:new e.bM(i),u_matrix:new e.bJ(i),u_label_plane_matrix:new e.bJ(i),u_coord_matrix:new e.bJ(i),u_is_text:new e.bN(i),u_elevation_from_sea:new e.bN(i),u_pitch_with_map:new e.bN(i),u_texsize:new e.bK(i),u_texsize_icon:new e.bK(i),u_texture:new e.bN(i),u_texture_icon:new e.bN(i),u_gamma_scale:new e.bM(i),u_device_pixel_ratio:new e.bM(i),u_tile_id:new e.bL(i),u_zoom_transition:new e.bM(i),u_inv_rot_matrix:new e.bJ(i),u_merc_center:new e.bK(i),u_camera_forward:new e.bL(i),u_tile_matrix:new e.bJ(i),u_up_vector:new e.bL(i),u_ecef_origin:new e.bL(i),u_is_halo:new e.bN(i),u_icon_transition:new e.bM(i),u_color_adj_mat:new e.bJ(i),u_scale_factor:new e.bM(i)}),background:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_opacity:new e.bM(i),u_color:new e.cA(i)}),backgroundPattern:i=>({u_matrix:new e.bJ(i),u_emissive_strength:new e.bM(i),u_opacity:new e.bM(i),u_image:new e.bN(i),u_pattern_tl:new e.bK(i),u_pattern_br:new e.bK(i),u_texsize:new e.bK(i),u_pattern_size:new e.bK(i),u_pixel_coord_upper:new e.bK(i),u_pixel_coord_lower:new e.bK(i),u_pattern_units_to_pixels:new e.bK(i)}),terrainRaster:i=>({u_matrix:new e.bJ(i),u_image0:new e.bN(i),u_skirt_height:new e.bM(i),u_ground_shadow_factor:new e.bL(i)}),skybox:i=>({u_matrix:new e.bJ(i),u_sun_direction:new e.bL(i),u_cubemap:new e.bN(i),u_opacity:new e.bM(i),u_temporal_offset:new e.bM(i)}),skyboxGradient:i=>({u_matrix:new e.bJ(i),u_color_ramp:new e.bN(i),u_center_direction:new e.bL(i),u_radius:new e.bM(i),u_opacity:new e.bM(i),u_temporal_offset:new e.bM(i)}),skyboxCapture:i=>({u_matrix_3f:new e.cB(i),u_sun_direction:new e.bL(i),u_sun_intensity:new e.bM(i),u_color_tint_r:new e.cb(i),u_color_tint_m:new e.cb(i),u_luminance:new e.bM(i)}),globeRaster:i=>({u_proj_matrix:new e.bJ(i),u_globe_matrix:new e.bJ(i),u_normalize_matrix:new e.bJ(i),u_merc_matrix:new e.bJ(i),u_zoom_transition:new e.bM(i),u_merc_center:new e.bK(i),u_image0:new e.bN(i),u_grid_matrix:new e.cB(i),u_skirt_height:new e.bM(i),u_far_z_cutoff:new e.bM(i),u_frustum_tl:new e.b
98L(i),u_frustum_tr:new e.bL(i),u_frustum_br:new e.bL(i),u_frustum_bl:new e.bL(i),u_globe_pos:new e.bL(i),u_globe_radius:new e.bM(i),u_viewport:new e.bK(i)}),globeAtmosphere:i=>({u_frustum_tl:new e.bL(i),u_frustum_tr:new e.bL(i),u_frustum_br:new e.bL(i),u_frustum_bl:new e.bL(i),u_horizon:new e.bM(i),u_transition:new e.bM(i),u_fadeout_range:new e.bM(i),u_color:new e.cb(i),u_high_color:new e.cb(i),u_space_color:new e.cb(i),u_temporal_offset:new e.bM(i),u_horizon_angle:new e.bM(i)}),model:i=>({u_matrix:new e.bJ(i),u_lighting_matrix:new e.bJ(i),u_normal_matrix:new e.bJ(i),u_node_matrix:new e.bJ(i),u_lightpos:new e.bL(i),u_lightintensity:new e.bM(i),u_lightcolor:new e.bL(i),u_camera_pos:new e.bL(i),u_opacity:new e.bM(i),u_baseColorFactor:new e.cb(i),u_emissiveFactor:new e.cb(i),u_metallicFactor:new e.bM(i),u_roughnessFactor:new e.bM(i),u_baseTextureIsAlpha:new e.bN(i),u_alphaMask:new e.bN(i),u_alphaCutoff:new e.bM(i),u_baseColorTexture:new e.bN(i),u_metallicRoughnessTexture:new e.bN(i),u_normalTexture:new e.bN(i),u_occlusionTexture:new e.bN(i),u_emissionTexture:new e.bN(i),u_lutTexture:new e.bN(i),u_color_mix:new e.cb(i),u_aoIntensity:new e.bM(i),u_emissive_strength:new e.bM(i),u_occlusionTextureTransform:new e.cb(i)}),modelDepth:i=>({u_matrix:new e.bJ(i),u_instance:new e.bJ(i),u_node_matrix:new e.bJ(i)}),groundShadow:i=>({u_matrix:new e.bJ(i),u_ground_shadow_factor:new e.bL(i)}),stars:i=>({u_matrix:new e.bJ(i),u_up:new e.bL(i),u_right:new e.bL(i),u_intensity_multiplier:new e.bM(i)}),snowParticle:i=>({u_modelview:new e.bJ(i),u_projection:new e.bJ(i),u_time:new e.bM(i),u_cam_pos:new e.bL(i),u_velocityConeAperture:new e.bM(i),u_velocity:new e.bM(i),u_horizontalOscillationRadius:new e.bM(i),u_horizontalOscillationRate:new e.bM(i),u_boxSize:new e.bM(i),u_billboardSize:new e.bM(i),u_simpleShapeParameters:new e.bK(i),u_screenSize:new e.bK(i),u_thinningCenterPos:new e.bK(i),u_thinningShape:new e.bL(i),u_thinningAffectedRatio:new e.bM(i),u_thinningParticleOffset:new e.bM(i),u_particleColor:new e.cb(i),u_direction:new e.bL(i)}),rainParticle:i=>({u_modelview:new e.bJ(i),u_projection:new e.bJ(i),u_time:new e.bM(i),u_cam_pos:new e.bL(i),u_texScreen:new e.bN(i),u_velocityConeAperture:new e.bM(i),u_velocity:new e.bM(i),u_boxSize:new e.bM(i),u_rainDropletSize:new e.bK(i),u_distortionStrength:new e.bM(i),u_rainDirection:new e.bL(i),u_color:new e.cb(i),u_screenSize:new e.bK(i),u_thinningCenterPos:new e.bK(i),u_thinningShape:new e.bL(i),u_thinningAffectedRatio:new e.bM(i),u_thinningParticleOffset:new e.bM(i),u_shapeDirectionalPower:new e.bM(i),u_shapeNormalPower:new e.bM(i),u_mode:new e.bM(i)}),vignette:i=>({u_vignetteShape:new e.bL(i),u_vignetteColor:new e.cb(i)}),occlusion:i=>({u_matrix:new e.bJ(i),u_anchorPos:new e.bL(i),u_screenSizePx:new e.bK(i),u_occluderSizePx:new e.bK(i),u_color:new e.cb(i)})};class r9{constructor(e,i,r,a){this.id=r9.uniqueIdxCounter,r9.uniqueIdxCounter++,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||a||i.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=r9.uniqueIdxCounter,r9.uniqueIdxCounter++;let i=this.context.gl;this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}r9.uniqueIdxCounter=0;let r7={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ae{constructor(e,i,r,a,n,o){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=a,this.instanceCount=o,this.context=e;const s=e.gl;this.buffer=s.createBuffer(),e.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||i.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){let i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}
98enableAttributes(e,i){for(let r=0;r<this.attributes.length;r++){let a=i.attributes[this.attributes[r].name];void 0!==a&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,i,r){for(let a=0;a<this.attributes.length;a++){let n=this.attributes[a],o=i.attributes[n.name];void 0!==o&&e.vertexAttribPointer(o,n.components,e[r7[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}setVertexAttribDivisor(e,i,r){for(let a=0;a<this.attributes.length;a++){let n=i.attributes[this.attributes[a].name];void 0!==n&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(n,r)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class at{constructor(e,i,r,a,n){this.context=e,this.width=i,this.height=r;const o=this.framebuffer=e.gl.createFramebuffer();a&&(this.colorAttachment=new rf(e,o)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new rm(e,o):new r_(e,o))}destroy(){let e=this.context.gl;if(this.colorAttachment){let i=this.colorAttachment.get();i&&e.deleteTexture(i)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}else{let i=this.depthAttachment.get();i&&e.deleteTexture(i)}e.deleteFramebuffer(this.framebuffer)}}class ai{constructor(e,i){this.gl=e,this.clearColor=new iH(this),this.clearDepth=new i$(this),this.clearStencil=new iW(this),this.colorMask=new iX(this),this.depthMask=new iY(this),this.stencilMask=new iK(this),this.stencilFunc=new iJ(this),this.stencilOp=new iQ(this),this.stencilTest=new i0(this),this.depthRange=new i1(this),this.depthTest=new i2(this),this.depthFunc=new i3(this),this.blend=new i4(this),this.blendFunc=new i5(this),this.blendColor=new i6(this),this.blendEquation=new i8(this),this.cullFace=new i9(this),this.cullFaceSide=new i7(this),this.frontFace=new re(this),this.program=new rt(this),this.activeTexture=new ri(this),this.viewport=new rr(this),this.bindFramebuffer=new ra(this),this.bindRenderbuffer=new rn(this),this.bindTexture=new ro(this),this.bindVertexBuffer=new rs(this),this.bindElementBuffer=new rl(this),this.bindVertexArrayOES=new rh(this),this.pixelStoreUnpack=new ru(this),this.pixelStoreUnpackPremultiplyAlpha=new rc(this),this.pixelStoreUnpackFlipY=new rd(this),this.options=i?Object.assign({},i):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=i&&!!i.forceManualRenderingForInstanceIDShaders||this.renderer&&-1!==this.renderer.indexOf("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}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(e,i,r){return new r9(this,e,i,r)}createVertexBuffer(e,i,r,a,n){return new ae(this,e,i,r,a,n)}createRenderbuffer(e,i,r){let a=this.gl,n=a.createRenderbuffer();return this.bindRenderbuffer.set(n),a.renderbufferStorage(a.RENDERBUFFER,e,i,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,i,r,a){return new at(this,e,i,r,a)}clear({color:e,depth:i,stencil:r,colorMask:a}){let n=this.gl,o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(a||[!0,!0,!0,!0])),void 0!==i&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(i){e.bn(i.blendFunction,t0.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor),i.blendEquation?this.blendEquation.set(i.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(i.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}function ar(i,r,n,o,s,l,h){let u=i.context,c=u.gl,d=i.transform,p=i.getOrCreateProgram("collisionBox"),f=[],m=0,_=0;for(let a=0;a<o.length;a++){let u=o[a],g=r.getTile(u),y=g.getBucket(n);if(!y)continue;let x=function(e,i,r){if(i.projection.name===r.projection.name)return e.projMatrix;let a=r.clone();return a.setProjection(i.projection),tR(a,i.getProjection(),e)}(u,y,d),v=x;0===s[0]&&0===s[1]||(v=i.translatePosMatrix(x,g,s,l));let b=h?y.textCollisionBox:y.iconCollisionBox,w=y.collisionCircleArray;
98if(w.length>0){let i=e.ad.mat4.create(),r=v;e.ad.mat4.mul(i,y.placementInvProjMatrix,d.glCoordMatrix),e.ad.mat4.mul(i,i,y.placementViewportMatrix),f.push({circleArray:w,circleOffset:_,transform:r,invTransform:i,projection:y.getProjection()}),m+=w.length/4,_=m}b&&(i.terrain&&i.terrain.setupElevationDraw(g,p),p.draw(i,c.LINES,t1.disabled,t2.disabled,i.colorModeForRenderPass(),t3.disabled,rq(v,d,g,y.getProjection()),n.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,null,d.zoom,null,[b.collisionVertexBuffer,b.collisionVertexBufferExt]))}if(!h||!f.length)return;let g=i.getOrCreateProgram("collisionCircle"),y=new e.cW;y.resize(4*m),y._trim();let x=0;for(let e of f)for(let i=0;i<e.circleArray.length/4;i++){let r=4*i,a=e.circleArray[r+0],n=e.circleArray[r+1],o=e.circleArray[r+2],s=e.circleArray[r+3];y.emplace(x++,a,n,o,s,0),y.emplace(x++,a,n,o,s,1),y.emplace(x++,a,n,o,s,2),y.emplace(x++,a,n,o,s,3)}(!a||a.length<2*m)&&(a=function(i){let r=2*i,a=new e.aV;a.resize(r),a._trim();for(let e=0;e<r;e++){let i=6*e;a.uint16[i+0]=4*e+0,a.uint16[i+1]=4*e+1,a.uint16[i+2]=4*e+2,a.uint16[i+3]=4*e+2,a.uint16[i+4]=4*e+3,a.uint16[i+5]=4*e+0}return a}(m));let v=u.createIndexBuffer(a,!0),b=u.createVertexBuffer(y,e.cX.members,!0);for(let r of f){let a={u_matrix:r.transform,u_inv_matrix:r.invTransform,u_camera_to_center_distance:d.getCameraToCenterDistance(r.projection),u_viewport_size:[d.width,d.height]};g.draw(i,c.TRIANGLES,t1.disabled,t2.disabled,i.colorModeForRenderPass(),t3.disabled,a,n.id,b,v,e.b8.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,d.zoom)}b.destroy(),v.destroy()}let aa=e.ad.mat4.create();function an(i){let r=i._camera.getWorldToCamera(i.worldSize,1),a=e.ad.mat4.multiply([],r,i.globeMatrix);e.ad.mat4.invert(a,a);let n=[0,0,0],o=[0,1,0,0];return e.ad.vec4.transformMat4(o,o,a),n[0]=o[0],n[1]=o[1],n[2]=o[2],e.ad.vec3.normalize(n,n),n}function ao(i,r,a,n,o,s,l={}){let h=a.paint.get("icon-translate"),u=a.paint.get("text-translate"),c=a.paint.get("icon-translate-anchor"),d=a.paint.get("text-translate-anchor"),p=a.layout.get("icon-rotation-alignment"),f=a.layout.get("text-rotation-alignment"),m=a.layout.get("icon-pitch-alignment"),_=a.layout.get("text-pitch-alignment"),g=a.layout.get("icon-keep-upright"),y=a.layout.get("text-keep-upright"),x=a.paint.get("icon-color-saturation"),v=a.paint.get("icon-color-contrast"),b=a.paint.get("icon-color-brightness-min"),w=a.paint.get("icon-color-brightness-max"),T="sea"===a.layout.get("symbol-elevation-reference"),S=i.context,M=S.gl,
98E=i.transform,A="map"===p,I="map"===f,C="map"===m,P="map"===_,z=void 0!==a.layout.get("symbol-sort-key").constantOr(1),D=!1,R=i.depthModeForSublayer(0,t1.ReadOnly),L=[e.av(E.center.lng),e.aC(E.center.lat)],O=a.layout.get("text-variable-anchor"),k="globe"===E.projection.name,F=[],B=[0,-1,0];for(let o of n){let n=r.getTile(o),s=n.getBucket(a);if(!s||"mercator"===s.projection.name&&k||s.fullyClipped)continue;let p="globe"===s.projection.name,f=p?e.ag(E.zoom):0,m=tL(o,s.getProjection(),E),_=E.calculatePixelsToTileUnitsMatrix(n),S=O&&s.hasTextData(),R=s.hasIconTextFit()&&S&&s.hasIconData(),N=s.getProjection().createInversionMatrix(E,o.canonical),V=e=>{E.depthOcclusionForSymbolsAndCircles&&(a.hasInitialOcclusionOpacityProperties||i.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},U=()=>{let r=A&&"point"!==a.layout.get("symbol-placement"),l=[];V(l);let u=r||R,d=a.paint.get("icon-image-cross-fade").constantOr(0);i.terrainRenderModeElevated()&&C&&l.push("PITCH_WITH_MAP_TERRAIN"),p&&(l.push("PROJECTION_GLOBE_VIEW"),u&&l.push("PROJECTED_POS_ON_VIEWPORT")),d>0&&l.push("ICON_TRANSITION"),s.icon.zOffsetVertexBuffer&&l.push("Z_OFFSET"),0===x&&0===v&&0===b&&1===w||l.push("COLOR_ADJUSTMENT"),s.sdfIcons&&l.push("RENDER_SDF");let y=s.icon.programConfigurations.get(a.id),S=i.getOrCreateProgram("symbol",{config:y,defines:l}),I=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],P=s.iconSizeData,z=e.bp(P,E.zoom),D=C||0!==E.pitch,O=ty(m,n.tileID.canonical,C,A,E,s.getProjection(),_),F=tv(m,n.tileID.canonical,C,A,E,s.getProjection(),_),U=i.translatePosMatrix(F,n,h,c,!0),j=i.translatePosMatrix(m,n,h,c),G=u?aa:O,q=A&&!C&&!r,Z=B;(k||E.mercatorFromTransition)&&!A&&(Z=an(E));let H=p?Z:B,$=a.getColorAdjustmentMatrix(x,v,b,w),W=r1(P.kind,z,q,C,i,j,G,U,T,!1,I,[0,0],!0,o,f,L,N,H,s.getProjection(),$,d),X=n.imageAtlasTexture?n.imageAtlasTexture:null,Y=1!==a.layout.get("icon-size").constantOr(0)||s.iconsNeedLinear,K=s.sdfIcons||i.options.rotating||i.options.zooming||Y||D?M.LINEAR:M.NEAREST,J=s.sdfIcons&&0!==a.paint.get("icon-halo-width").constantOr(1),Q=i.terrain&&C&&r?e.ad.mat4.invert(e.ad.mat4.create(),O):aa;if(r&&s.icon){let e=E.elevation,r=e?e.getAtTileOffsetFunc(o,E.center.lat,E.worldSize,s.getProjection()):null,a=tx(m,n.tileID.canonical,C,A,E,s.getProjection(),_);tT(s,m,i,!1,a,F,C,g,r,o)}return{program:S,buffers:s.icon,uniformValues:W,atlasTexture:X,atlasTextureIcon:null,atlasInterpolation:K,atlasInterpolationIcon:null,isSDF:s.sdfIcons,hasHalo:J,tile:n,labelPlaneMatrixInv:Q}},j=()=>{let r=I&&"point"!==a.layout.get("symbol-placement"),l=[],h=r||O||R;i.terrainRenderModeElevated()&&P&&l.push("PITCH_WITH_MAP_TERRAIN"),p&&(l.push("PROJECTION_GLOBE_VIEW"),h&&l.push("PROJECTED_POS_ON_VIEWPORT")),s.text.zOffsetVertexBuffer&&l.push("Z_OFFSET"),s.iconsInText&&l.push("RENDER_TEXT_AND_SYMBOL"),l.push("RENDER_SDF"),V(l);let c=s.text.programConfigurations.get(a.id),g=i.getOrCreateProgram("symbol",{config:c,defines:l}),x,v=[0,0],b=null,w=s.textSizeData;s.iconsInText&&(v=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],b=n.imageAtlasTexture?n.imageAtlasTexture:null,x=P||0!==E.pitch||i.options.rotating||i.options.zooming||"composite"===w.kind||"camera"===w.kind?M.LINEAR:M.NEAREST);let S=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],A=a.layout.get("text-size-scale-range"),C=e.ay(i.scaleFactor,A[0],A[1]),z=e.bp(w,E.zoom,C),D=ty(m,n.tileID.canonical,P,I,E,s.getProjection(),_),F=tv(m,n.tileID.canonical,P,I,E,s.getProjection(),_),U=i.translatePosMatrix(F,n,u,d,!0),j=i.translatePosMatrix(m,n,u,d),G=h?aa:D,q=I&&!P&&!r,Z=B;(k||E.mercatorFromTransition)&&!I&&(Z=an(E));let H=r1(w.kind,z,q,P,i,j,G,U,T,!0,S,v,!0,o,f,L,N,p?Z:B,s.getProjection(),null,null,C),$=n.glyphAtlasTexture?n.glyphAtlasTexture:null,W=M.LINEAR,X=0!==a.paint.get("text-halo-width").constantOr(1),Y=i.terrain&&P&&r?e.ad.mat4.invert(e.ad.mat4.create(),D):aa;if(r&&s.text){let e=E.elevation,r=e?e.getAtTileOffsetFunc(o,E.center.lat,E.worldSize,s.getProjection()):null,a=tx(m,n.tileID.canonical,P,I,E,s.getProjection(),_);tT(s,m,i,!0,a,F,P,y,r,o)}return{program:g,buffers:s.text,uniformValues:H,atlasTexture:$,atlasTextureIcon:b,atlasInterpolation:W,atlasInterpolationIcon:x,isSDF:!0,hasHalo:X,tile:n,labelPlaneMatr
98ixInv:Y}},G=s.icon.segments.get().length,q=s.text.segments.get().length,Z=G&&!l.onlyText?U():null,H=q&&!l.onlyIcons?j():null,$=a.paint.get("icon-opacity").constantOr(1),W=a.paint.get("text-opacity").constantOr(1);if(z&&s.canOverlap){D=!0;let i=$&&!l.onlyText?s.icon.segments.get():[],r=W&&!l.onlyIcons?s.text.segments.get():[];for(let r of i)F.push({segments:new e.b8([r]),sortKey:r.sortKey,state:Z});for(let i of r)F.push({segments:new e.b8([i]),sortKey:i.sortKey,state:H})}else l.onlyText||F.push({segments:$?s.icon.segments:new e.b8([]),sortKey:0,state:Z}),l.onlyIcons||F.push({segments:W?s.text.segments:new e.b8([]),sortKey:0,state:H})}for(let e of(D&&F.sort((e,i)=>e.sortKey-i.sortKey),F)){let r=e.state;if(r)if(i.terrain?i.terrain.setupElevationDraw(r.tile,r.program,{useDepthForOcclusion:E.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:r.labelPlaneMatrixInv}):i.setupDepthForOcclusion(E.depthOcclusionForSymbolsAndCircles,r.program),S.activeTexture.set(M.TEXTURE0),r.atlasTexture&&r.atlasTexture.bind(r.atlasInterpolation,M.CLAMP_TO_EDGE,!0),r.atlasTextureIcon&&(S.activeTexture.set(M.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,M.CLAMP_TO_EDGE,!0)),i.uploadCommonLightUniforms(i.context,r.program),r.hasHalo){let n=r.uniformValues;n.u_is_halo=1,as(r.buffers,e.segments,a,i,r.program,R,o,s,n,2),n.u_is_halo=0}else{if(r.isSDF){let n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,as(r.buffers,e.segments,a,i,r.program,R,o,s,n,1)),n.u_is_halo=0}as(r.buffers,e.segments,a,i,r.program,R,o,s,r.uniformValues,1)}}}function as(e,i,r,a,n,o,s,l,h,u){let c=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];n.draw(a,a.context.gl.TRIANGLES,o,s,l,t3.disabled,h,r.id,e.layoutVertexBuffer,e.indexBuffer,i,r.paint,a.transform.zoom,e.programConfigurations.get(r.id),c,u)}function al(i,r,a,n,o){var s;let l,h;if(!a.layout||"none"===a.layout.get("fill-elevation-reference"))return;let u=i.context.gl,c=new t1(i.context.gl.LEQUAL,t1.ReadWrite,i.depthRangeFor3D),d=new t1(i.context.gl.GREATER,t1.ReadWrite,i.depthRangeFor3D),p=(s=i.transform,l=e.c4(s.pitch),h=.01,s.isOrthographic&&(h=e.ah(1e-4,h,e.c9(l>=15?1:l/15))),2*h),f=i.transform.getFreeCameraOptions().position,m="elevatedStructuresDepthReconstruct",_=i.getOrCreateProgram(m,{defines:["DEPTH_RECONSTRUCTION"]}),g=i.getOrCreateProgram(m);for(let s of n){let n,l,h,m,y=r.getTile(s),x=y.getBucket(a);if(!x)continue;let v=x.elevatedStructures;if(!v)continue;let b=x.elevationBufferData.heightRange,w=function(i,r){let a=1<<i.canonical.z,n=(r.x*a-i.canonical.x-i.wrap*a)*e.ai,o=(r.y*a-i.canonical.y)*e.ai,s=e.d5(r.z,r.y);return e.ad.vec3.fromValues(n,o,s)}(s.toUnwrapped(),f),T=i.translatePosMatrix(s.projMatrix,y,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));if("initialize"===o){if(!b||b.min>=1||0===v.depthSegments.segments[0].primitiveLength)continue;n=rG(T,w,p,1,0),l=c,h=v.depthSegments,m=_}else if("reset"===o){if(!b||b.min>=0||0===v.maskSegments.segments[0].primitiveLength)continue;n=rG(T,w,0,0,1),l=d,h=v.maskSegments,m=_}else if("geometry"===o){if(0===v.depthSegments.segments[0].primitiveLength)continue;n=rG(T,w,p,1,0),l=c,h=v.depthSegments,m=g}m.draw(i,u.TRIANGLES,l,t2.disabled,t0.disabled,t3.disabled,n,a.id,v.vertexBuffer,v.indexBuffer,h,a.paint,i.transform.zoom)}}function ah(i,r,a){let{painter:n,sourceCache:o,layer:s,coords:l,colorMode:h,elevationType:u,terrainEnabled:c,pass:d}=i,p=n.context.gl,f=s.paint.get("fill-pattern"),m=u;"road"!==u||r&&!c||(m="none");let _="road"===m,g=new t1(n.context.gl.LEQUAL,t1.ReadWrite,n.depthRangeFor3D),y=f&&f.constantOr(1),x=(i,u)=>{let c,d,x,v,b;for(let w of(u?(d=y&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",c=p.LINES):(d=y?"fillPattern":"fill",c=p.TRIANGLES),l)){let l=o.getTile(w);if(y&&!l.patternsLoaded())continue;let T=l.getBucket(s);if(!T)continue;let S=r?T.elevationBufferData:T.bufferData;if(S.isEmpty())continue;n.prepareDrawTile();let M=S.programConfigurations.get(s.id),E=n.isTileAffectedByFog(w),A=[],I=[];_&&(A.push("ELEVATED_ROADS"),I.push(S.elevatedLayoutVertexBuffer));let C=n.getOrCreateProgram(d,{config:M,overrideFog:E,defines:A});y&&(n.context.activeTexture.set(p.TEXTURE0),l.imageAtlasTexture&&l.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),M.updatePaintBuffers());let P=f.constantOr(null);if(P&&l.imageAtlas){let i=l.imageAtlas,r=e.d0.from(P).getPrimary().scaleSelf(e.q.devicePixelRatio).toString(),a=i.patternPositions.get(r);a&&M.setConstantPatternPositions(a)}let z=n.translatePosMatrix(w.projMatrix,l,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor")),D=s.paint.get("fill-emissive-strength");if(u){v=S.lineIndexBuffer,b=S.lineSegments;let e=n.terrain&&n.terrain.renderingToTexture?n.terrain.drapeBufferSize:[p.drawingBufferWidth,p.drawingBufferHeight];x="fillOutlinePattern"===d&&y?rj(z,D,n,l,e):rU(z,D,e)}else v=S.indexBuffer,b=S.triangleSegments,x=y?rV(z,D,n,l):rN(z,D);n.uploadCommonUniforms(n.context,C,w.toUnwrapped()),C.draw(n,c,"none"!==m?g:i,a||n.stencilModeForClipping(w),h,t3.disabled,x,s.id,S.layoutVertexBuffer,v,b,s.paint,n.transform.zoom,M,I)}};n.renderPass===d&&x(n.depthModeForSublayer(1,"opaque"===n.renderPass?t1.ReadWrite:t1.ReadOnly),!1),"none"===m&&"translucent"===n.renderPass&&s.paint.get("fill-antialias")&&x(n.depthModeForSublayer(2*!!s.getPaintProperty("fill-outline-color"),t1.ReadOnly),!0)}function au(i,r,a,n,o,s,l,h){let u;a.resetLayerRenderingStats(i);let c=i.context,d=c.gl,p=i.transform,f=a.paint.get("fill-extrusion-pattern"),m=f.constantOr(1),_=a.paint.get("fill-extrusion-opacity"),g=i.style.enable3dLights(),y=a.paint.get(g&&!m?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),x=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),y],v=a.layout.get("fill-extrusion-edge-radius"),b=v>0&&!a.paint.get("fill-extrusion-rounded-roof"),w=b?0:v,T="globe"===p.projection.name?e.d6():0,S="globe"===p.projection.name,M=S?e.ag(p.zoom):0,E=[e.av(p.center.lng),e.aC(p.center.lat)],A="none"===a.paint.get("fill-extrusion-flood-light-color-use-theme").
98constantOr("default"),I=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(A?null:a.lut).toArray01().slice(0,3),C=a.paint.get("fill-extrusion-flood-light-intensity"),P=a.paint.get("fill-extrusion-vertical-scale"),z=0!==a.paint.get("fill-extrusion-line-width").constantOr(1),D=a.paint.get("fill-extrusion-height-alignment"),R=a.paint.get("fill-extrusion-base-alignment"),L=it(i,a.paint.get("fill-extrusion-cutoff-fade-range")),O=[];S&&O.push("PROJECTION_GLOBE_VIEW"),x[0]>0&&O.push("FAUX_AO"),b&&O.push("ZERO_ROOF_RADIUS"),h&&O.push("HAS_CENTROID"),C>0&&O.push("FLOOD_LIGHT"),L.shouldRenderCutoff&&O.push("RENDER_CUTOFF"),z&&O.push("RENDER_WALL_MODE");let k="shadow"===i.renderPass,F=i.shadowRenderer,B=k&&!!F;i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!0);let N=[0,0,0];if(F){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(N=ih(i.style,e,r)),k||(O.push("RENDER_SHADOWS","DEPTH_TEXTURE"),F.useNormalOffset&&O.push("NORMAL_OFFSET")),u=O.concat(["SHADOWS_SINGLE_CASCADE"])}let V=B?"fillExtrusionDepth":m?"fillExtrusionPattern":"fillExtrusion",U=a.getLayerRenderingStats();for(let g of n){let n,y=r.getTile(g),v=y.getBucket(a);if(!v||v.projection.name!==p.projection.name)continue;let b=!1;F&&(b=0===F.getMaxCascadeForTile(g.toUnwrapped()));let A=i.isTileAffectedByFog(g),B=v.programConfigurations.get(a.id),j=i.getOrCreateProgram(V,{config:B,defines:b?u:O,overrideFog:A});if(i.terrain&&i.terrain.setupElevationDraw(y,j,{useMeterToDem:!0}),!v.centroidVertexBuffer){let e=j.attributes.a_centroid_pos;void 0!==e&&d.vertexAttrib2f(e,0,0)}!k&&F&&F.setupShadows(y.tileID.toUnwrapped(),j,"vector-tile",y.tileID.overscaledZ),m&&(i.context.activeTexture.set(d.TEXTURE0),y.imageAtlasTexture&&y.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),B.updatePaintBuffers());let G=f.constantOr(null);if(G&&y.imageAtlas){let i=y.imageAtlas,r=e.d0.from(G).getPrimary().scaleSelf(e.q.devicePixelRatio),a=i.patternPositions.get(r.toString());a&&B.setConstantPatternPositions(a)}let q=a.paint.get("fill-extrusion-vertical-gradient"),Z=1/v.tileToMeter;if(k&&F){if(function(i,r,a){let n=a.transform,o=a.shadowRenderer;if(!o)return!0;let s=i.toUnwrapped(),l=n.tileSize*o._cascades[a.currentShadowCascade].scale,h=r.maxHeight;if(n.elevation){let e=n.elevation.getMinMaxForTile(i);e&&(h+=e.max)}let u=[...o.shadowDirection];u[2]=-u[2];let c=o.computeSimplifiedTileShadowVolume(s,h,l,u);if(!c)return!1;let d=[ad,ap,af,u,[u[0],0,u[2]],[0,u[1],u[2]]],p="globe"===n.projection.name,f=n.scaleZoom(l),m=e.bR.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,f,!p),_=o.getCurrentCascadeFrustum();return 0===m.intersectsPrecise(c.vertices,c.planes,d)||0===_.intersectsPrecise(c.vertices,c.planes,d)}(y.tileID,v,i))continue;n=rF(F.calculateShadowPassMatrixFromTile(y.tileID.toUnwrapped()),w,Z,P,D,R)}else{let e=i.translatePosMatrix(g.expandedProjMatrix,y,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),r=p.projection.createInversionMatrix(p,g.canonical);n=m?rB(e,i,q,_,x,w,Z,g,y,T,D,R,M,E,r,I,P):rk(e,i,q,_,x,w,Z,g,T,D,R,M,E,r,I,P,C,N)}i.uploadCommonUniforms(c,j,g.toUnwrapped(),null,L);let H=v.segments;if("mercator"===p.projection.name&&!k&&!(H=v.getVisibleSegments(y.tileID,i.terrain,i.transform.getFrustum(0))).get().length)continue;if(U)if(k)for(let e of H.get())U.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(let e of H.get())U.numRenderedVerticesInTransparentPass+=e.primitiveLength;let $=[];(i.terrain||h)&&$.push(v.centroidVertexBuffer),S&&$.push(v.layoutVertexExtBuffer),z&&$.push(v.wallVertexBuffer),j.draw(i,c.gl.TRIANGLES,o,s,l,t3.backCCW,n,a.id,v.layoutVertexBuffer,v.indexBuffer,H,a.paint,i.transform.zoom,B,$)}i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!1)}function ac(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=i.context,w=b.gl,T=i.transform,S=i.transform.zoom,M=[],E=it(i,a.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===c?(M.push("CLEAR_SUBPASS"),v&&(M.push("CLEAR_FROM_TEXTURE"),b.activeTexture.set(w.TEXTURE0),v.bind(w.LINEAR,w.CLAMP_TO_EDGE))):"sdf"===c&&M.push("SDF_SUBPASS"),y&&M.push("HAS_CENTROID"),E.shouldRenderCutoff&&M.push("RENDER_CUTOFF");let A=a.layout.get("fill-extrusion-edge-radius"),I=(e,r,n,c,x)=>{let w=r.programConfigurations.get(a.id),T=i.isTileAffectedByFog(e),I=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:w,defines:M,overrideFog:T}),C={u_matrix:c,u_opacity:d,u_ao_pass:+!!u,u_meter_to_tile:x,u_ao:[p,f*x],u_flood_light_intensity:m,u_flood_light_color:_,u_attenuation:g,u_edge_radius:S>=17?0:A*x,u_fb:0,u_fb_size:v?v.size[0]:0,u_dynamic_offset:1},P=[];y&&P.push(r.hiddenByLandmarkVertexBuffer),i.uploadCommonUniforms(b,I,e.toUnwrapped(),null,E),I.draw(i,b.gl.TRIANGLES,o,s,l,h,C,a.id,r.vertexBuffer,r.indexBuffer,n,a.paint,S,w,P)};for(let o of n){let n=r.getTile(o),s=n.getBucket(a);if(!s||s.projection.name!==T.projection.name||!s.groundEffect||s.groundEffect&&!s.groundEffect.hasData())continue;let l=s.groundEffect,h=1/s.tileToMeter;{let e=i.translatePosMatrix(o.projMatrix,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),r=l.getDefaultSegment();I(o,l,r,e,h)}if(x)for(let s=0;s<4;s++){let l,u,c=e.d7[s](o),d=r.getTile(c);if(!d)continue;let p=d.getBucket(a);if(!p||p.projection.name!==T.projection.name||!p.groundEffect||p.groundEffect&&!p.groundEffect.hasData())continue;let f=p.groundEffect;0===s?(l=[-e.ai,0,0],u=1):1===s?(l=[e.ai,0,0],u=0):2===s?(l=[0,-e.ai,0],u=3):(l=[0,e.ai,0],u=2);let m=f.regionSegments[u];if(!m)continue;let _=new Float32Array(16);e.ad.mat4.translate(_,o.projMatrix,l),I(o,f,m,i.translatePosMatrix(_,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),h)}}}let ad=[1,0,0],ap=[0,1,0],af=[0,0,1];function am(i){return[i[0]*e.dc,i[1]*e.dc,i[2]*e.dc,0]}
98function a_(i,r,a,n,o,s,l,h,u){let c,d,p,f,m,_,g,y,x=n.getSource(),v=a.globeSharedBuffers;if(!v||(r&&(c=n.getTile(r)),x instanceof e.aK?(d=x.texture,p=e.cJ(0,0,a.transform)):c&&r&&(d=c.texture,p=e.cJ(r.canonical.z,r.canonical.x,a.transform)),!d||!p))return;i||(p=e.ad.mat4.scale(e.ad.mat4.create(),p,[1,-1,1]));let b=a.context,w=b.gl,T="nearest"===o.paint.get("raster-resampling")?w.NEAREST:w.LINEAR,S=a.colorModeForDrapableLayerRenderPass(s),M=l.defines;M.push("GLOBE_POLES");let E=new t1(w.LEQUAL,t1.ReadWrite,a.depthRangeFor3D),A=Float32Array.from(a.transform.expandedFarZProjMatrix),I=Float32Array.from(e.bc(e.cI(new e.bT(0,0,0))));a.terrain&&a.terrain.prepareDrawTile(),b.activeTexture.set(w.TEXTURE0),d.bind(T,w.CLAMP_TO_EDGE),b.activeTexture.set(w.TEXTURE1),d.bind(T,w.CLAMP_TO_EDGE),"useMipmap"in d&&b.extTextureFilterAnisotropic&&a.transform.pitch>20&&w.texParameterf(w.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);let[C,P,z,D]=r?v.getPoleBuffers(r.canonical.z,!1):v.getPoleBuffers(0,!0),R=o.paint.get("raster-elevation");i?(f=C,a.renderDefaultNorthPole=0!==R):(f=P,a.renderDefaultSouthPole=0!==R);let L=am(l.mix),O=(m=p,_=e.ag(a.transform.zoom),g=l.offset,y=l.range,rY(A,I,m,new Float32Array(16),new Float32Array(9),[0,0],_,[0,0],[0,0,0,0],1,{opacity:1,mix:0},o,[0,0],R,2,L,g,y,1,0,s)),k=a.getOrCreateProgram("raster",{defines:M});a.uploadCommonUniforms(b,k,null),k.draw(a,w.TRIANGLES,E,u,S,h,O,o.id,f,z,D)}var ag=e.dd([{name:"a_index",type:"Int16",components:1}]);class ay{constructor(i,r,a,n){const o={width:a[0],height:a[1],data:null},s=i.gl;this.targetColorTexture=new e.T(i,o,s.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new e.T(i,o,s.RGBA8,{useMipmap:!1}),this.context=i,this.updateParticleTexture(r,n),this.lastInvalidatedAt=0}updateParticleTexture(i,r){if(this.particleTextureDimension===r.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());let a=this.context.gl,n=r.width*r.height;this.particleTexture0=new e.T(this.context,r,a.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,r,a.RGBA8,{premultiply:!1,useMipmap:!1});let o=new e.de;o.reserve(n);for(let e=0;e<n;e++)o.emplaceBack(e);this.particleIndexBuffer=this.context.createVertexBuffer(o,ag.members,!0),this.particleSegment=e.b8.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=r.width}update(i){return!(this.lastInvalidatedAt<i&&(this.lastInvalidatedAt=e.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}let ax=new e.al(1,0,0,1),av=new e.al(0,1,0,1),ab=new e.al(0,0,1,1),aw=new e.al(1,0,1,1),aT=new e.al(0,1,1,1);function aS(i,r,a,n,o,s,l){let h=i.context,u=i.transform,c=h.gl,d="globe"===u.projection.name,p=e.ad.mat4.clone(a.projMatrix);if(d&&e.ag(u.zoom)>0){let i=e.bb(a.canonical,u),r=e.dg(i);p=e.ad.mat4.multiply(new Float32Array(16),u.globeMatrix,r),e.ad.mat4.multiply(p,u.projMatrix,p)}let f=e.ad.mat4.create();f[12]+=2*o/(e.q.devicePixelRatio*u.width),f[13]+=2*s/(e.q.devicePixelRatio*u.height),e.ad.mat4.multiply(p,f,p);let m=i.getOrCreateProgram("debug",{defines:d?["PROJECTION_GLOBE_VIEW"]:[]}),_=r.getTileByID(a.key);i.terrain&&i.terrain.setupElevationDraw(_,m);let g=t1.disabled,y=t2.disabled,x=i.colorModeForRenderPass(),v="$debug";h.activeTexture.set(c.TEXTURE0),i.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),d?_._makeGlobeTileDebugBuffers(i.context,u):_._makeDebugTileBoundsBuffers(i.context,u.projection);let b=_._tileDebugBuffer||i.debugBuffer,w=_._tileDebugIndexBuffer||i.debugIndexBuffer,T=_._tileDebugSegments||i.debugSegments;if(m.draw(i,c.LINE_STRIP,g,y,x,t3.disabled,rZ(p,n),v,b,w,T,null,null,null,[_._globeTileDebugBorderBuffer]),l){var S;let e,r,n,o=_.latestRawTileData,s=Math.floor((o&&o.byteLength||0)/1024),l=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(l+=` => ${a.overscaledZ}`),l+=` ${_.state}`,l+=` ${s}kb`,S=l,i.initDebugOverlayCanvas(),e=i.debugOverlayCanvas,r=i.context.gl,(n=i.debugOverlayCanvas.getContext("2d")).clearRect(0,0,e.width,e.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(S,5,5),n.strokeText(S,5,5),i.debugOverlayTexture.update(e),i.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}let M=512/Math.min(r.getTile(a).tileSize,512)*(a.overscaledZ/u.zoom)*.5,E=_._tileDebugTextBuffer||i.debugBuffer,A=_._tileDebugTextIndexBuffer||i.quadTriangleIndexBuffer,I=_._tileDebugTextSegments||i.debugSegments;m.draw(i,c.TRIANGLES,g,y,t0.alphaBlended,t3.disabled,rZ(p,e.al.transparent,M),v,E,A,I,null,null,null,[_._globeTileDebugTextBuffer])}function aM(e,i,r,a){aA(e,0,i+r/2,e.transform.width,r,a)}function aE(e,i,r,a){aA(e,i-r/2,0,r,e.transform.height,a)}function aA(i,r,a,n,o,s){let l=i.context,h=l.gl;h.enable(h.SCISSOR_TEST),h.scissor(r*e.q.devicePixelRatio,a*e.q.devicePixelRatio,n*e.q.devicePixelRatio,o*e.q.devicePixelRatio),l.clear({color:s}),h.disable(h.SCISSOR_TEST)}let{members:aI}=e.dd([{name:"a_pos_3f",components:3,type:"Float32"}]);function aC(e,i,r,a){e.emplaceBack(i,r,a)}class aP{constructor(i){this.vertexArray=new e.dh,this.indices=new e.aV,aC(this.vertexArray,-1,-1,1),aC(this.vertexArray,1,-1,1),aC(this.vertexArray,-1,1,1),aC(this.vertexArray,1,1,1),aC(this.vertexArray,-1,-1,-1),aC(this.vertexArray,1,-1,-1),aC(this.vertexArray,-1,1,-1),aC(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=i.createVertexBuffer(this.vertexArray,aI),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=e.b8.simpleSegment(0,0,36,12)}}function az(i,r,a,n,o,s){let l,h=i.context.gl,u=r.paint.get("sky-atmosphere-color"),c=r.paint.get("sky-atmosphere-halo-color"),d=r.paint.get("sky-atmosphere-sun-intensity"),p=(l=e.ad.mat3.fromMat4(e.ad.mat3.create(),n),{u_matrix_3f:l,u_sun_direction:o,u_sun_intensity:d,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});h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_CUBE_MAP_POSITIVE_X+s,r.skyboxTexture,0),a.draw(i,h.TRIANGLES,t1.disabled,t2.disabled,t0.unblended,t3.frontCW,p,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}let aD=e.dd([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class aR{constructor(i){const r=new e.di;r.emplaceBack(-1,1,1,0,0),r.emplaceBack(1,1,1,1,0),r.emplaceBack(1,-1,1,1,1),r.emplaceBack(-1,-1,1,0,1);const a=new e.aV;a.emplaceBack(0,1,2),a.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(r,aD.members),this.indexBuffer=i.createIndexBuffer(a),this.segments=e.b8.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let aL=e.dd([{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_fade_opacity",components:1}]);class aO{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ak{constructor(i){this.colorModeAlphaBlendedWriteRGB=new t0([1,771,1,771],e.al.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new t0([1,0,1,0],e.al.transparent,[!1,!1,!1,!0]),this.params=new aO,this.updateNeeded=!0,i.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),i.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(i){let r=i.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new aR(r);let i=this.params.sizeRange,a=this.params.intensityRange,n=function(i){let r=e.dl(30),a=[];for(let n=0;n<i;++n){let i=2*Math.PI*r(),n=Math.acos(1-2*r())-.5*Math.PI;a.push(e.ad.vec3.fromValues(Math.cos(n)*Math.cos(i),Math.cos(n)*Math.sin(i),Math.sin(n)))}return a}(this.params.starsCount),o=e.dl(300),s=new e.dj,l=new e.aV,h=0;for(let r=0;r<n.length;++r){let u=e.ad.vec3.scale([],n[r],200),c=Math.max(0,1+.01*i*(o()-.5)),d=Math.max(0,1+.01*a*(o()-.5));s.emplaceBack(u[0],u[1],u[2],-1,-1,c,d),s.emplaceBack(u[0],u[1],u[2],1,-1,c,d),s.emplaceBack(u[0],u[1],u[2],1,1,c,d),s.emplaceBack(u[0],u[1],u[2],-1,1,c,d),l.emplaceBack(h+0,h+1,h+2),l.emplaceBack(h+0,h+2,h+3),h+=4}this.starsVx=r.createVertexBuffer(s,aL.members),this.starsIdx=r.createIndexBuffer(l),this.starsSegments=e.b8.simpleSegment(0,0,s.length,l.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(i,r){let a=i.context,n=a.gl,o=i.transform,s=new t1(n.LEQUAL,t1.ReadOnly,[0,1]),l=e.ag(o.zoom),h=i.style.getLut(r.scope),u="none"===r.properties.get("color-use-theme"),c=r.properties.get("color").toRenderColor(u?null:h).toArray01(),d="none"===r.properties.get("high-color-use-theme"),p=r.properties.get("high-color").toRenderColor(d?null:h).toArray01(),f="none"===r.properties.get("space-color-use-theme"),m=r.properties.get("space-color").toRenderColor(f?null:h).toArray01PremultipliedAlpha(),_=e.dk(r.properties.get("horizon-blend"),0,1,5e-4,.25),g=e.cD(i,a,o)&&5e-4===_?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,y=i.frameCounter/1e3%1,x=e.ad.vec3.length(o.globeCenterInViewSpace),v=Math.acos(Math.sqrt(Math.pow(x,2)-Math.pow(g,2))/x),b=e=>{let r,h,u,d,f="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];e&&f.push("ALPHA_PASS");let g=i.getOrCreateProgram("globeAtmosphere",{defines:f}),x=(r=o.frustumCorners.TL,h=o.frustumCorners.TR,u=o.frustumCorners.BR,d=o.frustumCorners.BL,{u_frustum_tl:r,u_frustum_tr:h,u_frustum_br:u,u_frustum_bl:d,u_horizon:o.frustumCorners.horizon,u_transition:l,u_fadeout_range:_,u_color:c,u_high_color:p,u_space_color:m,u_temporal_offset:y,u_horizon_angle:v});i.uploadCommonUniforms(a,g);let b=this.atmosphereBuffer;b&&g.draw(i,n.TRIANGLES,s,t2.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,t3.backCW,x,e?"atmosphere_glow_alpha":"atmosphere_glow",b.vertexBuffer,b.indexBuffer,b.segments)};b(!1),b(!0)}drawStars(i,r){let a=e.ay(r.properties.get("star-intensity"),0,1);if(0===a)return;let n=i.context,o=n.gl,s=i.transform,l=i.getOrCreateProgram("stars"),h=e.ad.quat.identity([]);e.ad.quat.rotateX(h,h,-s._pitch),e.ad.quat.rotateZ(h,h,-s.angle),e.ad.quat.rotateX(h,h,e.ak(s._center.lat)),e.ad.quat.rotateY(h,h,-e.ak(s._center.lng));let u=e.ad.mat4.fromQuat(new Float32Array(16),h),c=e.ad.mat4.multiply([],s.starsProjMatrix,u),d=e.ad.mat3.fromMat4([],u),p=e.ad.mat3.invert([],d),f=[0,1,0];e.ad.vec3.transformMat3(f,f,p),e.ad.vec3.scale(f,f,this.params.sizeMultiplier);let m=[1,0,0];e.ad.vec3.transformMat3(m,m,p),e.ad.vec3.scale(m,m,this.params.sizeMultiplier);let _={u_matrix:Float32Array.from(c),u_up:f,u_right:m,u_intensity_multiplier:a};i.uploadCommonUniforms(n,l),this.starsVx&&this.starsIdx&&l.draw(i,o.TRIANGLES,t1.disabled,t2.disabled,this.colorModeAlphaBlendedWriteRGB,t3.disabled,_,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function aF(i,r){let a=[...i],n=r.cameraWorldSizeForFog/r.worldSize,o=e.ad.mat4.identity([]);return e.ad.mat4.scale(o,o,[n,n,1]),e.ad.mat4.multiply(a,o,a),e.ad.mat4.multiply(a,r.worldToFogMatrix,a),a}function aB(i,r,a,n,o){let s=a.material,l=n.context,{baseColorTexture:h,metallicRoughnessTexture:u}=s.pbrMetallicRoughness,{normalTexture:c,occlusionTexture:d,emissionTexture:p}=s;function f(e,r,a){if(e&&(i.push(r),l.activeTexture.set(l.gl.TEXTURE0+a),e.gfxTexture)){let{minFilter:i,magFilter:r,wrapS:a,wrapT:n}=e.sampler;e.gfxTexture.bindExtraParam(i,r,a,n)}}f(h,"HAS_TEXTURE_u_baseColorTexture",5),f(u,"HAS_TEXTURE_u_metallicRoughnessTexture",6),f(c,"HAS_TEXTURE_u_normalTexture",7),f(d,"HAS_TEXTURE_u_occlusionTexture",8),f(p,"HAS_TEXTURE_u_emissionTexture",9),o&&(o.texture||(o.texture=new e.dn(n.context,o.image,[o.image.height,o.image.height,o.image.height],l.gl.RGBA8)),l.activeTexture.set(l.gl.TEXTURE0+10),o.texture&&o.texture.bind(l.gl.LINEAR,l.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_3f"),r.push(a.normalBuffer)),a.pbrBuffer&&(i.push("HAS_ATTRIBUTE_a_pbr"),i.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(a.pbrBuffer)),"OPAQUE"!==s.alphaMode&&"MASK"!==s.alphaMode||i.push("UNPREMULT_TEXTURE_IN_SHADER"),s.defined||i.push("DIFFUSE_SHADED");let m=n.shadowRenderer;m&&(i.push("RENDER_SHADOWS","DEPTH_TEXTURE"),m.useNormalOffset&&i.push("NORMAL_OFFSET"))}function aN(i,r,a,n,o,s){let l,h=a.paint.get("model-opacity").constantOr(1),u=r.context,c=new t1(r.context.gl.LEQUAL,t1.ReadWrite,r.depthRangeFor3D),d=r.transform,p=i.mesh,f=p.material,m=f.pbrMetallicRoughness,_=r.style.fog;l="pixels"===r.transform.projection.zAxisUnit?[...i.nodeModelMatrix]:e.ad.mat4.multiply([],n.zScaleMatrix,i.nodeModelMatrix),e.ad.mat4.multiply(l,n.negCameraPosMatrix,l);let g=e.ad.mat4.invert([],l);e.ad.mat4.transpose(g,g);
98let y="none"===a.paint.get("model-color-use-theme").constantOr("default"),x=a.paint.get("model-emissive-strength").constantOr(0),v=r5(new Float32Array(i.worldViewProjection),new Float32Array(l),new Float32Array(g),null,r,h,m.baseColorFactor.toRenderColor(null),f.emissiveFactor,m.metallicFactor,m.roughnessFactor,f,x,a),b={defines:[]},w=[],T=r.shadowRenderer;T&&(T.useNormalOffset=!1),aB(b.defines,w,p,r,y?null:a.lut);let S=null;if(_){let e=aF(i.nodeModelMatrix,r.transform);if(S=new Float32Array(e),"globe"!==d.projection.name){let i=p.aabb.min,r=p.aabb.max,[a,n]=_.getOpacityForBounds(e,i[0],i[1],r[0],r[1]);b.overrideFog=a>=.05||n>=.05}}let M=it(r,a.paint.get("model-cutoff-fade-range"));M.shouldRenderCutoff&&b.defines.push("RENDER_CUTOFF");let E=r.getOrCreateProgram("model",b);r.uploadCommonUniforms(u,E,null,S,M),"shadow"!==r.renderPass&&T&&T.setupShadowsFromMatrix(i.nodeModelMatrix,E),E.draw(r,u.gl.TRIANGLES,c,o,s,p.material.doubleSided?t3.disabled:t3.backCCW,v,a.id,p.vertexBuffer,p.indexBuffer,p.segments,a.paint,r.transform.zoom,void 0,w)}function aV(e,i,r,a){let n=r.shadowRenderer;if(!n)return;let o=n.getShadowPassDepthMode(),s=n.getShadowPassColorMode(),l=r6(n.calculateShadowPassMatrixFromMatrix(i));r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,o,t2.disabled,s,t3.backCCW,l,a.id,e.vertexBuffer,e.indexBuffer,e.segments,a.paint,r.transform.zoom,void 0,void 0)}let aU={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.ce([0,0,0],[e.ai,e.ai,0])},aj=[1,-1,1];class aG{}class aq{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(i,r,a){{let e=this._storage.get(r.id);if(e)return e.lastUsedFrameIdx=i,e.buf}let n=a.gl,o=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),s=new ArrayBuffer(o),l=new Int16Array(s);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(s));let h=new e.dt;for(let e=0;e<o/2;e+=3){let i=l[e],r=l[e+1],a=l[e+2];h.emplaceBack(i,r),h.emplaceBack(r,a),h.emplaceBack(a,i)}let u=a.bindVertexArrayOES.current,c=new aG;return c.buf=new r9(a,h),c.lastUsedFrameIdx=i,this._storage.set(r.id,c),a.bindVertexArrayOES.set(u),c.buf}update(e){for(let[i,r]of this._storage)e-r.lastUsedFrameIdx>30&&(r.buf.destroy(),this._storage.delete(i))}destroy(){for(let[e,i]of this._storage)i.buf.destroy(),this._storage.delete(e)}}class aZ{constructor(e){this.occluderSize=30,this.depthOffset=-1e-4,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}let aH=e.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class a${registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class aW{constructor(e,i){this.revealStart=11,this.revealRange=2,e.registerParameter(this,[...i,"Reveal"],"revealStart",{min:0,max:17,step:.05}
98),e.registerParameter(this,[...i,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}let aX=e.dd([{type:"Float32",name:"a_pos_2f",components:2}]);class aY{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(i,r){var a;let n=i.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){let r=new e.du,a=new e.aV;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1),a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),this.vignetteVx=i.context.createVertexBuffer(r,aX.members),this.vignetteIdx=i.context.createIndexBuffer(a)}let o=e.b8.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){i.uploadCommonUniforms(i.context,n);let e={u_vignetteShape:(a={vignetteShape:[r.start,r.range,Math.pow(10,r.fadePower)],vignetteColor:[r.color.r,r.color.g,r.color.b,r.color.a*r.strength]}).vignetteShape,u_vignetteColor:a.vignetteColor};n.draw(i,i.context.gl.TRIANGLES,t1.disabled,t2.disabled,t0.alphaBlended,t3.disabled,e,"vignette",this.vignetteVx,this.vignetteIdx,o)}}}class aK{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(i,r){let a=i.getFreeCameraOptions().position,n=a.toAltitude(),o=a.toLngLat(),s=e.ak(o.lng),l=e.ak(o.lat),h=i.pixelsPerMeter/r,u=s*e.dv,c=e.dv*Math.log(Math.tan(Math.PI/4+l/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 e=-this._offsetYPrev+c,i=-this._elevationPrev+n;this._accumulatedOffsetX+=(-this._offsetXPrev+u)*h,this._accumulatedOffsetY+=e*h,this._accumulatedElevation+=i*h,this._offsetXPrev=u,this._offsetYPrev=c,this._elevationPrev=n}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function aJ(e,i){return[-(e[0]-Math.floor(e[0]/i)*i),-(e[1]-Math.floor(e[1]/i)*i),-(e[2]-Math.floor(e[2]/i)*i)]}function aQ(i){let r=e.dl(0x134104da55e),a=[];for(let n=0;n<i;++n){let i=2*r()-1,n=2*r()-1,o=2*r()-1;a.push(e.ad.vec3.fromValues(i,n,o))}return a}function a0(i,r,a,n,o){let s=e.ay((o-a)/(n-a),0,1);return(1-s)*i+s*r}class a1{constructor(e){this._movement=new aK,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new aY,this._ppmScaleFactor=e}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(i,r){let a=i.transform;this._movement.update(a,this._ppmScaleFactor);let n=a.starsProjMatrix,o=e.ad.quat.identity([]);e.ad.quat.rotateX(o,o,e.ak(90)-a._pitch),e.ad.quat.rotateZ(o,o,-a.angle);let s=e.ad.mat4.fromQuat(new Float32Array(16),o),l=e.ad.mat4.fromValues(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),h=e.ad.mat4.transpose([],l),u=e.ad.mat4.multiply([],h,s),c=Date.now()/1e3;return this._accumulatedTimeFromStart+=(c-this._prevTime)*r,this._prevTime=c,{projectionMatrix:n,modelviewMatrix:u}}}class a2 extends a1{constructor(e){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new aW(e.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(i){let r=i.context;if(!this.particlesVx){let i=aQ(this.particlesCount),a=new e.dw,n=new e.aV,o=0,s=e.dl(0x134104da55e);for(let e=0;e<i.length;++e){let r=i[e],l=[2*s()-1,s(),s(),s()];a.emplaceBack(r[0],r[1],r[2],-1,-1,...l),a.emplaceBack(r[0],r[1],r[2],1,-1,...l),a.emplaceBack(r[0],r[1],r[2],1,1,...l),a.emplaceBack(r[0],r[1],r[2],-1,1,...l),n.emplaceBack(o+0,o+1,o+2),n.emplaceBack(o+0,o+2,o+3),o+=4}this.particlesVx=r.createVertexBuffer(a,aH.members),this.particlesIdx=r.createIndexBuffer(n)}}draw(i){if(!this._params.overrideStyleParameters&&!i.style.rain)return;let r=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},a=i.transform.zoom;if(r.revealStart>a)return;let n=a0(0,1,r.revealStart,r.revealStart+r.revealRange,a);if(!this.particlesVx||!this.particlesIdx)return;let o=structuredClone(this._params),s=[-o.direction.x,o.direction.y,-100];e.ad.vec3.normalize(s,s);
98let l=structuredClone(this._vignetteParams);l.strength*=n,o.overrideStyleParameters||(o.intensity=i.style.rain.state.density,o.timeFactor=i.style.rain.state.intensity,o.color=structuredClone(i.style.rain.state.color),s=structuredClone(i.style.rain.state.direction),o.screenThinning.intensity=i.style.rain.state.centerThinning,o.dropletSizeX=i.style.rain.state.dropletSize[0],o.dropletSizeYScale=i.style.rain.state.dropletSize[1]/i.style.rain.state.dropletSize[0],o.distortionStrength=100*i.style.rain.state.distortionStrength,l.strength=1,l.color=structuredClone(i.style.rain.state.vignetteColor));let h=this.updateOnRender(i,o.timeFactor),u=i.context,c=u.gl,d=i.transform;this.screenTexture&&this.screenTexture.size[0]===i.width&&this.screenTexture.size[1]===i.height||(this.screenTexture=new e.T(u,{width:i.width,height:i.height,data:null},c.RGBA8)),o.distortionStrength>0&&(u.activeTexture.set(c.TEXTURE0),this.screenTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),c.copyTexSubImage2D(c.TEXTURE_2D,0,0,0,0,0,i.width,i.height));let p=i.getOrCreateProgram("rainParticle");i.uploadCommonUniforms(u,p),u.activeTexture.set(c.TEXTURE0),this.screenTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let f=[o.color.r,o.color.g,o.color.b,o.color.a],m=(r,a)=>{var n;let l=aJ(this._movement.getPosition(),r),u=o.dropletSizeX,m=o.dropletSizeX*o.dropletSizeYScale,_=i.width/2,g=i.height/2,y=a0(0,o.screenThinning.start,0,1,o.screenThinning.intensity),x=a0(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),v=a0(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),b=(n={modelview:h.modelviewMatrix,projection:h.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:l,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,boxSize:r,rainDropletSize:[u,m],distortionStrength:o.distortionStrength,rainDirection:s,color:f,screenSize:[d.width,d.height],thinningCenterPos:[_,g],thinningShape:[y,x,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:v,shapeDirectionalPower:o.shapeDirPower,shapeNormalPower:o.shapeNormalPower,mode:+!a},{u_modelview:Float32Array.from(n.modelview),u_projection:Float32Array.from(n.projection),u_time:n.time,u_cam_pos:n.camPos,u_texScreen:0,u_velocityConeAperture:n.velocityConeAperture,u_velocity:n.velocity,u_boxSize:n.boxSize,u_rainDropletSize:n.rainDropletSize,u_distortionStrength:n.distortionStrength,u_rainDirection:n.rainDirection,u_color:n.color,u_screenSize:n.screenSize,u_thinningCenterPos:n.thinningCenterPos,u_thinningShape:n.thinningShape,u_thinningAffectedRatio:n.thinningAffectedRatio,u_thinningParticleOffset:n.thinningParticleOffset,u_shapeDirectionalPower:n.shapeDirectionalPower,u_shapeNormalPower:n.shapeNormalPower,u_mode:n.mode}),w=Math.round(o.intensity*this.particlesCount),T=e.b8.simpleSegment(0,0,4*w,2*w);p.draw(i,c.TRIANGLES,t1.disabled,t2.disabled,t0.alphaBlended,t3.disabled,b,"rain_particles",this.particlesVx,this.particlesIdx,T)};o.distortionStrength>0&&m(o.boxSize,!0),m(o.boxSize,!1),this._vignette.draw(i,l)}}let a3=e.dd([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class a4 extends a1{constructor(e){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new aW(e.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(i){let r=i.context;if(!this.particlesVx){let i=aQ(this.particlesCount),a=new e.dx,n=new e.aV,o=0,s=e.dl(0x134104da55e);for(let e=0;e<i.length;++e){let r=i[e],l=s(),h=s(),u=s(),c=[e/i.length,l,h,u],d=[s(),s()];a.emplaceBack(r[0],r[1],r[2],-1,-1,...c,...d),a.emplaceBack(r[0],r[1],r[2],1,-1,...c,...d),a.emplaceBack(r[0],r[1],r[2],1,1,...c,...d),a.emplaceBack(r[0],r[1],r[2],-1,1,...c,...d),n.emplaceBack(o+0,o+1,o+2),n.emplaceBack(o+0,o+2,o+3),o+=4}this.particlesVx=r.createVertexBuffer(a,a3.members),this.particlesIdx=r.createIndexBuffer(n)}}draw(i){var r,a;let n,o,s,l,h,u,c,d,p;if(!this._params.overrideStyleParameters&&!i.style.snow)return;let f=structuredClone(this._params),m=[-f.direction.x,f.direction.y,-100];e.ad.vec3.normalize(m,m);
98let _=structuredClone(this._vignetteParams),g=f.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},y=i.transform.zoom;if(g.revealStart>y)return;let x=a0(0,1,g.revealStart,g.revealStart+g.revealRange,y);_.strength*=x,f.overrideStyleParameters||(f.intensity=i.style.snow.state.density,f.timeFactor=i.style.snow.state.intensity,f.color=structuredClone(i.style.snow.state.color),m=structuredClone(i.style.snow.state.direction),f.screenThinning.intensity=i.style.snow.state.centerThinning,f.billboardSize=2.79*i.style.snow.state.flakeSize,_.strength=1,_.color=structuredClone(i.style.snow.state.vignetteColor));let v=this.updateOnRender(i,f.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;let b=i.context,w=b.gl,T=i.transform,S=i.getOrCreateProgram("snowParticle");i.uploadCommonUniforms(b,S),r=f.boxSize,n=aJ(this._movement.getPosition(),r),o=T.width/2,s=T.height/2,l=a0(0,f.screenThinning.start,0,1,f.screenThinning.intensity),h=a0(.001,f.screenThinning.range,0,1,f.screenThinning.intensity),u=a0(0,f.screenThinning.particleOffset,0,1,f.screenThinning.intensity),a={modelview:v.modelviewMatrix,projection:v.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:n,velocityConeAperture:f.velocityConeAperture,velocity:f.velocity,horizontalOscillationRadius:f.horizontalOscillationRadius,horizontalOscillationRate:f.horizontalOscillationRate,boxSize:r,billboardSize:+f.billboardSize,simpleShapeParameters:[f.shapeFadeStart,f.shapeFadePower],screenSize:[T.width,T.height],thinningCenterPos:[o,s],thinningShape:[l,h,Math.pow(10,f.screenThinning.fadePower)],thinningAffectedRatio:f.screenThinning.affectedRatio,thinningParticleOffset:u,color:[f.color.r,f.color.g,f.color.b,f.color.a],direction:m},c={u_modelview:Float32Array.from(a.modelview),u_projection:Float32Array.from(a.projection),u_time:a.time,u_cam_pos:a.camPos,u_velocityConeAperture:a.velocityConeAperture,u_velocity:a.velocity,u_horizontalOscillationRadius:a.horizontalOscillationRadius,u_horizontalOscillationRate:a.horizontalOscillationRate,u_boxSize:a.boxSize,u_billboardSize:a.billboardSize,u_simpleShapeParameters:a.simpleShapeParameters,u_screenSize:a.screenSize,u_thinningCenterPos:a.thinningCenterPos,u_thinningShape:a.thinningShape,u_thinningAffectedRatio:a.thinningAffectedRatio,u_thinningParticleOffset:a.thinningParticleOffset,u_particleColor:a.color,u_direction:a.direction},d=Math.round(f.intensity*this.particlesCount),p=e.b8.simpleSegment(0,0,4*d,2*d),this.particlesVx&&this.particlesIdx&&S.draw(i,w.TRIANGLES,t1.disabled,t2.disabled,t0.alphaBlended,t3.disabled,c,"snow_particles",this.particlesVx,this.particlesIdx,p),this._vignette.draw(i,_)}}let a5={symbol:function(i,r,a,n,o){if("translucent"!==i.renderPass)return;let s=t2.disabled,l=i.colorModeForRenderPass(),h=a.layout.get("text-variable-anchor"),u=a.layout.get("text-size-scale-range"),c=e.ay(i.scaleFactor,u[0],u[1]);h&&function(i,r,a,n,o,s,l,h){let u=r.transform,c="map"===o,d="map"===s;for(let r of i){let i=n.getTile(r),o=i.getBucket(a);if(!o||!o.text||!o.text.segments.get().length)continue;let s=e.bp(o.textSizeData,u.zoom,h),p=tL(r,o.getProjection(),u),f=u.calculatePixelsToTileUnitsMatrix(i),m=ty(p,i.tileID.canonical,d,c,u,o.getProjection(),f),_=o.hasIconTextFit()&&o.hasIconData();if(s){let a=Math.pow(2,u.zoom-i.tileID.overscaledZ);!function(i,r,a,n,o,s,l,h,u,c,d){let p=i.text.placedSymbolArray,f=i.text.dynamicLayoutVertexArray,m=i.icon.dynamicLayoutVertexArray,_={},g=i.getProjection(),y=tL(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,M=b.hidden||!b.crossTileID||i.allowVerticalPlacement&&!b.placedOrientation?null:n[b.crossTileID];if(M){let n=0,p=0,m=0;if(x){let e=x?x.getAtTileOffset(h,w,T):0,[i,r,a]=g.upVector(h.canonical,w,T);n=e*i*v,p=e*r*v,m=e*a*v}let[E,A,I,C]=tb(b.projectedAnchorX+n,b.projectedAnchorY+p,b.projectedAnchorZ+m,a?y:l),P=tw(s.getCameraToCenterDistance(g),C),z=o.evaluateSizeForFeature(i.textSizeData,c,b)*P/e.bw;a&&(z*=i.tilePixelRatio/u);let D=function({width:i,height:r,anchor:a,textOffset:n,textScale:o},s){let{horizontalAlign:l,verticalAlign:h}=e.bD(a),u=e.bC(a,n);return new e.P((-(l-.5)*i/o+u[0])*s,(-(h-.5)*r/o+u[1])*s)}(M,z);a?({x:E,y:A,z:I}=g.projectTilePoint(w+D.x,T+D.y,h.canonical),[E,A,I]=tb(E+n,A+p,I+m,l)):(r&&D._rotate(-s.angle),E+=D.x,A
98+=D.y,I=0);let R=i.allowVerticalPlacement&&b.placedOrientation===e.bq.vertical?Math.PI/2:0;for(let i=0;i<S;i++)e.bt(f,E,A,I,R);d&&b.associatedIconIndex>=0&&(_[b.associatedIconIndex]={x:E,y:A,z:I,angle:R})}else tP(S,f)}if(d){m.clear();let r=i.icon.placedSymbolArray;for(let i=0;i<r.length;i++){let a=r.get(i),{numGlyphs:n}=a,o=_[i];if(a.hidden||!o)tP(n,m);else{let{x:i,y:r,z:a,angle:s}=o;for(let o=0;o<n;o++)e.bt(m,i,r,a,s)}}i.icon.dynamicLayoutVertexBuffer.updateData(m)}i.text.dynamicLayoutVertexBuffer.updateData(f)}(o,c,d,l,e.cY,u,m,r,a,s,_)}}}(n,i,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),o,c);let d=0!==a.paint.get("icon-opacity").constantOr(1),p=0!==a.paint.get("text-opacity").constantOr(1);void 0!==a.layout.get("symbol-sort-key").constantOr(1)&&(d||p)?ao(i,r,a,n,s,l):(d&&ao(i,r,a,n,s,l,{onlyIcons:!0}),p&&ao(i,r,a,n,s,l,{onlyText:!0})),r.map.showCollisionBoxes&&(ar(i,r,a,n,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),ar(i,r,a,n,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(i,r,a,n){if("translucent"!==i.renderPass)return;let o=a.paint.get("circle-opacity"),s=a.paint.get("circle-stroke-width"),l=a.paint.get("circle-stroke-opacity"),h=void 0!==a.layout.get("circle-sort-key").constantOr(1),u=a.paint.get("circle-emissive-strength");if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===l.constantOr(1)))return;let c=i.context,d=c.gl,p=i.transform,f=i.depthModeForSublayer(0,t1.ReadOnly),m=t2.disabled,_=i.colorModeForDrapableLayerRenderPass(u),g="globe"===p.projection.name,y=[e.av(p.center.lng),e.aC(p.center.lat)],x=[];for(let o=0;o<n.length;o++){let s=n[o],l=r.getTile(s),u=l.getBucket(a);if(!u||u.projection.name!==p.projection.name)continue;let c=u.programConfigurations.get(a.id),d=e.cZ(a),f=i.isTileAffectedByFog(s);g&&d.push("PROJECTION_GLOBE_VIEW"),d.push("DEPTH_D24"),i.terrain&&p.depthOcclusionForSymbolsAndCircles&&d.push("DEPTH_OCCLUSION");let m=i.getOrCreateProgram("circle",{config:c,defines:d,overrideFog:f}),_=u.layoutVertexBuffer,v=u.globeExtVertexBuffer,b=u.indexBuffer,w=p.projection.createInversionMatrix(p,s.canonical),T={programConfiguration:c,program:m,layoutVertexBuffer:_,globeExtVertexBuffer:v,indexBuffer:b,uniformValues:e.c_(i,s,l,w,y,a),tile:l};if(h)for(let i of u.segments.get())x.push({segments:new e.b8([i]),sortKey:i.sortKey,state:T});else x.push({segments:u.segments,sortKey:0,state:T})}h&&x.sort((e,i)=>e.sortKey-i.sortKey);let v={useDepthForOcclusion:p.depthOcclusionForSymbolsAndCircles};for(let e of x){let{programConfiguration:r,program:n,layoutVertexBuffer:o,globeExtVertexBuffer:s,indexBuffer:l,uniformValues:h,tile:u}=e.state,g=e.segments;i.terrain&&i.terrain.setupElevationDraw(u,n,v),i.uploadCommonUniforms(c,n,u.tileID.toUnwrapped()),n.draw(i,d.TRIANGLES,f,m,_,t3.disabled,h,a.id,o,l,g,a.paint,p.zoom,r,[s])}},heatmap:function(i,r,a,n){if(0!==a.paint.get("heatmap-opacity"))if("offscreen"===i.renderPass){let o=i.context,s=o.gl,l=t2.disabled,h=new t0([s.ONE,s.ONE,s.ONE,s.ONE],e.al.transparent,[!0,!0,!0,!0]);!function(e,i,r,a){let n=e.gl,o=i.width*a,s=i.height*a;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,o,s]);let l=r.heatmapFbo;if(!l||l&&(l.width!==o||l.height!==s)){var h;let i;l&&l.destroy();let a=n.createTexture();n.bindTexture(n.TEXTURE_2D,a),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
98INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),l=r.heatmapFbo=e.createFramebuffer(o,s,!0,null),h=l,(i=e.gl).texImage2D(i.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?i.RGBA16F:i.RGBA,o,s,0,i.RGBA,e.extRenderToTextureHalfFloat?i.HALF_FLOAT:i.UNSIGNED_BYTE,null),h.colorAttachment.set(a)}else n.bindTexture(n.TEXTURE_2D,l.colorAttachment.get()),e.bindFramebuffer.set(l.framebuffer)}(o,i,a,"globe"===i.transform.projection.name?.5:.25),o.clear({color:e.al.transparent});let u=i.transform,c="globe"===u.projection.name,d=c?["PROJECTION_GLOBE_VIEW"]:[],p=c?t3.frontCCW:t3.disabled,f=[e.av(u.center.lng),e.aC(u.center.lat)];for(let e=0;e<n.length;e++){let m=n[e];if(r.hasRenderableParent(m))continue;let _=r.getTile(m),g=_.getBucket(a);if(!g||g.projection.name!==u.projection.name)continue;let y=i.isTileAffectedByFog(m),x=g.programConfigurations.get(a.id),v=i.getOrCreateProgram("heatmap",{config:x,defines:d,overrideFog:y}),{zoom:b}=i.transform;i.terrain&&i.terrain.setupElevationDraw(_,v),i.uploadCommonUniforms(o,v,m.toUnwrapped());let w=u.projection.createInversionMatrix(u,m.canonical);v.draw(i,s.TRIANGLES,t1.disabled,l,h,p,r$(i,m,_,w,f,b,a.paint.get("heatmap-intensity")),a.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,a.paint,i.transform.zoom,x,c?[g.globeExtVertexBuffer]:null)}o.viewport.set([0,0,i.width,i.height])}else"translucent"===i.renderPass&&(i.context.setColorMode(i.colorModeForRenderPass()),function(i,r){let a=i.context,n=a.gl,o=r.heatmapFbo;if(!o)return;a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),a.activeTexture.set(n.TEXTURE1);let s=r.colorRampTexture;s||(s=r.colorRampTexture=new e.T(a,r.colorRamp,n.RGBA8)),s.bind(n.LINEAR,n.CLAMP_TO_EDGE),i.getOrCreateProgram("heatmapTexture").draw(i,n.TRIANGLES,t1.disabled,t2.disabled,i.colorModeForRenderPass(),t3.disabled,{u_image:0,u_color_ramp:1,u_opacity:r.paint.get("heatmap-opacity")},r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom)}(i,a))},line:function(i,r,a,n){let o;if("translucent"!==i.renderPass)return;let s=a.paint.get("line-opacity"),l=a.paint.get("line-width");if(0===s.constantOr(1)||0===l.constantOr(1))return;let h=a.paint.get("line-emissive-strength"),u=a.paint.get("line-occlusion-opacity"),c=a.layout.get("line-elevation-reference"),d="meters"===a.layout.get("line-width-unit"),p="sea"===c,f=i.context,m=f.gl;if(a.hasElevatedBuckets&&"globe"===i.transform.projection.name)return;let _=a.layout.get("line-cross-slope"),g=i.colorModeForDrapableLayerRenderPass(h),y=i.terrain&&i.terrain.renderingToTexture,x=y?1:e.q.devicePixelRatio,v=a.paint.get("line-dasharray"),b=v.constantOr(1),w=a.layout.get("line-cap"),T=v.constantOr(null),S=w.constantOr(null),M=a.paint.get("line-pattern"),E=M.constantOr(1),A=M.constantOr(null),I=a.paint.get("line-opacity").constantOr(1),C=!E&&1!==I||i.depthOcclusion&&u>0&&u<1,P=a.paint.get("line-gradient"),z=E?"linePattern":"line",D=e.c$(a);if(y&&i.terrain&&i.terrain.clipOrMaskOverlapStencilType()&&(C=!1),0!==u&&i.depthOcclusion){let i=a.paint._values["line-opacity"];i&&i.value&&"constant"===i.value.kind?o=i.value:e.w(`Occlusion opacity for layer ${a.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==l.value.kind&&!1===l.value.isLineProgressConstant&&D.push("VARIABLE_LINE_WIDTH");let R=(n,s,l,h,c,_)=>{for(let v of n){let n=r.getTile(v);if(E&&!n.patternsLoaded())continue;let w=n.getBucket(a);if(!w||w.hasZOffset&&!c||!w.hasZOffset&&c)continue;i.prepareDrawTile();let M=w.programConfigurations.get(a.id),D=i.isTileAffectedByFog(v),R=i.getOrCreateProgram(z,{config:M,defines:s,overrideFog:D,overrideRtt:!c&&void 0});if(A&&n.imageAtlas){let i=e.d0.from(A).getPrimary().scaleSelf(x).toString(),r=n.imageAtlas.patternPositions.get(i);r&&M.setConstantPatternPositions(r)}if(!E&&T&&S&&n.lineAtlas){let e=n.lineAtlas.getDash(T,S);e&&M.setConstantPatternPositions(e)}let[L,O]=a.paint.get("line-trim-offset");("round"===S||"square"===S)&&L!==O&&(0===L&&(L-=1),1===O&&(O+=1));let k=y?v.projMatrix:null,F=d?1/w.tileToMeter/e.at(n,1,i.transform.zoom):1,B=d?1/w.tileToMeter/e.at(n,1,Math.floor(i.transform.zoom)):1,N=E?e.d1(i,n,a,k,x,F,B,[L,O]):e.d2(i,n,a,k,w.lineClipsArray.length,x,F,B,[L,O]);if(P){let n=w.gradients[a.id],o=n.texture;if(a.gradientVersion!==n.version){let s=256;if(a.stepInterpolant){let a=r.getSource().maxzoom,n=v.canonical.z===a?Math.
98ceil(1<<i.transform.maxZoom-v.canonical.z):1;s=e.ay(e.d3(w.maxLineLength/e.ai*1024*n),256,f.maxTextureSize)}n.gradient=e.d4({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:s,image:n.gradient||void 0,clips:w.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(f,n.gradient,m.RGBA8),n.version=a.gradientVersion,o=n.texture}f.activeTexture.set(m.TEXTURE1),o.bind(a.stepInterpolant?m.NEAREST:m.LINEAR,m.CLAMP_TO_EDGE)}b&&(f.activeTexture.set(m.TEXTURE0),n.lineAtlasTexture&&n.lineAtlasTexture.bind(m.LINEAR,m.REPEAT),M.updatePaintBuffers()),E&&(f.activeTexture.set(m.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),M.updatePaintBuffers()),c&&!p&&i.terrain.setupElevationDraw(n,R),i.uploadCommonUniforms(f,R,v.toUnwrapped());let V=e=>{null!=o&&(o.value=I*u),R.draw(i,m.TRIANGLES,l,e,g,t3.disabled,N,a.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,a.paint,i.transform.zoom,M,[w.layoutVertexBuffer2,w.patternVertexBuffer,w.zOffsetVertexBuffer]),null!=o&&(o.value=I)};if(C&&!c){let e=i.stencilModeForClipping(v).ref;0===e&&y&&f.clear({stencil:0});let r={func:m.EQUAL,mask:255};N.u_alpha_discard_threshold=.8,V(new t2(r,e,255,m.KEEP,m.KEEP,m.INVERT)),N.u_alpha_discard_threshold=0,V(new t2(r,e,255,m.KEEP,m.KEEP,m.KEEP))}else N.u_alpha_discard_threshold=C&&c&&_?.8:0,V(c?h:i.stencilModeForClipping(v))}};if(a.hasNonElevatedBuckets){let r=!y&&i.terrain;0!==u&&r?e.w(`Occlusion opacity for layer ${a.id} is supported on terrain only if the layer has line-z-offset enabled.`):r?e.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${a.id}.`):R(n,D,i.depthModeForSublayer(0,t1.ReadOnly),t2.disabled,!1,!0)}if(a.hasElevatedBuckets){D.push("ELEVATED"),void 0!==_&&D.push(_<1?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),p&&D.push("ELEVATION_REFERENCE_SEA");let e=C?i.stencilModeFor3D():t2.disabled,r=new t1(i.depthOcclusion?m.GREATER:m.LEQUAL,t1.ReadOnly,i.depthRangeFor3D);i.forceTerrainMode=!0,R(n,D,r,e,!0,!0),C&&R(n,D,r,e,!0,!1),i.forceTerrainMode=!1}C&&(i.resetStencilClippingMasks(),y&&f.clear({stencil:0})),0===u||i.depthOcclusion||y||i.layersWithOcclusionOpacity.push(i.currentLayer)},fill:function(i,r,a,n){let o=a.paint.get("fill-color"),s=a.paint.get("fill-opacity");if(0===s.constantOr(1))return;let l=a.paint.get("fill-emissive-strength"),h=i.colorModeForDrapableLayerRenderPass(l),u=a.paint.get("fill-pattern"),c=i.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===o.constantOr(e.al.transparent).a&&1===s.constantOr(0)?"opaque":"translucent",d="none";"none"!==a.layout.get("fill-elevation-reference")?d="road":0!==a.paint.get("fill-z-offset").constantOr(1)&&(d="offset");let p=!(!i.terrain||!i.terrain.enabled),f={painter:i,sourceCache:r,layer:a,coords:n,colorMode:h,elevationType:d,terrainEnabled:p,pass:c};if("offset"!==d){if(ah(f,!1),"road"===d){let e=!p&&"translucent"===i.renderPass;e&&al(i,r,a,n,"geometry"),ah(f,!0,t2.disabled),e&&function(e){let{painter:i,sourceCache:r,layer:a,coords:n,colorMode:o}=e,s=i.context.gl,l=new t1(i.context.gl.LEQUAL,t1.ReadOnly,i.depthRangeFor3D);for(let e of n){let n=r.getTile(e),h=n.getBucket(a);if(!h)continue;let u=h.elevatedStructures;if(!u||!u.renderableSegments||0===u.renderableSegments.segments[0].primitiveLength)continue;i.prepareDrawTile();let c=h.bufferData.programConfigurations.get(a.id),d=i.isTileAffectedByFog(e),p=i.getOrCreateProgram("elevatedStructures",{config:c,overrideFog:d,defines:["NORMAL_OFFSET"]}),f={u_matrix:i.translatePosMatrix(e.projMatrix,n,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"))};i.uploadCommonUniforms(i.context,p,e.toUnwrapped()),p.draw(i,s.TRIANGLES,l,t2.disabled,o,t3.backCCW,f,a.id,u.vertexBuffer,u.indexBuffer,u.renderableSegments,a.paint,i.transform.zoom,c,[u.vertexBufferNormal])}}(f)}}else ah(f,!1,i.stencilModeFor3D())},"fill-extrusion":function(i,r,a,n){let o=a.paint.get("fill-extrusion-opacity"),s=i.context,l=s.gl,h=i.terrain,u=h&&h.renderingToTexture;if(0===o)return;let c=i.conflationActive&&i.style.isLayerClipped(a,r.getSource()),d=i.style.order.indexOf(a.fqid);if(c&&function(e,i,r,a,n){for(let o of a){let a=i.getTile(o).getBucket(r);a&&(a.updateReplacement(o,e.replacementSource,n),a.uploadCentroid(e.context))}}(i,r,a,n,d),h||c)for(let o of n){let n=r.getTile(o).getBucket(a);n&&function(i,r,a,n,o,s,l){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();let h=s?s.findDEMTileFor(a):null;if(!(h&&h.dem||l))return;s&&h&&h.dem&&n.selfDEMTileTimestamp!==h.dem._timestamp&&(n.borderDoneWithNeighborZ=[-1,-1,-1,-1],n.selfDEMTileTimestamp=h.dem._timestamp);let u=i=>new e.P(Math.ceil((i+e.da)*e.db),0),c=e=>{let i=r.getSource().minzoom,a=e=>{let i=r.getTileByID(e);if(i&&i.hasData())return i.getBucket(o)};
98for(let r of[0,-1,1]){if(e.overscaledZ+r<i)continue;let n=a(e.calculateScaledKey(e.overscaledZ+r));if(n)return n}},d=[0,0,0],p=(i,r)=>(d[0]=Math.min(i.min.y,r.min.y),d[1]=Math.max(i.max.y,r.max.y),d[2]=e.ai-r.min.x>i.max.x?r.min.x-e.ai:i.max.x,d),f=(i,r)=>(d[0]=Math.min(i.min.x,r.min.x),d[1]=Math.max(i.max.x,r.max.x),d[2]=e.ai-r.min.y>i.max.y?r.min.y-e.ai:i.max.y,d),m=[(e,i)=>p(e,i),(e,i)=>p(i,e),(e,i)=>f(e,i),(e,i)=>f(i,e)],_=(i,r,n,o,l,u,c)=>{if(!s)return 0;let d=[[u?n:i,u?i:n,0],[u?n:r,u?r:n,0]],p=c<0?e.ai+c:c,f=[u?p:(i+r)/2,u?(i+r)/2:p,0];return 0===n&&c<0||0!==n&&c>0?s.getForTilePoints(l,[f],!0,o):d.push(f),s.getForTilePoints(a,d,!0,h),Math.max(d[0][2],d[1][2],f[2])/s.exaggeration()};for(let i=0;i<4;i++){let r=n.borderFeatureIndices[i];if(0===r.length)continue;let o=e.d7[i](a),h=c(o);if(!(h&&h instanceof e.d8))continue;let d=s?s.findDEMTileFor(o):null;if(!(d&&d.dem||l)||(s&&d&&d.dem&&n.borderDEMTileTimestamp[i]!==d.dem._timestamp&&(n.borderDoneWithNeighborZ[i]=-1,n.borderDEMTileTimestamp[i]=d.dem._timestamp),n.borderDoneWithNeighborZ[i]===h.canonical.z))continue;0===h.centroidVertexArray.length&&h.createCentroidsBuffer();let p=(i<2?1:5)-i,f=h.borderDoneWithNeighborZ[p]!==n.canonical.z,g=h.borderFeatureIndices[p],y=0;if(n.canonical.z!==h.canonical.z){for(let e of r)n.showCentroid(n.featuresOnBorder[e]);if(f)for(let e of g)h.showCentroid(h.featuresOnBorder[e]);n.borderDoneWithNeighborZ[i]=h.canonical.z,h.borderDoneWithNeighborZ[p]=n.canonical.z}for(let a of r){let r,s=n.featuresOnBorder[a],c=n.centroidData[s.centroidDataIndex],f=s.borders[i];for(;y<g.length;){let e=(r=h.featuresOnBorder[g[y]]).borders[p];if(e[1]>f[0]+3||e[0]>f[0]-3)break;h.showCentroid(r),y++}if(r&&y<g.length){let a=y,x=0;for(;!(r.borders[p][0]>f[1]-3)&&(x++,++y!==g.length);)r=h.featuresOnBorder[g[y]];r=h.featuresOnBorder[g[a]];let v=!1;if(x>=1){let e=r.borders[p];3>Math.abs(f[0]-e[0])&&3>Math.abs(f[1]-e[1])&&(x=1,v=!0,y=a+1)}else if(0===x){n.showCentroid(s);continue}let b=h.centroidData[r.centroidDataIndex];l&&v&&((c.flags|b.flags)&e.d9?(c.flags|=e.d9,b.flags|=e.d9):(c.flags&=~e.d9,b.flags&=~e.d9));let w=s.intersectsCount()>1||r.intersectsCount()>1;if(x>1)y=a,c.centroidXY=b.centroidXY=new e.P(0,0);else if(d&&d.dem&&!w){let r=m[i](c,b),a=i%2?e.ai-1:0;c.centroidXY=b.centroidXY=u(_(r[0],Math.min(e.ai-1,r[1]),a,d,o,i<2,r[2]))}else w?c.centroidXY=b.centroidXY=new e.P(0,0):(c.centroidXY=n.encodeBorderCentroid(s),b.centroidXY=h.encodeBorderCentroid(r));n.writeCentroidToBuffer(c),h.writeCentroidToBuffer(b)}else n.showCentroid(s)}n.borderDoneWithNeighborZ[i]=h.canonical.z,h.borderDoneWithNeighborZ[p]=n.canonical.z}(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(i)}(i.context,r,o,n,a,h,c)}if("shadow"===i.renderPass&&i.shadowRenderer){let s=i.shadowRenderer;if(h&&o<.65&&a._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.ab)return;let l=s.getShadowPassDepthMode(),u=s.getShadowPassColorMode();au(i,r,a,n,l,t2.disabled,u,c)}else if("translucent"===i.renderPass){let d=!a.paint.get("fill-extrusion-pattern").constantOr(1),p=a.paint.get("fill-extrusion-color").constantOr(e.al.white);if(!u&&0!==p.a){let e=new t1(i.context.gl.LEQUAL,t1.ReadWrite,i.depthRangeFor3D);1===o&&d?au(i,r,a,n,e,t2.disabled,t0.unblended,c):(au(i,r,a,n,e,t2.disabled,t0.disabled,c),au(i,r,a,n,e,i.stencilModeFor3D(),i.colorModeForRenderPass(),c),i.resetStencilClippingMasks())}if(i.style.enable3dLights()&&d&&(!h&&"globe"!==i.transform.projection.name||u)){let o=a.paint.get("fill-extrusion-opacity"),d=a.paint.get("fill-extrusion-ambient-occlusion-intensity"),p=a.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),f=a.paint.get("fill-extrusion-flood-light-intensity"),m="none"===a.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),_=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(m?null:a.lut).toArray01().slice(0,3),g=d>0&&p>0,y=f>0,x=(e,i,r)=>(1-r)*e+r*i,v=s=>{let h=i.depthModeForSublayer(1,t1.ReadOnly,l.LEQUAL,!0),u=x(.1,3,a.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation")),m=i._showOverdrawInspector;m||ac(i,r,a,n,h,new t2({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),new t0([l.ONE,l.ONE,l.ONE,l.ONE],e.al.transparent,[!1,!1,!1,!0],l.MIN),t3.disabled,s,"sdf",o,d,p,f,_,u,c,!1);{let g=m?t2.disabled:new t2({func:l.EQUAL,mask:255}
98,255,255,l.KEEP,l.DECR,l.DECR),y=m?i.colorModeForRenderPass():new t0([l.ONE_MINUS_DST_ALPHA,l.DST_ALPHA,l.ONE,l.ONE],e.al.transparent,[!0,!0,!0,!0]);ac(i,r,a,n,h,g,y,t3.disabled,s,"color",o,d,p,f,_,u,c,!1)}};if(u){let u=(s,h,u)=>{let m=i.depthModeForSublayer(1,t1.ReadOnly,l.LEQUAL,!1),g=x(.1,3,a.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"));{let u=new t0([l.ONE,l.ONE,l.ONE,l.ONE],e.al.transparent,[!1,!1,!1,!0]);ac(i,r,a,n,m,t2.disabled,u,t3.disabled,s,"clear",o,d,p,f,_,g,c,h)}ac(i,r,a,n,m,new t2({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),new t0([l.ONE,l.ONE,l.ONE,l.ONE],e.al.transparent,[!1,!1,!1,!0],l.MIN),t3.disabled,s,"sdf",o,d,p,f,_,g,c,h);{let u=s?l.ZERO:l.ONE_MINUS_DST_ALPHA;ac(i,r,a,n,m,new t2({func:l.EQUAL,mask:255},255,255,l.KEEP,l.DECR,l.DECR),new t0([u,l.DST_ALPHA,l.ONE_MINUS_DST_ALPHA,l.ZERO],e.al.transparent,[!0,!0,!0,!0]),t3.disabled,s,"color",o,d,p,f,_,g,c,h)}{let y=new t0([l.ONE,l.ONE,l.ONE,s?l.ZERO:l.ONE],e.al.transparent,[!1,!1,!1,!0],s?l.FUNC_ADD:l.MAX);ac(i,r,a,n,m,t2.disabled,y,t3.disabled,s,"clear",o,d,p,f,_,g,c,h,u)}};if(g||y){let r;if(i.prepareDrawTile(),h){let i=h.drapeBufferSize[0],a=h.drapeBufferSize[1];(r=h.framebufferCopyTexture)&&(!r||r.size[0]===i&&r.size[1]===a)||(r&&r.destroy(),r=h.framebufferCopyTexture=new e.T(s,new e.r({width:i,height:a}),l.RGBA8)),r.bind(l.LINEAR,l.CLAMP_TO_EDGE),l.copyTexSubImage2D(l.TEXTURE_2D,0,0,0,0,0,i,a)}g&&u(!0,!1,r),y&&u(!1,!0,r)}}else g&&v(!0),y&&v(!1),(g||y)&&i.resetStencilClippingMasks()}}},hillshade:function(i,r,a,n){if("offscreen"!==i.renderPass&&"translucent"!==i.renderPass||i.style.disableElevatedTerrain)return;let o=i.context,s=i.terrain&&i.terrain.renderingToTexture,[l,h]="translucent"!==i.renderPass||s?[{},n]:i.stencilConfigForOverlap(n);for(let n of h){let o=r.getTile(n);if(o.needsHillshadePrepare&&"offscreen"===i.renderPass)!function(i,r,a){var n;let o,s,l=i.context,h=l.gl;if(!r.dem)return;let u=r.dem;if(l.activeTexture.set(h.TEXTURE1),iq(i,r,u),!r.demTexture)return;r.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);let c=u.dim;l.activeTexture.set(h.TEXTURE0);let d=r.hillshadeFBO;if(!d){let i=new e.T(l,{width:c,height:c,data:null},h.RGBA8);i.bind(h.LINEAR,h.CLAMP_TO_EDGE),(d=r.hillshadeFBO=l.createFramebuffer(c,c,!0,"renderbuffer")).colorAttachment.set(i.texture)}l.bindFramebuffer.set(d.framebuffer),l.viewport.set([0,0,c,c]);let{tileBoundsBuffer:p,tileBoundsIndexBuffer:f,tileBoundsSegments:m}=i.getMercatorTileBoundsBuffers(),_=[];i.linearFloatFilteringSupported()&&_.push("TERRAIN_DEM_FLOAT_FORMAT"),i.getOrCreateProgram("hillshadePrepare",{defines:_}).draw(i,h.TRIANGLES,t1.disabled,t2.disabled,t0.unblended,t3.disabled,(n=r.tileID,o=u.stride,s=e.ad.mat4.create(),e.ad.mat4.ortho(s,0,e.ai,-e.ai,0,0,1),e.ad.mat4.translate(s,s,[0,-e.ai,0]),{u_matrix:s,u_image:1,u_dimension:[o,o],u_zoom:n.overscaledZ}),a.id,p,f,m),r.needsHillshadePrepare=!1}(i,o,a);else if("translucent"===i.renderPass){let r=i.depthModeForSublayer(0,t1.ReadOnly),h=a.paint.get("hillshade-emissive-strength"),u=i.colorModeForDrapableLayerRenderPass(h),c=s&&i.terrain?i.terrain.stencilModeForRTTOverlap(n):l[n.overscaledZ];!function(i,r,a,n,o,s,l){let h=i.context,u=h.gl,c=a.hillshadeFBO;if(!c)return;i.prepareDrawTile();let d=i.isTileAffectedByFog(r),p=i.getOrCreateProgram("hillshade",{overrideFog:d});h.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,c.colorAttachment.get());let f=((i,r,a,n)=>{var o;let s,l,h=a.paint.get("hillshade-shadow-color"),u="none"===a.paint.get("hillshade-shadow-color-use-theme").constantOr("default"),c=a.paint.get("hillshade-highlight-color"),d="none"===a.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),p=a.paint.get("hillshade-accent-color"),f="none"===a.paint.get("hillshade-accent-color-use-theme").constantOr("default"),m=a.paint.get("hillshade-emissive-strength"),_=e.ak(a.paint.get("hillshade-illumination-direction"));if("viewport"===a.paint.get("hillshade-illumination-anchor"))_-=i.transform.angle;else if(i.style&&i.style.enable3dLights()&&i.style.directionalLight){let r=i.style.directionalLight.properties.get("direction"),a=e.cc(r.x,r.y,r.z);_=e.ak(a[1])}let g=!i.options.moving;return{u_matrix:n||i.transform.calculateProjMatrix(r.tileID.toUnwrapped(),g),u_image:0,u_latrange:(s=Math.pow(2,(o=r.tileID).canonical.z),l=o.canonical.y,[new e.ac(0,l/s).toLngLat().lat,new e.ac(0,(l+1)/s).toLngLat().lat]),u_light:[a.paint.get("hillshade-exaggeration"),_],u_shadow:h.toRenderColor(u?null:a.lut),u_highlight:c.toRenderColor(d?null:a.lut),u_emissive_strength:m,u_accent:p.toRenderColor(f?null:a.lut)}})(i,a,n,i.terrain?r.projMatrix:null);i.uploadCommonUniforms(h,p,r.toUnwrapped());let{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=i.getTileBoundsBuffers(a);p.draw(i,u.TRIANGLES,o,s,l,t3.disabled,f,n.id,m,_,g)}(i,n,o,a,r,c,u)}}o.viewport.set([0,0,i.width,i.height]),i.resetStencilClippingMasks()}
98,raster:function(i,r,a,n,o,s){if("translucent"!==i.renderPass||0===a.paint.get("raster-opacity"))return;let l="globe"===i.transform.projection.name,h=0!==a.paint.get("raster-elevation"),u=h&&l;if(i.renderElevatedRasterBackface&&!u)return;let c=i.context,d=c.gl,p=r.getSource(),f=function(i,r,a,n){let o=r.paint.get("raster-color"),s="raster-array"===i.type,l=[],h=r.paint.get("raster-resampling"),u=r.paint.get("raster-color-mix"),c=r.paint.get("raster-color-range"),d=[u[0],u[1],u[2],0],p=u[3],f="nearest"===h?n.NEAREST:n.LINEAR;if(s&&(l.push("RASTER_ARRAY"),o||l.push("RASTER_COLOR"),"linear"===h&&l.push("RASTER_ARRAY_LINEAR"),f=n.NEAREST,!c&&i.rasterLayers)){let e=i.rasterLayers.find(({id:e})=>e===r.sourceLayer);e&&e.fields&&e.fields.range&&(c=e.fields.range)}if(c=c||[0,1],o){l.push("RASTER_COLOR"),a.activeTexture.set(n.TEXTURE2),r.updateColorRamp(c);let i=r.colorRampTexture;i||(i=r.colorRampTexture=new e.T(a,r.colorRamp,n.RGBA8)),i.bind(n.LINEAR,n.CLAMP_TO_EDGE)}return{mix:d,range:c,offset:p,defines:l,resampling:f}}(p,a,c,d);if(p instanceof e.aK&&!n.length&&!l)return;let m=a.paint.get("raster-emissive-strength"),_=i.colorModeForDrapableLayerRenderPass(m),g=i.terrain&&i.terrain.renderingToTexture,y=!i.options.moving,x="nearest"===a.paint.get("raster-resampling")?d.NEAREST:d.LINEAR;if(p instanceof e.aK&&!n.length&&(p.onNorthPole||p.onSouthPole)){let e=h?i.stencilModeFor3D():t2.disabled;return void a_(!!p.onNorthPole,null,i,r,a,m,f,t3.disabled,e)}if(!n.length)return;let[v,b]=p instanceof e.aK||g?[{},n]:i.stencilConfigForOverlap(n),w=b[b.length-1].overscaledZ;u&&f.defines.push("PROJECTION_GLOBE_VIEW"),h&&f.defines.push("RENDER_CUTOFF");let T=(n,o,b)=>{for(let T of n){let n,S,M,E,A,I=T.toUnwrapped(),C=r.getTile(T);if(g&&(!C||!C.hasData()))continue;c.activeTexture.set(d.TEXTURE0);let P=function(e,i,r,a){if(e)return i instanceof eY&&e instanceof te?i.getTextureDescriptor(e,r,!0):{texture:e.texture,mix:am(a.mix),offset:a.offset,buffer:0,tileSize:1}}(C,p,a,f);if(!P||!P.texture)continue;let{texture:z,mix:D,offset:R,tileSize:L,buffer:O}=P;g?(n=t1.disabled,S=T.projMatrix):h?(n=new t1(d.LEQUAL,t1.ReadWrite,i.depthRangeFor3D),S=l?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(I,y)):(n=i.depthModeForSublayer(T.overscaledZ-w,1===a.paint.get("raster-opacity")?t1.ReadWrite:t1.ReadOnly,d.LESS),S=i.transform.calculateProjMatrix(I,y));let k=i.terrain&&g?i.terrain.stencilModeForRTTOverlap(T):v[T.overscaledZ],F=s?0:a.paint.get("raster-fade-duration");C.registerFadeDuration(F);let B=r.findLoadedParent(T,0),N=rM(C,B,r,i.transform,F);i.terrain&&i.terrain.prepareDrawTile(),c.activeTexture.set(d.TEXTURE0),z.bind(x,d.CLAMP_TO_EDGE),c.activeTexture.set(d.TEXTURE1),B?(B.texture&&B.texture.bind(x,d.CLAMP_TO_EDGE),M=Math.pow(2,B.tileID.overscaledZ-C.tileID.overscaledZ),E=[C.tileID.canonical.x*M%1,C.tileID.canonical.y*M%1]):z.bind(x,d.CLAMP_TO_EDGE),"useMipmap"in z&&c.extTextureFilterAnisotropic&&i.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax);let V=i.transform,U=h?function(e){let i=e._nearZ,r=e.projection.farthestPixelDistance(e),a=r-i,n=.2*e.height,o=i+n;return[i,r,(o-n-i)/a,(o-i)/a]}(V):[0,0,0,0],j,G,q,Z,H,$=0;if(u&&p instanceof e.aK&&p.coordinates.length>3)j=Float32Array.from(e.bc(e.cI(new e.bT(0,0,0)))),G=Float32Array.from(V.globeMatrix),q=Float32Array.from(e.cE(V)),Z=[e.av(V.center.lng),e.aC(V.center.lat)],A=p.elevatedGlobePerspectiveTransform,H=p.elevatedGlobeGridMatrix||new Float32Array(9);else if(u){let i=e.cF(T.canonical);$=e.cG(i.getCenter().lat),j=Float32Array.from(e.bc(e.cI(T.canonical))),G=Float32Array.from(V.globeMatrix),q=Float32Array.from(e.cE(V)),Z=[e.av(V.center.lng),e.aC(V.center.lat)],A=[0,0],H=Float32Array.from(e.cH(T.canonical,i,$,V.worldSize/V._pixelsPerMercatorPixel))}else A=p instanceof e.aK?p.perspectiveTransform:[0,0],j=new Float32Array(16),G=new Float32Array(9),q=new Float32Array(16),Z=[0,0],H=new Float32Array(9);let W=rY(S,j,G,q,H,E||[0,0],e.ag(i.transform.zoom),Z,U,M||1,N,a,A,h?a.paint.get("raster-elevation"):0,2,D,R,f.range,L,O,m),X=i.isTileAffectedByFog(T),Y=i.getOrCreateProgram("raster",{defines:f.defines,overrideFog:X});if(i.uploadCommonUniforms(c,Y,I),p instanceof e.aK){let r=p.elevatedGlobeVertexBuffer,s=p.elevatedGlobeIndexBuffer;if(g||!l)p.boundsBuffer&&p.boundsSegments&&Y.draw(i,d.TRIANGLES,n,t2.disabled,_,t3.disabled,W,a.id,p.boundsBuffer,i.quadTriangleIndexBuffer,p.boundsSegments);else if(r&&s){let l=V.zoom<=e.c6?p.elevatedGlobeSegments:p.getSegmentsForLongitude(V.center.lng);l&&Y.draw(i,d.TRIANGLES,n,t2.disabled,_,o,W,a.id,r,s,l)}}else if(u){n=new t1(d.LEQUAL,t1.ReadOnly,i.depthRangeFor3D);let e=i.globeSharedBuffers;if(e){let[r,s,l]=e.getGridBuffers($,!1);Y.draw(i,d.TRIANGLES,n,b||k,i.colorModeForRenderPass(),o,W,a.id,r,s,l)}}else{let{tileBoundsBuffer:e,tileBoundsIndexBuffer:r,tileBoundsSegments:o}=i.getTileBoundsBuffers(C);Y.draw(i,d.TRIANGLES,n,k,_,t3.disabled,W,a.id,e,r,o)}}if(!(p instanceof e.aK)&&u)for(let e of n){let n=e.canonical.y===(1<<e.canonical.z)-1;0===e.canonical.y&&a_(!0,e,i,r,a,m,f,o,b||t2.disabled),n&&a_(!1,e,i,r,a,m,f,o===t3.frontCW?t3.backCW:t3.frontCW,b||t2.disabled)}};u?T(b,i.renderElevatedRasterBackface?t3.backCW:t3.frontCW,i.stencilModeFor3D()):T(b,t3.disabled,void 0),i.resetStencilClippingMasks()},"raster-particle":function(i,r,a,n,o,s){"offscreen"===i.renderPass&&function(i,r,a,n){if(!n.length)return;let o=i.context,s=o.gl,l=r.getSource();if(!(l instanceof eY))return;let h=Math.ceil(Math.sqrt(a.paint.get("raster-particle-count"))),u=a.particlePositionRGBAImage;if(!u||u.width!==h){let i=function(e){let i=e*e,r=new Uint8Array(4*i),a=function(e){return e|=0,((e
98=Math.imul((e=Math.imul((e=Math.imul(0xa3c59ac3^e,0x9e3779b9))^e>>>16,0x9e3779b9))^e>>>16,0x9e3779b9))>>>0)/0x100000000},n=1/1.1;for(let e=0;e<i;e++){let i=n*(a(2*e+0)+.05),o=n*(a(2*e+1)+.05),s=255*i%1,l=255*o%1,h=o-l/255;r[4*e+0]=255*(i-s/255),r[4*e+1]=255*s,r[4*e+2]=255*h,r[4*e+3]=255*l}return r}(h);u=a.particlePositionRGBAImage=new e.r({width:h,height:h},i)}let c=a.particleFramebuffer;c?c.width!==h&&(c.destroy(),c=a.particleFramebuffer=o.createFramebuffer(h,h,!0,null)):c=a.particleFramebuffer=o.createFramebuffer(h,h,!0,null);let d=[];for(let i of n){let n=r.getTile(i);if(!(n instanceof te))continue;let s=function(i,r,a){if(!i)return null;let n=r.getTextureDescriptor(i,a,!0);if(!n)return null;let{texture:o,mix:s,offset:l,tileSize:h,buffer:u,format:c}=n;if(!o||!c)return null;let d=!1;return"uint32"===c&&(d=!0,s[3]=0,s=rW(e.df,s,[0,a.paint.get("raster-particle-max-speed")]),l=rX(e.df,l,[0,a.paint.get("raster-particle-max-speed")])),{texture:o,textureOffset:[u/(h+2*u),h/(h+2*u)],tileSize:h,scalarData:d,scale:s,offset:l,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[c]]}}(n,l,a);if(!s)continue;let c=[n.tileSize,n.tileSize],p=a.tileFramebuffer;p||(p=a.tileFramebuffer=o.createFramebuffer(c[0],c[1],!0,null));let f=n.rasterParticleState;f||(f=n.rasterParticleState=new ay(o,i,c,u));let m=f.update(a.lastInvalidatedAt);f.particleTextureDimension!==h&&f.updateParticleTexture(i,u);let _=f.targetColorTexture;f.targetColorTexture=f.backgroundColorTexture,f.backgroundColorTexture=_;let g=f.particleTexture0;f.particleTexture0=f.particleTexture1,f.particleTexture1=g,d.push([i,s,f,m])}if(0===d.length)return;let p=e.q.now(),f=a.previousDrawTimestamp?.001*(p-a.previousDrawTimestamp):.0167;if(a.previousDrawTimestamp=p,a.hasColorMap()){o.activeTexture.set(s.TEXTURE0+2);let i=a.colorRampTexture;i||(i=a.colorRampTexture=new e.T(o,a.colorRamp,s.RGBA8)),i.bind(s.LINEAR,s.CLAMP_TO_EDGE)}o.bindFramebuffer.set(a.tileFramebuffer.framebuffer),function(i,r,a){var n;let o=i.context,s=o.gl,l=r.tileFramebuffer;o.activeTexture.set(s.TEXTURE0);let h={u_texture:0,u_opacity:1.05*(n=r.paint.get("raster-particle-fade-opacity-factor"))/(n+.05)},u=i.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});for(let n of a){let[,,a,c]=n;l.colorAttachment.set(a.targetColorTexture.texture),o.viewport.set([0,0,l.width,l.height]),o.clear({color:e.al.transparent}),c&&(a.backgroundColorTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),u.draw(i,s.TRIANGLES,t1.disabled,t2.disabled,t0.alphaBlended,t3.disabled,h,r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments))}}(i,a,d),function(i,r,a,n){let o=i.context,s=o.gl,l=a.tileFramebuffer,h="globe"===i.transform.projection.name,u=a.paint.get("raster-particle-max-speed");for(let c of n){let[n,d,p]=c;o.activeTexture.set(s.TEXTURE0+0),d.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),l.colorAttachment.set(p.targetColorTexture.texture);let f=i.getOrCreateProgram("rasterParticleDraw",{defines:d.defines,overrideFog:!1});o.activeTexture.set(s.TEXTURE0+1);let m=d.scalarData?[]:[0,1,2,3].map(i=>e.d7[i](n));m.push(n);let _=n.canonical.x,g=n.canonical.y;for(let e of m){let o=r.getTile(h?e.wrapped():e);if(!o)continue;let l=o.rasterParticleState;if(!l)continue;let c=e.canonical.x+(1<<e.canonical.z)*(e.wrap-n.wrap),p=e.canonical.y;l.particleTexture0.bind(s.NEAREST,s.CLAMP_TO_EDGE);let m=rJ(1,l.particleTexture0.size[0],[c-_,p-g],0,d.texture.size,2,u,d.textureOffset,d.scale,d.offset);f.draw(i,s.POINTS,t1.disabled,t2.disabled,t0.alphaBlended,t3.disabled,m,a.id,l.particleIndexBuffer,void 0,l.particleSegment)}}}(i,r,a,d),o.bindFramebuffer.set(a.particleFramebuffer.framebuffer),function(i,r,a,n){let o=i.context,s=o.gl,l=r.paint.get("raster-particle-max-speed"),h=n*r.paint.get("raster-particle-speed-factor")*.15,u=Math.pow(.01+ +r.paint.get("raster-particle-reset-rate-factor"),6),c=r.particleFramebuffer;for(let n of(o.viewport.set([0,0,c.width,c.height]),a)){let[,a,d]=n;o.activeTexture.set(s.TEXTURE0+0),a.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE0+1);let p=d.particleTexture0;p.bind(s.NEAREST,s.CLAMP_TO_EDGE);let f=rQ(1,p.size[0],0,a.texture.size,l,h,u,a.textureOffset,a.scale,a.offset);c.colorAttachment.set(d.particleTexture1.texture),o.clear({color:e.al.transparent}),i.getOrCreateProgram("rasterParticleUpdate",{defines:a.defines}).draw(i,s.TRIANGLES,t1.disabled,t2.disabled,t0.unblended,t3.disabled,f,r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments)}}(i,a,d,f)}(i,r,a,n),"translucent"===i.renderPass&&(function(i,r,a,n){let o=i.context,s=o.gl,l=r.getSource().tileSize,h=5*(1-e.ae(e.bY,e.bY+1,i.transform.zoom))*l+a.paint.get("raster-particle-elevation"),u=!i.options.moving,c="globe"===i.transform.projection.name;if(!n.length)return;let[d,p]=i.stencilConfigForOverlap(n),f=[];c&&f.push("PROJECTION_GLOBE_VIEW");let m=i.stencilModeFor3D();for(let n of p){let l,p,_,g,y,x,v,b=n.toUnwrapped(),w=r.getTile(n);if(!w.rasterParticleState)continue;let T=w.rasterParticleState;w.registerFadeDuration(100);let S=r.findLoadedParent(n,0),M=rM(w,S,r,i.transform,100);i.terrain&&i.terrain.prepareDrawTile(),o.activeTexture.set(s.TEXTURE0),T.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE1),S&&S.rasterParticleState?(S.rasterParticleState.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),l=Math.pow(2,S.tileID.overscaledZ-w.tileID.overscaledZ
98),p=[w.tileID.canonical.x*l%1,w.tileID.canonical.y*l%1]):T.targetColorTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE);let E=c?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(b,u),A=i.transform,I=function(e){let i=e._nearZ,r=e.projection.farthestPixelDistance(e),a=r-i,n=.2*e.height,o=i+n;return[i,r,(o-n-i)/a,(o-i)/a]}(A),C=e.cF(n.canonical),P=e.cG(C.getCenter().lat);c?(_=Float32Array.from(e.bc(e.cI(n.canonical))),g=Float32Array.from(A.globeMatrix),y=Float32Array.from(e.cE(A)),x=[e.av(A.center.lng),e.aC(A.center.lat)],v=Float32Array.from(e.cH(n.canonical,C,P,A.worldSize/A._pixelsPerMercatorPixel))):(_=new Float32Array(16),g=new Float32Array(9),y=new Float32Array(16),x=[0,0],v=new Float32Array(9));let z=rK(E,_,g,y,v,p||[0,0],e.ag(i.transform.zoom),x,I,l||1,M,h),D=i.isTileAffectedByFog(n),R=i.getOrCreateProgram("rasterParticle",{defines:f,overrideFog:D});if(i.uploadCommonUniforms(o,R,b),c){let e=new t1(s.LEQUAL,t1.ReadOnly,i.depthRangeFor3D),r=i.globeSharedBuffers;if(r){let[n,o,l]=r.getGridBuffers(P,!1);R.draw(i,s.TRIANGLES,e,m,t0.alphaBlended,i.renderElevatedRasterBackface?t3.frontCCW:t3.backCCW,z,a.id,n,o,l)}}else{let e=i.depthModeForSublayer(0,t1.ReadOnly),r=d[n.overscaledZ],{tileBoundsBuffer:o,tileBoundsIndexBuffer:l,tileBoundsSegments:h}=i.getTileBoundsBuffers(w);R.draw(i,s.TRIANGLES,e,r,t0.alphaBlended,t3.disabled,z,a.id,o,l,h)}}i.resetStencilClippingMasks()}(i,r,a,n),i.style.map.triggerRepaint())},background:function(i,r,a,n){let o,s=a.paint.get("background-color"),l="none"===a.paint.get("background-color-use-theme").constantOr("default"),h=a.paint.get("background-opacity"),u=a.paint.get("background-emissive-strength"),c="viewport"===a.paint.get("background-pitch-alignment");if(0===h)return;let d=i.context,p=d.gl,f=i.transform,m=f.tileSize,_=a.paint.get("background-pattern");if(void 0!==_&&(null===_||!(o=i.imageManager.getPattern(e.I.from(_.toString()),a.scope,i.style.getLut(a.scope)))))return;let g=!_&&1===s.a&&1===h&&i.opaquePassEnabledForLayer()?"opaque":"translucent";if(i.renderPass!==g)return;let y=t2.disabled,x=i.depthModeForSublayer(0,"opaque"===g?t1.ReadWrite:t1.ReadOnly),v=i.colorModeForDrapableLayerRenderPass(u),b=_?"backgroundPattern":"background",w,T=n;if(T||(T=Object.values(w=i.getBackgroundTiles()).map(e=>e.tileID)),_&&(d.activeTexture.set(p.TEXTURE0),i.imageManager.bind(i.context,a.scope)),c){let r=i.getOrCreateProgram(b,{overrideFog:!1,overrideRtt:!0}),n=new Float32Array(e.ad.mat4.identity([])),d=new e.aH(0,0,0,0,0),f=_?r3(n,u,h,i,0,a.scope,o,c,{tileID:d,tileSize:m}):r2(n,u,h,s.toRenderColor(l?null:a.lut));r.draw(i,p.TRIANGLES,x,y,v,t3.disabled,f,a.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments)}else for(let e of T){let g=i.isTileAffectedByFog(e),T=i.getOrCreateProgram(b,{overrideFog:g}),S=e.toUnwrapped(),M=n?e.projMatrix:i.transform.calculateProjMatrix(S);i.prepareDrawTile();let E=r?r.getTile(e):w?w[e.key]:new e7(e,m,f.zoom,i),A=_?r3(M,u,h,i,0,a.scope,o,c,{tileID:e,tileSize:m}):r2(M,u,h,s.toRenderColor(l?null:a.lut));i.uploadCommonUniforms(d,T,S);let{tileBoundsBuffer:I,tileBoundsIndexBuffer:C,tileBoundsSegments:P}=i.getTileBoundsBuffers(E);T.draw(i,p.TRIANGLES,x,y,v,t3.disabled,A,a.id,I,C,P)}},sky:function(i,r,a){let n,o,s,l,h,u,c,d,p,f,m,_,g,y,x=i._atmosphere?e.ag(i.transform.zoom):1,v=a.paint.get("sky-opacity")*x;if(0===v)return;let b=i.context,w=a.paint.get("sky-type"),T=new t1(b.gl.LEQUAL,t1.ReadOnly,[0,1]),S=i.frameCounter/1e3%1;"atmosphere"===w?"offscreen"===i.renderPass?a.needsSkyboxCapture(i)&&(function(i,r){let a=i.context,n=a.gl,o=r.skyboxFbo;if(!o){o=r.skyboxFbo=a.createFramebuffer(32,32,!0,null),r.skyboxGeometry=new aP(a),r.skyboxTexture=a.gl.createTexture(),n.bindTexture(n.TEXTURE_CUBE_MAP,r.skyboxTexture),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,n.L
98INEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR);for(let e=0;e<6;++e)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n.RGBA,32,32,0,n.RGBA,n.UNSIGNED_BYTE,null)}a.bindFramebuffer.set(o.framebuffer),a.viewport.set([0,0,32,32]);let s=r.getCenter(i,!0),l=i.getOrCreateProgram("skyboxCapture"),h=new Float64Array(16);e.ad.mat4.identity(h),e.ad.mat4.rotateY(h,h,-(.5*Math.PI)),az(i,r,l,h,s,0),e.ad.mat4.identity(h),e.ad.mat4.rotateY(h,h,.5*Math.PI),az(i,r,l,h,s,1),e.ad.mat4.identity(h),e.ad.mat4.rotateX(h,h,-(.5*Math.PI)),az(i,r,l,h,s,2),e.ad.mat4.identity(h),e.ad.mat4.rotateX(h,h,.5*Math.PI),az(i,r,l,h,s,3),e.ad.mat4.identity(h),az(i,r,l,h,s,4),e.ad.mat4.identity(h),e.ad.mat4.rotateY(h,h,Math.PI),az(i,r,l,h,s,5),a.viewport.set([0,0,i.width,i.height])}(i,a),a.markSkyboxValid(i)):"sky"===i.renderPass&&(o=(n=i.context).gl,s=i.transform,l=i.getOrCreateProgram("skybox"),n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_CUBE_MAP,a.skyboxTexture),h={u_matrix:s.skyboxMatrix,u_sun_direction:a.getCenter(i,!1),u_cubemap:0,u_opacity:v,u_temporal_offset:S},i.uploadCommonUniforms(n,l),l.draw(i,o.TRIANGLES,T,t2.disabled,i.colorModeForRenderPass(),t3.backCW,h,"skybox",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)):"gradient"===w&&"sky"===i.renderPass&&(c=(u=i.context).gl,d=i.transform,p=i.getOrCreateProgram("skyboxGradient"),a.skyboxGeometry||(a.skyboxGeometry=new aP(u)),u.activeTexture.set(c.TEXTURE0),(f=a.colorRampTexture)||(f=a.colorRampTexture=new e.T(u,a.colorRamp,c.RGBA8)),f.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=d.skyboxMatrix,_=a.getCenter(i,!1),g=a.paint.get("sky-gradient-radius"),y={u_matrix:m,u_color_ramp:0,u_center_direction:_,u_radius:e.ak(g),u_opacity:v,u_temporal_offset:S},i.uploadCommonUniforms(u,p),p.draw(i,c.TRIANGLES,T,t2.disabled,i.colorModeForRenderPass(),t3.backCW,y,"skyboxGradient",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment))},debug:function(i,r,a,n,o,s){for(let l=0;l<a.length;l++)if(o){let o=new e.al(.8*n.r,.8*n.g,.8*n.b,1);aS(i,r,a[l],n,-1,-1,s),aS(i,r,a[l],n,-1,1,s),aS(i,r,a[l],n,1,1,s),aS(i,r,a[l],n,1,-1,s),aS(i,r,a[l],o,0,0,s)}else aS(i,r,a[l],n,0,0,s)},custom:function(i,r,a,n){let o=i.context,s=a.implementation;if(!i.transform.projection.unsupportedLayers||!i.transform.projection.unsupportedLayers.includes("custom")||i.terrain&&(i.terrain.renderingToTexture||"offscreen"===i.renderPass)&&a.isDraped(r)){if("offscreen"===i.renderPass){let r=s.prerender;if(r){if(i.setCustomLayerDefaults(),o.setColorMode(i.colorModeForRenderPass()),"globe"===i.transform.projection.name){let a=i.transform.pointMerc;r.call(s,o.gl,i.transform.customLayerMatrix(),i.transform.getProjection(),i.transform.globeToMercatorMatrix(),e.ag(i.transform.zoom),[a.x,a.y],i.transform.pixelsPerMeterRatio)}else r.call(s,o.gl,i.transform.customLayerMatrix());o.setDirty(),i.setBaseState()}}else if("translucent"===i.renderPass){if(i.terrain&&i.terrain.renderingToTexture){let r=s.renderToTile;if(r){let a=n[0].canonical,l=new e.ac(a.x+n[0].wrap*(1<<a.z),a.y,a.z);o.setDepthMode(t1.disabled),o.setStencilMode(t2.disabled),o.setColorMode(i.colorModeForRenderPass()),i.setCustomLayerDefaults(),r.call(s,o.gl,l),o.setDirty(),i.setBaseState()}return}i.setCustomLayerDefaults(),o.setColorMode(i.colorModeForRenderPass()),o.setStencilMode(t2.disabled);let r="3d"===s.renderingMode?new t1(i.context.gl.LEQUAL,t1.ReadWrite,i.depthRangeFor3D):i.depthModeForSublayer(0,t1.ReadOnly);if(o.setDepthMode(r),"globe"===i.transform.projection.name){let r=i.transform.pointMerc;s.render(o.gl,i.transform.customLayerMatrix(),i.transform.getProjection(),i.transform.globeToMercatorMatrix(),e.ag(i.transform.zoom),[r.x,r.y],i.transform.pixelsPerMeterRatio)}else s.render(o.gl,i.transform.customLayerMatrix());o.setDirty(),i.setBaseState(),o.bindFramebuffer.set(null)}}else e.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(i,r,a,n){if("opaque"===i.renderPass)return;let o=a.paint.get("model-opacity").constantOr(1);if(0===o)return;let s=a.paint.get("model-cast-shadows");
98if("shadow"===i.renderPass&&(!s||i.terrain&&o<.65&&a._transitionablePaint._values["model-opacity"].value.expression instanceof e.ab))return;let l=i.shadowRenderer,h=a.paint.get("model-receive-shadows");l&&(l.useNormalOffset=!0,h||(l.enabled=!1));let u=()=>{l&&(l.useNormalOffset=!0,h||(l.enabled=!0))},c=r.getSource();if("light-beam"===i.renderPass&&"batched-model"!==c.type)return;if("vector"===c.type||"geojson"===c.type)return function(i,r,a,n,o){let s=i.transform;if("mercator"!==s.projection.name)return e.w(`Drawing 3D models for ${s.projection.name} projection is not yet implemented`);let l=s.getFreeCameraOptions().position;if(!i.modelManager)return;let h=i.modelManager;a.modelManager=h;let u=i.shadowRenderer;if(!a._unevaluatedLayout._values.hasOwnProperty("model-id"))return;let c=a._unevaluatedLayout._values["model-id"],d=Object.assign({},a.layout.get("model-id").parameters),p=i.style.order.indexOf(a.fqid);for(let f of n){let n=r.getTile(f).getBucket(a);if(!n||n.projection.name!==s.projection.name)continue;let m=n.getModelUris();m&&!n.modelsRequested&&(h.addModelsFromBucket(m,o),n.modelsRequested=!0),d.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 e=o.getMinMaxForTile(i);e&&e.max>c&&(c=e.max)}let d=e.ay(n.x,s,l)-n.x,p=e.ay(n.y,h,u)-n.y,f=e.bH(c,r.center.lat)-n.z;return r._zoomFromMercatorZ(Math.sqrt(d*d+p*p+f*f))}(f,s);let _=c.possiblyEvaluate(d);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=e.dr.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 e in r.instancesPerModel){let i=r.instancesPerModel[e];for(let e=0;e<i.instancedDataArray.length;++e){let a=(n?l*n.getElevationAt(0|i.instancedDataArray.float32[16*e],0|i.instancedDataArray.float32[16*e+1],!0,!0):0)+i.instancesEvaluatedElevation[e];i.instancedDataArray.float32[16*e+6]=a,o=o?Math.min(r.terrainElevationMin,a):a,s=s?Math.max(r.terrainElevationMax,a):a}}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,f),aU.shadowUniformsInitialized=!1,aU.useSingleShadowCascade=!!u&&0===u.getMaxCascadeForTile(f.toUnwrapped()),"shadow"===i.renderPass&&u){if(1===i.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;let r=s.calculatePosMatrix(f.toUnwrapped(),s.worldSize);if(aU.tileMatrix.set(r),aU.shadowTileMatrix=Float32Array.from(u.calculateShadowPassMatrixFromMatrix(r)),aU.aabb.min.fill(0),aU.aabb.max[0]=aU.aabb.max[1]=e.ai,aU.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 e=0;for(let r in i.instancesPerModel){let i=o.getModel(r,n);i?e=Math.max(e,Math.max(Math.max(i.aabb.max[0],i.aabb.max[1]),i.aabb.max[2])):h=!1}u=i.maxScale*e*1.41+i.maxVerticalOffset,h&&(i.maxHeight=u)}l.max[2]=u,l.min[2]+=i.terrainElevationMin,l.max[2]+=i.terrainElevationMax,e.ad.vec3.transformMat4(l.min,l.min,r.tileMatrix),e.ad.vec3.transformMat4(l.max,l.max,r.tileMatrix);let c=l.intersects(s.getCurrentCascadeFrustum());return 0===a.currentShadowCascade&&(i.isInsideFirstShadowMapFrustum=2===c),0===c}(n,aU,i,a.scope))continue}let g=1<<f.canonical.z,y=[((l.x-f.wrap)*g-f.canonical.x)*e.ai,(l.y*g-f.canonical.y)*e.ai,l.z*g*e.ai];for(let e in i.conflationActive&&Object.keys(n.instancesPerModel).length>0&&i.style.isLayerClipped(a,r.getSource())&&n.updateReplacement(f,i.replacementSource,p,o)&&(n.uploaded=!1,n.upload(i.context)),n.instancesPerModel){let r=n.instancesPerModel[e];r.features.length>0&&(e=_.evaluate(r.features[0].feature,{}));let s=h.getModel(e,o);if(s&&s.uploaded)for(let e of s.nodes)!function e(i,r,a,n,o,s,l){let h=i.context,u="shadow"===i.renderPass,c=i.shadowRenderer,d=u&&c?c.getShadowPassDepthMode():new t1(h.gl.LEQUAL,t1.ReadWrite,i.depthRangeFor3D),p=i.isTileAffectedByFog(s);if(a.meshes)for(let e of a.meshes){let f,m,_,g=["MODEL_POSITION_ON_GPU"],y=[];n.instancedDataArray.length>20&&g.push("INSTANCED_ARRAYS");let x=it(i,r.paint.get("model-cutoff-fade-range"));if(x.shouldRenderCutoff&&g.push("RENDER_CUTOFF"),u&&c)f=i.getOrCreateProgram("modelDepth",{defines:g}),m=r6(l.shadowTileMatrix,l.shadowTileMatrix,Float32Array.from(a.matrix)),_=c.getShadowPassColorMode();
98else{aB(g,y,e,i,"none"===r.paint.get("model-color-use-theme").constantOr("default")?null:r.lut),f=i.getOrCreateProgram("model",{defines:g,overrideFog:p});let n=e.material,u=n.pbrMetallicRoughness,d=r.paint.get("model-opacity").constantOr(1),v=r.paint.get("model-emissive-strength").constantOr(0);m=r5(s.expandedProjMatrix,Float32Array.from(a.matrix),new Float32Array(16),null,i,d,u.baseColorFactor.toRenderColor(null),n.emissiveFactor,u.metallicFactor,u.roughnessFactor,n,v,r,o),c&&(l.shadowUniformsInitialized?f.setShadowUniformValues(h,c.getShadowUniformValues()):(c.setupShadows(s.toUnwrapped(),f,"model-tile",s.overscaledZ),l.shadowUniformsInitialized=!0)),_=x.shouldRenderCutoff||d<1||"OPAQUE"!==n.alphaMode?t0.alphaBlended:t0.unblended}i.uploadCommonUniforms(h,f,s.toUnwrapped(),null,x);let v=e.material.doubleSided?t3.disabled:t3.backCCW;if(n.instancedDataArray.length>20)y.push(n.instancedDataBuffer),f.draw(i,h.gl.TRIANGLES,d,t2.disabled,_,v,m,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,y,n.instancedDataArray.length);else{let a=u?"u_instance":"u_normal_matrix";for(let o=0;o<n.instancedDataArray.length;++o)m[a]=new Float32Array(n.instancedDataArray.arrayBuffer,64*o,16),f.draw(i,h.gl.TRIANGLES,d,t2.disabled,_,v,m,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,y)}}if(a.children)for(let h of a.children)e(i,r,h,n,o,s,l)}(i,a,e,r,y,f,aU)}}}(i,r,a,n,"vector"===c.type?a.scope:""),void u();if(!c.loaded())return;if("batched-model"===c.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 e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);let u=i.transform.getFreeCameraOptions().position,c=e.ad.vec3.scale([],[u.x,u.y,u.z],i.transform.worldSize),d=e.ad.vec3.negate([],c),p=e.ad.mat4.identity([]),f=e.dm(s.center.lat,s.zoom),m=e.ad.mat4.fromScaling([],[1,1,1/f]);e.ad.mat4.translate(p,p,d);let _=a.paint.get("model-opacity").constantOr(1),g=new t1(o.gl.LEQUAL,t1.ReadWrite,i.depthRangeFor3D),y=new t1(o.gl.LEQUAL,t1.ReadOnly,i.depthRangeFor3D),x=new e.ce([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),v="shadow"===i.renderPass,b=v&&h?h.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),w=a.paint.get("model-front-cutoff"),T=w[2]<1,S=it(i,a.paint.get("model-cutoff-fade-range")),M=a.getLayerRenderingStats();(function(e,i,r,a){let n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(let s of a){let a=i.getTile(s).getBucket(r);a&&(a.setFilter(r.filter),e.conflationActive&&a.updateReplacement(s,e.replacementSource),a.evaluateScale(e,r),e.terrain&&n>0&&a.elevationUpdate(e.terrain,n,s,r.source),a.needsReEvaluation(e,o,r)&&a.evaluate(r))}})(i,r,a,n),function(){let u,d,E;T?(u=n.length-1,d=-1,E=-1):(u=0,d=n.length,E=1);let A=new Float64Array(16),I=e.ad.vec3.create(),C=new e.P(0,0);for(let P=u;P!==d;P+=E){let u=n[P],d=r.getTile(u).getBucket(a);if(!d||!d.uploaded)continue;let E=!1;h&&(E=0===h.getMaxCascadeForTile(u.toUnwrapped()));let z=s.calculatePosMatrix(u.toUnwrapped(),s.worldSize),D=d.modelTraits;!v&&T&&(e.ad.mat4.invert(A,z),e.ad.vec3.transformMat4(I,c,A),C.x=I[0],C.y=I[1]);let R=[];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;return x.min=[...i.min],x.max=[...i.max],x.min[2]+=n,x.max[2]+=n,e.ad.vec3.transformMat4(x.min,x.min,z),e.ad.vec3.transformMat4(x.max,x.max,z),x})(),l=r.evaluatedScale;if(l[0]<=1&&l[1]<=1&&l[2]<=1&&0===o.intersects(b))continue;if(!v&&T){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]*f<o.max[2]&&a.footprint&&e.bA(C,a.footprint)?Math.max(r.cameraCollisionOpacity-i,0):Math.min(1,r.cameraCollisionOpacity+i)}let h=[...z],u=a.anchor?a.anchor[0]:0,d=a.anchor?a.anchor[1]:0;e.ad.mat4.translate(h,h,[u*(l[0]-1),d*(l[1]-1),n]),e.ad.vec3.exactEquals(l,e.dq)||e.ad.mat4.scale(h,h,l);
98let p=e.ad.mat4.multiply([],h,a.matrix),m=e.ad.mat4.multiply([],s.expandedFarZProjMatrix,p),g=e.ad.mat4.multiply([],s.expandedFarZProjMatrix,h),y=e.ad.vec4.transformMat4([],[u,d,n,1],m)[2];a.hidden=!1;let M=_;v||(T&&(M*=r.cameraCollisionOpacity*function(i,r,a,n){if(r.pitch<20)return 1;let o=r.getWorldToCameraMatrix();e.ad.mat4.multiply(o,o,i);let s=e.ad.vec4.fromValues(a.min[0],a.min[1],a.min[2],1),l=e.ad.vec4.transformMat4(e.ad.vec4.create(),s,o),h=l,u=l;s[1]=a.max[1],h=(l=e.ad.vec4.transformMat4(e.ad.vec4.create(),s,o))[1]<h[1]?l:h,u=l[1]>u[1]?l:u,s[0]=a.max[0],h=(l=e.ad.vec4.transformMat4(e.ad.vec4.create(),s,o))[1]<h[1]?l:h,u=l[1]>u[1]?l:u,s[1]=a.min[1],h=(l=e.ad.vec4.transformMat4(e.ad.vec4.create(),s,o))[1]<h[1]?l:h,u=l[1]>u[1]?l:u;let c=e.ay(n[0],0,1),d=100*r.pixelsPerMeter*e.ay(n[1],0,1),p=e.ay(n[2],0,1),f=e.ad.vec4.lerp(e.ad.vec4.create(),h,u,c),m=Math.tan(.5*r.fovX),_=-f[2]*m;if(0===d)return f[1]<-Math.abs(_)?p:1;let g=(-Math.abs(_)-f[1])/d,y=(e,i,r)=>(1-r)*e+r*i,x=e.ay(y(1,p,g),p,1);return y(1,x,e.ay((r.pitch-20)/20,0,1))}(h,s,r.aabb,w)),M*=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:e.ay(((r-a)/(n-a)-o)/(s-o),0,1)}(S,y)),0!==M?R.push({nodeInfo:r,depth:y,opacity:M,wvpForNode:m,wvpForTile:g,nodeModelMatrix:p,tileModelMatrix:h}):a.hidden=!0}for(let r of(v||R.sort((e,i)=>T&&(1!==e.opacity||1!==i.opacity)?1===e.opacity?-1:1===i.opacity?1:e.depth>i.depth?-1:1:e.depth<i.depth?-1:1),R)){let n=r.nodeInfo,u=n.node,c=e.ad.mat4.multiply([],m,r.tileModelMatrix);e.ad.mat4.multiply(c,p,c);let d=e.ad.mat4.invert([],c);e.ad.mat4.transpose(d,d),e.ad.mat4.scale(d,d,aj),c=e.ad.mat4.multiply(c,c,u.matrix);let f="light-beam"===i.renderPass,_="none"===a.paint.get("model-color-use-theme").constantOr("default"),x=D&e.ds.HasMapboxMeshFeatures,b=x?0:n.evaluatedRMEA[0][2];for(let e=0;e<u.meshes.length;++e){let p,m=u.meshes[e],w=e===u.lightMeshIndex,T=r.wvpForNode;if(w){if(!f&&!i.terrain&&i.shadowRenderer){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);continue}T=r.wvpForTile}else if(f)continue;let S={defines:[]},A=[];if(!v&&h&&(h.useNormalOffset=!!m.normalBuffer),aB(S.defines,A,m,i,_?null:a.lut),x||S.defines.push("DIFFUSE_SHADED"),E&&S.defines.push("SHADOWS_SINGLE_CASCADE"),M&&(v?M.numRenderedVerticesInShadowPass+=m.vertexArray.length:M.numRenderedVerticesInTransparentPass+=m.vertexArray.length),v){aV(m,r.nodeModelMatrix,i,a);continue}let I=null;if(l){let e=aF(r.nodeModelMatrix,i.transform);if(I=new Float32Array(e),"globe"!==s.projection.name){let i=m.aabb.min,r=m.aabb.max,[a,n]=l.getOpacityForBounds(e,i[0],i[1],r[0],r[1]);S.overrideFog=a>=.05||n>=.05}}let C=m.material;C.occlusionTexture&&C.occlusionTexture.offsetScale&&(p=C.occlusionTexture.offsetScale,S.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));let P=i.getOrCreateProgram("model",S);!v&&h&&h.setupShadowsFromMatrix(r.tileModelMatrix,P,h.useNormalOffset),i.uploadCommonUniforms(o,P,null,I);let z=C.pbrMetallicRoughness;z.metallicFactor=.9,z.roughnessFactor=.5;let D=r5(new Float32Array(T),new Float32Array(c),new Float32Array(d),new Float32Array(u.matrix),i,r.opacity,z.baseColorFactor.toRenderColor(null),C.emissiveFactor,z.metallicFactor,z.roughnessFactor,C,b,a,[0,0,0],p);!w&&(n.hasTranslucentParts||r.opacity<1)&&P.draw(i,o.gl.TRIANGLES,g,t2.disabled,t0.disabled,t3.backCCW,D,a.id,m.vertexBuffer,m.indexBuffer,m.segments,a.paint,i.transform.zoom,void 0,A),P.draw(i,o.gl.TRIANGLES,w?y:g,t2.disabled,w||r.opacity<1||n.hasTranslucentParts?t0.alphaBlended:t0.unblended,t3.backCCW,D,a.id,m.vertexBuffer,m.indexBuffer,m.segments,a.paint,i.transform.zoom,void 0,A)}}}}()}(i,r,a,n),void u();if("model"!==c.type)return;let d=c.getModels(),p=[],f=i.transform.getFreeCameraOptions().position,m=e.ad.vec3.scale([],[f.x,f.y,f.z],i.transform.worldSize);e.ad.vec3.negate(m,m);let _=[],g=[],y=0;for(let r of d){let n=a.paint.get("model-rotation").constantOr(null),o=a.paint.get("model-scale").constantOr(null),s=a.paint.get("model-translation").constantOr(null);r.computeModelMatrix(i,n,o,s,!0,!0,!1);let l=e.ad.mat4.identity([]),h=e.dm(r.position.lat,i.transform.zoom),u=e.ad.mat4.fromScaling([],[1,1,1/h]);for(let a of(e.ad.mat4.translate(l,l,m),p.push({zScaleMatrix:u,negCameraPosMatrix:l}),r.nodes))!function i(r,a,n,o,s,l,h){let u;u="globe"===r.projection.name?e.dp(n,r):[...n],e.ad.mat4.multiply(u,u,a.matrix
98);let c=e.ad.mat4.multiply([],o,u);if(a.meshes)for(let i of a.meshes){if("BLEND"!==i.material.alphaMode){h.push({mesh:i,depth:0,modelIndex:s,worldViewProjection:c,nodeModelMatrix:u});continue}let a=e.ad.vec3.transformMat4([],i.centroid,c);!r.isOrthographic&&a[2]<=0||l.push({mesh:i,depth:a[2],modelIndex:s,worldViewProjection:c,nodeModelMatrix:u})}if(a.children)for(let e of a.children)i(r,e,n,o,s,l,h)}(i.transform,a,r.matrix,i.transform.expandedFarZProjMatrix,y,_,g);y++}if(_.sort((e,i)=>i.depth-e.depth),"shadow"!==i.renderPass){if(1===o)for(let e of g)aN(e,i,a,p[e.modelIndex],t2.disabled,i.colorModeForRenderPass());else{for(let e of g)aN(e,i,a,p[e.modelIndex],t2.disabled,t0.disabled);for(let e of g)aN(e,i,a,p[e.modelIndex],i.stencilModeFor3D(),i.colorModeForRenderPass());i.resetStencilClippingMasks()}for(let e of _)aN(e,i,a,p[e.modelIndex],t2.disabled,i.colorModeForRenderPass());u()}else{for(let e of g)aV(e.mesh,e.nodeModelMatrix,i,a);for(let e of _)aV(e.mesh,e.nodeModelMatrix,i,a);u()}}},a6={line:function(e,i,r){if(e.hasElevatedBuckets=!1,e.hasNonElevatedBuckets=!1,void 0!==e._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==e._unevaluatedLayout.getValue("line-z-offset")){if(i)for(let r of i.getVisibleCoordinates()){let a=i.getTile(r).getBucket(e);if(a&&(a.hasZOffset?e.hasElevatedBuckets=!0:e.hasNonElevatedBuckets=!0,e.hasElevatedBuckets&&e.hasNonElevatedBuckets))break}}else e.hasNonElevatedBuckets=!0},model:function(e,i,r){let a=i.getSource();if(a.loaded()){if("vector"===a.type||"geojson"===a.type)return void(r.modelManager&&r.modelManager.upload(r,"vector"===a.type?e.scope:""));if("batched-model"!==a.type&&"model"===a.type)for(let e of a.getModels())e.upload(r.context)}},raster:function(e,i,r){let a=i.getSource();if(!(a instanceof eY&&a.loaded()))return;let n=e.sourceLayer||a.rasterLayerIds&&a.rasterLayerIds[0];if(!n)return;let o=e.paint.get("raster-array-band")||a.getInitialBand(n);if(null!=o)for(let e of i.getIds().map(e=>i.getTileByID(e)))e.updateNeeded(n,o)&&a.prepareTile(e,n,o)},"raster-particle":function(e,i,r){let a=i.getSource();if(!(a instanceof eY&&a.loaded()))return;let n=e.sourceLayer||a.rasterLayerIds&&a.rasterLayerIds[0];if(!n)return;let o=e.paint.get("raster-particle-array-band")||a.getInitialBand(n);if(null!=o)for(let e of i.getIds().map(e=>i.getTileByID(e)))e.updateNeeded(n,o)&&a.prepareTile(e,n,o)}},a8={fill:al};class a9{constructor(i,r,a,n,o){this.context=new ai(i,r),this.transform=a,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=o,this._timeStamp=e.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const s=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const e of s)this._debugParams.enabledLayers[e]=!0;for(const e of(o.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),o.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),o.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),o.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),o.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200}),s))o.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new aZ(o),this.setup(),this.numSublayers=tr.maxUnderzooming+tr.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.dy,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new io(this),this._wireframeDebugCache=new aq,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const l=new e.r({width:1,height:1},Uint8Array.of(0,0,0,0));
98this.emptyDepthTexture=new e.T(this.context,l,i.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=n}updateTerrain(e,i){let r=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(r||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new rC(this,e));let a=this._terrain;this.transform.elevation=r?a:null,a.update(e,this.transform,i),this.transform.elevation&&!a.enabled&&(this.transform.elevation=null)}_updateFog(e){let i=e.fog;if(!i||"globe"===this.transform.projection.name||1>i.getOpacity(this.transform.pitch)||.03>i.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[r,a]=i.getFovAdjustedRange(this.transform._fov);if(r>a)return void(this.transform.fogCullDistSq=null);let n=r+.78*(a-r);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new rC(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(i,r){if(this.width=i*e.q.devicePixelRatio,this.height=r*e.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style.order)this.style._mergedLayers[e].resize()}setup(){let i=this.context,r=new e.b5;r.emplaceBack(0,0),r.emplaceBack(e.ai,0),r.emplaceBack(0,e.ai),r.emplaceBack(e.ai,e.ai),this.tileExtentBuffer=i.createVertexBuffer(r,e.b7.members),this.tileExtentSegments=e.b8.simpleSegment(0,0,4,2);let a=new e.b5;a.emplaceBack(0,0),a.emplaceBack(e.ai,0),a.emplaceBack(0,e.ai),a.emplaceBack(e.ai,e.ai),this.debugBuffer=i.createVertexBuffer(a,e.b7.members),this.debugSegments=e.b8.simpleSegment(0,0,4,5);let n=new e.b5;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(n,e.b7.members),this.viewportSegments=e.b8.simpleSegment(0,0,4,2);let o=new e.aU;o.emplaceBack(0,0,0,0),o.emplaceBack(e.ai,0,e.ai,0),o.emplaceBack(0,e.ai,0,e.ai),o.emplaceBack(e.ai,e.ai,e.ai,e.ai),this.mercatorBoundsBuffer=i.createVertexBuffer(o,e.ba.members),this.mercatorBoundsSegments=e.b8.simpleSegment(0,0,4,2);let s=new e.aV;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(s);let l=new e.b6;for(let e of[0,1,3,2,0])l.emplaceBack(e);this.debugIndexBuffer=i.createIndexBuffer(l),this.emptyTexture=new e.T(i,new e.r({width:1,height:1},Uint8Array.of(0,0,0,0)),i.gl.RGBA8),this.identityMat=e.ad.mat4.create();let h=this.context.gl;this.stencilClearMode=new t2({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){let e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,t1.disabled,this.stencilClearMode,t0.disabled,t3.disabled,rS(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,i,r){if(!i||this.currentStencilSource===i.id||!e.isTileClipped()||!r||0===r.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(let i of r)if(void 0===this._tileClippingMaskIDs[i.key]){e=!0;break}if(!e)return}this.currentStencilSource=i.id;let a=this.context,n=a.gl;this.nextStencilID+r.length>256&&this.clearStencil(),a.setColorMode(t0.disabled),a.setDepthMode(t1.disabled);let o=this.getOrCreateProgram("clippingMask");for(let e of(this._tileClippingMaskIDs={},r)){let r=i.getTile(e),a=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:s,tileBoundsIndexBuffer:l,tileBoundsSegments:h}=this.getTileBoundsBuffers(r);o.draw(this,n.TRIANGLES,t1.disabled,new t2({func:n.ALWAYS,mask:0},a,255,n.KEEP,n.KEEP,n.REPLACE),t0.disabled,t3.disabled,rS(e.projMatrix),"$clipping",s,l,h)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,i=this.context.gl;return new t2({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);let i=this.context.gl;return new t2({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(e){let i=this.context.gl,r=e.sort((e,i)=>
98i.overscaledZ-e.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let e={};for(let r=0;r<n;r++)e[r+a]=new t2({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[a]:t2.disabled},r]}colorModeForRenderPass(){let i=this.context.gl;if(this._showOverdrawInspector){let r=1/8;return new t0([i.CONSTANT_COLOR,i.ONE,i.CONSTANT_COLOR,i.ONE],new e.al(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?t0.unblended:t0.alphaBlended}colorModeForDrapableLayerRenderPass(i){let r=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&"translucent"===this.renderPass?new t0([r.ONE,r.ONE_MINUS_SRC_ALPHA,r.CONSTANT_ALPHA,r.ONE_MINUS_SRC_ALPHA],new e.al(0,0,0,void 0===i?0:i),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,i,r,a=!1){if(this.depthOcclusion)return new t1(this.context.gl.GREATER,t1.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!a)return t1.disabled;let n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new t1(r||this.context.gl.LEQUAL,i,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){let i=this.context.gl,r=Math.ceil(this.width),a=Math.ceil(this.height),n=this.context.bindFramebuffer.get(),o=i.getParameter(i.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===r&&this.depthFBO.height===a||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==r&&0!==a&&(this.depthFBO=new at(this.context,r,a,!1,"texture"),this.depthTexture=new e.T(this.context,{width:r,height:a,data:null},i.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(n),i.bindTexture(i.TEXTURE_2D,o),this.depthFBO&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),i.blitFramebuffer(0,0,r,a,0,0,r,a,i.DEPTH_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(0===this._dt?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((e,i)=>e+i/this._fpsHistory.length,0))}render(i,r){var a,n;let o,s,l=e.q.now();this._dt=l-this._timeStamp,this._timeStamp=l,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=i.map.repaint,this.style=i,this.options=r;let h=this.style._mergedLayers,u=!(!this.terrain||!this.terrain.enabled),c=()=>this.style._getOrder(u).filter(e=>{let i=h[e];return!(i.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[i.type]}),d=c(),p=!1,f=!1;for(let e of d){let i=h[e];"circle"===i.type&&(p=!0),"symbol"===i.type&&(i.hasInitialOcclusionOpacityProperties?f=!0:p=!0)}let m=d.map(e=>h[e]),_=this.style._mergedSourceCaches;this.imageManager=i.imageManager,this.modelManager=i.modelManager,this.symbolFadeChange=i.placement.symbolFadeChange(e.q.now()),this.imageManager.beginFrame();let g=0,y=!1;for(let e in _){let i=_[e];i.used&&(i.prepare(this.context),i.getSource().usedInConflation&&++g)}let x=!1;for(let e of m)e.isHidden(this.transform.zoom)||("clip"===e.type&&(x=!0),this.prepareLayer(e));let v={},b={},w={},T={},S={};for(let e in _){let i=_[e];v[e]=i.getVisibleCoordinates(),b[e]=v[e].slice().reverse(),w[e]=i.getVisibleCoordinates(!0).reverse(),T[e]=i.getShadowCasterCoordinates(),S[e]=i.sortCoordinatesByDistance(v[e])}let M=e=>{let i=this.style.getLayerSourceCache(e);return i&&i.used?i.getSource():null};if(g||x||this._clippingActiveLastFrame){let i=[],r=[],a=0;for(let e of m)this.isSourceForClippingOrConflation(e,M(e))&&(i.push(e),r.push(a)),a++;if(i&&(x||i.length>1)||this._clippingActiveLastFrame){x=!1;let a=[];for(let n=0;n<i.length;n++){let o=i[n],s=r[n],l=this.style.getLayerSourceCache(o);if(!l||!l.used||!l.getSource().usedInConflation&&"clip"!==o.type)continue;let h=e.dA,u=e.by.None,c=[],d=!0;
98if("clip"===o.type){for(let i of(h=s,o.layout.get("clip-layer-types")))u|="model"===i?e.by.Model:"symbol"===i?e.by.Symbol:e.by.FillExtrusion;for(let e of o.layout.get("clip-layer-scope"))c.push(e);o.isHidden(this.transform.zoom)?d=!1:x=!0}d&&a.push({layer:o.fqid,cache:l,order:h,clipMask:u,clipScope:c})}this.replacementSource.setSources(a),y=!0}}this._clippingActiveLastFrame=x,y||this.replacementSource.clear(),this.conflationActive=y,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let e=0;e<m.length;e++){let i=m[e],r=i.cutoffRange();if(this.longestCutoffRange=Math.max(r,this.longestCutoffRange),r>0){let e=M(i);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),i.minzoom&&(this.minCutoffZoom=Math.max(i.minzoom,this.minCutoffZoom))}i.is3D(u)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}let E=this.style&&this.style.fog;E?(this._fogVisible=0!==E.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=E.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(w),this.opaquePassCutoff=0,m=(d=c()).map(e=>h[e]));let A=this._shadowRenderer;if(A)for(let e in A.updateShadowParameters(this.transform,this.style.directionalLight),_)for(let i of v[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(i)||e),A.addShadowReceiver(i.toUnwrapped(),e.min,e.max)}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.dz(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ak(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let I=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),C=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(I&&!this._snow&&(this._snow=new a4(this)),!I&&this._snow&&(this._snow.destroy(),delete this._snow),C&&!this._rain&&(this._rain=new a2(this)),!C&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),!j.has(this.context.gl))return;for(let e of(this.renderPass="offscreen",m)){let r=i.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;let a=r?b[r.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||a&&a.length)&&this.renderLayer(this,r,e,a)}this.depthRangeFor3D=[0,1-(m.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,T)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);let P="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),z=(()=>{if(r.showOverdrawInspector)return e.al.black;let i=this.style.fog;if(i&&this.transform.projection.supportsFog){let r=this.style.getLut(i.scope);if(!P){let a="none"===i.properties.get("color-use-theme"),n=i.properties.get("color").toRenderColor(a?null:r).toArray01();return new e.al(...n)}if(P){let a="none"===i.properties.get("space-color-use-theme"),n=i.properties.get("space-color").toRenderColor(a?null:r).toArray01();return new e.al(...n)}}return e.al.transparent})();if(this.context.clear({color:z,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&P&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=d.length-1;this.currentLayer>=0;this.currentLayer--){let e=m[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())continue;let a=r?(e.is3D(u)?S:b)[r.id]:void 0;this._renderTileClippingMasks(e,r,a),this.renderLayer(this,r,e,a)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&P&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.ag(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isH
98orizonVisible()))for(this.currentLayer=0;this.currentLayer<d.length;this.currentLayer++){let e=m[this.currentLayer],r=i.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,r,e,r?b[r.id]:void 0)}function D(e,i){let r;return i&&(r=("symbol"===e.type?w:e.is3D(u)?S:b)[i.id]),r}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<d.length;){let e=m[this.currentLayer];if("raster"===e.type||"raster-particle"===e.type){let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,D(e,r))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let R=0;A&&(R=A.getShadowCastingLayerCount());let L=!1,O=-1;for(let e=0;e<d.length;++e){let i=m[e];i.isHidden(this.transform.zoom)||i.is3D(u)&&(O=e)}f&&-1===O&&(p=!0);let k=!1;for(;this.currentLayer<d.length;){let e=m[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(e)){if(e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!k&&e.is3D(u)&&!u){let e=this.currentLayer,i=e=>{for(this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){let i=m[this.currentLayer];if(a8[i.type]){let r=this.style.getLayerSourceCache(i);a8[i.type](this,r,i,D(i,r),e)}}};i("initialize"),i("reset"),this.currentLayer=e,k=!0}if(p&&!L&&this.terrain&&!this.transform.isOrthographic&&(L=!0,this.blitDepth()),f&&-1!==O&&this.currentLayer===O+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(e,r,r?v[r.id]:void 0),this.renderLayer(this,r,e,D(e,r)),!this.terrain&&A&&R>0&&e.hasShadowPass()&&0==--R&&(A.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){let e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){let e=m[this.currentLayer];if(!e.hasLightBeamPass())continue;let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,r?b[r.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){let e=this.currentLayer;for(let e of(this.depthOcclusion=!0,this.layersWithOcclusionOpacity)){this.currentLayer=e;let r=m[this.currentLayer],a=i.getLayerSourceCache(r),n=a?b[a.id]:void 0;this.terrain||this._renderTileClippingMasks(r,a,a?v[a.id]:void 0),this.renderLayer(this,a,r,n)}this.depthOcclusion=!1,this.currentLayer=e,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 r=null;m.forEach(e=>{let a=i.getLayerSourceCache(e);a&&!e.isHidden(this.transform.zoom)&&a.getVisibleCoordinates().length&&(!r||r.getSource().maxzoom<a.getSource().maxzoom)&&(r=a)}),r&&this.options.showTileBoundaries&&a5.debug(this,r,r.getVisibleCoordinates(),e.al.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&a5.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.al(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&(o=this.transform.padding,aM(this,this.transform.height-(o.top||0),3,ax),aM(this,o.bottom||0,3,av),aE(this,o.left||0,3,ab),aE(this,this.transform.width-(o.right||0),3,aw),s=this.transform.centerPoint,a=s.x,aA(this,a-1,(n=this.transform.height-s.y)-10,2,20,aT),aA(this,a-10,n-1,20,2,aT)),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
98anvasCopy()),y||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);let{unsupportedLayers:i}=this.transform.projection,r=!i||!i.includes(e.type);if(a6[e.type]&&(r||this.terrain&&"custom"===e.type)){let i=this.style.getLayerSourceCache(e);a6[e.type](e,i,this)}this.gpuTimingEnd()}renderLayer(e,i,r,a){r.isHidden(this.transform.zoom)||("background"===r.type||"sky"===r.type||"custom"===r.type||"model"===r.type||"raster"===r.type||"raster-particle"===r.type||a&&a.length)&&(this.id=r.id,this.gpuTimingStart(r),e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes(r.type)&&(!e.terrain||"custom"!==r.type)||"clip"===r.type||a5[r.type](e,i,r,a,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;let i=this.context.extTimerQuery,r=this.context.gl,a=this.gpuTimers[e.id];a||(a=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:r.createQuery()}),a.calls++,r.beginQuery(i.TIME_ELAPSED_EXT,a.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let e=this.context.extTimerQuery,i=this.context.gl,r=i.createQuery();this.deferredRenderGpuTimeQueries.push(r),i.beginQuery(e.TIME_ELAPSED_EXT,r)}}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 e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){let e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){let i={};for(let r in e){let a=e[r],n=this.context.extTimerQuery,o=n.getQueryParameter(a.query,this.context.gl.QUERY_RESULT)/1e6;n.deleteQueryEXT(a.query),i[r]=o}return i}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;let i=this.context.gl,r=0;for(let a of e)r+=i.getQueryParameter(a,i.QUERY_RESULT)/1e6,i.deleteQuery(a);return r}translatePosMatrix(i,r,a,n,o){if(!a[0]&&!a[1])return i;let s=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(s){let e=Math.sin(s),i=Math.cos(s);a=[a[0]*i-a[1]*e,a[0]*e+a[1]*i]}let l=[o?a[0]:e.at(r,a[0],this.transform.zoom),o?a[1]:e.at(r,a[1],this.transform.zoom),0],h=new Float32Array(16);return e.ad.mat4.translate(h,i,l),h}saveTileTexture(e){let i=e.size[0],r=this._tileTextures[i];r?r.push(e):this._tileTextures[i]=[e]}getTileTexture(e){let i=this._tileTextures[e];return i&&i.length>0?i.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,i,r){let a=void 0===r?this.terrain&&this.terrain.renderingToTexture:r,n=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(n.push("LIGHTING_3D_MODE"),n.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):a||n.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass&&(this._shadowMapDebug||n.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(n.push("TERRAIN"),this.linearFloatFilteringSupported()&&n.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&n.push("GLOBE"),this._fogVisible&&!a&&(void 0===i||i)&&n.push("FOG","FOG_DITHERING"),a&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}getOrCreateProgram(e,i){this.cache=this.cache||{};let r=i&&i.defines||[],a=i&&i.config,n=this.currentGlobalDefines(e,i&&i.overrideFog,i&&i.overrideRtt).concat(r),o=rD.cacheKey(iV[e],e,n,a);return this.cache[o]||(this.cache[o]=new rD(this.context,e,iV[e],a,r8[e],n)),this.cache[o]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
98stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(i,r){if(this.style.enable3dLights()){let o=this.style.directionalLight,s=this.style.ambientLight;if(o&&s){var a,n;let l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E=(a=this.style,l=o.properties.get("direction"),h="none"===o.properties.get("color-use-theme"),u=o.properties.get("color").toRenderColor(h?null:a.getLut(o.scope)).toArray01(),c=o.properties.get("intensity"),d="none"===s.properties.get("color-use-theme"),p=s.properties.get("color").toRenderColor(d?null:a.getLut(s.scope)).toArray01(),f=s.properties.get("intensity"),m=[l.x,l.y,l.z],_=e.cN(p,f),{u_lighting_ambient_color:_,u_lighting_directional_dir:m,u_lighting_directional_color:g=e.cN(u,c),u_ground_radiance:(n=[0,0,1],y=e.ad.vec3.dot(n,m),x=e.ad.vec3.dot(g,[.2126,.7152,.0722]),b=(v=(e,i,r)=>(1-r)*e+r*i)(1-.3*Math.min(x,1),1,Math.min(y+1,1)),w=v(.92,1,Math.asin(e.ay(n[2],-1,1))/Math.PI+.5)*b,T=[0,0,0],e.ad.vec3.scale(T,_.slice(0,3),w),S=[0,0,0],e.ad.vec3.scale(S,g.slice(0,3),m[2]),M=[0,0,0],e.ad.vec3.add(M,T,S),e.cg(M))});r.setLightsUniformValues(i,E)}}}uploadCommonUniforms(i,r,a,n,o){if(this.uploadCommonLightUniforms(i,r),this.terrain&&this.terrain.renderingToTexture)return;let s=this.style.fog;if(s){let o=s.getOpacity(this.transform.pitch),l=((i,r,a,n,o,s,l,h,u,c,d,p)=>{let f=i.transform,m="none"===r.properties.get("color-use-theme"),_=r.properties.get("color").toRenderColor(m?null:i.style.getLut(r.scope)).toArray01();_[3]=n;let g=i.frameCounter/1e3%1,[y,x]=r.properties.get("vertical-range");return{u_fog_matrix:a?f.calculateFogTileMatrix(a):p||i.identityMat,u_fog_range:r.getFovAdjustedRange(f._fov),u_fog_color:_,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(y,x),x],u_fog_temporal_offset:g,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:l,u_frustum_bl:h,u_globe_pos:u,u_globe_radius:c,u_viewport:d,u_globe_transition:e.ag(f.zoom),u_is_globe:+("globe"===f.projection.name)}})(this,s,a,o,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*e.q.devicePixelRatio,this.transform.height*e.q.devicePixelRatio],n);r.setFogUniformValues(i,l)}o&&r.setCutoffUniformValues(i,o.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){let e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){let e=this.context.gl,i=e.createTexture();return e.bindTexture(e.TEXTURE_2D,i),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),i}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){let e=this._backgroundTiles,i=this._backgroundTiles={};for(let r of this.transform.coveringTiles({tileSize:512}))i[r.key]=e[r.key]||new e7(r,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,i){return!(!e.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer)&&(!i||"batched-model"!==i.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let i=this._cachedTileFogOpacities[e.key];return i||(this._cachedTileFogOpacities[e.key]=i=this.style.fog.getOpacityForTile(e)),i[0]>=.05||i[1]>=.05}setupDepthForOcclusion(e,i,r){var a;let n=this.context,o=n.gl,s=!!r;r||(r={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}),n.activeTexture.set(o.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),r.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],r.u_depth_range_unpack=[2/((a=this.depthRangeFor3D)[1]-a[0]),-1-2*a[0]/(a[1]-a[0])],r.u_occluder_half_size=.5*this.occlusionParams.occluderSize,r.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
98DepthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE0),s||i.setTerrainUniformValues(n,r)}}function a7(e,i){let r=!1,a=null,n=()=>{a=null,r&&(e(),a=setTimeout(n,i),r=!1)};return()=>(r=!0,a||n(),a)}class ne{constructor(i){this._hashName=i&&encodeURIComponent(i),e.aQ(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=a7(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.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 e=this._map;if(!e)return"";let i=nt(e);if(this._hashName){let e=this._hashName,r=!1,a=location.hash.slice(1).split("&").map(a=>{let n=a.split("=")[0];return n===e?(r=!0,`${n}=${i}`):a}).filter(e=>e);return r||a.push(`${e}=${i}`),`#${a.join("&")}`}return`#${i}`}_getCurrentHash(){let e=location.hash.replace("#","");if(this._hashName){let i;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(i=e)}),(i&&i[1]||"").split("/")}return e.split("/")}_onHashChange(){let e=this._map;if(!e)return!1;let i=this._getCurrentHash();if(i.length>=3&&!i.some(e=>isNaN(e))){let r=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(i[3]||0):e.getBearing();return e.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function nt(e,i){let r=e.getCenter(),a=Math.round(100*e.getZoom())/100,n=Math.pow(10,Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10)),o=Math.round(r.lng*n)/n,s=Math.round(r.lat*n)/n,l=e.getBearing(),h=e.getPitch(),u=i?`/${o}/${s}/${a}`:`${a}/${s}/${o}`;return(l||h)&&(u+="/"+Math.round(10*l)/10),h&&(u+=`/${Math.round(h)}`),u}let ni={linearity:.3,easing:e.dB(0,0,.3,1)},nr=e.l({deceleration:2500,maxSpeed:1400},ni),na=e.l({deceleration:20,maxSpeed:1400},ni),nn=e.l({deceleration:1e3,maxSpeed:360},ni),no=e.l({deceleration:1e3,maxSpeed:90},ni);class ns{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.q.now(),settings:i})}_drainInertiaBuffer(){let i=this._inertiaBuffer,r=e.q.now();for(;i.length>0&&r-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;let r={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)r.zoom+=e.zoomDelta||0,r.bearing+=e.bearingDelta||0,r.pitch+=e.pitchDelta||0,e.panDelta&&r.pan._add(e.panDelta),e.around&&(r.around=e.around),e.pinchAround&&(r.pinchAround=e.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){let o=nh(r.pan.mag(),a,e.l({},nr,i||{}));n.offset=r.pan.mult(o.amount/r.pan.mag()),n.center=this._map.transform.center,nl(n,o)}if(r.zoom){let e=nh(r.zoom,a,na);n.zoom=this._map.transform.zoom+e.amount,nl(n,e)}if(r.bearing){let i=nh(r.bearing,a,nn);n.bearing=this._map.transform.bearing+e.ay(i.amount,-179,179),nl(n,i)}if(r.pitch){let e=nh(r.pitch,a,no);n.pitch=this._map.transform.pitch+e.amount,nl(n,e)}if(n.zoom||n.bearing){let e=void 0===r.pinchAround?r.around:r.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function nl(e,i){(!e.duration||e.duration<i.duration)&&(e.duration=i.duration,e.easing=i.easing)}function nh(i,r,a){let{maxSpeed:n,linearity:o,deceleration:s}=a,l=e.ay(i*o/(r/1e3),-n,n),h=Math.abs(l)/(s*o);return{easing:a.easing,duration:1e3*h,amount:h/2*l}}class nu extends e.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){const o=v(r.getCanvasContainer(),a),s=r.unproject(o);super(i,e.l({point:o,lngLat:s,originalEvent:a},n)),this._defaultPrevented=!1,this.target=r}}class nc extends e.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a){const n="touchend"===i?a.changedTouches:a.touches,o=b(r.getCanvasContainer(),n),s=o.map(e=>r.unproject(e)),l=o.reduce((e,i,r,a)=>e.add(i.div(a.length)),new e.P(0,0));super(i,{points:o,point:l,lngLats:s,lngLat:r.unproject(l),originalEvent:a}),this._defaultPrevented=!1}}class nd extends e.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i){super("wheel",{originalEvent:i}),this._defaultPrevented=!1}}class np{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new nd(this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new nu(e.type,this._map,e))}mouseup(e){this._map.fire(new nu(e.type,this._map,e))}preclick(i){let r=e.l({},i);r.type="preclick",this._map.fire(new nu(r.type,this._map,r))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||(this.preclick(e),this._map.fire(new nu(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new nu(e.type,this._map,e))}mouseover(e){this._map.fire(new nu(e.type,this._map,e))}mouseout(e){this._map.fire(new nu(e.type,this._map,e))}touchstart(e){return this._firePreventable(new nc(e.type,this._map,e))}touchmove(e){this._map.fire(new nc(e.type,this._map,e))}touchend(e){this._map.fire(new nc(e.type,this._map,e))}touchcancel(e){this._map.fire(new nc(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nf{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new nu(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new nu("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new nu(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nm{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&0===e.button&&(_(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;let r=this._startPos,a=this._lastPos;if(!r||!a||a.equals(i)||!this._box&&i.dist(r)<this._clickTolerance)return;this._lastPos=i,this._box||(this._box=d("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(r.x,i.x),o=Math.max(r.x,i.x),s=Math.min(r.y,i.y),l=Math.max(r.y,i.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${n}px,${s}px)`,this._box.style.width=o-n+"px",this._box.style.height=l-s+"px")})}mouseupWindow(i,r){if(!this._active)return;let a=this._startPos;if(a&&0===i.button){if(this.reset(),x(),a.x!==r.x||a.y!==r.y)return this._map.fire(new e.A("boxzoomend",{originalEvent:i})),{cameraAnimation:e=>e.fitScreenCoordinates(a,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",i)}}
98keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),g(),delete this._startPos,delete this._lastPos}_fireEvent(i,r){return this._map.fire(new e.A(i,{originalEvent:r}))}}function n_(e,i){let r={};for(let a=0;a<e.length;a++)r[e[a].identifier]=i[a];return r}class ng{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(i,r,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=i.timeStamp),a.length===this.numTouches&&(this.centroid=function(i){let r=new e.P(0,0);for(let e of i)r._add(e);return r.div(i.length)}(r),this.touches=n_(a,r)))}touchmove(e,i,r){if(this.aborted||!this.centroid)return;let a=n_(r,i);for(let e in this.touches){let i=a[e];(!i||i.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,i,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class ny{constructor(e){this.singleTap=new ng(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,i,r){this.singleTap.touchstart(e,i,r)}touchmove(e,i,r){this.singleTap.touchmove(e,i,r)}touchend(e,i,r){let a=this.singleTap.touchend(e,i,r);if(a){let i=e.timeStamp-this.lastTime<500,r=!this.lastTap||30>this.lastTap.dist(a);if(i&&r||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class nx{constructor(){this._zoomIn=new ny({numTouches:1,numTaps:2}),this._zoomOut=new ny({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,r){this._zoomIn.touchstart(e,i,r),this._zoomOut.touchstart(e,i,r)}touchmove(e,i,r){this._zoomIn.touchmove(e,i,r),this._zoomOut.touchmove(e,i,r)}touchend(e,i,r){let a=this._zoomIn.touchend(e,i,r),n=this._zoomOut.touchend(e,i,r);return a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:i.getZoom()+1,around:i.unproject(a)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:i.getZoom()-1,around:i.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let nv={0:1,2:2},nb={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class nw{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,i){return!1}_move(e,i){return{}}mousedown(e,i){if(this._lastPoint)return;let r=w(e);this._correctButton(e,r)&&(this._lastPoint=i,this._eventButton=r)}mousemoveWindow(e,i){let r=this._lastPoint;if(r){let a;if(e.preventDefault(),null!=this._eventButton&&(a=nv[this._eventButton],void 0===e.buttons||(e.buttons&a)!==a))this.reset();else if(this._moved||!(i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}}mouseupWindow(e){this._lastPoint&&w(e)===this._eventButton&&(this._moved&&x(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nT extends nw{mousedown(e,i){super.mousedown(e,i),this._lastPoint&&(this._active=!0)}_correctButton(e,i){return 0===i&&!e.ctrlKey}_move(e,i){return{around:i,panDelta:i.sub(e)}}}class nS extends nw{constructor(e){super(e),this._pitchRotateKey=e.pitchRotateKey?nb[e.pitchRotateKey]:void 0}_correctButton(e,i){return this._pitchRotateKey?0===i&&e[this._pitchRotateKey]:0===i&&e.ctrlKey||2===i}_move(e,i){let r=.8*(i.x-e.x);if(r)return this._active=!0,{bearingDelta:r}}contextmenu(e){this._pitchRotateKey||e.preventDefault()}}class nM extends nw{constructor(e){super(e),this._pitchRotateKey=e.pitchRotateKey?nb[e.pitchRotateKey]:void 0}_correctButton(e,i){return this._pitchRotateKey?0===i&&e[this._pitchRotateKey]:0===i&&e.ctrlKey||2===i}_move(e,i){let r=-.5*(i.y-e.y);if(r)return this._active=!0,{pitchDelta:r}}contextmenu(e){this._pitchRotateKey||e.preventDefault()}}class nE{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),e.aQ(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}touchstart(e,i,r){return this._calculateTransform(e,i,r)}touchmove(i,r,a){if(this._active&&!(a.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===a.length&&!e.dC())return void this._showTouchPanBlockerAlert();
98"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return i.cancelable&&i.preventDefault(),this._calculateTransform(i,r,a)}}touchend(e,i,r){this._calculateTransform(e,i,r),this._active&&r.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,r,a){a.length>0&&(this._active=!0);let n=n_(a,r),o=new e.P(0,0),s=new e.P(0,0),l=0;for(let e in n){let i=n[e],r=this._touches[e];r&&(o._add(i),s._add(i.sub(r)),l++,n[e]=i)}if(this._touches=n,l<this._minTouches||!s.mag())return;let h=s.div(l);return this._sum._add(h),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(l),panDelta:h}}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=d("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 nA{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,i,r){return{}}touchstart(e,i,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,r){let a=this._firstTwoTouches;if(!a)return;e.preventDefault();let[n,o]=a,s=nI(r,i,n),l=nI(r,i,o);if(!s||!l)return;let h=this._aroundCenter?null:s.add(l).div(2);return this._move([s,l],h,e)}touchend(e,i,r){if(!this._firstTwoTouches)return;let[a,n]=this._firstTwoTouches,o=nI(r,i,a),s=nI(r,i,n);o&&s||(this._active&&x(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function nI(e,i,r){for(let a=0;a<e.length;a++)if(e[a].identifier===r)return i[a]}function nC(e,i){return Math.log(e/i)/Math.LN2}class nP extends nA{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){let r=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(.1>Math.abs(nC(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:nC(this._distance,r),pinchAround:i}}}function nz(e,i){return 180*e.angleWith(i)/Math.PI}class nD extends nA{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),r&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:nz(this._vector,r),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let i=25/(Math.PI*this._minDiameter)*360,r=this._startVector;return!!r&&Math.abs(nz(e,r))<i}}function nR(e){return Math.abs(e.y)>Math.abs(e.x)}class nL extends nA{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,nR(e[0].sub(e[1]))&&(this._valid=!1)}_move(i,r,a){let n=this._lastPoints;if(!n)return;let o=i[0].sub(n[0]),s=i[1].sub(n[1]);return this._map._cooperativeGestures&&!e.dC()&&a.touches.length<3||(this._val
98id=this.gestureBeginsVertically(o,s,a.timeStamp),!this._valid)?void 0:(this._lastPoints=i,this._active=!0,{pitchDelta:-((o.y+s.y)/2*.5)})}gestureBeginsVertically(e,i,r){if(void 0!==this._valid)return this._valid;let a=e.mag()>=2,n=i.mag()>=2;if(!a&&!n)return;if(!a||!n)return null==this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let o=e.y>0==i.y>0;return nR(e)&&nR(i)&&o}}let nO=100,nk=15,nF=10;class nB{constructor(){this._panStep=nO,this._bearingStep=nk,this._pitchStep=nF,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,r=0,a=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?a=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?a=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,a=0),{cameraAnimation:s=>{let l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:nN,zoom:i?Math.round(l)+i*(e.shiftKey?2:1):l,bearing:s.getBearing()+r*this._bearingStep,pitch:s.getPitch()+a*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function nN(e){return e*(2-e)}let nV=1/450;class nU{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._handler=r,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=nV,e.aQ(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(i.ctrlKey||i.metaKey||this.isZooming()||e.dC()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let r=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY,a=e.q.now(),n=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&4>Math.abs(r)?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=window.setTimeout(this._onTimeout,40,i)):this._type||(this._type=200>Math.abs(n*r)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),i.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=i,this._delta-=r,this._active||this._start(i)),i.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){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 i=v(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:i,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let i=this._map.transform;"wheel"===this._type&&i.projection.wrap&&(i._center.lng>=180||i._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);let r=()=>i._terrainEnabled()&&this._aroundCoord?i.computeZoomRelativeTo(this._aroundCoord):i.zoom;if(0!==this._delta){let e="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==a&&(a=1/a);let n=r(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(s*a))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}let a="number"==typeof this._targetZoom?this._targetZoom:r(),n=this._startZoom,o=this._easing,s,l=!1;if("wheel"===this._type&&n&&o){let i=Math.min((e.q.now()-this._lastWheelEventTime)/200,1),r=o(i);s=e.ah(n,a,r),i<1?this._frameId||(this._frameId=!0):l=!0}else s=a,l=!0;this._active=!0,l&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>
98{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let h=s-r();return h*this._lastDelta<0&&(h=0),{noInertia:!0,needsRenderFrame:!l,zoomDelta:h,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let r=e.dD;if(this._prevEase){let i=this._prevEase,a=(e.q.now()-i.start)/i.duration,n=i.easing(a+.01)-i.easing(a),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=e.dB(o,s,.25,1)}return this._prevEase={start:e.q.now(),duration:i,easing:r},r}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=d("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class nj{constructor(e,i){this._clickZoom=e,this._tapZoom=i}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 nG{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,i){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:r.getZoom()+(e.shiftKey?-1:1),around:r.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nq{constructor(){this._tap=new ny({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,i,r){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=i[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(e,i,r))}touchmove(e,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let a=i[0],n=a.y-this._swipePoint.y;return this._swipePoint=a,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,i,r)}touchend(e,i,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(e,i,r)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nZ{constructor(e,i,r){this._el=e,this._mousePan=i,this._touchPan=r}enable(e){this._inertiaOptions=e||{},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 nH{constructor(e,i,r){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class n${constructor(e,i,r,a){this._el=e,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let nW=e=>e.zoom||e.drag||e.pitch||e.rotate;class nX extends e.A{}class nY{constructor(){this.constants=[1,1,.01],this.radius=0}setup(i,r){let a=e.ad.vec3.sub([],r,i);this.radius=e.ad.vec3.length(a[2]<0?e.ad.vec3.div([],a,this.constants):[a[0],a[1],0])}projectRay(i){e.ad.vec3.div(i,i,this.constants),e.ad.vec3.normalize(i,i),e.ad.vec3.mul(i,i,this.constants);let r=e.ad.vec3.scale([],i,this.radius);if(r[2]>0){let i=e.ad.vec3.scale([],[0,0,1],e.ad.vec3.dot(r,[0,0,1])),a=e.ad.vec3.scale([],e.ad.vec3.normalize([],[r[0],r[1],0]),this.radius),n=e.ad.vec3.add([],r,e.ad.vec3.scale([],e.ad.vec3.sub([],e.ad.vec3.add([],a,i),r),2));r[0]=n[0],r[1]=n[1]}return r}}function nK(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class nJ{constructor(i,r){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ns(i),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new nY,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),e.aQ(["handleEvent","handleWindowEvent"],this);const a=this._el;for(const[e,i,r]of(this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]],this._listeners)){const a=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(i,a,r)}}destroy(){for(let[e,i,r]of this._listeners){let a=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(i,a,r)}}_addDefaultHandlers(e){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new np(i,e));let a=i.boxZoom=new nm(i,e);this._add("boxZoom",a);let n=new nx,o=new nG;i.doubleClickZoom=new nj(o,n),this._add("tapZoom",n),this._add("clickZoom",o);let s=new nq;this._add("tapDragZoom",s);let l=i.touchPitch=new nL(i);this._add("touchPitch",l);let h=new nS(e),u=new nM(e);i.dragRotate=new nH(e,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);let c=new nT(e),d=new nE(i,e);i.dragPan=new nZ(r,c,d),this._add("mousePan",c),this._add("touchPan",d,["touchZoom","touchRotate"]);let p=new nD,f=new nP;i.touchZoomRotate=new n$(r,f,p,s),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),this._add("blockableMapEvent",new nf(i));let m=i.scrollZoom=new nU(i,this);this._add("scrollZoom",m,["mousePan"]);let _=i.keyboard=new nB;for(let r of(this._add("keyboard",_),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))e.interactive&&e[r]&&i[r].enable(e[r])}_add(e,i,r){this._handlers.push({handlerName:e,handler:i,allowed:r}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!nW(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,i,r){for(let a in e)if(a!==r&&(!i||0>i.indexOf(a)))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let i=[];for(let r of e)this._el.contains(r.target)&&i.push(r);return i}handleEvent(e,i){this._updatingCamera=!0;let r="renderFrame"===e.type,a=r?void 0:e,n={needsRenderFrame:!1},o={},s={},l=e.touches?this._getMapTouches(e.touches):void 0,h=l?b(this._el,l):r?void 0:v(this._el,e);for(let{handlerName:r,handler:u,allowed:c}of this._handlers){let d;u.isEnabled()&&(this._blockedByActive(s,c,r)?u.reset():u[i||e.type]&&(d=u[i||e.type](e,h,l),this.mergeHandlerResult(n,o,d,r,a),d&&d.needsRenderFrame&&this._triggerRe
98nderFrame()),(d||u.isActive())&&(s[r]=u))}let u={};for(let e in this._previousActiveHandlers)s[e]||(u[e]=a);this._previousActiveHandlers=s,(Object.keys(u).length||nK(n))&&(this._changes.push([n,o,u]),this._triggerRenderFrame()),(Object.keys(s).length||nK(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))}mergeHandlerResult(i,r,a,n,o){if(!a)return;e.l(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 i={},r={},a={};for(let[n,o,s]of this._changes)n.panDelta&&(i.panDelta=(i.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(i.around=n.around),void 0!==n.aroundCoord&&(i.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(i.pinchAround=n.pinchAround),n.noInertia&&(i.noInertia=n.noInertia),e.l(r,o),e.l(a,s);this._updateMapTransform(i,r,a),this._changes=[]}_updateMapTransform(i,r,a){let n,o=this._map,s=o.transform,l=e=>[e.x,e.y,e.z];if((n=this._eventsInProgress.drag)&&!this._handlersById[n.handlerName].isActive()&&!nK(i)){let e=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"),e!==s.zoom&&this._map._update(!0)}if(s._isCameraConstrained&&o._stop(!0),!nK(i))return void this._fireEvents(r,a,!0);let{panDelta:h,zoomDelta:u,bearingDelta:c,pitchDelta:d,around:p,aroundCoord:f,pinchAround:m}=i;s._isCameraConstrained&&(u>0&&(u=0),s._isCameraConstrained=!1),void 0!==m&&(p=m),(u||r.drag&&!this._eventsInProgress.drag)&&p&&(this._dragOrigin=l(s.pointCoordinate3D(p)),this._originalZoom=s.zoom,this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",o._stop(!0),p=p||o.transform.centerPoint,c&&(s.bearing+=c),d&&(s.pitch+=d),s._updateCameraState();let _=[0,0,0];if(h)if("mercator"===s.projection.name){let e=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p).dir),i=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p.sub(h)).dir);_[0]=i[0]-e[0],_[1]=i[1]-e[1]}else{let i=s.pointCoordinate(p);if("globe"===s.projection.name){h=h.rotate(-s.angle);let r=s._pixelsPerMercatorPixel/s.worldSize;_[0]=-h.x*e.dE(e.aT(i.y))*r,_[1]=-h.y*e.dE(s.center.lat)*r}else{let e=s.pointCoordinate(p.sub(h));i&&e&&(_[0]=e.x-i.x,_[1]=e.y-i.y)}}let g=s.zoom,y=[0,0,0];if(u){let i=l(f||s.pointCoordinate3D(p)),r={dir:e.ad.vec3.normalize([],e.ad.vec3.sub([],i,s._camera.position))};if(r.dir[2]<0){let a=s.zoomDeltaToMovement(i,u);e.ad.vec3.scale(y,r.dir,a)}}let x=e.ad.vec3.add(_,_,y);s._translateCameraConstrained(x),u&&Math.abs(s.zoom-g)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(r,a,!0)}_fireEvents(i,r,a){let n,o=nW(this._eventsInProgress),s=nW(i),l={};for(let e in i){let{originalEvent:r}=i[e];this._eventsInProgress[e]||(l[`${e}start`]=r),this._eventsInProgress[e]=i[e]}for(let e in!o&&s&&this._fireEvent("movestart",s.originalEvent),l)this._fireEvent(e,l[e]);for(let e in s&&this._fireEvent("move",s.originalEvent),i){let{originalEvent:r}=i[e];this._fireEvent(e,r)}let h={};for(let e in this._eventsInProgress){let{handlerName:i,originalEvent:a}=this._eventsInProgress[e];this._handlersById[i].isActive()||(delete this._eventsInProgress[e],n=r[i]||a,h[`${e}end`]=n)}for(let e in h)this._fireEvent(e,h[e]);let u=nW(this._eventsInProgress);if(a&&(o||s)&&!u){this._updatingCamera=!0;let i=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;i?(r(i.bearing||this._map.getBearing())&&(i.bearing=0),this._map.easeTo(i,{originalEvent:n})):(this._map.fire(new e.A("moveend",{originalEvent:n})),r(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,r){this._map.fire(new e.A(i,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{this._frameId=void 0,this.handleEvent(new nX("renderFrame",{timeStamp:e})),this._applyChanges()})}
98_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let nQ="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class n0 extends e.E{constructor(i,r){super(),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=r.bearingSnap,this._respectPrefersReducedMotion=!1!==r.respectPrefersReducedMotion,e.aQ(["_renderFrameCallback"],this)}getCenter(){return new e.bO(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}panBy(i,r,a){return i=e.P.convert(i).mult(-1),this.panTo(this.transform.center,e.l({offset:i},r),a)}panTo(i,r,a){return this.easeTo(e.l({center:i},r),a)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(i,r,a){return this.easeTo(e.l({zoom:i},r),a)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(i,r,a){return this.easeTo(e.l({bearing:i},r),a)}resetNorth(i,r){return this.rotateTo(0,e.l({duration:1e3},i),r),this}resetNorthPitch(i,r){return this.easeTo(e.l({bearing:0,pitch:0,duration:1e3},i),r),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}cameraForBounds(i,r){i=e.aB.convert(i);let a=r&&r.bearing||0,n=r&&r.pitch||0,o=i.getNorthWest(),s=i.getSouthEast();return this._cameraForBounds(this.transform,o,s,a,n,r)}_extendPadding(i){let r={top:0,right:0,bottom:0,left:0};return null==i?e.l({},r,this.transform.padding):"number"==typeof i?{top:i,bottom:i,right:i,left:i}:e.l({},r,i)}_extendCameraOptions(i){return(i=e.l({offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding=this._extendPadding(i.padding),i}_minimumAABBFrustumDistance(e,i){let r=i.max[0]-i.min[0],a=i.max[1]-i.min[1];return r/a>e.aspect?r/(2*Math.tan(.5*e.fovX)*e.aspect):a/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(i,r,a,n,o,s){let l=i.clone(),h=this._extendCameraOptions(s);l.bearing=n,l.pitch=o;let u=e.bO.convert(r),c=e.bO.convert(a),d=.5*(u.lat+c.lat),p=.5*(u.lng+c.lng),f=e.dF(d,p),m=e.ad.vec3.normalize([],f),_=e.ad.vec3.normalize([],e.ad.vec3.cross([],m,[0,1,0])),g=e.ad.vec3.cross([],_,m),y=[_[0],_[1],_[2],0,g[0],g[1],g[2],0,m[0],m[1],m[2],0,0,0,0,1],x=[f,e.dF(u.lat,u.lng),e.dF(c.lat,u.lng),e.dF(c.lat,c.lng),e.dF(u.lat,c.lng),e.dF(d,u.lng),e.dF(d,c.lng),e.dF(u.lat,p),e.dF(c.lat,p)],v=e.ce.fromPoints(x.map(i=>[e.ad.vec3.dot(_,i),e.ad.vec3.dot(g,i),e.ad.vec3.dot(m,i)])),b=e.ad.vec3.transformMat4([],v.center,y);0===e.ad.vec3.squaredLength(b)&&e.ad.vec3.set(b,0,0,1),e.ad.vec3.normalize(b,b),e.ad.vec3.scale(b,b,e.az),l.center=e.dG(b);let w=l.getWorldToCameraMatrix(),T=e.ad.mat4.invert(new Float64Array(16),w);v=e.ce.applyTransform(v,e.ad.mat4.multiply([],w,y));let S=this._extendAABB(v,l,h,n);if(!S)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=S,e.ad.vec3.transformMat4(b,b,w);let M=.5*(v.max[2]-v.min[2]),E=this._minimumAABBFrustumDistance(l,v),A=e.ad.vec3.scale([],[0,0,1],M),I=e.ad.vec3.add(A,b,A),C=E+(0===l.pitch?0:e.ad.vec3.distance(b,I)),P=l.globeCenterInViewSpace,z=e.ad.vec3.sub([],b,[P[0],P[1],P[2]]);e.ad.vec3.normalize(z,z),e.ad.vec3.scale(z,z,C);let D=e.ad.vec3.add([],b,z);e.ad.vec3.transformMat4(D,D,T);let R=e.dv/e.az,L=e.ad.vec3.length(D),O=e.bH(Math.max(L*R-e.dv,Number.EPSILON),0),k=Math.min(l.zoomFromMercatorZAdjusted(O),h.maxZoom);return k>.5*(e.c6+e.bY)?(l.setProjection({name:"mercator"}),l.zoom=k,this._cameraForBounds(l,r,a,n,o,s)):{center:l.center,zoom:k,bearing:n,pitch:o}}_extendAABB(i,r,a,n){let o=.5*((a.padding.left||0)+(a.padding.right||0)),s=.5*((a.padding.top||0)+(a.padding.bottom||0)),l=r.width-(o+o),h=r.height-(s+s),u=e.ad.vec3.sub([],i.max,i.min),c=Math.min(l/u[0],h/u[1]),d=Math.min(r.scaleZoom(r.scale*c),a.maxZoom);if(isNaN(d))return null;let p=r.scale/r.zoomScale(d),f=new e.ce([i.min[0]-o*p,i.min[1]-s*p,i.min[2]],[i.max[0]+o*p,i.max[1]+s*p,i.max[2]]),m=("number"==typeof a.offset.x&&"number"==typeof a.offset.y?new e.P(a.offset.x,a.offset.y):e.P.convert(a.offset)).rotate(-e.ak(n));return f.center[0]-=m.x*p,f.center[1]+=m.y*p,f}queryTerrainElevation(i,r){let a=this.transform.elevation;return a?(r=e.l({},{exaggerated:!0},r),a.getAtPoint(e.ac.fromLngLat(i),null,r.exaggerated)):null}
98_cameraForBounds(i,r,a,n,o,s){if("globe"===i.projection.name)return this._cameraForBoundsOnGlobe(i,r,a,n,o,s);let l=i.clone(),h=this._extendCameraOptions(s);l.bearing=n,l.pitch=o;let u=e.bO.convert(r),c=e.bO.convert(a),d=new e.bO(u.lng,c.lat),p=new e.bO(c.lng,u.lat),f=l.project(u),m=l.project(c),_=this.queryTerrainElevation(u),g=this.queryTerrainElevation(c),y=this.queryTerrainElevation(d),x=this.queryTerrainElevation(p),v=[[f.x,f.y,Math.min(_||0,g||0,y||0,x||0)],[m.x,m.y,Math.max(_||0,g||0,y||0,x||0)]],b=e.ce.fromPoints(v),w=l.getWorldToCameraMatrix(),T=e.ad.mat4.invert(new Float64Array(16),w);b=e.ce.applyTransform(b,w);let S=this._extendAABB(b,l,h,n);if(!S)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");b=S;let M=.5*e.ad.vec3.sub([],b.max,b.min)[2],E=this._minimumAABBFrustumDistance(l,b),A=[0,0,1,0];e.ad.vec4.transformMat4(A,A,w),e.ad.vec4.normalize(A,A);let I=e.ad.vec3.scale([],A,E+M),C=e.ad.vec3.add([],b.center,I);e.ad.vec3.transformMat4(b.center,b.center,T),e.ad.vec3.transformMat4(C,C,T);let P=l.unproject(new e.P(b.center[0],b.center[1])),z=Math.pow(2,e.dH(l.projection,P)),D=Math.min(l._zoomFromMercatorZ(C[2]*l.pixelsPerMeter*z/l.worldSize),h.maxZoom);return l.mercatorFromTransition&&D<.5*(e.c6+e.bY)?(l.setProjection({name:"globe"}),l.zoom=D,this._cameraForBounds(l,r,a,n,o,s)):{center:P,zoom:D,bearing:n,pitch:o}}fitBounds(e,i,r){let a=this.cameraForBounds(e,i);return this._fitInternal(a,i,r)}fitScreenCoordinates(i,r,a,n,o){let s=e.P.convert(i),l=e.P.convert(r),h=new e.P(Math.min(s.x,l.x),Math.min(s.y,l.y)),u=new e.P(Math.max(s.x,l.x),Math.max(s.y,l.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,l))return this;let c=this.transform.pointLocation3D(h),d=this.transform.pointLocation3D(u),p=this.transform.pointLocation3D(new e.P(h.x,u.y)),f=this.transform.pointLocation3D(new e.P(u.x,h.y)),m=[Math.min(c.lng,d.lng,p.lng,f.lng),Math.min(c.lat,d.lat,p.lat,f.lat)],_=[Math.max(c.lng,d.lng,p.lng,f.lng),Math.max(c.lat,d.lat,p.lat,f.lat)],g=n&&n.pitch?n.pitch:this.getPitch(),y=this._cameraForBounds(this.transform,m,_,a,g,n);return this._fitInternal(y,n,o)}_fitInternal(i,r,a){return i?(r=e.l(i,r)).linear?this.easeTo(r,a):this.flyTo(r,a):this}jumpTo(i,r){this.stop();let a=i.preloadOnly?this.transform.clone():this.transform,n=!1,o=!1,s=!1;"zoom"in i&&a.zoom!==+i.zoom&&(n=!0,a.zoom=+i.zoom),void 0!==i.center&&(a.center=e.bO.convert(i.center)),"bearing"in i&&a.bearing!==+i.bearing&&(o=!0,a.bearing=+i.bearing),"pitch"in i&&a.pitch!==+i.pitch&&(s=!0,a.pitch=+i.pitch);let l="number"==typeof i.padding?this._extendPadding(i.padding):i.padding;if(null!=i.padding&&!a.isPaddingEqual(l))if(!1===i.retainPadding){let e=a.clone();e.padding=l,a.setLocationAtPoint(a.center,e.centerPoint)}else a.padding=l;return i.preloadOnly?(this._preloadTiles(a),this):(this.fire(new e.A("movestart",r)).fire(new e.A("move",r)),n&&this.fire(new e.A("zoomstart",r)).fire(new e.A("zoom",r)).fire(new e.A("zoomend",r)),o&&this.fire(new e.A("rotatestart",r)).fire(new e.A("rotate",r)).fire(new e.A("rotateend",r)),s&&this.fire(new e.A("pitchstart",r)).fire(new e.A("pitch",r)).fire(new e.A("pitchend",r)),this.fire(new e.A("moveend",r)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(nQ),this.transform.getFreeCameraOptions()}setFreeCameraOptions(i,r){let a=this.transform;if(!a.projection.supportsFreeCamera)return e.w(nQ),this;this.stop();let n=a.zoom,o=a.pitch,s=a.bearing;a.setFreeCameraOptions(i);let l=n!==a.zoom,h=o!==a.pitch,u=s!==a.bearing;return this.fire(new e.A("movestart",r)).fire(new e.A("move",r)),l&&this.fire(new e.A("zoomstart",r)).fire(new e.A("zoom",r)).fire(new e.A("zoomend",r)),u&&this.fire(new e.A("rotatestart",r)).fire(new e.A("rotate",r)).fire(new e.A("rotateend",r)),h&&this.fire(new e.A("pitchstart",r)).fire(new e.A("pitch",r)).fire(new e.A("pitchend",r)),this.fire(new e.A("moveend",r)),this}easeTo(i,r){let a,n,o,s,l;this._stop(!1,i.easeId),(!1===(i=e.l({offset:[0,0],duration:500,easing:e.dD},i)).animate||this._prefersReducedMotion(i))&&(i.duration=0);let h=this.transform,u=this.getZoom(),c=this.getBearing(),d=this.getPitch(),p=this.getPadding(),f="zoom"in i?+i.zoom:u,m="bearing"in i?this._normalizeBearing(i.bearing,c):c,_="pitch"in i?+i.pitch:d,g=this._extendPadding(i.padding),y=e.P.convert(i.offset);if("globe"===h.projection.name){let r=e.ac.fromLngLat(h.center),s=y.rotate(-h.angle);r.x+=s.x/h.worldSize,r.y+=s.y/h.worldSize;let l=r.toLngLat(),u=e.bO.convert(i.center||l);this._normalizeCenter(u),a=h.centerPoint.add(s),n=new e.P(r.x,r.y).mult(h.worldSize),o=new e.P(e.av(u.lng),e.aC(u.lat)).mult(h.worldSize).sub(n)}else{a=h.centerPoint.add(y);let r=h.pointLocation(a),s=e.bO.convert(i.center||r);this._normalizeCenter(s),n=h.project(r),o=h.project(s).sub(n)}let x=h.zoomScale(f-u);i.around&&(s=e.bO.convert(i.around),l=h.locationPoint(s));let v=this._zooming||f!==u,b=this._rotating||c!==m,w=this._pitching||_!==d,T=!h.isPaddingEqual(g),S=!1===i.retainPadding?h.clone():h,M=h=>M=>{if(v&&(h.zoom=e.ah(u,f,M)),b&&(h.bearing=e.ah(c,m,M)),w&&(h.pitch=e.ah(d,_,M)),T&&(S.interpolatePadding(p,g,M),a=S.centerPoint.add(y)),s)h.setLocationAtPoint(s,l);else{let e=h.zoomScale(h.zoom-u),i=Math.pow(f>u?Math.min(2,x):Math.max(.5,x),1-M),r=h.unproject(n.add(o.mult(M*i)).mult(e));h.setLocationAtPoint(h.renderWorldCopies?r.wrap():r,a)}return i.preloadOnly||this._fireMoveEvents(r),h};if(i.preloadOnly){let e=this._emulate(M,i.duration,h);return this._preloadTiles(e),this}let E={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=v,this._rotating=b,this._pitching=w,this._padding=T,this._easeId=i.easeId,this._prepareEase(r,i.noMoveStart,E),this._ease(M(h),e=>{"sea"===h.cameraElevationReference&&h.recenterOnTerrain(),this._afterEase(r,e)},i),this}_prepareEase(i,r,a={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),r||a.mov
98ing||this.fire(new e.A("movestart",i)),this._zooming&&!a.zooming&&this.fire(new e.A("zoomstart",i)),this._rotating&&!a.rotating&&this.fire(new e.A("rotatestart",i)),this._pitching&&!a.pitching&&this.fire(new e.A("pitchstart",i))}_fireMoveEvents(i){this.fire(new e.A("move",i)),this._zooming&&this.fire(new e.A("zoom",i)),this._rotating&&this.fire(new e.A("rotate",i)),this._pitching&&this.fire(new e.A("pitch",i))}_afterEase(i,r){if(this._easeId&&r&&this._easeId===r)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let a=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new e.A("zoomend",i)),n&&this.fire(new e.A("rotateend",i)),o&&this.fire(new e.A("pitchend",i)),this.fire(new e.A("moveend",i))}flyTo(i,r){if(this._prefersReducedMotion(i)){let a=e.aA(i,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(a,r)}this.stop(),i=e.l({offset:[0,0],speed:1.2,curve:1.42,easing:e.dD},i);let a=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),l=this.getPadding(),h="zoom"in i?e.ay(+i.zoom,a.minZoom,a.maxZoom):n,u="bearing"in i?this._normalizeBearing(i.bearing,o):o,c="pitch"in i?+i.pitch:s,d=this._extendPadding(i.padding),p=a.zoomScale(h-n),f=e.P.convert(i.offset),m=a.centerPoint.add(f),_=a.pointLocation(m),g=e.bO.convert(i.center||_);this._normalizeCenter(g);let y=a.project(_),x=a.project(g).sub(y),v=i.curve,b=Math.max(a.width,a.height),w=b/p,T=x.mag();if("minZoom"in i){let r=e.ay(Math.min(i.minZoom,n,h),a.minZoom,a.maxZoom);v=Math.sqrt(b/a.zoomScale(r-n)/T*2)}let S=v*v;function M(e){let i=(w*w-b*b+(e?-1:1)*S*S*T*T)/(2*(e?w:b)*S*T);return Math.log(Math.sqrt(i*i+1)-i)}function E(e){return(Math.exp(e)-Math.exp(-e))/2}function A(e){return(Math.exp(e)+Math.exp(-e))/2}let I=M(0),C=function(e){return A(I)/A(I+v*e)},P=function(e){var i;return b*((A(I)*(E(i=I+v*e)/A(i))-E(I))/S)/T},z=(M(1)-I)/v;if(1e-6>Math.abs(T)||!isFinite(z)){if(1e-6>Math.abs(b-w))return this.easeTo(i,r);let e=w<b?-1:1;z=Math.abs(Math.log(w/b))/v,P=function(){return 0},C=function(i){return Math.exp(e*v*i)}}i.duration="duration"in i?+i.duration:1e3*z/("screenSpeed"in i?i.screenSpeed/v:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0);let D=o!==u,R=c!==s,L=!a.isPaddingEqual(d),O=!1===i.retainPadding?a.clone():a,k=a=>p=>{let _=p*z,v=1/C(_);a.zoom=1===p?h:n+a.scaleZoom(v),D&&(a.bearing=e.ah(o,u,p)),R&&(a.pitch=e.ah(s,c,p)),L&&(O.interpolatePadding(l,d,p),m=O.centerPoint.add(f));let b=1===p?g:a.unproject(y.add(x.mult(P(_))).mult(v));return a.setLocationAtPoint(a.renderWorldCopies?b.wrap():b,m),a._updateCameraOnTerrain(),i.preloadOnly||this._fireMoveEvents(r),a};if(i.preloadOnly){let e=this._emulate(k,i.duration,a);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=D,this._pitching=R,this._padding=L,this._prepareEase(r,!1),this._ease(k(a),()=>this._afterEase(r),i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,i)}if(!e){let e=this.handlers;e&&e.stop(!1)}return this}_ease(i,r,a){!1===a.animate||0===a.duration?(i(1),r()):(this._easeStart=e.q.now(),this._easeOptions=a,this._onEaseFrame=i,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let i=Math.min((e.q.now()-this._easeStart)/this._easeOptions.duration,1),r=this._onEaseFrame;r&&r(this._easeOptions.easing(i)),i<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(i,r){let a=Math.abs((i=e.bF(i,-180,180))-r);return Math.abs(i-360-r)<a&&(i-=360),Math.abs(i+360-r)<a&&(i+=360),i}_normalizeCenter(e){let i=this.transform;if(i.maxBounds||"globe"!==i.projection.name&&!i.renderWorldCopies)return;let r=e.lng-i.center.lng;e.lng+=r>180?-360:360*(r<-180)}_prefersReducedMotion(i){return this._respectPrefersReducedMotion&&e.q.prefersReducedMotion&&!(i&&i.essential)}_emulate(e,i,r){let a=Math.ceil(15*i/1e3),n=[],o=e(r.clone());for(let e=0;e<=a;e++){let i=o(e/a);n.push(i.clone())}return n}_preloadTiles(e,i){}}class n1{constructor(i={}){this.options=i,e.aQ(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){let i=this.options&&this.options.compact,r=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=d("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=d("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",r);let a=d("span","mapboxgl-ctrl-icon",this._compactButton);return a.setAttribute("aria-hidden","true"),a.setAttribute("title",r),this._innerContainer=d("div","mapboxgl-ctrl-attrib-inner",this._container),i&&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===i&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
98se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let i=this._editLink;i||(i=this._editLink=this._container.querySelector(".mapbox-improve-map"));let r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.e.ACCESS_TOKEN}];if(i){let a=r.reduce((e,i,a)=>(i.value&&(e+=`${i.key}=${i.value}${a<r.length-1?"&":""}`),e),"?");i.href=`${e.e.FEEDBACK_URL}/${a}#${nt(this._map,!0)}`,i.rel="noopener nofollow"}}_updateData(e){e&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType||"style"===e.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let i=this._map.style._mergedSourceCaches;for(let r in i){let a=i[r];if(a.used){let i=a.getSource();i.attribution&&0>e.indexOf(i.attribution)&&e.push(i.attribution)}}e.sort((e,i)=>e.length-i.length),e=e.filter((i,r)=>{for(let a=r+1;a<e.length;a++)if(e[a].indexOf(i)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=r,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 n2{constructor(){e.aQ(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=d("div","mapboxgl-ctrl");let i=d("a","mapboxgl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://www.mapbox.com/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),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(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(let i in e){let r=e[i].getSource();if(r.hasOwnProperty("mapbox_logo")&&!r.mapbox_logo)return!1}return!0}_updateCompact(){let e=this._container.children;if(e.length){let i=e[0];this._map.getCanvasContainer().offsetWidth<250?i.classList.add("mapboxgl-compact"):i.classList.remove("mapboxgl-compact")}}}class n3{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){let i=this._currentlyRunning;for(let r of i?this._queue.concat(i):this._queue)if(r.id===e)return void(r.cancelled=!0)}run(e=0){let i=this._currentlyRunning=this._queue;for(let r of(this._queue=[],i))if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class n4{constructor(e){this.jumpTo(e)}getValue(i){if(i<=this._startTime)return this._start;if(i>=this._endTime)return this._end;let r=e.cC((i-this._startTime)/(this._endTime-this._startTime));return this._start*(1-r)+this._end*r}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,i,r){this._start=this.getValue(i),this._end=e,this._startTime=i,this._endTime=i+r}}let n5={"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 n6 extends e.A{constructor(e,i,r,a){const{point:n,lngLat:o,originalEvent:s,target:l}=e;super(e.type,{point:n,lngLat:o,originalEvent:s,target:l}),this.preventDefault=()=>{e.preventDefault()},this.id=i,this.interaction=r,this.feature=a}}class n8{constructor(e){this.map=e,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}
98add(i,r){if(this.typeById.has(i))throw Error(`Interaction id "${i}" already exists.`);let a=r.filter,n=r.type;a&&this.filters.set(i,e.a_(a)),"mouseover"===n&&(n="mouseenter"),"mouseout"===n&&(n="mouseleave");let o=this.interactionsByType.get(n)||new Map;"mouseenter"===n||"mouseleave"===n?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(i,r)):0===o.size&&this.map.on(n,this.handleType),0===o.size&&this.interactionsByType.set(n,o),o.set(i,r),this.typeById.set(i,n)}get(e){let i=this.typeById.get(e);if(!i)return;let r=this.interactionsByType.get(i);return r?r.get(e):void 0}remove(e){let i=this.typeById.get(e);if(!i)return;this.typeById.delete(e),this.filters.delete(e);let r=this.interactionsByType.get(i);r&&(r.delete(e),"mouseenter"===i||"mouseleave"===i?(this.delegatedInteractions.delete(e),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===r.size&&this.map.off(i,this.handleType))}queryTargets(e,i){let r=[];for(let[e,a]of i)a.target&&r.push({targetId:e,target:a.target,filter:this.filters.get(e)});return this.map.style.queryRenderedTargets(e,r,this.map.transform)}handleMove(e){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;let i=this.queryTargets(e.point,Array.from(this.delegatedInteractions).reverse());i.length&&(e.type="mouseenter",this.handleType(e,i));let r=new Map;for(let[e,{feature:i}]of this.prevHoveredFeatures)this.hoveredFeatures.has(e)||r.set(i.id,i);r.size&&(e.type="mouseleave",this.handleType(e,Array.from(r.values())
98))}handleOut(e){let i=Array.from(this.hoveredFeatures.values()).map(({feature:e})=>e);i.length&&(e.type="mouseleave",this.handleType(e,i)),this.hoveredFeatures.clear()}handleType(i,r){let a=Array.from(this.interactionsByType.get(i.type)).reverse(),n=!!r;r=r||this.queryTargets(i.point,a);let o="mouseenter"===i.type,s=!1,l=new Set;for(let h of r){for(let[r,u]of a){if(!u.target)continue;let a=h.variants?h.variants[r]:null;if(a){for(let c of a){if(e0(c,h,l,r))continue;let a=new e.cx(h,c),d=eQ(c,h,r);n&&(a.state=this.map.getFeatureState(a));let p=o?this.prevHoveredFeatures.get(d):null,f=new n6(i,r,u,a),m=p?p.stop:u.handler(f);if(o&&this.hoveredFeatures.set(d,{feature:h,stop:m}),!1!==m){s=!0;break}}if(s)break}}if(s)break}if(!s)for(let[e,r]of a){let{handler:a,target:n}=r;if(!n&&!1!==a(new n6(i,e,r,null)))break}}}let n9={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},n7={showCompass:!0,showZoom:!0,visualizePitch:!1};class oe{constructor(i,r,a=!1){this._clickTolerance=10,this.element=r,this.mouseRotate=new nS({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,a&&(this.mousePitch=new nM({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),e.aQ(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchmove",this.touchmove),r.addEventListener("touchend",this.touchend),r.addEventListener("touchcancel",this.reset)}down(e,i){this.mouseRotate.mousedown(e,i),this.mousePitch&&this.mousePitch.mousedown(e,i),_()}move(e,i){let r=this.map,a=this.mouseRotate.mousemoveWindow(e,i),n=a&&a.bearingDelta;if(n&&r.setBearing(r.getBearing()+n),this.mousePitch){let a=this.mousePitch.mousemoveWindow(e,i),n=a&&a.pitchDelta;n&&r.setPitch(r.getPitch()+n)}}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){g(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(e.l({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),v(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,v(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=b(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=b(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.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 ot(i,r,a){if(i=new e.bO(i.lng,i.lat),r){let n=new e.bO(i.lng-360,i.lat),o=new e.bO(i.lng+360,i.lat),s=360*Math.ceil(Math.abs(i.lng-a.center.lng)/360),l=a.locationPoint3D(i).distSqr(r),h=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint3D(n).distSqr(r)<l&&(h||Math.abs(n.lng-a.center.lng)<s)?i=n:a.locationPoint3D(o).distSqr(r)<l&&(h||Math.abs(o.lng-a.center.lng)<s)&&(i=o)}for(;Math.abs(i.lng-a.center.lng)>180;){let e=a.locationPoint3D(i);if(e.x>=0&&e.y>=0&&e.x<=a.width&&e.y<=a.height)break;
98i.lng>a.center.lng?i.lng-=360:i.lng+=360}return i}let oi={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%)"},or={anchor:"center",color:"#3FB1CE",scale:1,draggable:!1,clickTolerance:0,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class oa extends e.E{constructor(i,r){super(),(i instanceof HTMLElement||r)&&(i=e.l({element:i},r)),e.aQ(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),i=e.l({},or,i),this._anchor=i.anchor,this._color=i.color,this._scale=i.scale,this._draggable=i.draggable,this._clickTolerance=i.clickTolerance,this._rotation=i.rotation,this._rotationAlignment=i.rotationAlignment,this._pitchAlignment=i.pitchAlignment,this._occludedOpacity=i.occludedOpacity,this._altitude=i.altitude,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),i&&i.element?(this._element=i.element,this._offset=e.P.convert(i&&i.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=e.P.convert(i&&i.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()});const a=this._element.classList;for(const e in oi)a.remove(`mapboxgl-marker-anchor-${e}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`);const n=i&&i.className?i.className.trim().split(/\s+/):[];a.add(...n),this._popup=null}_createDefaultMarker(){let e=d("div"),i=p("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},e);if(0===this._altitude){let e=p("radialGradient",{id:"shadowGradient"},p("defs",{},i));p("stop",{offset:"10%","stop-opacity":.4},e),p("stop",{offset:"100%","stop-opacity":.05},e),p("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},i)}return p("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"},i),p("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"},i),p("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},i),e}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){let e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=e.bO.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(e){return e===this._altitude||(this._defaultMarker&&(0===this._altitude&&0!==e||0!==this._altitude&&0===e)&&(this._element=this._createDefaultMarker()),this._altitude=e||or.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(e){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")),e){if(!("offset"in e.options)){let i=Math.sqrt(91.125);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
980,-38.1],"bottom-left":[i,-1*(24.6+i)],"bottom-right":[-i,-1*(24.6+i)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,e._marker=this,e._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(e){let i=e.code,r=e.charCode||e.keyCode;"Space"!==i&&"Enter"!==i&&32!==r&&13!==r||this.togglePopup()}_onMapClick(e){let i=e.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e&&(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_behindTerrain(){let e=this._map,i=this._pos;if(!e||!i)return!1;let r=e.unproject(i,this._altitude),a=e.getFreeCameraOptions();if(!a.position)return!1;let n=a.position.toLngLat();return n.distanceTo(r)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){let i,r=this._map;if(!r)return;let a=this._pos;if(!a||a.x<0||a.x>r.transform.width||a.y<0||a.y>r.transform.height)return void this._clearFadeTimer();let n=r.unproject(a,this._altitude);r._showingGlobe()&&e.dK(r.transform,this._lngLat)?i=0:(i=1-r._queryFogOpacity(n),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(i*=this._occludedOpacity)),this._element.style.opacity=`${i}`,this._element.style.pointerEvents=i>0?"auto":"none",this._popup&&this._popup._setOpacity(i),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let e=this._pos;if(!e||!this._map)return;let i=this._offset.mult(this._scale);this._element.style.transform=` 99 translate(${e.x}px,${e.y}px) 100 ${oi[this._anchor]} 101 ${this._calculateXYTransform()} ${this._calculateZTransform()} 102 translate(${i.x}px,${i.y}px) 103 `}_calculateXYTransform(){let i=this._pos,r=this._map,a=this.getPitchAlignment();if(!r||!i||"map"!==a)return"";if(!r._showingGlobe()){let e=r.getPitch();return e?`rotateX(${e}deg)`:""}let n=e.c4(e.dL(r.transform,this._lngLat)),o=i.sub(e.dM(r.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";let l=n/s;return`rotateX(${-o.y*l}deg) rotateY(${o.x*l}deg)`}_calculateZTransform(){let i=this._pos,r=this._map;if(!r||!i)return"";let a=0,n=this.getRotationAlignment();if("map"===n)if(r._showingGlobe()){let i=r.project(new e.bO(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),n=r.project(new e.bO(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(i);a=e.c4(Math.atan2(n.y,n.x))-90}else a=-r.getBearing();else if("horizon"===n){let n=e.ae(4,6,r.getZoom()),o=e.dM(r.transform);o.y+=n*r.transform.height;let s=i.sub(o),l=e.c4(Math.atan2(s.y,s.x));a=(l>90?l-270:l+90)*(1-n)}return(a+=this._rotation)?`rotateZ(${a}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);let i=this._map;
103i&&(i.transform.renderWorldCopies&&(this._lngLat=ot(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat,this._altitude),!0===e?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),i._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(i._showingGlobe()||i.getTerrain()||i.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(i){return this._offset=e.P.convert(i),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(i){let r=this._map;if(!r)return;let a=this._pointerdownPos,n=this._positionDelta;if(a&&n){if(!this._isDragging){let e=this._clickTolerance||r._clickTolerance;if(i.point.dist(a)<e)return;this._isDragging=!0}this._pos=i.point.sub(n),this._lngLat=r.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.A("dragstart"))),this.fire(new e.A("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let i=this._map;i&&(i.off("mousemove",this._onMove),i.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.A("dragend")),this._state="inactive"}_addDragHandler(e){let i=this._map,r=this._pos;i&&r&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(r),this._pointerdownPos=e.point,this._state="pending",i.on("mousemove",this._onMove),i.on("touchmove",this._onMove),i.once("mouseup",this._onUp),i.once("touchend",this._onUp))}setDraggable(e){this._draggable=!!e;let i=this._map;return i&&(e?(i.on("mousedown",this._addDragHandler),i.on("touchstart",this._addDragHandler)):(i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||or.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||or.rotationAlignment,this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||or.pitchAlignment,this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||or.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let on={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},oo={maxWidth:100,unit:"metric"},os={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},ol={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0};function oh(i=new e.P(0,0),r="bottom"){if("number"==typeof i){let a=Math.round(Math.sqrt(.5*Math.pow(i,2)));switch(r){case"top":return new e.P(0,i);case"top-left":return new e.P(a,a);case"top-right":return new e.P(-a,a);case"bottom":return new e.P(0,-i);case"bottom-left":return new e.P(a,-a);case"bottom-right":return new e.P(-a,-a);case"left":return new e.P(i,0);case"right":return new e.P(-i,0)}return new e.P(0,0)}return i instanceof e.P||Array.isArray(i)?e.P.convert(i):e.P.convert(i[r]||[0,0])}return{version:n,supported:c.supported,setRTLTextPlugin:e.dN,getRTLTextPluginStatus:e.dO,Map:class extends n0{constructor(i){s.mark(o.create);const r=i;if(null!=(i=e.l({},n9,i)).minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=i.minPitch&&i.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=i.maxPitch&&i.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(i.antialias&&e.dI(window)&&(i.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new ie(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies,null,null),i),this._repaint=!!i.repaint,this._interactive=i.interactive,this._minTileCacheSize=i.minTileCacheSize,this._maxTileC
103acheSize=i.maxTileCacheSize,this._failIfMajorPerformanceCaveat=i.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=i.preserveDrawingBuffer,this._antialias=i.antialias,this._trackResize=i.trackResize,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=i.crossSourceCollisions,this._collectResourceTiming=i.collectResourceTiming,this._language=this._parseLanguage(i.language),this._worldview=i.worldview,this._renderTaskQueue=new n3,this._domRenderTaskQueue=new n3,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aW(),this._locale=e.l({},n5,i.locale),this._clickTolerance=i.clickTolerance,this._cooperativeGestures=i.cooperativeGestures,this._performanceMetricsCollection=i.performanceMetricsCollection,this._tessellationStep=i.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=i.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new n4(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=i.scaleFactor,this._requestManager=new M(i.transformRequest,i.accessToken,i.testMode),this._silenceAuthErrors=!!i.testMode,this._contextCreateOptions=i.contextCreateOptions?Object.assign({},i.contextCreateOptions):{},"string"==typeof i.container){const e=document.getElementById(i.container);if(!e)throw Error(`Container '${i.container.toString()}' not found.`);this._container=e}else{if(!(i.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(this._container.childNodes.length>0&&e.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."),i.maxBounds&&this.setMaxBounds(i.maxBounds),this._spriteFormat=i.spriteFormat,e.aQ(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new a$),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),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 nJ(this,i),this._localFontFamily=i.localFontFamily,this._localIdeographFontFamily=i.localIdeographFontFamily,(i.style||!i.testMode)&&this.setStyle(i.style||e.e.DEFAULT_STYLE,{config:i.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),i.projection&&this.setProjection(i.projection),this.indoor=new im(this),i.hash&&(this._hash=new ne("string"==typeof i.hash&&i.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==r.center&&null==r.zoom||(this.transform._unmodified=!1),this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch});const a=i.bounds;a&&(this.resize(),this.fitBounds(a,e.l({},i.fitBoundsOptions,{duration:0})))}this.resize(),i.attributionControl&&this.addControl(new n1({customAttribution:i.customAttribution}
103)),this._logoControl=new n2,this.addControl(this._logoControl,i.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",i=>{this._update("style"===i.dataType),this.fire(new e.A(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new e.A(`${i.dataType}dataloading`,i))}),this._interactions=new n8(this)}_getMapId(){return this._mapId}addControl(i,r){if(void 0===r&&(r=i.getDefaultPosition?i.getDefaultPosition():"top-right"),!i||!i.onAdd)return this.fire(new e.z(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let a=i.onAdd(this);this._controls.push(i);let n=this._controlPositions[r];return -1!==r.indexOf("bottom")?n.insertBefore(a,n.firstChild):n.appendChild(a),this}removeControl(i){if(!i||!i.onRemove)return this.fire(new e.z(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(i);return r>-1&&this._controls.splice(r,1),i.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(i){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 r=!this._moving;return r&&this.fire(new e.A("movestart",i)).fire(new e.A("move",i)),this.fire(new e.A("resize",i)),r&&this.fire(new e.A("moveend",i)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(i){return this.transform.setMaxBounds(e.aB.convert(i)),this._update()}setMinZoom(i){if((i=i??-2)>=-2&&i<=this.transform.maxZoom)return this.transform.minZoom=i,this._update(),this.getZoom()<i?this.setZoom(i):this.fire(new e.A("zoomstart")).fire(new e.A("zoom")).fire(new e.A("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(i){if((i=i??22)>=this.transform.minZoom)return this.transform.maxZoom=i,this._update(),this.getZoom()>i?this.setZoom(i):this.fire(new e.A("zoomstart")).fire(new e.A("zoom")).fire(new e.A("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(i){if((i=i??0)<0)throw Error("minPitch must be greater than or equal to 0");if(i>=0&&i<=this.transform.maxPitch)return this.transform.minPitch=i,this._update(),this.getPitch()<i?this.setPitch(i):this.fire(new e.A("pitchstart")).fire(new e.A("pitch")).fire(new e.A("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(i){if((i=i??85)>85)throw Error("maxPitch must be less than or equal to 85");if(i>=this.transform.minPitch)return this.transform.maxPitch=i,this._update(),this.getPitch()>i?this.setPitch(i):this.fire(new e.A("pitchstart")).fire(new e.A("pitch")).fire(new e.A("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(e=>"symbol"===e.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map(e=>"auto"===e?navigator.language:e):e}setLanguage(e){let i=this._parseLanguage(e);if(!this.style||i===this._language)return this;for(let e of(this._language=i,this.style.reloadSources(),this._controls))e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview&&(this._worldview=e,this.style.reloadSources()),this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){let i;if("globe"!==this.getProjection().name)return;let r=this.transform,a=r.projection.name;"globe"===a&&r.zoom>=e.bY?(r.setMercatorFromTransition(),i=!0):"mercator"===a&&r.zoom<e.bY&&(r.setProjection({name:"globe"}),i=!0),i&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
103Update())}_prioritizeAndUpdateProjection(e,i){return this._updateProjection(e||i||{name:"mercator"})}_updateProjection(i){let r;return r="globe"===i.name&&this.transform.zoom>=e.bY?this.transform.setMercatorFromTransition():this.transform.setProjection(i),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(i,r){return this.transform.locationPoint3D(e.bO.convert(i),r)}unproject(i,r){return this.transform.pointLocation3D(e.P.convert(i),r)}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(e,i,r){let a=e=>{let r=[];if(Array.isArray(i)){let a=i.filter(e=>this.getLayer(e));r=a.length?this.queryRenderedFeatures(e,{layers:a}):[]}else r=this.queryRenderedFeatures(e,{target:i});return r};if("mouseenter"===e||"mouseover"===e){let n=!1,o=i=>{let o=a(i.point);o.length?n||(n=!0,r.call(this,new nu(e,this,i.originalEvent,{features:o}))):n=!1};return{listener:r,targets:i,delegates:{mousemove:o,mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1,o=i=>{a(i.point).length?n=!0:n&&(n=!1,r.call(this,new nu(e,this,i.originalEvent)))},s=i=>{n&&(n=!1,r.call(this,new nu(e,this,i.originalEvent)))};return{listener:r,targets:i,delegates:{mousemove:o,mouseout:s}}}{let n=e=>{let i=a(e.point);i.length&&(e.features=i,r.call(this,e),delete e.features)};return{listener:r,targets:i,delegates:{[e]:n}}}}on(e,i,r){if("function"==typeof i||void 0===r)return super.on(e,i);if("string"==typeof i&&(i=[i]),!this._areTargetsValid(i))return this;let a=this._createDelegatedListener(e,i,r);for(let i in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(a),a.delegates)this.on(i,a.delegates[i]);return this}once(e,i,r){if("function"==typeof i||void 0===r)return super.once(e,i);if("string"==typeof i&&(i=[i]),!this._areTargetsValid(i))return this;let a=this._createDelegatedListener(e,i,r);for(let e in a.delegates)this.once(e,a.delegates[e]);return this}off(i,r,a){if("function"==typeof r||void 0===a)return super.off(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._delegatedListeners?this._delegatedListeners[i]:void 0;return n&&(i=>{for(let n=0;n<i.length;n++){let o=i[n];if(o.listener===a&&function(i,r){if(Array.isArray(i)&&Array.isArray(r)){let e=new Set(i),a=new Set(r);return e.size===a.size&&i.every(e=>a.has(e))}return e.bn(i,r)}(o.targets,r)){for(let e in o.delegates)this.off(e,o.delegates[e]);return i.splice(n,1),this}}})(n),this}queryRenderedFeatures(i,r){if(!this.style)return[];if(void 0===i||i instanceof e.P||Array.isArray(i)||void 0!==r||(r=i,i=void 0),i=i||[[0,0],[this.transform.width,this.transform.height]],!r){let e=this.style.queryRenderedFeatures(i,void 0,this.transform),r=this.style.queryRenderedFeatureset(i,void 0,this.transform);return e.concat(r)}let a=!0;if(r.target&&(a=this._isTargetValid(r.target))&&!r.layers)return this.style.queryRenderedFeatureset(i,r,this.transform);let n=!0;if(r.layers&&Array.isArray(r.layers)){for(let e of r.layers)if(!this._isValidId(e)){n=!1;break}if(n&&!r.target)return this.style.queryRenderedFeatures(i,r,this.transform)}let o=[];return n&&(o=o.concat(this.style.queryRenderedFeatures(i,r,this.transform))),a&&(o=o.concat(this.style.queryRenderedFeatureset(i,r,this.transform))),o}querySourceFeatures(e,i){return e&&("string"!=typeof e||this._isValidId(e))?this.style.querySourceFeatures(e,i):[]}isPointOnSurface(i){let{name:r}=this.transform.projection;return"globe"!==r&&"mercator"!==r&&e.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(e.P.convert(i))}addInteraction(e,i){return this._interactions.add(e,i),this}removeInteraction(e){return this._interactions.remove(e),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(e){return this._cooperativeGestures=e,this}setStyle(i,r){return r=e.l({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},r),this.style&&i&&!1!==r.diff&&r.localFontFamily===this._localFontFamily&&r.localIdeographFontFamily===this._localIdeographFontFamily&&!r.config?(this.style._diffStyle(i,(a,n)=>{a?(e.w(`Unable to perform style diff: ${String(a.message||a.error||a)}. Rebuilding the style from scratch.`),this._updateStyle(i,r)):n&&this._update(!0)},()=>{this._postStyleLoadEvent()}),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(i,r))}_getUIString(e){let i=this._locale[e];if(null==i)throw Error(`Missing UI string '${e}'`);return i}_updateStyle(i,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),i){let a=e.l({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new iS(this,a).load(i),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new iS(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():(e.w("There is no style added to the map."),!1)}_isValidId(i){return null==i?(this.fire(new e.z(Error("IDs can't be empty."))),!1):!e.cs(i)||(this.fire(new e.z(Error(`IDs can't
103contain special symbols: "${i}".`))),!1)}_isTargetValid(e){return"featuresetId"in e?this._isValidId("importId"in e?e.importId:e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(let i of e)if(!this._isValidId(i))return!1;return!0}return this._isTargetValid(e)}addSource(e,i){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,i),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,i,r){this._lazyInitEmptyStyle(),this.style.addSourceType(e,i,r)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(i,r,{pixelRatio:a=1,sdf:n=!1,stretchX:o,stretchY:s,content:l}={}){this._lazyInitEmptyStyle();let h=e.I.from(i);if(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){let{width:i,height:u,data:c}=e.q.getImageData(r);this.style.addImage(h,{data:new e.r({width:i,height:u},c),pixelRatio:a,stretchX:o,stretchY:s,content:l,sdf:n,version:0,usvg:!1})}else if(void 0===r.width||void 0===r.height)this.fire(new e.z(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:u,height:c}=r;this.style.addImage(h,{data:new e.r({width:u,height:c},new Uint8Array(r.data)),pixelRatio:a,stretchX:o,stretchY:s,content:l,sdf:n,usvg:!1,version:0,userImage:r}),r.onAdd&&r.onAdd(this,i)}}updateImage(i,r){this._lazyInitEmptyStyle();let a=e.I.from(i),n=this.style.getImage(a);if(!n)return void this.fire(new e.z(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:o,height:s,data:l}=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?e.q.getImageData(r):r;if(void 0===o||void 0===s)return void this.fire(new e.z(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(o!==(n.usvg?n.icon.usvg_tree.width:n.data.width)||s!==(n.usvg?n.icon.usvg_tree.height:n.data.height))return void this.fire(new e.z(Error(`The width and height of the updated image (${o}, ${s}) 104 must be that same as the previous version of the image 105 (${n.data.width}, ${n.data.height})`)));let h=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap),u=!1;n.usvg?(n.data=new e.r({width:o,height:s},new Uint8Array(l)),n.usvg=!1,n.icon=void 0,u=!0):n.data.replace(l,h),this.style.updateImage(a,n,u)}hasImage(i){return i?!!this.style&&!!this.style.getImage(e.I.from(i)):(this.fire(new e.z(Error("Missing required image id"))),!1)}removeImage(i){this.style.removeImage(e.I.from(i))}loadImage(i,r){e.o(this._requestManager.transformRequest(i,e.R.Image),(i,a)=>{r(i,a instanceof HTMLImageElement?e.q.getImageData(a):a)})}listImages(){return this.style.listImages().map(e=>e.name)}addModel(e,i){this._lazyInitEmptyStyle(),this.style.addModel(e,i)}hasModel(i){return i?this.style.hasModel(i):(this.fire(new e.z(Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,i){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,i),this._update(!0)):this}getSlot(e){let i=this.getLayer(e);return i&&i.slot||null}setSlot(e,i){return this.style.setSlot(e,i),this.style.mergeLayers(),this._update(!0)}addImport(e,i){return this.style.addImport(e,i),this}updateImport(e,i){return"string"!=typeof i&&i.id!==e?(this.removeImport(e),this.addImport(i)):(this.style.updateImport(e,i),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,i){return this.style.moveImport(e,i),this._update(!0)}moveLayer(e,i){return this._isValidId(e)?(this.style.moveLayer(e,i),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;let i=this.style.getOwnLayer(e);return i?"custom"===i.type?i.implementation:i.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,i,r){return this._isValidId(e)?(this.style.setLayerZoomRange(e,i,r),this._update(!0)):this}setFilter(e,i,r={}){return this._isValidId(e)?(this.style.setFilter(e,i,r),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,i,r,a={}){return this._isValidId(e)?(this.style.setPaintProperty(e,i,r,a),this._update(!0)):this}getPaintProperty(e,i){return this._isValidId(e)?this.style.getPaintProperty(e,i):null}setLayoutProperty(e,i,r,a={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,i,r,a),this._update(!0)):this}getLayoutProperty(e,i){return this._isValidId(e)?this.style.getLayoutProperty(e,i):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(e){return this.style.setGlyphsUrl(e),this._update(!0)}getSchema(e){return this.style.getSchema(e)}setSchema(e,i){return this.style.setSchema(e,i),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,i){return this.style.setConfig(e,i),this._update(!0)}getConfigProperty(e,i){return this.style.getConfigProperty(e,i)}setConfigProperty(e,i,r){return this.style.setConfigProperty(e,i,r),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){let i=e[0];i.properties?this.style.setFlatLight(i.properties,i.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){let e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,i={}
105){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:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(e){return this._lazyInitEmptyStyle(),this.style.setSnow(e),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(e){return this._lazyInitEmptyStyle(),this.style.setRain(e),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setImportColorTheme(e,i){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(e,i),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(i){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.bO.convert(i),this.transform):0}setFeatureState(e,i){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,i),this._update())}removeFeatureState(e,i){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,i),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;let e=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300,r,a,n,o=this._container;for(;o&&(!a||!n);){let e=window.getComputedStyle(o).transform;e&&"none"!==e&&((r=e.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==r[0]&&"1"!==r[0]&&(a=r[0]),r[3]&&"0"!==r[3]&&"1"!==r[3]&&(n=r[3])),o=o.parentElement}this._containerWidth=a?Math.abs(e/a):e,this._containerHeight=n?Math.abs(i/n):i}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.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 e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=d("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();let i=this._canvasContainer=d("div","mapboxgl-canvas-container",e);this._canvas=d("canvas","mapboxgl-canvas",i),this._interactive&&(i.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);let r=this._controlContainer=d("div","mapboxgl-control-container",e),a=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(e=>{a[e]=d("div",`mapboxgl-ctrl-${e}`,r)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(i,r){let a=e.q.devicePixelRatio||1;this._canvas.width=a*Math.ceil(i),this._canvas.height=a*Math.ceil(r),this._canvas.style.width=`${i}px`,this._canvas.style.height=`${r}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){let i=this._markers.indexOf(e);-1!==i&&this._markers.splice(i,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){let i=this._popups.indexOf(e);-1!==i&&this._popups.splice(i,1)}_setupPainter(){let i=e.l({},c.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",i);r?(G(r,!0),this.painter=new a9(r,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp),this.on("data",e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)}),e.m.testSupport(r)):this.fire(new e.z(Error("Failed to initialize WebGL")))}_contextLost(i){i.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.A("webglcontextlost",{originalEvent:i}))}_contextRestored(i){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style.reloadModels(),this.style.clearSources(),this._update(),this.fire(new e.A("webglcontextrestored",{originalEvent:i}))}_onMapScroll(e){if(e.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(e){return this.style&&(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(i){let r;this.fire(new e.A("renderstart")),++this._frameId;let a=this.painter.context.extTimerQuery,n=e.q.now(),l=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=l.createQuery(),l.beginQuery(a.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
105(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(i),this._domRenderTaskQueue.run(i),this._removed)return;this._updateProjectionTransition();let h=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let i=this.transform.zoom,r=this.transform.pitch,a=e.q.now(),n=new e.aa(i,{now:a,fadeDuration:h,pitch:r,transition:this.style.transition});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let u=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),u=this._updateAverageElevation(n),this.style.updateSources(this.transform),this.isMoving()||this._forceMarkerAndPopupUpdate()):u=this._updateAverageElevation(n);let c=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,h,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),c&&(this._placementDirty=c.needsRerender),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:h,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.mark(o.load),this.fire(new e.A("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(),r){let i=e.q.now()-n;l.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{let a=l.getQueryParameter(r,l.QUERY_RESULT)/1e6;l.deleteQuery(r),this.fire(new e.A("gpu-timing-frame",{cpuTime:i,gpuTime:a}))},50)}if(this.listens("gpu-timing-layer")){let i=this.painter.collectGpuTimers();setTimeout(()=>{let r=this.painter.queryGpuTimers(i);this.fire(new e.A("gpu-timing-layer",{layerTimes:r}))},50)}if(this.listens("gpu-timing-deferred-render")){let i=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let r=this.painter.queryGpuTimeDeferredRender(i);this.fire(new e.A("gpu-timing-deferred-render",{gpuTime:r}))},50)}let d=this._sourcesDirty||this._styleDirty||this._placementDirty||u;if(d||this._repaint)this.triggerRepaint();else{let i=this.idle();if(i&&(u=this._updateAverageElevation(n,!0)),u)this.triggerRepaint();else if(this._triggerFrame(!1),i&&(this.fire(new e.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let i=this._calculateSpeedIndex();this.fire(new e.A("speedindexcompleted",{speedIndex:i})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,s.mark(o.fullLoad),this._performanceMetricsCollection&&N(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(let i of this._markers)e&&!this.getRenderWorldCopies()&&(i._lngLat=i._lngLat.wrap()),i._update();for(let i of this._popups)!e||this.getRenderWorldCopies()||i._trackPointer||(i._lngLat=i._lngLat.wrap()),i._update()}_updateAverageElevation(e,i=!1){let r=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&r(0);let a=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(a||(i||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){let i=this.transform.averageElevation,n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;let o=Math.abs(i-n);if(o>1){if(this._isInitialLoad||a)return this._averageElevation.jumpTo(n),r(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),r(n)}return!!this._averageElevation.isEasing(e)&&r(this._averageElevation.getValue(e))}_authenticate(){U(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,i=>{if(i&&(i.message===S||401===i.status)){let i=this.painter.context.gl;G(i,!1),this._logoControl instanceof n2&&this._logoControl._updateLogo(),i&&i.clear(i.DEPTH_BUFFER_BIT|i.COLOR_BUFFER_BIT|i.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.z(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/")))}}),O(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&F(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){let e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){let e=this.painter.canvasCopy(),i=this.painter.getCanvasCopiesAndTimestamps();i.timeStamps.push(performance.now());let r=this.painter.context.gl,a=r.createFramebuffer();function n(e){r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);let i=new Uint8Array(r.drawingBufferWidth*r.drawingBufferHeight*4);return r.readPixels(0,0,r.drawingBufferWidth,r.drawingBufferHeight,r.RGBA,r.UNSIGNED_BYTE,i),i}return r.bindFramebuffer(r.FRAMEBUFFER,a),this._canvasPixelComparison(n(e),i.canvasCopies.map(n),i.timeStamps)}_canvasPixelComparison(e,i,r){let a=r[1]-r[0],n=e.length/4;for(let o=0;o<i.length;o++){let s=i[o],l=0;for(let i=0;i<s.length;
105i+=4)s[i]===e[i]&&s[i+1]===e[i+1]&&s[i+2]===e[i+2]&&s[i+3]===e[i+3]&&(l+=1);a+=(r[o+2]-r[o+1])*(1-l/n)}return a}remove(){for(let e of(this._hash&&this._hash.remove(),this._controls))e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor.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 i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.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),j.delete(this.painter.context.gl),V.remove(),L.remove(),this._removed=!0,this.fire(new e.A("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(i){this._renderNextFrame=this._renderNextFrame||i,this.style&&!this._frame&&(this._frame=e.q.frame(e=>{let i=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,i&&this._render(e)}))}_preloadTiles(i){let r=this.style?this.style.getSourceCaches():[];return e.bl(r,(e,r)=>e._preloadTiles(i,r),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update())}_setCacheLimits(i,r){e.dJ(i,r)}get version(){return n}},NavigationControl:class{constructor(i={}){this.options=e.l({},n7,i),this._container=d("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.aQ(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",e=>{this._map&&this._map.zoomIn({},{originalEvent:e})}),d("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",e=>{this._map&&this._map.zoomOut({},{originalEvent:e})}),d("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aQ(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",e=>{let i=this._map;i&&(this.options.visualizePitch?i.resetNorthPitch({},{originalEvent:e}):i.resetNorth({},{originalEvent:e}))}),this._compassIcon=d("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let e=this._map;if(!e)return;
105let i=e.getZoom(),r=i===e.getMaxZoom(),a=i===e.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())}_rotateCompassArrow(){let e=this._map;if(!e)return;let i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=i)})}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new oe(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){let e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,i){let r=d("button",e,this._container);return r.type="button",r.addEventListener("click",i),r}_setButtonTitle(e,i){if(!this._map)return;let r=this._map._getUIString(`NavigationControl.${i}`);e.setAttribute("aria-label",r),e.firstElementChild&&e.firstElementChild.setAttribute("title",r)}},GeolocateControl:class extends e.E{constructor(i={}){super();const r=navigator.geolocation;this.options=e.l({geolocation:r},on,i),e.aQ(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=a7(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=d("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){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(e){let i=(i=!!this.options.geolocation)=>{this._supportsGeolocation=i,e(i)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(e=>i("denied"!==e.state)).catch(()=>i()):i()}_isOutOfMapMaxBounds(e){let i=this._map.getMaxBounds(),r=e.coords;return!!i&&(r.longitude<i.getWest()||r.longitude>i.getEast()||r.latitude<i.getSouth()||r.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(i){if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new e.A("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
105RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(i),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(i),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.A("geolocate",i)),this._finish()}}_updateCamera(i){let r=new e.bO(i.coords.longitude,i.coords.latitude),a=i.coords.accuracy,n=this._map.getBearing(),o=e.l({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(a),o,{geolocateSource:!0})}_updateMarker(i){if(i){let r=new e.bO(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=i.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let i=this._map.transform,r=e.bH(1,i._center.lat)*i.worldSize,a=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}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(i){if(this._map){if(this.options.trackUserLocation)if(1===i.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===i.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.A("error",i)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(i){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=d("button","mapboxgl-ctrl-geolocate",this._container),d("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===i){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
105se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=d("div","mapboxgl-user-location"),this._dotElement.appendChild(d("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(d("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new oa({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=d("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new oa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i.originalEvent&&"resize"===i.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.A("trackuserlocationend")))})}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){let e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"u">typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&e()}).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
105se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:n1,ScaleControl:class{constructor(i={}){this.options=e.l({},oo,i),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aQ(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let e=this.options.maxWidth||100,i=this._map,r=i._containerHeight/2,a=i._containerWidth/2-e/2,n=i.unproject([a,r]),o=i.unproject([a+e,r]),s=n.distanceTo(o);if("imperial"===this.options.unit){let i=3.2808*s;i>5280?this._setScale(e,i/5280,"mile"):this._setScale(e,i,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,i,r){this._map._requestDomTask(()=>{var a;let n,o,s,l=(n=Math.pow(10,`${Math.floor(i)}`.length-1),o=i/n,n*(o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:o>=1?1:(s=Math.pow(10,Math.ceil(-Math.log(a=o)/Math.LN10)),Math.round(a*s)/s))),h=l/i;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==r?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:r}).format(l):`${l} ${os[r]}`,this._container.style.width=e*h+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=d("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.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(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(i={}){this._fullscreen=!1,i&&i.container&&(i.container instanceof HTMLElement?this._container=i.container:e.w("Full screen control 'container' must be a DOM element.")),e.aQ(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(i){return this._map=i,this._container||(this._container=this._map.getContainer()),this._controlContainer=d("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.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 e=this._fullscreenButton=d("button","mapboxgl-ctrl-fullscreen",this._controlContainer);d("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_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()}},Popup:class extends e.E{constructor(i){super(),this.options=e.l(Object.create(ol),i),this._altitude=this.options.altitude,e.aQ(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(i&&i.className?i.className.trim().split(/\s+/):[])}addTo(i){return this._map&&this.remove(),this._map=i,this.options.closeOnClick&&i.on("preclick",this._onClose),this.options.closeOnMove&&i.on("move",this._onClose),i.on("remove",this.remove),this._update(),i._addPopup(this),this._focusFirstElement(),this._trackPointer?(i.on("mousemove",this._onMouseEvent),i.on("mouseup",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")):i.on("move",this._update),this.fire(new e.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let i=this._map;return i&&(i.off("move",this._update),i.off("move",this._onClose),i.off("preclick",this._onClose),i.off("click",this._onClose),i.off("remove",this.remove),i.off("mousemove",this._onMouseEvent),i.off("mouseup",this._onMouseEvent),i.off("drag",this._onMouseEvent),i._canvasContainer&&i._canvasContainer.classList.remove("mapboxgl-track-pointer"),i._removePopup(this),this._map=void 0),this.fire(new e.A("close")),this}getLngLat(){return this._lngLat}setLngLat(i){this._lngLat=e.bO.convert(i),this._pos=null,this._trackPointer=!1,this._update();let r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(e){return this._altitude=e,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let i,r=document.createDocumentFragment(),a=document.createElement("body");for(a.innerHTML=e;i=a.firstChild;)r.appendChild(i);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let i=this._content;if(i)for(;i.hasChildNodes();)i.firstChild&&i.removeChild(i.firstChild);else i=this._content=d("div","mapboxgl-popup-content",this._container||void 0);if(i.appendChild(e),this.options.closeButton){let e=this._closeButton=d("button","mapboxgl-popup-close-button",i);e.type="button",e.setAttribute("aria-label","Close popup"),e.innerHTML='<span aria-hidden="true">×</span>',e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let i;return this._classList.delete(e)?i=!1:(this._classList.add(e),i=!0),this._updateClassList(),i}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;let i=this._map,r=this._container,a=this._pos;if(!i||!r||!a)return"bottom";let n=r.offsetWidth,o=r.offsetHeight,s=a.x<n/2,l=a.x>i.transform.width-n/2;if(a.y+e<o)return s?"top-left":l?"top-right":"top";if(a.y>i.transform.height-o){if(s)return"bottom-left";if(l)return"bottom-right"}return s?"left":l?"right":"bottom"}_updateClassList(){let e=this._container;if(!e)return;let i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),e.className=i.join(" ")}_update(i){let r=this._map,a=this._content;if(!r||!this._lngLat&&!this._trackPointer||!a)return;let n=this._container;if(n||(n=this._container=d("div","mapboxgl-popup",r.getContainer()),this._tip=d("div","mapboxgl-popup-tip",n),n.appendChild(a)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ot(this._lngLat,this._pos,r.transform)),!this._trackPointer||i){let a=this._pos=this._trackPointer&&i instanceof e.P?i:r.project(this._lngLat,this._altitude),n=oh(this.options.offset),o=this._anchor=this._getAnchor(n.y),s=oh(this.options.offset,o),l=a.add(s).round();r._requestDomTask(()=>{this._container&&o&&(this._container.style.transform=`${oi[o]} translate(${l.x}px,${l.y}px)`)})}if(!this._marker&&r._showingGlobe()){let i=+!e.dK(r.transform,this._lngLat);this._setOpacity(i)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;
105let e=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])");e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:oa,Style:iS,LngLat:e.bO,LngLatBounds:e.aB,Point:e.P,MercatorCoordinate:e.ac,FreeCameraOptions:t8,Evented:e.E,config:e.e,prewarm:e.dP,clearPrewarmedResources:e.dQ,get accessToken(){return e.e.ACCESS_TOKEN},set accessToken(t){e.e.ACCESS_TOKEN=t},get baseApiUrl(){return e.e.API_URL},set baseApiUrl(t){e.e.API_URL=t},get workerCount(){return e.dR.workerCount},set workerCount(t){e.dR.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(i){e.dS(i)},get workerUrl(){return e.dT.workerUrl},set workerUrl(t){e.dT.workerUrl=t},get workerClass(){return e.dT.workerClass},set workerClass(t){e.dT.workerClass=t},get workerParams(){return e.dT.workerParams},set workerParams(t){e.dT.workerParams=t},get dracoUrl(){return e.dU()},set dracoUrl(t){e.dV(t)},get meshoptUrl(){return e.dW()},set meshoptUrl(t){e.dX(t)},setNow:e.q.setNow,restoreNow:e.q.restoreNow}}),r}()}}]);
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.