1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3415],{7719:function(e,i,r){var a,n=r(357);a=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),"undefined"!=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,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,M,I,A,C,P,z,D,R,L,k,O,B,F,N,V,U,j,G,q;function Z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $,H={},W={};function X(){if($)return W;$=1,Object.defineProperty(W,"__esModule",{value:!0}),W.setMatrixArrayType=function(e){W.ARRAY_TYPE=i=e},W.toRadian=function(e){return e*a},W.equals=function(i,r){return Math.abs(i-r)<=e*Math.max(1,Math.abs(i),Math.abs(r))},W.RANDOM=W.ARRAY_TYPE=W.EPSILON=void 0;var e=1e-6;W.EPSILON=e;var i="undefined"!=typeof Float32Array?Float32Array:Array;W.ARRAY_TYPE=i;var r=Math.random;W.RANDOM=r;var a=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)}),W}var Y,J,K,Q={},ee={},et={};function ei(){if(K)return et;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)}K=1,Object.defineProperty(et,"__esModule",{value:!0}),et.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},et.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},et.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},et.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},et.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},et.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},et.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},et.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},et.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},et.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},et.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)},et.multiply=a,et.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},et.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},et.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},et.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},et.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},et.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},et.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},et.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},et.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,E=c*_-
1d*m,M=c*g-p*m,I=c*y-f*m,A=d*g-p*_,C=d*y-f*_,P=p*y-f*g,z=x*P-v*C+b*A+w*I-T*M+S*E;return z?(e[0]=(l*P-h*C+u*A)*(z=1/z),e[1]=(h*I-s*P-u*M)*z,e[2]=(s*C-l*I+u*E)*z,e[3]=(n*C-a*P-o*A)*z,e[4]=(r*P-n*I+o*M)*z,e[5]=(a*I-r*C-o*E)*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},et.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},et.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},et.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},et.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},et.subtract=n,et.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},et.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},et.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]},et.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))},et.sub=et.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.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,n&&n.set(i,o),o}(X());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 et.mul=a,et.sub=n,et}var er,ea={};function en(){if(er)return ea;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(ea,"__esModule",{value:!0}),ea.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},ea.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},ea.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},ea.fromValues=function(e,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){var y=new i.ARRAY_TYPE(16);
1return 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},ea.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},ea.identity=a,ea.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},ea.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,E=c*_-d*m,M=c*g-p*m,I=c*y-f*m,A=d*g-p*_,C=d*y-f*_,P=p*y-f*g,z=x*P-v*C+b*A+w*I-T*M+S*E;return z?(e[0]=(l*P-h*C+u*A)*(z=1/z),e[1]=(n*C-a*P-o*A)*z,e[2]=(_*S-g*T+y*w)*z,e[3]=(p*T-d*S-f*w)*z,e[4]=(h*I-s*P-u*M)*z,e[5]=(r*P-n*I+o*M)*z,e[6]=(g*b-m*S-y*v)*z,e[7]=(c*S-p*b+f*v)*z,e[8]=(s*C-l*I+u*E)*z,e[9]=(a*I-r*C-o*E)*z,e[10]=(m*T-_*b+y*x)*z,e[11]=(d*b-c*T-f*x)*z,e[12]=(l*M-s*A-h*E)*z,e[13]=(r*A-a*M+n*E)*z,e[14]=(_*v-m*w-g*x)*z,e[15]=(c*w-d*v+p*x)*z,e):null},ea.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},ea.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)},ea.multiply=n,ea.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},ea.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},ea.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,E,M,I,A,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,E=z*z*l+s,M=D*z*l+P*o,I=P*D*l+z*o,A=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*E+g*M,e[5]=u*S+f*E+y*M,e[6]=c*S+m*E+x*M,e[7]=d*S+_*E+v*M,e[8]=h*I+p*A+g*C,e[9]=u*I+f*A+y*C,e[10]=c*I+m*A+x*C,e[11]=d*I+_*A+v*C,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)},ea.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},ea.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},ea.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},ea.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},ea.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},ea.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)},ea.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},ea.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},ea.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},ea.fromRotationTranslation=o,ea.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},ea.getTranslation=function(e,i){return e[0]=i[12],e[1]=i[13],e[2]=i[14],e},ea.getScaling=s,ea.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},ea.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},ea.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],E=n[0],M=n[1],I=n[2],A=(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,k=(g-x)*S,O=(1-(p+_))*S;return e[0]=A,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]=k,e[10]=O,e[11]=0,e[12]=r[0]+E-(A*E+z*M+L*I),e[13]=r[1]+M-(C*E+D*M+k*I),e[14]=r[2]+I-(P*E+R*M+O*I),e[15]=1,e},ea.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},ea.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},ea.perspectiveNO=l,ea.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},ea.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},ea.orthoNO=h,ea.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},ea.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],E=n[2];return Math.abs(g-T)<i.EPSILON&&Math.abs(y-S)<i.EPSILON&&Math.abs(x-E)<i.EPSILON?a(e):(p=g-T,f=y-S,m=x-E,(_=Math.hypot(s=b*(m*=_=1/Math.hypot(p,f,m))-w*(f*=_),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)},ea.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},ea.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]+")"},ea.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])},ea.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},ea.subtract=u,ea.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},ea.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},ea.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]},ea.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],E=r[5],M=r[6],I=r[7],A=r[8],C=r[9],P=r[10],z=r[11],D=r[12],R=r[13],L=r[14],k=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-E)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(u-M)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(c-I)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(d-A)<=i.EPSILON*Math.max(1,Math.abs(d),Math.abs(A))&&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-k)<=i.EPSILON*Math.max(1,Math.abs(x),Math.abs(k))},ea.sub=ea.mul=ea.ortho=ea.perspective=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.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,n&&n.set(i,o),o}(X());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 ea.perspective=l,ea.ortho=h,ea.mul=n,ea.sub=u,ea}var eo,es={},el={};function eh(){if(eo)return el;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)}
1eo=1,Object.defineProperty(el,"__esModule",{value:!0}),el.create=a,el.clone=function(e){var r=new i.ARRAY_TYPE(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r},el.length=n,el.fromValues=function(e,r,a){var n=new i.ARRAY_TYPE(3);return n[0]=e,n[1]=r,n[2]=a,n},el.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},el.set=function(e,i,r,a){return e[0]=i,e[1]=r,e[2]=a,e},el.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},el.subtract=o,el.multiply=s,el.divide=l,el.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e},el.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e},el.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},el.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},el.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e},el.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e},el.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},el.distance=h,el.squaredDistance=u,el.squaredLength=c,el.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e},el.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e},el.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},el.dot=d,el.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},el.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},el.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},el.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},el.random=function(e,r){r=r||1;var a=2*i.RANDOM()*Math.PI,n=2*i.RANDOM()-1,o=Math.sqrt(1-n*n)*r;return e[0]=Math.cos(a)*o,e[1]=Math.sin(a)*o,e[2]=n*r,e},el.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},el.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},el.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},el.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]*Math.cos(a),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},el.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},el.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},el.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&&d(e,i)/h,-1),1))},el.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},el.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},el.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]},el.equals=function(e,r){var a=e[0],n=e[1],o=e[2],s=r[0],l=r[1],h=r[2];return Math.abs(a-s)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(s))&&Math.abs(n-l)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-h)<=i.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))},el.forEach=el.sqrLen=el.len=el.sqrDist=el.dist=el.div=el.mul=el.sub=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.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,n&&n.set(i,o),o}(X());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(){var e=new i.ARRAY_TYPE(3);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function n(e){return Math.hypot(e[0],e[1],e[2])}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}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){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2])}function u(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 c(e){var i=e[0],r=e[1],a=e[2];return i*i+r*r+a*a}function d(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]}
1el.sub=o,el.mul=s,el.div=l,el.dist=h,el.sqrDist=u,el.len=n,el.sqrLen=c;var p,f=(p=a(),function(e,i,r,a,n,o){var s,l;for(i||(i=3),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)p[0]=e[s],p[1]=e[s+1],p[2]=e[s+2],n(p,p,o),e[s]=p[0],e[s+1]=p[1],e[s+2]=p[2];return e});return el.forEach=f,el}var eu,ec,ed={};function ep(){if(eu)return ed;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)}eu=1,Object.defineProperty(ed,"__esModule",{value:!0}),ed.create=a,ed.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},ed.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},ed.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},ed.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},ed.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},ed.subtract=n,ed.multiply=o,ed.divide=s,ed.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},ed.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},ed.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},ed.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},ed.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},ed.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},ed.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},ed.distance=l,ed.squaredDistance=h,ed.length=u,ed.squaredLength=c,ed.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=-i[3],e},ed.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},ed.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},ed.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]+e[3]*i[3]},ed.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},ed.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},ed.random=function(e,r){r=r||1;do l=(a=2*i.RANDOM()-1)*a+(n=2*i.RANDOM()-1)*n;while(l>=1);do h=(o=2*i.RANDOM()-1)*o+(s=2*i.RANDOM()-1)*s;while(h>=1);var a,n,o,s,l,h,u=Math.sqrt((1-l)/h);return e[0]=r*a,e[1]=r*n,e[2]=r*o*u,e[3]=r*s*u,e},ed.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},ed.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*a-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},ed.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},ed.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},ed.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},ed.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))},ed.forEach=ed.sqrLen=ed.len=ed.sqrDist=ed.dist=ed.div=ed.mul=ed.sub=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.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,n&&n.set(i,o),o}(X());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(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),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}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){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2],i[3]-e[3])}function h(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 u(e){return Math.hypot(e[0],e[1],e[2],e[3])}function c(e){var i=e[0],r=e[1],a=e[2],n=e[3];return i*i+r*r+a*a+n*n}ed.sub=n,ed.mul=o,ed.div=s,ed.dist=l,ed.sqrDist=h,ed.len=u,ed.sqrLen=c;var d,p=(d=a(),function(e,i,r,a,n,o){var s,l;for(i||(i=4),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)d[0]=e[s],d[1]=e[s+1],d[2]=e[s+2],d[3]=e[s+3],n(d,d,o),e[s]=d[0],e[s+1]=d[1],e[s+2]=d[2],e[s+3]=d[3];return e});return ed.forEach=p,ed}function ef(){if(ec)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)}ec=1,Object.defineProperty(es,"__esModule",{value:!0}),es.create=l,es.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},es.setAxisAngle=h,es.getAxisAngle=function(e,r){var a=2*Math.acos(r[3]),n=Math.sin(a/2);return n>i.EPSILON?(e[0]=r[0]/n,e[1]=r[1]/n,e[2]=r[2]/n):(e[0]=1,e[1]=0,e[2]=0),a},es.getAngle=function(e,i){var r=_(e,i);return Math.acos(2*r*r-1)},es.multiply=u,es.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},es.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},es.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},es.calculateW=function(e,i){var r=i[0],a=i[1],n=i[2];
1return e[0]=r,e[1]=a,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-a*a-n*n)),e},es.exp=c,es.ln=d,es.pow=function(e,i,r){return d(e,i),m(e,e,r),c(e,e),e},es.slerp=p,es.random=function(e){var r=i.RANDOM(),a=i.RANDOM(),n=i.RANDOM(),o=Math.sqrt(1-r),s=Math.sqrt(r);return e[0]=o*Math.sin(2*Math.PI*a),e[1]=o*Math.cos(2*Math.PI*a),e[2]=s*Math.sin(2*Math.PI*n),e[3]=s*Math.cos(2*Math.PI*n),e},es.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},es.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e},es.fromMat3=f,es.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},es.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},es.setAxes=es.sqlerp=es.rotationTo=es.equals=es.exactEquals=es.normalize=es.sqrLen=es.squaredLength=es.len=es.length=es.lerp=es.dot=es.scale=es.mul=es.add=es.set=es.copy=es.fromValues=es.clone=void 0;var i=s(X()),r=s(ei()),a=s(eh()),n=s(ep());function o(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(o=function(e){return e?r:i})(e)}function s(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=o(r);if(a&&a.has(i))return a.get(i);var n={},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(n,l,h):n[l]=i[l]}return n.default=i,a&&a.set(i,n),n}function l(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function h(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 u(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 c(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 d(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 p(e,r,a,n){var o,s,l,h,u,c=r[0],d=r[1],p=r[2],f=r[3],m=a[0],_=a[1],g=a[2],y=a[3];return(s=c*m+d*_+p*g+f*y)<0&&(s=-s,m=-m,_=-_,g=-g,y=-y),1-s>i.EPSILON?(l=Math.sin(o=Math.acos(s)),h=Math.sin((1-n)*o)/l,u=Math.sin(n*o)/l):(h=1-n,u=n),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 f(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}es.clone=n.clone,es.fromValues=n.fromValues,es.copy=n.copy,es.set=n.set,es.add=n.add,es.mul=u;var m=n.scale;es.scale=m;var _=n.dot;es.dot=_,es.lerp=n.lerp;var g=n.length;es.length=g,es.len=g;var y=n.squaredLength;es.squaredLength=y,es.sqrLen=y;var x=n.normalize;es.normalize=x,es.exactEquals=n.exactEquals,es.equals=n.equals;var v,b,w,T=(v=a.create(),b=a.fromValues(1,0,0),w=a.fromValues(0,1,0),function(e,i,r){var n=a.dot(i,r);return n<-.999999?(a.cross(v,b,i),1e-6>a.len(v)&&a.cross(v,w,i),a.normalize(v,v),h(e,v,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(a.cross(v,i,r),e[0]=v[0],e[1]=v[1],e[2]=v[2],e[3]=1+n,x(e,e))});es.rotationTo=T;var S,E,M=(S=l(),E=l(),function(e,i,r,a,n,o){return p(S,i,n,o),p(E,r,a,o),p(e,S,E,2*o*(1-o)),e});es.sqlerp=M;var I,A=(I=r.create(),function(e,i,r,a){return I[0]=r[0],I[3]=r[1],I[6]=r[2],I[1]=a[0],I[4]=a[1],I[7]=a[2],I[2]=-i[0],I[5]=-i[1],I[8]=-i[2],x(e,f(e,I))});return es.setAxes=A,es}var em,e_,eg,ey,ex,ev,eb,ew={},eT={},eS=function(){if(eg)return H;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(H,"__esModule",{value:!0}),H.vec4=H.vec3=H.vec2=H.quat2=H.quat=H.mat4=H.mat3=H.mat2d=H.mat2=H.glMatrix=void 0;var i=p(X());H.glMatrix=i;var r=p(function(){if(Y)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)}Y=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.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},Q.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},Q.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},Q.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},Q.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},Q.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},Q.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},Q.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},Q.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},Q.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},Q.multiply=a,Q.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},Q.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},Q.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},Q.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e},Q.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},Q.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},Q.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]},Q.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},Q.subtract=n,Q.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},Q.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))},Q.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},Q.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},Q.sub=Q.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.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,n&&n.set(i,o),o}(X());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 Q.mul=a,Q.sub=n,Q}());H.mat2=r;var a=p(function(){if(J)return ee;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)}
1J=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.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},ee.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},ee.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},ee.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},ee.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},ee.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},ee.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},ee.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},ee.multiply=a,ee.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},ee.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},ee.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},ee.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},ee.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},ee.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},ee.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},ee.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},ee.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},ee.subtract=n,ee.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},ee.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},ee.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]},ee.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))},ee.sub=ee.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.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,n&&n.set(i,o),o}(X());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 ee.mul=a,ee.sub=n,ee}());H.mat2d=a;var n=p(ei());H.mat3=n;var o=p(en());H.mat4=o;var s=p(ef());H.quat=s;var l=p(function(){if(em)return ew;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)}em=1,Object.defineProperty(ew,"__esModule",{value:!0}),ew.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},ew.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},ew.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},ew.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},ew.fromRotationTranslation=s,ew.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},ew.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},ew.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},ew.copy=l,ew.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},ew.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},ew.getDual=function(e,i){return e[0]=i[4],e[1]=i[5],e[2]=i[6],e[3]=i[7],e},ew.setDual=function(e,i){return e[4]=i[0],e[5]=i[1],e[6]=i[2],e[7]=i[3],e},ew.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},ew.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},ew.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},ew.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},ew.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},ew.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},ew.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},ew.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},ew.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},ew.multiply=h,ew.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},ew.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},ew.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},ew.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},ew.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},ew.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},ew.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]},ew.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))},ew.sqrLen=ew.squaredLength=ew.len=ew.length=ew.dot=ew.mul=ew.setReal=ew.getReal=void 0;var i=o(X()),r=o(ef()),a=o(en());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}ew.getReal=r.copy,ew.setReal=r.copy,ew.mul=h;var u=r.dot;ew.dot=u;var c=r.length;ew.length=c,ew.len=c;var d=r.squaredLength;return ew.squaredLength=d,ew.sqrLen=d,ew}());H.quat2=l;var h=p(function(){if(e_)return eT;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)}
1e_=1,Object.defineProperty(eT,"__esModule",{value:!0}),eT.create=a,eT.clone=function(e){var r=new i.ARRAY_TYPE(2);return r[0]=e[0],r[1]=e[1],r},eT.fromValues=function(e,r){var a=new i.ARRAY_TYPE(2);return a[0]=e,a[1]=r,a},eT.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e},eT.set=function(e,i,r){return e[0]=i,e[1]=r,e},eT.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e},eT.subtract=n,eT.multiply=o,eT.divide=s,eT.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e},eT.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e},eT.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e},eT.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e},eT.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e},eT.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e},eT.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e},eT.distance=l,eT.squaredDistance=h,eT.length=u,eT.squaredLength=c,eT.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e},eT.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e},eT.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},eT.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]},eT.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},eT.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},eT.random=function(e,r){r=r||1;var a=2*i.RANDOM()*Math.PI;return e[0]=Math.cos(a)*r,e[1]=Math.sin(a)*r,e},eT.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},eT.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},eT.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},eT.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},eT.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},eT.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))},eT.zero=function(e){return e[0]=0,e[1]=0,e},eT.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},eT.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]},eT.equals=function(e,r){var a=e[0],n=e[1],o=r[0],s=r[1];return Math.abs(a-o)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(o))&&Math.abs(n-s)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))},eT.forEach=eT.sqrLen=eT.sqrDist=eT.dist=eT.div=eT.mul=eT.sub=eT.len=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.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,n&&n.set(i,o),o}(X());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(){var e=new i.ARRAY_TYPE(2);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],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){return Math.hypot(i[0]-e[0],i[1]-e[1])}function h(e,i){var r=i[0]-e[0],a=i[1]-e[1];return r*r+a*a}function u(e){return Math.hypot(e[0],e[1])}function c(e){var i=e[0],r=e[1];return i*i+r*r}eT.len=u,eT.sub=n,eT.mul=o,eT.div=s,eT.dist=l,eT.sqrDist=h,eT.sqrLen=c;var d,p=(d=a(),function(e,i,r,a,n,o){var s,l;for(i||(i=2),r||(r=0),l=a?Math.min(a*i+r,e.length):e.length,s=r;s<l;s+=i)d[0]=e[s],d[1]=e[s+1],n(d,d,o),e[s]=d[0],e[s+1]=d[1];return e});return eT.forEach=p,eT}());H.vec2=h;var u=p(eh());H.vec3=u;var c=p(ep());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}return H.vec4=c,H}(),eE=Z(function(){if(ex)return ey;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 ex=1,ey=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))}},ey}());function eM(){if(eb)return ev;function e(e,i){this.x=e,this.y=i}return eb=1,ev=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},ev}var eI=Z(eM());function eA(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(!eA(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(!eA(e[r],i[r]))return!1;return!0}return e===i}let eC=Math.PI/180,eP=180/Math.PI,ez=[[0,0],[1,0],[1,1],[0,1]];function eD(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 eR(e,i,r,a){let n=new eE(e,i,r,a);return function(e){return n.solve(e)}}let eL=eR(.25,.1,.25,1);function ek(e,i,r){return Math.min(r,Math.max(i,e))}function eO(e,i,r){return(r=ek((r-e)/(i-e),0,1))*r*(3-2*r)}function eB(e,i,r){let a=r-i,n=((e-i)%a+a)%a+i;return n===i?r:n}function eF(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 eN(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}let eV=1;function eU(){return eV++}function ej(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function eG(e,i){e.forEach(e=>{i[e]&&(i[e]=i[e].bind(i))})}function eq(e,i){return -1!==e.indexOf(i,e.length-i.length)}function eZ(e,i,r){let a={};for(let r in e)a[r]=i.call(this,e[r],r,e);return a}function e$(e,i,r){let a={};for(let r in e)i.call(this,e[r],r,e)&&(a[r]=e[r]);return a}function eH(e){return Array.isArray(e)?e.map(eH):"object"==typeof e&&e?eZ(e,eH):e}let eW={};function eX(e){eW[e]||("undefined"!=typeof console&&console.warn(e),eW[e]=!0)}function eY(e,i,r){return(r.y-e.y)*(i.x-e.x)>(i.y-e.y)*(r.x-e.x)}function eJ([e,i,r]){let a=(i+90)*eC,n=r*eC;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 eK(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function eQ(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 e0,e1=null;function e2(e,i){return[e[4*i],e[4*i+1],e[4*i+2],e[4*i+3]]}function e3(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<a?i=n+1:r=n}return i}function e4(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<=a?i=n+1:r=n}return i}function e5(e){return e>0?1/(1.001-e):1+e}function e6(e){return e>0?1-1/(1.001-e):-e}let e8={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==e0){let e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{e0=null!=n.env.API_URL_REGEX?new RegExp(n.env.API_URL_REGEX):e}catch(i){e0=e}}return e0},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(!e8.API_URL)return null;try{let e=new URL(e8.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 e9(e){return e8.API_URL_REGEX.test(e)}function e7(e){return e8.API_SPRITE_REGEX.test(e)}function te(){return null==i&&(i=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),i}let tt={now:()=>void 0!==o?o:performance.now(),setNow(e){o=e},restoreNow(){o=void 0},frame(e){let i=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(i)}},getImageData(e,i=0){let{width:r,height:a}=e;s||(s=document.createElement("canvas"));let n=s.getContext("2d",{willReadFrequently:!0});if(!n)throw Error("failed to create canvas 2d context");return(r>s.width||a>s.height)&&(s.width=r,s.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!==l)return l;if(!te())return l=!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 l=!0,!0;return l=!1,!1}};function ti(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 tr(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 ta="mapbox-tiles",tn=500,to=50,ts=["language","worldview","jobid"];function tl(){try{return caches}catch(e){}}function th(){let e=tl();e&&null==h&&(h=e.open(ta))}let tu=1/0,tc={supported:!1,testSupport:function(e){!tf&&tp&&(tm?tg(e):td=e)}},td,tp,tf=!1,tm=!1,t_="undefined"!=typeof self?self:{};function tg(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,tp),e.isContextLost())return;tc.supported=!0}catch(e){}e.deleteTexture(i),tf=!0}t_.document&&((tp=t_.document.createElement("img")).onload=function(){td&&tg(td),td=null,tm=!0},tp.onerror=function(){tf=!0,td=null},tp.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let ty={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(ty);class tx extends Error{constructor(e,i,r){401===i&&e9(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 tv=eK()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,tb=function(e,i){var r;if(!(/^file:/.test(r=e.url)||/^file:/.test(tv())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,i){var r;let a=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:tv(),referrerPolicy:e.referrerPolicy,signal:a.signal}),o=!1,s=!1,l=(r=n.url).indexOf("sku=")>0&&e9(r);"json"===e.type&&n.headers.set("Accept","application/json");let c=(r,a,o)=>
1{if(s)return;if(r&&"SecurityError"!==r.message&&eX(r.toString()),a&&o)return d(a);let h=Date.now();fetch(n).then(r=>{if(r.ok){let e=l?r.clone():null;return d(r,e,h)}return i(new tx(r.statusText,r.status,e.url))}).catch(r=>{"AbortError"!==r.name&&i(Error(`${r.message} ${e.url}`))})},d=(r,a,l)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then(e=>{s||(a&&l&&function(e,i,r){if(th(),null==h)return;let a=eQ(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=tr(e.url,{persistentParams:ts});if(206===i.status){let i=e.headers.get("Range");if(!i)return;n.status=200,s=ti(s,{range:i})}!function(e,i){if(void 0===u)try{new Response(new ReadableStream),u=!0}catch(e){u=!1}u?i(e.body):e.blob().then(i)}(i,e=>{var r;let a=new Response(200!==(r=i.status)&&404!==r&&[101,103,204,205,304].includes(r)?null:e,n);th(),null!=h&&h.then(e=>e.put(s,a)).catch(e=>eX(e.message))})}(n,a,l),o=!0,i(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))}).catch(e=>{s||i(Error(e.message))})};return l?function(e,i){if(th(),null==h)return i(null);h.then(r=>
1{let a=tr(e.url,{persistentParams:ts}),n=e.headers.get("Range");n&&(a=ti(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=eQ(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||a.abort()}}}(e,i);if(eK()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,i,void 0,!0)}return function(e,i){let r=new XMLHttpRequest;for(let i in r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer"),e.headers)r.setRequestHeader(i,e.headers[i]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{i(Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let a=r.response;if("json"===e.type)try{a=JSON.parse(r.response)}catch(e){return i(e)}i(null,a,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else i(new tx(r.statusText,r.status,e.url))},r.send(e.body),{cancel:()=>r.abort()}}(e,i)},tw=function(e,i){return tb(eN(e,{type:"arrayBuffer"}),i)},tT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";c=[],d=0;let tS=function(e,i){if(tc.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),d>=e8.MAX_PARALLEL_IMAGE_REQUESTS){let r={requestParameters:e,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return c.push(r),r}d++;let r=!1,a=()=>{if(!r)for(r=!0,d--;c.length&&d<e8.MAX_PARALLEL_IMAGE_REQUESTS;){let e=c.shift(),{requestParameters:i,callback:r,cancelled:a}=e;a||(e.cancel=tS(i,r).cancel)}},n=tw(e,(e,r,n,o)=>{a(),e?i(e):r&&(self.createImageBitmap?function(e,i){createImageBitmap(new Blob([new Uint8Array(e)],{type:"image/png"})).then(e=>{i(null,e)}).catch(e=>{i(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.`))})}(r,(e,r)=>i(e,r,n,o)):function(e,i){let r=new Image;r.onload=()=>{i(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame(()=>{r.src=tT})},r.onerror=()=>i(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."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(a):tT}(r,(e,r)=>i(e,r,n,o)))});return{cancel:()=>{n.cancel(),a()}}};var tE,tM,tI,tA={exports:{}},tC={exports:{}},tP={exports:{}},tz=Z(function(){if(tI)return tA.exports;tI=1;var e=(tE||(tE=1,tC.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)*3432918353+(((s>>>16)*3432918353&65535)<<16)&4294967295)<<15|s>>>17))*461845907+(((s>>>16)*461845907&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((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)))*3432918353+(((s>>>16)*3432918353&65535)<<16)&4294967295)<<15|s>>>17))*461845907+(((s>>>16)*461845907&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),tC.exports),i=(tM||(tM=1,tP.exports=function(e,i){for(var r,a=e.length,n=i^a,o=0;a>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(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=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),tP.exports);return tA.exports=e,tA.exports.murmur3=e,tA.exports.murmur2=i,tA.exports}());class tD{constructor(e,...i){eN(this,i[0]||{}),this.type=e}}class tR extends tD{constructor(e,i={}){super("error",eN({error:e},i))}}function tL(e,i,r){r[e]&&-1!==r[e].indexOf(i)||(r[e]=r[e]||[],r[e].push(i))}function tk(e,i,r){if(r&&r[e]){let a=r[e].indexOf(i);-1!==a&&r[e].splice(a,1)}}class tO{on(e,i){return this._listeners=this._listeners||{},tL(e,i,this._listeners),this}off(e,i){return tk(e,i,this._listeners),tk(e,i,this._oneTimeListeners),this}
1once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},tL(e,i,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,i){let r="string"==typeof e?new tD(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():[])tk(a,e,this._oneTimeListeners),e.call(this,r);let e=this._eventedParent;e&&(eN(r,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),e.fire(r))}else r instanceof tR&&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}}var tB,tF={},tN=function(){if(tB)return tF;tB=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{tF.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<=16777215?[(16711680&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 tF}();class tV{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 tV)return e;if("string"!=typeof e)return;let i=tN.parseCSSColor(e);return i?new tV(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){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})`}toRenderColor(e){let{r:i,g:r,b:a,a:n}=this;return new tU(e,i,r,a,n)}}class tU{constructor(e,i,r,a,n){if(e){let 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);let 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),E=4*(c+d*s+p*o);if(y<0||E>=g.length)throw Error("out of range");this.r=tj(tj(tj(g[y],g[x],_),tj(g[v],g[b],_),m),tj(tj(g[w],g[T],_),tj(g[S],g[E],_),m),f)/255*n,this.g=tj(tj(tj(g[y+1],g[x+1],_),tj(g[v+1],g[b+1],_),m),tj(tj(g[w+1],g[T+1],_),tj(g[S+1],g[E+1],_),m),f)/255*n,this.b=tj(tj(tj(g[y+2],g[x+2],_),tj(g[v+2],g[b+2],_),m),tj(tj(g[w+2],g[T+2],_),tj(g[S+2],g[E+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]}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 tj(e,i,r){return e*(1-r)+i*r}function tG(e,i,r){return e.map((e,a)=>tj(e,i[a],r))}tV.black=new tV(0,0,0,1),tV.white=new tV(1,1,1,1),tV.transparent=new tV(0,0,0,0),tV.red=new tV(1,0,0,1),tV.blue=new tV(0,0,1,1);var tq=Object.freeze({__proto__:null,array:tG,color:function(e,i,r){return new tV(tj(e.r,i.r,r),tj(e.g,i.g,r),tj(e.b,i.b,r),tj(e.a,i.a,r))},number:tj});function tZ(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}class t$ extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class tH{constructor(e,i=[]){for(let[r,a]of(this.parent=e,this.bindings={},i))this.bindings[r]=a}concat(e){return new tH(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 tW={kind:"null"},tX={kind:"number"},tY={kind:"string"},tJ={kind:"boolean"},tK={kind:"color"},tQ={kind:"object"},t0={kind:"value"},t1={kind:"collator"},t2={kind:"formatted"},t3={kind:"resolvedImage"};function t4(e,i){return{kind:"array",itemType:e,N:i}}function t5(e){if("array"===e.kind){let i=t5(e.itemType);return"number"==typeof e.N?`array<${i}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${i}>`}return e.kind}let t6=[tW,tX,tY,tJ,tK,t2,tQ,t4(t0),t3];function t8(e,i){if("error"===i.kind)return null;if("array"===e.kind){if("array"===i.kind&&(0===i.N&&"value"===i.itemType.kind||!t8(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 t6)if(!t8(e,i))return null}}return`Expected ${t5(e)} but found ${t5(i)} instead.`}function t9(e,i){return i.some(i=>i.kind===e.kind)}function t7(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 ie{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 it{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 ii{constructor(e){this.sections=e}static fromString(e){return new ii([new it(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.namePrimary.length)}static factory(e){return e instanceof ii?e:ii.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){e.push(["image",i.image.namePrimary]);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 ir{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,i){return e?new ir({namePrimary:e,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function ia(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 io(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof tV||e instanceof ie||e instanceof ii||e instanceof ir)return!0;
1if(Array.isArray(e)){for(let i of e)if(!io(i))return!1;return!0}if("object"==typeof e){for(let i in e)if(!io(e[i]))return!1;return!0}return!1}function is(e){if(null===e)return tW;if("string"==typeof e)return tY;if("boolean"==typeof e)return tJ;if("number"==typeof e)return tX;if(e instanceof tV)return tK;if(e instanceof ie)return t1;if(e instanceof ii)return t2;if(e instanceof ir)return t3;if(Array.isArray(e)){let i;let r=e.length;for(let r of e){let e=is(r);if(i){if(i===e)continue;i=t0;break}i=e}return t4(i||t0,r)}return tQ}function il(e){let i=typeof e;return null===e?"":"string"===i||"number"===i||"boolean"===i?String(e):e instanceof tV||e instanceof ii||e instanceof ir?e.toString():JSON.stringify(e)}class ih{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(!io(e[1]))return i.error("invalid value");let r=e[1],a=is(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 ih(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 tV?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof ii?this.value.serialize():this.value}}class iu{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}let ic={string:tY,number:tX,boolean:tJ,object:tQ};class id{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 ic)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);n=ic[r],a++}else n=t0;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=t4(n,o)}else r=ic[n];let o=[];for(;a<e.length;a++){let r=i.parse(e[a],a,t0);if(!r)return null;o.push(r)}return new id(r,o)}evaluate(e){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(e);if(!t8(this.type,is(r)))return r;if(i===this.args.length-1)throw new iu(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${t5(is(r))} but was expected to be of type ${t5(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 ip{constructor(e){this.type=t2,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",tX)))return null;let s=null;if(o["text-font"]&&!(s=i.parseObjectValue(o["text-font"],r,"text-font",t4(tY))))return null;let l=null;if(o["text-color"]&&!(l=i.parseObjectValue(o["text-color"],r,"text-color",tK)))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,t0);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 ip(a)}evaluate(e){return new ii(this.sections.map(i=>{let r=i.content.evaluate(e);return is(r)===t3?new it("",r,null,null,null):new it(il(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 im{constructor(e,i){this.type=t3,this.inputPrimary=e,this.inputSecondary=i}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let r=i.parse(e[1],1,tY);if(!r)return i.error("No image name provided.");if(2===e.length)return new im(r);let a=i.parse(e[2],1,tY);return a?new im(r,a):i.error("Secondary image variant is not a string.")}evaluate(e){let i=ir.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function i_(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}let ig={"to-boolean":tJ,"to-color":tK,"to-number":tX,"to-string":tY};class iy{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=tW;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=t4(i.expectedType.itemType,r)}else{if(!(r>0&&io(e[1][0])))return null;n=t4(is(e[1][0]),r)}for(let o=0;o<r;o++){let r;let s=e[1][o];if("array"===i_(s))r=i.parse(s,void 0,n.itemType);else{let e=i_(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=ig[r];for(let r=1;r<e.length;r++){let n=i.parse(e[r],r,t0);if(!n)return null;a.push(n)}}return new iy(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 tV)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.`:ia(i[0],i[1],i[2],i[3])))return new tV(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new iu(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 iu(`Could not convert ${JSON.stringify(i)} to number.`)}return"formatted"===this.type.kind?ii.fromString(il(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?ir.fromString(il(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(i=>i.evaluate(e)):il(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 ip([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new im(this.args[0]).serialize();let e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}let ix=["Unknown","Point","LineString","Polygon"];class iv{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?ix[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]=tV.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class ib{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=ib.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=ib.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 rh(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 ib(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(iw).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(t5(n.type))}i.error(`Expected arguments of type ${r}, but found (${a.join(", ")}) instead.`)}return null}static register(e,i){for(let r in ib.definitions=i,i)e[r]=ib}}function iw(e){return Array.isArray(e)?`(${e.map(t5).join(", ")})`:`(${t5(e.type)}...)`}class iT{constructor(e,i,r){this.type=t1,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,tJ):i.parseObjectValue(r["case-sensitive"],1,"case-sensitive",tJ);if(!a)return null;let n=void 0===r["diacritic-sensitive"]?i.parse(!1,1,tJ):i.parseObjectValue(r["diacritic-sensitive"],1,"diacritic-sensitive",tJ);if(!n)return null;let o=null;return!r.locale||(o=i.parseObjectValue(r.locale,1,"locale",tY))?new iT(a,n,o):null}evaluate(e){return new ie(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 iS(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function iE(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 iM(e,i){return!(e[0]<=i[0]||e[2]>=i[2]||e[1]<=i[1]||e[3]>=i[3])}function iI(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 iA(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 iC(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]&&!(!iA(e,i,r,a)||
1!iA(r,a,e,i))}function iP(e,i){for(let r=0;r<e.length;++r)if(!iI(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(iC(e,i,a[o],a[r]))return!0;return!1}(e[r],e[r+1],i))return!1;return!0}function iz(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);iE(i,s),o.push(s)}a.push(o)}return a}function iD(e,i,r){let a=[];for(let n=0;n<e.length;n++){let o=iz(e[n],i,r);a.push(o)}return a}function iR(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}iE(i,e)}function iL(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]];iR(a,i,r,n),s.push(a)}return s}function ik(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]];iE(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)iR(a,i,r,n);return s}class iO{constructor(e,i){this.type=tJ,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(io(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 iO(i,i.features[e].geometry)}else if("Feature"===i.type){let e=i.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new iO(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new iO(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=iz(i.coordinates,a,n),s=iL(e.geometry(),r,a,n);if(!iM(r,a))return!1;for(let e of s)if(!iI(e,o))return!1}if("MultiPolygon"===i.type){let o=iD(i.coordinates,a,n),s=iL(e.geometry(),r,a,n);if(!iM(r,a))return!1;for(let e of s)if(!function(e,i){for(let r=0;r<i.length;r++)if(iI(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=iz(i.coordinates,a,n),s=ik(e.geometry(),r,a,n);if(!iM(r,a))return!1;for(let e of s)if(!iP(e,o))return!1}if("MultiPolygon"===i.type){let o=iD(i.coordinates,a,n),s=ik(e.geometry(),r,a,n);if(!iM(r,a))return!1;for(let e of s)if(!function(e,i){for(let r=0;r<i.length;r++)if(iP(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 iB={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},iF=1/298.257223563*(2-1/298.257223563),iN=Math.PI/180;class iV{static fromTile(e,i,r){let a=Math.PI*(1-2*(e+.5)/Math.pow(2,i));return new iV(Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/iN,r)}static get units(){return iB}constructor(e,i){if(void 0===e)throw Error("No latitude given.");if(i&&!iB[i])throw Error(`Unknown unit ${i}. Use one of: ${Object.keys(iB).join(", ")}`);let r=6378.137*iN*(i?iB[i]:1),a=Math.cos(e*iN),n=1/(1-iF*(1-a*a)),o=Math.sqrt(n);this.kx=r*o*a,this.ky=r*o*n*(1-iF)}distance(e,i){let r=iG(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(iG(i[0]-e[0])*this.kx,(i[1]-e[1])*this.ky)/iN}destination(e,i,r){let a=r*iN;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+=iG(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 ij(n,o,(i-(r-s))/s)}return e[e.length-1]}pointToSegmentDistance(e,i,r){let[a,n]=i,o=iG(r[0]-a)*this.kx,s=(r[1]-n)*this.ky;if(0!==o||0!==s){let i=(iG(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=iG(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=iG(e[l+1][0]-h)*this.kx,d=(e[l+1][1]-u)*this.ky,p=0;0===c&&0===d||((p=(iG(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=iG(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;!iU(r[s],o[0])&&s<=l&&o.push(r[s]);for(let e=s+1;e<=l;e++)o.push(r[e]);return iU(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(ij(s,l,(e-(a-h))/h)),a>=i)return n.push(ij(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 iG(e[0]-i[0])>=0&&0>=iG(e[0]-i[2])&&e[1]>=i[1]&&e[1]<=i[3]}}function iU(e,i){return e[0]===i[0]&&e[1]===i[1]}function ij(e,i,r){let a=iG(i[0]-e[0]);return[e[0]+a*r,e[1]+(i[1]-e[1])*r]}function iG(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class iq{constructor(e=[],i=(e,i)=>e<i?-1:e>i?1:0){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 iZ(e,i){return i.dist-e.dist}function i$(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 iH(e){return e[1]-e[0]+1}function iW(e,i){let r=e[1]>=e[0]&&e[1]<i;return r||console.warn("Distance Expression: Index is out of range"),r}function iX(e,i){if(e[0]>e[1])return[null,null];let r=iH(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 iY(e,i){let r=[1/0,1/0,-1/0,-1/0];if(!iW(i,e.length))return r;for(let a=i[0];a<=i[1];++a)iE(r,e[a]);return r}function iJ(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)iE(i,e[r][a]);return i}function iK(e,i,r){if(i$(e)||i$(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 iQ(e,i){let r=Math.pow(2,i.z),a=(e.y/8192+i.y)/r;return[(e.x/8192+i.x)/r*360-180,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90]}function i0(e,i,r){let a=r.pointOnLine(i,e).point;return r.distance(e,a)}function i1(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,i0(e[r],o,n))))return 0;return s}function i2(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 i3(e,i){for(let r of e)for(let e=0;e<=r.length-1;++e)if(iI(r[e],i,!0))return!0;return!1}function i4(e,i,r,a,n,o,s){if(null===o||null===s)return;let l=iK(iY(a,o),iY(n,s),r);l<i&&e.push({dist:l,range1:o,range2:s})}function i5(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 iq([{dist:0,range1:[0,e.length-1],range2:[0,r.length-1]}],iZ),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(iH(c)<=h&&iH(d)<=u){if(!iW(c,e.length)||!iW(d,r.length))return NaN;if(i&&a?s=Math.min(s,function(e,i,r,a,n){if(!iW(i,e.length)||!iW(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(iC(e[s],e[s+1],r[i],r[i+1]))return 0;o=Math.min(o,i2(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,i1(r,d,e,c,n)):!i&&a&&(s=Math.min(s,i1(e,c,r,d,n))):s=Math.min(s,function(e,i,r,a,n){if(!iW(i,e.length)||!iW(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=iX(c,i),h=iX(d,a);i4(l,s,n,e,r,o[0],h[0]),i4(l,s,n,e,r,o[0],h[1]),i4(l,s,n,e,r,o[1],h[0]),i4(l,s,n,e,r,o[1],h[1])}}return s}function i6(e,i,r,a,n=1/0){let o=n,s=iY(e,[0,e.length-1]);for(let n of r)if(!(o!==1/0&&iK(s,iY(n,[0,n.length-1]),a)>=o)&&0===(o=Math.min(o,i5(e,i,n,!0,a,o))))break;return o}function i8(e,i,r,a,n=1/0){let o=n,s=iY(e,[0,e.length-1]);for(let n of r){if(o!==1/0&&iK(s,iJ(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 iq([{dist:0,range1:[0,e.length-1],range2:[0,0]}],iZ),l=i?50:100,h=iJ(r);for(;s.length;){let n=s.pop();if(n.dist>=o)continue;let u=n.range1;if(iH(u)<=l){if(!iW(u,e.length))return NaN;if(i){if(0===(o=Math.min(o,function(e,i,r,a){if(!iW(i,e.length))return NaN;for(let a=i[0];a<=i[1];++a)if(iI(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(iC(e[o],e[o+1],i[l],i[r]))return 0;n=Math.min(n,i2(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(iI(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,i0(e,n,r))))break}return a}(e[i],r,a))))return o}else{let r=iX(u,i);if(null!==r[0]){let i=iK(iY(e,r[0]),h,a);i<o&&s.push({dist:i,range1:r[0],range2:[0,0]})}if(null!==r[1]){let i=iK(iY(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 i9(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class i7{constructor(e,i){this.type=tX,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(io(e[1])){let i=e[1];if("FeatureCollection"===i.type){for(let e=0;e<i.features.length;++e)if(i9(i.features[e].geometry.type))return new i7(i,i.features[e].geometry)}else if("Feature"===i.type){if(i9(i.geometry.type))return new i7(i,i.geometry)}else if(i9(i.type))return new i7(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())return function(e,i,r){let a=[];for(let r of e)for(let e of r)a.push(iQ(e,i));let n=new iV(a[0][1],"meters");return"Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type?i5(a,!1,"Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n):"MultiLineString"===r.type?i6(a,!1,r.coordinates,n):"Polygon"===r.type||"MultiPolygon"===r.type?i8(a,!1,"Polygon"===r.type?[r.coordinates]:r.coordinates,n):null}(i,r,this.geometries);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(iQ(a,i));a.push(e)}let n=new iV(a[0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return i6("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=i6(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=i8(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,i){let r,a;let 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]))}return r&&o.push(r),o}(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(iQ(e[a],i));return r}(r[a],i));a.push(e)}let n=new iV(a[0][0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return i8("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=i8(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=iJ(e),o=iJ(i);if(a!==1/0&&iK(n,o,r)>=a)return a;
1if(iM(n,o)){if(i3(e,i))return 0}else if(i3(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(iC(a[o],a[e],n[h],n[i]))return 0;s=Math.min(s,i2(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 re(e,i){switch(e){case"string":return il(i);case"number":return+i;case"boolean":return!!i;case"color":return tV.parse(i);case"formatted":return ii.fromString(il(i));case"resolvedImage":return ir.fromString(il(i))}return i}function rt(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 ri{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=t0),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 ih))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 ih?new ri(r,il(a.value),il(n.value)):i.error("Scope of 'config' expression must be a string literal.")}return new ri(r,il(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=re(a,c)),void 0===c||void 0===s&&void 0===l&&void 0===h||("number"==typeof c?c=rt(c,s,l,h):Array.isArray(c)&&(c=c.map(e=>"number"==typeof e?rt(e,s,l,h):e))),void 0!==n&&void 0!==c&&o&&!o.includes(c)&&(c=u,a&&(c=re(a,c))),(a&&a!==this.type||void 0!==c&&is(c)!==this.type)&&(c=re(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){let e=["config",this.key];return this.scope&&e.concat(this.key),e}}function rr(e){if(e instanceof ib&&("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 iO||e instanceof i7)return!1;let i=!0;return e.eachChild(e=>{i&&!rr(e)&&(i=!1)}),i}function ra(e){if(e instanceof ib&&"feature-state"===e.name)return!1;let i=!0;return e.eachChild(e=>{i&&!ra(e)&&(i=!1)}),i}function rn(e){if(e instanceof ri)return new Set([e.key]);let i=new Set;return e.eachChild(e=>{i=new Set([...i,...rn(e)])}),i}function ro(e,i){if(e instanceof ib&&i.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!ro(e,i)&&(r=!1)}),r}class rs{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 rs(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 rl{constructor(e,i=[],r,a=new tH,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 id(i,[e]):"coerce"===r?new iy(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 ih)&&"resolvedImage"!==n.type.kind&&function e(i){if(i instanceof rs)return e(i.boundExpression);if(i instanceof ib&&"error"===i.name||i instanceof iT||i instanceof iO||i instanceof i7||i instanceof ri)return!1;let r=i instanceof iy||i instanceof id,a=!0;return i.eachChild(i=>{a=r?a&&e(i):a&&i instanceof ih}),!!a&&rr(i)&&ro(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 iv(this._scope,this.options);try{n=new ih(n.type,n.evaluate(e))}catch(e){return this.error(e.message),null}}return n}return iy.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 rl(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 t$(r,e))}checkSubtype(e,i){let r=t8(e,i);return r&&this.error(r),r}}var rh=rl;function ru(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 iu("Input is not a number.");s=l-1}return 0}
1class rc{constructor(e,i,r){for(let[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,tX);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 rc(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[ru(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 rd=4/29,rp=6/29,rf=6/29*3*(6/29),rm=6/29*(6/29)*(6/29),r_=Math.PI/180,rg=180/Math.PI;function ry(e){return e>rm?Math.pow(e,1/3):e/rf+rd}function rx(e){return e>rp?e*e*e:rf*(e-rd)}function rv(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function rb(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function rw(e){let i=rb(e.r),r=rb(e.g),a=rb(e.b),n=ry((.4124564*i+.3575761*r+.1804375*a)/.95047),o=ry((.2126729*i+.7151522*r+.072175*a)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-ry((.0193339*i+.119192*r+.9503041*a)/1.08883)),alpha:e.a}}function rT(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=1*rx(i),new tV(rv(3.2404542*(r=.95047*rx(r))-1.5371385*i-.4985314*(a=1.08883*rx(a))),rv(-.969266*r+1.8760108*i+.041556*a),rv(.0556434*r-.2040259*i+1.0572252*a),e.alpha)}let rS={forward:rw,reverse:rT,interpolate:function(e,i,r){return{l:tj(e.l,i.l,r),a:tj(e.a,i.a,r),b:tj(e.b,i.b,r),alpha:tj(e.alpha,i.alpha,r)}}},rE={forward:function(e){let{l:i,a:r,b:a}=rw(e),n=Math.atan2(a,r)*rg;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*r_,r=e.c;return rT({l:e.l,a:Math.cos(i)*r,b:Math.sin(i)*r,alpha:e.alpha})},interpolate:function(e,i,r){return{h:function(e,i,r){let a=i-e;return e+r*(a>180||a<-180?a-360*Math.round(a/360):a)}(e.h,i.h,r),c:tj(e.c,i.c,r),l:tj(e.l,i.l,r),alpha:tj(e.alpha,i.alpha,r)}}};var rM=Object.freeze({__proto__:null,hcl:rE,lab:rS});class rI{constructor(e,i,r,a,n){for(let[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=rA(i,e.base,r,a);else if("linear"===e.name)n=rA(i,1,r,a);else if("cubic-bezier"===e.name){let o=e.controlPoints;n=new eE(o[0],o[1],o[2],o[3]).solve(rA(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)%2!=0)return i.error("Expected an even number of arguments.");if(!(n=i.parse(n,2,tX)))return null;let s=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=tK: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 c
1omputed 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 rI(l,r,a,n,s):i.error(`Type ${t5(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=ru(i,a),s=rI.interpolationFactor(this.interpolation,a,i[o],i[o+1]),l=r[o].evaluate(e),h=r[o+1].evaluate(e);return"interpolate"===this.operator?tq[this.type.kind.toLowerCase()](l,h,s):"interpolate-hcl"===this.operator?rE.reverse(rE.interpolate(rE.forward(l),rE.forward(h),s)):rS.reverse(rS.interpolate(rS.forward(l),rS.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"].concat(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 rA(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 rC{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 rC(a&&n.some(e=>t8(a,e.type))?t0:r,n)}evaluate(e){let i,r=null,a=0;for(let n of this.args){if(a++,(r=n.evaluate(e))&&r instanceof ir&&!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 rP{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;r.push([n,o])}let a=i.parse(e[e.length-1],e.length-1,i.expectedType,r);return a?new rP(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 rz{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,tX),a=i.parse(e[2],2,t4(i.expectedType||t0));return r&&a?new rz(a.type.itemType,r,a):null}evaluate(e){let i=this.index.evaluate(e),r=this.input.evaluate(e);if(i<0)throw new iu(`Array index out of bounds: ${i} < 0.`);if(i>=r.length)throw new iu(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i!==Math.floor(i))throw new iu(`Array index must be an integer, but found ${i} instead.`);return r[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class rD{constructor(e,i){this.type=tJ,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,t0),a=i.parse(e[2],2,t0);return r&&a?t9(r.type,[tJ,tY,tX,tW,t0])?new rD(r,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${t5(r.type)} instead`):null}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!t7(i,["boolean","string","number","null"]))throw new iu(`Expected first argument to be of type boolean, string, number or null, but found ${t5(is(i))} instead.`);if(!t7(r,["string","array"]))throw new iu(`Expected second argument to be of type array or string, but found ${t5(is(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 rR{constructor(e,i,r){this.type=tX,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,t0),a=i.parse(e[2],2,t0);if(!r||!a)return null;if(!t9(r.type,[tJ,tY,tX,tW,t0]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${t5(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,tX);return n?new rR(r,a,n):null}return new rR(r,a)}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!t7(i,["boolean","string","number","null"]))throw new iu(`Expected first argument to be of type boolean, string, number or null, but found ${t5(is(i))} instead.`);if(!t7(r,["string","array"]))throw new iu(`Expected second argument to be of type array or string, but found ${t5(is(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 rL{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,is(e)))return null}else r=is(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,t0);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 rL(r,a,s,n,o,l):null}evaluate(e){let i=this.input.evaluate(e);return(is(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 rk{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,tJ);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 rk(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 rO{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,t0),a=i.parse(e[2],2,tX);if(!r||!a)return null;if(!t9(r.type,[t4(t0),tY,t0]))return i.error(`Expected first argument to be of type array or string, but found ${t5(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,tX);return n?new rO(r.type,r,a,n):null}return new rO(r.type,r,a)}evaluate(e){let i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!t7(i,["string","array"]))throw new iu(`Expected first argument to be of type array or string, but found ${t5(is(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 rB(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 rF(e,i,r,a){return 0===a.compare(i,r)}function rN(e,i,r){let a="=="!==e&&"!="!==e;
1return class n{constructor(e,i,r){this.type=tJ,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,t0);if(!o)return null;if(!rB(r,o.type))return i.concat(1).error(`"${r}" comparisons are not supported for type '${t5(o.type)}'.`);let s=i.parse(e[2],2,t0);if(!s)return null;if(!rB(r,s.type))return i.concat(2).error(`"${r}" comparisons are not supported for type '${t5(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return i.error(`Cannot compare types '${t5(o.type)}' and '${t5(s.type)}'.`);a&&("value"===o.type.kind&&"value"!==s.type.kind?o=new id(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new id(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,t1)))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=is(o),r=is(s);if(i.kind!==r.kind||"string"!==i.kind&&"number"!==i.kind)throw new iu(`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=is(o),r=is(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 rV=rN("==",function(e,i,r){return i===r},rF),rU=rN("!=",function(e,i,r){return i!==r},function(e,i,r,a){return!rF(0,i,r,a)}),rj=rN("<",function(e,i,r){return i<r},function(e,i,r,a){return 0>a.compare(i,r)}),rG=rN(">",function(e,i,r){return i>r},function(e,i,r,a){return a.compare(i,r)>0}),rq=rN("<=",function(e,i,r){return i<=r},function(e,i,r,a){return 0>=a.compare(i,r)}),rZ=rN(">=",function(e,i,r){return i>=r},function(e,i,r,a){return a.compare(i,r)>=0});class r${constructor(e,i,r,a,n,o){this.type=tY,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,tX);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",tY)))return null;let o=null;if(a.currency&&!(o=i.parseObjectValue(a.currency,2,"currency",tY)))return null;let s=null;if(a.unit&&!(s=i.parseObjectValue(a.unit,2,"unit",tY)))return null;let l=null;if(a["min-fraction-digits"]&&!(l=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",tX)))return null;let h=null;return!a["max-fraction-digits"]||(h=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",tX))?new r$(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 rH{constructor(e){this.type=tX,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 ${t5(r.type)} instead.`):new rH(r):null}evaluate(e){let i=this.input.evaluate(e);if("string"==typeof i||Array.isArray(i))return i.length;throw new iu(`Expected value to be of type string or array, but found ${t5(is(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){let e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function rW(e){return function(){let i=Math.imul((e=1831565813+(e|=0)|0)^e>>>15,1|e);return(((i=i+Math.imul(i^i>>>7,61|i)^i)^i>>>14)>>>0)/4294967296}}let rX={"==":rV,"!=":rU,">":rG,"<":rj,">=":rZ,"<=":rq,array:id,at:rz,boolean:id,case:rk,coalesce:rC,collator:iT,format:ip,image:im,in:rD,"index-of":rR,interpolate:rI,"interpolate-hcl":rI,"interpolate-lab":rI,length:rH,let:rP,literal:ih,match:rL,number:id,"number-format":r$,object:id,slice:rO,step:rc,string:id,"to-boolean":iy,"to-color":iy,"to-number":iy,"to-string":iy,var:rs,within:iO,distance:i7,c
1onfig:ri};function rY(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=ia(i,r,a,o);if(s)throw new iu(s);return new tV(i/255*o,r/255*o,a/255*o,o)}function rJ(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 iu(u);let c=`hsla(${i}, ${r}%, ${a}%, ${h})`,d=tV.parse(c);if(!d)throw new iu(`Failed to parse HSLA color: ${c}`);return d}function rK(e,i){let r=i[e];return void 0===r?null:r}function rQ(e){return{type:e}}function r0(e){return{result:"success",value:e}}function r1(e){return{result:"error",value:e}}function r2(e,i){return!!e&&!!e.parameters&&e.parameters.indexOf(i)>-1}function r3(e){return"data-driven"===e["property-type"]}function r4(e){return r2(e.expression,"measure-light")}function r5(e){return r2(e.expression,"zoom")}function r6(e){return!!e.expression&&e.expression.interpolated}function r8(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function r9(e){return e}function r7(e,i,r){return void 0!==e?e:void 0!==i?i:void 0!==r?r:void 0}function ae(e,i,r,a,n){return r7(typeof r===n?a[r]:void 0,e.default,i.default)}function at(e,i,r){if("number"!==i_(r))return r7(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=ru(e.stops.map(e=>e[0]),r);return e.stops[n][1]}function ai(e,i,r){let a=void 0!==e.base?e.base:1;if("number"!==i_(r))return r7(e.default,i.default);let n=e.stops.length;if(1===n||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let o=ru(e.stops.map(e=>e[0]),r),s=function(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)}(r,a,e.stops[o][0],e.stops[o+1][0]),l=e.stops[o][1],h=e.stops[o+1][1],u=tq[i.type]||r9;if(e.colorSpace&&"rgb"!==e.colorSpace){let i=rM[e.colorSpace];u=(e,r)=>i.reverse(i.interpolate(i.forward(e),i.forward(r),s))}return"function"==typeof l.evaluate?{evaluate(...e){let i=l.evaluate.apply(void 0,e),r=h.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return u(i,r,s)}}:u(l,h,s)}function ar(e,i,r){return"color"===i.type?r=tV.parse(r):"formatted"===i.type?r=ii.fromString(r.toString()):"resolvedImage"===i.type?r=ir.fromString(r.toString()):i_(r)===i.type||"enum"===i.type&&i.values[r]||(r=void 0),r7(r,e.default,i.default)}ib.register(rX,{error:[{kind:"error"},[tY],(e,[i])=>{throw new iu(i.evaluate(e))}],typeof:[tY,[t0],(e,[i])=>t5(is(i.evaluate(e)))],"to-rgba":[t4(tX,4),[tK],(e,[i])=>i.evaluate(e).toRenderColor(null).toArray()],rgb:[tK,[tX,tX,tX],rY],rgba:[tK,[tX,tX,tX,tX],rY],hsl:[tK,[tX,tX,tX],rJ],hsla:[tK,[tX,tX,tX,tX],rJ],has:{type:tJ,overloads:[[[tY],(e,[i])=>i.evaluate(e) in e.properties()],[[tY,tQ],(e,[i,r])=>i.evaluate(e) in r.evaluate(e)]]},get:{type:t0,overloads:[[[tY],(e,[i])=>rK(i.evaluate(e),e.properties())],[[tY,tQ],(e,[i,r])=>rK(i.evaluate(e),r.evaluate(e))]]},"feature-state":[t0,[tY],(e,[i])=>rK(i.evaluate(e),e.featureState||{})],properties:[tQ,[],e=>e.properties()],"geometry-type":[tY,[],e=>e.geometryType()],id:[t0,[],e=>e.id()],zoom:[tX,[],e=>e.globals.zoom],pitch:[tX,[],e=>e.globals.pitch||0],"distance-from-center":[tX,[],e=>e.distanceFromCenter()],"measure-light":[tX,[tY],(e,[i])=>e.measureLight(i.evaluate(e))],"heatmap-density":[tX,[],e=>e.globals.heatmapDensity||0],"line-progress":[tX,[],e=>e.globals.lineProgress||0],"raster-value":[tX,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[tX,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[tX,[],e=>e.globals.skyRadialProgress||0],accumulated:[t0,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[tX,rQ(tX),(e,i)=>{let r=0;for(let a of i)r+=a.evaluate(e);return r}],"*":[tX,rQ(tX),(e,i)=>{let r=1;for(let a of i)r*=a.evaluate(e);return r}],"-":{type:tX,overloads:[[[tX,tX],(e,[i,r])=>i.evaluate(e)-r.evaluate(e)],[[tX],(e,[i])=>-i.evaluate(e)]]},"/":[tX,[tX,tX],(e,[i,r])=>i.evaluate(e)/r.evaluate(e)],"%":[tX,[tX,tX],(e,[i,r])=>i.evaluate(e)%r.evaluate(e)],ln2:[tX,[],()=>Math.LN2],pi:[tX,[],()=>Math.PI],e:[tX,[],()=>Math.E],"^":[tX,[tX,tX],(e,[i,r])=>Math.pow(i.evaluate(e),r.evaluate(e))],sqrt:[tX,[tX],(e,[i])=>Math.sqrt(i.evaluate(e))],log10:[tX,[tX],(e,[i])=>Math.log(i.evaluate(e))/Math.LN10],ln:[tX,[tX],(e,[i])=>Math.log(i.evaluate(e))],log2:[tX,[tX],(e,[i])=>Math.log(i.evaluate(e))/Math.LN2],sin:[tX,[tX],(e,[i])=>Math.sin(i.evaluate(e))],cos:[tX,[tX],(e,[i])=>Math.cos(i.evaluate(e))],tan:[tX,[tX],(e,[i])=>Math.tan(i.evaluate(e))],asin:[tX,[tX],(e,[i])=>Math.asin(i.evaluate(e))],acos:[tX,[tX],(e,[i])=>Math.acos(i.evaluate(e))],atan:[tX,[tX],(e,[i])=>Math.atan(i.evaluate(e))],min:[tX,rQ(tX),(e,i)=>Math.min(...i.map(i=>i.evaluate(e)))],max:[tX,rQ(tX),(e,i)=>Math.max(...i.map(i=>i.evaluate(e)))],abs:[tX,[tX],(e,[i])=>Math.abs(i.evaluate(e))],round:[tX,[tX],(e,[i])=>{let r=i.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[tX,[tX],(e,[i])=>Math.floor(i.evaluate(e))],ceil:[tX,[tX],(e,[i])=>Math.ceil(i.evaluate(e))],"filter-==":[tJ,[tY,t0],(e,[i,r])=>e.properties()[i.value]===r.value],"filter-id-==":[tJ,[t0],(e,[i])=>e.id()===i.value],"filter-type-==":[tJ,[tY],(e,[i])=>e.geometryType()===i.value],"filter-<":[tJ,[tY,t0],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<n}],"filter-id-<":[tJ,[t0],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<a}],"filter->":[tJ,[tY,t0],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>n}],"filter-id->":[tJ,[t0],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>a}],"filter-<=":[tJ,[tY,t0],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<=n}],"filter-id-<=":[tJ,[t0],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<=a}],"filter->=":[tJ,[tY,t0],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>=n}],"filter-id->=":[tJ,[t0],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>=a}],"filter-has":[tJ,[t0],(e,[i])=>i.value in e.properties()],"filter-has-id":[tJ,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[tJ,[t4(tY)],(e,[i])=>i.value.indexOf(e.geometryType())>=0],"filter-id-in":[tJ,[t4(t0)],(e,[i])=>i.value.indexOf(e.id())>=0],"filter-in-small":[tJ,[tY,t4(t0)],(e,[i,r])=>r.value.indexOf(e.properties()[i.value])>=0],"filter-in-large":[tJ,[tY,t4(t0)],(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:tJ,overloads:[[[tJ,tJ],(e,[i,r])=>i.evaluate(e)&&r.evaluate(e)],[rQ(tJ),(e,i)=>{for(let r of i)if(!r.evaluate(e))return!1;return!0}]]},any:{type:tJ,overloads:[[[tJ,tJ],(e,[i,r])=>i.evaluate(e)||r.evaluate(e)],[rQ(tJ),(e,i)=>{for(let r of i)if(r.evaluate(e))return!0;return!1}]]},"!":[tJ,[tJ],(e,[i])=>!i.evaluate(e)],"is-supported-script":[tJ,[tY],(e,[i])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[tY,[tY],(e,[i])=>i.evaluate(e).toUpperCase()],downcase:[tY,[tY],(e,[i])=>i.evaluate(e).toLowerCase()],concat:[tY,rQ(t0),(e,i)=>i.map(i=>il(i.evaluate(e))).join("")],"resolved-locale":[tY,[t1],(e,[i])=>i.evaluate(e).resolvedLocale()],random:[tX,[tX,tX,t0],(e,i)=>{let r;let[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 iu(`Invalid seed input: ${o}`);r=o}return a+rW(r)()*(n-a)}]});class aa{constructor(e,i,r,a){this.expression=e,this._warningHistory={},this._evaluator=new iv(r,a),this._defaultValue=i?"color"===i.type&&(r8(i.default)||Array.isArray(i.default))?new tV(0,0,0,0):"color"===i.type?tV.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=i&&"enum"===i.type?i.values:null}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 iu(`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,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function an(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in rX}function ao(e,i,r,a){let n=new rh(rX,[],i?function(e){let i={color:tK,string:tY,number:tX,enum:tY,boolean:tJ,formatted:t2,resolvedImage:t3};return"array"===e.type?t4(i[e.value]||t0,e.length):i[e.type]}(i):void 0,void 0,void 0,r,a),o=n.parse(e,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return o?r0(new aa(o,i,r,a)):r1(n.errors)}class as{constructor(e,i,r){this.kind=e,this._styleExpression=i,this.isLightConstant=r,this.isStateDependent="constant"!==e&&!ra(i.expression),this.configDependencies=rn(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 al{constructor(e,i,r,a,n){this.kind=e,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==e&&!ra(i.expression),this.isLightConstant=n,this.configDependencies=rn(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?rI.interpolationFactor(this.interpolationType,e,i,r):0}}function ah(e,i,r,a){if("error"===(e=ao(e,i,r,a)).result)return e;let n=e.value.expression,o=rr(n);if(!o&&!r3(i))return r1([new t$("","data expressions not supported")]);let s=ro(n,["zoom","pitch","distance-from-center"]);if(!s&&!r5(i))return r1([new t$("","zoom expressions not supported")]);let l=ro(n,["measure-light"]);if(!l&&!r4(i))return r1([new t$("","measure-light expression not supported")]);let h=i.expression&&i.expression.relaxZoomRestriction,u=function e(i){let r=null;if(i instanceof rP)r=e(i.result);else if(i instanceof rC){for(let a of i.args)if(r=e(a))break}else(i instanceof rc||i instanceof rI)&&i.input instanceof ib&&"zoom"===i.input.name&&(r=i);return r instanceof t$||i.eachChild(i=>{let a=e(i);a instanceof t$?r=a:r&&a&&r!==a&&(r=new t$("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}(n);return u||s||h?u instanceof t$?r1([u]):u instanceof rI&&!r6(i)?r1([new t$("",'"interpolate" expressions cannot be used with this property')]):r0(u?new al(o?"camera":"composite",e.value,u.labels,u instanceof rI?u.interpolation:void 0,l):new as(o?"constant":"source",e.value,l)):r1([new t$("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class au{constructor(e,i){this._parameters=e,this._specification=i,tZ(this,function e(i,r){let a,n,o;let s="color"===r.type,l=i.stops&&"object"==typeof i.stops[0][0],h=l||!(l||void 0!==i.property),u=i.type||(r6(r)?"exponential":"interval");if(s&&((i=tZ({},i)).stops&&(i.stops=i.stops.map(e=>[e[0],tV.parse(e[1])])),i.default=tV.parse(i.default?i.default:r.default)),i.colorSpace&&"rgb"!==i.colorSpace&&!rM[i.colorSpace])throw Error(`Unknown color space: ${i.colorSpace}`);if("exponential"===u)a=ai;else if("interval"===u)a=at;else if("categorical"===u){for(let e of(a=ae,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=ar}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:rI.interpolationFactor.bind(void 0,s),zoomStops:o.map(e=>e[0]),evaluate:({zoom:e},a)=>ai({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:rI.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?r7(i.default,r.default):a(i,r,l,n,o)}}}(this._parameters,this._specification))}static deserialize(e){return new au(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}var ac,ad,ap=Z(function(){if(ad)return ac;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 ad=1,ac=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},ac}());let af={};function am(e,i,r={}){Object.defineProperty(e,"_classRegistryKey",{value:i,writable:!1}),af[i]={klass:e,omit:r.omit||[]}}for(let e in am(Object,"Object"),ap.serialize=function(e,i){let r=e.toArrayBuffer();return i&&i.add(r),{buffer:r}},ap.deserialize=function(e){return new ap(e.buffer)},Object.defineProperty(ap,"name",{value:"Grid"}),am(ap,"Grid"),am(tV,"Color"),am(Error,"Error"),am(ii,"Formatted"),am(it,"FormattedSection"),am(tx,"AJAXError"),am(ir,"ResolvedImage"),am(au,"StylePropertyFunction"),am(aa,"StyleExpression",{omit:["_evaluator"]}),am(al,"ZoomDependentExpression"),am(as,"ZoomConstantExpression"),am(ib,"CompoundExpression",{omit:["_evaluate"]}),rX)af[rX[e]._classRegistryKey]||am(rX[e],`Expression${e}`);function a_(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function ag(e){return self.ImageBitmap&&e instanceof ImageBitmap}function ay(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(a_(e)||ag(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(ay(a,i));return r}if(e instanceof Map){let i={$name:"Map"};for(let[r,a]of e.entries())i[r]=ay(a);return i}if(e instanceof Set){let i={$name:"Set"},r=0;for(let a of e.values())i[++r]=ay(a);return i}if("object"==typeof e){let r=e.constructor,a=r._classRegistryKey;if(!a)throw Error(`can't serialize object of unregistered class ${a}`);let n=r.serialize?r.serialize(e,i):{};if(!r.serialize){for(let r in e)e.hasOwnProperty(r)&&(af[a].omit.indexOf(r)>=0||(n[r]=ay(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 ax(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||a_(e)||ag(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(ax);if("object"==typeof e){let i=e.$name||"Object";if("Map"===i){let i=new Map;for(let r of Object.keys(e))"$name"!==r&&i.set(r,ax(e[r]));return i}if("Set"===i){let i=new Set;for(let r of Object.keys(e))"$name"!==r&&i.add(ax(e[r]));return i}let{klass:r}=af[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]=ax(e[i]));return a}throw Error("can't deserialize object of type "+typeof e)}let av={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>
1=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519,"CJK Unified Ideographs Extension B":e=>e>=131072&&e<=173791};function ab(e){for(let i of e)if(aw(i.charCodeAt(0)))return!0;return!1}function aw(e){return!(746!==e&&747!==e&&(e<4352||!(av["Bopomofo Extended"](e)||av.Bopomofo(e)||av["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||av["CJK Compatibility Ideographs"](e)||av["CJK Compatibility"](e)||av["CJK Radicals Supplement"](e)||av["CJK Strokes"](e)||!(!av["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||av["CJK Unified Ideographs Extension A"](e)||av["CJK Unified Ideographs"](e)||av["Enclosed CJK Letters and Months"](e)||av["Hangul Compatibility Jamo"](e)||av["Hangul Jamo Extended-A"](e)||av["Hangul Jamo Extended-B"](e)||av["Hangul Jamo"](e)||av["Hangul Syllables"](e)||av.Hiragana(e)||av["Ideographic Description Characters"](e)||av.Kanbun(e)||av["Kangxi Radicals"](e)||av["Katakana Phonetic Extensions"](e)||av.Katakana(e)&&12540!==e||!(!av["Halfwidth and Fullwidth Forms"](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)||!(!av["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||av["Unified Canadian Aboriginal Syllabics"](e)||av["Unified Canadian Aboriginal Syllabics Extended"](e)||av["Vertical Forms"](e)||av["Yijing Hexagram Symbols"](e)||av["Yi Syllables"](e)||av["Yi Radicals"](e))))}function aT(e){return!(aw(e)||av["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||av["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||av["Letterlike Symbols"](e)||av["Number Forms"](e)||av["Miscellaneous Technical"](e)&&(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)||av["Control Pictures"](e)&&9251!==e||av["Optical Character Recognition"](e)||av["Enclosed Alphanumerics"](e)||av["Geometric Shapes"](e)||av["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||av["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||av["CJK Symbols and Punctuation"](e)||av.Katakana(e)||av["Private Use Area"](e)||av["CJK Compatibility Forms"](e)||av["Small Form Variants"](e)||av["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}function aS(e){return e>=1424&&e<=2303||av["Arabic Presentation Forms-A"](e)||av["Arabic Presentation Forms-B"](e)}let aE="deferred",aM="loading",aI="loaded",aA=null,aC="unavailable",aP=null,az=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(aC="error"),aA&&aA(e)};function aD(){aR.fire(new tD("pluginStateChange",{pluginStatus:aC,pluginURL:aP}))}let aR=new tO,aL=function(){return aC},ak=function(){if(aC!==aE||!aP)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");aC=aM,aD(),aP&&tw({url:aP},e=>{e?az(e):(aC=aI,aD())})},aO={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>aC===aI||null!=aO.applyArabicShaping,isLoading:()=>aC===aM,setState(e){aC=e.pluginStatus,aP=e.pluginURL},isParsed:()=>null!=aO.applyArabicShaping&&null!=aO.processBidirectionalText&&null!=aO.processStyledBidirectionalText,getPluginURL:()=>aP};class aB{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){return function(e,i){for(let a of e){var r;
1if(r=a.charCodeAt(0),!i&&aS(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||av.Khmer(r))return!1}return!0}(e,aO.isLoaded())}}class aF{constructor(e,i,r,a){this.property=e,this.value=i,this.expression=function(e,i,r,a){if(r8(e))return new au(e,i);if(an(e)||Array.isArray(e)&&e.length>0){let n=ah(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=tV.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 aN{constructor(e,i,r){this.property=e,this.value=new aF(e,void 0,i,r)}transitioned(e,i){return new aU(this.property,this.value,i,eN({},e.transition,this.transition),e.now)}untransitioned(){return new aU(this.property,this.value,null,{},0)}}class aV{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 eH(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new aN(this._values[e].property,this._scope,this._options)),this._values[e].value=new aF(this._values[e].property,null===i?void 0:eH(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(eq(i,"-transition")){let e=i.slice(0,-11);r[e]&&this.setTransition(e,a)}else r.hasOwnProperty(i)&&this.setValue(i,a)}}getTransition(e){return eH(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new aN(this._values[e].property)),this._values[e].transition=eH(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 aj(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 aj(this._properties);for(let i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class aU{constructor(e,i,r,a,n){let 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,eD(s))}}return n}}class aj{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,r){let a=new aZ(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 aG{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 eH(this._values[e].value)}setValue(e,i){this._values[e]=new aF(this._values[e].property,null===i?void 0:eH(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 aZ(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}}class aq{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 aZ{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class a${constructor(e){this.specification=e}
1possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,r){let a=tq[this.specification.type];return a?a(e,i,r):e}}class aH{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,r,a){return new aq(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 aq(this,{kind:"constant",value:void 0},e.parameters);let a=tq[this.specification.type];return a?new aq(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 aW{constructor(e){this.specification=e}possiblyEvaluate(e,i,r,a){return!!e.expression.evaluate(i,null,{},r,a)}interpolate(){return!1}}class aX{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];let i=new aB(0,{});for(let r in e){let a=e[r];a.specification.overridable&&this.overridableProperties.push(r);let n=this.defaultPropertyValues[r]=new aF(a,void 0),o=this.defaultTransitionablePropertyValues[r]=new aN(a);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=n.possiblyEvaluate(i)}}}am(aH,"DataDrivenProperty"),am(a$,"DataConstantProperty"),am(aW,"ColorRampProperty");var aY=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"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"imports":{"type":"array","value":"import"},"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,"selectors":{"type":"array","value":"selector"}},"selector":{"experimental":true,"layer":{"type":"string","required":true},"properties":{"type":"selectorProperty","required":false},"featureNamespace":{"type":"string","required":false}},"selectorProperty":{"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"}},"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-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}},"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}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"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":{"experimental":true}},"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","experimental":true},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{},"property-type":"data-constant","experimental":true}},"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"}},"layout_circle":{"circle-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"}},"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,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"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"},"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-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-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_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}}},"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":{}}},"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":{"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"}},"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-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"},"lin
1e-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"]},"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"},"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"},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1},"default":"ground","experimental":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"}},"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":[]},"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":
1{"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":{"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":["zoom"]},"property-type":"data-constant"},"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":"string"}}}');function aJ(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function aK(e){if(Array.isArray(e))return e.map(aK);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let i={};for(let r in e)i[r]=aK(e[r]);return i}return aJ(e)}function aQ(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(!aQ(i)&&"boolean"!=typeof i)return!1;return!0;default:return!0}}function a0(e,i="",r=null,a="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};aQ(e)||(e=function e(i){if(!i)return!0;let r=i[0];return i.length<=1?"any"!==r:"=="===r?a4(i[1],i[2],"=="):"!="===r?a8(a4(i[1],i[2],"==")):"<"===r||">"===r||"<="===r||">="===r?a4(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(a8)):"in"===r?a5(i[1],i.slice(2)):"!in"===r?a8(a5(i[1],i.slice(2))):"has"===r?a6(i[1]):"!has"!==r||a8(a6(i[1]))}(e));let n=e,o=!0;try{o=function(e){if(!a1(e))return e;let i=aK(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||a1(i[e]),a.push(i[e+1]);a.push(i[i.length-1])}else if("match"===i[0]){r=r||a1(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||a1(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(a2.has(e[0])){for(let i=1;i<e.length;i++)if(a1(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=aY[`filter_${a}`],l=ao(o,s,i,r),h=null;if("error"===l.result)throw Error(l.value.map(e=>`${e.key}: ${e.message}`).join(", "));h=(e,i,r)=>l.value.evaluate(e,i,{},r);let u=null,c=null;if(o!==n){let e=ao(n,s,i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));u=(i,r,a,n,o)=>e.value.evaluate(i,r,{},a,void 0,void 0,n,o),c=!rr(e.value.expression)}return{filter:h,dynamicFilter:u||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:!!c}}function a1(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(a1(e[i]))return!0;return!1}let a2=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function a3(e,i){return e<i?-1:e>i?1:0}function a4(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 a5(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(a3)]]:["filter-in-small",e,["literal",i]]}}function a6(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function a8(e){return["!",e]}function a9(e,i){return i?`${e}�${i}`:e}let a7="-transition",ne=new Set(["fill","line","background","hillshade","raster"]);class nt extends tO{constructor(e,i,r,a,n){if(super(),this.id=e.id,this.fqid=a9(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&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new aG(i.layout,this.scope,n),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint)){for(let r in this._transitionablePaint=new aV(i.paint,this.scope,n),e.paint)this.setPaintProperty(r,e.paint[r]);for(let 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 aZ(i.paint)}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D()&&ne.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.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(e){return eq(e,a7)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){let r=this._transitionablePaint,a=r._properties.properties;if(eq(e,a7)){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=eq(e,"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 e$({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(void 0===e||"layout"===i&&!Object.keys(e).length||"paint"===i&&!Object.keys(e).length))}is3D(){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 aq&&r3(i.property.specification)&&("source"===i.value.kind||"composite"===i.value.kind)&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=a0(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){}queryIntersectsMatchingFeature(e,i,r,a){}}let ni={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
7class nr{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 na{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(...e){throw Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){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 nn(e,i=1){let r=0,a=0;return{members:e.map(e=>{let n=ni[e.type].BYTES_PER_ELEMENT,o=r=no(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:no(r,Math.max(a,i)),alignment:i}}function no(e,i){return Math.ceil(e/i)*i}class ns extends na{_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}}ns.prototype.bytesPerElement=4,am(ns,"StructArrayLayout2i4");class nl extends na{_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}}nl.prototype.bytesPerElement=6,am(nl,"StructArrayLayout3i6");class nh extends na{_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}}nh.prototype.bytesPerElement=8,am(nh,"StructArrayLayout4i8");class nu extends na{_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}}nu.prototype.bytesPerElement=10,am(nu,"StructArrayLayout5i10");class nc extends na{_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}}nc.prototype.bytesPerElement=12,am(nc,"StructArrayLayout2i4ub1f12");class nd extends na{_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}}nd.prototype.bytesPerElement=16,am(nd,"StructArrayLayout4f16");class np extends na{_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}}np.prototype.bytesPerElement=12,am(np,"StructArrayLayout3f12");class nf extends na{_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}}nf.prototype.bytesPerElement=12,am(nf,"StructArrayLayout4ui1f12");class nm extends na{_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}}nm.prototype.bytesPerElement=8,am(nm,"StructArrayLayout4ui8");class n_ extends na{_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}}n_.prototype.bytesPerElement=12,am(n_,"StructArrayLayout6i12");class ng extends na{_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}}ng.prototype.bytesPerElement=24,am(ng,"StructArrayLayout4i4ui4i24");class ny extends na{_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}}ny.prototype.bytesPerElement=20,am(ny,"StructArrayLayout3i3f20");class nx extends na{_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[1*e+0]=i,e}}nx.prototype.bytesPerElement=4,am(nx,"StructArrayLayout1ul4");class nv extends na{_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}}nv.prototype.bytesPerElement=4,am(nv,"StructArrayLayout2ui4");class nb extends na{_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}}nb.prototype.bytesPerElement=40,am(nb,"StructArrayLayout5i4f1i1ul2ui40");class nw extends na{_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}}nw.prototype.bytesPerElement=16,am(nw,"StructArrayLayout3i2i2i16");class nT extends na{_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}}nT.prototype.bytesPerElement=16,am(nT,"StructArrayLayout2f1f2i16");class nS extends na{_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}}nS.prototype.bytesPerElement=20,am(nS,"StructArrayLayout2ub4f20");class nE extends na{_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}}nE.prototype.bytesPerElement=6,am(nE,"StructArrayLayout3ui6");class nM extends na{_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,E=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[E+48]=g,this.uint8[E+49]=y,this.uint8[E+50]=x,this.uint32[S+13]=v,this.int16[T+28]=b,this.uint8[E+58]=w,e}}nM.prototype.bytesPerElement=60,am(nM,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class nI extends na{_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,E,M,I,A,C,P,z,D){let R=this.length;return this.resize(R+1),this.emplace(R,e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,M,I,A,C,P,z,D)}emplace(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,M,I,A,C,P,z,D,R){let L=20*e,k=40*e;return this.float32[L+0]=i,this.float32[L+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]=E,this.uint16[k+26]=M,this.uint16[k+27]=I,this.uint32[L+14]=A,this.float32[L+15]=C,this.float32[L+16]=P,this.float32[L+17]=z,this.float32[L+18]=D,this.uint8[80*e+76]=R,e}}nI.prototype.bytesPerElement=80,am(nI,"StructArrayLayout2f9i15ui1ul4f1ub80");class nA extends na{_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[1*e+0]=i,e}}nA.prototype.bytesPerElement=4,am(nA,"StructArrayLayout1f4");class nC extends na{_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}}nC.prototype.bytesPerElement=20,am(nC,"StructArrayLayout5f20");class nP extends na{_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}}nP.prototype.bytesPerElement=28,am(nP,"StructArrayLayout7f28");class nz extends na{_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;
vendor: 5,875 bytes, line 7
7return this.uint32[3*e+0]=i,this.uint16[o+2]=r,this.uint16[o+3]=a,this.uint16[o+4]=n,e}}nz.prototype.bytesPerElement=12,am(nz,"StructArrayLayout1ul3ui12");class nD extends na{_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[1*e+0]=i,e}}nD.prototype.bytesPerElement=2,am(nD,"StructArrayLayout1ui2");class nR extends na{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(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.float32[a+0]=i,this.float32[a+1]=r,e}}nR.prototype.bytesPerElement=8,am(nR,"StructArrayLayout2f8");class nL extends na{_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}}nL.prototype.bytesPerElement=64,am(nL,"StructArrayLayout16f64");class nk extends na{_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}}nk.prototype.bytesPerElement=20,am(nk,"StructArrayLayout4ui3f20");class nO extends na{_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[1*e+0]=i,e}}nO.prototype.bytesPerElement=2,am(nO,"StructArrayLayout1i2");class nB extends na{_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[1*e+0]=i,e}}nB.prototype.bytesPerElement=1,am(nB,"StructArrayLayout1ub1");class nF extends nr{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]}}nF.prototype.size=40;class nN extends nb{get(e){return new nF(this,e)}}am(nN,"CollisionBoxArray");class nV extends nr{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}nV.prototype.size=60;class nU extends nM{get(e){return new nV(this,e)}}am(nU,"PlacedSymbolArray");class nj extends nr{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]}
7get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}nj.prototype.size=80;class nG extends nI{get(e){return new nj(this,e)}}am(nG,"SymbolInstanceArray");class nq extends nA{getoffsetX(e){return this.float32[1*e+0]}}am(nq,"GlyphOffsetArray");class nZ extends ns{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}am(nZ,"SymbolLineVertexArray");class n$ extends nr{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]}}n$.prototype.size=12;class nH extends nz{get(e){return new n$(this,e)}}am(nH,"FeatureIndexArray");class nW extends nv{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}am(nW,"FillExtrusionCentroidArray");class nX extends nr{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]}}nX.prototype.size=6;class nY extends nl{get(e){return new nX(this,e)}}am(nY,"FillExtrusionWallArray");let nJ=nn([{name:"a_pos",components:2,type:"Int16"}],4),nK=nn([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class nQ{constructor(e=[]){this.segments=e}_prepareSegment(e,i,r,a){let n=this.segments[this.segments.length-1];return e>nQ.MAX_VERTEX_ARRAY_LENGTH&&eX(`Max vertices per segment is ${nQ.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>nQ.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 nQ([{vertexOffset:e,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}}function n0(e,i){return 256*(e=ek(Math.floor(e),0,255))+ek(Math.floor(i),0,255)}nQ.MAX_VERTEX_ARRAY_LENGTH=65535,am(nQ,"SegmentVector");let n1=nn([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),n2=nn([{name:"a_dash",components:4,type:"Uint16"}]);
7class n3{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,r,a){this.ids.push(n4(e)),this.positions.push(i,r,a)}eachPosition(e,i){let r=n4(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;n5(i,s,l),n5(r,3*s,3*l),n5(r,3*s+1,3*l+1),n5(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;let r=new n3;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 n4(e){let i=+e;return!isNaN(i)&&Number.MIN_SAFE_INTEGER<=i&&i<=Number.MAX_SAFE_INTEGER?i:tz(String(e))}function n5(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}am(n3,"FeaturePositionMap");class n6{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 n8 extends n6{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 n9 extends n6{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 n7 extends n6{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 oe extends n6{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 ot extends n6{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 oi extends n6{constructor(e){super(e),this.current=tV.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 or=new Float32Array(16);class oa extends n6{constructor(e){super(e),this.current=or}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 on=new Float32Array(9),oo=new Float32Array(4);class os extends n6{constructor(e){super(e),this.current=oo}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 ol(e){return[n0(255*e.r,255*e.g),n0(255*e.b,255*e.a)]}class oh{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 tV?o.toRenderColor(this.context.lut):o)}getBinding(e,i){return"color"===this.type?new oi(e):new n9(e)}}class ou{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 ot(e):new n9(e)}}class oc{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=this.expression.evaluate(new aB(0,{brightness:o}),i,{},n,a,s);this.paintVertexArray.resize(e),this._setPaintValue(l,e,h,this.context)}updatePaintArray(e,i,r,a,n,o,s){let l=this.expression.evaluate({zoom:0,brightness:s},r,a,void 0,n);this._setPaintValue(e,i,l,this.context)}_setPaintValue(e,i,r,a){if("color"===this.type){let n=ol(r.toRenderColor(a.lut));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.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class od{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 aB(this.context.zoom,{brightness:o}),i,{},n,a,s),h=this.expression.evaluate(new aB(this.context.zoom+1,{brightness:o}),i,{},n,a,s),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,l,h,this.context)}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);this._setPaintValue(e,i,l,h,this.context)}_setPaintValue(e,i,r,a,n){if("color"===this.type){let a=ol(r.toRenderColor(n.lut)),o=ol(r.toRenderColor(n.lut));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);
7this.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=ek(this.expression.interpolationFactor(o,this.context.zoom,this.context.zoom+1),0,1);i.set(e,n,s)}getBinding(e,i){return new n9(e)}}class op{constructor(e,i,r,a,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===r?n2:n1).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 of{constructor(e,i,r=()=>!0){this.binders={},this._buffers=[],this.context=i;let a=[];for(let o in e.paint._values){var n;let s=e.paint.get(o);if(!r(o)||!(s instanceof aq&&r3(s.property.specification)))continue;let l=(n=e.type,o_[o]||[o.replace(`${n}-`,"").replace(/-/g,"_")]),h=s.value,u=s.property.specification.type,c=!!s.property.useIntegerZoom,d="line-dasharray"===o||o.endsWith("pattern"),p="line-dasharray"===o&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==h.kind||p){if("source"===h.kind||p||d){let i=ox(o,u,"source");this.binders[o]=d?new op(h,l,u,i,e.id):new oc(h,l,u,i),a.push(`/a_${o}`)}else{let e=ox(o,u,"composite");this.binders[o]=new od(h,l,u,c,i,e),a.push(`/z_${o}`)}}else this.binders[o]=d?new ou(h.value,l):new oh(h.value,l,u,i),a.push(`/u_${o}`)}this.cacheKey=a.sort().join("")}getMaxValue(e){let i=this.binders[e];return i instanceof oc||i instanceof od?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 oc||h instanceof od||h instanceof op)&&h.populatePaintArray(e,i,r,a,n,o,s)}}setConstantPatternPositions(e){for(let i in this.binders){let r=this.binders[i];r instanceof ou&&r.setConstantPatternPositions(e)}}updatePaintArrays(e,i,r,a,n,o,s,l){let h=!1,u=Object.keys(e),c=0!==u.length,d=c?u:i.uniqueIds;for(let u in this.context.lut=n.lut,this.binders){let p=this.binders[u];if(p.context=this.context,(p instanceof oc||p instanceof od||p instanceof op)&&(!0===p.expression.isStateDependent||!1===p.expression.isLightConstant)){let f=n.paint.get(u);for(let r of(p.expression=f.value,d)){let n=e[r.toString()];i.eachPosition(r,(e,i,r)=>{let h=a.feature(e);p.updatePaintArray(i,r,h,n,o,s,l)})}if(!c)for(let i of r.uniqueIds){let n=e[i.toString()];r.eachPosition(i,(e,i,r)=>{let h=a.feature(e);p.updatePaintArray(i,r,h,n,o,s,l)})}h=!0}}return h}defines(){let e=[];for(let i in this.binders){let r=this.binders[i];(r instanceof oh||r instanceof ou)&&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 oc||r instanceof od||r instanceof op)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 oh||r instanceof ou||r instanceof od)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 oh||a instanceof ou||a instanceof od)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 oc||i instanceof od||i instanceof op)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let i in this.binders){let r=this.binders[i];(r instanceof oc||r instanceof od||r instanceof op)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let i=this.binders[e];(i instanceof oc||i instanceof od||i instanceof op)&&i.destroy()}}}class om{constructor(e,i,r=()=>!0){for(let a of(this.programConfigurations={},e))this.programConfigurations[a.id]=new of(a,i,r);this.needsUpload=!1,this._featureMap=new n3,this._featureMapWithoutIds=new n3,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){for(let s of r)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,s,a,n,o||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 o_={"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"]},og={"line-pattern":{source:nf,composite:nf},"fill-pattern":{source:nf,composite:nf},"fill-extrusion-pattern":{source:nf,composite:nf},"line-dasharray":{source:nm,composite:nm}},oy={color:{source:nR,composite:nd},number:{source:nA,composite:nR}};function ox(e,i,r){let a=og[e];return a&&a[r]||oy[i][r]}am(oh,"ConstantBinder"),am(ou,"PatternConstantBinder"),am(oc,"SourceExpressionBinder"),am(op,"PatternCompositeBinder"),am(od,"CompositeExpressionBinder"),am(of,"ProgramConfiguration",{omit:["_buffers"]}),am(om,"ProgramConfigurationSet");let ov=8192/Math.PI/2,ob=[64,32,16],ow=-ov;function oT(e,i,r,a=ov){return[e*Math.sin(r*=eC)*a,-i*a,e*Math.cos(r)*a]}function oS(e,i,r){return oT(Math.cos(e*eC),Math.sin(e*eC),i,r)}let oE=2*Math.PI*6371008.8;class oM{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 oM(eB(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/40075017,r=i/Math.cos(Math.PI/180*this.lat);return new oI({lng:this.lng-r,lat:this.lat-i},{lng:this.lng+r,lat:this.lat+i})}toEcef(e){return oS(this.lat,this.lng,ov+e*ov/6371008.8)}static convert(e){if(e instanceof oM)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new oM(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new oM(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 oI{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 oM?new oM(e.lng,e.lat):oM.convert(e),this}setSouthWest(e){return this._sw=e instanceof oM?new oM(e.lng,e.lat):oM.convert(e),this}extend(e){let i,r;let a=this._sw,n=this._ne;if(e instanceof oM)i=e,r=e;else{if(!(e instanceof oI))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(oI.convert(e)):this.extend(oM.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(oM.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 oM(i.lng,i.lat),this._ne=new oM(r.lng,r.lat)),this}getCenter(){return new oM((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 oM(this.getWest(),this.getNorth())}getSouthEast(){return new oM(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}=oM.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 oI?e:new oI(e)}}function oA(e){return oE*Math.cos(e*Math.PI/180)}function oC(e){return(180+e)/360}function oP(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function oz(e){return 360*e-180}function oD(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180)
7)-90}function oR(e){return Math.cos(ek(e,-85.051129,85.051129)*eC)}function oL(e,i){let r=Math.pow(2,ek(i,0,25.5));return oR(e)*oE/(512*r)}function ok(e){return 1/Math.cos(e*Math.PI/180)}function oO(e,i=0){let r=Math.exp(Math.PI*(1-(e.y+i/8192)/(1<<e.z)*2));return 80150034*r/(r*r+1)/8192/(1<<e.z)}class oB{constructor(e,i,r=0){this.x=+e,this.y=+i,this.z=+r}static fromLngLat(e,i=0){let r=oM.convert(e);return new oB(oC(r.lng),oP(r.lat),i/oA(r.lat))}toLngLat(){return new oM(oz(this.x),oD(this.y))}toAltitude(){return this.z*oA(oD(this.y))}meterInMercatorCoordinateUnits(){return 1/oE*ok(oD(this.y))}}function oF(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){let c=(r+n)/2,d=(a+o)/2,p=new eI(c,d);h(p),function(e,i,r,a,n,o){let s=r-n,l=a-o;return Math.abs((a-i)*s-(r-e)*l)/Math.hypot(s,l)}(p.x,p.y,s.x,s.y,l.x,l.y)>=u?(e(i,r,a,c,d,s,p,h,u),e(i,c,d,n,o,p,l,h,u)):i.push(l)}(s,n,o,u,c,a,h,i,r),n=u,o=c,a=h}return s}let oN=-16383-1;function oV(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=oz((i.x+e.x/n)/o),a=oD((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]=oF(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=ek(r,oN,16383),e.y=ek(a,oN,16383),(r<e.x||r>e.x+1||a<e.y||a>e.y+1)&&eX("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(i,o);return a}function oU(e,i){return{type:e.type,id:e.id,properties:e.properties,geometry:i?oV(e):[]}}function oj(e,i,r,a,n){e.emplaceBack(2*i+(a+1)/2,2*r+(n+1)/2)}function oG(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class oq{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 ns,this.indexArray=new nE,this.segments=new nQ,this.programConfigurations=new om(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=oU(i,e);if(!this.layers[0]._featureFilter.filter(new aB(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:oV(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 n_,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){let o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,o?this.stateDependentLayers:this.layers,r,a,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nJ.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,nK.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;oG(s,e,i),oG(s,e,i),oG(s,e,i),oG(s,e,i)}let s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),l=s.vertexLength;oj(this.layoutVertexArray,r,a,-1,-1),oj(this.layoutVertexArray,r,a,1,-1),oj(this.layoutVertexArray,r,a,1,1),oj(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)}}function oZ(e,i){for(let r=0;r<e.length;r++)if(oJ(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(oJ(e,i[r]))return!0;return!!oH(e,i)}function o$(e,i){if(1===e.length)return oY(i,e[0]);for(let r=0;r<i.length;r++){let a=i[r];for(let i=0;i<a.length;i++)if(oJ(e,a[i]))return!0}for(let r=0;r<e.length;r++)if(oY(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(oH(e,i[r]))return!0;return!1}function oH(e,i){if(0===e.length||0===i.length)return!1;for(let n=0;n<e.length-1;n++){let o=e[n],s=e[n+1];for(let e=0;e<i.length-1;e++){var r,a;if(eY(o,r=i[e],a=i[e+1])!==eY(s,r,a)&&eY(o,s,r)!==eY(o,s,a))return!0}}return!1}function oW(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(oX(e,i[r-1],i[r])<a)return!0;return!1}function oX(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 oY(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 oJ(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 oK(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 eI(i,r),new eI(i,n),new eI(a,n),new eI(a,r)];if(e.length>2){for(let i of o)if(oJ(e,i))return!0}for(let i=0;i<e.length-1;i++)if(oQ(e[i],e[i+1],o))return!0;return!1}function oQ(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=eY(e,i,r[0]);return o!==eY(e,i,r[1])||o!==eY(e,i,r[2])||o!==eY(e,i,r[3])}function o0(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}
7return!((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 o1(e,i,r,a,n,o,s){return!(o0(e,i,a,n,o,s)||o0(i,r,a,n,o,s)||o0(r,e,a,n,o,s)||o0(a,n,e,i,r,s)||o0(n,o,e,i,r,s)||o0(o,a,e,i,r,s))}function o2(e,i,r){let a=i.paint.get(e).value;return"constant"===a.kind?a.value:r.programConfigurations.get(i.id).getMaxValue(e)}function o3(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function o4(e,i,r,a,n){if(!i[0]&&!i[1])return e;let o=eI.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 o5(e,i,r,a){let n=eI.convert(e)._mult(a);return"viewport"===i&&n._rotate(-r),n}am(oq,"CircleBucket",{omit:["layers"]});var o6,o8={exports:{}},o9=(o6||(o6=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})}(o8.exports)),o8.exports);class o7{constructor(e,i,r){this.z=e,this.x=i,this.y=r,this.key=si(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=o9.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 se{constructor(e,i){this.wrap=e,this.canonical=i,this.key=si(e,i.z,i.z,i.x,i.y)}}class st{constructor(e,i,r,a,n){this.overscaledZ=e,this.wrap=i,this.canonical=new o7(r,+a,+n),this.key=0===i&&e===r?this.canonical.key:si(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 st(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new st(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 si(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{let r=this.canonical.z-e;return si(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 st(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 st(i,this.wrap,i,r,a),new st(i,this.wrap,i,r+1,a),new st(i,this.wrap,i,r,a+1),new st(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>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new st(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new st(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 se(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}
7function si(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 sr=[e=>{let i=e.canonical.x-1,r=e.wrap;return i<0&&(i=(1<<e.canonical.z)-1,r--),new st(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 st(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>new st(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new st(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];am(o7,"CanonicalTileID"),am(st,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});let{members:sa}=nn([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),sn=nn([{name:"a_pos_3",components:3,type:"Int16"}]);var so=nn([{name:"a_pos",type:"Int16",components:2}]);class ss{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,r){let a=eS.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(eS.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 sl{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],l=eS.vec3.transformMat4(a,a,e);return new sl(l,eS.vec3.transformMat4(n,n,e),eS.vec3.transformMat4(o,o,e),eS.vec3.transformMat4(s,s,e),i/r)}}function sh(e,i,r){let a=1/0,n=-1/0,o=[];for(let s of e){eS.vec3.sub(o,s,i);let e=eS.vec3.dot(o,r);a=Math.min(a,e),n=Math.max(n,e)}return[a,n]}function su(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+=eS.vec3.dot(n,i[e])+n[3]>=0;if(0===o)return 0;o!==i.length&&(r=!1)}return r?2:1}function sc(e,i){for(let r of e.projections){let a=sh(i,e.points[0],r.axis);if(r.projection[1]<a[0]||r.projection[0]>a[1])return 0}return 1}function sd(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,eS.vec4.dot(a,i)>=0&&r++;return r}class sp{constructor(e,i){for(let r of(this.points=e||Array(8).fill([0,0,0]),this.planes=i||Array(6).fill([0,0,0,0]),this.bounds=sf.fromPoints(this.points),this.projections=[],this.frustumEdges=[eS.vec3.sub([],this.points[2],this.points[3]),eS.vec3.sub([],this.points[0],this.points[3]),eS.vec3.sub([],this.points[4],this.points[0]),eS.vec3.sub([],this.points[5],this.points[1]),eS.vec3.sub([],this.points[6],this.points[2]),eS.vec3.sub([],this.points[7],this.points[3])],this.frustumEdges)){let e=[0,-r[2],r[1]],i=[r[2],0,-r[0]];this.projections.push({axis:e,projection:sh(this.points,this.points[0],e)}),this.projections.push({axis:i,projection:sh(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=eS.vec4.transformMat4([],r,e),s=1/o[3]/i*n;return eS.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=eS.vec3.sub([],o[e[0]],o[e[1]]),r=eS.vec3.sub([],o[e[2]],o[e[1]]),a=eS.vec3.normalize([],eS.vec3.cross([],i,r)),n=-eS.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 sp(l,s)}intersectsPrecise(e,i,r){for(let r=0;r<i.length;r++)if(!sd(e,i[r]))return 0;for(let i=0;i<this.planes.length;i++)if(!sd(e,this.planes[i]))return 0;for(let i of r)for(let r of this.frustumEdges){let a=eS.vec3.cross([],i,r),n=eS.vec3.length(a);if(0===n)continue;eS.vec3.scale(a,a,1/n);let o=sh(this.points,this.points[0],a),s=sh(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(eS.vec3.dot([i[0],i[1],i[2]],e)+r<0)return!1}return!0}}class sf{static fromPoints(e){let i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let a of e)eS.vec3.min(i,i,a),eS.vec3.max(r,r,a);return new sf(i,r)}static fromTileIdAndHeight(e,i,r){let a=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new sf([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)eS.vec3.transformMat4(r[e],r[e],i);return sf.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 sf(r,a)}static projectAabbCorners(e,i){let r=e.getCorners();for(let e=0;e<r.length;++e)eS.vec3.transformMat4(r[e],r[e],i);return r}constructor(e,i){this.min=e,this.max=i,this.center=eS.vec3.scale([],eS.vec3.add([],this.min,this.max),.5)}quadrant(e){let i=[e%2==0,e<2],r=eS.vec3.clone(this.min),a=eS.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 sf(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)?su(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?su(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)?sc(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?sc(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 sm(e){return e*ov/6371008.8}am(sf,"Aabb");let s_=[new sf([ow,ow,ow],[ov,ov,ov]),new sf([ow,ow,ow],[0,0,ov]),new sf([0,ow,ow],[ov,0,ov]),new sf([ow,0,ow],[0,ov,ov]),new sf([0,0,ow],[ov,ov,ov])];function sg(e,i,r,a=!0){let n=eS.vec3.scale([],e._camera.position,e.worldSize),o=[i,r,1,1];eS.vec4.transformMat4(o,o,e.pixelMatrixInverse),eS.vec4.scale(o,o,1/o[3]);let s=eS.vec3.sub([],o,n),l=eS.vec3.normalize([],s),h=e.globeMatrix,u=[h[12],h[13],h[14]],c=eS.vec3.sub([],u,n),d=eS.vec3.length(c),p=eS.vec3.normalize([],c),f=e.worldSize/(2*Math.PI),m=eS.vec3.dot(p,l),_=Math.asin(f/d);if(_<Math.acos(m)){if(!a)return null;let e=[],i=[];eS.vec3.scale(e,l,d/m),eS.vec3.normalize(i,eS.vec3.sub(i,e,c)),eS.vec3.normalize(l,eS.vec3.add(l,c,eS.vec3.scale(l,i,Math.tan(_)*d)))}let g=[];new ss(n,l).closestPointOnSphere(u,f,g);let y=eS.vec3.normalize([],e2(h,0)),x=eS.vec3.normalize([],e2(h,1)),v=eS.vec3.normalize([],e2(h,2)),b=eS.vec3.dot(y,g),w=eS.vec3.dot(x,g),T=Math.atan2(b,eS.vec3.dot(v,g))*eP;return new oB(oC(T=e.center.lng+function(e,i){let r=(i-e+180)%360-180;return r<-180?r+360:r}(e.center.lng,T)),ek(oP(Math.asin(-w/f)*eP),0,1))}class sy{constructor(e,i,r){this.a=eS.vec3.sub([],e,r),this.b=eS.vec3.sub([],i,r),this.center=r;let a=eS.vec3.normalize([],this.a),n=eS.vec3.normalize([],this.b);this.angle=Math.acos(eS.vec3.dot(a,n))}}function sx(e,i){let r;return 0===e.angle?null:(r=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||r>1?null:function(e,i,r,a){let n=Math.sin(r);return Math.sin((1-a)*r)/n*e+Math.sin(a*r)/n*i}(e.a[i],e.b[i],e.angle,ek(r,0,1))+e.center[i]}function sv(e){if(e.z<=1)return s_[e.z+2*e.y+e.x];let i=sE(sS(e));return sf.fromPoints(i)}
7function sb(e,i,r){return eS.vec3.scale(e,e,1-r),eS.vec3.scaleAndAdd(e,e,i,r)}function sw(e,i,r){for(let a of e)eS.vec3.transformMat4(a,a,i),eS.vec3.scale(a,a,r)}function sT(e,i,r,a){let n=i/e.worldSize,o=e.globeMatrix;if(r.z<=1){let e=sv(r).getCorners();return sw(e,o,n),sf.fromPoints(e)}let s=sS(r,a),l=sE(s,ov+sm(e._tileCoverLift));sw(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)eS.vec3.min(c,c,e),eS.vec3.max(u,u,e);u[2]=0;let i=e.point,r=[i.x*n,i.y*n,0];return eS.vec3.min(c,c,r),eS.vec3.max(u,u,r),new sf(c,u)}if(e._tileCoverLift>0){for(let e of l)eS.vec3.min(c,c,e),eS.vec3.max(u,u,e);return new sf(c,u)}let d=[o[12]*n,o[13]*n,o[14]*n],p=s.getCenter(),f=ek(e.center.lat,-85.051129,85.051129),m=ek(p.lat,-85.051129,85.051129),_=oC(e.center.lng),g=oP(f),y=_-oC(p.lng),x=g-oP(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())*eC)*ov;eS.vec3.scaleAndAdd(d,d,e,i)}let b=l[v],w=l[(v+1)%4],T=new sy(b,w,d),S=[sx(T,0)||b[0],sx(T,1)||b[1],sx(T,2)||b[2]],E=sL(e.zoom);if(E>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*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++)sb(l[e],a[e],E);let n=eS.vec3.add([],a[v],a[(v+1)%4]);eS.vec3.scale(n,n,.5),sb(S,n,E)}for(let e of l)eS.vec3.min(c,c,e),eS.vec3.max(u,u,e);return c[2]=Math.min(b[2],w[2]),eS.vec3.min(c,c,S),eS.vec3.max(u,u,S),new sf(c,u)}function sS({x:e,y:i,z:r},a=!1){let n=1/(1<<r);return new oI(new oM(oz(e*n),i===(1<<r)-1&&a?-90:oD((i+1)*n)),new oM(oz((e+1)*n),0===i&&a?90:oD(i*n)))}function sE(e,i=ov){let r=e.getNorth()*eC,a=e.getSouth()*eC,n=Math.cos(r),o=Math.cos(a),s=Math.sin(r),l=Math.sin(a),h=e.getWest(),u=e.getEast();return[oT(o,l,h,i),oT(o,l,u,i),oT(n,s,u,i),oT(n,s,h,i)]}function sM(e,i,r,a){let n=1<<r.z,o=(e/8192+r.x)/n;return oS(oD((i/8192+r.y)/n),oz(o),a)}function sI({min:e,max:i}){return 16383/Math.max(i[0]-e[0],i[1]-e[1],i[2]-e[2])}let sA=new Float64Array(16);function sC(e){let i=sI(e),r=eS.mat4.fromScaling(sA,[i,i,i]);return eS.mat4.translate(r,r,eS.vec3.negate([],e.min))}function sP(e){let i=eS.mat4.fromTranslation(sA,e.min),r=1/sI(e);return eS.mat4.scale(i,i,[r,r,r])}function sz(e){return e/(2*Math.PI)/(8192/(2*Math.PI))}function sD(e,i){return 8192/(512*Math.pow(2,e))*sI(sv(i))}function sR(e,i,r,a,n){let o=sz(r),s=[e,i,-r/(2*Math.PI)],l=eS.mat4.identity(new Float64Array(16));return eS.mat4.translate(l,l,s),eS.mat4.scale(l,l,[o,o,o]),eS.mat4.rotateX(l,l,-n*eC),eS.mat4.rotateY(l,l,-a*eC),l}function sL(e){return eO(5,6,e)}function sk(e,i){let r=oS(i.lat,i.lng),a=function(e){let i=oS(e._center.lat,e._center.lng),r=eS.vec3.fromValues(0,1,0),a=eS.vec3.cross([],r,i),n=eS.mat4.fromRotation([],-e.angle,i);a=eS.vec3.transformMat4(a,a,n),eS.mat4.fromRotation(n,-e._pitch,a);let o=eS.vec3.normalize([],i);return eS.vec3.scale(o,o,sm(e.cameraToCenterDistance/e.pixelsPerMeter)),eS.vec3.transformMat4(o,o,n),eS.vec3.add([],i,o)}(e),n=eS.vec3.subtract([],a,r);return eS.vec3.angle(n,r)}function sO(e,i){return sk(e,i)>Math.PI/2*1.01}let sB=85*eC,sF=Math.cos(sB),sN=Math.sin(sB),sV=eS.mat4.create(),sU=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 sj(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=eS.vec4.transformMat4([],[e,i,r,1],a);return new eI(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=eS.vec3.create();return sG[2]=i,e.intersectsPlane(sG,sq,r),new eI(r[0],r[1])})(e,f)):e.queryGeometry.screenGeometry,y=eS.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=oD((i.y/8192+u.y)/(1<<u.z));h/=r.projection.pixelsPerMeter(e,1)/(1/oA(e))}if(d=h,oJ(g,_)||oW(_,g,d))return!0}return!1}let sG=eS.vec3.fromValues(0,0,0),sq=eS.vec3.fromValues(0,0,1);class sZ extends oq{}function s$(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 sH(e,i,r){let{width:a,height:n}=i;a===e.width&&n===e.height||(sW(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 sW(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 tV(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}am(sZ,"HeatmapBucket",{omit:["layers"]});class sX{constructor(e,i){s$(this,e,1,i)}resize(e){sH(this,new sX(e),1)}clone(){return new sX({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n){sW(e,i,r,a,n,1,null)}}class sY{constructor(e,i){s$(this,e,4,i)}resize(e){sH(this,new sY(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new sY({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n,o,s){sW(e,i,r,a,n,4,o,s)}}class sJ{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function sK(e){let i={},r=e.resolution||256,a=e.clips?e.clips.length:1,n=e.image||new sY({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}am(sX,"AlphaImage"),am(sY,"RGBAImage");let{members:sQ}=nn([{name:"a_pos",components:2,type:"Int16"}],4);function s0(e,i,r=2){let a,n,o;let s=i&&i.length,l=s?i[0]*r:e.length,h=s1(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=s1(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(s3);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&&s5(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);lt(r,e)&&(i<c||i===c&&(r.x>o.x||r.x===o.x&&(d=o,p=r,0>s6(d.prev,d,p.prev)&&0>s6(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=li(r,e);return s2(a,a.next),s2(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=s4(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(s6(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=s4(p,f,i,r,a),y=s4(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&&s5(s,u,l,c,h,d,x.x,x.y)&&s6(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==o&&s5(s,u,l,c,h,d,v.x,v.y)&&s6(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&&s5(s,u,l,c,h,d,x.x,x.y)&&s6(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&&s5(s,u,l,c,h,d,v.x,v.y)&&s6(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(s6(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&&s5(a,s,n,l,o,h,f.x,f.y)&&s6(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}(i))r.push(u.i,i.i,c.i),la(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;!s8(a,n)&&s9(a,r,r.next,n)&<(a,n)&<(n,a)&&(i.push(a.i,r.i,n.i),la(r),la(r.next),r=e=n),r=r.next}while(r!==e);return s2(r)}(s2(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&&s9(r,r.next,e,i))return!0;r=r.next}while(r!==e);return!1}(h,u)&&(lt(h,u)&<(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)&&(s6(h.prev,h,u.prev)||s6(h,u.prev,u))||s8(h,u)&&s6(h.prev,h,h.next)>0&&s6(u.prev,u,u.next)>0))){let h=li(l,i);return l=s2(l,l.next),h=s2(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(s2(i),r,a,n,o,s,1);break}}}(h,u,r,a,n,o,0),u}function s1(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=lr(n/a|0,e[n],e[n+1],o);else for(let n=r-a;n>=i;n-=a)o=lr(n/a|0,e[n],e[n+1],o);return o&&s8(o,o.next)&&(la(o),o=o.next),o}function s2(e,i){if(!e)return e;i||(i=e);let r,a=e;do if(r=!1,a.steiner||!s8(a,a.next)&&0!==s6(a.prev,a,a.next))a=a.next;else{if(la(a),(a=i=a.prev)===a.next)break;r=!0}while(r||a!==i);return i}function s3(e,i){return e.x-i.x}function s4(e,i,r,a,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-a)*n|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function s5(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 s6(e,i,r){return(i.y-e.y)*(r.x-i.x)-(i.x-e.x)*(r.y-i.y)}function s8(e,i){return e.x===i.x&&e.y===i.y}function s9(e,i,r,a){let n=le(s6(e,i,r)),o=le(s6(e,i,a)),s=le(s6(r,a,e)),l=le(s6(r,a,i));return n!==o&&s!==l||!(0!==n||!s7(e,r,i))||!(0!==o||!s7(e,a,i))||!(0!==s||!s7(r,e,a))||!(0!==l||!s7(r,i,a))}function s7(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 le(e){return e>0?1:e<0?-1:0}function lt(e,i){return 0>s6(e.prev,e,e.next)?s6(e,i,e.next)>=0&&s6(e,e.prev,i)>=0:0>s6(e,i,e.prev)||0>s6(e,e.next,i)}function li(e,i){let r=ln(e.i,e.x,e.y),a=ln(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 lr(e,i,r,a){let n=ln(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 la(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 ln(e,i,r){return{i:e,x:i,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function lo(e,i){let r,a;let 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?1:0}){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(iS(i,a,r),o(i[n],s)>0&&iS(i,a,n);l<h;){for(iS(i,l,h),l++,h--;0>o(i[l],s);)l++;for(;o(i[h],s)>0;)h--}0===o(i[a],s)?iS(i,a,h):iS(i,++h,n),h<=r&&(a=h+1),r<=h&&(n=h-1)}}(o[e],i,1,o[e].length-1,ls),o[e]=o[e].slice(0,i));return o}function ls(e,i){return i.area-e.area}function ll(e,i,r){let a=r.patternDependencies,n=!1;for(let r of i){let i=r.paint.get(`${e}-pattern`);i.isConstant()||(n=!0);let o=i.constantOr(null);o&&(n=!0,a[o]=!0)}return n}function lh(e,i,r,a,n){let o=n.patternDependencies;for(let s of i){let i=s.paint.get(`${e}-pattern`).value;if("constant"!==i.kind){let e=i.evaluate({zoom:a},r,{},n.availableImages);o[e=e&&e.name?e.name:e]=!0,r.patterns[s.id]=e}}return r}class lu{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.patternFeatures=[],this.layoutVertexArray=new ns,this.indexArray=new nE,this.indexArray2=new nv,this.programConfigurations=new om(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new nQ,this.segments2=new nQ,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection}updateFootprints(e,i){}populate(e,i,r,a){this.hasPattern=ll("fill",this.layers,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=oU(s,e);if(!this.layers[0]._featureFilter.filter(new aB(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:oV(s,r,a),patterns:{},sortKey:d};o.push(p)}for(let a of(n&&o.sort((e,i)=>
7e.sortKey-i.sortKey),o)){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(this.hasPattern){let e=lh("fill",this.layers,a,this.zoom,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,{},i.availableImages,i.brightness);i.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,i,r,a,n){let o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,o?this.stateDependentLayers:this.layers,r,a,n)}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||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,sQ),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,i,r,a,n,o=[],s){for(let e of lo(i,500)){let i=0;for(let r of e)i+=r.length;let r=this.segments.prepareSegment(i,this.layoutVertexArray,this.indexArray),a=r.vertexLength,n=[],o=[];for(let i of e){if(0===i.length)continue;i!==e[0]&&o.push(n.length/2);let r=this.segments2.prepareSegment(i.length,this.layoutVertexArray,this.indexArray2),a=r.vertexLength;this.layoutVertexArray.emplaceBack(i[0].x,i[0].y),this.indexArray2.emplaceBack(a+i.length-1,a),n.push(i[0].x),n.push(i[0].y);for(let e=1;e<i.length;e++)this.layoutVertexArray.emplaceBack(i[e].x,i[e].y),this.indexArray2.emplaceBack(a+e-1,a+e),n.push(i[e].x),n.push(i[e].y);r.vertexLength+=i.length,r.primitiveLength+=i.length}let s=s0(n,o);for(let e=0;e<s.length;e+=3)this.indexArray.emplaceBack(a+s[e],a+s[e+1],a+s[e+2]);r.vertexLength+=i,r.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,o,a,s)}}am(lu,"FillBucket",{omit:["layers","patternFeatures"]});class lc{constructor(e,i,r,a){if(this.triangleCount=i.length/3,this.min=new eI(0,0),this.max=new eI(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;let[n,o]=[e[0].clone(),e[0].clone()];for(let i=1;i<e.length;++i){let 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;let s=this.max.sub(this.min);s.x=Math.max(s.x,1),s.y=Math.max(s.y,1);let 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;let h=[];for(let r=0;r<this.triangleCount;r++){let 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=ld(Math.floor(Math.min(a.x,n.x,o.x)),this.xScale,this.cellsX),u=ld(Math.floor(Math.max(a.x,n.x,o.x)),this.xScale,this.cellsX),c=ld(Math.floor(Math.min(a.y,n.y,o.y)),this.yScale,this.cellsY),d=ld(Math.floor(Math.max(a.y,n.y,o.y)),this.yScale,this.cellsY),p=new eI(0,0),f=new eI(0,0),m=new eI(0,0),_=new eI(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,(o1(a,n,o,p,f,_)||o1(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;){let 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=ld(e.x-this.min.x,this.xScale,this.cellsX),a=ld(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=ld(e.x-this.min.x,this.xScale,this.cellsX),n=ld(i.x-this.min.x,this.xScale,this.cellsX),o=ld(e.y-this.min.y,this.yScale,this.cellsY),s=ld(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 ld(e,i,r){return Math.max(0,Math.min(r-1,Math.floor(e*i)))}am(lc,"TriangleGridIndex");class lp{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=oU(i,e);if(!this.layers[0]._featureFilter.filter(new aB(this.zoom),h,r))continue;let u={id:o,properties:i.properties,type:i.type,sourceLayerIndex:l,index:s,geometry:e?h.geometry:oV(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){}destroy(){}addFeature(e,i,r,a,n,o=[],s){for(let e of lo(i,2)){let i=[],r=[],a=[],n=new eI(1/0,1/0),o=new eI(-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=s0(r,a),l=new lc(i,s,8,256);this.footprints.push({vertices:i,indices:s,grid:l,min:n,max:o})}}}am(lp,"ClipBucket",{omit:["layers"]});let lf=nn([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),lm=nn([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),l_=nn([{name:"a_centroid_pos",components:2,type:"Uint16"}]),lg=nn([{name:"a_join_normal_inside",components:3,type:"Int16"}]),ly=nn([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),lx=nn([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:lv}=lf;var lb,lw,lT,lS,lE,lM,lI,lA={};function lC(){if(lw)return lb;lw=1;var e=eM();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 lb=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))-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};
7return"id"in this&&(f.id=this.id),f},lb}function lP(){if(lS)return lT;lS=1;var e=lC();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 lT=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)},lT}function lz(){return lI||(lI=1,lA.VectorTile=function(){if(lM)return lE;lM=1;var e=lP();function i(i,r,a){if(3===i){var n=new e(a,a.readVarint()+a.pos);n.length&&(r[n.name]=n)}}return lE=function(e,r){this.layers=e.readFields(i,{},r)}}(),lA.VectorTileFeature=lC(),lA.VectorTileLayer=lP()),lA}var lD=lz();class lR extends eI{constructor(e,i,r){super(e,i),this.z=r}}class lL extends lR{constructor(e,i,r,a){super(e,i,r),this.w=a}}function lk(e,i,r,a){let n=[],o=0===a?(e,i,r,a,n,o)=>{e.push(new eI(o,r+(o-i)/(a-i)*(n-r)))}:(e,i,r,a,n,o)=>{e.push(new eI(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 lO(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=tj(e.z,i.z,o)),e.hasOwnProperty("w")&&(e.w=tj(e.w,i.w,o))}function lB(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&&lO(o,s,n,r),o[n]<a&&s[n]>a&&lO(s,o,n,a)}}let lF=Number.MAX_SAFE_INTEGER;function lN(e,i,r,a){var n;return e.order<i||e.order===lF||!(e.clipMask&r)||0!==(n=e.clipScope).length&&void 0===n.find(e=>e===a)}function lV(e,i){return e.x-i.x||e.y-i.y}function lU(e,i){return 0===lV(e.min,i.min)&&0===lV(e.max,i.max)}function lj(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 lG(e,i){if(e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(e[r].sourceId!==i[r].sourceId||!lU(e[r],i[r])||e[r].order!==i[r].order||e[r].clipMask!==i[r].clipMask||!eA(e[r].clipScope,i[r].clipScope))return!1;return!0}function lq(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 eI((1220703125e-13*e.x+r.canonical.x)*a+r.wrap,(1220703125e-13*e.y+r.canonical.y)*a),max:new eI(n,o)}}function lZ(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 eI(p,m),new eI(f,_),u);for(let e=0;e<u.length;e++){let i=u[e];if(o1(h[l[3*i+0]],h[l[3*i+1]],h[l[3*i+2]],a,n,d,s))return!0}}return!1}function l$(e,i,r,a){let n=Math.pow(2,a.z-r.z);return new eI((e+8192*r.x)*n-8192*a.x,(i+8192*r.y)*n-8192*a.y)}function lH(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(oJ([n[a[3*o+0]],n[a[3*o+1]],n[a[3*o+2]]],e))return!0}return!1}let lW=[new eI(0,0),new eI(8192,0),new eI(8192,8192),new eI(0,8192)];function lX(e,i){let r=[],a=[];if(!i||e.length<2)return[e];if(2===e.length)return oQ(e[0],e[1],lW)?[e]:[];for(let i=0;i<e.length+2;i++){let n=e[i%e.length],o=e[(i+1)%e.length],s=oQ(0===i?e[e.length-1]:e[(i-1)%e.length],n,lW),l=oQ(n,o,lW),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 lY=lD.VectorTileFeature.types,lJ=["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"],lK=["fill-extrusion-flood-light-ground-radius"],lQ=new eI(0,1);function l0(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 l1(e,i,r){e.emplaceBack(8192*i.x,8192*i.y,r?1:0)}function l2(e,i,r,a,n,o){e.emplaceBack(i.x,i.y,(r.x<<1)+a,(r.y<<1)+n,o)}function l3(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class l4{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class l5{constructor(){this.centroidXY=new eI(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 eI(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new eI(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new eI(this.max.x-this.min.x,this.max.y-this.min.y)}}class l6{constructor(){this.acc=new eI(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,tj(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>8192!=e.x>
78192&&this.addBorderIntersection(1,tj(i.y,e.y,(8192-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,tj(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>8192!=e.y>8192&&this.addBorderIntersection(3,tj(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?0:1;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 eI(0,0):new eI(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 l8(e,i){let r=e.add(i)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(ek(e.x*r.x+e.y*r.y,-1,1)))))/4*32767*(e.x*i.y-e.y*i.x<0?-1:1)}let l9=[e=>e.x<0,e=>e.x>8192,e=>e.y<0,e=>e.y>8192];class l7{constructor(e){this.vertexArray=new nu,this.indexArray=new nE,this.programConfigurations=new om(e.layers,{zoom:e.zoom,lut:e.lut},e=>lK.includes(e)),this._segments=new nQ,this.hiddenByLandmarkVertexArray=new nB,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new nQ}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=l8(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=l8(f,p.sub(d)._perp()._unit()),_=o;if(hr(c,d,i)||a&&ha(c,i)&&ha(d,i)){o=m;continue}let g=l.vertexLength;for(let e of(l2(this.vertexArray,c,d,1,1,_),l2(this.vertexArray,c,d,1,0,_),l2(this.vertexArray,c,d,0,1,m),l2(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(l9[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 nQ);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,lm.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,r,a,n,o){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,r,a,n,o)}updateHiddenByLandmark(e){if(!this.hasData())return;let i=e.groundVertexCount+e.groundVertexArrayOffset;if(0===e.groundVertexCount)return;let r=2147483648&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,ly.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 he{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,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 nE,this.footprintVertices=new ns,this.footprintSegments=[],this.layoutVertexArray=new nh,this.centroidVertexArray=new nW,this.wallVertexArray=new nY,this.indexArray=new nE,this.programConfigurations=new om(e.layers,{zoom:e.zoom,lut:e.lut},e=>lJ.includes(e)),this.segments=new nQ,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new l7(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=ll("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=oO(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=oU(n,e);if(!this.layers[0]._featureFilter.filter(new aB(this.zoom),h,r))continue;let u={id:o,sourceLayerIndex:l,index:s,geometry:e?h.geometry:oV(n,r,a),properties:n.properties,type:n.type,patterns:{}},c=this.layoutVertexArray.length,d="Polygon"===lY[u.type];if(this.hasPattern)this.features.push(lh("fill-extrusion",this.layers,u,this.zoom,i));else if(this.wallMode)for(let e of u.geometry)for(let n of lX(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"===lY[e.type],{geometry:l}=e;if(this.wallMode)for(let h of l)for(let l of lX(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){let o=0!==Object.keys(e).length;if(o&&!this.stateDependentLayers.length)return;let s=o?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,i,s,r,a,n),this.groundEffect.update(e,i,s,r,a,n)}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,lv),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,lg.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,lx.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,l_.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;let d=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,p=[new eI(0,0),new eI(8192,8192)],f=s.projection,m="globe"===f.name,_=this.wallMode||"Polygon"===lY[e.type],g=new l6;g.centroidDataIndex=this.centroidData.length;let y=new l5,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 n_),this.wallMode){if(m)return void eX("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;if(s<(i?3:2))return r;for(;s>=2&&e[s-1].equals(e[s-2]);)s--;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 eI(e.x,e.y),h=new eI(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]:lo(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=hl(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,E=(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 l4;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;let 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||E(_,s)||_.push(s),l0(this.layoutVertexArray,s.x,s.y,0,0,1,1,0),this.wallMode){let i=b(e,p);l1(this.wallVertexArray,u.joinNormals[e],!i)}o.vertexLength++,this.footprintVertices.emplaceBack(i.x,i.y),n.push(i.x,i.y),m&&l3(this.layoutVertexExtArray,f.projectTilePoint(s.x,s.y,a),f.upVector(a,s.x,s.y))}x&&(0===T||S)&&(0!==_.length&&E(_,_[0])&&_.pop(),this.groundEffect.addData(_,i,d))}let h=this.wallMode?u.indices:s0(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;let c=e[n];g.startRing(y,c[0]);let p=c.length>4&&hn(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 hi(e,i,r,ht(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],M=c[e===c.length-1?1:e+1];if(g.appendEdge(y,_,d),hr(_,d,i)){T&&(l=M.sub(_)._perp()._unit(),S=!S);continue}let I=_.sub(d)._perp(),A=I.x/(Math.abs(I.x)+Math.abs(I.y)),C=I.y>0?1:0,P=d.dist(_);if(n+P>32768&&(n=0),T){h=M.sub(_)._perp()._unit();let e=hi(d,_,M,ht(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&&(E(w,d)||w.push(d),E(w,_)||w.push(_))}let z=o.vertexLength,D=c.length>4&&hn(d,_,M),R=ho(n,p,S);if(l0(this.layoutVertexArray,d.x,d.y,A,C,0,0,R),l0(this.layoutVertexArray,d.x,d.y,A,C,0,1,R),this.wallMode){let i=b(e-1,c),r=u.joinNormals[e-1];l1(this.wallVertexArray,r,i),l1(this.wallVertexArray,r,i)}if(n+=P,R=ho(n,D,!S),p=D,l0(this.layoutVertexArray,_.x,_.y,A,C,0,0,R),l0(this.layoutVertexArray,_.x,_.y,A,C,0,1,R),this.wallMode){let i=b(e,c),r=u.joinNormals[e];l1(this.wallVertexArray,r,i),l1(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),!hr(M,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);l3(e,i,n),l3(e,i,n),l3(e,r,o),l3(e,r,o)}}_&&(r+=c.length-1),x&&T&&this.zoom>=17&&(0!==w.length&&E(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?lQ: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 nE;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;let n=new nQ;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 sf([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 eI(ek(r.x,1,8191)<<3|n,ek(r.y,1,8191)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new eI(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?0:1;return new eI(6|(i[0][0]!==r?0:65528),(i[e][0]+i[e][1])/2<<3|6)}{let e=i[2][0]!==r?2:3;return new eI((i[e][0]+i[e][1])/2<<3|6,6|(i[2][0]!==r?0:65528))}}showCentroid(e){let i=this.centroidData[e.centroidDataIndex];i.flags&=2147483648,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=2147483648&e.flags?lQ: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(lG(this.activeReplacements,a))return;if(this.activeReplacements=a,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(let e of this.centroidData)e.flags&=2147483647;let n=[];for(let i of this.activeReplacements){if(i.order<r)continue;let a=Math.pow(2,i.footprintTileId.canonical.z-e.canonical.z);for(let r of this.centroidData)if(!(2147483648&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 eI(r,h))}}(this.footprintVertices,s.vertexOffset,s.vertexCount,i.footprintTileId.canonical,e.canonical,n),lZ(i.footprint,n,this.footprintIndices.uint16,s.indexOffset,s.indexCount,-s.vertexOffset,
7-a)){r.flags|=2147483648;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=Number.NEGATIVE_INFINITY,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:!!(2147483648&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=!!(2147483648&o.flags));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:a};this.partLookup[n]=void 0}}function ht(e,i){let r=e.add(i)._unit();return e.x*r.x+e.y*r.y}function hi(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 hr(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 ha(e,i){return e.x<i[0].x||e.x>i[1].x||e.y<i[0].y||e.y>i[1].y}function hn(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 ho(e,i,r){let a=i?2|e:-3&e;return r?1|a:-2&a}function hs(){let e=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*e*e)-6371008.8}function hl(e,i,r){let a=1<<r.z,n=oz(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=lk(p,i[0].y-n,i[1].y+n,1),!(p=lk(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=lk(e.polygons,h-n,c+n,r),m=lk(e.polygons,c-n,u+n,r);if(p.length){let e=[a,new eI(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 eI(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((oz((r.x+1)/a)-n)/11.25),Math.ceil((oD(r.y/a)-oD((r.y+1)/a))/11.25),1,(e,i,n)=>{if(0===e)return .5*(i+n);{let e=oD((r.y+i/8192)/a);return(oP(.5*(oD((r.y+n/8192)/a)+e))*a-r.y)*8192}})}function hh(e,i){return e.x*i.x+e.y*i.y}function hu(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=hh(l,l),d=hh(l,h),p=hh(h,h),f=hh(u,l),m=hh(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 hc(e,i,r,a,n,o,s,l){let h=s*n.getElevationAt(e,i,!0,!0),u=0!==o[0],c=u?0===o[1]?s*(o[0]/7-450):s*function(e,i,r){var a,n;let o=Math.floor(i[0]/8),s=Math.floor(i[1]/8),l=10*(i[0]-8*o),h=10*(i[1]-8*s),u=e.getElevationAt(o,s,!0,!0),c=e.getMeterToDEM(r),d=Math.floor(.5*(l*c-1)),p=Math.floor(.5*(h*c-1)),f=e.tileCoordToPixel(o,s),m=2*d+1,_=2*p+1,g=(a=f.x-d,n=f.y-p,[e.getElevationAtPixel(a,n,!0),e.getElevationAtPixel(a+_,n,!0),e.getElevationAtPixel(a,n+_,!0),e.getElevationAtPixel(a+m,n+_,!0)]),y=Math.abs(g[0]-g[1]);return u+Math.max(Math.min(.25,.5*c*(y+Math.abs(g[2]-g[3]))/m)*l,Math.min(.25,.5*c*(Math.abs(g[0]-g[2])+Math.abs(g[1]-g[3]))/_)*h)}(n,o,l):h;return{base:h+(0===r)?-1:r,top:u?Math.max(c+a,h+r+2):h+a}}am(he,"FillExtrusionBucket",{omit:["layers","features"]}),am(l5,"PartData"),am(l4,"FootprintSegment"),am(l6,"BorderCentroidData"),am(l7,"GroundEffect");let hd=nn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),hp=nn([{name:"a_z_offset",components:1,type:"Float32"}],4),{members:hf}=hd,{members:hm}=nn([{name:"a_packed",components:4,type:"Float32"}]),{members:h_}=nn([{name:"a_pattern_data",components:3,type:"Float32"}]);class hg{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new sX({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=ej(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=a?7:0,o=2*n+1;if(this.nextRow+o>this.height)return eX("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&&(eX("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}}am(hg,"LineAtlas");let hy=lD.VectorTileFeature.types,hx=Math.cos(Math.PI/180*37.5),hv=Math.cos(Math.PI/180*5);class hb{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.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new nc,this.layoutVertexArray2=new nd,this.patternVertexArray=new np,this.indexArray=new nE,this.programConfigurations=new om(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new nQ,this.maxLineLength=0,this.zOffsetVertexArray=new nA,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=ll("line",this.layers,i);let n=this.layers[0].layout.get("line-sort-key"),o=this.layers[0].layout.get("line-z-offset");this.hasZOffset=!o.isConstant()||!!o.constantOr(0);let s=[];for(let{feature:i,id:o,index:l,sourceLayerIndex:h}of e){let e=this.layers[0]._featureFilter.needGeometry,u=oU(i,e);if(!this.layers[0]._featureFilter.filter(new aB(this.zoom),u,r))continue;let c=n?n.evaluate(u,{},r):void 0,d={id:o,properties:i.properties,type:i.type,sourceLayerIndex:h,index:l,geometry:e?u.geometry:oV(i,r,a),patterns:{},sortKey:c};s.push(d)}n&&s.sort((e,i)=>e.sortKey-i.sortKey);let{lineAtlas:l,featureIndex:h}=i,u=this.addConstantDashes(l);for(let a of s){let{geometry:n,index:o,sourceLayerIndex:s}=a;if(u&&this.addFeatureDashes(a,l),this.hasPattern){let e=lh("line",this.layers,a,this.zoom,i);this.patternFeatures.push(e)}else this.addFeature(a,n,o,r,l.positions,i.availableImages,i.brightness);h.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,n=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;let 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){let o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,o?this.stateDependentLayers:this.layers,r,a,n)}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,hm)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,h_)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,hp.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hf),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");for(let r of(this.lineClips=this.lineFeatureClips(e),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.scaledDistance=0,this.totalDistance=0,this.lineS
7oFar=0,this.currentVertex=void 0;let f={zoom:this.zoom,lineProgress:void 0},m=this.layers[0].layout,_="none"===a;if(this.patternJoinNone=this.hasPattern&&_,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.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let g="Polygon"===hy[i.type],y=e.length;for(;y>=2&&e[y-1].equals(e[y-2]);)y--;let x=0;for(;x<y-1&&e[x].equals(e[x+1]);)x++;if(y<(g?3:2))return;"bevel"===a&&(o=1.05);let v=this.overscaling<=16?122880/(512*this.overscaling):0,b=this.segments.prepareSegment(10*y,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,g&&(l=e[y-2],d=e[x].sub(l)._unit()._perp());for(let r=x;r<y;r++){if((u=r===y-1?g?e[x+1]:void 0:e[r+1])&&e[r].equals(u))continue;if(d&&(c=d),l&&(h=l),l=e[r],this.hasZOffset){let e=m.get("line-z-offset").value;if("constant"===e.kind)p=e.value;else{if(this.lineClips){let e=this.totalDistance/(this.lineClips.end-this.lineClips.start);f.lineProgress=(e*this.lineClips.start+this.distance+(h?h.dist(l):0))/e}else eX(`line-z-offset evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`),f.lineProgress=0;p=e.evaluate(f,i)}p=p||0}d=u?u.sub(l)._unit()._perp():c,c=c||d;let w=h&&u,T=w?a:g||_?"butt":n,S=c.x*d.x+c.y*d.y;if(_){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(w&&S<hv){this.updateDistance(h,l),this.addCurrentVertex(l,c,1,1,b,p),e(this),this.addCurrentVertex(l,d,-1,-1,b,p);continue}if(h){if(!u){this.updateDistance(h,l),this.addCurrentVertex(l,c,1,1,b,p),e(this);continue}T="miter"}}let E=c.add(d);0===E.x&&0===E.y||E._unit();let M=E.x*d.x+E.y*d.y,I=0!==M?1/M:1/0,A=2*Math.sqrt(2-2*M),C=M<hx&&h&&u,P=c.x*d.y-c.y*d.x>0;if(C&&r>x){let e=l.dist(h);if(e>2*v){let i=l.sub(l.sub(h)._mult(v/e)._round());this.updateDistance(h,i),this.addCurrentVertex(i,c,0,0,b,p),h=i}}if(w&&"round"===T&&(I<s?T="miter":I<=2&&(T="fakeround")),"miter"===T&&I>o&&(T="bevel"),"bevel"===T&&(I>2&&(T="flipbevel"),I<o&&(T="miter")),h&&this.updateDistance(h,l),"miter"===T)E._mult(I),this.addCurrentVertex(l,E,0,0,b,p);else if("flipbevel"===T){if(I>100)E=d.mult(-1);else{let e=I*c.add(d).mag()/c.sub(d).mag();E._perp()._mult(e*(P?-1:1))}this.addCurrentVertex(l,E,0,0,b,p),this.addCurrentVertex(l,E.mult(-1),0,0,b,p)}else if("bevel"===T||"fakeround"===T){let e=-Math.sqrt(I*I-1),i=P?e:0,r=P?0:e;if(h&&this.addCurrentVertex(l,c,i,r,b,p),"fakeround"===T){let e=Math.round(180*A/Math.PI/20);for(let i=1;i<e;i++){let r=i/e;if(.5!==r){let e=r-.5;r+=r*e*(r-1)*((1.0904+S*(S*(3.55645-1.43519*S)-3.2452))*e*e+(.848013+S*(.215638*S-1.06021)))}let a=d.sub(c)._mult(r)._add(c)._unit()._mult(P?-1:1);this.addHalfVertex(l,a.x,a.y,!1,P,0,b,p)}}u&&this.addCurrentVertex(l,d,-i,-r,b,p)}else"butt"===T?this.addCurrentVertex(l,E,0,0,b,p):"square"===T?(h||this.addCurrentVertex(l,E,-1,-1,b,p),this.addCurrentVertex(l,E,0,0,b,p),h&&this.addCurrentVertex(l,E,1,1,b,p)):"roun
7d"===T&&(h&&(this.addCurrentVertex(l,c,0,0,b,p),this.addCurrentVertex(l,c,1,1,b,p,!0)),u&&(this.addCurrentVertex(l,d,-1,-1,b,p,!0),this.addCurrentVertex(l,d,0,0,b,p)));if(C&&r<y-1){let e=l.dist(u);if(e>2*v){let i=l.add(u.sub(l)._mult(v/e)._round());this.updateDistance(l,i),this.addCurrentVertex(i,d,0,0,b,p),l=i}}}}addVerticesTo(e,i,r,a,n,o,s,l,h,u){let c=(i.w-e.w)/this.tessellationStep|0;if(c>1){this.lineSoFar=e.w;let d=(i.x-e.x)/c,p=(i.y-e.y)/c,f=(i.z-e.z)/c,m=(i.w-e.w)/c;for(let i=1;i<c;++i)e.x+=d,e.y+=p,e.z+=f,this.lineSoFar+=m,this.addHalfVertex(e,r,a,u,!1,s,h,e.z),this.addHalfVertex(e,n,o,u,!0,-l,h,e.z)}this.lineSoFar=i.w,this.addHalfVertex(i,r,a,u,!1,s,h,i.z),this.addHalfVertex(i,n,o,u,!0,-l,h,i.z)}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=new lL(e.x,e.y,o,this.lineSoFar),d=hw(e,-10,8202),p=this.lineSoFar;if(this.currentVertex){if(d){let i=this.currentVertexIsOutside,d=this.currentVertex,p=new lL(e.x,e.y,o,this.lineSoFar);lB(d,p,-10,8202),hw(p,-10,8202)||(i&&(this.e1=this.e2=-1,this.lineSoFar=d.w,this.addHalfVertex(d,l,h,s,!1,r,n,d.z),this.addHalfVertex(d,u,c,s,!0,-a,n,d.z)),this.addVerticesTo(d,p,l,h,u,c,r,a,n,s))}else{let e=this.currentVertex;this.currentVertexIsOutside&&(lB(e,i,-10,8202),this.e1=this.e2=-1,this.lineSoFar=e.w,this.addHalfVertex(e,l,h,s,!1,r,n,e.z),this.addHalfVertex(e,u,c,s,!0,-a,n,e.z)),this.addVerticesTo(e,i,l,h,u,c,r,a,n,s)}}else d||(this.addHalfVertex(e,l,h,s,!1,r,n,o),this.addHalfVertex(e,u,c,s,!0,-a,n,o));this.currentVertex=i,this.currentVertexIsOutside=d,this.lineSoFar=p}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){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?1:0),(i<<1)+(o?1:0),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&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);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)}updateScaledDistance(){if(this.lineClips){let e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}}function hw(e,i,r){return e.x<i||e.x>r||e.y<i||e.y>r}function hT(e,i,r){return 8192/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ))*i}function hS(e,i){return 1/hT(e,1,i.tileZoom)}function hE(e,i,r,a){return e.translatePosMatrix(a||i.tileID.projMatrix,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}am(hb,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let hM=e=>{let i=[];hI(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 hI(e){let i=e.paint.get("line-dasharray").value;return i.value||"constant"!==i.kind}let hA=()=>I||(I={layout:E||(E=new aX({"line-cap":new aH(aY.layout_line["line-cap"]),"line-join":new aH(aY.layout_line["line-join"]),"line-miter-limit":new a$(aY.layout_line["line-miter-limit"]),"line-round-limit":new a$(aY.layout_line["line-round-limit"]),"line-sort-key":new aH(aY.layout_line["line-sort-key"]),"line-z-offset":new aH(aY.layout_line["line-z-offset"]),visibility:new a$(aY.layout_line.visibility)})),paint:M||(M=new aX({"line-opacity":new aH(aY.paint_line["line-opacity"]),"line-color":new aH(aY.paint_line["line-color"]),"line-translate":new a$(aY.paint_line["line-translate"]),"line-translate-anchor":new a$(aY.paint_line["line-translate-anchor"]),"line-width":new aH(aY.paint_line["line-width"]),"line-gap-width":new aH(aY.paint_line["line-gap-width"]),"line-offset":new aH(aY.paint_line["line-offset"]),"line-blur"
7:new aH(aY.paint_line["line-blur"]),"line-dasharray":new aH(aY.paint_line["line-dasharray"]),"line-pattern":new aH(aY.paint_line["line-pattern"]),"line-gradient":new aW(aY.paint_line["line-gradient"]),"line-trim-offset":new a$(aY.paint_line["line-trim-offset"]),"line-trim-fade-range":new a$(aY.paint_line["line-trim-fade-range"]),"line-trim-color":new a$(aY.paint_line["line-trim-color"]),"line-emissive-strength":new a$(aY.paint_line["line-emissive-strength"]),"line-border-width":new aH(aY.paint_line["line-border-width"]),"line-border-color":new aH(aY.paint_line["line-border-color"]),"line-occlusion-opacity":new a$(aY.paint_line["line-occlusion-opacity"])}))});class hC extends aH{possiblyEvaluate(e,i){return i=new aB(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,r,a){return i=eN({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,r,a)}}let hP=nn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),hz=nn([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),hD=nn([{name:"a_projected_pos",components:4,type:"Float32"}],4);nn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let hR=nn([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),hL=nn([{name:"a_texb",components:2,type:"Uint16"}]),hk=nn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),hO=nn([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);nn([{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 hB=nn([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),hF=nn([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function hN(e,i){let{expression:r}=i;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new aB(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 aB(s)),maxSize:r.evaluate(new aB(l)),interpolationType:a}}}function hV(e,{uSize:i,uSizeT:r},{lowerSize:a,upperSize:n}){return"source"===e.kind?a/128:"composite"===e.kind?tj(a/128,n/128,r):i}function hU(e,i){let r=0,a=0;if("constant"===e.kind)a=e.layoutSize;else if("source"!==e.kind){let{interpolationType:n,minZoom:o,maxZoom:s}=e,l=n?ek(rI.interpolationFactor(n,i,o,s),0,1):0;"camera"===e.kind?a=tj(e.minSize,e.maxSize,l):r=l}return{uSizeT:r,uSize:a}}nn([{name:"triangle",components:3,type:"Uint16"}]),nn([{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"}
7]),nn([{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"}]),nn([{type:"Float32",name:"offsetX"}]),nn([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var hj=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:128,evaluateSizeForFeature:hV,evaluateSizeForZoom:hU,getSizeData:hN});let hG={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};var hq,hZ,h$,hH={};function hW(){if(h$)return hZ;h$=1,hZ=i;var e=(hq||(hq=1,hH.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)},hH.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=23===n?5960464477539062e-23:0,f=a?0:o-1,m=a?1:-1,_=i<0||0===i&&1/i<0?1:0;for(isNaN(i=Math.abs(i))||i===1/0?(l=isNaN(i)?1:0,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*_}),hH);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="undefined"==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<=268435455?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;
7r++)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)+16777216*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)+4294967296*m(this.buf,this.pos+4);return this.pos+=8,e},readSFixed64:function(){var e=m(this.buf,this.pos)+4294967296*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=r.buf;if(n=(112&(o=s[r.pos++]))>>4,o<128||(n|=(127&(o=s[r.pos++]))<<3,o<128)||(n|=(127&(o=s[r.pos++]))<<10,o<128)||(n|=(127&(o=s[r.pos++]))<<17,o<128)||(n|=(127&(o=s[r.pos++]))<<24,o<128)||(n|=(1&(o=s[r.pos++]))<<31,o<128))return a=n,i?4294967296*a+(e>>>0):4294967296*(a>>>0)+(e>>>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)>268435455||e<0?function(e,i){var r,a,n,o,s;if(e>=0?(r=e%4294967296|0,a=e/4294967296|0):(a=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)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|((o>>>=3)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o|((o>>>=7)?128:0),o&&(i.buf[i.pos++]=127&o)))))}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),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)}},hZ}var hX=Z(hW());function hY(e,i,r){i.glyphs=[],1===e&&r.readMessage(hJ,i)}function hJ(e,i,r){if(3===e){let{id:e,bitmap:a,width:n,height:o,left:s,top:l,advance:h}=r.readMessage(hK,{});i.glyphs.push({id:e,bitmap:new sX({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 hK(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 hQ={horizontal:1,vertical:2,horizontalOnly:3};class h0{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,i){let r=new h0;return r.scale=e||1,r.fontStack=i,r}static forImage(e){let i=new h0;return i.imageName=e,i}}class h1{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){let r=new h1;for(let a=0;a<e.sections.length;a++){let n=e.sections[a];n.image?r.addImageSection(n):r.addTextSection(n,i)}return r}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&&aT(n)&&!hG[e[a+1]]||o&&aT(o)&&!hG[e[a-1]])||!hG[e[a]]?e[a]:hG[e[a]]}return r}(this.text,e)}trim(){let e=0;for(let i=0;i<this.text.length&&h3[this.text.charCodeAt(i)];i++)e++;let i=this.text.length;for(let r=this.text.length-1;r>=0&&r>=e&&h3[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 h1;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(h0.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){let i=e.image?e.image.namePrimary:"";if(0===i.length)return void eX("Can't add FormattedSection with an empty image.");let r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCodePoint(r),this.sections.push(h0.forImage(i)),this.sectionIndex.push(this.sections.length-1)):eX("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function h2(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m){let _=h1.fromFeature(e,n);d===hQ.vertical&&_.verticalizePunctuation(p);let g=[],y=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+=h5(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(h3[d]||(u+=h5(d,c,a,n,i,o)),r<e.length()-1){let i=!(d<11904||!(av["Bopomofo Extended"](d)||av.Bopomofo(d)||av["CJK Compatibility Forms"](d)||av["CJK Compatibility Ideographs"](d)||av["CJK Compatibility"](d)||av["CJK Radicals Supplement"](d)||av["CJK Strokes"](d)||av["CJK Symbols and Punctuation"](d)||av["CJK Unified Ideographs Extension A"](d)||av["CJK Unified Ideographs"](d)||av["Enclosed CJK Letters and Months"](d)||av["Halfwidth and Fullwidth Forms"](d)||av.Hiragana(d)||av["Ideographic Description Characters"](d)||av["Kangxi Radicals"](d)||av["Katakana Phonet
7ic Extensions"](d)||av.Katakana(d)||av["Vertical Forms"](d)||av["Yi Radicals"](d)||av["Yi Syllables"](d)));(h4[d]||i||c.imageName)&&s.push(h8(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):[]}(h8(e.length(),u,l,s,0,!0))}(_,u,o,i,a,f),{processBidirectionalText:x,processStyledBidirectionalText:v}=aO;if(x&&1===_.sections.length)for(let e of x(_.toString(),y)){let i=new h1;i.text=e,i.sections=_.sections;for(let r=0;r<e.length;r++)i.sectionIndex.push(0);g.push(i)}else if(v)for(let e of v(_.text,_.sectionIndex,y)){let i=new h1;i.text=e[0],i.sectionIndex=e[1],i.sections=_.sections,g.push(i)}else g=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}(_,y);let b=[],w={positionedLines:b,text:_.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:d,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,i,r,a,n,o,s,l,h,u,c,d){let p=0,f=0,m=0,_="right"===l?1:"left"===l?0:.5,g=!1;for(let e of n){for(let r of e.getSections()){if(r.imageName)continue;let e=i[r.fontStack];if(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,E=null,M=24,I=0,A=!(h===hQ.horizontal||!c&&!aw(_)||c&&(h3[_]||av.Arabic(_)||av["Arabic Supplement"](_)||av["Arabic Extended-A"](_)||av["Arabic Presentation Forms-A"](_)||av["Arabic Presentation Forms-B"](_)));if(l.imageName){let i=a[l.imageName];if(!i)continue;E=l.imageName,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:A?r[1]:r[0],localGlyph:!1},I=g?-x.height*y:24*n-17-r[1]*y,M=x.advance;let o=(A?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,M=8203!==_?24:0,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),I=-e*y}else I=(n-y)*24-17}A?(e.verticalizable=!0,v.push({glyph:_,imageName:E,x:p,y:f+I,vertical:A,scale:y,localGlyph:x.localGlyph,fontStack:l.fontStack,sectionIndex:m,metrics:x,rect:S}),p+=M*y+u):(v.push({glyph:_,imageName:E,x:p,y:f+I,vertical:A,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?h7(v,_,b,T,o*n/2):h7(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}=h9(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}(w,i,r,a,g,s,l,h,d,u,p,m),!function(e){for(let i of e)if(0!==i.positionedGlyphs.length)return!1;return!0}(b)&&w}let h3={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},h4={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 h5(e,i,r,a,n,o){if(i.imageName){let e=a[i.imageName];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 h6(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 h8(e,i,r,a,n,o){let s=null,l=h6(i,r,n,o);for(let e of a){let a=h6(i-e.x,r,n,o)+e.badness;a<=l&&(s=e,l=a)}return{index:e,x:i,priorBreak:s,badness:l}}function h9(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 h7(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 ue(e,i,r,a,n,o){let s,l,h,u,c;let 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 ut extends eI{constructor(e,i,r,a,n){super(e,i),this.angle=a,this.z=r,void 0!==n&&(this.segment=n)}clone(){return new ut(this.x,this.y,this.z,this.angle,this.segment)}}function ui(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 ur(e){let i=0;for(let r=0;r<e.length-1;r++)i+=e[r].dist(e[r+1]);return i}function ua(e,i){return Math.max(e?e.right-e.left:0,i?i.right-i.left:0)}function un(e,i,r,a,n){let o=[];for(let s=0;s<e.length;s++){let l;let 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 eI(i,s.y+(i-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<i&&(u=new eI(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 eI(s.x+(r-s.y)/(u.y-s.y)*(u.x-s.x),r)._round():u.y<r&&(u=new eI(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 eI(a,s.y+(a-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=a&&(u=new eI(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 eI(s.x+(n-s.y)/(u.y-s.y)*(u.x-s.x),n)._round():u.y>=n&&(u=new eI(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 uo(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}}am(ut,"Anchor");class us{constructor(e,{pixelRatio:i,version:r,stretchX:a,stretchY:n,content:o},s){this.paddedRect=e,this.pixelRatio=i,this.stretchX=a,this.stretchY=n,this.content=o,this.version=r,this.padding=s}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.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class ul{constructor(e,i,r){let a={},n={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,a,1,o),this.addImages(i,n,2,o);let{w:s,h:l}=uo(o),h=new sY({width:s||1,height:l||1});for(let i in e){let n=e[i],o=a[i].paddedRect;sY.copy(n.data,h,{x:0,y:0},{x:o.x+1,y:o.y+1},n.data,r,n.sdf)}for(let e in i){let a=i[e],o=n[e].paddedRect,s=n[e].padding,l=o.x+s,u=o.y+s,c=a.data.width,d=a.data.height;s=s>1?s-1:s,sY.copy(a.data,h,{x:0,y:0},{x:l,y:u},a.data,r),sY.copy(a.data,h,{x:0,y:d-s},{x:l,y:u-s},{width:c,height:s},r),sY.copy(a.data,h,{x:0,y:0},{x:l,y:u+d},{width:c,height:s},r),sY.copy(a.data,h,{x:c-s,y:0},{x:l-s,y:u},{width:s,height:d},r),sY.copy(a.data,h,{x:0,y:0},{x:l+c,y:u},{width:s,height:d},r),sY.copy(a.data,h,{x:c-s,y:d-s},{x:l-s,y:u-s},{width:s,height:s},r),sY.copy(a.data,h,{x:0,y:d-s},{x:l+c,y:u-s},{width:s,height:s},r),sY.copy(a.data,h,{x:0,y:0},{x:l+c,y:u+d},{width:s,height:s},r),sY.copy(a.data,h,{x:c-s,y:0},{x:l-s,y:u+d},{width:s,height:s},r)}this.image=h,this.iconPositions=a,this.patternPositions=n}addImages(e,i,r,a){for(let n in e){let o=e[n],s={x:0,y:0,w:o.data.width+2*r,h:o.data.height+2*r};a.push(s),i[n]=new us(s,o,r),o.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(e,i,r){for(let a in this.haveRenderCallbacks=this.haveRenderCallbacks.filter(i=>e.hasImage(i,r)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r),e.getUpdatedImages(r))this.patchUpdatedImage(this.iconPositions[a],e.getImage(a,r),i),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a,r),i)}patchUpdatedImage(e,i,r){if(!e||!i||e.version===i.version)return;e.version=i.version;let[a,n]=e.tl;r.update(i.data,{position:{x:a,y:n}})}}function uh(e,i,r,a,n,o,s,l,h){for(let u=i;u<i+a;u++)uu(e,r*o+u,o,n,s,l,h);for(let u=r;u<r+n;u++)uu(e,u*o+i,1,a,s,l,h)}function uu(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}}am(us,"ImagePosition"),am(ul,"ImageAtlas");let uc={none:0,ideographs:1,all:2};class ud{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]||e8.GLYPHS_URL;for(let i in e)for(let r of e[i])a.push({stack:i,id:r});eF(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 void r(Error("glyphs > 65535 not supported"));if(a.ranges[s])return void r(null,{stack:e,id:i,glyph:o});let l=a.requests[s];l||(l=a.requests[s]=[],ud.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){return this.localGlyphMode!==uc.none&&(this.localGlyphMode===uc.all?!!this.localFontFamily:!!this.localFontFamily&&
7(av["CJK Unified Ideographs"](e)||av["Hangul Syllables"](e)||av.Hiragana(e)||av.Katakana(e)||av["CJK Symbols and Punctuation"](e)||av["CJK Unified Ideographs Extension A"](e)||av["CJK Unified Ideographs Extension B"](e)))}_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 ud.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 sX({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 up(e,i,r,a){let n=[],o=e.imagePrimary,s=o.pixelRatio,l=o.paddedRect.w-2,h=o.paddedRect.h-2,u=e.right-e.left,c=e.bottom-e.top,d=o.stretchX||[[0,l]],p=o.stretchY||[[0,h]],f=(e,i)=>e+i[1]-i[0],m=d.reduce(f,0),_=p.reduce(f,0),g=l-m,y=h-_,x=0,v=m,b=0,w=_,T=0,S=g,E=0,M=y;if(o.content&&a){let e=o.content;x=uf(d,0,e[0]),b=uf(p,0,e[1]),v=uf(d,e[0],e[2]),w=uf(p,e[1],e[3]),T=e[0]-x,E=e[1]-b,S=e[2]-e[0]-v,M=e[3]-e[1]-w}let I=(a,n,l,h)=>{var d,p,f,g;let y=(a.stretch-x)/v*u+e.left,I=(d=a.fixed-T,d-S*a.stretch/m),A=(n.stretch-b)/w*c+e.top,C=(p=n.fixed-E,p-M*n.stretch/_),P=(l.stretch-x)/v*u+e.left,z=(f=l.fixed-T,f-S*l.stretch/m),D=(h.stretch-b)/w*c+e.top,R=(g=h.fixed-E,g-M*h.stretch/_),L=new eI(y,A),k=new eI(P,A),O=new eI(P,D),B=new eI(y,D),F=new eI(I/s,C/s),N=new eI(z/s,R/s),V=i*Math.PI/180;if(V){let e=Math.sin(V),i=Math.cos(V),r=[i,-e,e,i];L._matMult(r),k._matMult(r),B._matMult(r),O._matMult(r)}let U=a.stretch+a.fixed,j=l.stretch+l.fixed,G=n.stretch+n.fixed,q=h.stretch+h.fixed,Z=e.imageSecondary;return{tl:L,tr:k,bl:B,br:O,texPrimary:{x:o.paddedRect.x+1+U,y:o.paddedRect.y+1+G,w:j-U,h:q-G},texSecondary:Z?{x:Z.paddedRect.x+1+U,y:Z.paddedRect.y+1+G,w:j-U,h:q-G}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:N,minFontScaleX:S/s/u,minFontScaleY:M/s/c,isSDF:r}};if(a&&(o.stretchX||o.stretchY)){let e=um(d,g,m),i=um(p,y,_);for(let r=0;r<e.length-1;r++){let a=e[r],o=e[r+1];for(let e=0;e<i.length-1;e++)n.push(I(a,i[e],o,i[e+1]))}}else n.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:h+1}));return n}function uf(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 um(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}function u_(e,i){return i.max-e.max}ud.loadGlyphRange=function(e,i,r,a,n){let o=256*i;tw(a.transformRequest(a.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",`${o}-${o+255}`),ty.Glyphs),(e,i)=>{if(e)n(e);else if(i){let e={},r=new hX(i).readFields(hY,{});for(let i of r.glyphs)e[i.id]=i;n(null,{glyphs:e,ascender:r.ascender,descender:r.descender})}})},ud.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;let 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}}uh(y,0,0,u,c,u,this.f,this.v,this.z),uh(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}};class ug{constructor(e,i,r,a){this.p=new eI(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,oX(e,n,l))}}return(r?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}let uy=Number.POSITIVE_INFINITY,ux=Math.sqrt(2);function uv(e,[i,r]){let a=0,n=0;if(r===uy){i<0&&(i=0);let r=i/ux;
7switch(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 ub(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 uw(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,l){let h=[];if(0===i.positionedLines.length)return h;let u=a.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,c=function(e){let i=e[0],r=e[1],a=i*r;return a>0?[i,-r]:a<0?[-i,r]:0===i?[r,i]:[r,-i]}(r),d=Math.abs(i.top-i.bottom);for(let e of i.positionedLines)d-=e.lineOffset;let p=i.positionedLines.length,f=d/p,m=i.top-r[1];for(let e=0;e<p;++e){let a=i.positionedLines[e];for(let o of(m=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}(i,f,m,e),a.positionedGlyphs)){let e,a,d,p;if(!o.rect)continue;let f=o.rect||{},_=4,g=!0,y=1,x=0;if(o.imageName){let e=s[o.imageName];if(!e)continue;if(e.sdf){eX("SDF images are not supported in formatted text and will be ignored.");continue}g=!1,_=1/(y=e.pixelRatio)}let v=(n||l)&&o.vertical,b=o.metrics.advance*o.scale/2,w=o.metrics,T=o.rect;if(null===T)continue;l&&i.verticalizable&&(x=o.imageName?b-o.metrics.width*o.scale/2:0);let S=n?[o.x+b,o.y]:[0,0],E=[0,0],M=[0,0],I=!1;n||(v?(M=[o.x+b+c[0],o.y+c[1]-x],I=!0):E=[o.x+b+r[0],o.y+r[1]-x]);let A=T.w*o.scale/(y*(o.localGlyph?2:1)),C=T.h*o.scale/(y*(o.localGlyph?2:1));if(v){let i=o.y-m,r=new eI(-b,b-i),n=-Math.PI/2,s=new eI(...M);(e=new eI(-b+E[0],E[1]))._rotateAround(n,r)._add(s),e.x+=-i+b,e.y-=(w.left-_)*o.scale;let l=o.imageName?w.advance*o.scale:24*o.scale,h=String.fromCodePoint(o.glyph);"︶"===h||"ï¹"===h||"︸"===h||"ï¹"===h||"ï¹"===h||"︾"===h||"︼"===h||"︺"===h||"ï¸"===h||"ï¹"===h||"ï¸"===h||"ï¸"===h||"ï¸"===h||"ï½"===h||"ï¿£"===h||"ï¸"===h||"ï¸"===h?e.x+=(1-_)*o.scale:"︵"===h||"ï¹"===h||"︷"===h||"ï¹"===h||"ï¹"===h||"︽"===h||"︻"===h||"︹"===h||"ï¸"===h||"︿"===h?e.x+=l-w.height*o.scale+(-_-1)*o.scale:e.x+=o.imageName||w.width+2*_===T.w&&w.height+2*_===T.h?(l-C)/2:(l-(w.height+2*_)*o.scale)/2,a=new eI(e.x,e.y-A),d=new eI(e.x+C,e.y),p=new eI(e.x+C,e.y-A)}else{let i=(w.left-_)*o.scale-b+E[0],r=(-w.top-_)*o.scale+E[1],n=i+A,s=r+C;e=new eI(i,r),a=new eI(n,r),d=new eI(i,s),p=new eI(n,s)}if(u){let i;i=n?new eI(0,0):I?new eI(c[0],c[1]):new eI(r[0],r[1]),e._rotateAround(u,i),a._rotateAround(u,i),d._rotateAround(u,i),p._rotateAround(u,i)}let P=new eI(0,0),z=new eI(0,0);h.push({tl:e,tr:a,bl:d,br:p,texPrimary:f,texSecondary:void 0,writingMode:i.writingMode,glyphOffset:S,sectionIndex:o.sectionIndex,isSDF:g,pixelOffsetTL:P,pixelOffsetBR:z,minFontScaleX:0,minFontScaleY:0})}}return h}(0,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)])[0]>32640&&eX(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===v.kind&&((b=[128*m.compositeTextSizes[0].evaluate(l,{},g),128*m.compositeTextSizes[1].evaluate(l,{},g)])[0]>32640||b[1]>32640)&&eX(`${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 uT(e){for(let i in e)return e[i];return null}function uS(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 eI(p,c),i=new eI(f,c),r=new eI(p,d),a=new eI(f,d),n=h*eC,o=new eI(0,0);
7u&&(o=new eI(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 uE(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 uM(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=1/e._horizonShift*n;return e.elevation&&0!==e.elevation.exaggeration()||(s*=1+Math.max(e.zoom-17,0)),Math.min(1.01*s,l)}function uI(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=oz(a),h=oz(n),u=oD(o),c=oD(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(oz(l),oD(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 uA(e,{x:i,y:r},a=0){return new eI(((i-a)*e.scale-e.x)*8192,(r*e.scale-e.y)*8192)}let uC=eS.mat4.identity(new Float32Array(16));class uP{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 oM(0,0)}projectTilePoint(e,i,r){return{x:e,y:i,z:0}}locationPoint(e,i,r=!0){return e._coordinatePoint(e.locationCoordinate(i),r)}pixelsPerMeter(e,i){return 1/oA(e)*i}pixelSpaceConversion(e,i,r){return 1}farthestPixelDistance(e){return uM(e,e.pixelsPerMeter)}pointCoordinate(e,i,r,a){let n=new eI(i,Math.max(e.horizonLineFromTop(!1),r));return e.rayIntersectionCoordinate(e.pointRayIntersection(n,a))}pointCoordinate3D(e,i,r){let a=new eI(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 uC}createTileMatrix(e,i,r){let a,n,o;let s=r.canonical,l=eS.mat4.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){let h=uI(s,this);a=1,n=h.x+r.wrap*h.scale,o=h.y,eS.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 eS.mat4.translate(l,l,[n,o,0]),eS.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 uz extends uP{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];let[i,r]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(i*eC);this.n=(a+Math.sin(r*eC))/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])*eC,s=Math.sqrt(a-2*r*Math.sin(i*eC))/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]*eC*r,h=ek((s=eB(s,-Math.PI-l,Math.PI-l))/r*eP+this.center[0],-180,180),u=Math.asin(ek((a-(e*e+o*o)*r*r)/(2*r),-1,1));return new oM(h,ek(u*eP,-85.051129,85.051129))}}let uD=Math.sqrt(3)/2;class uR extends uP{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;let r=Math.asin(uD*Math.sin(i)),a=r*r,n=a*a*a;return{x:.5*(e*Math.cos(r)/(uD*(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=ek(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=uD*e*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))/Math.cos(r),s=Math.asin(Math.sin(r)/uD);return new oM(ek(180*o/Math.PI,-180,180),ek(180*s/Math.PI,-85.051129,85.051129))}}class uL extends uP{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 oM(360*(e-.5),ek(360*(.5-i),-85.051129,85.051129))}}let uk=Math.PI/2;function uO(e){return Math.tan((uk+e)/2)}class uB extends uP{constructor(e){super(e),this.center=e.center||[0,30];let[i,r]=this.parallels=e.parallels||[30,30],a=i*eC,n=r*eC;this.southernCenter=a+n<0,this.southernCenter&&(a=-a,n=-n);let o=Math.cos(a),s=uO(a);this.n=a===n?Math.sin(a):Math.log(o/Math.cos(n))/Math.log(uO(n)/s),this.f=o*Math.pow(uO(a),this.n)/this.n}project(e,i){i*=eC,this.southernCenter&&(i=-i),e=(e-this.center[0])*eC;let{n:r,f:a}=this;a>0?i<-uk+1e-6&&(i=-uk+1e-6):i>uk-1e-6&&(i=uk-1e-6);let n=a/Math.pow(uO(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=ek(l/r*eP+this.center[0],-180,180),u=ek((2*Math.atan(Math.pow(a/s,1/r))-uk)*eP,-85.051129,85.051129);return new oM(h,this.southernCenter?-u:u)}}class uF extends uP{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:oC(e),y:oP(i),z:0}}unproject(e,i){return new oM(oz(e),oD(i))}}let uN=85.051129*eC;class uV extends uP{project(e,i){let r=(i*=eC)*i,a=r*r;return{x:.5*((e*=eC)*(.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=ek(r-n,-uN,uN)}while(Math.abs(n)>1e-6&&--a>0);return new oM(ek(e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))*eP,-180,180),r*eP)}}let uU=85.051129*eC;class uj extends uP{project(e,i){i*=eC,e*=eC;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,E=w*T-S*b;o=(v*w-x*S)/E,s=(x*T-v*b)/E,r=ek(r-o,-Math.PI,Math.PI),a=ek(a-s,-uU,uU)}while((Math.abs(o)>1e-6||Math.abs(s)>1e-6)&&--n>0);return new oM(r*eP,a*eP)}}class uG extends uP{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]*eC)),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*eC*a*r+.5,y:-Math.sin(i*eC)/a*r+.5,z:0}}unproject(e,i){let{scale:r,cosPhi:a}=this,n=ek((e-.5)/r*eP/a,-180,180),o=Math.asin(ek(-(i-.5)/r*a,-1,1));return new oM(n,ek(o*eP,-85.051129,85.051129))}}class uq extends uF{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=sM(e,i,r),n=sC(sv(r));return eS.vec3.transformMat4(a,a,n),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i){let r=oS(i.lat,i.lng),a=eS.vec3.normalize([],r),n=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,o=1/oA(0)*8192*n;eS.vec3.scaleAndAdd(r,r,a,o);let s=eS.mat4.identity(new Float64Array(16));return eS.mat4.multiply(s,e.pixelMatrix,e.globeMatrix),eS.vec3.transformMat4(r,r,s),new eI(r[0],r[1])}pixelsPerMeter(e,i){return 1/oA(0)*i}pixelSpaceConversion(e,i,r){let a=1/oA(e)*i,n=tj(1/oA(45)*i,a,r);return this.pixelsPerMeter(e,i)/n}createTileMatrix(e,i,r){let a=sP(sv(r.canonical));return eS.mat4.multiply(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){let{center:r}=e,a=sC(sv(i));return eS.mat4.rotateY(a,a,r.lng*eC),eS.mat4.rotateX(a,a,r.lat*eC),eS.mat4.scale(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,r,a){return sg(e,i,r,!0)||new oB(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!sg(e,i.x,i.y,!1)}farthestPixelDistance(e){let i=function(e,i){let r;let a=e.cameraToCenterDistance,n=e._centerAltitude*i,o=e._camera,s=e._camera.forward(),l=eS.vec3.add([],eS.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=eS.vec3.scale([],o.up(),d),f=eS.vec3.scale([],o.right(),d*c),m=eS.vec3.normalize([],eS.vec3.add([],eS.vec3.add([],s,p),f)),_=[];
7if(new ss(l,m).closestPointOnSphere(u,h,_)){let i=eS.vec3.add([],_,u),a=eS.vec3.sub([],i,l);r=Math.cos(e.fovAboveCenter)*eS.vec3.length(a)}else{let e=eS.vec3.sub([],l,u),i=eS.vec3.sub([],u,l);eS.vec3.normalize(i,i);let a=eS.vec3.length(e)-h,n=Math.acos((r=Math.sqrt(a*(a+2*h)))/(h+a))-Math.acos(eS.vec3.dot(s,i));r*=Math.cos(n)}return 1.01*r}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),r=sL(e.zoom);return r>0?tj(i,uM(e,1/oA(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 sM(i,r,e,1)}upVectorScale(e){return{metersToTile:sm(sI(sv(e)))}}}function uZ(e){let i=e.parallels,r=!!i&&.01>Math.abs(i[0]+i[1]);switch(e.name){case"mercator":return new uF(e);case"equirectangular":return new uL(e);case"naturalEarth":return new uV(e);case"equalEarth":return new uR(e);case"winkelTripel":return new uj(e);case"albers":return r?new uG(e):new uz(e);case"lambertConformalConic":return r?new uG(e):new uB(e);case"globe":return new uq(e)}throw Error(`Invalid projection name: ${e.name}`)}let u$=lD.VectorTileFeature.types,uH=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function uW(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?1:0),m,16*u,16*c,256*d,256*p)}function uX(e,i,r){e.emplaceBack(i,r)}function uY(e,i,r,a,n,o,s){e.emplaceBack(i,r,a,n,o,s)}function uJ(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 uK{constructor(e){this.layoutVertexArray=new ng,this.indexArray=new nE,this.programConfigurations=e,this.segments=new nQ,this.dynamicLayoutVertexArray=new nd,this.opacityVertexArray=new nx,this.placedSymbolArray=new nU,this.iconTransitioningVertexArray=new nv,this.globeExtVertexArray=new ny,this.zOffsetVertexArray=new nA}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,hP.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,hD.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,uH,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,hL.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,hz.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,hR.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())}}am(uK,"SymbolBuffers");class uQ{constructor(e,i,r){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new r,this.segments=new nQ,this.collisionVertexArray=new nS,this.collisionVertexArrayExt=new nd}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,hk.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,hO.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}am(uQ,"CollisionBuffers");class u0{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=eS.mat4.identity([]),this.placementViewportMatrix=eS.mat4.identity([]);let i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hN(this.zoom,i["text-size"]),this.iconSizeData=hN(this.zoom,i["icon-size"]);let 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=>hQ[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=r.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new uK(new om(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new uK(new om(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new nq,this.lineVertexArray=new nZ,this.symbolInstances=new nG}calculateGlyphDependencies(e,i,r,a,n){for(let r=0;r<e.length;r++){let o=e.codePointAt(r);if(void 0===o)break;if(i[o]=!0,a&&n&&o<=65535){let a=hG[e.charAt(r)];a&&(i[a.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!lG(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=("constant"!==h.value.kind||h.value.value instanceof ii&&!h.value.value.isEmpty()||h.value.value.toString().length>0)&&("constant"!==l.value.kind||l.value.value.length>0),d="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!c&&!d)return;let f=i.iconDependencies,m=i.glyphDependencies,_=i.availableImages,g=new aB(this.zoom);for(let{feature:i,id:h,index:u,sourceLayerIndex:y}of e){let e,x;let v=n._featureFilter.needGeometry,b=oU(i,v);if(!n._featureFilter.filter(g,b,r))continue;if(v||(b.geometry=oV(i,r,a)),s&&1!==i.type&&r.z<=5){let e=b.geometry,i=(e,i)=>{let a=sM(e.x,e.y,r,1),n=sM(i.x,i.y,r,1);return .98078528056>eS.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(c){let i=n.getValueAndResolveTokens("text-field",b,r,_),a=ii.factory(i);(function(e){for(let i of e.sections)if(function(e){for(let i of e)if(aS(i.charCodeAt(0)))return!0;return!1}(i.text))return!0;return!1})(a)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===aL()||this.hasRTLText&&aO.isParsed())&&(e=function(e,i,r){return e.sections.forEach(e=>{e.text=function(e,i,r){let a=i.layout.get("text-transform").evaluate(r,{});return"uppercase"===a?e=e.toLocaleUpperCase():"lowercase"===a&&(e=e.toLocaleLowerCase()),aO.applyArabicShaping&&(e=aO.applyArabicShaping(e)),e}(e.text,i,r)}),e}(a,n,b))}if(d){let e=n.getValueAndResolveTokens("icon-image",b,r,_);x=e instanceof ir?e:ir.fromString(e)}if(!e&&!x)continue;let w=this.sortFeaturesByKey?p.evaluate(b,{},r):void 0;if(this.features.push({id:h,text:e,icon:x,index:u,sourceLayerIndex:y,geometry:b.geometry,properties:i.properties,type:u$[i.type],sortKey:w}),x&&(f[x.namePrimary]=!0,x.nameSecondary&&(f[x.nameSecondary]=!0)),e){let i=l.evaluate(b,{},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(hQ.vertical)>=0,e.sections))if(r.image)f[r.image.namePrimary]=!0;else{let n=ab(e.toString()),o=r.fontStack||i,s=m[o]=m[o]||{};this.calculateGlyphDependencies(r.text,s,a,this.allowVerticalPlacement,n)}}}"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)),this.sortFeaturesByKey&&this.features.sort((e,i)=>
7e.sortKey-i.sortKey)}update(e,i,r,a,n){let o=0!==Object.keys(e).length;if(o&&!this.stateDependentLayers.length)return;let s=o?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,i,s,r,a,n),this.icon.programConfigurations.updatePaintArrays(e,i,s,r,a,n)}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=uZ(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===hQ.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:E,minFontScaleX:M,minFontScaleY:I,glyphOffset:A,isSDF:C,sectionIndex:P}=i[a],z=v.vertexLength,D=A[1];if(uW(y,h.x,h.y,n.x,D+n.y,d.x,d.y,r,C,w.x,w.y,M,I),uW(y,h.x,h.y,s.x,D+s.y,d.x+d.w,d.y,r,C,E.x,w.y,M,I),uW(y,h.x,h.y,u.x,D+u.y,d.x,d.y+d.h,r,C,w.x,E.y,M,I),uW(y,h.x,h.y,c.x,D+c.y,d.x+d.w,d.y+d.h,r,C,E.x,E.y,M,I),l){let{x:i,y:r,z:a}=l.anchor,[n,o,s]=l.up;uY(x,i,r,a,n,o,s),uY(x,i,r,a,n,o,s),uY(x,i,r,a,n,o,s),uY(x,i,r,a,n,o,s),uJ(e.dynamicLayoutVertexArray,i,r,a,T)}else uJ(e.dynamicLayoutVertexArray,h.x,h.y,h.z,T);if(_){let i=b||d;uX(e.iconTransitioningVertexArray,i.x,i.y),uX(e.iconTransitioningVertexArray,i.x+i.w,i.y),uX(e.iconTransitioningVertexArray,i.x,i.y+i.h),uX(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(A[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 E=l?l.anchor:h;e.placedSymbolArray.emplaceBack(E.x,E.y,E.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 eI(e.x1,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eI(e.x2,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eI(e.x2,e.y2)),this._commitLayoutVertex(r.layoutVertexArray,a,n,o,u,c,new eI(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){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new uQ(nw,hB.members,nv),this.iconCollisionBox=new uQ(nw,hB.members,nv);let r=hU(this.iconSizeData,e),a=hU(this.textSizeData,e);for(let n=0;n<this.symbolInstances.length;n++){let o=this.symbolInstances.get(n);this._addTextDebugCollisionBoxes(a,e,i,o.textBoxStartIndex,o.textBoxEndIndex,o),this._addTextDebugCollisionBoxes(a,e,i,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._addIconDebugCollisionBoxes(r,e,i,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._addIconDebugCollisionBoxes(r,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=hV(this.textSizeData,e,n)/24;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,i,r){let a=this.icon.placedSymbolArray.get(r),n=hV(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){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){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){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let r=hU(this.iconSizeData,e),a=hU(this.textSizeData,e);for(let n=0;n<this.symbolInstances.length;n++){let o=this.symbolInstances.get(n);this._updateTextDebugCollisionBoxes(a,e,i,o.textBoxStartIndex,o.textBoxEndIndex,o),this._updateTextDebugCollisionBoxes(a,e,i,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._updateIconDebugCollisionBoxes(r,e,i,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._updateIconDebugCollisionBoxes(r,e,i,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}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)}}}am(u0,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),u0.addDynamicAttributes=uJ;class u1{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:tW,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}}am(u1,"FormatSectionOverride",{omit:["defaultValue"]});let u2=()=>z||(z={layout:C||(C=new aX({"symbol-placement":new a$(aY.layout_symbol["symbol-placement"]),"symbol-spacing":new a$(aY.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new a$(aY.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new aH(aY.layout_symbol["symbol-sort-key"]),"symbol-z-order":new a$(aY.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new a$(aY.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new a$(aY.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new a$(aY.layout_symbol["icon-ignore-placement"]),"icon-optional":new a$(aY.layout_symbol["icon-optional"]),"icon-rotation-alignment":new a$(aY.layout_symbol["icon-rotation-alignment"]),"icon-size":new aH(aY.layout_symbol["icon-size"]),"icon-text-fit":new aH(aY.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new aH(aY.layout_symbol["icon-text-fit-padding"]),"icon-image":new aH(aY.layout_symbol["icon-image"]),"icon-rotate":new aH(aY.layout_symbol["icon-rotate"]),"icon-padding":new a$(aY.layout_symbol["icon-padding"]),"icon-keep-upright":new a$(aY.layout_symbol["icon-keep-upright"]),"icon-offset":new aH(aY.layout_symbol["icon-offset"]),"icon-anchor":new aH(aY.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new a$(aY.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new a$(aY.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new a$(aY.layout_symbol["text-rotation-alignment"]),"text-field":new aH(aY.layout_symbol["text-field"]),"text-font":new aH(aY.layout_symbol["text-font"]),"text-size":new aH(aY.layout_symbol["text-size"]),"text-max-width":new aH(aY.layout_symbol["text-max-width"]),"text-line-height":new aH(aY.layout_symbol["text-line-height"]),"text-letter-spacing":new aH(aY.layout_symbol["text-letter-spacing"]),"text-justify":new aH(aY.layout_symbol["text-justify"]),"text-radial-offset":new aH(aY.layout_symbol["text-radial-offset"]),"text-variable-anchor":new a$(aY.layout_symbol["text-variable-anchor"]),"text-anchor":new aH(aY.layout_symbol["text-anchor"]),"text-max-angle":new a$(aY.layout_symbol["text-max-angle"]),"text-writing-mode":new a$(aY.layout_symbol["text-writing-mode"]),"text-rotate":new aH(aY.layout_symbol["text-rotate"]),"text-padding":new a$(aY.layout_symbol["text-padding"]),"text-keep-upright":new a$(aY.layout_symbol["text-keep-upright"]),"text-transform":new aH(aY.layout_symbol["text-transform"]),"text-offset":new aH(aY.layout_symbol["text-offset"]),"text-allow-overlap":new a$(aY.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new a$(aY.layout_symbol["text-ignore-placement"]),"text-optional":new a$(aY.layout_symbol["text-optional"]),visibility:new a$(aY.layout_symbol.visibility)})),paint:P||(P=new aX({"icon-opacity":new aH(aY.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new aH(aY.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new aH(aY.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new aH(aY.paint_symbol["text-emissive-strength"]),"icon-color":new aH(aY.paint_symbol["icon-color"]),"icon-halo-color":new aH(aY.paint_symbol["icon-halo-color"]),"icon-halo-width":new aH(aY.paint_symbol["icon-halo-width"]),"icon-halo-blur":new aH(aY.paint_symbol["icon-halo-blur"]),"icon-translate":new a$(aY.paint_symbol["icon-translate"]),"icon-translate-anchor":new a$(aY.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new aH(aY.paint_symbol["icon-image-cross-fade"]),"text-opacity":new aH(aY.paint_symbol["text-opacity"]),"text-occlusion-opacity":new aH(aY.paint_symbol["text-occlusion-opacity"]),"text-color":new aH(aY.paint_symbol["text-color"],{runtimeType:tK,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new aH(aY.paint_symbol["text-halo-color"]),"text-halo-width":new aH(aY.paint_symbol["text-halo-width"]),"text-halo-blur":new aH(aY.paint_symbol["text-halo-blur"]),"text-translate":new a$(aY.paint_symbol["text-translate"]),"text-translate-anchor":new a$(aY.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new a$(aY.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new a$(aY.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new a$(aY.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new a$(aY.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new aH(aY.paint_symbol["symbol-z-offset"]),"symbol-elevation-reference":new a$(aY.paint_symbol["symbol-elevation-reference"])}))});class u3 extends nt{constructor(e,i,r,a){super(e,u2(),i,r,a),this._colorAdjustmentMatrix=eS.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){return this._saturation===e&&this._contrast===i&&this._brightnessMin===r&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(e,i,r,a){e=e6(e),i=e5(i);let n=eS.mat4.create(),o=e/3,s=1-2*o,l=.5-.5*i,h=a-r;return eS.mat4.multiply(n,[h,0,0,0,0,h,0,0,0,0,h,0,r,r,r,1],[i,0,0,0,0,i,0,0,0,0,i,0,l,l,l,1]),eS.mat4.multiply(n,n,[s,o,o,0,o,s,o,0,o,o,s,0,0,0,0,1]),n}(e,i,r,a),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()||an(s.value)||!o?o:(n=i.properties,o.replace(/{([^{}]+)}/g,(e,i)=>i in n?String(n[i]):""))}createBucket(e){return new u0(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let e of u2().paint.overridableProperties){if(!u3.hasPaintOverride(this.layout,e))continue;let i=this.paint.get(e),r=new aa(new u1(i),i.property.specification,this.scope,this.options),a=null;a="constant"===i.value.kind||"source"===i.value.kind?new as("source",r):new al("composite",r,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new aq(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&u3.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){let r=e.get("text-field"),a=u2().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 ii)o(r.value.value.sections);else if("source"===r.value.kind){let e=i=>{n||(i instanceof ih&&is(i.value)===t2?o(i.value.sections):i instanceof ip?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 of(this,{zoom:i,lut:r}),overrideFog:!1}}}var u4=nn([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function u5(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 u6(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 u8{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=Math.max(s+r,this.size?this.size[0]:0),u=Math.max(l+a,this.size?this.size[1]:0);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,u5(this.format),u6(this.format),e);else{let i=e.data;i&&o.texSubImage2D(o.TEXTURE_2D,0,s,l,r,a,u5(this.format),u6(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 u9{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 u7(e,i,r,a,n,o,s,l){let h=[e,i,1,r,a,1,n,o,1],u=[s,l,1],c=eS.mat3.adjoint([],h),[d,p,f]=eS.vec3.transformMat3(u,u,c);return eS.mat3.multiply(h,h,[d,0,0,0,p,0,0,0,f])}function ce(e,i,r,a,n,o,s,l){let h=function(e,i,r,a,n,o,s,l){let h=u7(0,0,1,0,1,1,0,1),u=u7(e,i,r,a,n,o,s,l),c=eS.mat3.adjoint([],h);return eS.mat3.multiply(u,u,c)}(e,i,r,a,n,o,s,l);return[h[2]/h[8]/8192,h[5]/h[8]/8192]}function ct(e){return[e[0],Math.min(Math.max(e[1],-85.051129),85.051129)]}class ci extends tO{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){if(this._loaded=i||!1,this.fire(new tD("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=tS(this.map._requestManager.transformRequest(this.url,ty.Image),(i,r)=>{this._imageRequest=null,this._loaded=!0,i?this.fire(new tR(i)):r&&(this.image=r instanceof HTMLImageElement?tt.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url&&(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded)),this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new u9(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 tD("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 u9||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(oB.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 o7(o,l,Math.floor((r+n)/2*s))}(i),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new tD("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){var i;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 r=uI(new o7(0,0,0),this.map.transform.projection),a=[r.projection.project(this.coordinates[0][0],this.coordinates[0][1]),r.projection.project(this.coordinates[1][0],this.coordinates[1][1]),r.projection.project(this.coordinates[2][0],this.coordinates[2][1]),r.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){let i=e[1].x-e[0].x,r=e[1].y-e[0].y,a=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,s=e[3].y-e[2].y,l=e[0].x-e[3].x,h=e[0].y-e[3].y,u=i*n-a*r,c=a*s-o*n,d=o*h-l*s,p=l*r-i*h;return u>0&&c>0&&d>0&&p>0||u<0&&c<0&&d<0&&p<0}(a))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let n=uI(this.tileID,this.map.transform.projection),[o,s,l,h]=this.coordinates.map(e=>{let i=n.projection.project(e[0],e[1]);return uA(n,i)._round()});this.perspectiveTransform=ce(o.x,o.y,s.x,s.y,l.x,l.y,h.x,h.y);let u=this._boundsArray=new nh;u.emplaceBack(o.x,o.y,0,0),u.emplaceBack(s.x,s.y,8192,0),u.emplaceBack(h.x,h.y,0,8192),u.emplaceBack(l.x,l.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(u,u4.members),this.boundsSegments=nQ.simpleSegment(0,0,4,2);let c=[],[d,p,f,m]=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]}([ct((i=this.coordinates)[0]),ct(i[1]),ct(i[2]),ct(i[3])]);{let i=new nh,[n,o,s,l]=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]}(a),h=e=>
7[(e.x-n)/s,(e.y-o)/l],[u,_,g,y]=a.map(h),x=function(e,i,r,a,n,o,s,l){let h=u7(0,0,1,0,1,1,0,1),u=u7(e,i,r,a,n,o,s,l),c=eS.mat3.adjoint([],u);return eS.mat3.multiply(h,h,c)}(u[0],u[1],_[0],_[1],g[0],g[1],y[0],y[1]);this.elevatedGlobePerspectiveTransform=ce(u[0],u[1],_[0],_[1],g[0],g[1],y[0],y[1]);let v=(e,r)=>{c.push(e.lng);let a=Math.round((e.lng-d)/f*8192),n=Math.round((e.lat-p)/m*8192),o=h(r),s=eS.vec3.transformMat3([],[o[0],o[1],1],x),l=Math.round(s[0]/s[2]*8192),u=Math.round(s[1]/s[2]*8192);i.emplaceBack(a,n,l,u)},b=a[3].x-a[0].x,w=a[3].y-a[0].y,T=a[2].x-a[1].x,S=a[2].y-a[1].y;for(let e=0;e<65;e++){let i=e/64,n=[a[0].x+i*b,a[0].y+i*w],o=[a[1].x+i*T,a[1].y+i*S],s=o[0]-n[0],l=o[1]-n[1];for(let e=0;e<65;e++){let i=e/64,a={x:n[0]+s*i,y:n[1]+l*i,z:0};v(r.projection.unproject(a.x,a.y),a)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(i,u4.members)}{this.maxLongitudeTriangleSize=0;let i=[],r=new nE,a=(e,a,n)=>{r.emplaceBack(e,a,n);let o=c[e],s=c[a],l=c[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 nE;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=nQ.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,f/8192,0,m/8192,0,0,p,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 u9||(this.texture?this.texture.update(this.image):(this.texture=new u8(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 nQ,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=e4(a,0,a.length,n+l);return e===a.length||s(e,e3(a,e+1,a.length,n+360-l)-e),o}n<a[0]&&(n+=360);let h=e3(a,0,a.length,n-l);if(h===a.length)return s(0,a.length),o;s(0,h-0);let u=e4(a,h+1,a.length,n+l);return u!==a.length&&s(u,a.length-u),o}}class cr extends nt{constructor(e,i,r,a){super(e,{layout:L||(L=new aX({visibility:new a$(aY.layout_raster.visibility)})),paint:k||(k=new aX({"raster-opacity":new a$(aY.paint_raster["raster-opacity"]),"raster-color":new aW(aY.paint_raster["raster-color"]),"raster-color-mix":new a$(aY.paint_raster["raster-color-mix"]),"raster-color-range":new a$(aY.paint_raster["raster-color-range"]),"raster-hue-rotate":new a$(aY.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new a$(aY.paint_raster["raster-brightness-min"]),"raster-brightness-max":new a$(aY.paint_raster["raster-brightness-max"]),"raster-saturation":new a$(aY.paint_raster["raster-saturation"]),"raster-contrast":new a$(aY.paint_raster["raster-contrast"]),"raster-resampling":new a$(aY.paint_raster["raster-resampling"]),"raster-fade-duration":new a$(aY.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new a$(aY.paint_raster["raster-emissive-strength"]),"raster-array-band":new a$(aY.paint_raster["raster-array-band"]),"raster-elevation":new a$(aY.paint_raster["raster-elevation"])}))},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 ci&&(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())}
7updateColorRamp(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=sK({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[r,a])}}class ca extends nt{constructor(e,i,r,a){super(e,{layout:O||(O=new aX({visibility:new a$(aY["layout_raster-particle"].visibility)})),paint:B||(B=new aX({"raster-particle-array-band":new a$(aY["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new a$(aY["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new aW(aY["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new a$(aY["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new a$(aY["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new a$(aY["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new a$(aY["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new a$(aY["paint_raster-particle"]["raster-particle-elevation"])}))},i,r,a),this._updateColorRamp(),this.lastInvalidatedAt=tt.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=sK({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=tt.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class cn extends nt{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){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 co(e,i,r){let a=[0,0,1],n=eS.quat.identity([]);return eS.quat.rotateY(n,n,r?-(e*eC)+Math.PI:e*eC),eS.quat.rotateX(n,n,-(i*eC)),eS.vec3.transformQuat(a,a,n),eS.vec3.normalize(a,a)}function cs(e,i){let r=ch(e.projection,e.zoom,e.width,e.height),a=function(e,i,r,a,n){let o=new oM(r.lng-180*cu,r.lat),s=new oM(r.lng+180*cu,r.lat),l=e.project(o.lng,o.lat),h=e.project(s.lng,s.lat),u=-Math.atan2(h.y-l.y,h.x-l.x),c=oB.fromLngLat(r);c.y=ek(c.y,-1+cu,1-cu);let d=c.toLngLat(),p=e.project(d.lng,d.lat),f=oB.fromLngLat(d);f.x+=cu;let m=f.toLngLat(),_=e.project(m.lng,m.lat),g=cd(_.x-p.x,_.y-p.y,u),y=oB.fromLngLat(d);y.y+=cu;let x=y.toLngLat(),v=e.project(x.lng,x.lat),b=cd(v.x-p.x,v.y-p.y,u),w=Math.abs(g.x)/Math.abs(b.y),T=eS.mat4.identity([]);eS.mat4.rotateZ(T,T,-u*(1-(n?0:a)));let S=eS.mat4.identity([]);return eS.mat4.scale(S,S,[1,1-(1-w)*a,1]),S[4]=-b.x/b.y*a,eS.mat4.rotateZ(S,S,u),eS.mat4.multiply(S,T,S
7),S}(e.projection,0,e.center,r,i),n=cl(e);return eS.mat4.scale(a,a,[n,n,1]),a}function cl(e){let i=e.projection,r=ch(e.projection,e.zoom,e.width,e.height);return Math.pow(2,cc(i,e.center)*r+(1-r)*cc(i,oM.convert(i.center)))}function ch(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 eO(o[0]+s,o[1]+s,i)}let cu=1/4e4;function cc(e,i){let r=ek(i.lat,-85.051129,85.051129),a=new oM(i.lng-180*cu,r),n=new oM(i.lng+180*cu,r),o=e.project(a.lng,r),s=e.project(n.lng,r),l=oB.fromLngLat(a),h=oB.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 cd(e,i,r){let a=Math.cos(r),n=Math.sin(r);return{x:e*a-i*n,y:e*n+i*a}}function cp(e,i,r){eS.mat4.identity(e),eS.mat4.rotateZ(e,e,i[2]*eC),eS.mat4.rotateX(e,e,i[0]*eC),eS.mat4.rotateY(e,e,i[1]*eC),eS.mat4.scale(e,e,r),eS.mat4.multiply(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function cf(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>eS.vec3.length(h)||1e-12>eS.vec3.length(u))return eS.quat.identity(e);let c=eS.vec3.cross([],h,u);return eS.vec3.normalize(c,c),eS.vec3.subtract(u,a,i),h[2]=(o-n)*l,u[2]=(s-n)*l,eS.vec3.cross(h,h,u),eS.vec3.normalize(h,h),eS.quat.rotationTo(e,c,h)}function cm(e,i,r=!1){let a=sL(i.zoom),n=function(e,i,r){let a=i.worldSize,n=[e[12],e[13],e[14]],o=oD(n[1]/a),s=oz(n[0]/a),l=eS.mat4.identity([]),h=1/oA(o)*a,u=1/oA(0)*a*oL(o,i.zoom),c=1/sz(a),d=u*c;if(r){let e=ch(i.projection,i.zoom,i.width,i.height,1024);d=c*i.projection.pixelSpaceConversion(i.center.lat,a,e)}let p=oS(o,s);eS.vec3.add(p,p,eS.vec3.scale([],eS.vec3.normalize([],p),h*d*n[2]));let f=function(e){let i=[e[0],e[1],e[2]],r=[0,1,0],a=eS.vec3.cross([],r,i);return eS.vec3.cross(r,i,a),0===eS.vec3.squaredLength(r)&&(r=[0,1,0],eS.vec3.cross(a,i,r)),eS.vec3.normalize(a,a),eS.vec3.normalize(r,r),eS.vec3.normalize(i,i),[a[0],a[1],a[2],0,r[0],r[1],r[2],0,i[0],i[1],i[2],0,e[0],e[1],e[2],1]}(p);eS.mat4.scale(l,l,[d,d,d*h]),eS.mat4.translate(l,l,[-n[0],-n[1],-n[2]]);let m=eS.mat4.multiply([],i.globeMatrix,f);return eS.mat4.multiply(m,m,l),eS.mat4.multiply(m,m,e),m}(e,i,r);return a>0?function(e,i,r){let a=(e,i,r)=>{let a=eS.vec3.length(e),n=eS.vec3.length(i),o=sb(e,i,r);return eS.vec3.scale(o,o,1/eS.vec3.length(o)*tj(a,n,r))},n=a([e[0],e[1],e[2]],[i[0],i[1],i[2]],r),o=a([e[4],e[5],e[6]],[i[4],i[5],i[6]],r),s=a([e[8],e[9],e[10]],[i[8],i[9],i[10]],r),l=sb([e[12],e[13],e[14]],[i[12],i[13],i[14]],r);return[n[0],n[1],n[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,l[0],l[1],l[2],1]}(n,function(e,i){let r=i.worldSize,a=1/oA(0)*r*oL(i.center.lat,i.zoom)/sz(r),n=1/oA(i.center.lat)*r,o=eS.mat4.identity([]);return eS.mat4.rotateY(o,o,i.center.lng*eC),eS.mat4.rotateX(o,o,i.center.lat*eC),eS.mat4.translate(o,o,[0,0,ov]),eS.mat4.scale(o,o,[a,a,a*n]),eS.mat4.translate(o,o,[i.point.x-.5*r,i.point.y-.5*r,0]),eS.mat4.multiply(o,o,e),eS.mat4.multiply(o,i.globeMatrix,o)}(e,i),a):n}function c_(e,i,r,a){let n;let o=sf.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 eI(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(oZ(e,n))return s}let cg=nn([{name:"a_pos_3f",components:3,type:"Float32"}]),cy=nn([{name:"a_color_3f",components:3,type:"Float32"}]),cx=nn([{name:"a_color_4f",components:4,type:"Float32"}]),cv=nn([{name:"a_uv_2f",components:2,type:"Float32"}]),cb=nn([{name:"a_normal_3f",components:3,type:"Float32"}]),cw=nn([{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"}]),cT=nn([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),cS={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class cE{constructor(e,i,r,a){this.message=(e?`${e}: `:"")+r,a&&(this.identifier=a),null!=i&&i.__line__&&(this.line=i.__line__)}}function cM(e,i){let r=-1===e.indexOf("://");try{return new URL(e,r&&i?"http://example.com":void 0),!0}catch(e){return!1}}
7class cI{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 cA{constructor(){this.instancedDataArray=new nL,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class cC{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=oO(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=oU(o,n);if(!this.layers[0]._featureFilter.filter(new aB(this.zoom),u,r))continue;let c={id:e,sourceLayerIndex:h,index:l,geometry:n?u.geometry:oV(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);eS.vec3.exactEquals(i.rotation,s)&&eS.vec3.exactEquals(i.scale,l)&&eS.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(lG(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(!lN(i,r,cS.Model,a)&&!(i.min.x>c||c>i.max.x||i.min.y>d||d>i.max.y)&&(p=lH(l$(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.instancedDataArray,cw.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 eX(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),n;cM(n,!1)&&(this.modelUris.includes(n)||this.modelUris.push(n)),this.instancesPerModel[n]||(this.instancesPerModel[n]=new cA);let o=this.instancesPerModel[n],s=o.instancedDataArray,l=new cI(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])),cp(d,l,h);let p=Math.round(100*c.a)+c.b/1.05;for(let i=0;i<e.instancedDataCount;
7++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:oO(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]}}}am(cC,"ModelBucket",{omit:["layers"]}),am(cA,"PerModelAttributes"),am(cI,"ModelFeature");let cP={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function cz(e,i,r,a,n,o,s,l,h,u=!1){let c=r.zoom,d=r.project(a),p=oL(a.lat,c),f=1/p;eS.mat4.identity(e),eS.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 oB(d.x/g,d.y/g),0));let i=eS.vec4.transformMat4([],[d.x,d.y,e,1],r.projMatrix)[3]/r.cameraToCenterDistance;m=i,_=i*oL(r.center.lat,c)}else if("globe"===r.projection.name){let i=cm(e,r),n=eS.mat4.multiply([],r.projMatrix,i),o=[0,0,0,1];eS.vec4.transformMat4(o,o,n);let s=o[3]/r.cameraToCenterDistance,l=sL(c),h=r.projection.pixelsPerMeter(a.lat,g)*oL(a.lat,c),u=r.projection.pixelsPerMeter(r.center.lat,g)*oL(r.center.lat,c);m=s/tj(h,oR(r.center.lat),l),_=s*p/h,m*=u,_*=u}}else m=f;eS.mat4.scale(e,e,[m,m,_]);let y=[...e],x=i.orientation,v=[];if(cp(v,[x[0]+n[0],x[1]+n[1],x[2]+n[2]],o),eS.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=sf.projectAabbCorners(r,a),l=1/oA(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=eS.vec3.cross(l,l,[s[0]-a[0],s[1]-a[1],i*(s[2]-a[2])]);eS.vec3.normalize(h,h),n.dotProductWithUp=eS.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 oB(u[0]/i.worldSize,u[1]/i.worldSize),0),m=o.getAtPointOrZero(new oB(c[0]/i.worldSize,c[1]/i.worldSize),0),_=o.getAtPointOrZero(new oB(d[0]/i.worldSize,d[1]/i.worldSize),0),g=o.getAtPointOrZero(new oB(p[0]/i.worldSize,p[1]/i.worldSize),0),y=(f+g)/2,x=(m+_)/2;return y>x?m<_?cf(e,c,p,u,m,g,f,l):cf(e,d,u,p,_,f,g,l):f<g?cf(e,u,c,d,f,m,_,l):cf(e,p,d,c,g,_,m,l),Math.max(y,x)}(o,r,i.aabb,e,a);let s=eS.mat4.fromQuat([],o),l=eS.mat4.multiply([],s,v);eS.mat4.multiply(e,y,l)}else n=r.elevation.getAtPointOrZero(new oB(d.x/g,d.y/g),0);0!==n&&(e[14]+=n)}}function cD(e,i,r=!1){e.uploaded||(e.gfxTexture=new u8(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 cR(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,cg.members,!1,!0),e.normalArray&&(e.normalBuffer=i.createVertexBuffer(e.normalArray,cb.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=i.createVertexBuffer(e.texcoordArray,cv.members,!1,!0)),e.colorArray&&(e.colorBuffer=i.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?cy:cx).members,!1,!0)),e.featureArray&&(e.pbrBuffer=i.createVertexBuffer(e.featureArray,cT.members,!0)),e.segments=nQ.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);let a=e.material;a.pbrMetallicRoughness.baseColorTexture&&cD(a.pbrMetallicRoughness.baseColorTexture,i),a.pbrMetallicRoughness.metallicRoughnessTexture&&cD(a.pbrMetallicRoughness.metallicRoughnessTexture,i),a.normalTexture&&cD(a.normalTexture,i),a.occlusionTexture&&cD(a.occlusionTexture,i,r),a.emissionTexture&&cD(a.emissionTexture,i)}(a,i,r);if(e.children)for(let a of e.children)cR(a,i,r)}function cL(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)cL(i)}function ck(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)ck(i)}class cO{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 cO(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 eI(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?tj(tj(h.get(s,l,a),h.get(s,l+1,a),o-l),tj(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/oA(e))*this._dem.stride}}let cB=new Float32Array(262144),cF=new Uint8Array(262144),cN=["","wall","door","roof","window","lamp","logo"];class cV{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()}_getLocalBounds(){if(!this.node.meshes)return new sf([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0,i=new sf([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=sf.applyTransformFast(r.aabb,this.node.matrix),i.encapsulate(r.transformedAabb)),e++;this.aabb=i}return this.aabb}}class cU{constructor(e,i,r,a,n,o){for(let s of(this.id=i,this.modelTraits|=cP.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,r&&(this.modelTraits|=cP.HasMapboxMeshFeatures),a&&(this.modelTraits|=cP.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=n,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[],e))this.nodesInfo.push(new cV(s)),function e(i,r,a){if(i.meshes)for(let e of i.meshes)e.aabb.min[0]!==1/0&&a.insert(r,e.aabb.min[0],e.aabb.min[1],e.aabb.max[0],e.aabb.max[1]);if(i.children)for(let n of i.children)e(n,r,a)}(s,o.featureIndexArray.length,o.grid),o.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,o.bucketLayerIDs.length-1,0)}updateFootprints(e,i){for(let r of this.getNodesInfo()){let a=r.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;let i=this.getNodesInfo();for(let r of i){let i=r.node;this.uploaded?this.updatePbrBuffer(i):cR(i,e,!0)}for(let e of i)cL(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;return!!(!this.uploaded||this.dirty||a.name!==this.projection.name||cj(r.paint.get("model-color").value,o)||cj(r.paint.get("model-color-mix-intensity").value,o)||cj(r.paint.get("model-roughness").value,o)||cj(r.paint.get("model-emissive-strength").value,o)||cj(r.paint.get("model-height-based-emissive-strength-multiplier").value,o))&&(this.projection=a,this.brightness=n,!0)}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)}}
7evaluate(e){for(let i of this.getNodesInfo()){if(!i.node.meshes)continue;let r=i.feature,a=i.node.meshes&&i.node.meshes[0].featureData,n=i.evaluatedColor[2],o=i.evaluatedRMEA[2],s=this.id.canonical;if(i.hasTranslucentParts=!1,a){for(let a=0;a<cN.length;a++){let n=cN[a];n.length&&(r.properties.part=n);let o=e.paint.get("model-color").evaluate(r,{},s).toRenderColor(null),l=e.paint.get("model-color-mix-intensity").evaluate(r,{},s);i.evaluatedColor[a]=[o.r,o.g,o.b,l],i.evaluatedRMEA[a][0]=e.paint.get("model-roughness").evaluate(r,{},s),i.evaluatedRMEA[a][2]=e.paint.get("model-emissive-strength").evaluate(r,{},s),i.evaluatedRMEA[a][3]=o.a,i.emissionHeightBasedParams[a]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(r,{},s),!i.hasTranslucentParts&&o.a<1&&(i.hasTranslucentParts=!0)}delete r.properties.part,function(e,i,r){let a=e.node,n=0,o=r&cP.HasMeshoptCompression;for(let r of a.meshes){if(a.lights&&a.lightMeshIndex===n||!r.featureData)continue;r.featureArray=new nk,r.featureArray.reserve(r.featureData.length);let s=i;for(let i of r.featureData){let n;let 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 nk).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=tj(p,255*r[0],r[3]),f=tj(f,255*r[1],r[3]),m=tj(m,255*r[2],r[3]));let _=p<<8|f,g=m<<8|Math.floor(255*a[3]),y=Math.min(Math.round(.5*ek(a[2],0,2)*255),255)<<8|15*a[0]<<4|15*a[1],x=ek(n[0],0,1),v=ek(n[1],0,1),b=ek(n[2],0,1),w=ek(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,ek(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++}}(i,n!==i.evaluatedColor[2]||o!==i.evaluatedRMEA[2],this.modelTraits)}else i.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(r,{},s);i.evaluatedScale=e.paint.get("model-scale").evaluate(r,{},s),this.updatePbrBuffer(i.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=cO.create(e,r,n);if(!i)return;
7for(let n of(this.modelTraits&cP.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;let u=ek(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)cF[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===cF[e*o+r]&&(cF[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===cF[e*o+r]&&(cB[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===cF[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(cF[u]>=e)continue;let d=cB[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),cB[n]=i._dem.set(a,r,l),cF[n]=e}}}}}s&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=tt.now())}getNodesInfo(){return this.nodesInfo}destroy(){for(let e of this.getNodesInfo())cL(e.node),ck(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=eS.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]};eS.mat4.invert(o,l.node.matrix),n[0]=e,n[1]=i,eS.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 eI(e,i),new eI(e,i),a),a.length>0)return{height:void 0,maxHeight:l.feature.properties.height,hidden:l.hiddenByReplacement,verticalScale:l.evaluatedScale[2]}}}}function cj(e,i){return!e.isLightConstant&&i}function cG(e,i,r,a){let n=1<<e.z;i.lat=oD((a/8192+e.y)/n),i.lng=oz((r/8192+e.x)/n)}am(cU,"Tiled3dModelBucket",{omit:["layers"]}),am(cV,"Tiled3dModelFeature");let cq={circle:class extends nt{constructor(e,i,r,a){super(e,{layout:p||(p=new aX({"circle-sort-key":new aH(aY.layout_circle["circle-sort-key"]),visibility:new a$(aY.layout_circle.visibility)})),paint:f||(f=new aX({"circle-radius":new aH(aY.paint_circle["circle-radius"]),"circle-color":new aH(aY.paint_circle["circle-color"]),"circle-blur":new aH(aY.paint_circle["circle-blur"]),"circle-opacity":new aH(aY.paint_circle["circle-opacity"]),"circle-translate":new a$(aY.paint_circle["circle-translate"]),"circle-translate-anchor":new a$(aY.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new a$(aY.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new a$(aY.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new aH(aY.paint_circle["circle-stroke-width"]),"circle-stroke-color":new aH(aY.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new aH(aY.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new a$(aY.paint_circle["circle-emissive-strength"])}))},i,r,a)}createBucket(e){return new oq(e)}queryRadius(e){return o2("circle-radius",this,e)+o2("circle-stroke-width",this,e)+o3(this.paint.get("circle-translate"))}queryIntersectsFeature(e,i,r,a,n,o,s,l){let h=o5(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 sj(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=sU(this);return{config:new of(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}},heatmap:class extends nt{createBucket(e){return new sZ(e)}constructor(e,i,r,a){super(e,{layout:m||(m=new aX({visibility:new a$(aY.layout_heatmap.visibility)})),paint:_||(_=new aX({"heatmap-radius":new aH(aY.paint_heatmap["heatmap-radius"]),"heatmap-weight":new aH(aY.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new a$(aY.paint_heatmap["heatmap-intensity"]),"heatmap-color":new aW(aY.paint_heatmap["heatmap-color"]),"heatmap-opacity":new a$(aY.paint_heatmap["heatmap-opacity"])}))},i,r,a),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sK({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 o2("heatmap-radius",this,e)}queryIntersectsFeature(e,i,r,a,n,o,s,l){let h=this.paint.get("heatmap-radius").evaluate(i,r);return sj(e,a,o,s,l,!0,!0,new eI(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 of(this,{zoom:i,lut:r}),overrideFog:!1}:{}}},hillshade:class extends nt{constructor(e,i,r,a){super(e,{layout:g||(g=new aX({visibility:new a$(aY.layout_hillshade.visibility)})),paint:y||(y=new aX({"hillshade-illumination-direction":new a$(aY.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new a$(aY.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new a$(aY.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new a$(aY.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new a$(aY.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new a$(aY.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new a$(aY.paint_hillshade["hillshade-emissive-strength"])}))},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 nt{constructor(e,i,r,a){super(e,{layout:x||(x=new aX({"fill-sort-key":new aH(aY.layout_fill["fill-sort-key"]),visibility:new a$(aY.layout_fill.visibility)})),paint:v||(v=new aX({"fill-antialias":new a$(aY.paint_fill["fill-antialias"]),"fill-opacity":new aH(aY.paint_fill["fill-opacity"]),"fill-color":new aH(aY.paint_fill["fill-color"]),"fill-outline-color":new aH(aY.paint_fill["fill-outline-color"]),"fill-translate":new a$(aY.paint_fill["fill-translate"]),"fill-translate-anchor":new a$(aY.paint_fill["fill-translate-anchor"]),"fill-pattern":new aH(aY.paint_fill["fill-pattern"]),"fill-emissive-strength":new a$(aY.paint_fill["fill-emissive-strength"]),"fill-z-offset":new aH(aY.paint_fill["fill-z-offset"])}))},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 of(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 lu(e)}queryRadius(){return o3(this.paint.get("fill-translate"))}queryIntersectsFeature(e,i,r,a,n,o){return!e.queryGeometry.isAboveHorizon&&o$(o4(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a)}isTileClipped(){return!0}is3D(){return 0!==this.paint.get("fill-z-offset").constantOr(1)}},"fill-extrusion":class extends nt{constructor(e,i,r,a){super(e,{layout:T||(T=new aX({visibility:new a$(aY["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new a$(aY["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:S||(S=new aX({"fill-extrusion-opacity":new a$(aY["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new aH(aY["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new a$(aY["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new a$(aY["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new aH(aY["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new aH(aY["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new aH(aY["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new a$(aY["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new a$(aY["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new a$(aY["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new a$(aY["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new a$(aY["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new a$(aY["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new a$(aY["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new a$(aY["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new aH(aY["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new aH(aY["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new a$(aY["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new a$(aY["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new a$(aY["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new a$(aY["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new aH(aY["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new aH(aY["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new a$(aY["paint_fill-extrusion"]["fill-extrusion-cast-shadows"])}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new he(e)}queryRadius(){return o3(this.paint.get("fill-extrusion-translate"))}is3D(){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=o5(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 he){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=hl([a],[new eI(0,0),new eI(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=hs();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=hc(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),eS.vec3.transformMat4(m,m,o),eS.vec3.transformMat4(_,_,o),i.push(new lR(m[0],m[1],m[2])),y.push(new lR(_[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=hc(c,p,i,r,o,s,l,h);d[0]=c,d[1]=p,d[2]=m.base,d[3]=1,eS.vec4.transformMat4(d,d,n),d[3]=Math.max(d[3],1e-5);let _=new lR(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,eS.vec4.transformMat4(d,d,n),d[3]=Math.max(d[3],1e-5);let g=new lR(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,E=g+p,M=y+f,I=Math.max(x+m,1e-5);e.push(new lR(v/T,b/T,w/T)),r.push(new lR(S/I,E/I,M/I))}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;o$(r,i)&&(a=hu(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];oZ(r,n)&&(a=Math.min(a,hu(r,n)))}}return a!==1/0&&a}(b,w,T.isPointQuery()?T.screenBounds:T.screenGeometry)}},line:class extends nt{constructor(e,i,r,a){let n=hA();super(e,n,i,r,a),n.layout&&(this.layout=new aZ(n.layout)),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof rc,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 hC(hA().paint.properties["line-width"].specification)).useIntegerZoom=!0),A).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new hb(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,i,r){let a=hM(this);return{config:new of(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}queryRadius(e){var i,r;return i=o2("line-width",this,e),((r=o2("line-gap-width",this,e))>0?r+2*i:i)/2+Math.abs(o2("line-offset",this,e))+o3(this.paint.get("line-translate"))}queryIntersectsFeature(e,i,r,a,n,o){var s,l;if(e.queryGeometry.isAboveHorizon)return!1;let h=o4(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 eI(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(oJ(e,n[i]))return!0}if(function(e,i,r){if(e.length>1){if(oH(e,i))return!0;for(let a=0;a<i.length;a++)if(oW(i[a],e,r))return!0}for(let a=0;a<e.length;a++)if(oW(e[a],i,r))return!0;return!1}(e,n,r))return!0}return!1}(h,a,u)}isTileClipped(){return!0}isDraped(e){let i=this.layout.get("line-z-offset");return i.isConstant()&&!i.constantOr(0)}},symbol:u3,background:class extends nt{constructor(e,i,r,a){super(e,{layout:D||(D=new aX({visibility:new a$(aY.layout_background.visibility)})),paint:R||(R=new aX({"background-pitch-alignment":new a$(aY.paint_background["background-pitch-alignment"]),"background-color":new a$(aY.paint_background["background-color"]),"background-pattern":new a$(aY.paint_background["background-pattern"]),"background-opacity":new a$(aY.paint_background["background-opacity"]),"background-emissive-strength":new a$(aY.paint_background["background-emissive-strength"])}))},i,r,a)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,i,r){return{overrideFog:!1}}is3D(){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:cr,"raster-particle":ca,sky:class extends nt{constructor(e,i,r,a){super(e,{layout:F||(F=new aX({visibility:new a$(aY.layout_sky.visibility)})),paint:N||(N=new aX({"sky-type":new a$(aY.paint_sky["sky-type"]),"sky-atmosphere-sun":new a$(aY.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new a$(aY.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new a$(aY.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new a$(aY.paint_sky["sky-gradient-radius"]),"sky-gradient":new aW(aY.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new a$(aY.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new a$(aY.paint_sky["sky-atmosphere-color"]),"sky-opacity":new a$(aY.paint_sky["sky-opacity"])}))},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._skyboxInvali
7dated=!0)}_updateColorRamp(){this.colorRamp=sK({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")&&eX("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?co(o.azimuthal,90-o.polar,i):co(r[0],90-r[1],i)}let r=this.paint.get("sky-gradient-center");return co(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 nt{constructor(e,i,r,a){super(e,{paint:V||(V=new aX({}))},i,null)}},model:class extends nt{constructor(e,i,r,a){super(e,{layout:U||(U=new aX({visibility:new a$(aY.layout_model.visibility),"model-id":new aH(aY.layout_model["model-id"])})),paint:j||(j=new aX({"model-opacity":new a$(aY.paint_model["model-opacity"]),"model-rotation":new aH(aY.paint_model["model-rotation"]),"model-scale":new aH(aY.paint_model["model-scale"]),"model-translation":new aH(aY.paint_model["model-translation"]),"model-color":new aH(aY.paint_model["model-color"]),"model-color-mix-intensity":new aH(aY.paint_model["model-color-mix-intensity"]),"model-type":new a$(aY.paint_model["model-type"]),"model-cast-shadows":new a$(aY.paint_model["model-cast-shadows"]),"model-receive-shadows":new a$(aY.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new a$(aY.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new aH(aY.paint_model["model-emissive-strength"]),"model-roughness":new aH(aY.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new aH(aY.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new a$(aY.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new a$(aY.paint_model["model-front-cutoff"])}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new cC(e)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return e instanceof cU?8191:0}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 cC))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=eS.mat4.create(),c=new oM(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]];cG(d,c,s[n],0|s[n+1]),cz(u,h,o,c,i.rotation,i.scale,l,!1,!1,!1),"globe"===o.projection.name&&(u=cm(u,o));let f=eS.mat4.multiply([],o.projMatrix,u),m=e.queryGeometry,_=c_(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 al}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}
7queryIntersectsMatchingFeature(e,i,r,a){let n=e.tile,o=n.getBucket(this),s=null,l=Number.MAX_VALUE;if(!(o&&o instanceof cU))return{queryFeature:s,intersectionZ:l};let h=o.getNodesInfo()[i];if(h.hiddenByReplacement||!h.node.meshes||!r.filter(new aB(n.tileID.overscaledZ),h.feature,n.tileID.canonical))return{queryFeature:s,intersectionZ:l};let u=h.node,c=a.calculatePosMatrix(n.tileID.toUnwrapped(),a.worldSize),d=h.evaluatedScale,p=0;a.elevation&&u.elevation&&(p=u.elevation*a.elevation.exaggeration()),eS.mat4.translate(c,c,[(u.anchor?u.anchor[0]:0)*(d[0]-1),(u.anchor?u.anchor[1]:0)*(d[1]-1),p]),eS.mat4.scale(c,c,d),eS.mat4.multiply(c,c,u.matrix);let f=e.queryGeometry,m=f.isPointQuery()?f.screenBounds:f.screenGeometry,_=function(e){let i=eS.mat4.multiply([],c,e.matrix),r=eS.mat4.multiply(i,a.expandedFarZProjMatrix,i);for(let i=0;i<e.meshes.length;++i){let n=e.meshes[i];if(i===e.lightMeshIndex)continue;let o=c_(m,a,r,n.aabb);null!=o&&(l=Math.min(o,l))}if(e.children)for(let i of e.children)_(i)};if(_(u),l===Number.MAX_VALUE)return{queryFeature:s,intersectionZ:l};let g=new oM(0,0);return cG(n.tileID.canonical,g,h.node.anchor[0],h.node.anchor[1]),{queryFeature:s={type:"Feature",geometry:{type:"Point",coordinates:[g.lng,g.lat]},properties:h.feature.properties,id:h.feature.id,state:{},layer:this.serialize()},intersectionZ:l}}},clip:class extends nt{constructor(e,i,r,a){super(e,{layout:b||(b=new aX({"clip-layer-types":new a$(aY.layout_clip["clip-layer-types"]),"clip-layer-scope":new a$(aY.layout_clip["clip-layer-scope"])})),paint:w||(w=new aX({}))},i,r,a)}recalculate(e,i){super.recalculate(e,i)}createBucket(e){return new lp(e)}isTileClipped(){return!0}is3D(){return!0}}};class cZ{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class c${constructor(){this.tasks={},this.taskQueue=[],eG(["process"],this),this.invoker=new cZ(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 cH{constructor(e,i,r){this.target=e,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},eG(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new c$}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:ay(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,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||eK()){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>
7"===i.type){let r=this.callbacks[e];delete this.callbacks[e],r&&(i.error?r(ax(i.error)):r(null,ax(i.data)))}else{let r=new Set,a=i.hasCallback?(i,a)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:i?ay(i):null,data:ay(a,r)},r)}:e=>{},n=ax(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)}}class cW{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=eU();let r=this.workerPool.acquire(this.id);for(let e=0;e<r.length;e++){let a=new cW.Actor(r[e],i,this.id);a.name=`Worker ${e}`,this.actors.push(a)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,r){eF(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]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}cW.Actor=cH;class cX{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 cY(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 cJ(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,E=u[2]-r,M=(T*y+S*x+E*v)*w;if(M<0||M>1)return null;let I=S*f-E*p,A=E*d-T*f,C=T*p-S*d,P=(c[0]*I+c[1]*A+c[2]*C)*w;return P<0||M+P>1?null:(m*I+_*A+g*C)*w}function cK(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 cQ{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;let 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?1:0;n[0]=e*r,n[1]=i*r,n[2]=(e+1)*r-o,n[3]=(i+1)*r-o},s=new cX(a),l=[];for(let i=0;i<a*a;i++){o(i%a,Math.floor(i/a),n,!1,l);let r=c1(l[0],l[1],e),h=c1(l[2],l[1],e),u=c1(l[2],l[3],e),c=c1(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 cX(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,0,0,r,0)}raycastRoot(e,i,r,a,n,o,s=1){return cY([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:_,nodex:g,nodey:y,depth:x}=p.pop();if(this.leaves[l]){cK(g,y,x,e,i,r,a,c,d);let l=1<<x,h=(g+0)/l,u=(g+1)/l,p=(y+0)/l,v=(y+1)/l,b=c1(h,p,this.dem)*s,w=c1(u,p,this.dem)*s,T=c1(u,v,this.dem)*s,S=c1(h,v,this.dem)*s,E=cJ(c[0],c[1],b,d[0],c[1],w,d[0],d[1],T,n,o),M=cJ(d[0],d[1],T,c[0],d[1],S,c[0],c[
71],b,n,o),I=Math.min(null!==E?E:Number.MAX_VALUE,null!==M?M:Number.MAX_VALUE);if(I!==Number.MAX_VALUE)return I;{var f,m;let e=eS.vec3.scaleAndAdd([],n,o,_);if(c0(b,w,S,T,(e[0]-(f=c[0]))/(d[0]-f),(e[1]-(m=c[1]))/(d[1]-m))>=e[2])return _}continue}let v=0;for(let p=0;p<this._siblingOffset.length;p++){cK((g<<1)+this._siblingOffset[p][0],(y<<1)+this._siblingOffset[p][1],x+1,e,i,r,a,c,d),c[2]=-100,d[2]=this.maximums[this.childOffsets[l]+p]*s;let f=cY(c,d,n,o);if(null!=f){h[p]=f;let e=!1;for(let i=0;i<v&&!e;i++)f>=h[u[i]]&&(u.splice(i,0,p),e=!0);e||(u[v]=p),v++}}for(let e=0;e<v;e++){let i=u[e];p.push({idx:this.childOffsets[l]+i,t:h[i],nodex:(g<<1)+this._siblingOffset[i][0],nodey:(y<<1)+this._siblingOffset[i][1],depth:x+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 c0(e,i,r,a,n,o){return tj(tj(e,r,o),tj(i,a,o),n)}function c1(e,i,r){let a=r.dim,n=ek(e*a-.5,0,a-1),o=ek(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 c0(r.get(s,l),r.get(h,l),r.get(s,u),r.get(h,u),n-s,o-l)}let c2={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function c3(e,i,r){return(256*e*256+256*i+r)/10-1e4}function c4(e,i,r){return 256*e+i+r/256-32768}class c5{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 eX(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;let 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)]}let s="terrarium"===r?c4:c3;for(let e=0;e<o.length;++e){let i=4*e;this.floatView[e]=s(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}this._timestamp=tt.now()}_buildQuadTree(){this._tree=new cQ(this)}get(e,i,r=!1){r&&(e=ek(e,-1,this.dim),i=ek(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 c2[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=c5.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 sJ({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 c6(e,i,r){var a;1===e?i.header_length=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(dt,{version:0,name:"",units:"",tilesize:0,buffer:0,pixel_format:0,data_index:[]},a)))}function c8(e,i,r){var a;1===e?(i.delta_filter=(a=r.readVarint()+r.pos,r.readFields(c9,{block_size: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 c9(e,i,r){1===e&&(i.block_size=r.readVarint())}function c7(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 de(e,i,r){var a,n;1===e?i.first_byte=r.readFixed64():2===e?i.last_byte=r.readFixed64():3===e?i.filters.push((a=r.readVarint()+r.pos,r.readFields(c8,{}
7,a))):4===e?i.codec=(n=r.readVarint()+r.pos,r.readFields(c7,{},n)):5===e?i.deprecated_offset=r.readFloat():6===e?i.deprecated_scale=r.readFloat():7===e?i.bands.push(r.readString()):8===e?i.offset=r.readDouble():9===e&&(i.scale=r.readDouble())}function dt(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.pixel_format=r.readVarint():7===e&&i.data_index.push((a=r.readVarint()+r.pos,r.readFields(de,{first_byte:0,last_byte:0,filters:[],codec:null,offset:0,scale:0,deprecated_offset:0,deprecated_scale:0,bands:[]},a)))}function di(e,i,r){if(2===e)!function(e,i,r){e.readFields(dr,r,i)}(r,r.readVarint()+r.pos,i);else if(3===e)throw Error("Not implemented")}function dr(e,i,r){if(1===e){let e=0,a=r.readVarint()+r.pos;for(;r.pos<a;)i[e++]=r.readVarint()}}am(c5,"DEMData"),am(cQ,"DemMinMaxQuadTree",{omit:["dem"]});class da{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)}}var dn=Uint8Array,ds=Uint16Array,dl=Int32Array,dh=new dn([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]),du=new dn([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]),dc=new dn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),dd=function(e,i){for(var r=new ds(31),a=0;a<31;++a)r[a]=i+=1<<e[a-1];var n=new dl(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}},dp=dd(dh,2),df=dp.b,dm=dp.r;df[28]=258,dm[258]=28;for(var d_=dd(du,0).b,dg=new ds(32768),dy=0;dy<32768;++dy){var dx=(43690&dy)>>1|(21845&dy)<<1;dg[dy]=((65280&(dx=(61680&(dx=(52428&dx)>>2|(13107&dx)<<2))>>4|(3855&dx)<<4))>>8|(255&dx)<<8)>>1}var dv=function(e,i,r){for(var a=e.length,n=0,o=new ds(i);n<a;++n)e[n]&&++o[e[n]-1];var s,l=new ds(i);for(n=1;n<i;++n)l[n]=l[n-1]+o[n-1]<<1;s=new ds(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[dg[d]>>h]=u;return s},db=new dn(288);for(dy=0;dy<144;++dy)db[dy]=8;for(dy=144;dy<256;++dy)db[dy]=9;for(dy=256;dy<280;++dy)db[dy]=7;for(dy=280;dy<288;++dy)db[dy]=8;var dw=new dn(32);for(dy=0;dy<32;++dy)dw[dy]=5;var dT=dv(db,9),dS=dv(dw,5),dE=function(e){for(var i=e[0],r=1;r<e.length;++r)e[r]>i&&(i=e[r]);return i},dM=function(e,i,r){var a=i/8|0;return(e[a]|e[a+1]<<8)>>(7&i)&r},dI=function(e,i){var r=i/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&i)}
7,dA=["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"],dC=function(e,i,r){var a=Error(i||dA[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,dC),!r)throw a;return a},dP=new dn(0),dz="undefined"!=typeof TextDecoder&&new TextDecoder;try{dz.decode(dP,{stream:!0})}catch(e){}let dD={gzip_data:"gzip"};class dR extends Error{constructor(e){super(e),this.name="MRTError"}}let dL={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},dk={uint32:1,uint16:2,uint8:4},dO={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class dB{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 dR(`Layer '${e}' not found`);return i}getHeaderLength(e){let i=new Uint8Array(e),r=new DataView(e);if(13!==i[0])throw new dR("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 dR(`Expected header with length >= ${r} but got buffer of length ${i.length}`);let a=new G(i.subarray(0,r)).readFields(c6,{header_length: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 dR(`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 dF(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.first_byte-e.firstByte,s=n.last_byte-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 dN(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 dF{constructor({version:e,name:i,units:r,tilesize:a,pixel_format:n,buffer:o,data_index:s},l){if(this.version=e,1!==this.version)throw new dR(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=r,this.tileSize=a,this.buffer=o,this.pixelFormat=dL[n],this.dataIndex=s,this.bandShape=[a+2*o,a+2*o,dk[this.pixelFormat]],this._decodedBlocks=new da(l?l.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return dk[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 dR(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new dR(`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 dR(`Invalid band: ${JSON.stringify(o)}`);let s=this.dataIndex[e];a.includes(e)||a.push(e),n.add(e),i=Math.min(i,s.first_byte),r=Math.max(r,s.last_byte)}if(n.size>this.cacheSize)throw new dR(`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 dR(`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:0!==n.offset?n.offset:n.deprecated_offset,scale:0!==n.scale?n.scale:n.deprecated_scale}}}dB.setPbf=function(e){G=e};class dN{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)}}dB.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 dR(`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]||dC(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&&dC(6,"invalid gzip data"),function(e,i,r,a){var n=e.length;if(!n||i.f&&!i.l)return r||new dn(0);var o=!r,s=o||2!=i.i,l=i.i;o&&(r=new dn(3*n));var h,u,c=function(e){var i=r.length;if(e>i){var a=new dn(Math.max(2*i,e));a.set(r),r=a}},d=i.f||0,p=i.p||0,f=i.b||0,m=i.l,_=i.d,g=i.m,y=i.n,x=8*n;do{if(!m){d=dM(e,p,1);var v=dM(e,p+1,3);if(p+=3,!v){var b=e[(D=4+((p+7)/8|0))-4]|e[D-3]<<8,w=D+b;if(w>n){l&&dC(0);break}s&&c(f+b),r.set(e.subarray(D,w),f),i.b=f+=b,i.p=p=8*w,i.f=d;continue}if(1==v)m=dT,_=dS,g=9,y=5;else if(2==v){var T=dM(e,p,31)+257,S=dM(e,p+10,15)+4,E=T+dM(e,p+5,31)+1;p+=14;for(var M=new dn(E),I=new dn(19),A=0;A<S;++A)I[dc[A]]=dM(e,p+3*A,7);p+=3*S;var C=dE(I),P=(1<<C)-1,z=dv(I,C);for(A=0;A<E;){var D,R=z[dM(e,p,P)];if(p+=15&R,(D=R>>4)<16)M[A++]=D;else{var L=0,k=0;for(16==D?(k=3+dM(e,p,3),p+=2,L=M[A-1]):17==D?(k=3+dM(e,p,7),p+=3):18==D&&(k=11+dM(e,p,127),p+=7);k--;)M[A++]=L}}var O=M.subarray(0,T),B=M.subarray(T);g=dE(O),y=dE(B),m=dv(O,g),_=dv(B,y)}else dC(1);if(p>x){l&&dC(0);break}}s&&c(f+131072);for(var F=(1<<g)-1,N=(1<<y)-1,V=p;;V=p){var U=(L=m[dI(e,p)&F])>>4;if((p+=15&L)>x){l&&dC(0);break}if(L||dC(2),U<256)r[f++]=U;else{if(256==U){V=p,m=null;break}var j=U-254;U>264&&(j=dM(e,p,(1<<(Z=dh[A=U-257]))-1)+df[A],p+=Z);var G=_[dI(e,p)&N],q=G>>4;if(G||dC(3),p+=15&G,B=d_[q],q>3){var Z=du[q];B+=dI(e,p)&(1<<Z)-1,p+=Z}if(p>x){l&&dC(0);break}s&&c(f+131072);var $=f+j;if(f<B){var H=0-B,W=Math.min(B,$);for(H+f<0&&dC(3);f<W;++f)r[f]=(void 0)[H+f]}for(;f<$;++f)r[f]=r[f-B]}}i.l=m,i.p=V,i.b=f,i.f=d,m&&(d=1,i.m=g,i.d=_,i.n=y)}while(!d);return f!=r.length&&o?(h=r,(null==(u=f)||u>h.length)&&(u=h.length),new dn(h.subarray(0,u))):r.subarray(0,f)}(e.subarray(a,-8),{i:2},new dn((e[(r=e.length)-4]|e[r-3]<<8|e[r-2]<<16|e[r-1]<<24)>>>0))));let n=dD[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=>((function(e,i){e.readFields(di,i)})(new G(e),d),new dO[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?1:0,o=2===a?1:0;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":(function(e){for(let i=0,r=e.length;i<r;i++)e[i]=e[i]>>>1^-(1&e[i])})(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;default:throw new dR(`Unhandled filter "${h[i]}"`)}return{layerName:i,blockIndex:l,data:e}}).catch(e=>{throw e})}))},am(dN,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});var dV={workerUrl:"",workerClass:null,workerParams:void 0};let dU="mapboxgl_preloaded_worker_pool";class dj{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<dj.workerCount;)this.workers.push(null!=dV.workerClass?new dV.workerClass:new self.Worker(dV.workerUrl,dV.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEac
7h(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[dU]}numActive(){return Object.keys(this.active).length}}function dG(){return q||(q=new dj),q}dj.workerCount=2;let dq,dZ,d$,dH,dW,dX=null;function dY(){return eK()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:dZ||e8.DRACO_URL}function dJ(){if(eK()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(dH)return dH;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 dH=WebAssembly.validate(e)?e8.MESHOPT_SIMD_URL:e8.MESHOPT_URL}let dK={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},dQ={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},d0={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function d1(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 d2="KHR_draco_mesh_compression",d3="EXT_meshopt_compression",d4=new TextDecoder("utf8");function d5(e,i){return new URL(e,i).href}function d6(e,i){let r=e.json.bufferViews[i];return new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function d8(e,i=0,r){let a={json:null,images:[],buffers:[]};if(1179937895===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(d4.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(d4.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(d5(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(d2),n=l&&l.includes(d3);if(i&&e.push(function(){if(!d$)return null!=dq?dq:(dq=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.max(e>>>0,Math.ceil(1.2*n));try{return r.grow(Math.ceil((o-n)/65536)),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;let{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:E,Bb:M,Db:I,Gb:A}=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:E(),DT_UINT16:M(),DT_UINT32:I(),DT_FLOAT32:A()}})}(fetch(dY()))).then(e=>{d$=e,dq=void 0})}()),n&&e.push(function(){if(dW)return;let e=function(e){let i;let 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"};return{ready:r,supported:!0,decodeGltfBuffer(e,r,o,s,l,h){!function(e,i,r,a,n,o,s){let l=e.exports.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]])}}}(fetch(dJ()));return e.ready.then(()=>{dW=e})}()),o)for(let i=0;i<o.length;i++)e.push(function(e,i,r,a){return e.uri?fetch(d5(e.uri,a)).then(e=>e.blob()).then(e=>createImageBitmap(e)).then(e=>{i.images[r]=e}):void 0!==e.bufferView?createImageBitmap(new Blob([d6(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(()=>
7{if(i&&s)for(let{primitives:e}of s)for(let i of e)!function(e,i){let r=e.extensions&&e.extensions[d2];if(!r)return;let a=new d$.Decoder,n=d6(i,r.bufferView),o=new d$.Mesh;if(!a.DecodeArrayToMesh(n,n.byteLength,o))throw Error("Failed to decode Draco mesh");let s=i.json.accessors[e.indices],l=dK[s.componentType],h=s.count*l.BYTES_PER_ELEMENT,u=d$._malloc(h);for(let n of(l===Uint16Array?a.GetTrianglesUInt16Array(o,h,u):a.GetTrianglesUInt32Array(o,h,u),d1(d$.memory.buffer.slice(u,u+h),s,i),d$._free(u),Object.keys(r.attributes))){let s=a.GetAttributeByUniqueId(o,r.attributes[n]),l=i.json.accessors[e.attributes[n]],h=dQ[l.componentType],u=l.count*d0[l.type]*dK[l.componentType].BYTES_PER_ELEMENT,c=d$._malloc(u);a.GetAttributeDataArrayForAllPoints(o,s,d$[h],u,c),d1(d$.memory.buffer.slice(c,c+u),l,i),d$._free(c)}a.destroy(),o.destroy(),delete e.extensions[d2]}(i,a);if(n&&s&&h)for(let e of h)!function(e,i){if(!e.extensions||!e.extensions[d3])return;let r=e.extensions[d3],a=new Uint8Array(i.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),n=new Uint8Array(r.count*r.byteStride);dW.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[d3]}(e,a);return a})})}function d9(e,i){let r=e.json.bufferViews[i.bufferView],a=dK[i.componentType];return new a(e.buffers[r.buffer],(i.byteOffset||0)+(r.byteOffset||0),i.count*(r.byteStride&&r.byteStride!==d0[i.type]*a.BYTES_PER_ELEMENT?r.byteStride/a.BYTES_PER_ELEMENT:d0[i.type]))}function d7(e,i,r,a){let n=dK[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:d0[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 pe(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 nE;let s=i.json.accessors[a],l=s.count/3;o.indexArray.reserve(l);let h=d9(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 np;let u=i.json.accessors[n.POSITION];o.vertexArray.reserve(u.count);let c=d9(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 sf(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=d0[e.type],a=d9(i,e);o.colorArray=3===r?new np:new nd,o.colorArray.resize(e.count),d7(i,e,o.colorArray,a)}if(void 0!==n.NORMAL){o.normalArray=new np;let e=i.json.accessors[n.NORMAL];o.normalArray.resize(e.count);let r=d9(i,e);d7(i,e,o.normalArray,r)}if(void 0!==n.TEXCOORD_0&&r.length>0){o.texcoordArray=new nR;let e=i.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);let r=d9(i,e);d7(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=d9(i,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(d9(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 tV(...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||eS.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],eS.vec3.transformMat4(o,o,i),r.push(new eI(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 eI(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=s0(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 lc(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 pt{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){let r=e[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}let pi=["id","tile","layer","source","sourceLayer","state"];class pr{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}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 pi)void 0!==this[i]&&(e[i]=this[i]);return e}}class pa{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ap(8192,16,0),this.featureIndexArray=new nH,this.promoteId=i,this.is3DTile=!1}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 lD.VectorTile(new hX(this.rawTileData)).layers,this.sourceLayerCoder=new pt(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}query(e,i,r,a){let n;this.loadVTLayers();let o=e.params||{},s=a0(o.filter),l=e.tileResult,h=e.transform,u=l.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,(e,i,r,a)=>oK(l.bufferedTilespaceGeometry,e,i,r,a));c.sort(po);let d=null;h.elevation&&c.length>0&&(d=cO.create(h.elevation,this.tileID));let p={};for(let u=0;u<c.length;u++){let f=c[u];if(f===n)continue;n=f;let m=this.featureIndexArray.get(f),_=null;if(this.is3DTile){let e=this.bucketLayerIDs[0][0],r=i[e];if("model"!==r.type)continue;let{queryFeature:a,intersectionZ:n}=r.queryIntersectsMatchingFeature(l,m.featureIndex,s,h);a&&this.appendToResult(p,e,m.featureIndex,a,n)}else this.loadMatchingFeature(p,m,s,o.layers,o.availableImages,i,r,a,(i,r,a,n=0)=>(_||(_=oV(i,this.tileID.canonical,e.tileTransform)),r.queryIntersectsFeature(l,i,a,_,this.z,e.transform,e.pixelPosMatrix,d,n)))}return p}loadMatchingFeature(e,i,r,a,n,o,s,l,h){let{featureIndex:u,bucketIndex:c,sourceLayerIndex:d,layoutVertexArrayOffset:p}=i,f=this.bucketLayerIDs[c];if(a&&!function(e,i){for(let r=0;r<e.length;r++)if(i.indexOf(e[r])>=0)return!0;return!1}(a,f))return;let m=this.sourceLayerCoder.decode(d),_=this.vtLayers[m].feature(u);if(r.needGeometry){let e=oU(_,!0);if(!r.filter(new aB(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!r.filter(new aB(this.tileID.overscaledZ),_))return;let g=this.getId(_,m);for(let i=0;i<f.length;i++){let r=f[i];if(a&&0>a.indexOf(r))continue;let c=o[r];if(!c)continue;let d={};void 0!==g&&l&&(d=l.getState(c.sourceLayer||"_geojsonTileLayer",g));let m=!h||h(_,c,d,p);if(!m)continue;let y=new pr(_,this.z,this.x,this.y,g),x=eN({},s[r]);x.paint=pn(x.paint,c.paint,_,d,n),x.layout=pn(x.layout,c.layout,_,d,n),y.layer=x,this.appendToResult(e,r,u,y,m)}}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,o,s,l){let h={};this.loadVTLayers();let u=a0(n);for(let n of e)this.loadMatchingFeature(h,{bucketIndex:r,sourceLayerIndex:a,featureIndex:n,layoutVertexArrayOffset:0},u,o,s,l,i);return h}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="string"==typeof this.promoteId?this.promoteId:this.promoteId[i];null!=a&&(r=e.properties[a]),"boolean"==typeof r&&(r=Number(r))}return r}}function pn(e,i,r,a,n){return eZ(e,(e,o)=>{let s=i instanceof aZ?i.get(o):null;return s&&s.evaluate?s.evaluate(r,a,n):s})}function po(e,i){return i-e}am(pa,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let ps=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class pl{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=ps[15&r];if(!n)throw Error("Unrecognized array type.");let[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new pl(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;let n=ps.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}.`);
7return 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(ph(i,r,n,a),r[2*o+s]>l&&ph(i,r,n,o);h<u;){for(ph(i,r,h,u),h++,u--;r[2*h+s]<l;)h++;for(;r[2*u+s]>l;)u--}r[2*n+s]===l?ph(i,r,n,u):ph(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;if(c-d<=o){for(let r=d;r<=c;r++)pc(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];pc(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 ph(e,i,r,a){pu(e,r,a),pu(i,2*r,2*a),pu(i,2*r+1,2*a+1)}function pu(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function pc(e,i,r,a){let n=e-r,o=i-a;return n*n+o*o}e.$=aV,e.A=class extends cE{},e.B=i_,e.C=tZ,e.D=aJ,e.E=tO,e.F=r6,e.G=r3,e.H=r5,e.I=us,e.J=an,e.K=aK,e.L=ah,e.M=ao,e.N=ra,e.O=ro,e.P=eI,e.Q=rr,e.R=ty,e.S=ib,e.T=u8,e.U=tN,e.V=cE,e.W=aQ,e.X=r8,e.Y=r4,e.Z=function(e){let i=e.value,r=[];if(!i)return r;let a=i_(i);return"string"!==a?r=r.concat([new cE(e.key,i,`string expected, "${a}" found`)]):(cM(i,!0)||(r=r.concat([new cE(e.key,i,`invalid url "${i}"`)])),r)},e._=aY,e.a=function(e){return e8.API_CDN_URL_REGEX.test(e)},e.a$=nD,e.a0=aX,e.a1=a$,e.a2=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return eJ(e.expression.evaluate(i))}interpolate(e,i,r){return{x:tj(e.x,i.x,r),y:tj(e.y,i.y,r),z:tj(e.z,i.z,r),azimuthal:tj(e.azimuthal,i.azimuthal,r),polar:tj(e.polar,i.polar,r)}}},e.a3=aB,e.a4=al,e.a5=oB,e.a6=eS,e.a7=eO,e.a8=aZ,e.a9=sL,e.aA=st,e.aB=cr,e.aC=ca,e.aD=ci,e.aE=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.aF=u9,e.aG=function(e){return fetch(e).then(e=>e.arrayBuffer()).then(i=>d8(i,0,e))},e.aH=pe,e.aI=class{constructor(e,i,r,a){this.id=e,this.position=null!=i?new oM(i[0],i[1]):new oM(0,0),this.orientation=null!=r?r:[0,0,0],this.nodes=a,this.uploaded=!1,this.aabb=new sf([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){if(eS.mat4.multiply(e.matrix,i,e.matrix),e.meshes)for(let i of e.meshes){let r=sf.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=eS.mat4.identity([]);for(let i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,r,a,n,o,s=!1){cz(this.matrix,this,e.transform,this.position,i,r,a,n,o,s)}upload(e){if(!this.uploaded){for(let i of this.nodes)cR(i,e);for(let e of this.nodes)cL(e);this.uploaded=!0}}destroy(){for(let e of this.nodes)ck(e)}},e.aJ=eG,e.aK=uI,e.aL=oz,e.aM=oD,e.aN=nh,e.aO=nE,e.aP=eU,e.aQ=nN,e.aR=u0,e.aS=function(){aO.isLoading()||aO.isLoaded()||"deferred"!==aL()||ak()},e.aT=a0,e.aU=oU,e.aV=pr,e.aW=eQ,e.aX=hb,e.aY=lu,e.aZ=oV,e.a_=ns,e.aa=tj,e.ab=8192,e.ac=tG,e.ad=class{constructor(e){this.specification=e}
7possiblyEvaluate(e,i){return function([e,i]){let r=eJ([1,e,i]);return{x:r.x,y:r.y,z:r.z}}(e.expression.evaluate(i))}interpolate(e,i,r){return{x:tj(e.x,i.x,r),y:tj(e.y,i.y,r),z:tj(e.z,i.z,r)}}},e.ae=function(e,i,r=0,a=!0){let n=new eI(r,r),o=e.sub(n),s=i.add(n),l=[o,new eI(s.x,o.y),s,new eI(o.x,s.y)];return a&&l.push(o.clone()),l},e.af=function(e,i){let r=[];for(let a=0;a<e.length;a++){let n=eB(a-1,-1,e.length-1),o=eB(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));r.push(s.add(d))}return r},e.ag=uA,e.ah=oK,e.ai=function(e,i,r=0){return eS.vec3.fromValues(((i.x-r)*e.scale-e.x)*8192,(i.y*e.scale-e.y)*8192,i.z*oA(oD(i.y)))},e.aj=ss,e.ak=hT,e.al=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 eI(i,r),max:new eI(a,n)}},e.am=oC,e.an=oJ,e.ao=oF,e.ap=ek,e.aq=ov,e.ar=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.as=oI,e.at=oP,e.au=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.av=a9,e.aw=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=tw(e.request,(e,a,n,o)=>{e?i(e):a&&i(null,{vectorTile:r?void 0:new lD.VectorTile(new hX(a)),rawData:a,cacheControl:n,expires:o})});return()=>{a.cancel(),i()}},i)},e.ax=function(e){++tu>to&&(e.getActor().send("enforceCacheSizeLimit",tn),tu=0)},e.ay=te,e.az=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.b=function(e){return e8.API_FONTS_REGEX.test(e)},e.b$=function(e){let{x:i,y:r}=e.point,{lng:a,lat:n}=e._center;return sR(i,r,e.worldSize,a,n)},e.b0=so,e.b1=nQ,e.b2=s0,e.b3=u4,e.b4=function(e,i){let r=sL(i.zoom);if(0===r)return sv(e);let a=sS(e),n=sE(a),o=oC(a.getWest())*i.worldSize,s=oC(a.getEast())*i.worldSize,l=oP(a.getNorth())*i.worldSize,h=oP(a.getSouth())*i.worldSize,u=[o,l,0],c=[s,l,0],d=[o,h,0],p=[s,h,0],f=eS.mat4.invert([],i.globeMatrix);return eS.vec3.transformMat4(u,u,f),eS.vec3.transformMat4(c,c,f),eS.vec3.transformMat4(d,d,f),eS.vec3.transformMat4(p,p,f),n[0]=sb(n[0],d,r),n[1]=sb(n[1],p,r),n[2]=sb(n[2],c,r),n[3]=sb(n[3],u,r),sf.fromPoints(n)},e.b5=sC,e.b6=sM,e.b7=sb,e.b8=nl,e.b9=sn,e.bA=eB,e.bB=function(e){return e*eC},e.bC=e2,e.bD=function(e,i){return e/oA(i)},e.bE=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.bF=oa,e.bG=n7,e.bH=oe,e.bI=n9,e.bJ=n8,e.bK=oM,e.bL=uZ,e.bM=se,e.bN=sp,e.bO=cl,e.bP=o7,e.bQ=sT,e.bR=function(e,i,r,a,n,o,s,l,h){if("globe"===h.name)return sT(e,i,new o7(r,a,n),!1);let u=uI({z:r,x:a,y:n},h);return new sf([(o+u.x/u.scale)*i,u.y/u.scale*i,s],[(o+u.x2/u.scale)*i,u.y2/u.scale*i,l])},e.bS=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.bT=85.051129,e.bU=6,e.bV=function(e){let i=eS.mat4.identity(new Float64Array(16));eS.mat4.multiply(i,e.pixelMatrix,e.globeMatrix);let r=[0,ow,0],a=[0,ov,0];return eS.vec3.transformMat4(r,r,i),eS.vec3.transformMat4(a,a,i),[r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!sO(e,new oM(e.center.lat,90)),a[0]>0&&a[0]<=e.width&&a[1]>0&&a[1]<=e.height&&!sO(e,new oM(e.center.lat,-90))]},e.bW=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 eS.mat2.scale(new Float32Array(4),i.inverseAdjustmentMatrix,[a,a])},e.bX=ch,e.bY=cs,e.bZ=function(e){let i=cs(e,!0);return eS.mat2.invert([],[i[0],i[1],i[4],i[5]])},e.b_=sl,e.ba=dB,e.bb=hX,e.bc=tw,e.bd=function(e){let i=[];for(let r in e)i.push(e[r]);return i},e.be=function(e,i){let r=[];for(let a in e)a in i||r.push(a);return r},e.bf=eF,e.bg=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.bh=eA,e.bi=function(e,i){let{x:r,y:a}=e.point,n=sR(r,a,e.worldSize/e._pixelsPerMercatorPixel,0,0);return eS.mat4.multiply(n,n,sP(sv(i)))},e.bj=hU,e.bk=hQ,e.bl=hV,e.bm=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.bn=uJ,e.bo=un,e.bp=oZ,e.bq=24,e.br=lN,e.bs=cS,e.bt=l$,e.bu=lH,e.bv=ub,e.bw=uv,e.bx=h9,e.by=pl,e.bz=tV,e.c=e7,e.c$=sr,e.c0=function(e){return e*eP},e.c1=si,e.c2=5,e.c3=function(e){return ez[Math.round((e+45+360)%360/90)%4]},e.c4=45,e.c5=oA,e.c6=ot,e.c7=function(e,i,r){let a=Math.sqrt(e*e+i*i+r*r),n=a>0?Math.acos(r/a)*eP:0,o=0!==e||0!==i?Math.atan2(-i,-e)*eP+90:0;return o<0&&(o+=360),[a,o,n]},e.c8=oO,e.c9=sf,e.cA=function(e){return Math.round(Math.pow(Math.abs(Math.sin((e=ek(e,-80.051129,80.051129)/80.051129*90)*eC)),3)*(ob.length-1))},e.cB=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/ob[r],f=[0,d,0,p,0,0,n,s,0];if(e.z>0){let e=180/a;eS.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.cC=sv,e.cD=function(e,i,r){let a=eS.mat4.identity(new Float64Array(16));return eS.mat4.rotateY(a,r.globeMatrix,(i/(1<<e)-.5)*Math.PI*2),Float32Array.from(a)},e.cE=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 st(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 st(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)*tj(tj(c.get(m,_),c.get(m,_+1),f-_),tj(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 oB(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 eS.vec3.scale(s,s,o*l),s}}getForTilePoints(e,i,r,a){if(this.isUsingMockSource())return!1;let n=cO.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=Number.MIN_VALUE;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.cF=sJ,e.cG=sm,e.cH=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.cI=sD,e.cJ=e6,e.cK=e5,e.cL=256,e.cM=function(e,i){let r=[0,0,0],a=sC(sv(i.canonical));return eS.vec3.transformMat4(r,r,a),eS.vec3.transformMat4(r,r,e),r},e.cN=e=>({u_camera_to_center_distance:new n9(e),u_extrude_scale:new os(e),u_device_pixel_ratio:new n9(e),u_matrix:new oa(e),u_inv_rot_matrix:new oa(e),u_merc_center:new n7(e),u_tile_id:new oe(e),u_zoom_transition:new n9(e),u_up_dir:new oe(e),u_emissive_strength:new n9(e)}),e.cO=e=>({u_matrix:new oa(e),u_pixels_to_tile_units:new os(e),u_device_pixel_ratio:new n9(e),u_units_to_pixels:new n7(e),u_dash_image:new n8(e),u_gradient_image:new n8(e),u_image_height:new n9(e),u_texsize:new n7(e),u_tile_units_to_pixels:new n9(e),u_alpha_discard_threshold:new n9(e),u_trim_offset:new n7(e),u_trim_fade_range:new n7(e),u_trim_color:new ot(e),u_emissive_strength:new n9(e)}),e.cP=e=>({u_matrix:new oa(e),u_texsize:new n7(e),u_pixels_to_tile_units:new os(e),u_device_pixel_ratio:new n9(e),u_image:new n8(e),u_units_to_pixels:new n7(e),u_tile_units_to_pixels:new n9(e),u_alpha_discard_threshold:new n9(e),u_trim_offset:new n7(e)}),e.cQ=nT,e.cR=hF,e.cS=hj,e.cT=sU,e.cU=(e,i,r,a,n,o)=>{let s;let l=e.transform,h="globe"===l.projection.name;if("map"===o.paint.get("circle-pitch-alignment")){if(h){let e=sD(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:tt.devicePixelRatio,u_extrude_scale:s,u_inv_rot_matrix:sV,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=sL(l.zoom);let e=8192*n[0],r=8192*n[1];u.u_up_dir=l.projection.upVector(new o7(0,0,0),e,r)}return u},e.cV=hM,e.cW=(e,i,r,a,n,o)=>{let s=e.transform;return{u_matrix:hE(e,i,r,a),u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:s.calculatePixelsToTileUnitsMatrix(i),u_device_pixel_ratio:n,u_image:0,u_tile_units_to_pixels:hS(i,s),u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_alph
7a_discard_threshold:0,u_trim_offset:o}},e.cX=(e,i,r,a,n,o,s)=>{let l=e.transform,h=l.calculatePixelsToTileUnitsMatrix(i);return{u_matrix:hE(e,i,r,a),u_pixels_to_tile_units:h,u_device_pixel_ratio:o,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:hI(r)&&i.lineAtlasTexture?i.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:hS(i,e.transform),u_alpha_discard_threshold:0,u_trim_offset:s,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toRenderColor(r.lut).toArray01(),u_emissive_strength:r.paint.get("line-emissive-strength")}},e.cY=ej,e.cZ=sK,e.c_=hs,e.ca=eJ,e.cb=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.cc=function(e){return e({pluginStatus:aC,pluginURL:aP}),aR.on("pluginStateChange",e),e},e.cd=cW,e.ce=dG,e.cf=ud,e.cg=uc,e.ch=tv,e.ci=az,e.cj=tr,e.ck=tz,e.cl=eH,e.cm=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(0,i):e},e.cn=function(e){return e.indexOf("\x1f")>=0},e.co=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(i+1):""},e.cp=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.cq=function(e,i,r,a){return"custom"===e.type?new cn(e,i):new cq[e.type](e,i,r,a)},e.cr=e$,e.cs=aR,e.ct=tb,e.cu=oi,e.cv=class extends n6{constructor(e){super(e),this.current=on}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.cw=eD,e.cx=function(e,i,r){let a=sL(r.zoom),n=e.style.map._antialias,o=i.options.extStandardDerivativesForceOff||e.terrain&&e.terrain.exaggeration()>0;return 0===a&&!n&&!o},e.cy=function(e){let i=e.pixelsPerMeter,r=i/(1/oA(e.center.lat)),a=eS.mat4.identity(new Float64Array(16));return eS.mat4.translate(a,a,[e.point.x,e.point.y,0]),eS.mat4.scale(a,a,[r,r,i]),Float32Array.from(a)},e.cz=sS,e.d=function(e){return e8.API_TILEJSON_REGEX.test(e)},e.d$=Z,e.d0=he,e.d1=2147483648,e.d2=450,e.d3=7,e.d4=.0038760859073359074,e.d5=nn,e.d6=nO,e.d7=256,e.d8=sP,e.d9=np,e.dA=sk,e.dB=function(e){let i=[0,0,0],r=eS.mat4.identity(new Float64Array(16));return eS.mat4.multiply(r,e.pixelMatrix,e.globeMatrix),eS.vec3.transformMat4(i,i,r),new eI(i[0],i[1])},e.dC=function(e,i,r=!1){if(aC===aE||aC===aM||aC===aI)throw Error("setRTLTextPlugin cannot be called multiple times.");aP=tt.resolveURL(e),aC=aE,aA=i,aD(),r||ak()},e.dD=aL,e.dE=function(){dG().acquire(dU)},e.dF=function(){let e=q;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(dU),q=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.dG=dj,e.dH=function(e){let i=tl();if(!i)return;let r=i.delete(ta);e&&r.catch(e).then(()=>e())},e.dI=dV,e.dJ=dY,e.dK=function(e){dZ=tt.resolveURL(e),dX||(dX=new cW(dG(),new tO)),dX.broadcast("setDracoUrl",dZ)},e.dL=dJ,e.dM=function(e){dH=tt.resolveURL(e),dX||(dX=new cW(dG(),new tO)),dX.broadcast("setMeshoptUrl",dH)},e.dN=am,e.dO=sX,e.dP=2,e.dQ=pt,e.dR=pa,e.dS=hg,e.dT=eZ,e.dU=ul,e.dV=function(e,i,r,a,n,o,s,l,h,u,c){e.createArrays(),e.tilePixelRatio=8192/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;let d=e.layers[0].layout,p=e.layers[0]._unevaluatedLayout._values,f={};if("composite"===e.textSizeData.kind){let{minZoom:i,maxZoom:r}=e.textSizeData;f.compositeTextSizes=[p["text-size"].possiblyEvaluate(new aB(i),l),p["text-size"].possiblyEvaluate(new aB(r),l)]}if("composite"===e.iconSizeData.kind){let{minZoom:i,maxZoom:r}=e.iconSizeData;f.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new aB(i),l),p["icon-size"].possiblyEvaluate(new aB(r),l)]}f.layoutTextSize=p["text-size"].possiblyEvaluate(new aB(h+1),l),f.layoutIconSize=p["icon-size"].possiblyEvaluate(new aB(h+1),l),f.textMaxSize=p["text-size"].possiblyEvaluate(new aB(18),l);let m="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),_=d.get("text-size"),g=!1;for(let i of e.features)if(i.icon&&i.icon.nameSecondary){g=!0;break}for(let o of e.features){let h=d.get("text-font").evaluate(o,{},l).join(","),p=_.evaluate(o,{},l),y=f.layoutTextSize.evaluate(o,{},l),x=(f.layoutIconSize.evaluate(o,{},l),{horizontal:{},vertical:void 0}),v=o.text,b,w=[0,0];if(v){let a=v.toString(),s=24*d.get("text-letter-spacing").evaluate(o,{},l),u=24*d.get("text-line-height").evaluate(o,{},l),c=!function(e){for(let r of e){var i;if(i=r.charCodeAt(0),av.Arabic(i)||av["Arabic Supplement"](i)||av["Arabic Extended-A"](i)||av["Arabic Presentation Forms-A"](i)||av["Arabic Presentation Forms-B"](i))return!1}return!0}(a)?0:s,f=d.get("text-anchor").evaluate(o,{},l),_=d.get("text-variable-anchor");if(!_){let e=d.get("text-radial-offset").evaluate(o,{},l);w=e?uv(f,[24*e,uy]):d.get("text-offset").evaluate(o,{},l).map(e=>24*e)}
7let g=m?"center":d.get("text-justify").evaluate(o,{},l),b="point"===d.get("symbol-placement"),T=b?24*d.get("text-max-width").evaluate(o,{},l):1/0,S=o=>{e.allowVerticalPlacement&&ab(a)&&(x.vertical=h2(v,i,r,n,h,T,u,f,o,c,w,hQ.vertical,!0,y,p))};if(!m&&_){let e="auto"===g?_.map(e=>ub(e)):[g],a=!1;for(let o=0;o<e.length;o++){let s=e[o];if(!x.horizontal[s]){if(a)x.horizontal[s]=x.horizontal[0];else{let e=h2(v,i,r,n,h,T,u,"center",s,c,w,hQ.horizontal,!1,y,p);e&&(x.horizontal[s]=e,a=1===e.positionedLines.length)}}}S("left")}else{if("auto"===g&&(g=ub(f)),b||d.get("text-writing-mode").indexOf("horizontal")>=0||!ab(a)){let e=h2(v,i,r,n,h,T,u,f,g,c,w,hQ.horizontal,!1,y,p);e&&(x.horizontal[g]=e)}S(b?"left":g)}}let T=!1;if(o.icon&&o.icon.namePrimary){let i=a[o.icon.namePrimary];i&&(b=function(e,i,r,a){let{horizontalAlign:n,verticalAlign:o}=h9(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[o.icon.namePrimary],o.icon.nameSecondary?n[o.icon.nameSecondary]:void 0,d.get("icon-offset").evaluate(o,{},l),d.get("icon-anchor").evaluate(o,{},l)),T=i.sdf,void 0===e.sdfIcons?e.sdfIcons=i.sdf:e.sdfIcons!==i.sdf&&eX("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(i.pixelRatio!==e.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}let S=uT(x.horizontal)||x.vertical;e.iconsInText||(e.iconsInText=!!S&&S.iconsInText),(S||b)&&function(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m){var _;let g,y=o.textMaxSize.evaluate(i,{},d);void 0===y&&(y=s);let x=e.layers[0].layout,v=x.get("icon-offset").evaluate(i,{},d),b=uT(r.horizontal)||r.vertical,w="globe"===p.name,T=s/24,S=e.tilePixelRatio*y/24,E=(_=e.overscaling,e.zoom>18&&_>2&&(_>>=1),Math.max(8192/(512*_),1)*x.get("symbol-spacing")),M=x.get("text-padding")*e.tilePixelRatio,I=x.get("icon-padding")*e.tilePixelRatio,A=x.get("text-max-angle")*eC,C="map"===x.get("text-rotation-alignment")&&"point"!==x.get("symbol-placement"),P="map"===x.get("icon-rotation-alignment")&&"point"!==x.get("symbol-placement"),z=x.get("symbol-placement"),D=E/2,R=x.get("icon-text-fit").evaluate(i,{},d),L=x.get("icon-text-fit-padding").evaluate(i,{},d),k="none"!==R;!1===e.hasAnyIconTextFit&&k&&(e.hasAnyIconTextFit=!0),a&&k&&(e.allowVerticalPlacement&&r.vertical&&(g=ue(a,r.vertical,R,L,v,T)),b&&(a=ue(a,b,R,L,v,T)));let O=(s,l,_)=>{if(l.x<0||l.x>=8192||l.y<0||l.y>=8192)return;let y=null;if(w){let{x:e,y:i,z:r}=p.projectTilePoint(l.x,l.y,_);y={anchor:new ut(e,i,r,0,void 0),up:p.upVector(_,l.x,l.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,E,M,I){let A=e.addToLineVertexArray(i,a),C,P,z,D,R,L,k,O=0,B=0,F=0,N=0,V=-1,U=-1,j={},G=tz(""),q=r?r.anchor:i,Z="none"!==h.layout.get("icon-text-fit").evaluate(b,{},E),$=0,H=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")?[$,H]=h.layout.get("text-offset").evaluate(b,{},E).map(e=>24*e):($=24*h.layout.get("text-radial-offset").evaluate(b,{},E),H=uy),e.allowVerticalPlacement&&n.vertical){let e=n.vertical;if(m)L=uE(e),l&&(k=uE(l));else{let r=h.layout.get("text-rotate").evaluate(b,{},E)+90;z=uS(u,q,i,c,d,p,e,f,r,_),l&&(D=uS(u,q,i,c,d,p,l,y,r))}}if(o){let a=h.layout.get("icon-rotate").evaluate(b,{},E),n=up(o,a,T,Z),s=l?up(l,a,T,Z):void 0;P=uS(u,q,i,c,d,p,o,y,a),O=4*n.length;let f=e.iconSizeData,m=null;"source"===f.kind?(m=[128*h.layout.get("icon-size").evaluate(b,{},E)])[0]>32640&&eX(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===f.kind&&((m=[128*w.compositeIconSizes[0].evaluate(b,{},E),128*w.compositeIconSizes[1].evaluate(b,{},E)])[0]>32640||m[1]>32640)&&eX(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),e.addSymbols(e.icon,n,m,v,x,b,!1,r,i,A.lineStartIndex,A.lineLength,-1,S,E,M,I),V=e.icon.placedSymbolArray.length-1,s&&(B=4*s.length,e.addSymbols(e.icon,s,m,v,x,b,hQ.vertical,r,i,A.lineStartIndex,A.lineLength,-1,S,E,M,I),U=e.icon.placedSymbolArray.length-1)}for(let a in n.horizontal){let o=n.horizontal[a];C||(G=tz(o.text),m?R=uE(o):C=uS(u,q,i,c,d,p,o,f,h.layout.get("text-rotate").evaluate(b,{},E),_));let l=1===o.positionedLines.length;if(F+=uw(e,r,i,o,s,h,m,b,_,A,n.vertical?hQ.horizontal:hQ.horizontalOnly,l?Object.keys(n.horizontal):[a],j,V,w,S,E,M),l)break}n.vertical&&(N+=uw(e,r,i,n.vertical,s,h,m,b,_,A,hQ.vertical,["vertical"],j,U,w,S,E,M));let W=-1,X=(e,i)=>e?Math.max(e,i):i;W=X(R,-1),W=X(L,W);let Y=(W=X(k,W))>-1?1:0;e.glyphOffsetArray.length>=65535&&eX("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKey
7Ranges(e.symbolInstances.length,b.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,q.x,q.y,q.z,j.right>=0?j.right:-1,j.center>=0?j.center:-1,j.left>=0?j.left:-1,j.vertical>=0?j.vertical:-1,V,U,G,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==z?z:e.collisionBoxArray.length,void 0!==z?z+1:e.collisionBoxArray.length,void 0!==P?P:e.collisionBoxArray.length,void 0!==P?P+1:e.collisionBoxArray.length,D||e.collisionBoxArray.length,D?D+1:e.collisionBoxArray.length,c,F,N,O,B,Y,0,$,H,W,0,Z?1:0)}(e,l,y,s,r,a,n,g,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,M,C,h,0,I,P,v,i,o,u,c,d,f,m)};if("line"===z)for(let n of un(i.geometry,0,0,8192,8192))for(let i of function(e,i,r,a,n,o,s,l,h){let u=a?14.399999999999999*s:0,c=ua(a,n),d=c*s,p=0===e[0].x||8192===e[0].x||0===e[0].y||8192===e[0].y;return i-d<i/4&&(i=d+i/4),function e(i,r,a,n,o,s,l,h,u){let c=s/2,d=ur(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=tj(r.x,l.x,g),x=tj(r.y,l.y,g);if(y>=0&&y<u&&x>=0&&x<u&&f-c>=0&&f+c<=d){let r=new ut(y,x,0,_,e);n&&!ui(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,p?i/2*l%i:(c/2+48)*s*l%i,i,u,r,d,p,!1,8192)}(n,E,A,r.vertical||b,a,0,S,e.overscaling,8192))b&&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,b.text,D,i)||O(n,i,d);else if("line-center"===z){for(let e of i.geometry)if(e.length>1){let i=function(e,i,r,a,n,o){let s=r?14.399999999999999*o:0,l=ua(r,a)*o,h=0,u=ur(e)/2;for(let r=0;r<e.length-1;r++){let a=e[r],n=e[r+1],o=a.dist(n);if(h+o>u){let c=(u-h)/o,d=new ut(tj(a.x,n.x,c),tj(a.y,n.y,c),0,n.angleTo(a),r);return!s||ui(e,d,l,s,i)?d:void 0}h+=o}}(e,A,r.vertical||b,a,0,S);i&&O(e,i,d)}}else if("Polygon"===i.type)for(let e of lo(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 iq([],u_);if(0===h)return new eI(a,n);for(let i=a;i<o;i+=h)for(let r=n;r<s;r+=h)c.push(new ug(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 ug(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 ug(a.p.x-u,a.p.y-u,u,e)),c.push(new ug(a.p.x+u,a.p.y-u,u,e)),c.push(new ug(a.p.x-u,a.p.y+u,u,e)),c.push(new ug(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);O(e[0],new ut(i.x,i.y,0,0,void 0),d)}else if("LineString"===i.type)for(let e of i.geometry)O(e,new ut(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)O([i],new ut(i.x,i.y,0,0,void 0),d)}(e,o,x,b,a,f,y,0,w,T,s,l,u,c,g)}o&&e.generateCollisionDebugBuffers(h,e.collisionBoxArray)},e.dW=lD,e.dX=c5,e.dY=eM,e.dZ=lz,e.d_=hW,e.da=nC,e.db=nP,e.dc=function(e,i,r,a,n){return ek((e-i)/(r-i)*(n-a)+a,a,n)},e.dd=rW,e.de=oL,e.df=class{constructor(e,i,r,a){this.context=e,this.format=a,this.size=r,this.texture=e.gl.createTexture();let[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,u5(this.format),u6(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.dg=cm,e.dh=[1,1,1],e.di=cO,e.dj=cP,e.dk=nv,e.dl=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new eI(1/0,1/0),max:new eI(-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=lq(new eI(0,0),new eI(8192,8192),e),a=[];if(i&&!lj(r,this._globalClipBounds))return a;for(let i of this._activeRegions){if(i.hiddenByOverlap||!lj(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 eI(((e.x-r.wrap)*a-r.canonical.x)*8192,(e.y*a-r.canonical.y)*8192),max:new eI(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=lq(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)=>e.priority-i.priority||lV(e.min,i.min)||lV(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(e,i){let r=(e,i)=>e+i;return e.length-i.length||e.reduce(r,"").localeCompare(i.reduce(r,""))}(e.clipScope,i.clipScope));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||!lU(r,a)||r.order!==a.order||r.clipMask!==a.clipMask||!eA(r.clipScope,a.
7clipScope),++i}}if(e){for(let e of(++this._updateTime,this._activeRegions))e.order!==lF&&(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===lF&&lj(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 eI((e.x+8192*s.x)*h-8192*l.x,(e.y+8192*s.y)*h-8192*l.y))}return lZ(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.dm=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 ns,a=new nE,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+=r?24575:0,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 nE;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=nQ.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=nQ.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,ob);this._gridSegments=i.segments,this._gridBuffer=e.createVertexBuffer(i.vertices,so.members),this._gridIndexBuffer=e.createIndexBuffer(i.indices,!0)}_createPoles(e){let i=new nE;for(let e=0;e<=64;e++)i.emplaceBack(0,e+1,e+2);this._poleIndexBuffer=e.createIndexBuffer(i,!0);let r=new nC,a=new nC,n=new nC,o=new nC;this._poleSegments=[];for(let e=0,i=0;e<5;e++){let s=360/(1<<e);r.emplaceBack(0,-ov,0,.5,0),a.emplaceBack(0,-ov,0,.5,1),n.emplaceBack(0,-ov,0,.5,.5),o.emplaceBack(0,-ov,0,.5,.5);for(let e=0;e<=64;e++){let i=e/64,l=0,h=tj(0,s,i),[u,c,d]=oT(sF,sN,h,ov);r.emplaceBack(u,c,d,i,l),a.emplaceBack(u,c,d,i,1-l);let p=h*eC;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(nQ.simpleSegment(i,0,66,64)),i+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,sa,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(a,sa,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,sa,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(o,sa,!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.dn=lF,e.dp=eR,e.dq=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.dr=eL,e.ds=ok,e.dt=oS,e.du=function([e,i,r]){let a=Math.hypot(e,i,r);return new oM(Math.atan2(e,r)*eP,(.5*Math.PI-Math.acos(-i/a))*eP)},e.dv=cc,e.dw=6371008.8,e.dx=function(e){let i=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==e1){let i=e.navigator?e.navigator.userAgent:null;e1=!!e.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return e1}(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.dy=function(e,i){tn=e,to=i},e.dz=sO,e.e=e8,e.e0=function(e){let i=0;if(1179937895!==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)&&eX("Invalid b3dm header information.")}
7return d8(e,i)},e.e1=function(e,i){let r=pe(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 nE,r.indexArray.reserve(4*e.length),r.vertexArray=new np,r.vertexArray.reserve(10*e.length),r.colorArray=new nd,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=eS.vec3.scaleAndAdd([],n.pos,o,l/2),u=eS.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=eS.vec3.scaleAndAdd([],n.normal,o,s);eS.vec3.scale(p,p,e);let f=eS.vec3.scaleAndAdd([],n.normal,o,-s);eS.vec3.scale(f,f,e),eS.vec3.add(p,h,p),eS.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=tV.white,n.pbrMetallicRoughness=o,r.material=n,r.aabb=new sf([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}(e.lights,i)))}return r},e.e2=cU,e.e3=cH,e.e4=aO,e.e5=function(e){th(),null!=h&&h.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 tb(eN(e,{method:"GET"}),i)},e.h=e9,e.i=function(e){return e8.API_STYLE_REGEX.test(e)&&!e7(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=eN,e.m=tc,e.n=function(e,i){return tb(eN(e,{type:"json"}),i)},e.o=tS,e.p=function(e,i){return tb(eN(e,{method:"POST"}),i)},e.q=tt,e.r=sY,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=tR,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=eX,e.x=tD,e.y=2,e.z=uo}),a(["./shared"],function(e){function i(e){let i=e?e.url.toString():void 0;return i?performance.getEntriesByName(i):[]}class r{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,r,a){for(let r of(this._options=a,i))this._layerConfigs[r.id]=r,(this._layers[r.id]=e.cq(r,this.scope,null,this._options)).compileFilter(a),this.keyCache[r.id]&&delete this.keyCache[r.id];for(let e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];for(let i of(this.familiesBySource={},function(i,r){let a={};for(let n=0;n<i.length;n++){let o=r&&r[i[n].id]||function(i){let r="";for(let a of e.bg)r+=`/${function e(i){if("number"==typeof i||"boolean"==typeof i||"string"==typeof i||null==i)return JSON.stringify(i);if(Array.isArray(i)){let r="[";for(let a of i)r+=`${e(a)},`;return`${r}]`}let r="{";for(let a of Object.keys(i).sort())r+=`${a}
7:${e(i[a])},`;return`${r}}`}(i[a])}`;return r}(i[n]);r&&(r[i[n].id]=o);let s=a[o];s||(s=a[o]=[]),s.push(i[n])}let n=[];for(let e in a)n.push(a[e]);return n}(e.bd(this._layerConfigs),this.keyCache))){let e=i.map(e=>this._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 a=1*e.dP;class n{constructor(i){let r={},n=[];for(let e in i){let o=i[e],s=r[e]={};for(let e in o.glyphs){let i=o.glyphs[+e];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;let r=i.metrics.localGlyph?a:1,l={x:0,y:0,w:i.bitmap.width+2*r,h:i.bitmap.height+2*r};n.push(l),s[e]=l}}let{w:o,h:s}=e.z(n),l=new e.dO({width:o||1,height:s||1});for(let n in i){let o=i[n];for(let i in o.glyphs){let s=o.glyphs[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;let h=r[n][i],u=s.metrics.localGlyph?a:1;e.dO.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.dN(n,"GlyphAtlas");class o{constructor(i){this.tileID=new e.aA(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.collectResourceTiming,this.promoteId=i.promoteId,this.isSymbolTile=i.isSymbolTile,this.tileTransform=e.aK(i.tileID.canonical,i.projection),this.projection=i.projection,this.brightness=i.brightness,this.extraShadowCaster=!!i.extraShadowCaster,this.tessellationStep=i.tessellationStep}parse(i,r,a,o,l){let h,u,c,d;this.status="parsing",this.data=i,this.collisionBoxArray=new e.aQ;let p=new e.dQ(Object.keys(i.layers).sort()),f=new e.dR(this.tileID,this.promoteId);f.bucketLayerIDs=[];let m={},_=new e.dS(256,256),g={featureIndex:f,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:_,availableImages:a,brightness:this.brightness},y=r.familiesBySource[this.source];for(let r in y){let n=i.layers[r];if(!n)continue;let o=!1,l=!1,h=!1;for(let e of y[r])"symbol"===e[0].type?o=!0:l=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h||!0===this.isSymbolTile&&!o||!1===this.isSymbolTile&&!l)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=p.encode(r),c=[];for(let e=0;e<n.length;e++){let i=n.feature(e),a=f.getId(i,r);c.push({feature:i,id:a,index:e,sourceLayerIndex:u})}for(let e of y[r]){let i=e[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&&(s(e,this.zoom,g.brightness,a),(m[i.id]=i.createBucket({index:f.bucketLayerIDs.length,layers:e,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,g,this.tileID.canonical,this.tileTransform),f.bucketLayerIDs.push(e.map(e=>e.id))))}}_.trim();let x={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},v=()=>{if(h)return this.status="done",l(h);if(this.extraShadowCaster)this.status="done",l(null,{buckets:e.bd(m).filter(e=>!e.isEmpty()),featureIndex:f,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:g.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(u&&c&&d){let i=new n(u),r=new e.dU(c,d,this.lut);for(let n in m){let o=m[n];o instanceof e.aR?(s(o.layers,this.zoom,g.brightness,a),e.dV(o,u,i.positions,c,r.iconPositions,this.showCollisionBoxes,a,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):o.hasPattern&&(o instanceof e.aX||o instanceof e.aY||o instanceof e.d0)&&(s(o.layers,this.zoom,g.brightness,a),o.addFeatures(g,this.tileID.canonical,r.patternPositions,a,this.tileTransform,this.brightness))}this.status="done",l(null,{buckets:e.bd(m).filter(e=>!e.isEmpty()),featureIndex:f,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:_,imageAtlas:r,brightness:g.brightness})}};if(!this.extraShadowCaster){let i=e.dT(g.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(i).length?o.send("getGlyphs",{uid:this.uid,stacks:i,scope:this.scope},(e,i)=>{h||(h=e,u=i,v())},void 0,!1,x):u={};let r=Object.keys(g.iconDependencies);r.length?o.send("getImages",{icons:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,i)=>{h||(h=e,c=i,v())},void 0,!1,x):c={};let a=Object.keys(g.patternDependencies);a.length?o.send("getImages",{icons:a,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,i)=>{h||(h=e,d=i,v())},void 0,!1,x):d={}}v()}}function s(i,r,a,n){let o=new e.a3(r,{brightness:a});for(let e of i)e.recalculate(o,n)}class l extends e.E{constructor(i,r,a,n,o,s){super(),this.actor=i,this.layerIndex=r,this.availableImages=a,this.loadVectorData=o||e.aw,this.loading={},this.loaded={},this.deduped=new e.au(i.scheduler),this.isSpriteLoaded=n,this.scheduler
7=i.scheduler,this.brightness=s}loadTile(r,a){let n=r.uid,s=r&&r.request,l=s&&s.collectResourceTiming,h=this.loading[n]=new o(r);h.abort=this.loadVectorData(r,(o,u)=>{let c=!this.loading[n];if(delete this.loading[n],c||o||!u)return h.status="done",c||(this.loaded[n]=h),a(o);let d=u.rawData,p={};u.expires&&(p.expires=u.expires),u.cacheControl&&(p.cacheControl=u.cacheControl),h.vectorTile=u.vectorTile||new e.dW.VectorTile(new e.bb(d));let f=()=>{h.parse(h.vectorTile,this.layerIndex,this.availableImages,this.actor,(r,n)=>{if(r||!n)return a(r);let o={};if(l){let e=i(s);e.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(e)))}a(null,e.l({rawTileData:d.slice(0)},n,p,o))})};this.isSpriteLoaded?f():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(f,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom}):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.showCollisionBoxes=i.showCollisionBoxes,o.projection=i.projection,o.brightness=i.brightness,o.tileTransform=e.aK(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 h{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.dX(a,l,n,s<1))}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.ba.setPbf(e.bb);class u{decodeRasterArray({task:i,buffer:r},a){e.ba.performDecoding(r,i).then(e=>{a(null,e)},e=>{a(e)})}}let c=e.dW.VectorTileFeature.prototype.toGeoJSON;class d{constructor(i){this._feature=i,this.extent=e.ab,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 c.call(this,e,i,r)}}class p{constructor(i){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.ab,this.length=i.length,this._features=i}feature(e){return new d(this._features[e])}}let f=64/4096;class m{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)g(o,l,s);else if("MultiPoint"===n)for(let e of o)g(e,l,s);else if("LineString"===n)s.type=2,y(o,l,s);else if("MultiLineString"===n)s.type=2,x(o,l,s);else if("Polygon"===n)s.type=3,x(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))x(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;_(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())_(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)!function(i,r,a,n,o){for(let s=0;s<i.length;s+=2){let l=Math.round(e.ab*(i[s+0]*r-a)),h=Math.round(e.ab*(i[s+1]*r-n));o.push([l,h])}}(l,r,a,n,u);else for(let i of l)(function(i,r,a,n,o){let s;let l=e.ab+128;for(let h=0;h<i.length-2;h+=2){let u=Math.round(e.ab*(i[h+0]*r-a)),c=Math.round(e.ab*(i[h+1]*r-n)),d=Math.round(e.ab*(i[h+2]*r-a)),p=Math.round(e.ab*(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 _({minX:e,minY:i,maxX:r,maxY:a},n,o,s){return e<(o+1+f)/n&&i<(s+1+f)/n&&r>(o-f)/n&&a>(s-f)/n}function g([i,r],a,n){let o=e.am(i),s=e.at(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 y(e,i,r,a=!1,n=!1){let o=[];for(let i of e)g(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 x(e,i,r,a=!1){for(let n=0;n<e.length;n++)y(e[n],i,r,a,0===n)}var v,b,w,T,S={exports:{}},E=function(){if(T)return S.exports;T=1;var i=e.d_(),r=function(){if(w)return b;w=1;var i=e.dY(),r=e.dZ().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 b=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,b}();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 S.exports=a,S.exports.fromVectorTileJs=a,S.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})},S.exports.GeoJSONWrapper=r,S.exports}(),M=e.d$(E);let I={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},A=Math.fround||(v=new Float32Array(1),e=>(v[0]=+e,v[0]));class C{constructor(e){this.options=Object.assign(Object.create(I),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=A(D(a)),l=A(R(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)}
7return 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(D(r),R(o),D(n),R(a)),h=s.data,u=[];for(let e of l){let i=this.stride*e;u.push(h[i+5]>1?P(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?P(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.by(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;let c=s*this.stride,d=i[c+5]>1;if(d)e=z(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=D(a),h=R(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 P(e,i,r){return{type:"Feature",id:e[i+3],properties:z(e,i,r),geometry:{type:"Point",coordinates:[360*(e[i]-.5),360*Math.atan(Math.exp((180-360*e[i+1])*Math.PI/180))/Math.PI-90]}}}function z(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 D(e){return e/360+.5}function R(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 L(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)k(n,r);else if("Polygon"===i)k(n,r[0]);else if("MultiLineString"===i)for(let e of r)k(n,e);else if("MultiPolygon"===i)for(let e of r)k(n,e[0]);return n}function k(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 O(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)B(n,l);else if("MultiPoint"===o)for(let e of n)B(e,l);else if("LineString"===o)F(n,l,s,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(let r of n)F(r,l=[],s,!1),e.push(L(h,"LineString",l,i.properties));return}N(n,l,s,!1)}else if("Polygon"===o)N(n,l,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(let n of i.geometry.geometries)O(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=[];N(e,i,s,!0),l.push(i)}}
7e.push(L(h,o,l,i.properties))}function B(e,i){i.push(e[0]/360+.5,V(e[1]),0)}function F(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=V(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 N(e,i,r,a){for(let n=0;n<e.length;n++){let o=[];F(e[n],o,r,a),i.push(o)}}function V(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 U(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,u=0===n?i.maxX:i.maxY;if(s>=r&&u<a){h.push(i);continue}if(u<r||s>=a)continue;let c=[];if("Point"===o||"MultiPoint"===o)(function(e,i,r,a,n){for(let o=0;o<e.length;o+=3){let s=e[o+n];s>=r&&s<=a&&Z(i,e[o],e[o+1],e[o+2])}})(e,c,r,a,n);else if("LineString"===o)j(e,c,r,a,n,!1,l.lineMetrics);else if("MultiLineString"===o)q(e,c,r,a,n,!1);else if("Polygon"===o)q(e,c,r,a,n,!0);else if("MultiPolygon"===o)for(let i of e){let e=[];q(i,e,r,a,n,!0),e.length&&c.push(e)}if(c.length){if(l.lineMetrics&&"LineString"===o){for(let e of c)h.push(L(i.id,o,e,i.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===c.length?(o="LineString",c=c[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===c.length?"Point":"MultiPoint"),h.push(L(i.id,o,c,i.tags))}}return h.length?h:null}function j(e,i,r,a,n,o,s){let l=G(e),h=0===n?$:H,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)):Z(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=G(e)),s&&(d+=u)}let p=e.length-3,f=e[p],m=e[p+1],_=0===n?f:m;_>=r&&_<=a&&Z(l,f,m,e[p+2]),p=l.length-3,o&&p>=3&&(l[p]!==l[0]||l[p+1]!==l[1])&&Z(l,l[0],l[1],l[2]),l.length&&i.push(l)}function G(e){let i=[];return i.size=e.size,i.start=e.start,i.end=e.end,i}function q(e,i,r,a,n,o){for(let s of e)j(s,i,r,a,n,o,!1)}function Z(e,i,r,a){e.push(i,r,a)}function $(e,i,r,a,n,o){let s=(o-i)/(a-i);return Z(e,o,r+(n-r)*s,1),s}function H(e,i,r,a,n,o){let s=(o-r)/(n-r);return Z(e,i+(a-i)*s,o,1),s}function W(e,i){let r=[];for(let a=0;a<e.length;a++){let n;let o=e[a],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)n=X(o.geometry,i);else if("MultiLineString"===s||"Polygon"===s)for(let e of(n=[],o.geometry))n.push(X(e,i));else if("MultiPolygon"===s)for(let e of(n=[],o.geometry)){let r=[];for(let a of e)r.push(X(a,i));n.push(r)}r.push(L(o.id,s,n,o.tags))}return r}function X(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 Y(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(J(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(J(e[s][o],e[s][o+1],i,r,a,n));o.geometry.push(l)}}return e.transformed=!0,e}function J(e,i,r,a,n,o){return[Math.round(r*(e*a-n)),Math.round(r*(i*a-o))]}function K(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 Q={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ee{constructor(e,i){let r=(i=this.options=function(e,i){for(let r in i)e[r]=i[r];return e}(Object.create(Q),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++)O(r,e.features[a],i,a);else O(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=U(e,1,-1-r,r,0,-1,2,i
7),o=U(e,1,1-r,2+r,0,-1,2,i);return(n||o)&&(a=U(e,1,-r,1+r,0,-1,2,i)||[],n&&(a=W(n,1).concat(a)),o&&(a=a.concat(W(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=et(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};for(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)K(s,n,e,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let i=0;i<n.length;i++)K(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++)K(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=U(e,c,r-f,r+_,0,p.minX,p.maxX,h),T=U(e,c,r+m,r+g,0,p.minX,p.maxX,h);e=null,w&&(y=U(w,c,a-f,a+_,1,p.minY,p.maxY,h),x=U(w,c,a+m,a+g,1,p.minY,p.maxY,h),w=null),T&&(v=U(T,c,a-f,a+_,1,p.minY,p.maxY,h),b=U(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=+e,i=+i,r=+r;let{extent:a,debug:n}=this.options;if(e<0||e>24)return null;let o=1<<e,s=et(e,i=i+o&o-1,r);if(this.tiles[s])return Y(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[et(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]?Y(this.tiles[s],a):null):null}}function et(e,i,r){return 32*((1<<e)*r+i)+e}function ei(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 p(a.features),o=M(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),i(null,{vectorTile:n,rawData:o.buffer})}class er extends l{constructor(e,i,r,a,n,o){super(e,i,r,a,ei,o),n&&(this.loadGeoJSON=n),this._dynamicIndex=new m}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.M(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 C(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.M(s),h=e.M("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 ee(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 ea{constructor(i,r){this.tileID=new e.aA(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.aA(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.dR(o,a.promoteId);return h.bucketLayerIDs=[],h.is3DTile=!0,e.e0(i).then(i=>{if(!i)return n(Error("Could not parse tile"));let r=e.e1(i,1/e.c8(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.a3(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(e=>e.id)),i.recalculate(d,[]);let n=new e.e2(r,o,u,c,this.brightness,h);u||(n.needsUpload=!0),s[i.fqid]=n,n.evaluate(i)}this.status="done",n(null,{buckets:s,featureIndex:h})}).catch(e=>n(Error(e.message)))}}class en{constructor(e,i,r,a,n,o){this.actor=e,this.layerIndex=i,this.brightness=o,this.loading={},this.loaded={}}loadTile(i,r){let a=i.uid,n=this.loading[a]=new ea(i,this.brightness);e.bc(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,"parsing"===n.status?n.reloadCallback=(r,a)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,i)),i(r,a)}:"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()}}class eo{constructor(i){this.self=i,this.actor=new e.e3(i,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.bL({name:"mercator"}),this.workerSourceTypes={vector:l,geojson:er,"batched-model":en},this.workerSources={},this.demWorkerSources={}
7,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.e4.isParsed())throw Error("RTL text plugin already registered.");e.e4.applyArabicShaping=i.applyArabicShaping,e.e4.processBidirectionalText=i.processBidirectionalText,e.e4.processStyledBidirectionalText=i.processStyledBidirectionalText}}clearCaches(e,i,r){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],delete this.rasterArrayWorkerSource,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 l&&(r.isSpriteLoaded=a,r.fire(new e.x("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.bL(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)}loadDEMTile(e,i,r){this.getDEMWorkerSource(e,i.source,i.scope).loadTile(i,r)}decodeRasterArray(e,i,r){this.getRasterArrayWorkerSource().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.e4.setState(r);let i=e.e4.getPluginURL();if(e.e4.isLoaded()&&!e.e4.isParsed()&&null!=i){this.self.importScripts(i);let r=e.e4.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 a=this.layerIndexes[e][i];return a||((a=this.layerIndexes[e][i]=new r).scope=i),a}getWorkerSource(e,i,r,a){return this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][a]||(this.workerSources[e][a]={}),this.workerSources[e][a][i]||(this.workerSources[e][a][i]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),this.workerSources[e][a][i][r]||(this.workerSources[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)),this.workerSources[e][a][i][r]}getDEMWorkerSource(e,i,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]={}),this.demWorkerSources[e][r][i]||(this.demWorkerSources[e][r][i]=new h),this.demWorkerSources[e][r][i]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new u),this.rasterArrayWorkerSource}enforceCacheSizeLimit(i,r){e.e5(r)}getWorkerPerformanceMetrics(e,i,r){r(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new eo(self)),eo}),a(["./shared"],function(e){let i,r,a,n,o;var s="3.7.0";let l={create:"create",load:"load",fullLoad:"fullLoad"},h={mark(e){performance.mark(e)},measure(e,i,r){performance.measure(e,i,r)}};function u(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 c,d={},p=function(){if(c)return d;function e(e){return!i(e)}function i(i){var a;return"undefined"==typeof window||"undefined"==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")}c=1,d.supported=e,d.notSupportedReason=i;var r={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},d}();function f(e,i,r){let a=document.createElement(e);return null!=i&&(a.className=i),r&&r.appendChild(a),a}function m(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 _="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,g=_&&void 0!==_.userSelect?"userSelect":"WebkitUserSelect";function y(){_&&g&&(i=_[g],_[g]="none")}function x(){_&&g&&(_[g]=i)}function v(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",v,!0)}function b(){window.addEventListener("click",v,!0),window.setTimeout(()=>{window.removeEventListener("click",v,!0)},0)}function w(e,i){let r=e.getBoundingClientRect();return E(e,r,i)}function T(e,i){let r=e.getBoundingClientRect(),a=[];for(let n=0;n<i.length;n++)a.push(E(e,r,i[n]));return a}function S(e){return void 0!==window.InstallTrigger&&2===e.button&&e.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button}function E(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 M="NO_ACCESS_TOKEN";class I{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=C(i);return a.params.push(`sdk=js-${s}`),a.path=`/styles/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!e.f(i))return i;let a=C(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=C(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=C(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)}normalizeSpriteURL(i,r,a,n){let o=C(i);return e.f(i)?(o.path=`/styles/v1${o.path}/sprite${r}${a}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${r}${a}`,P(o))}normalizeTileURL(i,r,a){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!e.f(i))return i;let n=C(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=C(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=C(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 P(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||""}`),P(i)}}let A=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function C(e){let i=e.match(A);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 P(e){let i=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${i}`}let z="mapbox.eventData";function D(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 R{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){let r=D(e.e.ACCESS_TOKEN),a="";return a=r&&r.u?e.k(r.u):e.e.ACCESS_TOKEN||"",i?`${z}.${i}:${a}`:`${z}:${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=C(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:P(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 L=new class extends R{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=D(e.e.ACCESS_TOKEN),a=r?r.u:e.e.ACCESS_TOKEN,n=a!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),n=!0);let o=this.queue.shift();if(this.eventData.lastSuccess){let e=new Date(this.eventData.lastSuccess),i=new Date(o),r=(o-this.eventData.lastSuccess)/864e5;n=n||r>=1||r<-1||e.getDate()!==i.getDate()}else n=!0;n?this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:s,skuId:"01","enabled.telemetry":!1,userId:this.anonId},e=>{e||(this.eventData.lastSuccess=o,this.eventData.tokenU=a)},i):this.processRequests()}},k=L.postTurnstileEvent.bind(L),O=new class extends R{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(M)))}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:s,skuId:"01",skuToken:this.skuToken,userId:this.anonId},e=>{e?this.errorCb(e):r&&(this.success[r]=!0)},i))}remove(){this.errorCb=null}},B=O.postMapLoadEvent.bind(O),F=new class extends R{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)}},N=F.postStyleLoadEvent.bind(F),V=new class extends R{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(),n=function(i){let r=performance.getEntriesByType("resource"),a=performance.getEntriesByType("mark"),n=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,u)),o=window.devicePixelRatio,h=navigator.connection||navigator.mozConnection||navigator.webkitConnection,c=h?h.effectiveType:void 0,d={counters:[],metadata:[],attributes:[]},p=(e,i,r)=>{null!=r&&e.push({name:i,value:r.toString()})};for(let e in n)p(d.counters,e,n[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(l)){let i=l[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",o),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/o),p(d.metadata,"mapHeight",i.height/o),p(d.metadata,"webglRenderer",i.renderer),p(d.metadata,"webglVendor",i.vendor),p(d.metadata,"sdkVersion",s),p(d.metadata,"sdkIdentifier","mapbox-gl-js"),d}(a);for(let e of n.metadata);for(let e of n.counters);for(let e of n.attributes);this.postEvent(r,n,()=>{},i)}},U=V.postPerformanceEvent.bind(V),j=new class extends R{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=C(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:P(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(M)))}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}},G=j.getSessionAPI.bind(j),q=new Set;function Z(e,i){i?q.add(e):q.delete(e)}class ${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(e){this._updatedImages.add(e),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}class H extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(i){this.images[i]={},this.loaded[i]=!1,this.updatedImages[i]={},this.patterns[i]={},this.callbackDispatchedThisFrame[i]={},this.atlasImage[i]=new e.r({width:1,height:1})}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 this.images[i][e]}
7addImage(e,i,r){this._validate(e,r)&&(this.images[i][e]=r)}_validate(i,r){let a=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new e.t(Error(`Image "${i}" has invalid "stretchX" value`))),a=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new e.t(Error(`Image "${i}" has invalid "stretchY" value`))),a=!1),this._validateContent(r.content,r)||(this.fire(new e.t(Error(`Image "${i}" 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||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){r.version=this.images[i][e].version+1,this.images[i][e]=r,this.updatedImages[i][e]=!0}removeImage(e,i){let r=this.images[i][e];delete this.images[i][e],delete this.patterns[i][e],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(e){return Object.keys(this.images[e])}getImages(e,i,r){let a=!0,n=!!this.loaded[i];if(!n)for(let r of e)this.images[i][r]||(a=!1);n||a?this._notify(e,i,r):this.requestors.push({ids:e,scope:i,callback:r})}getUpdatedImages(e){return this.updatedImages[e]}_notify(i,r,a){let n={};for(let a of i){this.images[r][a]||this.fire(new e.x("styleimagemissing",{id:a}));let i=this.images[r][a];i?n[a]={data:i.data.clone(),pixelRatio:i.pixelRatio,sdf:i.sdf,version:i.version,stretchX:i.stretchX,stretchY:i.stretchY,content:i.content,hasRenderCallback:!!(i.userImage&&i.userImage.render)}:e.w(`Image "${a}" 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.`)}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],o=this.getImage(i,r);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{let a={w:o.data.width+2*e.y,h:o.data.height+2*e.y,x:0,y:0},n=new e.I(a,o,e.y);this.patterns[r][i]={bin:a,position:n}}return this._updatePatternAtlas(r,a),this.patterns[r][i].position}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.z(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]={}}dispatchRenderCallbacks(e,i){for(let r of e){if(this.callbackDispatchedThisFrame[i][r])continue;this.callbackDispatchedThisFrame[i][r]=!0;let e=this.images[i][r];(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)}}}function W(i){let r=i.key,a=i.value,n=i.valueSpec||{},o=i.objectElementValidators||{},s=i.style,l=i.styleSpec,h=[],u=e.B(a);if("object"!==u)return[new e.V(r,a,`object expected, ${u} found`)];for(let i in a){let u;let c=i.split(".")[0];o[c]?u=o[c]:n[c]?u=ep:o["*"]?u=o["*"]:n["*"]&&(u=ep),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.A(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 X(i){let r=i.value,a=i.valueSpec,n=i.style,o=i.styleSpec,s=i.key,l=i.arrayElementValidator||ep;if("array"!==e.B(r))return[new e.V(s,r,`array expected, ${e.B(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.B(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}
7function Y(i){let r=i.key,a=i.value,n=i.valueSpec,o=e.B(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.B(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.B(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 J(i){let r=i.valueSpec,a=e.D(i.value.type),n,o,s,l={},h="categorical"!==a&&void 0===i.value.property,u="array"===e.B(i.value.stops)&&"array"===e.B(i.value.stops[0])&&"object"===e.B(i.value.stops[0][0]),c=W({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(X({key:i.key,value:n,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:d})),"array"===e.B(n)&&0===n.length&&r.push(new e.V(i.key,n,"array must have at least one stop")),r},default:function(e){return ep({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.F(i.valueSpec)&&c.push(new e.V(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(h||e.G(i.valueSpec)?h&&!e.H(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.B(n))return[new e.V(h,n,`array expected, ${e.B(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.B(n[0]))return[new e.V(h,n,`object expected, ${e.B(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.D(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(W({key:`${h}[0]`,value:n[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:Y,value:p}}))}else a=a.concat(p({key:`${h}[0]`,value:n[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},n));return e.J(e.K(n[1]))?a.concat([new e.V(`${h}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(ep({key:`${h}[1]`,value:n[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}function p(i,s){let h=e.B(i.value),u=e.D(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.G(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 K(i){let r=("property"===i.expressionContext?e.L:e.M)(e.K(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.N(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);
7if(0===n.size)return[];let o=[];return r instanceof e.S&&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.O(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.Q(a))return[new e.V(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Q(i){let r=i.key,a=i.value,n=i.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.D(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.D(a))&&o.push(new e.V(r,a,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(a)} found`)),o}function ee(i){return e.W(e.K(i.value))?K(e.C({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):function i(r){let a=r.value,n=r.key;if("array"!==e.B(a))return[new e.V(n,a,`array expected, ${e.B(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(Q({key:`${n}[0]`,value:a[0],valueSpec:o.filter_operator,style:r.style,styleSpec:r.styleSpec})),e.D(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===e.D(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.B(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.B(a[i]),"$type"===e.D(a[1])?l=l.concat(Q({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.B(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 et(i,r){let a;let 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(/^(.*)-transition$/);if("paint"===r&&d&&c[d[1]]&&c[d[1]].transition)return ep({key:n,value:h,valueSpec:l.transition,style:o,styleSpec:l});let p=i.valueSpec||c[u];if(!p)return[new e.A(n,h,`unknown property "${u}"`)];if("string"===e.B(h)&&e.G(p)&&!p.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 f=[];if("symbol"===i.layerType)"text-field"!==u||!o||o.glyphs||o.imports||f.push(new e.V(n,h,'use of "text-field" requires a style "glyphs" property')),"text-font"===u&&e.X(e.K(h))&&"identity"===e.D(h.type)&&f.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.G(p)&&(e.Y(p)||e.H(p))){let i=e.L(e.K(h),p),r=i.value.expression||i.value._styleExpression.expression;r&&!e.O(r,["measure-light"])&&("model-emissive-strength"===u&&e.Q(r)&&e.N(r)||f.push(new e.V(n,h,`${u} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return f.concat(ep({key:i.key,value:h,valueSpec:p,style:o,styleSpec:l,expressionContext:"property",propertyType:r,propertyKey:u}))}function ei(e){return et(e,"paint")}function er(e){return et(e,"layout")}function ea(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.D(a.type),h=e.D(a.ref);
8if(a.id){let s=e.D(a.id);for(let l=0;l<i.arrayIndex;l++){let i=o.layers[l];e.D(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.D(r.id)===h&&(i=r)}),i?i.ref?r.push(new e.V(n,a.ref,"ref cannot reference another ref layer")):l=e.D(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.D(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(W({key:n,value:a,valueSpec:s.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ep({key:`${n}.type`,value:a.type,valueSpec:s.layer.type,style:i.style,styleSpec:i.styleSpec,object:a,objectKey:"type"}),filter:i=>ee(e.C({layerType:l},i)),layout:i=>W({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>er(e.C({layerType:l},i))}}),paint:i=>W({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>ei(e.C({layerType:l,layer:a},i))}})}}))}function en(i){let r=i.value,a=i.key,n=e.B(r);return"string"!==n?[new e.V(a,r,`string expected, ${n} found`)]:[]}let eo={promoteId:function({key:i,value:r}){if("string"===e.B(r))return en({key:i,value:r});{let e=[];for(let a in r)e.push(...en({key:`${i}.${a}`,value:r[a]}));return e}}};function es(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.D(r.type),l=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&(r.url||r.tiles||l.push(new e.A(a,r,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return l.concat(W({key:a,value:r,valueSpec:n[`source_${s.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:eo}));case"geojson":if(l=W({key:a,value:r,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:eo}),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(...K({key:`${a}.${e}.map`,value:n,expressionContext:"cluster-map"})),l.push(...K({key:`${a}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return l;case"video":return W({key:a,value:r,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return W({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:return Q({key:`${a}.type`,value:r.type,valueSpec:{values:n.source.reduce((e,i)=>{let r=n[i];return"enum"===r.type.type&&(e=e.concat(Object.keys(r.type.values))),e},[])},style:o,styleSpec:n})}}function el(i){let r=i.value,a=i.styleSpec,n=a.light,o=i.style,s=[],l=e.B(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$/);s=s.concat(l&&n[l[1]]&&n[l[1]].transition?ep({key:i,value:r[i],valueSpec:a.transition,style:o,styleSpec:a}):n[i]?ep({key:i,value:r[i],valueSpec:n[i],style:o,styleSpec:a}):[new e.V(i,r[i],`unknown property "${i}"`)])}return s}function eh(i){let r=i.value,a=[];if(!r)return a;let n=e.B(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.D(r.type),o=u[n];e.D(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.B(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]?ep({key:r,value:s[r],valueSpec:d[r],style:h,styleSpec:o}):[new e.A(i.key,s[r],`unknown property "${r}"`)])}else{let i=n.match(/^(.*)-transition$/);a=a.concat(i&&s[i[1]]&&s[i[1]].transition?ep({key:n,value:r[n],valueSpec:o.transition,style:h,styleSpec:o}):s[n]?ep({key:n,value:r[n],valueSpec:s[n],style:h,styleSpec:o}):[new e.A(n,r[n],`unknown property "${n}"`)])}return a}function eu(i){let r=i.value,a=i.key,n=i.style,o=i.styleSpec,s=o.terrain,l=[],h=e.B(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$/);l=l.concat(a&&s[a[1]]&&s[a[1]].transition?ep({key:i,value:r[i],valueSpec:o.transition,style:n,styleSpec:o}):s[i]?ep({key:i,value:r[i],valueSpec:s[i],style:n,styleSpec:o}):[new e.A(i,r[i],`unknown property "${i}"`)])}if(r.source){let i=n.sources&&n.sources[r.source],o=i&&e.D(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 ec(i){let r=i.value,a=i.style,n=i.styleSpec,o=n.fog,s=[],l=e.B(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$/);s=s.concat(l&&o[l[1]]&&o[l[1]].transition?ep({key:i,value:r[i],valueSpec:n.transition,style:a,styleSpec:n}):o[i]?ep({key:i,value:r[i],valueSpec:o[i],style:a,styleSpec:n}):[new e.A(i,r[i],`unknown property "${i}"`)])}return s}let ed={"*":()=>[],array:X,boolean:function(i){let r=i.value,a=i.key,n=e.B(r);return"boolean"!==n?[new e.V(a,r,`boolean expected, ${n} found`)]:[]},number:Y,color:function(i){let r=i.key,a=i.value,n=e.B(a);return"string"!==n?[new e.V(r,a,`color expected, ${n} found`)]:null===e.U.parseCSSColor(a)?[new e.V(r,a,`color expected, "${a}" found`)]:[]},enum:Q,filter:ee,function:J,layer:ea,object:W,source:es,model:e.Z,light:el,"light-3d":eh,terrain:eu,fog:ec,string:en,formatted:function(e){return 0===en(e).length?[]:K(e)},resolvedImage:function(e){return 0===en(e).length?[]:K(e)},projection:function(i){let r=i.value,a=i.styleSpec,n=a.projection,o=i.style,s=[],l=e.B(r);if("object"===l)for(let e in r)s=s.concat(ep({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=W(e.C({},i,{value:o,valueSpec:a.import}));return""===e.D(o.id)&&s.push(new e.V(`${i.key}.id`,o,"import id can't be an empty string")),n&&(s=s.concat(em(n,a,{key:`${i.key}.data`}))),s}};function ep(i,r=!1){let a=i.value,n=i.valueSpec,o=i.styleSpec;if(n.expression&&e.X(e.D(a)))return J(i);if(n.expression&&e.J(e.K(a)))return K(i);if(n.type&&ed[n.type]){let a=ed[n.type](i);return!0===r&&a.length>0&&"array"===e.B(i.value)?K(i):a}return W(e.C({},i,{valueSpec:n.type?o[n.type]:n}))}function ef(i){let r=i.value,a=i.key,n=en(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 em(i,r=e._,a={}){return ep({key:a.key||"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:ef,"*":()=>[]}})}function e_(i,r=e._){return eI(em(i,r))}let eg=e=>eI(es(e)),ey=e=>eI(el(e)),ex=e=>eI(eh(e)),ev=e=>eI(eu(e)),eb=e=>eI(ec(e)),ew=e=>eI(ea(e)),eT=e=>eI(ee(e)),eS=e=>eI(ei(e)),eE=e=>eI(er(e)),eM=i=>eI(e.Z(i));function eI(e){return e.slice().sort((e,i)=>e.line&&i.line?e.line-i.line:0)}function eA(i,r){let a=!1;if(r&&r.length)for(let n of r)n instanceof e.A?e.w(n.message):(i.fire(new e.t(Error(n.message))),a=!0);return a}class eC extends e.E{constructor(i,a="flat"){super(),this._transitionable=new e.$(r||(r=new e.a0({anchor:new e.a1(e._.light.anchor),position:new e.a2(e._.light.position),color:new e.a1(e._.light.color),intensity:new e.a1(e._.light.intensity)}))),this.setLight(i,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i,r={}
8){this._validate(ey,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)&&eA(this,i.call(e_,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e._})))}}let eP=new e.a0({source:new e.a1(e._.terrain.source),exaggeration:new e.a1(e._.terrain.exaggeration)}),ez=class extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._transitionable=new e.$(eP,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.a3(i)).get("exaggeration")}isZoomDependent(){let i=this._transitionable._values.exaggeration;return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof e.a4}};function eD(i,r,a,n){let o=e.a7(45,65,a),[s,l]=eR(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 eR(e,i){let r=.5/Math.tan(.5*i);return[e.range[0]+r,e.range[1]+r]}function eL(i,r,a,n,o){let s=e.a6.vec3.transformMat4([],[r,a,n],o.mercatorFogMatrix);return eD(i,e.a6.vec3.length(s),o.pitch,o._fov)}function ek(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.a6.vec3.transformMat4([],i,r),n=e.a6.vec3.length(a);h=Math.min(h,n),u=Math.max(u,n)}return[eD(i,h,l.pitch,l._fov),eD(i,u,l.pitch,l._fov)]}let eO=new e.a0({range:new e.a1(e._.fog.range),color:new e.a1(e._.fog.color),"high-color":new e.a1(e._.fog["high-color"]),"space-color":new e.a1(e._.fog["space-color"]),"horizon-blend":new e.a1(e._.fog["horizon-blend"]),"star-intensity":new e.a1(e._.fog["star-intensity"]),"vertical-range":new e.a1(e._.fog["vertical-range"])});class eB extends e.E{constructor(i,r,a,n){super(),this._transitionable=new e.$(eO,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this._transform=r,this.properties=new e.a8(eO),this.scope=a}get state(){let i=this._transform,r="globe"===i.projection.name,a=e.a9(i.zoom),n=this.properties.get("range");return{range:r?[e.aa(.5,n[0],a),e.aa(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(eb,i,a))return;let n=e.l({},i);for(let i of Object.keys(e._.fog))void 0===n[i]&&(n[i]=e._.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.a7(45,65,i))*r.a}getOpacityAtLatLng(i,r){return this._transform.projection.supportsFog?function(i,r,a){let n=e.a5.fromLngLat(r),o=a.elevation?a.elevation.getAtPointOrZero(n):0;return eL(i,n.x,n.y,o,a)}(this.state,i,r):0}getOpacityForTile(i){if(!this._transform.projection.supportsFog)return[1,1];let r=this._transform.calculateFogTileMatrix(i.toUnwrapped());return ek(this.state,r,0,0,e.ab,e.ab,this._transform)}getOpacityForBounds(e,i,r,a,n){return this._transform.projection.supportsFog?ek(this.state,e,i,r,a,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?eR(this.state,e):[0,1]}isVisibleOnFrustum(i){if(!this._transform.projection.supportsFog)return!1;for(let r of[4,5,6,7]){let a;let n=i.points[r];if(n[2]>=0)a=n;else{let o=i.points[r-4];a=e.ac(o,n,o[2]/(o[2]-n[2]))}if(eL(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)}
8_validate(i,r,a){return(!a||!1!==a.validate)&&eA(this,i.call(e_,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e._})))}}class eF extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._options=i,this.properties=new e.a8(r),this._transitionable=new e.$(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 eN{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.ae(o,s).every(e=>r.isPointAboveHorizon(e))}return new eN(a,r.getCameraPoint(),n,r)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(i){return e.ae(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.ae(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.af(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.ae(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.ag(i.tileTransform,r,h));if(!e.ah(u,0,0,e.ab,e.ab))return;h=i.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);let c=this.screenGeometryMercator.polygon.map(r=>e.ai(i.tileTransform,r,h)),d=c.map(i=>new e.P(i[0],i[1])),p=r.getFreeCameraOptions().position||new e.a5(0,0,0),f=e.ai(i.tileTransform,p,h),m=c.map(i=>{let r=e.a6.vec3.sub(i,i,f);return e.a6.vec3.normalize(r,r),new e.aj(f,r)}),_=e.ak(i,1,r.zoom)*r._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:d,tilespaceRays:m,bufferedTilespaceGeometry:u,bufferedTilespaceBounds:((o=e.al(u)).min.x=e.ap(o.min.x,0,e.ab),o.min.y=e.ap(o.min.y,0,e.ab),o.max.x=e.ap(o.max.x,0,e.ab),o.max.y=e.ap(o.max.y,0,e.ab),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.a6.mat4.multiply([],r.pixelMatrix,r.globeMatrix),n=[0,-e.aq,0,1],o=[0,e.aq,0,1],s=[0,0,0,1];e.a6.vec4.transformMat4(n,n,a),e.a6.vec4.transformMat4(o,o,a),e.a6.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.an(i,l)&&n[3]<s[3],c=e.an(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=eU(i.pointCoordinate3D(e[a-1]).x),o=eU(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?eV(i.slice(0,p),r):[],_=p<i.length?eV(i.slice(p),r):[];m=m.map(i=>new e.P(eU(i.x),i.y)),_=_.map(i=>new e.P(eU(i.x),i.y));let g=[...m];0===g.length&&g.push(_[_.length-1]);let y=e.aa(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.a5(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.am(r.center.lng);return a&&s<Math.abs(s-1)&&i.forEach(e=>{e.x-=1}),{polygon:i,unwrapped:a}}(eV(i,r).map(i=>new e.P(eU(i.x),i.y)),r);return{polygon:n.polygon.map(i=>new e.a5(i.x,i.y)),unwrapped:n.unwrapped}}}function eV(i,r){return e.ao(i,e=>{let i=r.pointCoordinate3D(e);e.x=i.x,e.y=i.y},1/256)}function eU(e){return e<0?1+e%1:e%1}function ej(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.ar(e.l(n,i),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(a.vectorLayers=n.vector_layers,a.vectorLayerIds=a.vectorLayers.map(e=>e.id)),n.raster_layers&&(a.rasterLayers=n.raster_layers,a.rasterLayerIds=a.rasterLayers.map(e=>e.id)),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 eG{constructor(i,r,a){this.bounds=e.as.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.am(this.bounds.getWest())*r),n=Math.floor(e.at(this.bounds.getNorth())*r),o=Math.ceil(e.am(this.bounds.getEast())*r),s=Math.ceil(e.at(this.bounds.getSouth())*r);return i.x>=a&&i.x<o&&i.y>=n&&i.y<s}}class eq 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.ar(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.au}load(i){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map._worldview;this._tileJSONRequest=ej(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.t(n))):o&&(e.l(this,o),o.bounds&&(this.tileBounds=new eG(o.bounds,this.minzoom,this.maxzoom)),k(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("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.av(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=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme)),n=this.map._requestManager.transformRequest(a,e.R.Tile),o=this.map.style?this.map.style.getLut(this.scope):null,s={request:n,data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,lut:o?{image:o.image.clone()}:null,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};if(s.request.collectResourceTiming=this._collectResourceTiming,i.actor&&"expired"!==i.state)"loading"===i.state?i.reloadCallback=r:i.request=i.actor.send("reloadTile",s,l.bind(this));else if(i.actor=this._tileWorkers[a]=this._tileWorkers[a]||this.dispatcher.getActor(),this.dispatcher.ready)i.request=i.actor.send("loadTile",s,l.bind(this),void 0,!0);else{let r=e.aw.call({deduped:this._deduped},s,(e,r)=>{e||!r?l.call(this,e):(s.data={cacheControl:r.cacheControl,expires:r.expires,rawData:r.rawData.slice(0)},i.actor&&i.actor.send("loadTile",s,l.bind(this),void 0,!0))},!0);i.request={cancel:r}}function l(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.ax(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 eZ 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.ar(r,["url","scheme","tileSize"]))}load(i){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"})),this._tileJSONRequest=ej(this._options,this.map._requestManager,null,null,(r,a)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new e.t(r)):a&&(e.l(this,a),a.bounds&&(this.tileBounds=new eG(a.bounds,this.minzoom,this.maxzoom)),k(a.tiles),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("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.av(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.ax(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 e$ extends eZ{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=22,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);i.requestParams=n,i.actor||(i.actor=this.dispatcher.getActor()),i.request=i.fetchHeader(void 0,(e,a,n,o)=>{if(delete i.request,i.aborted)return i.state="unloaded",r(null);if(e){if(20===e.code)return;return i.state="errored",r(e)}this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:n,expires:o}),i.state="empty",r(null)})}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)=>{if(r)return i.state="errored",this.fire(new e.t(r)),void this.triggerRepaint(i);a&&(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.aB?o=r.paint.get("raster-array-band"):r instanceof e.aC&&(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)}}}let eH={vector:eq,raster:eZ,"raster-dem":class extends eZ{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);
8else if(o){this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:s,expires:l});let r=ImageBitmap&&o instanceof ImageBitmap&&e.ay(),a=1-(o.width-e.az(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,coord:i.tileID,source:this.id,scope:this.scope,rawImageData:h,encoding:this.encoding,padding:a};i.actor&&"expired"!==i.state||(i.actor=this.dispatcher.getActor(),i.actor.send("loadDEMTile",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.aA(i.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},h[new e.aA(i.overscaledZ,l,r.z,s,r.y).key]={backfilled:!1},r.y>0&&(h[new e.aA(i.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},h[new e.aA(i.overscaledZ,i.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},h[new e.aA(i.overscaledZ,l,r.z,s,r.y-1).key]={backfilled:!1}),r.y+1<a&&(h[new e.aA(i.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},h[new e.aA(i.overscaledZ,i.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},h[new e.aA(i.overscaledZ,l,r.z,s,r.y+1).key]={backfilled:!1}),h}},"raster-array":e$,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;let o=e.ab/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.ab,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.ab,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.t(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.t(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.x("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.t(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.x("data",r)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(i),this._coalesce=!1)})}loaded(){return this._loaded}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=this._partialReload,s={type:this.t
8ype,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:n?{image:n.image.clone()}:null,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,partial:o};i.request=this.actor.send(a,s,(e,n)=>o&&!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.aD{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.aE(this.urls,(i,r)=>{this._loaded=!0,i?this.fire(new e.t(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.t(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.aD,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.aG(this.map._requestManager.transformRequest(a.uri,e.R.Model).url).then(i=>{if(!i)return;let n=e.aH(i),o=new e.aI(r,a.position,a.orientation,n);o.computeBoundsAndApplyParent(),this.models.push(o)}).catch(i=>{this.fire(new e.t(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.x("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this.fire(new e.t(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()}load(i){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map._worldview;this._tileJSONRequest=ej(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.t(n))):o&&(e.l(this,o),o.bounds&&(this.tileBounds=new eG(o.bounds,this.minzoom,this.maxzoom)),k(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("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};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):(a&&(a.resourceTiming&&(i.resourceTiming=a.resourceTiming),this.map._refreshExpiredTiles&&i.setExpiryData(a),i.buckets={...i.buckets,...a.buckets},a.featureIndex&&(i.latestFeatureIndex=a.featureIndex)),i.state="loaded",void r(null))}}serialize(){return e.l({},this._options)}},canvas:class extends e.aD{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.t(new e.V(`sources.${i}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.t(new e.V(`sources.${i}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.t(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.t(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.t(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.t(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.aF||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.t(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.t(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new eG(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.ar(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.ar(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(i){this.map=i,this._loaded=!1,this.fire(new e.x("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=>{20!==r.code&&(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.av(this.id,this.scope);this.map.style.clearSource(i)}
8_update(){this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))}}},eW=function(i,r,a,n){let o=new eH[r.type](i,r,a,n);if(o.id!==i)throw Error(`Expected Source id to be ${i} instead of ${o.id}`);return e.aJ(["load","abort","unload","serialize","prepare"],o),o};function eX(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}let eY=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;eY[h+0]=r,eY[h+1]=a,eY[h+2]=n,eY[h+3]=o}let eJ=new Uint16Array(2178),eK=new Uint8Array(1089),eQ=new Uint16Array(1089);function e0(e){return 0===e?-.03125:32===e?.03125:0}let e1={type:2,extent:e.ab,loadGeometry:()=>[[new e.P(0,0),new e.P(e.ab+1,0),new e.P(e.ab+1,e.ab+1),new e.P(0,e.ab+1),new e.P(0,0)]]};class e2{constructor(i,r,a,n,o){this.tileID=i,this.uid=e.aP(),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.aK(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=function(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}(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){let i=this.buckets[n];if(i instanceof e.aR){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.aR&&r.hasRTLText){this.hasRTLText=!0,e.aS();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.aQ}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"}}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;if(a&&!a.uploaded){let n=!!Object.keys(a.patternPositions).length;this.imageAtlasTexture=new e.T(i,a.image,r.RGBA8,{useMipmap:n}),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._lastUpdatedBrightness=a,this.updateBuckets(i)))}queryRenderedFeatures(e,i,r,a,n,o,s,l){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:a,pixelPosMatrix:s,transform:o,params:n,tileTransform:this.tileTransform},e,i,r):{}}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.aT(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.aU(n,!0);
8if(!l.filter(new e.a3(this.tileID.overscaledZ),i,this.tileID.canonical))continue}else if(!l.filter(new e.a3(this.tileID.overscaledZ),n))continue;let p=a.getId(n,o),f=new e.aV(n,h,u,c,p);f.tile=d,i.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=e.aW(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(),2147483647)}setFeatureState(e,i){this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(e).length&&i&&this.updateBuckets(i)}updateBuckets(i){if(!this.latestFeatureIndex)return;let r=this.latestFeatureIndex.loadVTLayers(),a=i.style.listImages(),n=i.style.getBrightness();for(let o in this.buckets){if(!i.style.hasLayer(o))continue;let s=this.buckets[o],l=s.layers[0].sourceLayer||"_geojsonTileLayer",h=r[l],u=i.style.getOwnSourceCache(s.layers[0].source),c={};u&&(c=u._state.getState(l,void 0)),s.update(c,h,a,this.imageAtlas&&this.imageAtlas.patternPositions||{},n),(s instanceof e.aX||s instanceof e.aY)&&i._terrain&&i._terrain.enabled&&u&&s.programConfigurations.needsUpload&&i._terrain._clearRenderCacheForTile(u.id,this.tileID);let d=i&&i.style&&i.style.getOwnLayer(o);d&&(this.queryPadding=Math.max(this.queryPadding,d.queryRadius(s)))}}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.aZ(e1,this.tileID.canonical,this.tileTransform)[0],n=new e.a_,o=new e.a$;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.b0.members),this._tileDebugSegments=e.b1.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(i,r){let a,n;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=e.aZ(e1,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let a=e.aK(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.aL((i.x+(s+e0(s))/32)/n),h=e.aM((i.y+(o+e0(o))/32)/n),u=r.project(l,h),c=33*o+s;eJ[2*c+0]=Math.round((u.x*a.scale-a.x)*e.ab),eJ[2*c+1]=Math.round((u.y*a.scale-a.y)*e.ab)}eK.fill(0),eQ.fill(0);for(let e=2045;e>=0;e--){let i=4*e,r=eY[i+0],a=eY[i+1],n=eY[i+2],o=eY[i+3],s=r+n>>1,l=a+o>>1,h=s+l-a,u=l+r-s,c=33*a+r,d=33*o+n,p=33*l+s,f=Math.hypot((eJ[2*c+0]+eJ[2*d+0])/2-eJ[2*p+0],(eJ[2*c+1]+eJ[2*d+1])/2-eJ[2*p+1])>=16;eK[p]=eK[p]||(f?1:0),e<1022&&(eK[p]=eK[p]||eK[(a+u>>1)*33+(r+h>>1)]||eK[(o+u>>1)*33+(n+h>>1)])}let o=new e.aN,s=new e.aO,l=0;function h(i,r){let a=33*r+i;return 0===eQ[a]&&(o.emplaceBack(eJ[2*a+0],eJ[2*a+1],i*e.ab/32,r*e.ab/32),eQ[a]=++l),eQ[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&&eK[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.aN,n=new e.aO,o))a.emplaceBack(i,r,0,0);let i=e.b2(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.b3.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(n),this._tileBoundsSegments=e.b1.simpleSegment(0,0,a.length,n.length)}_makeGlobeTileDebugBuffers(i,r){let a;let n=r.projection;if(!n||"globe"!==n.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=e.b4(o,r),l=e.b5(s),h=e.a9(r.zoom);h>0&&(a=e.a6.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.b6(i,r,a);if(s){let o=1<<a.z,u=e.am(n.center.lng),c=e.at(n.center.lat),d=(a.x+.5)/o-u,p=0;d>.5?p=-1:d<-.5&&(p=1);let f=(i/e.ab+a.x)/o+p,m=(r/e.ab+a.y)/o;f=(f-u)*n._pixelsPerMercatorPixel+u,m=(m-c)*n._pixelsPerMercatorPixel+c;let _=[f*n.worldSize,m*n.worldSize,0];e.a6.vec3.transformMat4(_,_,s),h=e.b7(h,_,l)}return e.a6.vec3.transformMat4(h,h,o)}_makeGlobeTileDebugBorderBuffer(i,r,a,n,o,s){let l=new e.a_,h=new e.a$,u=new e.b8,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.ab;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.b0.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(u,e.b9.members),this._tileDebugSegments=e.b1.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(i,r,a,n,o,s){let l=e.ab/4,h=new e.a_,u=new e.aO,c=new e.b8;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.b0.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(c,e.b9.members),this._tileDebugTextSegments=e.b1.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.ba.setPbf(e.bb);class e3 extends e2{constructor(e,i,r,a,n){super(e,i,r,a,n),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}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.ba(30),n=Object.assign({}
8,this.requestParams,{headers:{Range:"bytes=0-"+(i-1)}});return this.entireBuffer=null,this.request=e.bc(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].last_byte);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;let 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",{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.bc(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={data:n,width:u,height:u},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,16777216*h]}}}class e4{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 e5{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.setFeatureState(this.state,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].setFeatureState(a,r)}}class e6 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 e4(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 e5,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){let i=this._tiles[e];if("loaded"!==i.state&&"errored"!==i.state)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 e.bd(this._tiles).map(e=>e.tileID).sort(e8).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(e8).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.t(n,{tile:i}));else{if(this._source.fire(new e.x("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.x("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){let o;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 s="batched-model"===this._source.type;if(this.used||this.usedForTerrain){if(this._source.tileID)o=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new e.aA(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,o=n.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:s}),this._source.minzoom<=1&&"globe"===i.projection.name&&(o.push(new e.aA(1,0,1,0,0)),o.push(new e.aA(1,0,1,1,0)),o.push(new e.aA(1,0,1,0,1)),o.push(new e.aA(1,0,1,1,1)))}else if(o=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:s}),this._source.hasTile){let e=this._source.hasTile.bind(this._source);o=o.filter(i=>e(i))}}else o=[];if(o.length>0&&this.castsShadows&&n&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!e9(this._source.type)){let e=Math.min(i.coveringZoomLevel({tileSize:r||this._source.tileSize,roundZoom:this._source.roundZoom&&!a}),this._source.maxzoom);if(s)for(let r of i.extendTileCover(o,e))o.push(r);else for(let r of i.extendTileCover(o,e,n))this._shadowCasterTiles[r.key]=!0,o.push(r)}let l=this._updateRetainedTiles(o);if(e9(this._source.type)&&0!==o.length){let i={},r={};for(let a of Object.keys(l)){let n=l[a],o=this._tiles[a];if(!o||o.fadeEndTime&&o.fadeEndTime<=e.q.now())continue;let s=this.findLoadedParent(n,Math.max(n.overscaledZ-e6.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),i[s.tileID.key]=s.tileID),r[a]=n}let a=o[o.length-1].overscaledZ;for(let e in this._tiles){let i=this._tiles[e];if(l[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]){l[e]=i.tileID;break}}}for(let e in i)l[e]||(this._coveredTiles[e]=!0,l[e]=i[e])}for(let e in l)this._tiles[e].clearFadeHold();for(let i of e.be(this._tiles,l)){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-e6.maxOverzooming,this._source.minzoom),s=Math.max(n+e6.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 e3(i,a,this.transform.tileZoom,e,this._isRaster):new e2(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.x("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.am(o.center.lng);for(let h in this._tiles){let u;let 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.ap(l,...e7(i,-1))-l),Math.abs(e.ap(l,...e7(i,1))-l)];u=[0,2*r.indexOf(Math.min(...r))-1]}else{let r=[Math.abs(e.ap(l,...e7(i,-1))-l),Math.abs(e.ap(l,...e7(i,0))-l),Math.abs(e.ap(l,...e7(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(e9(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.bf(l,(e,i)=>{let r=new e2(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 e8(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 e9(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function e7(e,i){let r=1<<e.z;return[e.x/r+i,(e.x+1)/r+i]}e6.maxOverzooming=10,e6.maxUnderzooming=3;class te{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")>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!==Number.NEGATIVE_INFINITY?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.ab)*h-l.x*e.ab|0,s=(a+i.canonical.y*e.ab)*h-l.y*e.ab|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:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function tt(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.bg.forEach(e=>{e in r&&(a[e]=r[e])}),a}(i[a],r[i[a].ref]));return i}let ti={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",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function tr(e,i,r){r.push({command:ti.addSource,args:[e,i[e]]})}function ta(e,i,r){i.push({command:ti.removeSource,args:[e]}),r[e]=!0}function tn(i,r,a,n,o,s){let l;for(l in r=r||{},i=i||{})i.hasOwnProperty(l)&&(e.bh(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.bh(i[l],r[l])||a.push({command:s,args:[n,l,r[l],o]}))}function to(e){return e.id}function ts(e,i){return e[i.id]=i,e}class tl{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.ap(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 th{constructor(e,i,r){let 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 tu={unknown:0,flipRequired:1,flipNotRequired:2},tc=Math.tan(85*Math.PI/180);function td(i,r,a,n,o,s,l){let h=e.a6.mat4.create();if(a){if("globe"===s.name){let i=e.bi(o,r);e.a6.mat4.multiply(h,h,i)}else{let i=e.a6.mat2.invert([],l);h[0]=i[0],h[1]=i[1],h[4]=i[2],h[5]=i[3],n||e.a6.mat4.rotateZ(h,h,o.angle)}}else e.a6.mat4.multiply(h,o.labelPlaneMatrix,i);return h}function tp(e,i,r,a,n,o,s){let l=td(e,i,r,a,n,o,s);return"globe"===o.name&&r||(l[2]=l[6]=l[10]=l[14]=0),l}function tf(i,r,a,n,o,s,l){if(a){if("globe"===s.name){let h=td(i,r,a,n,o,s,l);return e.a6.mat4.invert(h,h),e.a6.mat4.multiply(h,i,h),h}{let r=e.a6.mat4.clone(i),a=e.a6.mat4.identity([]);return a[0]=l[0],a[1]=l[1],a[4]=l[2],a[5]=l[3],e.a6.mat4.multiply(r,r,a),n||e.a6.mat4.rotateZ(r,r,-o.angle),r}}return o.glCoordMatrix}function tm(i,r,a,n){let o=[i,r,a,1];a?e.a6.vec4.transformMat4(o,o,n):tE(o,o,n);let s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function t_(e,i){return Math.min(.5+e/i*.5,1.5)}function tg(i,r,a,n,o,s,l,h,u,c){let d=a.transform,p=n?i.textSizeData:i.iconSizeData,f=e.bj(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:E}=m;if(E!==e.bk.vertical||T||w===e.bk.horizontal||(T=!0),w=E,(m.hidden||E===e.bk.vertical)&&!T){tS(S,g);continue}T=!1;let M=new e.P(m.tileAnchorX,m.tileAnchorY),{x:I,y:A,z:C}=d.projection.projectTilePoint(M.x,M.y,c.canonical);if(u){let[e,i,r]=u(M);I+=e,A+=i,C+=r}let P=[I,A,C,1];if(e.a6.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,_)){tS(S,g);continue}let z=P[3],D=t_(a.transform.getCameraToCenterDistance(d.projection),z),R=e.bl(p,f,m),L=l?R/D:R*D,k=tm(I,A,C,o);if(k[3]<=0){tS(S,g);continue}let O={},B=l?null:u,F=tv(m,L,!1,h,r,o,s,i.glyphOffsetArray,x,g,y,k,M,O,b,B,d.projection,c,l);T=F.useVertical,B&&F.needsFlipping&&(O={}),(F.notEnoughRoom||T||F.needsFlipping&&tv(m,L,!0,h,r,o,s,i.glyphOffsetArray,x,g,y,k,M,O,b,B,d.projection,c,l).notEnoughRoom)&&tS(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 ty(e,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let{lineStartIndex:g,glyphStartIndex:y,segment:x}=l,v=y+l.numGlyphs,b=g+l.lineLength,w=i.getoffsetX(y),T=i.getoffsetX(v-1),S=tT(e*w,r,a,n,o,s,x,g,b,h,u,c,d,p,!0,f,m,_);if(!S)return null;let E=tT(e*T,r,a,n,o,s,x,g,b,h,u,c,d,p,!0,f,m,_);return E?{first:S,last:E}:null}function tx(i,r,a,n){return i===e.bk.horizontal&&Math.abs(n)>Math.abs(a)?{useVertical:!0}:i===e.bk.vertical?n>0?{needsFlipping:!0}:null:r!==tu.unknown&&(0===a||Math.abs(n/a)>tc)?r===tu.flipRequired?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function tv(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=r/24,w=i.lineOffsetX*b,T=i.lineOffsetY*b,{lineStartIndex:S,glyphStartIndex:E,numGlyphs:M,segment:I,writingMode:A,flipState:C}=i,P=S+i.lineLength,z=i=>{if(d){let[r,a,n]=i.up,o=c.length;e.bm(d,o+0,r,a,n),e.bm(d,o+1,r,a,n),e.bm(d,o+2,r,a,n),e.bm(d,o+3,r,a,n)}let[r,a,n]=i.point;e.bn(c,r,a,n,i.angle)};if(M>1){let e=ty(b,h,w,T,a,p,f,i,u,s,m,g,!1,y,x,v);if(!e)return{notEnoughRoom:!0};if(n&&!a){let[r,a,n]=e.first.point,[o,s,h]=e.last.point;[r,a]=tm(r,a,n,l),[o,s]=tm(o,s,h,l);let u=tx(A,C,(o-r)*_,s-a);if(i.flipState=u&&u.needsFlipping?tu.flipRequired:tu.flipNotRequired,u)return u}z(e.first);for(let e=E+1;e<E+M-1;e++){let i=tT(b*h.getoffsetX(e),w,T,a,p,f,I,S,P,u,s,m,g,!1,!1,y,x,v);if(!i)return c.length-=4*(e-E),{notEnoughRoom:!0};z(i)}z(e.last)}else{if(n&&!a){let r=tm(f.x,f.y,0,o),a=S+I+1,n=new e.P(u.getx(a),u.gety(a)),s=tm(n.x,n.y,0,o),l=s[3]>0?s:tw(f,n,r,1,o,void 0,y,x.canonical),h=tx(A,C,(l[0]-r[0])*_,l[1]-r[1]);if(i.flipState=h&&h.needsFlipping?tu.flipRequired:tu.flipNotRequired,h)return h}let r=tT(b*h.getoffsetX(E),w,T,a,p,f,I,S,P,u,s,m,g,!1,!1,y,x,v);if(!r)return{notEnoughRoom:!0};z(r)}return{}}function tb(e,i,r,a,n){let{x:o,y:s,z:l}=a.projectTilePoint(e.x,e.y,i);if(!n)return tm(o,s,l,r);let[h,u,c]=n(e);return tm(o+h,s+u,l+c,r)}function tw(i,r,a,n,o,s,l,h){let u=tb(i.sub(r)._unit()._add(i),h,o,l,s);return e.a6.vec3.sub(u,a,u),e.a6.vec3.normalize(u,u),e.a6.vec3.scaleAndAdd(u,a,u,n)}function tT(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x){let v=n?i-r:i+r,b=v>0?1:-1,w=0;n&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let T=h+l+(b>0?0:1)|0,S=o,E=o,M=0,I=0,A=Math.abs(v),C=[],P=[],z=s,D=z,R=()=>tw(D,z,E,A-M+1,d,f,g,y.canonical);for(;M+I<=A;){if((T+=b)<h||T>=u)return null;if(E=S,D=z,C.push(E),m&&P.push(D),z=new e.P(c.getx(T),c.gety(T)),!(S=p[T])){let e=tb(z,y.canonical,d,g,f);S=e[3]>0?p[T]=e:R()}M+=I,I=e.a6.vec3.distance(E,S)}_&&f&&(p[T]&&(S=R(),I=e.a6.vec3.distance(E,S)),p[T]=S);let L=(A-M)/I,k=z.sub(D)._mult(L)._add(D),O=e.a6.vec3.sub([],S,E),B=e.a6.vec3.scaleAndAdd([],E,O,L
8),F=[0,0,1],N=O[0],V=O[1];if(x&&(0!==(F=g.upVector(y.canonical,k.x,k.y))[0]||0!==F[1]||1!==F[2])){let i=[F[2],0,-F[0]],r=e.a6.vec3.cross([],F,i);e.a6.vec3.normalize(i,i),e.a6.vec3.normalize(r,r),N=e.a6.vec3.dot(O,i),V=e.a6.vec3.dot(O,r)}if(a){let i=e.a6.vec3.cross([],F,O);e.a6.vec3.normalize(i,i),e.a6.vec3.scaleAndAdd(B,B,i,a*b)}let U=w+Math.atan2(V,N);return C.push(B),m&&P.push(k),{point:B,angle:U,path:C,tilePath:P,up:F}}function tS(e,i){let r=i.length,a=r+4*e;i.resize(a),i.float32.fill(-1/0,4*r,4*a)}function tE(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 tM{constructor(e,i,r=new th(e.width+200,e.height+200,25),a=new th(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 E="globe"===x.name,M=this.projectAndGetPerspectiveRatio(l,w,T,S,_,E||!!y||this.transform.pitch>0,x),{perspectiveRatio:I}=M,A=(d?s/I:s*I)/e.bq,C=tm(w,T,S,h),P=M.signedDistanceFromCamera>0?ty(A,o,a.lineOffsetX*A,a.lineOffsetY*A,!1,C,b,a,n,h,{},y&&!d?v:null,d&&!!y,x,_,d):null,z=!1,D=!1,R=!0;if(P&&!M.occluded){let i=.5*f*I+m,a=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new tl,{first:s,last:l}=P,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&&!E&&(r=v(a<h-1?s.tilePath[h-1-a]:l.tilePath[a-h+2])[2]),tm(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.bo(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(R=R&&this.isOffscreen(u,d,f,m),D=D||this.isInsideGrid(u,d,f,m),!r&&this.grid.hitTestCircle(l,h,i,p)&&(z=!0,!c))return{circles:[],offscreen:!1,collisionDetected:z,occluded:!1}}}}return{circles:(c||!z)&&D?g:[],offscreen:R,collisionDetected:z,occluded:M.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)];e.bp(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;
8i+=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;n||this.transform.pitch>0?(e.a6.vec4.transformMat4(h,h,i),this.fogState&&o&&"globe"!==l.name&&(u=function(i,r,a,n,o,s){let l=s.calculateFogTileMatrix(o),h=[r,a,n];return e.a6.vec3.transformMat4(h,h,l),eD(i,e.a6.vec3.length(h),s.pitch,s._fov)}(this.fogState,r,a,n,o.toUnwrapped(),this.transform)>.9)):tE(h,h,i);let c=h[3];return{point:new e.P((h[0]/c+1)/2*this.transform.width+100,(-h[1]/c+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(l)/c*.5,1.5),signedDistanceFromCamera:c,occluded:s&&h[2]>c||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.a6.mat4.identity([]);return e.a6.mat4.translate(i,i,[-100,-100,0]),i}}function tI(i,r,a){let n=r.createTileMatrix(i,i.worldSize,a.toUnwrapped());return e.a6.mat4.multiply(new Float32Array(16),i.projMatrix,n)}function tA(e,i,r){return i.name===r.projection.name?e.projMatrix:tI(r,i,e)}class tC{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 tP{constructor(e,i,r,a,n,o=!1){this.text=new tC(e?e.text:null,i,r,n),this.icon=new tC(e?e.icon:null,i,a,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class tz{constructor(e,i,r,a=!1){this.text=e,this.icon=i,this.skipFade=r,this.clipped=a}}class tD{constructor(){this.invProjMatrix=e.a6.mat4.create(),this.viewportMatrix=e.a6.mat4.create(),this.circles=[]}}class tR{constructor(e,i,r,a,n){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=n}}class tL{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 tk(i,r,a,n,o){let{horizontalAlign:s,verticalAlign:l}=e.bx(i),h=e.bw(i,n);return new e.P(-(s-.5)*r+h[0]*o,-(l-.5)*a+h[1]*o)}function tO(i,r,a,n,o){let s=new e.P(i,r);return a&&s._rotate(n?o:-o),s}class tB{constructor(e,i,r,a,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new tM(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 tL(r),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,r,a,n){var o,s,l;let h=a.getBucket(r),u=a.latestFeatureIndex;if(!h||!u||r.fqid!==h.layerIds[0])return;let c=h.layers[0].layout,d=h.layers[0].paint,p=a.collisionBoxArray,f=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),m=a.tileSize/e.ab,_=a.tileID.toUnwrapped();this.transform.setProjection(h.projection);let g=(o=a.tileID,s=h.getProjection(),l=this.transform,s.name===this.projection?l.calculateProjMatrix(o.toUnwrapped()):tI(l,s,o)),y="map"===c.get("text-pitch-alignment"),x="map"===c.get("text-rotation-alignment");r.compileFilter();let v=r.dynamicFilter(),b=r.dynamicFilterNeedsFeature(),w=this.transform.calculatePixelsToTileUnitsMatrix(a),T=tp(g,a.tileID.canonical,y,x,this.transform,h.getProjection(),w),S=null;if(y){let i=tf(g,a.tileID.canonical,y,x,this.transform,h.getProjection(),w);S=e.a6.mat4.multiply([],this.transform.labelPlaneMatrix,i)}let E=null;v&&a.latestFeatureIndex&&(E={unwrappedTileID:_,dynamicFilter:v,dynamicFilterNeedsFeature:b}),this.retainedQueryData[h.bucketInstanceId]=new tR(h.bucketInstanceId,u,h.sourceLayerIndex,h.index,a.tileID);let M={bucket:h,layout:c,paint:d,posMatrix:g,textLabelPlaneMatrix:T,labelToScreenMatrix:S,clippingData:E,scale:f,textPixelRatio:m,holdingForFade:a.holdingForFade(),collisionBoxArray:p,partiallyEvaluatedTextSize:e.bj(h.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.bj(h.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID),latestFeatureIndex:a.latestFeatureIndex};if(n)for(let e of h.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n}=e;i.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n,parameters:M})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:M})}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=tk(e,r,a,w,n),S=this.collisionIndex.placeCollisionBox(f,n,i,tO(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,_,tO(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].anch
8or),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){let{bucket:o,layout:s,paint:l,posMatrix:h,textLabelPlaneMatrix:u,labelToScreenMatrix:c,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:_,partiallyEvaluatedIconSize:g,collisionGroup:y,latestFeatureIndex:x}=i.parameters,v=s.get("text-optional"),b=s.get("icon-optional"),w=s.get("text-allow-overlap"),T=s.get("icon-allow-overlap"),S="map"===s.get("text-rotation-alignment"),E="map"===s.get("text-pitch-alignment"),M=s.get("symbol-z-elevate"),I=l.get("symbol-z-offset"),A="sea"===l.get("symbol-elevation-reference");this.transform.setProjection(o.projection);let C=w&&(T||!o.hasIconData()||b),P=T&&(w||!o.hasTextData()||v),z=!I.isConstant();!o.collisionArrays&&m&&o.deserializeCollisionBoxes(m),a&&n&&o.updateCollisionDebugBuffers(this.transform.zoom,m);let D=(i,n,l)=>{let{crossTileID:m,numVerticalGlyphVertices:M}=i,D=null;if(d&&d.dynamicFilterNeedsFeature||z){let e=this.retainedQueryData[o.bucketInstanceId];D=x.loadFeature({featureIndex:i.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.s
8ourceLayerIndex,layoutVertexArrayOffset:0})}if(d&&!(0,d.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},D,this.retainedQueryData[o.bucketInstanceId].tileID.canonical,new e.P(i.tileAnchorX,i.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[m]=new tz(!1,!1,!1,!0),void r.add(m);let R=I.evaluate(D,{});if(r.has(m))return;if(f)return void(this.placements[m]=new tz(!1,!1,!1));let L=!1,k=!1,O=!0,B=!1,F=!1,N=null,V={box:null,offscreen:null,occluded:null},U={box:null,offscreen:null,occluded:null},j=null,G=null,q=null,Z=0,$=0,H=0;l.textFeatureIndex?Z=l.textFeatureIndex:i.useRuntimeCollisionCircles&&(Z=i.featureIndex),l.verticalTextFeatureIndex&&($=l.verticalTextFeatureIndex);let W=e=>{e.tileID=this.retainedQueryData[o.bucketInstanceId].tileID;let r=this.transform.elevation;e.elevation=A?R:R+(r?r.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0),e.elevation+=i.zOffset},X=l.textBox;if(X){W(X);let r=r=>{let a=e.bk.horizontal;if(o.allowVerticalPlacement&&!r&&this.prevPlacement){let e=this.prevPlacement.placedOrientations[m];e&&(this.placedOrientations[m]=e,a=e,this.markUsedOrientation(o,a,i))}return a},a=(i,r)=>{if(o.allowVerticalPlacement&&M>0&&l.verticalTextBox){for(let a of o.writingModes)if(a===e.bk.vertical?U=V=r():V=i(),V&&V.box&&V.box.length)break}else V=i()};if(s.get("text-variable-anchor")){let u=s.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[m]){let e=this.prevPlacement.variableOffsets[m];u.indexOf(e.anchor)>0&&(u=u.filter(i=>i!==e.anchor)).unshift(e.anchor)}let c=(e,r,a)=>{let s=o.getSymbolInstanceTextSize(_,i,this.transform.zoom,n),l=(e.x2-e.x1)*s+2*e.padding,c=(e.y2-e.y1)*s+2*e.padding,d=i.hasIconTextFit&&!T?r:null;d&&W(d);let f={box:[],offscreen:!1,occluded:!1},m=w?2*u.length:u.length;for(let r=0;r<m;++r){let m=this.attemptAnchorPlacement(u[r%u.length],e,l,c,s,S,E,p,h,y,r>=u.length,i,n,o,a,d,_,g);if(m&&(f=m.placedGlyphBoxes)&&f.box&&f.box.length){L=!0,N=m.shift;break}}return f};a(()=>c(X,l.iconBox,e.bk.horizontal),()=>{let i=l.verticalTextBox;return i&&W(i),o.allowVerticalPlacement&&!(V&&V.box&&V.box.length)&&M>0&&i?c(i,l.verticalIconBox,e.bk.vertical):{box:null,offscreen:null,occluded:null}}),V&&(L=V.box,O=V.offscreen,B=V.occluded);let d=r(!(!V||!V.box));if(!L&&this.prevPlacement){let e=this.prevPlacement.variableOffsets[m];e&&(this.variableOffsets[m]=e,this.markUsedJustification(o,e.anchor,i,d))}}else{let s=(r,a)=>{let s=o.getSymbolInstanceTextSize(_,i,this.transform.zoom,n),l=this.collisionIndex.placeCollisionBox(o,s,r,new e.P(0,0),w,p,h,y.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(o,a,i),this.placedOrientations[m]=a),l};a(()=>s(X,e.bk.horizontal),()=>{let i=l.verticalTextBox;return o.allowVerticalPlacement&&M>0&&i?(W(i),s(i,e.bk.vertical)):{box:null,offscreen:null,occluded:null}}),r(!!(V&&V.box&&V.box.length))}}if(L=(j=V)&&j.box&&j.box.length>0,O=j&&j.offscreen,B=j&&j.occluded,i.useRuntimeCollisionCircles){let r=o.text.placedSymbolArray.get(i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex),n=e.bl(o.textSizeData,_,r),l=s.get("text-padding");G=this.collisionIndex.placeCollisionCircles(o,w,r,o.lineVertexArray,o.glyphOffsetArray,n,h,u,c,a,E,y.predicate,i.collisionCircleDiameter*n/e.bq,l,this.retainedQueryData[o.bucketInstanceId].tileID),L=w||G.circles.length>0&&!G.collisionDetected,O=O&&G.offscreen,B=G.occluded}if(l.iconFeatureIndex&&(H=l.iconFeatureIndex),l.iconBox){let r=r=>{W(r);let a=i.hasIconTextFit&&N?tO(N.x,N.y,S,E,this.transform.angle):new e.P(0,0),n=o.getSymbolInstanceIconSize(g,this.transform.zoom,i.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(o,n,r,a,T,p,h,y.predicate)};k=U&&U.box&&U.box.length&&l.verticalIconBox?(q=r(l.verticalIconBox)).box.length>0:(q=r(l.iconBox)).box.length>0,O=O&&q.offscreen,F=q.occluded}let Y=v||0===i.numHorizontalGlyphVertices&&0===M,J=b||0===i.numIconVertices;if(Y||J?J?Y||(k=k&&L):L=k&&L:k=L=k&&L,L&&j&&j.box&&this.collisionIndex.insertCollisionBox(j.box,s.get("text-ignore-placement"),o.bucketInstanceId,U&&U.box&&$?$:Z,y.ID),k&&q&&this.collisionIndex.insertCollisionBox(q.box,s.get("icon-ignore-placement"),o.bucketInstanceId,H,y.ID),G&&(L&&this.collisionIndex.insertCollisionCircles(G.circles,s.get("text-ignore-placement"),o.bucketInstanceId,Z,y.ID),a)){let e=o.bucketInstanceId,i=this.collisionCircleArrays[e];void 0===i&&(i=this.collisionCircleArrays[e]=new tD);for(let e=0;e<G.circles.length;e+=4)i.circles.push(G.circles[e+0]),i.circles.push(G.circles[e+1]),i.circles.push(G.circles[e+2]),i.circles.push(G.collisionDetected?1:0)}let K="globe"!==o.projection.name;C=C&&(K||!B),P=P&&(K||!F),this.placements[m]=new tz(L||C,k||P,O||o.justReloaded),r.add(m)};if(M&&this.buildingIndex&&(this.buildingIndex.updateZOffset(o,this.retainedQueryData[o.bucketInstanceId].tileID),o.updateZOffset()),o.sortFeaturesByY){let i=o.getSortedSymbolIndexe
8s(this.transform.angle);for(let e=i.length-1;e>=0;--e){let r=i[e];D(o.symbolInstances.get(r),r,o.collisionArrays[r])}o.hasAnyZOffset&&e.w(`${o.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(o.hasAnyZOffset){let e=o.getSortedIndexesByZOffset();for(let i=0;i<e.length;++i){let r=e[i];D(o.symbolInstances.get(r),r,o.collisionArrays[r])}}else for(let e=i.symbolInstanceStart;e<i.symbolInstanceEnd;e++)D(o.symbolInstances.get(e),e,o.collisionArrays[e]);if(a&&o.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[o.bucketInstanceId];e.a6.mat4.invert(i.invProjMatrix,h),i.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}markUsedJustification(i,r,a,n){let{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:h,crossTileID:u}=a,c=e.bv(r),d=n===e.bk.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.bk.horizontal||r===e.bk.horizontalOnly?r:0,o=r===e.bk.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 tP(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 tP(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 tP(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),i.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(i,o.tileID),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 tP(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"===c.get("symbol-elevation-reference"),b=!x.isConstant(),w=new tP(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:E,tileAnchorX:M,tileAnchorY:I}=u,A=null;if(u&&b){let e=this.retainedQueryData[i.bucketInstanceId];A=a.latestFeatureIndex.loadFeature({featureIndex:u.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.s
8ourceLayerIndex,layoutVertexArrayOffset:0})}let C=x.evaluate(A,{}),P=r.has(m),z=this.opacities[m];P?z=p:z||(z=w,this.opacities[m]=z),r.add(m);let D=c>0||f>0,R=E>0,L=this.placedOrientations[m],k=L===e.bk.vertical,O=L===e.bk.horizontal||L===e.bk.horizontalOnly;!D&&!R||z.isHidden()||S++;let B=!1;if((D||R)&&s)for(let r of i.activeReplacements){if(e.br(r,o,e.bs.Symbol,h)||r.min.x>M||M>r.max.x||r.min.y>I||I>r.max.y)continue;let i=e.bt(M,I,l.canonical,r.footprintTileId.canonical);if(B=e.bu(i,r.footprint))break}if(D){let e=B?tV:tN(z.text);T(i.text,c,k?tV:e),T(i.text,f,O?tV:e);let r=z.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||O?1:0);let d=this.variableOffsets[m];d&&this.markUsedJustification(i,d.anchor,u,L);let p=this.placedOrientations[m];p&&(this.markUsedJustification(i,"left",u,p),this.markUsedOrientation(i,p,u))}if(R){let e=B?tV:tN(z.icon),{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=u,n=i.icon.placedSymbolArray,o=z.icon.isHidden()?1:0;r>=0&&(T(i.icon,E,k?tV:e),n.get(r).hidden=o),a>=0&&(T(i.icon,u.numVerticalIconVertices,O?tV: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=tk(e.anchor,e.width,e.height,e.textOffset,e.textScale),g&&a._rotate(y?this.transform.angle:-this.transform.angle)):n=!1}d&&(n=!z.clipped),r.textBox&&tF(i.textCollisionBox.collisionVertexArray,z.text.placed,!n||k,C,v,a.x,a.y),r.verticalTextBox&&tF(i.textCollisionBox.collisionVertexArray,z.text.placed,!n||O,C,v,a.x,a.y)}let o=n&&!!(!O&&r.verticalIconBox);r.iconBox&&tF(i.iconCollisionBox.collisionVertexArray,z.icon.placed,o,C,v,u.hasIconTextFit?a.x:0,u.hasIconTextFit?a.y:0),r.verticalIconBox&&tF(i.iconCollisionBox.collisionVertexArray,z.icon.placed,!o,C,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.opacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.bucketInstanceId in this.collisionCircleArrays){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 tF(e,i,r,a,n,o,s){e.emplaceBack(i?1:0,r?1:0,o||0,s||0,a,n?1:0),e.emplaceBack(i?1:0,r?1:0,o||0,s||0,a,n?1:0),e.emplaceBack(i?1:0,r?1:0,o||0,s||0,a,n?1:0),e.emplaceBack(i?1:0,r?1:0,o||0,s||0,a,n?1:0)}function tN(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let i=e.placed?1:0,r=Math.floor(127*e.opacity);return 33554432*r+16777216*i+131072*r+65536*i+512*r+256*i+2*r+i}let tV=0;class tU{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){let o=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(o,a,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((e,i)=>
8e.sortKey-i.sortKey));this._currentPartIndex<o.length;){let e=o[this._currentPartIndex];if(i.placeLayerBucketPart(e,this._seenCrossTileIDs,r,0===e.symbolInstanceStart),this._currentPartIndex++,n())return!0}return!1}}class tj{constructor(e,i,r,a,n,o,s,l,h){this.placement=new tB(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){let o=e.q.now(),s=()=>{let i=e.q.now()-o;return!this._forceFullPlacement&&i>2};for(;this._currentPlacementIndex>=0;){let o=r[i[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===o.type&&(!o.minzoom||o.minzoom<=l)&&(!o.maxzoom||o.maxzoom>l)){let i=o.layout.get("symbol-z-elevate"),r=void 0!==o.layout.get("symbol-sort-key").constantOr(1),l=o.layout.get("symbol-z-order"),h="viewport-y"===l||"auto"===l&&!("viewport-y"!==l&&r),u=o.layout.get("text-allow-overlap")||o.layout.get("icon-allow-overlap")||o.layout.get("text-ignore-placement")||o.layout.get("icon-ignore-placement"),c=h&&u,d=this._inProgressLayer=this._inProgressLayer||new tU(o),p=e.av(o.source,o.scope);if(d.continuePlacement(i||c?n[p]:a[p],this.placement,this._showCollisionBoxes,o,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let tG=512/e.ab/2;class tq{constructor(i,r,a){this.tileID=i,this.bucketInstanceId=a,this.index=new e.by(r.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];let n=i.canonical.x*e.ab,o=i.canonical.y*e.ab;
8for(let e=0;e<r.length;e++){let{key:i,crossTileID:a,tileAnchorX:s,tileAnchorY:l}=r.get(e),h=Math.floor((n+s)*tG),u=Math.floor((o+l)*tG);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=tG/Math.pow(2,r.canonical.z-this.tileID.canonical.z),s=r.canonical.x*e.ab,l=r.canonical.y*e.ab;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 tZ{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class t${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(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 tq(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 tH{constructor(){this.layerIndexes={},this.crossTileIDs=new tZ,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 t$);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 tW{constructor(e,i,r,a){this.blendFunction=e,this.blendColor=i,this.mask=r,this.blendEquation=a}}tW.Replace=[1,0,1,0],tW.disabled=new tW(tW.Replace,e.bz.transparent,[!1,!1,!1,!1]),tW.unblended=new tW(tW.Replace,e.bz.transparent,[!0,!0,!0,!0]),tW.alphaBlended=new tW([1,771,1,771],e.bz.transparent,[!0,!0,!0,!0]),tW.alphaBlendedNonPremultiplied=new tW([770,771,770,771],e.bz.transparent,[!0,!0,!0,!0]),tW.multiply=new tW([774,0,774,0],e.bz.transparent,[!0,!0,!0,!0]);class tX{constructor(e,i,r){this.func=e,this.mask=i,this.range=r}}tX.ReadOnly=!1,tX.ReadWrite=!0,tX.disabled=new tX(519,tX.ReadOnly,[0,1]);class tY{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}}tY.disabled=new tY({func:519,mask:0},0,0,7680,7680,7680);class tJ{constructor(e,i,r){this.enable=e,this.mode=i,this.frontFace=r}}function tK(i,r){let a=e.bC(i,3);e.a6.mat4.fromQuat(i,r),e.bE(i,3,a)}function tQ(i,r){let a=e.a6.quat.identity([]);return e.a6.quat.rotateZ(a,a,-r),e.a6.quat.rotateX(a,a,-i),a}function t0(i,r){let a=[i[0],i[1],0],n=[r[0],r[1],0];if(e.a6.vec3.length(a)>=1e-15){let i=e.a6.vec3.normalize([],a);e.a6.vec3.scale(n,i,e.a6.vec3.dot(n,i)),r[0]=n[0],r[1]=n[1]}let o=e.a6.vec3.cross([],r,i);if(1e-15>e.a6.vec3.len(o))return null;let s=Math.atan2(-o[1],o[0]);return tQ(Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2]),s)}tJ.disabled=new tJ(!1,1029,2305),tJ.backCCW=new tJ(!0,1029,2305),tJ.backCW=new tJ(!0,1029,2304),tJ.frontCW=new tJ(!0,1028,2304),tJ.frontCCW=new tJ(!0,1028,2305);class t1{constructor(e,i){this.position=e,this.orientation=i}get position(){return this._position}set position(i){if(i){let r=i instanceof e.a5?i:new e.a5(i[0],i[1],i[2]);
8this._renderWorldCopies&&(r.x=e.bA(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.a5.fromLngLat(i)):0,o=e.a5.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=t0(s,r)}setPitchBearing(i,r){this.orientation=tQ(e.bB(i),e.bB(-r))}}class t2{constructor(i,r){this._transform=e.a6.mat4.identity([]),this.orientation=r,this.position=i}get mercatorPosition(){let i=this.position;return new e.a5(i[0],i[1],i[2])}get position(){let i=e.bC(this._transform,3);return[i[0],i[1],i[2]]}set position(i){i&&e.bE(this._transform,3,[i[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(i){this._orientation=i||e.a6.quat.identity([]),i&&tK(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=tQ(e,i),tK(this._transform,this._orientation)}forward(){let i=e.bC(this._transform,2);return[-i[0],-i[1],-i[2]]}up(){let i=e.bC(this._transform,1);return[-i[0],-i[1],-i[2]]}right(){let i=e.bC(this._transform,0);return[i[0],i[1],i[2]]}getCameraToWorld(i,r){let a=new Float64Array(16);return e.a6.mat4.invert(a,this.getWorldToCamera(i,r)),a}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(i,r,a){let n=this.position;e.a6.vec3.scale(n,n,-i);let o=new Float64Array(16);return e.a6.mat4.fromScaling(o,[a,a,a]),e.a6.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.a6.quat.conjugate(n,this._orientation),e.a6.vec3.scale(o,o,-i),e.a6.mat4.fromQuat(a,n),e.a6.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.a6.mat4.perspective(o,i,r,a,n),o}getCameraToClipOrthographic(i,r,a,n,o,s){let l=new Float64Array(16);return e.a6.mat4.ortho(l,i,r,a,n,o,s),l}getDistanceToElevation(i,r=!1){let a=0===i?0:e.bD(i,r?e.aM(this.position[1]):this.position[1]),n=this.forward();return(a-this.position[2])/n[2]}clone(){return new t2([...this.position],[...this.orientation])}}let t3={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class t4{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.aa(i.top,r.top,a)),null!=r.bottom&&null!=i.bottom&&(this.bottom=e.aa(i.bottom,r.bottom,a)),null!=r.left&&null!=i.left&&(this.left=e.aa(i.left,r.left,a)),null!=r.right&&null!=i.right&&(this.right=e.aa(i.right,r.right,a)),this}getCenter(i,r){let a=e.ap((this.left+i-this.right)/2,0,i),n=e.ap((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 t4(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let t5=(e,i,r)=>(1-r)*e+r*i,t6=e=>e*e*e*e*e;class t8{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.bK(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 t4,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new t2,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}clone(){let e=new t8(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());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}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.ar(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};let r=this.projection?this.getProjection():void 0;this.projection=e.bL(this.projectionOptions);let a=this.getProjection(),n=!e.bh(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.bL({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.bD(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.bA(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.a6.mat2.create(),e.a6.mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){let r=e.ap(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}get fovX(){return this._fov}get fovY(){let e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=e.bB(i),this._calcMatrices())}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),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,i=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!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=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom);this._setZoom(this._zoomFromMercatorZ(Math.max(a-r,n)))}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;let 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.a6.vec3.length(e.a6.vec3.sub([],this._camera.position,r));return e.ap(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.a6.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.a6.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 t1;return r.position=new e.a5(i[0],i[1],i[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(i){if(!e.a6.quat.length(i))return!1;e.a6.quat.normalize(i,i);let r=e.a6.vec3.transformQuat([],[0,0,-1],i),a=e.a6.vec3.transformQuat([],[0,-1,0],i);if(a[2]<0)return!1;let n=t0(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.ap(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.bM(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.bM(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.c1(r,i,a,o,s);l.has(h)||(n.push(new e.aA(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?0:1),y=n.wrap+(p?0:1),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.bN.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,f),_=p?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),g=c*e.bD(1,this.center.lat),y=this._camera.position[2]/e.bD(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.bO(this):1,E=i=>{let r=1/4e4,a=new e.a5(i.x+r,i.y,i.z),n=new e.a5(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},M=i=>{let a=r;return{aabb:e.bR(this,c,0,0,0,i,T,a,this.projection),zoom:0,x:0,y:0,minZ:T,maxZ:a,wrap:i,fullyVisible:!1}},I=[],A=[],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.aM((i.y+1)/r)),e.aM(i.y/r)),n=e.c5(a)/e.c5(u);if(h=a===u?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,n/this._mercatorScaleRatio),this.zoom<=e.c2&&i.zoom===C-1&&n>=.9)return!0}else if(s&&(o=i.aabb.distanceZ(x)*g),this.projection.isReprojectedInTileSpace&&n<=5){let r=Math.pow(2,i.zoom),a=E(new e.a5((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.a6.vec3.sub(_,i,x),p||(s?_[2]*=g:_[2]=z);let r=e.a6.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++)I.push(M(-e)),I.push(M(e));for(I.push(M(0));I.length>0;){let r=I.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.bP(r.zoom,n,o);i=e.bQ(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.bR(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.aA(r.zoom+1===C?P:r.zoom+1,r.wrap,r.zoom+1,a,u),D(d)),I.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.bP(r.zoom,n,o);a=e.bQ(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.aA(s,r.wrap,r.zoom,n,o);i.calculateQuadrantVisibility&&(_.visibleQuadrants=l),A.push({tileID:_,distanceSq:p*p+f*f})}}if(this.fogCullDistSq){let a=this.fogCullDistSq,n=this.horizonLineFromTop();A=A.filter(o=>{let s=[0,0,0,1],l=[e.ab,e.ab,0,1],h=this.calculateFogTileMatrix(o.tileID.toUnwrapped());e.a6.vec4.transformMat4(s,s,h),e.a6.vec4.transformMat4(l,l,h);let u=e.a6.vec4.min([],s,l),c=e.a6.vec4.max([],s,l),d=e.bS(u,c);if(0===d)return!0;let p=!1,f=this._elevation;if(f&&d>a&&0!==n){let a;let s=this.calculateProjMatrix(o.tileID.toUnwrapped());i.isTerrainDEM||(a=f.getMinMaxForTile(o.tileID)),a||(a={min:T,max:r});let l=e.c3(this.rotation),h=[l[0]*e.ab,l[1]*e.ab,a.max];e.a6.vec3.transformMat4(h,h,s),p=(1-h[1])*this.height*.5<n}return d<a||p})}return A.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.ap(i.lat,-e.bT,e.bT),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.bD(1,this.center.lat)/this.worldSize}setLocationAtPoint(i,r){let a,n;let 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.a5(s.x-a,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(i,r){let a=r?e.bD(r,i.lat):void 0,n=this.projection.project(i.lng,i.lat);return new e.a5(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.a6.vec4.transformMat4(n,n,this.pixelMatrixInverse),e.a6.vec4.transformMat4(o,o,this.pixelMatrixInverse);let s=o[3];
8e.a6.vec4.scale(n,n,1/n[3]),e.a6.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.a6.vec4.transformMat4(r,r,this.pixelMatrixInverse),e.a6.vec4.transformMat4(a,a,this.pixelMatrixInverse),e.a6.vec4.scale(r,r,1/r[3]),e.a6.vec4.scale(a,a,1/a[3]),r[2]=e.bD(r[2],this._center.lat)*this.worldSize,a[2]=e.bD(a[2],this._center.lat)*this.worldSize,e.a6.vec4.scale(r,r,1/this.worldSize),e.a6.vec4.scale(a,a,1/this.worldSize),new e.aj([r[0],r[1],r[2]],e.a6.vec3.normalize([],e.a6.vec3.sub([],a,r)))}rayIntersectionCoordinate(i){let{p0:r,p1:a,t:n}=i,o=e.bD(r[2],this._center.lat),s=e.bD(a[2],this._center.lat);return new e.a5(e.aa(r[0],a[0],n)/this.worldSize,e.aa(r[1],a[1],n)/this.worldSize,e.aa(o,s,n))}pointCoordinate(e,i=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,i)}pointCoordinate3D(i){if(!this.elevation)return this.pointCoordinate(i);let r=this.projection.pointCoordinate3D(this,i.x,i.y);if(r)return new e.a5(r[0],r[1],r[2]);let a=0,n=this.horizonLineFromTop();if(i.y>n)return this.pointCoordinate(i);let o=.02*n,s=i.clone();for(let i=0;i<10&&n-a>o;i++){s.y=e.aa(a,n,.66);let i=this.projection.pointCoordinate3D(this,s.x,s.y);i?(n=s.y,r=i):a=s.y}return r?new e.a5(r[0],r[1],r[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.bU)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.a6.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.bV(this);i?(p=90,c=180,u=-180):r&&(d=-90,c=180,u=-180)}return new e.as(new e.bK(u,d),new e.bK(c,p))}_getBoundsRectangular(i,r){let a,n,o,s;let{top:l,left:h}=this._edgeInsets,u=this.height-this._edgeInsets.bottom,c=this.width-this._edgeInsets.right,d=new e.P(h,l),p=new e.P(c,l),f=new e.P(c,u),m=new e.P(h,u),_=this.pointCoordinate(d,i),g=this.pointCoordinate(p,i),y=this.pointCoordinate(f,r),x=this.pointCoordinate(m,r);return _.y>1&&g.y>=0?_=new e.a5((1-x.y)/(((a=_).y-x.y)/(a.x-x.x))+x.x,1):_.y<0&&g.y<=1&&(_=new e.a5(-x.y/(((n=_).y-x.y)/(n.x-x.x))+x.x,0)),g.y>1&&_.y>=0?g=new e.a5((1-y.y)/(((o=g).y-y.y)/(o.x-y.x))+y.x,1):g.y<0&&_.y<=1&&(g=new e.a5(-y.y/(((s=g).y-y.y)/(s.x-y.x))+y.x,0)),(new e.as).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(g)).extend(this.coordinateLocation(x)).extend(this.coordinateLocation(y))}_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.bT,this.maxLat=e.bT,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.am(this.minLng)*this.tileSize,this.worldMaxX=e.am(this.maxLng)*this.tileSize,this.worldMinY=e.at(this.maxLat)*this.tileSize,this.worldMaxY=e.at(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.ab*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.a6.mat4.multiply(n,this.worldToFogMatrix,n),a[r]=new Float32Array(n),a[r]}calculateProjMatrix(i,r=!1,a=!1){let n,o;let 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.a6.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.bW(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.a6.mat4.fromScaling([],[i,i,i]);return e.a6.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.bD(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(r),n=this._camera.forward(),o=e.bD(1,this._center.lat);a[2]/=o,n[2]/=o,e.a6.vec3.normalize(n,n);let s=i.raycast(a,n,i.exaggeration());if(s){let i=e.a6.vec3.scaleAndAdd([],a,n,s),r=new e.a5(i[0],i[1],e.bD(i[2],e.aM(i[1]))),l=(r.z+e.a6.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.bD(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),o=r.getAtPointOrZero(new e.a5(...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.a6.vec3.length(r);r[2]-=(l-h)/this._pixelsPerMercatorPixel;let o=e.a6.vec3.length(r);if(0===o)return;e.a6.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.ap(r.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||i)||(r.lng=e.ap(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.center=this.unproject(new e.P(s,l))),o&&(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.bD(1,this.center.lat)/e.bD(1,e.c4));let o=e.bX(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 e=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),a=e*this.aspect,n=-a,o=-e;a-=r.x,n-=r.x,e+=r.y,o+=r.y,((e,i,r,a)=>{for(let n=0;n<16;n++)e[n]=t5(i[n],r[n],a)})(i=this._camera.getCameraToClipOrthographic(n,a,o,e,this._nearZ,this._farZ),i,h,t6(this.pitch>=15?1:this.pitch/15))}else i=h;let u=e.a6.mat4.mul([],h,l),c=e.a6.mat4.mul([],i,l);if(this.projection.isReprojectedInTileSpace){let i=this.locationCoordinate(this.center),r=e.a6.mat4.identity([]);e.a6.mat4.translate(r,r,[i.x*this.worldSize,i.y*this.worldSize,0]),e.a6.mat4.multiply(r,r,e.bY(this)),e.a6.mat4.translate(r,r,[-i.x*this.worldSize,-i.y*this.worldSize,0]),e.a6.mat4.multiply(c,c,r),e.a6.mat4.multiply(u,u,r),this.inverseAdjustmentMatrix=e.bZ(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.a6.mat4.scale([],c,[this.worldSize,this.worldSize,this.worldSize/s,1]),this.projMatrix=c,this.invProjMatrix=e.a6.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.a6.mat4.mul([],i,l)}else this.expandedFarZProjMatrix=this.projMatrix;let d=e.a6.mat4.invert([],i);this.frustumCorners=e.b_.fromInvProjectionMatrix(d,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bN.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a);let p=new Float32Array(16);e.a6.mat4.identity(p),e.a6.mat4.scale(p,p,[1,-1,1]),e.a6.mat4.rotateX(p,p,this._pitch),e.a6.mat4.rotateZ(p,p,this.angle);let f=e.a6.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.a6.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.a6.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,E=new Float64Array(c);if(e.a6.mat4.translate(E,E,[T>.5?T-1:T,S>.5?S-1:S,0]),this.alignedProjMatrix=E,c=e.a6.mat4.create(),e.a6.mat4.scale(c,c,[this.width/2,-this.height/2,1]),e.a6.mat4.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=e.a6.mat4.create(),e.a6.mat4.scale(c,c,[1,-1,1]),e.a6.mat4.translate(c,c,[-1,-1,0]),e.a6.mat4.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=e.a6.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,u),this._calcFogMatrices(),this._distanceTileDataCache={},!(c=e.a6.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.b$(this);let i=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.a6.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.a6.vec3.scale(o,o,n),e.a6.vec3.scale(a,a,-1),e.a6.vec3.multiply(a,a,o);let s=e.a6.mat4.create();e.a6.mat4.translate(s,s,a),e.a6.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.a6.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.bD(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.bB(this._maxPitch)),l=Math.max((i[2]-o)/Math.cos(a),s),h=this._zoomFromMercatorZ(l);e.a6.vec3.scaleAndAdd(i,i,r,l),this._pitch=e.ap(a,e.bB(this.minPitch),e.bB(this.maxPitch)),this.angle=e.bA(n,-Math.PI,Math.PI),this._setZoom(e.ap(h,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.a5(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.bU,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.c0(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(i,r){let a=e.a6.vec3.length(e.a6.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.a6.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.bX(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=t5(1,s,t6(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.a6.mat4.multiply(i,i,this.globeMatrix),i}getFrustum(i){return e.bN.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,"meters"===this.projection.zAxisUnit)}}let t9=(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.a7(60,45,a.pitch):e.a7(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]}}},t7={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class ie{constructor(e,i){this.aabb=e,this.lastCascade=i}}class it{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 ie(i,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(i,r,a){let n=e.c9.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.a6.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 ii{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new it,this._depthMode=new tX(e.context.gl.LEQUAL,tX.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(t7,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(t7,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),e.tp.registerParameter(t7,["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=t7.shadowMapResolution,l=t7.shadowMapResolution;if(0===this._cascades.length||t7.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let i=0;i<t7.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.bN,scale:0})}}this.shadowDirection=ia(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===t7.cascadeCount?o=c:0===r?o=u:(n=u,o=c);let[s,l]=function(i,r,a,n,o,s){let l,h;let 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.a6.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.a6.mat4.mul(s,o,r);let l=new Float64Array(16);for(let r of(e.a6.mat4.invert(l,s),e.bN.fromInvProjectionMatrix(l,d,u,!0).points)){let a=(r[0]/=c,r[1]/=c,r[2]=e.bD(r[2],i._center.lat),r);w=Math.max(w,e.a6.vec3.len(e.a6.vec3.subtract([],b,a)))}}w*=o/(o-1);let S=Math.acos(r[2]),E=Math.atan2(-r[0],-r[1]),M=new t2;M.position=b,M.setPitchBearing(S,E);let I=M.getWorldToCamera(d,x),A=w*d,C=Math.min(-(i._mercatorZfromZoom(17)*d*2),-2*A),P=M.getCameraToClipOrthographic(-A,A,-A,A,C,(A+s*x)/r[2]),z=new Float64Array(16);e.a6.mat4.multiply(z,P,I);let D=e.a6.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.a6.vec3.transformMat4(L,D,z),e.a6.vec3.scale(L,L,R);let k=[Math.floor(L[0]),Math.floor(L[1]),Math.floor(L[2])],O=[0,0,0];e.a6.vec3.sub(O,L,k),e.a6.vec3.scale(O,O,-1/R);let B=new Float64Array(16);return e.a6.mat4.identity(B),e.a6.mat4.translate(B,B,O),e.a6.mat4.multiply(z,B,z),[z,A]}(i,this.shadowDirection,n,o,t7.shadowMapResolution,h);a.scale=i.scale,a.matrix=s,a.boundingSphereRadius=l,e.a6.mat4.invert(d,a.matrix
8),a.frustum=e.bN.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/t7.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=t7.shadowMapResolution,this._uniformValues.u_shadowmap_0=t3.ShadowMap0,this._uniformValues.u_shadowmap_1=t3.ShadowMap0+1,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,t7.shadowMapResolution,t7.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.bz.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=t9(e,e.longestCutoffRange);s.shouldRenderCutoff&&o.push("RENDER_CUTOFF");let l=io(i,a,n),h=new tX(r.gl.LEQUAL,tX.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,tY.disabled,tW.multiply,tJ.disabled,c,"ground_shadow",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,{},e.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?tW.unblended:tW.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(i){let r=this.painter.transform,a=r.calculatePosMatrix(i,r.worldSize);return e.a6.mat4.multiply(a,this._cascades[this.painter.currentShadowCascade].matrix,a),Float32Array.from(a)}calculateShadowPassMatrixFromMatrix(i){return e.a6.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.a6.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+t3.ShadowMap0+i),this._cascades[i].texture.bind(l.NEAREST,l.CLAMP_TO_EDGE);if(this.useNormalOffset=!!a,this.useNormalOffset){let r=e.c8(i.canonical),s=2/o.tileSize*e.ab/t7.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<t7.cascadeCount;r++)e.a6.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+t3.ShadowMap0+r),this._cascades[r].texture.bind(o.NEAREST,o.CLAMP_TO_EDGE);if(this.useNormalOffset=a,a){let e=t7.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){if(n[2]>=0)return{};let o=(function(i,r,a){let n=a/(1<<i.canonical.z);return new e.c9([i.canonical.x*n+i.wrap*a,i.canonical.y*n+i.wrap*a,0],[(i.canonical.x+1)*n+i.wrap*a,(i.canonical.y+1)*n+i.wrap*a,r])})(i,r,a).getCorners(),s=-(r/n[2]);n[0]<0?(e.a6.vec3.add(o[0],o[0],[n[0]*s,0,0]),e.a6.vec3.add(o[3],o[3],[n[0]*s,0,0])):n[0]>0&&(e.a6.vec3.add(o[1],o[1],[n[0]*s,0,0]),e.a6.vec3.add(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(e.a6.vec3.add(o[0],o[0],[0,n[1]*s,0]),e.a6.vec3.add(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(e.a6.vec3.add(o[2],o[2],[0,n[1]*s,0]),e.a6.vec3.add(o[3],o[3],[0,n[1]*s,0]));let l={};return l.vertices=o,l.planes=[ir(o[1],o[0],o[4]),ir(o[2],o[1],o[5]),ir(o[3],o[2],o[6]),ir(o[0],o[3],o[7])],l}addShadowReceiver(i,r,a){this._receivers.add(i,e.c9.fromTileIdAndHeight(i,r,a))}getMaxCascadeForTile(e){let i=this._receivers.get(e);return i&&i.lastCascade?i.lastCascade:0}}function ir(i,r,a){let n=e.a6.vec3.sub([],a,r),o=e.a6.vec3.sub([],i,r),s=e.a6.vec3.cross([],n,o),l=e.a6.vec3.length(s);return 0===l?[0,0,1,0]:(e.a6.vec3.scale(s,s,1/l),[s[0],s[1],s[2],-e.a6.vec3.dot(s,r)])}function ia(i){let r=i.properties.get("direction"),a=e.c7(r.x,r.y,r.z);
8a[2]=e.ap(a[2],0,75);let n=e.ca([a[0],a[1],a[2]]);return e.a6.vec3.fromValues(n.x,n.y,n.z)}function io(i,r,a){let n=r.properties.get("color"),o=r.properties.get("intensity"),s=r.properties.get("direction"),l=[s.x,s.y,s.z],h=a.properties.get("color"),u=a.properties.get("intensity"),c=Math.max(e.a6.vec3.dot([0,0,1],l),0),d=[0,0,0];e.a6.vec3.scale(d,h.toRenderColor(i.getLut(r.scope)).toArray01Linear().slice(0,3),u);let p=[0,0,0];return e.a6.vec3.scale(p,n.toRenderColor(i.getLut(a.scope)).toArray01Linear().slice(0,3),c*o),e.cb([d[0]>0?d[0]/(d[0]+p[0]):0,d[1]>0?d[1]/(d[1]+p[1]):0,d[2]>0?d[2]/(d[2]+p[2]):0])}class is extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.numModelsLoading={}}loadModel(i,r){return e.aG(this.requestManager.transformRequest(r,e.R.Model).url).then(r=>{if(!r)return;let a=e.aH(r),n=new e.aI(i,void 0,void 0,a);return n.computeBoundsAndApplyParent(),n}).catch(a=>{if(a&&404===a.status)return null;this.fire(new e.t(Error(`Could not load model ${i} from ${r}: ${a.message}`)))})}load(i,r){this.models[r]||(this.models[r]={});let a=Object.keys(i);this.numModelsLoading[r]=(this.numModelsLoading[r]||0)+a.length;let n=[];for(let e of a)n.push(this.loadModel(e,i[e]));Promise.allSettled(n).then(i=>{for(let e=0;e<i.length;e++){let{status:n,value:o}=i[e];"fulfilled"===n&&o&&(this.models[r][a[e]]={model:o,numReferences:1})}this.numModelsLoading[r]-=a.length,this.fire(new e.x("data",{dataType:"style"}))}).catch(i=>{this.fire(new e.t(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.hasModel(e,r)&&this.models[r][e].numReferences++,this.load({[e]:this.requestManager.normalizeModelURL(i)},r)}addModels(e,i){this.models[i]||(this.models[i]={});let r={};for(let a in e)this.models[i][a]={},r[a]=this.requestManager.normalizeModelURL(e[a]);this.load(r,i)}addModelsFromBucket(e,i){this.models[i]||(this.models[i]={});let r={};for(let a of e)this.hasModel(a,i)?this.models[i][a].numReferences++:r[a]=this.requestManager.normalizeModelURL(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],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 il=new e.a0({data:new e.a1(e._.colorTheme.data)}),ih=(e,i)=>eA(e,i&&i.filter(e=>"source.canvas"!==e.identifier)),iu=e.ar(ti,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),ic=e.ar(ti,["setCenter","setZoom","setBearing","setPitch"]),id={version:8,layers:[],sources:{}},ip={duration:300,delay:0};class im 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({},ip),this._buildingIndex=new te(this),this.crossTileSymbolIndex=new tH,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 $,this.dispatcher=r.dispatcher?r.dispatcher:new e.cd(e.ce(),this),r.imageManager?this.imageManager=r.imageManager:(this.imageManager=new H,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=r.glyphManager?r.glyphManager:new e.cf(i._requestManager,r.localFontFamily?e.cg.all:r.localIdeographFontFamily?e.cg.ideographs:e.cg.none,r.localFontFamily||r.localIdeographFontFamily),r.modelManager?this.modelManager=r.modelManager:(this.modelManager=new is(i._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null},this._styleColorThemeForScope={},this.options=r.configOptions?r.configOptions:new Map,this._configDependentLayers=r.configDependentLayers?r.configDependentLayers:new Set,this._config=r.config,this._initialConfig=r.initialConfig,this.dispatcher.broadcast("setReferrer",e.ch());let a=this;this._rtlTextPluginCallback=im.registerForPluginStateChange(i=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:i.pluginStatus,pluginURL:i.pluginURL},(i,r)=>{if(e.ci(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.cj(i);if(!r.startsWith("http"))try{return new URL(r,location.href).toString()}catch(e){}return r}return`json://${e.ck(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.t(i)):a&&n(a,r)})}else"object"==typeof i&&n(i,r)}loadURL(i,r={}){this.fire(new e.x("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.t(r));else if(n)return this.importsCache.set(i,n),this._load(n,a)})}loadJSON(i,r={}){this.fire(new e.x("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.x("dataloading",{dataType:"style"})),this._load(id,!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;let a=this.scope?e.av(i.id,this.scope):i.id,n=this._initialConfig&&this._initialConfig[a];(i.config||n)&&(r=e.l({},i.config,n));let o=new im(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,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.schema;if(this._isInternalStyle(i)){let a=e.l({},id,{imports:[{id:"basemap",data:i,url:""}]});return void this._load(a,r)}if(this.updateConfig(this._config,a),r&&ih(this,e_(i)))return;this._loaded=!0,this.stylesheet=e.cl(i);let n=()=>{for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1,isInitialLoad:!0});i.sprite?this._loadSprite(i.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(i.glyphs,this.scope);
8let a=tt(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={},this._serializedLayers={},a)){let r=e.cq(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,this._serializedLayers[r.id]=r.serialize();let a=this.getOwnLayerSourceCache(r),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&r.canCastShadows()&&n&&(a.castsShadows=!0)}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.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.x("data",{dataType:"style"}));let o=this.isRootStyle();i.imports?this._loadImports(i.imports,r).then(()=>{this._reloadImports(),this.fire(new e.x(o?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new e.x(o?"style.load":"style.import.load")))},o=this.stylesheet["color-theme"];if(this._styleColorTheme.colorTheme=o,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;let u={};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),null!=e.stylesheet.camera&&(h=e.stylesheet.camera),null!=e.stylesheet.projection&&(s=e.stylesheet.projection),null!=e.stylesheet.transition&&(l=e.stylesheet.transition),u[e.scope]=e._styleColorTheme}}),this.light=i,this.ambientLight=r,this.directionalLight=a,this.fog=o,this._styleColorThemeForScope=u,null===n?delete this.terrain:this.terrain=n,this.camera=h||{"camera-projection":"perspective"},this.projection=s||{name:"mercator"},this.transition=e.l({},ip,l),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.av(r,n.scope)]=n._sourceCaches[r];for(let i in n._otherSourceCaches)r[e.av(i,n.scope)]=n._otherSourceCaches[i];for(let i in n._symbolSourceCaches)a[e.av(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.cm(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.cm(o.id);i[r]&&n(i[r]),this._mergedSlots.push(r)}else{let i=e.av(o.id,o.scope);this._mergedOrder.push(i),a[i]=o,o.is3D()&&(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()?1:0:r.is3D()&&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._.colorTheme))void 0===n[i]&&(n[i]=e._.colorTheme[i].default);let o=new e.$(il,i,new Map(a));return o.setTransitionOrValue(n,a),o.untransitioned().possiblyEvaluate(new e.a3(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="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,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;let 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}}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.t(i));else if(r)for(let e in r)this.imageManager.addImage(e,this.scope,r[e]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.x("data",{dataType:"style"}))})}_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.t(Error(`Source layer "${a}" does not exist on source "${r.id}" as specified by style layer "${i.id}"`)))}loaded(){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.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()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())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}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.t(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.t(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._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(()=>
8{this.precompilePrograms(r,i)}):this.precompilePrograms(r,i))}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.x("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.z=i.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),a&&this.fire(new e.x("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=this._changes.getUpdatedImages();if(e.length){for(let i in this._sourceCaches)this._sourceCaches[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(),ih(this,e_(i)))return!1;(i=e.cl(i)).layers=tt(i.layers);let a=(function(i,r){if(!i)return[{command:ti.setStyle,args:[r]}];let a=[];try{if(!e.bh(i.version,r.version)||(e.bh(i.center,r.center)||a.push({command:ti.setCenter,args:[r.center]}),e.bh(i.zoom,r.zoom)||a.push({command:ti.setZoom,args:[r.zoom]}),e.bh(i.bearing,r.bearing)||a.push({command:ti.setBearing,args:[r.bearing]}),e.bh(i.pitch,r.pitch)||a.push({command:ti.setPitch,args:[r.pitch]}),e.bh(i.sprite,r.sprite)||a.push({command:ti.setSprite,args:[r.sprite]}),e.bh(i.glyphs,r.glyphs)||a.push({command:ti.setGlyphs,args:[r.glyphs]}),e.bh(i.imports,r.imports)||function(i=[],r=[],a){let n,o,s,l;r=r||[];let h=(i=i||[]).map(to),u=r.map(to),c=i.reduce(ts,{}),d=r.reduce(ts,{}),p=h.slice();for(n=0,o=0;n<h.length;n++)s=h[n],d.hasOwnProperty(s)?o++:(a.push({command:ti.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:ti.removeImport,args:[s]}),p.splice(p.lastIndexOf(s,p.length-o),1)):o++,l=p[p.length-n],a.push({command:ti.addImport,args:[d[s],l]}),p.splice(p.length-n,0,s));for(let i of r){let r=c[i.id];r&&!e.bh(r,i)&&a.push({command:ti.updateImport,args:[i.id,i]})}}(i.imports,r.imports,a),e.bh(i.transition,r.transition)||a.push({command:ti.setTransition,args:[r.transition]}),e.bh(i.light,r.light)||a.push({command:ti.setLight,args:[r.light]}),e.bh(i.fog,r.fog)||a.push({command:ti.setFog,args:[r.fog]}),e.bh(i.projection,r.projection)||a.push({command:ti.setProjection,args:[r.projection]}),e.bh(i.lights,r.lights)||a.push({command:ti.setLights,args:[r.lights]}),e.bh(i.camera,r.camera)||a.push({command:ti.setCamera,args:[r.camera]}),!e.bh(i["color-theme"],r["color-theme"])))return[{command:ti.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)||ta(o,a,n));for(o in r){var s,l;if(!r.hasOwnProperty(o))continue;let h=r[o];i.hasOwnProperty(o)?e.bh(i[o],h)||("geojson"===i[o].type&&"geojson"===h.type&&function(i,r,a){let n;for(n in i[a])if(i[a].hasOwnProperty(n)&&"data"!==n&&!e.bh(i[a][n],r[a][n]))return!1;for(n in r[a])if(r[a].hasOwnProperty(n)&&"data"!==n&&!e.bh(i[a][n],r[a][n]))return!1;return!0}(i,r,o)?a.push({command:ti.setGeoJSONSourceData,args:[o,h.data]}):(s=o,l=r,ta(s,a,n),tr(s,l,a))):tr(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:ti.removeLayer,args:[e.id]}):s.push(e)});let l=i.terrain;l&&n[l.source]&&(a.push({command:ti.setTerrain,args:[void 0]}),l=void 0),a=a.concat(o),e.bh(l,r.terrain)||a.push({command:ti.setTerrain,args:[r.terrain]}),function(i,r,a){let n,o,s,l,h,u,c;r=r||[];let d=(i=i||[]).map(to),p=r.map(to),f=i.reduce(ts,{}),m=r.reduce(ts,{}),_=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:ti.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:ti.removeLayer,args:[s]}),_.splice(_.lastIndexOf(s,_.length-o),1)):o++,u=_[_.length-n],a.push({command:ti.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.bh(l,h)){if(e.bh(l.source,h.source)&&e.bh(l["source-layer"],h["source-layer"])&&e.bh(l.type,h.type)){for(c in tn(l.layout,h.layout,a,s,null,ti.setLayoutProperty),tn(l.paint,h.paint,a,s,null,ti.setPaintProperty),e.bh(l.slot,h.slot)||a.push({command:ti.setSlot,args:[s,h.slot]}
8),e.bh(l.filter,h.filter)||a.push({command:ti.setFilter,args:[s,h.filter]}),e.bh(l.minzoom,h.minzoom)&&e.bh(l.maxzoom,h.maxzoom)||a.push({command:ti.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.")?tn(l[c],h[c],a,s,c.slice(6),ti.setPaintProperty):e.bh(l[c],h[c])||a.push({command:ti.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.")?tn(l[c],h[c],a,s,c.slice(6),ti.setPaintProperty):e.bh(l[c],h[c])||a.push({command:ti.setLayerProperty,args:[s,c,h[c]]}))}else a.push({command:ti.removeLayer,args:[s]}),u=_[_.lastIndexOf(s)+1],a.push({command:ti.addLayer,args:[h,u]})}}(s,r.layers,a)}catch(e){console.warn("Unable to compute style diff:",e),a=[{command:ti.setStyle,args:[r]}]}return a})(this.serialize(),i).filter(e=>!(e.command in ic));if(0===a.length)return!1;let n=a.filter(e=>!(e.command in iu));if(n.length>0)throw Error(`Unimplemented: ${n.map(e=>e.command).join(", ")}.`);let o=[];return 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}addImage(i,r){return this.getImage(i)?this.fire(new e.t(Error("An image with this name already exists."))):(this.imageManager.addImage(i,this.scope,r),this._afterImageUpdated(i),this)}updateImage(e,i){this.imageManager.updateImage(e,this.scope,i)}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(i){return this.getImage(i)?(this.imageManager.removeImage(i,this.scope),this._afterImageUpdated(i),this):this.fire(new e.t(Error("No image with this name exists.")))}_afterImageUpdated(i){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(i),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new e.x("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,i,r={}){return this._checkLoaded(),this._validate(eM,`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.t(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(eg,`sources.${i}`,r,null,a))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let n=eW(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.av(r,this.scope),o=this._sourceCaches[r]=new e6(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.t(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.t(Error(`Source "${i}" cannot be removed while terrain is using it.`)));for(let r of this.getOwnSourceCaches(i)){let i=e.cm(r.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(r.id),r.fire(new e.x("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 o of i){if(this._validate(ex,"lights",o))return;switch(o.type){case"ambient":if(this.ambientLight){let e=this.ambientLight;e.set(o),e.updateTransitions(r)}else this.ambientLight=new eF(o,a||(a=new e.a0({color:new e.a1(e._.properties_light_ambient.color),intensity:new e.a1(e._.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){let e=this.directionalLight;e.set(o),e.updateTransitions(r)}else this.directionalLight=new eF(o,n||(n=new e.a0({direction:new e.ad(e._.properties_light_directional.direction),color:new e.a1(e._.properties_light_directional.color),intensity:new e.a1(e._.properties_light_directional.intensity),"cast-shadows":new e.a1(e._.properties_light_directional["cast-shadows"]),"shadow-intensity":new e.a1(e._.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}let o=new e.a3(this.z||0,r);this.ambientLight&&this.ambientLight.recalculate(o),this.directionalLight&&this.directionalLight.recalculate(o),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.c7(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(h+a(u)*c)/2}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.cn(i)){let r=e.co(i),a=this.fragments.find(({id:e})=>e===r);if(!a)throw Error(`Style import not found: ${i}`);let n=e.cm(i);return a.style.getFragmentStyle(n)}{let e=this.fragments.find(({id:e})=>e===i);if(!e)throw Error(`Style import not found: ${i}`);return e.style}}getConfigProperty(i,r){let a=this.getFragmentStyle(i);if(!a)return null;let n=e.av(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;let o=this.getFragmentStyle(i);if(!o)return;let s=o.stylesheet.schema;if(!s||!s[r])return;let l=e.M(a);if("success"!==l.result)return void ih(this,l.value);let h=l.value.expression,u=e.av(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.M(s[r].default);"success"===g.result&&(n=g.value.expression),n?(this.options.set(u,{...c,value:h,default:n,minValue:d,maxValue:p,stepValue:f,type:m,values:_}),this.updateConfigDependencies(r)):this.fire(new e.t(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.av(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;let s=e.M(r[a].default);if("success"===s.result&&(n=s.value.expression),i&&void 0!==i[a]){let r=e.M(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.av(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.t(Error(`No schema defined for config option "${a}".`)))}else this.fire(new e.t(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.forEachFragmentStyle(e=>{if(e._styleColorTheme.colorTheme){let i=e._evaluateColorThemeData(e._styleColorTheme.colorTheme);(!e._styleColorTheme.lut&&""!==i||e._styleColorTheme.lut&&i!==e._styleColorTheme.lut.data)&&e.setColorTheme(e._styleColorTheme.colorTheme)}}),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.t(Error(`Layer with id "${o}" already exists on this map`)));if("custom"===i.type){if(ih(this,e.cp(i)))return;n=e.cq(i,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof i.source&&(this.addSource(o,i.source),i=e.cl(i),i=e.l(i,{source:o})),this._validate(ew,`layers.${o}`,i,{arrayIndex:-1},a))return;n=e.cq(i,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(n),n.setEventedParent(this,{layer:{id:o}}),this._serializedLayers[n.id]=n.serialize()}0!==n.configDependencies.size&&this._configDependentLayers.add(n.fqid);let s=this._order.length;if(r){let i=this._order.indexOf(r);
8if(-1===i)return void this.fire(new e.t(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.av(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);if(-1===i)return void this.fire(new e.t(Error(`Layer with i
8d "${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],delete this._serializedLayers[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.bh(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.cl(r),this._updateLayer(n)))}getFilter(i){let r=this._checkLayer(i);if(r)return e.cl(r.filter)}setLayoutProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);if(o&&!e.bh(o.getLayoutProperty(r),a)){if(null!=a&&(!n||!1!==n.validate)&&ih(o,eE.call(e_,{key:`layers.${i}.layout.${r}`,layerType:o.type,objectKey:r,value:a,styleSpec:e._,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.bh(o.getPaintProperty(r),a)||null!=a&&(!n||!1!==n.validate)&&ih(o,eS.call(e_,{key:`layers.${i}.paint.${r}`,layerType:o.type,objectKey:r,value:a,styleSpec:e._})))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){this._checkLoaded();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.t(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new e.t(Error("The sourceLayer parameter must be provided for vector source types.")));for(let o of(void 0===i.id&&this.fire(new e.t(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)))o.setFeatureState(n,i.id,r)}removeFeatureState(i,r){this._checkLoaded();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.t(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.t(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){this._checkLoaded();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.t(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(r)[0].getFeatureState(a,i.id);this.fire(new e.t(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.cr({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,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,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)}_updateLayer(i){this._changes.updateLayer(i);let r=this.getLayerSourceCache(i),a=e.av(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(),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){r&&r.filter&&this._validate(eT,"queryRenderedFeatures.filter",r.filter,null,r),r.scope=this.scope,r.availableImages=this._availableImages,r.serializedLayers=this._serializedLayers;let n={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new e.t(Error("parameters.layers must be an Array."))),[];for(let i of r.layers){let r=this._mergedLayers[i];if(!r)return this.fire(new e.t(Error(`The layer '${i}' does not exist in the map's style and cannot be queried for features.`))),[];n[r.source]=!0}}let o=[],s=r.serializedLayers||{},l=r&&r.layers?r.layers.some(e=>{let i=this.getLayer(e);return i&&i.is3D()}):this.has3DLayers(),h=eN.createFromScreenPoints(i,a);for(let i in this._mergedSourceCaches){let u=this._mergedSourceCaches[i].getSource();if(!u||u.scope!==r.scope)continue;let c=this._mergedSourceCaches[i].getSource().id;r.layers&&!n[c]||o.push(function(i,r,a,n,o,s,l,h=!1){let u=i.tilesIn(n,l,h);u.sort(eX);let c=[];for(let n of u)c.push({wrappedTileID:n.tile.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(r,a,i._state,n,o,s,function(i,r){let a=e.a6.mat4.identity([]);return e.a6.mat4.scale(a,a,[.5*i.width,-(.5*i.height),1]),e.a6.mat4.translate(a,a,[1,-1,0]),e.a6.mat4.multiply(a,a,i.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(a)}(i.transform,n.tile.tileID),h)});let d=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}(c);for(let e in d)d[e].forEach(e=>{let r=e.feature,a=r.layer;a&&"background"!==a.type&&"sky"!==a.type&&"slot"!==a.type&&(r.source=a.source,a["source-layer"]&&(r.sourceLayer=a["source-layer"]),r.state=void 0!==r.id?i.getFeatureState(a["source-layer"],r.id):{})});return d}(this._mergedSourceCaches[i],this._mergedLayers,s,h,r,a,l,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(e,i,r,a,n,o,s){let l={},h=o.queryRenderedSymbols(a),u=[];for(let e of Object.keys(h).map(Number))u.push(s[e]);for(let r of(u.sort(eX),u)){let a=r.featureIndex.lookupSymbolFeatures(h[r.bucketInstanceId],i,r.bucketIndex,r.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(let e in a){let i=l[e]=l[e]||[],n=a[e];for(let e of(n.sort((e,i)=>{let a=r.featureSortOrder;if(a){let r=a.indexOf(e.featureIndex);return a.indexOf(i.featureIndex)-r}return i.featureIndex-e.featureIndex}),n))i.push(e)}}for(let i in l)l[i].forEach(a=>{let n=a.feature,o=r(e[i]);if(!o)return;let s=o.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=s});return l}(this._mergedLayers,s,this.getLayerSourceCache.bind(this),h.screenGeometry,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(eT,"querySourceFeatures.filter",i.filter,null,i);let r=this.getOwnSourceCaches(e),a=[];for(let e of r)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}(e,i));return a}addSourceType(e,i,r){return im.getSourceType(e)?r(Error(`A source type called "${e}" already exists.`)):(im.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.bh(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._markersNeedU
8pdate=!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.cl(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(ev,"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._.terrain))!a.hasOwnProperty(i)&&e._.terrain[i].default&&(a[i]=e._.terrain[i].default);for(let a in i)if(!e.bh(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.x("data",{dataType:"style"}));break}}else{if(!a)return;this._createTerrain(a,r),this.fire(new e.x("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){let i=this.fog=new eB(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=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.bh(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}setColorTheme(i){this._checkLoaded();let r=()=>{for(let e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(let e in this._sourceCaches)this._sourceCaches[e].clearTiles()};if(this._styleColorTheme.colorTheme=i,!i)return this._styleColorTheme.lut=null,void r();let a=this._evaluateColorThemeData(i);this._loadColorTheme(a).then(()=>{this.fire(new e.x("colorthemeset")),r()}).catch(i=>{e.w(`Couldn't set color theme: ${i}`)})}_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 ez(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 ih(this,i.call(e_,e.l({key:r,style:s,value:a,styleSpec:e._},n)))}_remove(){for(let i in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.cs.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.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()}updateSources(e){let i;for(let r in this.directionalLight&&(i=ia(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.av(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.x("neworder")),(l||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.q.now(),r.zoom))&&(this.pauseablePlacement=new tj(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.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.av(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.t(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.t(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.bh(r.config,a[n].config)||this.setImportConfig(i,r.config),e.bh(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){this._checkLoaded();let r=this.getImportIndex(e),a=this.stylesheet.imports||[];if(-1===r)return this;i?a[r].config=i:delete a[r].config;let n=this.fragments[r],o=n.style.stylesheet&&n.style.stylesheet.schema;return n.config=i,n.style.updateConfig(i,o),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.t(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.av(i,r);return this._mergedOtherSourceCaches[a]}getLayerSourceCache(i){let r=e.av(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)}}getImages(e,i,r){this.imageManager.getImages(i.icons,i.scope,r),this._updateTilesForChangedImages();let a=e=>{e&&e.setDependencies(i.tileID.key,i.type,i.icons)};a(this._otherSourceCaches[i.source]),a(this._symbolSourceCaches[i.source])}getGlyphs(e,i,r){this.glyphManager.getGlyphs(i.stacks,i.scope,r)}getResource(i,r,a){return e.ct(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.t(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()){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)}}im.getSourceType=function(e){return eH[e]},im.setSourceType=function(e,i){eH[e]=i},im.registerForPluginStateChange=e.cc;var i_="\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",ig="\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 vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color) {\n#ifdef INDICATOR_CUTOUT\nfloat holeMinOpacity=u_indicator_cutout_params.x;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,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",iy="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;
8float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}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);}",ix="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;}",iv="\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",ib="#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",iw="highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#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) {\n#ifdef FOG_DITHERING\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\n#else\nreturn color;\n#endif\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",iT="#ifdef RASTER_ARRAY\nuniform 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",iS="#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;}",iE="#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",iM="#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 NATIVE\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 mix(lerpx.x,lerpx.y,f.y);}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.xyz/light_view_pos0.w*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 mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));\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));}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 iI=[];iD(i_,iI),iD(iy,iI),iD(ig,iI);let iA={"_prelude_fog.vertex.glsl":ib,"_prelude_terrain.vertex.glsl":iv,"_prelude_shadow.vertex.glsl":iE,"_prelude_fog.fragment.glsl":iw,"_prelude_shadow.fragment.glsl":iM,"_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":iT,"_prelude_raster_particle.glsl":iS},iC={};iR("",iv),iR(iw,ib),iR(iM,iE),iR(iT,""),iR(iS,"");let iP=iR(ig,iy);var iz={background:iR('#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:iR('#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:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float opacity_t=smoothstep((1.0-blur_positive)*antialiased_blur,blur_positive*antialiased_blur,extrude_length-1.0)-smoothstep(0.0,antialiasblur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius
8/(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\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);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\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,radiu
8s,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:iR("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:iR('#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:iR("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in 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:iR("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:iR("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:iR("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
8);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),fill:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;void 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#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"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_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 FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutline:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\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#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"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\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 FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in 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#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"\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\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 FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength;\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#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);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.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\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 FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:iR('#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_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\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"\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\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_radius;out float v_has_floodlight;\n#endif\nout float v_height;\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 flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : 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);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),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:iR("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;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#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 flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : 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:iR('#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);\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\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 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 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 flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : 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);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:iR('#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(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)).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:iR("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:iR("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:iR('#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:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform lowp float u_device_pixel_ratio;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 vec4 v_uv;\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\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=(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;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/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 start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));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=out_color.a;}\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+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.rgb=mix(border_color.rgb*border_color.a*trim_alpha,out_color.rgb,smoothAlpha);}}\n#endif\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\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\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#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin float a_z_offset;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec4 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;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;\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#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 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=width/2.0;offset=-1.0*offset;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);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);\n#ifdef ELEVATED_ROADS\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,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)*0.1*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#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=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\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=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\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,(-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}'),linePattern:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform highp float u_device_pixel_ratio;
8uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform 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 vec4 v_uv;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\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;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=(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 start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}\n#endif\n#ifdef LINE_JOIN_NONE\nfloat pattern_len=pattern_size/aspect;float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;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_ground(color);\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);\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#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin float a_z_offset;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;out 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 vec4 v_uv;\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 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=width/2.0;offset=-1.0*offset;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);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);\n#ifdef ELEVATED_ROADS\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,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)*0.1*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#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=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nfloat a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef LINE_JOIN_NONE\nv_width=floorwidth+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}'),raster:iR('#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 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:iR('#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:iR("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:iR("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:iR('#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:iR('#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;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\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*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/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\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\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\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\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;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;\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}'),terrainRaster:iR('#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:iR("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:iR('#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.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_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}',ix),skyboxGradient:iR('#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;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',ix),skyboxCapture:iR
vendor: 3,689 bytes, line 8
8("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;
8v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:iR('#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\nvec2 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);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);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(raster.rgb*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:iR('#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;\n#ifndef NATIVE\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\n#endif\nglFragColor=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:iR('#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);\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:iR("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:iR("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);}"),occlusion:iR("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 iD(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 iR(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=[...iI];for(let r of(iD(e,h),iD(i,h),[...s,...l]))iA[r]||console.error(`Undefined include: ${r}`),iC[r]||(iC[r]=[],iD(iA[r],iC[r])),h=[...h,...iC[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 iL{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 ik(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 iO{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 iB extends iO{getDefault(){return e.bz.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 iF extends iO{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class iN extends iO{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}
93class iV extends iO{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 iU extends iO{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class ij extends iO{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class iG extends iO{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 iO{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 iZ extends iO{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 i$ extends iO{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 iH extends iO{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 iW extends iO{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class iX extends iO{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 iY extends iO{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 iJ extends iO{getDefault(){return e.bz.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 iK extends iO{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 iQ extends iO{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 i0 extends iO{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class i1 extends iO{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let i2=class extends iO{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class i3 extends iO{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class i4 extends iO{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 i5 extends iO{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 i6 extends iO{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 i8 extends iO{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 i9 extends iO{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 i7 extends iO{getDefault(){return null}set(e){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class re extends iO{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class rt extends iO{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 ri extends iO{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 rr extends iO{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 ra extends iO{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class rn extends ra{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 ro extends ra{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 rs extends ra{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 rl extends ro{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}let rh=(e,i,r)=>({u_matrix:e,u_image0:0,u_skirt_height:i,u_ground_shadow_factor:r}),ru=(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 rc(e,i){return null!=e&&null!=i&&!(!e.hasData()||!i.hasData())&&null!=e.demTexture&&null!=i.demTexture&&e.tileID.key!==i.tileID.key}let rd=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()}},rp={0:null,1:"TERRAIN_VERTEX_MORPHING"};function rf(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 rm=e=>({u_matrix:e});function r_(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.ap(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 rg extends e6{constructor(i){let r=eW("mock-dem",{type:"raster-dem",maxzoom:i.transform.maxZoom},new e.cd(e.ce(),null),i.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,i){e.state="loaded",i(null)}}class ry extends e6{constructor(i){let r=eW("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new e.cd(e.ce(),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 e2(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 rx extends e.aA{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 rv extends e.cE{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={};let[a,n,o]=function(i){let r=new e.a_,a=new e.aO;r.reserve(17161),a.reserve(33800);let n=e.ab/128,o=e.ab+n/2,s=o+n;for(let i=-n;i<s;i+=n)for(let a=-n;a<s;a+=n){let n=a<0||a>o||i<0||i>o?24575:0,s=e.ap(Math.round(a),0,e.ab),l=e.ap(Math.round(i),0,e.ab);r.emplaceBack(s+n,l)}let l=(e,i)=>{let r=131*i+e;a.emplaceBack(r+1,r,r+131),a.emplaceBack(r+131,r+131+1,r+1)};for(let e=1;e<129;e++)for(let i=1;i<129;i++)l(i,e);return[0,129].forEach(e=>{for(let i=0;i<130;i++)l(i,e),l(e,i)}),[r,a,32768]}(),s=i.context;this.gridBuffer=s.createVertexBuffer(a,e.b0.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.b1.simpleSegment(0,0,a.length,n.length),this.gridNoSkirtSegments=e.b1.simpleSegment(0,0,a.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new ry(r.map),this.orthoMatrix=e.a6.mat4.create(),e.a6.mat4.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.ab,0,e.ab,0,1);let l=s.gl;this._overlapStencilMode=new tY({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 rg(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._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){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.aa(this._exaggeration,c,p)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}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){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let r=this.proxySourceCache,a=this.painter.transform;this._initializing&&(this._initializing=0===a._centerAltitude&&-1===this.getAtPointOrZero(e.a5.fromLngLat(a.center),-1),this._emptyDEMTextureDirty=!this._initializing);let n=this.proxyCoords=r.getIds().map(e=>{let i=r.getTileByID(e).tileID;return i.projMatrix=a.calculateProjMatrix(i.toUnwrapped()),i});!function(i,r){let a=r.transform.pointCoordinate(r.transform.getCameraPoint()),n=new e.P(a.x,a.y);i.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)})}(n,this.painter);let o=this.proxyToSource||{};this.proxyToSource={},n.forEach(e=>{this.proxyToSource[e.key]={}}),this.terrainTileForTile={};let s=this._style._mergedSourceCaches;for(let e in s){let r=s[e];if(!r.used||(r!==this.sourceCache&&this.resetTileLookupCache(r.id),this._setupProxiedCoordsForOrtho(r,i[e],o),r.usedForTerrain))continue;let a=i[e];r.getSource().reparseOverscaled&&this._assignTerrainTiles(a)}this.proxiedCoords[r.id]=n.map(e=>new rx(e,e.key,this.orthoMatrix)),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1;let l={};for(let e of(this._visibleDemTiles=[],this.proxyCoords)){let i=this.terrainTileForTile[e.key];if(!i)continue;let r=i.tileID.key;r in l||(this._visibleDemTiles.push(i),l[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),ik(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.cF({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:-.0001,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){let i=(1<<h.tileID.canonical.z)*e.bD(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;l.u_meter_to_dem=i}if(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.ab,0),u_tile_br_up:n.upVector(r,e.ab,e.ab),u_tile_bl_up:n.upVector(r,0,e.ab),u_tile_up_scale:a?e.cG(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;let h=i.context,u=h.gl,c=i.transform,d=e.cx(i,h,c),p=(e,r)=>{if(l===r)return;let a=[rp[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 tX(u.LEQUAL,tX.ReadWrite,i.depthRangeFor3D);rd.update(o);let _=e.cy(c),g=[e.am(c.center.lng),e.at(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=rf(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=tY.disabled,S=r.prevTerrainTileForTile[l.key],E=r.terrainTileForTile[l.key];rc(S,E)&&rd.newMorphing(l.key,S,E,o,250),h.activeTexture.set(u.TEXTURE0),n.texture&&n.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let M=rd.getMorphValuesForProxy(l.key),I=M?1:0;M&&e.C(b,{morphing:{srcDemTile:M.from,dstDemTile:M.to,phase:e.cw(M.phase)}});let A=e.cz(l.canonical),C=e.cA(A.getCenter().lat),P=e.cB(l.canonical,A,C,c.worldSize/c._pixelsPerMercatorPixel),z=e.b5(e.cC(l.canonical)),D=ru(c.expandedFarZProjMatrix,v,_,z,e.a9(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,I),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,tJ.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.cD(d,n,c),E=e.b5(e.cC(l.canonical)),M=(e,r)=>e.draw(i,u.TRIANGLES,m,tY.disabled,f,tJ.disabled,ru(c.expandedFarZProjMatrix,y,y,E,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&&M(s,v),_&&i.renderDefaultSouthPole&&(y=e.a6.mat4.scale(e.a6.mat4.create(),y,[1,-1,1]),M(s,w))}}}}(i,r,a,n,o);else{let s,l;let h=i.context,u=h.gl,c=i.shadowRenderer,d=t9(i,i.longestCutoffRange),p=e=>{if(l===e)return;let r=[];r.push(rp[e]),d.shouldRenderCutoff&&r.push("RENDER_CUTOFF"),s=i.getOrCreateProgram("terrainRaster",{defines:r}),l=e},f=i.colorModeForRenderPass(),m=new tX(u.LEQUAL,tX.ReadWrite,i.depthRangeFor3D);rd.update(o);let _=i.transform,g=rf(_.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=io(i.style,e,r))}{l=-1;let x=u.TRIANGLES,[v,b]=[r.gridIndexBuffer,r.gridSegments];for(let l of n){let n;let w=a.getTile(l),T=tY.disabled,S=r.prevTerrainTileForTile[l.key],E=r.terrainTileForTile[l.key];rc(S,E)&&rd.newMorphing(l.key,S,E,o,250),h.activeTexture.set(u.TEXTURE0),w.texture&&w.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);let M=rd.getMorphValuesForProxy(l.key),I=M?1:0;M&&(n={morphing:{srcDemTile:M.from,dstDemTile:M.to,phase:e.cw(M.phase)}});let A=rh(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(I),!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,tJ.backCCW,A,"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;let 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.bz.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 rl(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 eq){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.a4)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 eZ){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=r_(a.getTile(e),a.findLoadedParent(e,0),a,this.painter.transform,n);(1!==i.opacity||0!==i.mix)&&this._clearRenderCacheForTile(a.id,e)}}}}_setupDrapedRenderBatches(){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):tY.disabled}_renderTileClippingMasks(e,i){let r=this.painter,a=this.painter.context,n=a.gl;r._tileClippingMaskIDs={},a.setColorMode(tW.disabled),a.setDepthMode(tX.disabled);let o=r.getOrCreateProgram("clippingMask");for(let a of e){let e=r._tileClippingMaskIDs[a.key]=--i;o.draw(r,n.TRIANGLES,tX.disabled,new tY({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),tW.disabled,tJ.disabled,rm(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.a6.vec4.transformMat4(a,a,r.pixelMatrixInverse),e.a6.vec4.scale(a,a,1/a[3]),a[0]/=r.worldSize,a[1]/=r.worldSize;let n=r._camera.position,o=e.bD(1,r.center.lat),s=[n[0],n[1],n[2]/o,0],l=e.a6.vec3.subtract([],a.slice(0,3),s);e.a6.vec3.normalize(l,l);let h=this.raycast(s,l,this._exaggeration);return null!==h&&h?(e.a6.vec3.scaleAndAdd(s,s,l,h),s[3]=s[2],s[2]*=o,s):null}_setupProxiedCoordsForOrtho(i,r,a){if(i.getSource() instanceof e.aD)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.a5.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.ab/(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;let l=i.canonical.z-r.tileID.canonical.z;n=e.a6.mat4.create();let h=r.tileID.wrap-i.wrap<<i.overscaledZ;l>0?(o=(a=e.ab>>l)*((r.tileID.canonical.x<<l)-i.canonical.x+h),s=a*((r.tileID.canonical.y<<l)-i.canonical.y)):(a=e.ab<<-l,o=e.ab*(r.tileID.canonical.x-(i.canonical.x+h<<-l)),s=e.ab*(r.tileID.canonical.y-(i.canonical.y<<-l))),e.a6.mat4.ortho(n,0,a,0,a,0,1),e.a6.mat4.translate(n,n,[o,s,0])}return new rx(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.aA(l,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a)):0!==a&&(l=n,s=new e.aA(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 rb=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],rw=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbol"];class rT{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){let l=i.gl;this.program=l.createProgram(),this.configuration=n,this.name=r,this.fixedDefines=[...s];let h=n?n.getBinderAttributes():[],u=(a.staticAttributes||[]).concat(h),c=n?n.defines():[];c=c.concat(s.map(e=>`#define ${e}`));let d="#version 300 es\n",p=d+c.concat("precision mediump float;",i_,iP.fragmentSource).join("\n");for(let e of a.fragmentIncludes)p+=` 95${iA[e]}`;p+=` 96${a.fragmentSource}`;let f=d+c.concat("precision highp float;",i_,iP.vertexSource).join("\n");for(let e of a.vertexIncludes)f+=` 97${iA[e]}`;f+=` 98${a.vertexSource}`;let 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);let _=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]){let 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):[],(s.includes("TERRAIN")||-1!==r.indexOf("symbol")||-1!==r.indexOf("circle"))&&(this.terrainUniforms={u_dem:new e.bJ(i),u_dem_prev:new e.bJ(i),u_dem_tl:new e.bG(i),u_dem_scale:new e.bI(i),u_dem_tl_prev:new e.bG(i),u_dem_scale_prev:new e.bI(i),u_dem_size:new e.bI(i),u_dem_lerp:new e.bI(i),u_exaggeration:new e.bI(i),u_depth:new e.bJ(i),u_depth_size_inv:new e.bG(i),u_depth_range_unpack:new e.bG(i),u_occluder_half_size:new e.bI(i),u_occlusion_depth_offset:new e.bI(i),u_meter_to_dem:new e.bI(i),u_label_plane_matrix_inv:new e.bF(i)}),s.includes("GLOBE")&&(this.globeUniforms={u_tile_tl_up:new e.bH(i),u_tile_tr_up:new e.bH(i),u_tile_br_up:new e.bH(i),u_tile_bl_up:new e.bH(i),u_tile_up_scale:new e.bI(i)}),s.includes("FOG")&&(this.fogUniforms={u_fog_matrix:new e.bF(i),u_fog_range:new e.bG(i),u_fog_color:new e.c6(i),u_fog_horizon_blend:new e.bI(i),u_fog_vertical_limit:new e.bG(i),u_fog_temporal_offset:new e.bI(i),u_frustum_tl:new e.bH(i),u_frustum_tr:new e.bH(i),u_frustum_br:new e.bH(i),u_frustum_bl:new e.bH(i),u_globe_pos:new e.bH(i),u_globe_radius:new e.bI(i),u_globe_transition:new e.bI(i),u_is_globe:new e.bJ(i),u_viewport:new e.bG(i)}),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms={u_cutoff_params:new e.c6(i)}),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms={u_lighting_ambient_color:new e.bH(i),u_lighting_directional_dir:new e.bH(i),u_lighting_directional_color:new e.bH(i),u_ground_radiance:new e.bH(i)}),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms={u_light_matrix_0:new e.bF(i),u_light_matrix_1:new e.bF(i),u_fade_range:new e.bG(i),u_shadow_normal_offset:new e.bH(i),u_shadow_intensity:new e.bI(i),u_shadow_texel_size:new e.bI(i),u_shadow_map_resolution:new e.bI(i),u_shadow_direction:new e.bH(i),u_shadow_bias:new e.bH(i),u_shadowmap_0:new e.bJ(i),u_shadowmap_1:new e.bJ(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||!rb.includes(this.name))||!(!d.layers3D||!rw.includes(this.name))))return;let f=p.gl,m=i.wireframeDebugCache.getLinesFromTrianglesBuffer(i.frameCounter,o,p);if(!m)return;let _=[...this.fixedDefines];
98_.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 tW([f.ONE,f.ONE_MINUS_SRC_ALPHA,f.ZERO,f.ONE],e.bz.transparent,[!0,!0,!0,!1])),p.setDepthMode(new tX(r.func===f.LESS?f.LEQUAL:r.func,tX.ReadOnly,r.range)),p.setStencilMode(tY.disabled);let x=3*s.primitiveLength*2,v=3*s.primitiveOffset*4;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)}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],v=_&&_>0?1:void 0;for(let o of c.get()){let s=o.vaos||(o.vaos={});(s[l]||(s[l]=new iL)).bind(g,this,h,f?f.getPaintVertexBuffers():[],u,o.vertexOffset,m||[],v),_&&_>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,_)}}}function rS(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.ak(r,1,i.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}let rE=e.a6.mat4.create(),rM=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g)=>{let y=r.style.light,x=y.properties.get("position"),v=[x.x,x.y,x.z],b=e.a6.mat3.create();"viewport"===y.properties.get("anchor")&&(e.a6.mat3.fromRotation(b,-r.transform.angle),e.a6.vec3.transformMat3(v,v,b));let w=y.properties.get("color"),T=r.transform,S={u_matrix:i,u_lightpos:v,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_vertical_gradient:+a,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rE,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:o,u_edge_radius:s,u_width_scale:l,u_flood_light_color:f,u_vertical_scale:m,u_flood_light_intensity:_,u_ground_shadow_factor:g};return"globe"===T.projection.name&&(S.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],S.u_zoom_transition=c,S.u_inv_rot_matrix=p,S.u_merc_center=d,S.u_up_dir=T.projection.upVector(new e.bP(0,0,0),d[0]*e.ab,d[1]*e.ab),S.u_height_lift=u),S},rI=(e,i,r,a)=>({u_matrix:e,u_edge_radius:i,u_width_scale:r,u_vertical_scale:a}),rA=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_)=>{let g=rM(i,r,a,n,o,s,l,h,c,d,p,f,m,_,1,[0,0,0]),y={u_height_factor:-Math.pow(2,h.overscaledZ)/u.tileSize/8};return e.l(g,rS(r,u),y)},rC=(e,i)=>({u_matrix:e,u_emissive_strength:i}),rP=(i,r,a,n)=>e.l(rC(i,r),rS(a,n)),rz=(e,i,r)=>({u_matrix:e,u_world:r,u_emissive_strength:i}),rD=(i,r,a,n,o)=>e.l(rP(i,r,a,n),{u_world:o}),rR=(i,r,a,n)=>{let o=e.ab/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]}},rL=(e,i,r=1)=>({u_matrix:e,u_color:i.toRenderColor(null),u_overlay:0,u_overlay_scale:r}),rk=e.a6.mat4.create(),rO=(i,r,a,n,o,s,l)=>{let h=i.transform,u="globe"===h.projection.name,c=u?e.cI(h.zoom,r.canonical)*h._pixelsPerMercatorPixel:e.ak(a,1,s),d={u_matrix:r.projMatrix,u_extrude_scale:c,u_intensity:l,u_inv_rot_matrix:rk,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.a9(h.zoom);let i=o[0]*e.ab,a=o[1]*e.ab;d.u_up_dir=h.projection.upVector(new e.bP(0,0,0),i,a)}return d};function rB(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 rF(e,i,[r,a]){return r===a?0:.5/e+(i-r)*(e-1)/(e*(a-r))}let rN=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)=>({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:
98p.paint.get("raster-brightness-max"),u_saturation_factor:e.cJ(p.paint.get("raster-saturation")),u_contrast_factor:e.cK(p.paint.get("raster-contrast")),u_spin_weights:function(e){let i=Math.sin(e*=Math.PI/180),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*i-r+1)/3,(Math.sqrt(3)*i-r+1)/3]}(p.paint.get("raster-hue-rotate")),u_perspective_transform:f,u_raster_elevation:m,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:u,u_colorization_mix:rB(e.cL,g,x),u_colorization_offset:rF(e.cL,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}),rV=(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}),rU=(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]}),rj=(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]}),rG=e.a6.mat4.create(),rq=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)=>{let T=o.transform,S={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:T.getCameraToCenterDistance(v),u_rotate_symbol:+a,u_aspect_ratio:T.width/T.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?1:0,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:rG,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:rG,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};return"globe"===v.name&&(S.u_tile_id=[m.canonical.x,m.canonical.y,1<<m.canonical.z],S.u_zoom_transition=_,S.u_inv_rot_matrix=y,S.u_merc_center=g,S.u_camera_forward=T._camera.forward(),S.u_ecef_origin=e.cM(T.globeMatrix,m.toUnwrapped()),S.u_tile_matrix=Float32Array.from(T.globeMatrix),S.u_up_vector=x),S},rZ=(e,i,r,a)=>({u_matrix:e,u_emissive_strength:i,u_opacity:r,u_color:a}),r$=(i,r,a,n,o,s,l,h,u)=>e.l(function(i,r,a,n,o,s){let{width:l,height:h}=n.imageManager.getPixelSize(r),u=Math.pow(2,s.tileID.overscaledZ),c=s.tileSize*Math.pow(2,n.transform.tileZoom)/u,d=c*(s.tileID.canonical.x+s.tileID.wrap*u),p=c*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:a.tl,u_pattern_br:a.br,u_texsize:[l,h],u_pattern_size:a.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/e.ak(s,1,n.transform.tileZoom),1/e.ak(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}}(0,s,l,n,h,u),{u_matrix:i,u_emissive_strength:r,u_opacity:a}),rH=new Float32Array(e.a6.mat4.identity([])),rW=(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.a6.mat3.create();"viewport"===g.properties.get("anchor")&&(e.a6.mat3.fromRotation(v,-o.transform.angle),e.a6.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.bz.white).toRenderColor(null),E=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||rH,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:t3.BaseColor,u_metallicRoughnessTexture:t3.MetallicRoughness,u_normalTexture:t3.Normal,u_occlusionTexture:t3.Occlusion,u_emissionTexture:t3.Emission,u_lutTexture:t3.LUT,u_color_mix:[S.r,S.g,S.b,E],u_aoIntensity:T,u_emissive_strength:p,u_occlusionTextureTransform:_||[0,0,0,0]}},rX=(e,i=rH,r=rH)=>({u_matrix:e,u_instance:i,u_node_matrix:r}),rY={fillExtrusion:i=>({u_matrix:new e.bF(i),u_lightpos:new e.bH(i),u_lightintensity:new e.bI(i),u_lightcolor:new e.bH(i),u_vertical_gradient:new e.bI(i),u_opacity:new e.bI(i),u_edge_radius:new e.bI(i),u_width_scale:new e.bI(i),u_ao:new e.bG(i),u_tile_id:new e.bH(i),u_zoom_transition:new e.bI(i),u_inv_rot_matrix:new e.bF(i),u_merc_center:new e.bG(i),u_up_dir:new e.bH(i),u_height_lift:new e.bI(i),u_flood_light_color:new e.bH(i),u_vertical_scale:new e.bI(i),u_flood_light_intensity:new e.bI(i),u_ground_shadow_factor:new e.bH(i)}),fillExtrusionDepth:i=>
98({u_matrix:new e.bF(i),u_edge_radius:new e.bI(i),u_width_scale:new e.bI(i),u_vertical_scale:new e.bI(i)}),fillExtrusionPattern:i=>({u_matrix:new e.bF(i),u_lightpos:new e.bH(i),u_lightintensity:new e.bI(i),u_lightcolor:new e.bH(i),u_vertical_gradient:new e.bI(i),u_height_factor:new e.bI(i),u_edge_radius:new e.bI(i),u_width_scale:new e.bI(i),u_ao:new e.bG(i),u_tile_id:new e.bH(i),u_zoom_transition:new e.bI(i),u_inv_rot_matrix:new e.bF(i),u_merc_center:new e.bG(i),u_up_dir:new e.bH(i),u_height_lift:new e.bI(i),u_image:new e.bJ(i),u_texsize:new e.bG(i),u_pixel_coord_upper:new e.bG(i),u_pixel_coord_lower:new e.bG(i),u_tile_units_to_pixels:new e.bI(i),u_opacity:new e.bI(i)}),fillExtrusionGroundEffect:i=>({u_matrix:new e.bF(i),u_opacity:new e.bI(i),u_ao_pass:new e.bI(i),u_meter_to_tile:new e.bI(i),u_ao:new e.bG(i),u_flood_light_intensity:new e.bI(i),u_flood_light_color:new e.bH(i),u_attenuation:new e.bI(i),u_edge_radius:new e.bI(i),u_fb:new e.bJ(i),u_fb_size:new e.bI(i),u_dynamic_offset:new e.bI(i)}),fill:i=>({u_matrix:new e.bF(i),u_emissive_strength:new e.bI(i)}),fillPattern:i=>({u_matrix:new e.bF(i),u_emissive_strength:new e.bI(i),u_image:new e.bJ(i),u_texsize:new e.bG(i),u_pixel_coord_upper:new e.bG(i),u_pixel_coord_lower:new e.bG(i),u_tile_units_to_pixels:new e.bI(i)}),fillOutline:i=>({u_matrix:new e.bF(i),u_emissive_strength:new e.bI(i),u_world:new e.bG(i)}),fillOutlinePattern:i=>({u_matrix:new e.bF(i),u_emissive_strength:new e.bI(i),u_world:new e.bG(i),u_image:new e.bJ(i),u_texsize:new e.bG(i),u_pixel_coord_upper:new e.bG(i),u_pixel_coord_lower:new e.bG(i),u_tile_units_to_pixels:new e.bI(i)}),circle:e.cN,collisionBox:i=>({u_matrix:new e.bF(i),u_camera_to_center_distance:new e.bI(i),u_extrude_scale:new e.bG(i)}),collisionCircle:i=>({u_matrix:new e.bF(i),u_inv_matrix:new e.bF(i),u_camera_to_center_distance:new e.bI(i),u_viewport_size:new e.bG(i)}),debug:i=>({u_color:new e.cu(i),u_matrix:new e.bF(i),u_overlay:new e.bJ(i),u_overlay_scale:new e.bI(i)}),clippingMask:i=>({u_matrix:new e.bF(i)}),heatmap:i=>({u_extrude_scale:new e.bI(i),u_intensity:new e.bI(i),u_matrix:new e.bF(i),u_inv_rot_matrix:new e.bF(i),u_merc_center:new e.bG(i),u_tile_id:new e.bH(i),u_zoom_transition:new e.bI(i),u_up_dir:new e.bH(i)}),heatmapTexture:i=>({u_image:new e.bJ(i),u_color_ramp:new e.bJ(i),u_opacity:new e.bI(i)}),hillshade:i=>({u_matrix:new e.bF(i),u_image:new e.bJ(i),u_latrange:new e.bG(i),u_light:new e.bG(i),u_shadow:new e.cu(i),u_highlight:new e.cu(i),u_emissive_strength:new e.bI(i),u_accent:new e.cu(i)}),hillshadePrepare:i=>({u_matrix:new e.bF(i),u_image:new e.bJ(i),u_dimension:new e.bG(i),u_zoom:new e.bI(i)}),line:e.cO,linePattern:e.cP,raster:i=>({u_matrix:new e.bF(i),u_normalize_matrix:new e.bF(i),u_globe_matrix:new e.bF(i),u_merc_matrix:new e.bF(i),u_grid_matrix:new e.cv(i),u_tl_parent:new e.bG(i),u_scale_parent:new e.bI(i),u_fade_t:new e.bI(i),u_opacity:new e.bI(i),u_image0:new e.bJ(i),u_image1:new e.bJ(i),u_brightness_low:new e.bI(i),u_brightness_high:new e.bI(i),u_saturation_factor:new e.bI(i),u_contrast_factor:new e.bI(i),u_spin_weights:new e.bH(i),u_perspective_transform:new e.bG(i),u_raster_elevation:new e.bI(i),u_zoom_transition:new e.bI(i),u_merc_center:new e.bG(i),u_cutoff_params:new e.c6(i),u_colorization_mix:new e.c6(i),u_colorization_offset:new e.bI(i),u_color_ramp:new e.bJ(i),u_texture_offset:new e.bG(i),u_texture_res:new e.bG(i),u_emissive_strength:new e.bI(i)}),rasterParticle:i=>({u_matrix:new e.bF(i),u_normalize_matrix:new e.bF(i),u_globe_matrix:new e.bF(i),u_merc_matrix:new e.bF(i),u_grid_matrix:new e.cv(i),u_tl_parent:new e.bG(i),u_scale_parent:new e.bI(i),u_fade_t:new e.bI(i),u_opacity:new e.bI(i),u_image0:new e.bJ(i),u_image1:new e.bJ(i),u_raster_elevation:new e.bI(i),u_zoom_transition:new e.bI(i),u_merc_center:new e.bG(i),u_cutoff_params:new e.c6(i)}),rasterParticleTexture:i=>({u_texture:new e.bJ(i),u_opacity:new e.bI(i)}),rasterParticleDraw:i=>({u_particle_texture:new e.bJ(i),u_particle_texture_side_len:new e.bI(i),u_tile_offset:new e.bG(i),u_velocity:new e.bJ(i),u_color_ramp:new e.bJ(i),u_velocity_res:new e.bG(i),u_max_speed:new e.bI(i),u_uv_offset:new e.bG(i),u_data_scale:new e.bG(i),u_data_offset:new e.bI(i),u_particle_pos_scale:new e.bI(i),u_particle_pos_offset:new e.bG(i)}),rasterParticleUpdate:i=>({u_particle_texture:new e.bJ(i),u_particle_texture_side_len:new e.bI(i),u_velocity:new e.bJ(i),u_velocity_res:new e.bG(i),u_max_speed:new e.bI(i),u_speed_factor:new e.bI(i),u_reset_rate:new e.bI(i),u_rand_seed:new e.bI(i),u_uv_offset:new e.bG(i),u_data_scale:new e.bG(i),u_data_offset:new e.bI(i),u_particle_pos_scale:new e.bI(i),u_particle_pos_offset:new e.bG(i)}),symbol:i=>({u_is_size_zoom_constant:new e.bJ(i),u_is_size_feature_constant:new e.bJ(i),u_size_t:new e.bI(i),u_size:new e.bI(i),u_camera_to_center_distance:new e.bI(i),u_rotate_symbol:new e.bJ(i),u_aspect_ratio:new e.bI(i),u_fade_change:new e.bI(i),u_matrix:new e.bF(i),u_label_plane_matrix:new e.bF(i),u_coord_matrix:new e.bF(i),u_is_text:new e.bJ(i),u_elevation_from_sea:new e.bJ(i),u_pitch_with_map:new e.bJ(i),u_texsize:new e.bG(i),u_texsize_icon:new e.bG(i),u_texture:new e.bJ(i),u_texture_icon:new e.bJ(i),u_gamma_scale:new e.bI(i),u_device_pixel_ratio:new e.bI(i),u_tile_id:new e.bH(i),u_zoom_transition:new e.bI(i),u_inv_rot_matrix:new e.bF(i),u_merc_center:new e.bG(i),u_camera_forward:new e.bH(i),u_tile_matrix:new e.bF(i),u_up_vector:new e.bH(i),u_ecef_origin:new e.bH(i),u_is_halo:new e.bJ(i),u_icon_transition:new e.bI(i),u_color_adj_mat:new e.bF(i)}),background:i=>({u_matrix:new e.bF(i),u_emissive_strength:new e.bI(i),u_opacity:new e.bI(i),u_color:new e.cu(i)}),backgroundPattern:i=>({u_matrix:new e.bF(i),u_emissive_strength:new e.bI(i),u_opacity:new e.bI(i),u_image:new e.bJ(i),u_pattern_tl:new e.bG(i),u_pattern_br:new e.bG(i),u_texsize:new e.bG(i),u_pattern_size:new e.bG(i),u_pixel_coord_upper:new e.bG(i),u_pixel_coord_lower:new e.bG(i),u_pattern_units_to_pixels:new e.bG(i)}),terrainRaster:i=>({u_matrix:new e.bF(i),u_image0:new e.bJ(i),u_skirt_height:new e.bI(i),u_ground_shadow_factor:new e.bH(i)}),skybox:i=>({u_matrix:new e.bF(i),u_sun_direction:new e.bH(i),u_cubemap:new e.bJ(i),u_opacity:new e.bI(i),u_temporal_offset:new e.bI(i)}),skyboxGradient:i=>({u_matrix:new e.bF(i),u_color_ramp:new e.bJ(i),u_center_direction:new e.bH(i),u_radius:new e.bI(i),u_opacity:new e.bI(i),u_temporal_offset:new e.bI(i)}),skyboxCapture:i=>({u_matrix_3f:new e.cv(i),u_sun_direction:new e.bH(i),u_sun_intensity:new e.bI(i),u_color_tint_r:new e.c6(i),u_color_tint_m:new e.c6(i),u_luminance:new e.bI(i)}),globeRaster:i=>({u_proj_matrix:new e.bF(i),u_globe_matrix:new e.bF(i),u_normalize_matrix:new e.bF(i),u_merc_matrix:new e.bF(i),u_zoom_transition:new e.bI(i),u_merc_center:new e.bG(i),u_image0:new e.bJ(i),u_grid_matrix:new e.cv(i),u_skirt_height:new e.bI(i),u_far_z_cutoff:new e.bI(i),u_frustum_tl:new e.bH(i),u_frustum_tr:new e.bH(i),u_frustum_br:new e.bH(i),u_frustum_bl:new e.bH(i),u_globe_pos:new e.bH(i),u_globe_radius:new e.bI(i),u_viewport:new e.bG(i)}),globeAtmosphere:i=>({u_frustum_tl:new e.bH(i),u_frustum_tr:new e.bH(i),u_frustum_br:new e.bH(i),u_frustum_bl:new e.bH(i),u_horizon:new e.bI(i),u_transition:new e.bI(i),u_fadeout_range:new e.bI(i),u_color:new e.c6(i),u_high_color:new e.c6(i),u_space_color:new e.c6(i),u_temporal_offset:new e.bI(i),u_horizon_angle:new e.bI(i)}),model:i=>({u_matrix:new e.bF(i),u_lighting_matrix:new e.bF(i),u_normal_matrix:new e.bF(i),u_node_matrix:new e.bF(i),u_lightpos:new e.bH(i),u_lightintensity:new e.bI(i),u_lightcolor:new e.bH(i),u_camera_pos:new e.bH(i),u_opacity:new e.bI(i),u_baseColorFactor:new e.c6(i),u_emissiveFactor:new e.c6(i),u_metallicFactor:new e.bI(i),u_roughnessFactor:new e.bI(i),u_baseTextureIsAlpha:new e.bJ(i),u_alph
98aMask:new e.bJ(i),u_alphaCutoff:new e.bI(i),u_baseColorTexture:new e.bJ(i),u_metallicRoughnessTexture:new e.bJ(i),u_normalTexture:new e.bJ(i),u_occlusionTexture:new e.bJ(i),u_emissionTexture:new e.bJ(i),u_lutTexture:new e.bJ(i),u_color_mix:new e.c6(i),u_aoIntensity:new e.bI(i),u_emissive_strength:new e.bI(i),u_occlusionTextureTransform:new e.c6(i)}),modelDepth:i=>({u_matrix:new e.bF(i),u_instance:new e.bF(i),u_node_matrix:new e.bF(i)}),groundShadow:i=>({u_matrix:new e.bF(i),u_ground_shadow_factor:new e.bH(i)}),stars:i=>({u_matrix:new e.bF(i),u_up:new e.bH(i),u_right:new e.bH(i),u_intensity_multiplier:new e.bI(i)}),occlusion:i=>({u_matrix:new e.bF(i),u_anchorPos:new e.bH(i),u_screenSizePx:new e.bG(i),u_occluderSizePx:new e.bG(i),u_color:new e.c6(i)})};class rJ{constructor(e,i,r,a){this.id=rJ.uniqueIdxCounter,rJ.uniqueIdxCounter++,this.context=e;let 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=rJ.uniqueIdxCounter,rJ.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)}}rJ.uniqueIdxCounter=0;let rK={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class rQ{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;let 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)}enableAttributes(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[rK[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 r0{constructor(e,i,r,a,n){this.context=e,this.width=i,this.height=r;let o=this.framebuffer=e.gl.createFramebuffer();a&&(this.colorAttachment=new rn(e,o)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new ro(e,o):new rs(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 r1{constructor(e,i){this.gl=e,this.clearColor=new iB(this),this.clearDepth=new iF(this),this.clearStencil=new iN(this),this.colorMask=new iV(this),this.depthMask=new iU(this),this.stencilMask=new ij(this),this.stencilFunc=new iG(this),this.stencilOp=new iq(this),this.stencilTest=new iZ(this),this.depthRange=new i$(this),this.depthTest=new iH(this),this.depthFunc=new iW(this),this.blend=new iX(this),this.blendFunc=new iY(this),this.blendColor=new iJ(this),this.blendEquation=new iK(this),this.cullFace=new iQ(this),this.cullFaceSide=new i0(this),this.frontFace=new i1(this),this.program=new i2(this),this.activeTexture=new i3(this),this.viewport=new i4(this),this.bindFramebuffer=new i5(this),this.bindRenderbuffer=new i6(this),this.bindTexture=new i8(this),this.bindVertexBuffer=new i9(this),this.bindElementBuffer=new i7(this),this.bindVertexArrayOES=new re(this),this.pixelStoreUnpack=new rt(this),this.pixelStoreUnpackPremultiplyAlpha=new ri(this),this.pixelStoreUnpackFlipY=new rr(this),this.options=i?{...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.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 rJ(this,e,i,r)}createVertexBuffer(e,i,r,a,n){return new rQ(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 r0(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.bh(i.blendFunction,tW.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 r2(i,r,a,n,s,l,h){let u=i.context,c=u.gl,d=i.transform,p=i.getOrCreateProgram("collisionBox"),f=[],m=0,_=0;for(let o=0;o<n.length;o++){let u=n[o],g=r.getTile(u),y=g.getBucket(a);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),tI(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.a6.mat4.create(),r=v;e.a6.mat4.mul(i,y.placementInvProjMatrix,d.glCoordMatrix),e.a6.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,tX.disabled,tY.disabled,i.colorModeForRenderPass(),tJ.disabled,rR(v,d,g,y.getProjection()),a.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.cQ;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)}(!o||o.length<2*m)&&(o=function(i){let r=2*i,a=new e.aO;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(o,!0),b=u.createVertexBuffer(y,e.cR.members,!0);for(let r of f){let n={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,tX.disabled,tY.disabled,i.colorModeForRenderPass(),tJ.disabled,n,a.id,b,v,e.b1.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,d.zoom)}b.destroy(),v.destroy()}let r3=e.a6.mat4.create();function r4(i){let r=i._camera.getWorldToCamera(i.worldSize,1),a=e.a6.mat4.multiply([],r,i.globeMatrix);e.a6.mat4.invert(a,a);let n=[0,0,0],o=[0,1,0,0];return e.a6.vec4.transformMat4(o,o,a),n[0]=o[0],n[1]=o[1],n[2]=o[2],e.a6.vec3.normalize(n,n),n}function r5(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.paint.get("symbol-elevation-reference"),S=a.paint.get("text-occlusion-opacity").constantOr(0),E=i.context,M=E.gl,I=i.transform,A="map"===p,C="map"===f,P="map"===m,z="map"===_,D=void 0!==a.layout.get("symbol-sort-key").constantOr(1),R=!1,L=i.depthModeForSublayer(0,tX.ReadOnly),k=[e.am(I.center.lng),e.at(I.center.lat)],O=a.layout.get("text-variable-anchor"),B="globe"===I.projection.name,F=[],N=[0,-1,0];for(let o of n){let n=r.getTile(o),s=n.getBucket(a);if(!s||"mercator"===s.projection.name&&B||s.fullyClipped)continue;let p="globe"===s.projection.name,f=p?e.a9(I.zoom):0,m=tA(o,s.getProjection(),I),_=I.calculatePixelsToTileUnitsMatrix(n),E=O&&s.hasTextData(),L=s.hasIconTextFit()&&E&&s.hasIconData(),V=s.getProjection().createInversionMatrix(I,o.canonical),U=e=>{I.depthOcclusionForSymbolsAndCircles&&(a.hasInitialOcclusionOpacityProperties||i.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},j=()=>{let r=A&&"point"!==a.layout.get("symbol-placement"),l=[];U(l);let u=r||L,d=a.paint.get("icon-image-cross-fade").constantOr(0);i.terrainRenderModeElevated()&&P&&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}),E=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],C=s.iconSizeData,z=e.bj(C,I.zoom),D=P||0!==I.pitch,R=td(m,n.tileID.canonical,P,A,I,s.getProjection(),_),O=tf(m,n.tileID.canonical,P,A,I,s.getProjection(),_),F=i.translatePosMatrix(O,n,h,c,!0),j=i.translatePosMatrix(m,n,h,c),G=u?r3:R,q=A&&!P&&!r,Z=N;(B||I.mercatorFromTransition)&&!A&&(Z=r4(I));let $=p?Z:N,H=a.getColorAdjustmentMatrix(x,v,b,w),W=rq(C.kind,z,q,P,i,j,G,F,T,!1,E,[0,0],!0,o,f,k,V,$,s.getProjection(),H,d),X=n.imageAtlasTexture?n.imageAtlasTexture:null,Y=1!==a.layout.get("icon-size").constantOr(0)||s.iconsNeedLinear,J=s.sdfIcons||i.options.rotating||i.options.zooming||Y||D?M.LINEAR:M.NEAREST,K=s.sdfIcons&&0!==a.paint.get("icon-halo-width").constantOr(1),Q=i.terrain&&P&&r?e.a6.mat4.invert(e.a6.mat4.create(),R):r3;if(r&&s.icon){let e=I.elevation,r=e?e.getAtTileOffsetFunc(o,I.center.lat,I.worldSize,s.getProjection()):null,a=tp(m,n.tileID.canonical,P,A,I,s.getProjection(),_);tg(s,m,i,!1,a,O,P,g,r,o)}return{program:S,buffers:s.icon,uniformValues:W,atlasTexture:X,atlasTextureIcon:null,atlasInterpolation:J,atlasInterpolationIcon:null,isSDF:s.sdfIcons,hasH
98alo:K,tile:n,labelPlaneMatrixInv:Q}},G=()=>{let r=C&&"point"!==a.layout.get("symbol-placement"),l=[],h=r||O||L;i.terrainRenderModeElevated()&&z&&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"),U(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=z||0!==I.pitch||i.options.rotating||i.options.zooming||"composite"===w.kind||"camera"===w.kind?M.LINEAR:M.NEAREST);let E=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],A=e.bj(w,I.zoom),P=td(m,n.tileID.canonical,z,C,I,s.getProjection(),_),D=tf(m,n.tileID.canonical,z,C,I,s.getProjection(),_),R=i.translatePosMatrix(D,n,u,d,!0),F=i.translatePosMatrix(m,n,u,d),j=h?r3:P,G=C&&!z&&!r,q=N;(B||I.mercatorFromTransition)&&!C&&(q=r4(I));let Z=rq(w.kind,A,G,z,i,F,j,R,T,!0,E,v,!0,o,f,k,V,p?q:N,s.getProjection(),S),$=n.glyphAtlasTexture?n.glyphAtlasTexture:null,H=M.LINEAR,W=0!==a.paint.get("text-halo-width").constantOr(1),X=i.terrain&&z&&r?e.a6.mat4.invert(e.a6.mat4.create(),P):r3;if(r&&s.text){let e=I.elevation,r=e?e.getAtTileOffsetFunc(o,I.center.lat,I.worldSize,s.getProjection()):null,a=tp(m,n.tileID.canonical,z,C,I,s.getProjection(),_);tg(s,m,i,!0,a,D,z,y,r,o)}return{program:g,buffers:s.text,uniformValues:Z,atlasTexture:$,atlasTextureIcon:b,atlasInterpolation:H,atlasInterpolationIcon:x,isSDF:!0,hasHalo:W,tile:n,labelPlaneMatrixInv:X}},q=s.icon.segments.get().length,Z=s.text.segments.get().length,$=q&&!l.onlyText?j():null,H=Z&&!l.onlyIcons?G():null,W=a.paint.get("icon-opacity").constantOr(1),X=a.paint.get("text-opacity").constantOr(1);if(D&&s.canOverlap){R=!0;let i=W&&!l.onlyText?s.icon.segments.get():[],r=X&&!l.onlyIcons?s.text.segments.get():[];for(let r of i)F.push({segments:new e.b1([r]),sortKey:r.sortKey,state:$});for(let i of r)F.push({segments:new e.b1([i]),sortKey:i.sortKey,state:H})}else l.onlyText||F.push({segments:W?s.icon.segments:new e.b1([]),sortKey:0,state:$}),l.onlyIcons||F.push({segments:X?s.text.segments:new e.b1([]),sortKey:0,state:H})}for(let e of(R&&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:I.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:r.labelPlaneMatrixInv}):i.setupDepthForOcclusion(I.depthOcclusionForSymbolsAndCircles,r.program),E.activeTexture.set(M.TEXTURE0),r.atlasTexture&&r.atlasTexture.bind(r.atlasInterpolation,M.CLAMP_TO_EDGE,!0),r.atlasTextureIcon&&(E.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,r6(r.buffers,e.segments,a,i,r.program,L,o,s,n,2),n.u_is_halo=0}else{if(r.isSDF){let n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,r6(r.buffers,e.segments,a,i,r.program,L,o,s,n,1)),n.u_is_halo=0}r6(r.buffers,e.segments,a,i,r.program,L,o,s,r.uniformValues,1)}}}}function r6(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,tJ.disabled,h,r.id,e.layoutVertexBuffer,e.indexBuffer,i,r.paint,a.transform.zoom,e.programConfigurations.get(r.id),c,u)}function r8(e,i,r,a,n,o,s){let l,h,u,c,d;let p=e.context.gl,f=r.paint.get("fill-pattern"),m=r.is3D(),_=m?e.stencilModeFor3D():tY.disabled,g=f&&f.constantOr(1);for(let y of(s?(h=g&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=p.LINES):(h=g?"fillPattern":"fill",l=p.TRIANGLES),a)){let a=i.getTile(y);if(g&&!a.patternsLoaded())continue;let x=a.getBucket(r);if(!x)continue;e.prepareDrawTile();let v=x.programConfigurations.get(r.id),b=e.isTileAffectedByFog(y),w=e.getOrCreateProgram(h,{config:v,overrideFog:b});g&&(e.context.activeTexture.set(p.TEXTURE0),a.imageAtlasTexture&&a.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),v.updatePaintBuffers());let T=f.constantOr(null);if(T&&a.imageAtlas){let e=a.imageAtlas.patternPositions[T.toString()];e&&v.setConstantPatternPositions(e)}let S=e.translatePosMatrix(y.projMatrix,a,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor")),E=r.paint.get("fill-emissive-strength");if(s){c=x.indexBuffer2,d=x.segments2;let i=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[p.drawingBufferWidth,p.drawingBufferHeight];u="fillOutlinePattern"===h&&g?rD(S,E,e,a,i):rz(S,E,i)}else c=x.indexBuffer,d=x.segments,u=g?rP(S,E,e,a):rC(S,E);e.uploadCommonUniforms(e.context,w,y.toUnwrapped()),w.draw(e,l,n,m?_:e.stencilModeForClipping(y),o,tJ.disabled,u,r.id,x.layoutVertexBuffer,c,d,r.paint,e.transform.zoom,v,void 0)}}function r9(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.c_():0,S="globe"===p.projection.name,E=S?e.a9(p.zoom):0,M=[e.am(p.center.lng),e.at(p.center.lat)],I=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),A=a.paint.get("fill-extrusion-flood-light-intensity"),C=a.paint.get("fill-extrusion-vertical-scale"),P=0!==a.paint.get("fill-extrusion-line-width").constantOr(1),z=t9(i,a.paint.get("fill-extrusion-cutoff-fade-range")),D=[];S&&D.push("PROJECTION_GLOBE_VIEW"),x[0]>0&&D.push("FAUX_AO"),b&&D.push("ZERO_ROOF_RADIUS"),h&&D.push("HAS_CENTROID"),A>0&&D.push("FLOOD_LIGHT"),z.shouldRenderCutoff&&D.push("RENDER_CUTOFF"),P&&D.push("RENDER_WALL_MODE");let R="shadow"===i.renderPass,L=i.shadowRenderer;i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!0);let k=[0,0,0];if(L){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(k=io(i.style,e,r)),u=D.concat(["SHADOWS_SINGLE_CASCADE"])}let O=R&&L?"fillExtrusionDepth":m?"fillExtrusionPattern":"fillExtrusion",B=a.getLayerRenderingStats();for(let g of n){let n;let y=r.getTile(g),v=y.getBucket(a);if(!v||v.projection.name!==p.projection.name)continue;let b=!1;L&&(b=0===L.getMaxCascadeForTile(g.toUnwrapped()));let F=i.isTileAffectedByFog(g),N=v.programConfigurations.get(a.id),V=i.getOrCreateProgram(O,{config:N,defines:b?u:D,overrideFog:F});if(i.terrain&&i.terrain.setupElevationDraw(y,V,{useMeterToDem:!0}),!v.centroidVertexBuffer){let e=V.attributes.a_centroid_pos;void 0!==e&&d.vertexAttrib2f(e,0,0)}!R&&L&&L.setupShadows(y.tileID.toUnwrapped(),V,"vector-tile",y.tileID.overscaledZ
98),m&&(i.context.activeTexture.set(d.TEXTURE0),y.imageAtlasTexture&&y.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),N.updatePaintBuffers());let U=f.constantOr(null);if(U&&y.imageAtlas){let e=y.imageAtlas.patternPositions[U.toString()];e&&N.setConstantPatternPositions(e)}let j=a.paint.get("fill-extrusion-vertical-gradient"),G=1/v.tileToMeter;if(R&&L){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=[ae,at,ai,u,[u[0],0,u[2]],[0,u[1],u[2]]],p="globe"===n.projection.name,f=n.scaleZoom(l),m=e.bN.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=rI(L.calculateShadowPassMatrixFromTile(y.tileID.toUnwrapped()),w,G,C)}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?rA(e,i,j,_,x,w,G,g,y,T,E,M,r,I,C):rM(e,i,j,_,x,w,G,g,T,E,M,r,I,C,A,k)}i.uploadCommonUniforms(c,V,g.toUnwrapped(),null,z);let q=v.segments;if("mercator"===p.projection.name&&!R&&!(q=v.getVisibleSegments(y.tileID,i.terrain,i.transform.getFrustum(0))).get().length)continue;if(B){if(R)for(let e of q.get())B.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(let e of q.get())B.numRenderedVerticesInTransparentPass+=e.primitiveLength}let Z=[];(i.terrain||h)&&Z.push(v.centroidVertexBuffer),S&&Z.push(v.layoutVertexExtBuffer),P&&Z.push(v.wallVertexBuffer),V.draw(i,c.gl.TRIANGLES,o,s,l,tJ.backCCW,n,a.id,v.layoutVertexBuffer,v.indexBuffer,q,a.paint,i.transform.zoom,N,Z)}i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!1)}function r7(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,E=[],M=t9(i,a.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===c?(E.push("CLEAR_SUBPASS"),v&&(E.push("CLEAR_FROM_TEXTURE"),b.activeTexture.set(w.TEXTURE0),v.bind(w.LINEAR,w.CLAMP_TO_EDGE))):"sdf"===c&&E.push("SDF_SUBPASS"),y&&E.push("HAS_CENTROID"),M.shouldRenderCutoff&&E.push("RENDER_CUTOFF");let I=a.layout.get("fill-extrusion-edge-radius"),A=(e,r,n,c,x)=>{let w=r.programConfigurations.get(a.id),T=i.isTileAffectedByFog(e),A=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:w,defines:E,overrideFog:T}),C={u_matrix:c,u_opacity:d,u_ao_pass:u?1:0,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:I*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,A,e.toUnwrapped(),null,M),A.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();A(o,l,r,e,h)}if(x)for(let s=0;s<4;s++){let l,u;let c=e.c$[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.ab,0,0],u=1):1===s?(l=[e.ab,0,0],u=0):2===s?(l=[0,-e.ab,0],u=3):(l=[0,e.ab,0],u=2);let m=f.regionSegments[u];if(!m)continue;let _=new Float32Array(16);e.a6.mat4.translate(_,o.projMatrix,l),A(o,f,m,i.translatePosMatrix(_,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),h)}}}let ae=[1,0,0],at=[0,1,0],ai=[0,0,1];function ar(i){return[i[0]*e.d4,i[1]*e.d4,i[2]*e.d4,0]}function aa(i,r,a,n,o,s,l,h,u){let c,d,p,f,m,_,g,y;
98let x=n.getSource(),v=a.globeSharedBuffers;if(!v||(r&&(c=n.getTile(r)),x instanceof e.aD?(d=x.texture,p=e.cD(0,0,a.transform)):c&&r&&(d=c.texture,p=e.cD(r.canonical.z,r.canonical.x,a.transform)),!d||!p))return;i||(p=e.a6.mat4.scale(e.a6.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),E=l.defines;E.push("GLOBE_POLES");let M=new tX(w.LEQUAL,tX.ReadWrite,a.depthRangeFor3D),I=Float32Array.from(a.transform.expandedFarZProjMatrix),A=Float32Array.from(e.b5(e.cC(new e.bP(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),d.useMipmap&&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=ar(l.mix),k=(m=p,_=e.a9(a.transform.zoom),g=l.offset,y=l.range,rN(I,A,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)),O=a.getOrCreateProgram("raster",{defines:E});a.uploadCommonUniforms(b,O,null),O.draw(a,w.TRIANGLES,M,u,S,h,k,o.id,f,z,D)}var an=e.d5([{name:"a_index",type:"Int16",components:1}]);class ao{constructor(i,r,a,n){let 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.d6;o.reserve(n);for(let e=0;e<n;e++)o.emplaceBack(e);this.particleIndexBuffer=this.context.createVertexBuffer(o,an.members,!0),this.particleSegment=e.b1.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 as=new e.bz(1,0,0,1),al=new e.bz(0,1,0,1),ah=new e.bz(0,0,1,1),au=new e.bz(1,0,1,1),ac=new e.bz(0,1,1,1);function ad(i,r,a,n,o,s,l){let h=i.context,u=i.transform,c=h.gl,d="globe"===u.projection.name,p=e.a6.mat4.clone(a.projMatrix);if(d&&e.a9(u.zoom)>0){let i=e.b4(a.canonical,u),r=e.d8(i);p=e.a6.mat4.multiply(new Float32Array(16),u.globeMatrix,r),e.a6.mat4.multiply(p,u.projMatrix,p)}let f=e.a6.mat4.create();f[12]+=2*o/(e.q.devicePixelRatio*u.width),f[13]+=2*s/(e.q.devicePixelRatio*u.height),e.a6.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=tX.disabled,y=tY.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,tJ.disabled,rL(p,n),v,b,w,T,null,null,null,[_._globeTileDebugBorderBuffer]),l){let e=_.latestRawTileData,r=Math.floor((e&&e.byteLength||0)/1024),n=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(n+=` => ${a.overscaledZ}`),function(e,i){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,a=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.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(i,5,5),n.strokeText(i,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(i,n+=` ${_.state} ${r}kb`)}
98let S=512/Math.min(r.getTile(a).tileSize,512)*(a.overscaledZ/u.zoom)*.5,E=_._tileDebugTextBuffer||i.debugBuffer,M=_._tileDebugTextIndexBuffer||i.quadTriangleIndexBuffer,I=_._tileDebugTextSegments||i.debugSegments;m.draw(i,c.TRIANGLES,g,y,tW.alphaBlended,tJ.disabled,rL(p,e.bz.transparent,S),v,E,M,I,null,null,null,[_._globeTileDebugTextBuffer])}function ap(e,i,r,a){am(e,0,i+r/2,e.transform.width,r,a)}function af(e,i,r,a){am(e,i-r/2,0,r,e.transform.height,a)}function am(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:a_}=e.d5([{name:"a_pos_3f",components:3,type:"Float32"}]);function ag(e,i,r,a){e.emplaceBack(i,r,a)}class ay{constructor(i){this.vertexArray=new e.d9,this.indices=new e.aO,ag(this.vertexArray,-1,-1,1),ag(this.vertexArray,1,-1,1),ag(this.vertexArray,-1,1,1),ag(this.vertexArray,1,1,1),ag(this.vertexArray,-1,-1,-1),ag(this.vertexArray,1,-1,-1),ag(this.vertexArray,-1,1,-1),ag(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,a_),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=e.b1.simpleSegment(0,0,36,12)}}function ax(i,r,a,n,o,s){let l=i.context.gl,h=r.paint.get("sky-atmosphere-color"),u=r.paint.get("sky-atmosphere-halo-color"),c=r.paint.get("sky-atmosphere-sun-intensity"),d={u_matrix_3f:e.a6.mat3.fromMat4(e.a6.mat3.create(),n),u_sun_direction:o,u_sun_intensity:c,u_color_tint_r:[h.r,h.g,h.b,h.a],u_color_tint_m:[u.r,u.g,u.b,u.a],u_luminance:5e-5};l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_CUBE_MAP_POSITIVE_X+s,r.skyboxTexture,0),a.draw(i,l.TRIANGLES,tX.disabled,tY.disabled,tW.unblended,tJ.frontCW,d,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}let av=e.d5([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class ab{constructor(i){let r=new e.da;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);let a=new e.aO;a.emplaceBack(0,1,2),a.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(r,av.members),this.indexBuffer=i.createIndexBuffer(a),this.segments=e.b1.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let aw=e.d5([{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 aT{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class aS{constructor(i){this.colorModeAlphaBlendedWriteRGB=new tW([1,771,1,771],e.bz.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new tW([1,0,1,0],e.bz.transparent,[!1,!1,!1,!0]),this.params=new aT,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 ab(r);let i=this.params.sizeRange,a=this.params.intensityRange,n=function(i){let r=e.dd(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.a6.vec3.fromValues(Math.cos(n)*Math.cos(i),Math.cos(n)*Math.sin(i),Math.sin(n)))}return a}(this.params.starsCount),o=e.dd(300),s=new e.db,l=new e.aO,h=0;for(let r=0;r<n.length;++r){let u=e.a6.vec3.scale([],n[r],200),c=Math.max(0,1+.01*i*(1*o()-.5)),d=Math.max(0,1+.01*a*(1*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,aw.members),this.starsIdx=r.createIndexBuffer(l),this.starsSegments=e.b1.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 tX(n.LEQUAL,tX.ReadOnly,[0,1]),l=e.a9(o.zoom),h=i.style.getLut(r.scope),u=r.properties.get("color").toRenderColor(h).toArray01(),c=r.properties.get("high-color").toRenderColor(h).toArray01(),d=r.properties.get("space-color").toRenderColor(h).toArray01PremultipliedAlpha(),p=e.dc(r.properties.get("horizon-blend"),0,1,5e-4,.25),f=e.cx(i,a,o)&&5e-4===p?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,m=i.frameCounter/1e3%1,_=e.a6.vec3.length(o.globeCenterInViewSpace),g=Math.acos(Math.sqrt(Math.pow(_,2)-Math.pow(f,2))/_),y=e=>{let r,h,f;let _="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];e&&_.push("ALPHA_PASS");let y=i.getOrCreateProgram("globeAtmosphere",{defines:_}),x=(r=o.frustumCorners.TL,h=o.frustumCorners.TR,f=o.frustumCorners.BR,{u_frustum_tl:r,u_frustum_tr:h,u_frustum_br:f,u_frustum_bl:o.frustumCorners.BL,u_horizon:o.frustumCorners.horizon,u_transition:l,u_fadeout_range:p,u_color:u,u_high_color:c,u_space_color:d,u_temporal_offset:m,u_horizon_angle:g});i.uploadCommonUniforms(a,y);let v=this.atmosphereBuffer;v&&y.draw(i,n.TRIANGLES,s,tY.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,tJ.backCW,x,e?"atmosphere_glow_alpha":"atmosphere_glow",v.vertexBuffer,v.indexBuffer,v.segments)};y(!1),y(!0)}drawStars(i,r){let a=e.ap(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.a6.quat.identity([]);e.a6.quat.rotateX(h,h,-s._pitch),e.a6.quat.rotateZ(h,h,-s.angle),e.a6.quat.rotateX(h,h,e.bB(s._center.lat)),e.a6.quat.rotateY(h,h,-e.bB(s._center.lng));let u=e.a6.mat4.fromQuat(new Float32Array(16),h),c=e.a6.mat4.multiply([],s.starsProjMatrix,u),d=e.a6.mat3.fromMat4([],u),p=e.a6.mat3.invert([],d),f=[0,1,0];e.a6.vec3.transformMat3(f,f,p),e.a6.vec3.scale(f,f,this.params.sizeMultiplier);let m=[1,0,0];e.a6.vec3.transformMat3(m,m,p),e.a6.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,tX.disabled,tY.disabled,this.colorModeAlphaBlendedWriteRGB,tJ.disabled,_,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function aE(i,r){let a=[...i],n=r.cameraWorldSizeForFog/r.worldSize,o=e.a6.mat4.identity([]);return e.a6.mat4.scale(o,o,[n,n,1]),e.a6.mat4.multiply(a,o,a),e.a6.mat4.multiply(a,r.worldToFogMatrix,a),a}function aM(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",t3.BaseColor),f(u,"HAS_TEXTURE_u_metallicRoughnessTexture",t3.MetallicRoughness),f(c,"HAS_TEXTURE_u_normalTexture",t3.Normal),f(d,"HAS_TEXTURE_u_occlusionTexture",t3.Occlusion),f(p,"HAS_TEXTURE_u_emissionTexture",t3.Emission),o&&(o.texture||(o.texture=new e.df(n.context,o.image,[o.image.height,o.image.height,o.image.height],l.gl.RGBA8)),l.activeTexture.set(l.gl.TEXTURE0+t3.LUT),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"),i.push("USE_STANDARD_DERIVATIVES")}function aI(i,r,a,n,o,s){let l;let h=a.paint.get("model-opacity"),u=r.context,c=new tX(r.context.gl.LEQUAL,tX.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.a6.mat4.multiply([],n.zScaleMatrix,i.nodeModelMatrix),e.a6.mat4.multiply(l,n.negCameraPosMatrix,l);let g=e.a6.mat4.invert([],l);e.a6.mat4.transpose(g,g);let y=a.paint.get("model-emissive-strength").constantOr(0),x=rW(new Float32Array(i.worldViewProjection),new Float32Array(l),new Float32Array(g),null,r,h,m.baseColorFactor.toRenderColor(null),f.emissiveFactor,m.metallicFactor,m.roughnessFactor,f,y,a),v={defines:[]},b=[];aM(v.defines,b,p,r,a.lut);let w=r.shadowRenderer;w&&(w.useNormalOffset=!1);let T=null;if(_){let e=aE(i.nodeModelMatrix,r.transform);if(T=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]);v.overrideFog=a>=.05||n>=.05}}
98let S=t9(r,a.paint.get("model-cutoff-fade-range"));S.shouldRenderCutoff&&v.defines.push("RENDER_CUTOFF");let E=r.getOrCreateProgram("model",v);r.uploadCommonUniforms(u,E,null,T,S),"shadow"!==r.renderPass&&w&&w.setupShadowsFromMatrix(i.nodeModelMatrix,E),E.draw(r,u.gl.TRIANGLES,c,o,s,p.material.doubleSided?tJ.disabled:tJ.backCCW,x,a.id,p.vertexBuffer,p.indexBuffer,p.segments,a.paint,r.transform.zoom,void 0,b)}function aA(e,i,r,a){let n=r.shadowRenderer;if(!n)return;let o=n.getShadowPassDepthMode(),s=n.getShadowPassColorMode(),l=rX(n.calculateShadowPassMatrixFromMatrix(i));r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,o,tY.disabled,s,tJ.backCCW,l,a.id,e.vertexBuffer,e.indexBuffer,e.segments,a.paint,r.transform.zoom,void 0,void 0)}let aC={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.c9([0,0,0],[e.ab,e.ab,0])},aP=[1,-1,1];class az{}class aD{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.dk;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 az;return c.buf=new rJ(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 aR{constructor(e){this.occluderSize=30,this.depthOffset=-.0001,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}let aL={symbol:function(i,r,a,n,o){if("translucent"!==i.renderPass)return;let s=tY.disabled,l=i.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(i,r,a,n,o,s,l){let h=r.transform,u="map"===o,c="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.bj(o.textSizeData,h.zoom),d=tA(r,o.getProjection(),h),p=h.calculatePixelsToTileUnitsMatrix(i),f=td(d,i.tileID.canonical,c,u,h,o.getProjection(),p),m=o.hasIconTextFit()&&o.hasIconData();if(s){let a=Math.pow(2,h.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=tA(h,g,s),x=s.elevation,v=g.upVectorScale(h.canonical,s.center.lat,s.worldSize).metersToTile;f.clear();for(let m=0;m<p.length;m++){let b=p.get(m),{tileAnchorX:w,tileAnchorY:T,numGlyphs:S}=b,E=b.hidden||!b.crossTileID||i.allowVerticalPlacement&&!b.placedOrientation?null:n[b.crossTileID];if(E){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[M,I,A,C]=tm(b.projectedAnchorX+n,b.projectedAnchorY+p,b.projectedAnchorZ+m,a?y:l),P=t_(s.getCameraToCenterDistance(g),C),z=o.evaluateSizeForFeature(i.textSizeData,c,b)*P/e.bq;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.bx(a),u=e.bw(a,n);return new e.P((-(l-.5)*i/o+u[0])*s,(-(h-.5)*r/o+u[1])*s)}(E,z);a?({x:M,y:I,z:A}=g.projectTilePoint(w+D.x,T+D.y,h.canonical),[M,I,A]=tm(M+n,I+p,A+m,l)):(r&&D._rotate(-s.angle),M+=D.x,I+=D.y,A=0);let R=i.allowVerticalPlacement&&b.placedOrientation===e.bk.vertical?Math.PI/2:0;for(let i=0;i<S;i++)e.bn(f,M,I,A,R);d&&b.associatedIconIndex>=0&&(_[b.associatedIconIndex]={x:M,y:I,z:A,angle:R})}else tS(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)tS(n,m);else{let{x:i,y:r,z:a,angle:s}=o;for(let o=0;o<n;o++)e.bn(m,i,r,a,s)}}i.icon.dynamicLayoutVertexBuffer.updateData(m)}i.text.dynamicLayoutVertexBuffer.updateData(f)}(o,u,c,l,e.cS,h,f,r,a,s,m)}}}(n,i,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),o);let h=0!==a.paint.get("icon-opacity").constantOr(1),u=0!==a.paint.get("text-opacity").constantOr(1);void 0!==a.layout.get("symbol-sort-key").constantOr(1)&&(h||u)?r5(i,r,a,n,s,l):(h&&r5(i,r,a,n,s,l,{onlyIcons:!0}),u&&r5(i,r,a,n,s,l,{onlyText:!0})),r.map.showCollisionBoxes&&(r2(i,r,a,n,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),r2(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("
98circle-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,tX.ReadOnly),m=tY.disabled,_=i.colorModeForDrapableLayerRenderPass(u),g="globe"===p.projection.name,y=[e.am(p.center.lng),e.at(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.cT(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.cU(i,s,l,w,y,a),tile:l};if(h)for(let i of u.segments.get())x.push({segments:new e.b1([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,_,tJ.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=tY.disabled,h=new tW([s.ONE,s.ONE,s.ONE,s.ONE],e.bz.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)){l&&l.destroy();let i=n.createTexture();n.bindTexture(n.TEXTURE_2D,i),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),function(e,i,r,a,n,o){let s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,n,o,0,s.RGBA,e.extRenderToTextureHalfFloat?s.HALF_FLOAT:s.UNSIGNED_BYTE,null),a.colorAttachment.set(r)}(e,0,i,l,o,s)}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.bz.transparent});let u=i.transform,c="globe"===u.projection.name,d=c?["PROJECTION_GLOBE_VIEW"]:[],p=c?tJ.frontCCW:tJ.disabled,f=[e.am(u.center.lng),e.at(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,tX.disabled,l,h,p,rO(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,tX.disabled,tY.disabled,i.colorModeForRenderPass(),tJ.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=i.context,d=c.gl,p=a.layout.get("line-z-offset"),f=!p.isConstant()||!!p.constantOr(0),m=f?new tX(i.depthOcclusion?d.GREATER:d.LEQUAL,tX.ReadOnly,i.depthRangeFor3D):i.depthModeForSublayer(0,tX.ReadOnly),_=i.colorModeForDrapableLayerRenderPass(h),g=i.terrain&&i.terrain.renderingToTexture,y=g?1:e.q.devicePixelRatio,x=a.paint.get("line-dasharray"),v=x.constantOr(1),b=a.layout.get("line-cap"),w=x.constantOr(null),T=b.constantOr(null),S=a.paint.get("line-pattern"),E=S.constantOr(1),M=S.constantOr(null),I=a.paint.get("line-opacity").constantOr(1),A=!E&&1!==I||i.depthOcclusion&&u>0&&u<1,C=a.paint.get("line-gradient"),P=E?"linePattern":"line",z=e.cV(a);if(g&&i.terrain&&i.terrain.clipOrMaskOverlapStencilType()&&(A=!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.`)}if(f&&(i.forceTerrainMode=!0),!f&&0!==u&&i.terrain&&!g)return void e.w(`Occlusion opacity for layer ${a.id} is supported on terrain only if the layer has non-zero line-z-offset.`);let D=A&&f?i.stencilModeFor3D():tY.disabled;for(let s of n){let n=r.getTile(s);if(E&&!n.patternsLoaded())continue;let l=n.getBucket(a);if(!l)continue;i.prepareDrawTile();let h=l.programConfigurations.get(a.id),p=i.isTileAffectedByFog(s),x=i.getOrCreateProgram(P,{config:h,defines:f?[...z,"ELEVATED"]:z,overrideFog:p});if(M&&n.imageAtlas){let e=n.imageAtlas.patternPositions[M.toString()];e&&h.setConstantPatternPositions(e)}if(!E&&w&&T&&n.lineAtlas){let e=n.lineAtlas.getDash(w,T);e&&h.setConstantPatternPositions(e)}let[b,S]=a.paint.get("line-trim-offset");("round"===T||"square"===T)&&b!==S&&(0===b&&(b-=1),1===S&&(S+=1));let R=g?s.projMatrix:null,L=E?e.cW(i,n,a,R,y,[b,S]):e.cX(i,n,a,R,l.lineClipsArray.length,y,[b,S]);if(C){let n=l.gradients[a.id],o=n.texture;if(a.gradientVersion!==n.version){let h=256;if(a.stepInterpolant){let a=r.getSource().maxzoom,n=s.canonical.z===a?Math.
98ceil(1<<i.transform.maxZoom-s.canonical.z):1;h=e.ap(e.cY(l.maxLineLength/e.ab*1024*n),256,c.maxTextureSize)}n.gradient=e.cZ({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:h,image:n.gradient||void 0,clips:l.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(c,n.gradient,d.RGBA8),n.version=a.gradientVersion,o=n.texture}c.activeTexture.set(d.TEXTURE1),o.bind(a.stepInterpolant?d.NEAREST:d.LINEAR,d.CLAMP_TO_EDGE)}v&&(c.activeTexture.set(d.TEXTURE0),n.lineAtlasTexture&&n.lineAtlasTexture.bind(d.LINEAR,d.REPEAT),h.updatePaintBuffers()),E&&(c.activeTexture.set(d.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),h.updatePaintBuffers()),f&&i.terrain.setupElevationDraw(n,x),i.uploadCommonUniforms(c,x,s.toUnwrapped());let k=e=>{null!=o&&(o.value=I*u),x.draw(i,d.TRIANGLES,m,e,_,tJ.disabled,L,a.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,a.paint,i.transform.zoom,h,[l.layoutVertexBuffer2,l.patternVertexBuffer,l.zOffsetVertexBuffer]),null!=o&&(o.value=I)};if(A&&!f){let e=i.stencilModeForClipping(s).ref;0===e&&g&&c.clear({stencil:0});let r={func:d.EQUAL,mask:255};L.u_alpha_discard_threshold=.8,k(new tY(r,e,255,d.KEEP,d.KEEP,d.INVERT)),L.u_alpha_discard_threshold=0,k(new tY(r,e,255,d.KEEP,d.KEEP,d.KEEP))}else A&&f&&(L.u_alpha_discard_threshold=.001),k(f?D:i.stencilModeForClipping(s))}A&&(i.resetStencilClippingMasks(),g&&c.clear({stencil:0})),0===u||i.depthOcclusion||g||i.layersWithOcclusionOpacity.push(i.currentLayer),f&&(i.forceTerrainMode=!1)},fill:function(i,r,a,n){let o=a.paint.get("fill-color"),s=a.paint.get("fill-opacity"),l=a.is3D(),h=new tX(i.context.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D);if(0===s.constantOr(1))return;let u=a.paint.get("fill-emissive-strength"),c=i.colorModeForDrapableLayerRenderPass(u),d=a.paint.get("fill-pattern"),p=i.opaquePassEnabledForLayer()&&!d.constantOr(1)&&1===o.constantOr(e.bz.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(i.renderPass===p){let e=l?h:i.depthModeForSublayer(1,"opaque"===i.renderPass?tX.ReadWrite:tX.ReadOnly);r8(i,r,a,n,e,c,!1)}if(!l&&"translucent"===i.renderPass&&a.paint.get("fill-antialias")){let e=l?h:i.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,tX.ReadOnly);r8(i,r,a,n,e,c,!0)}},"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;let u=i=>new e.P(Math.ceil((i+e.d2)*e.d3),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.ab-r.min.x>i.max.x?r.min.x-e.ab: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.ab-r.min.y>i.max.y?r.min.y-e.ab: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.ab+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.c$[i](a),h=c(o);if(!(h&&h instanceof e.d0)||n.borderDoneWithNeighborZ[i]===h.canonical.z)continue;0===h.centroidVertexArray.length&&h.createCentroidsBuffer();let d=s?s.findDEMTileFor(o):null;if(!(d&&d.dem||l))continue;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;let 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.d1?(c.flags|=e.d1,b.flags|=e.d1):(c.flags&=~e.d1,b.flags&=~e.d1));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.ab-1:0,n=_(r[0],Math.min(e.ab-1,r[1]),a,d,o,i<2,r[2]);c.centroidXY=b.centroidXY=u(n)}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.a4)return;let l=s.getShadowPassDepthMode(),u=s.getShadowPassColorMode();r9(i,r,a,n,l,tY.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.bz.white);if(!u&&0!==p.a){let e=new tX(i.context.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D);1===o&&d?r9(i,r,a,n,e,tY.disabled,tW.unblended,c):(r9(i,r,a,n,e,tY.disabled,tW.disabled,c),r9(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=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),_=d>0&&p>0,g=f>0,y=(e,i,r)=>(1-r)*e+r*i,x=s=>{let h=i.depthModeForSublayer(1,tX.ReadOnly,l.LEQUAL,!0),u=y(.1,3,a.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation")),_=i._showOverdrawInspector;_||r7(i,r,a,n,h,new tY({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),new tW([l.ONE,l.ONE,l.ONE,l.ONE],e.bz.transparent,[!1,!1,!1,!0],l.MIN),tJ.disabled,s,"sdf",o,d,p,f,m,u,c,!1);{let g=_?tY.disabled:new tY({func:l.EQUAL,mask:255},255,255,l.KEEP,l.DECR,l.DECR),y=_?i.colorModeForRenderPass():new tW([l.ONE_MINUS_DST_ALPHA,l.DST_ALPHA,l.ONE,l.ONE],e.bz.transparent,[!0,!0,!0,!0]);r7(i,r,a,n,h,g,y,tJ.disabled,s,"color",o,d,p,f,m,u,c,!1)}};if(u){let u=(s,h,u)=>{let _=i.depthModeForSublayer(1,tX.ReadOnly,l.LEQUAL,!1),g=y(.1,3,a.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"));{let u=new tW([l.ONE,l.ONE,l.ONE,l.ONE],e.bz.transparent,[!1,!1,!1,!0]);r7(i,r,a,n,_,tY.disabled,u,tJ.disabled,s,"clear",o,d,p,f,m,g,c,h)}r7(i,r,a,n,_,new tY({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),new tW([l.ONE,l.ONE,l.ONE,l.ONE],e.bz.transparent,[!1,!1,!1,!0],l.MIN),tJ.disabled,s,"sdf",o,d,p,f,m,g,c,h);{let u=s?l.ZERO:l.ONE_MINUS_DST_ALPHA;r7(i,r,a,n,_,new tY({func:l.EQUAL,mask:255},255,255,l.KEEP,l.DECR,l.DECR),new tW([u,l.DST_ALPHA,l.ONE_MINUS_DST_ALPHA,l.ZERO],e.bz.transparent,[!0,!0,!0,!0]),tJ.disabled,s,"color",o,d,p,f,m,g,c,h)}{let y=new tW([l.ONE,l.ONE,l.ONE,s?l.ZERO:l.ONE],e.bz.transparent,[!1,!1,!1,!0],s?l.FUNC_ADD:l.MAX);r7(i,r,a,n,_,tY.disabled,y,tJ.disabled,s,"clear",o,d,p,f,m,g,c,h,u)}};if(_||g){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.copyTexImage2D(l.TEXTURE_2D,0,l.RGBA,0,0,i,a,0)}_&&u(!0,!1,r),g&&u(!1,!0,r)}}else _&&x(!0),g&&x(!1),(_||g)&&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){let n=i.context,o=n.gl;if(!r.dem)return;let s=r.dem;if(n.activeTexture.set(o.TEXTURE1),ik(i,r,s),!r.demTexture)return;r.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);let l=s.dim;n.activeTexture.set(o.TEXTURE0);let h=r.hillshadeFBO;if(!h){let i=new e.T(n,{width:l,height:l,data:null},o.RGBA8);i.bind(o.LINEAR,o.CLAMP_TO_EDGE),(h=r.hillshadeFBO=n.createFramebuffer(l,l,!0,"renderbuffer")).colorAttachment.set(i.texture)}n.bindFramebuffer.set(h.framebuffer),n.viewport.set([0,0,l,l]);let{tileBoundsBuffer:u,tileBoundsIndexBuffer:c,tileBoundsSegments:d}=i.getMercatorTileBoundsBuffers(),p=[];i.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT"),i.getOrCreateProgram("hillshadePrepare",{defines:p}).draw(i,o.TRIANGLES,tX.disabled,tY.disabled,tW.unblended,tJ.disabled,((i,r)=>{let a=r.stride,n=e.a6.mat4.create();return e.a6.mat4.ortho(n,0,e.ab,-e.ab,0,0,1),e.a6.mat4.translate(n,n,[0,-e.ab,0]),{u_matrix:n,u_image:1,u_dimension:[a,a],u_zoom:i.overscaledZ}})(r.tileID,s),a.id,u,c,d),r.needsHillshadePrepare=!1}(i,o,a);else if("translucent"===i.renderPass){let r=i.depthModeForSublayer(0,tX.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)=>{let o=a.paint.get("hillshade-shadow-color"),s=a.paint.get("hillshade-highlight-color"),l=a.paint.get("hillshade-accent-color"),h=a.paint.get("hillshade-emissive-strength"),u=e.bB(a.paint.get("hillshade-illumination-direction"));if("viewport"===a.paint.get("hillshade-illumination-anchor"))u-=i.transform.angle;else if(i.style&&i.style.enable3dLights()&&i.style.directionalLight){let r=i.style.directionalLight.properties.get("direction"),a=e.c7(r.x,r.y,r.z);u=e.bB(a[1])}let c=!i.options.moving;return{u_matrix:n||i.transform.calculateProjMatrix(r.tileID.toUnwrapped(),c),u_image:0,u_latrange:function(i,r){let a=Math.pow(2,r.canonical.z),n=r.canonical.y;
98return[new e.a5(0,n/a).toLngLat().lat,new e.a5(0,(n+1)/a).toLngLat().lat]}(0,r.tileID),u_light:[a.paint.get("hillshade-exaggeration"),u],u_shadow:o.toRenderColor(a.lut),u_highlight:s.toRenderColor(a.lut),u_emissive_strength:h,u_accent:l.toRenderColor(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,tJ.disabled,f,n.id,m,_,g)}(i,n,o,a,r,c,u)}}o.viewport.set([0,0,i.width,i.height]),i.resetStencilClippingMasks()},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.aD&&!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.aD&&!n.length&&(p.onNorthPole||p.onSouthPole)){let e=h?i.stencilModeFor3D():tY.disabled;return void aa(!!p.onNorthPole,null,i,r,a,m,f,tJ.disabled,e)}if(!n.length)return;let[v,b]=p instanceof e.aD||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,E,M,I;let A=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 e$&&e instanceof e3?i.getTextureDescriptor(e,r,!0):{texture:e.texture,mix:ar(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:k}=P;g?(n=tX.disabled,S=T.projMatrix):h?(n=new tX(d.LEQUAL,tX.ReadWrite,i.depthRangeFor3D),S=l?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(A,y)):(n=i.depthModeForSublayer(T.overscaledZ-w,1===a.paint.get("raster-opacity")?tX.ReadWrite:tX.ReadOnly,d.LESS),S=i.transform.calculateProjMatrix(A,y));let O=i.terrain&&g?i.terrain.stencilModeForRTTOverlap(T):v[T.overscaledZ],B=s?0:a.paint.get("raster-fade-duration");C.registerFadeDuration(B);let F=r.findLoadedParent(T,0),N=r_(C,F,r,i.transform,B);i.terrain&&i.terrain.prepareDrawTile(),c.activeTexture.set(d.TEXTURE0),z.bind(x,d.CLAMP_TO_EDGE),c.activeTexture.set(d.TEXTURE1),F?(F.texture&&F.texture.bind(x,d.CLAMP_TO_EDGE),E=Math.pow(2,F.tileID.overscaledZ-C.tileID.overscaledZ),M=[C.tileID.canonical.x*E%1,C.tileID.canonical.y*E%1]):z.bind(x,d.CLAMP_TO_EDGE),z.useMipmap&&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.aD&&p.coordinates.length>3)j=Float32Array.from(e.b5(e.cC(new e.bP(0,0,0)))),G=Float32Array.from(V.globeMatrix),q=Float32Array.from(e.cy(V)),Z=[e.am(V.center.lng),e.at(V.center.lat)],I=p.elevatedGlobePerspectiveTransform,$=p.elevatedGlobeGridMatrix||new Float32Array(9);else if(u){let i=e.cz(T.canonical);H=e.cA(i.getCenter().lat),j=Float32Array.from(e.b5(e.cC(T.canonical))),G=Float32Array.from(V.globeMatrix),q=Float32Array.from(e.cy(V)),Z=[e.am(V.center.lng),e.at(V.center.lat)],I=[0,0],$=Float32Array.from(e.cB(T.canonical,i,H,V.worldSize/V._pixelsPerMercatorPixel))}else I=p instanceof e.aD?p.perspectiveTransform:[0,0],j=new Float32Array(16),G=new Float32Array(9),q=new Float32Array(16),Z=[0,0],$=new Float32Array(9);let W=rN(S,j,G,q,$,M||[0,0],e.a9(i.transform.zoom),Z,U,E||1,N,a,I,h?a.paint.get("raster-elevation"):0,2,D,R,f.range,L,k,m),X=i.isTileAffectedByFog(T),Y=i.getOrCreateProgram("raster",{defines:f.defines,overrideFog:X});if(i.uploadCommonUniforms(c,Y,A),p instanceof e.aD){let r=p.elevatedGlobeVertexBuffer,s=p.elevatedGlobeIndexBuffer;if(g||!l)p.boundsBuffer&&p.boundsSegments&&Y.draw(i,d.TRIANGLES,n,tY.disabled,_,tJ.disabled,W,a.id,p.boundsBuffer,i.quadTriangleIndexBuffer,p.boundsSegments);else if(r&&s){let l=V.zoom<=e.c2?p.elevatedGlobeSegments:p.getSegmentsForLongitude(V.center.lng);l&&Y.draw(i,d.TRIANGLES,n,tY.disabled,_,o,W,a.id,r,s,l)}}else if(u){n=new tX(d.LEQUAL,tX.ReadOnly,i.depthRangeFor3D);let e=i.globeSharedBuffers;if(e){let[r,s,l]=e.getGridBuffers(H,!1);Y.draw(i,d.TRIANGLES,n,b||O,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,O,_,tJ.disabled,W,a.id,e,r,o)}}if(!(p instanceof e.aD)&&u)for(let e of n){let n=e.canonical.y===(1<<e.canonical.z)-1;0===e.canonical.y&&aa(!0,e,i,r,a,m,f,o,b||tY.disabled),n&&aa(!1,e,i,r,a,m,f,o===tJ.frontCW?tJ.backCW:tJ.frontCW,b||tY.disabled)}};u?T(b,i.renderElevatedRasterBackface?tJ.backCW:tJ.frontCW,i.stencilModeFor3D()):T(b,tJ.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 e$))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(2747636419^e,2654435769))^e>>>16,2654435769))^e>>>16,2654435769))>>>0)/4294967296},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 e3))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=rB(e.d7,s,[0,a.paint.get("raster-particle-max-speed")]),l=rF(e.d7,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 ao(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.bz.transparent}),c&&(a.backgroundColorTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),u.draw(i,s.TRIANGLES,tX.disabled,tY.disabled,tW.alphaBlended,tJ.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.c$[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=rU(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,tX.disabled,tY.disabled,tW.alphaBlended,tJ.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+1*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=rj(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.bz.transparent}),i.getOrCreateProgram("rasterParticleUpdate",{defines:a.defines}).draw(i,s.TRIANGLES,tX.disabled,tY.disabled,tW.unblended,tJ.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,o){let s=i.context,l=s.gl,h=r.getSource().tileSize,u=5*(1-e.a7(e.bU,e.bU+1,i.transform.zoom))*h+a.paint.get("raster-particle-elevation"),c=!i.options.moving,d="globe"===i.transform.projection.name;if(!n.length)return;let[p,f]=i.stencilConfigForOverlap(n),m=[];d&&m.push("PROJECTION_GLOBE_VIEW");let _=i.stencilModeFor3D();for(let n of f){let o,h,f,g,y,x,v;let b=n.toUnwrapped(),w=r.getTile(n);if(!w.rasterParticleState)continue;let T=w.rasterParticleState;w.registerFadeDuration(100);let S=r.findLoadedParent(n,0),E=r_(w,S,r,i.transform,100);i.terrain&&i.terrain.prepareDrawTile(),s.activeTexture.set(l.TEXTURE0),T.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE1),S&&S.rasterParticleState?(S.rasterParticleState.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),o=Math.pow(2,S.tileID.overscaledZ-w.tileID.overscaledZ
98),h=[w.tileID.canonical.x*o%1,w.tileID.canonical.y*o%1]):T.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE);let M=d?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(b,c),I=i.transform,A=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]}(I),C=e.cz(n.canonical),P=e.cA(C.getCenter().lat);d?(f=Float32Array.from(e.b5(e.cC(n.canonical))),g=Float32Array.from(I.globeMatrix),y=Float32Array.from(e.cy(I)),x=[e.am(I.center.lng),e.at(I.center.lat)],v=Float32Array.from(e.cB(n.canonical,C,P,I.worldSize/I._pixelsPerMercatorPixel))):(f=new Float32Array(16),g=new Float32Array(9),y=new Float32Array(16),x=[0,0],v=new Float32Array(9));let z=rV(M,f,g,y,v,h||[0,0],e.a9(i.transform.zoom),x,A,o||1,E,u),D=i.isTileAffectedByFog(n),R=i.getOrCreateProgram("rasterParticle",{defines:m,overrideFog:D});if(i.uploadCommonUniforms(s,R,b),d){let e=new tX(l.LEQUAL,tX.ReadOnly,i.depthRangeFor3D),r=i.globeSharedBuffers;if(r){let[n,o,s]=r.getGridBuffers(P,!1);R.draw(i,l.TRIANGLES,e,_,tW.alphaBlended,i.renderElevatedRasterBackface?tJ.frontCCW:tJ.backCCW,z,a.id,n,o,s)}}else{let e=i.depthModeForSublayer(0,tX.ReadOnly),r=p[n.overscaledZ],{tileBoundsBuffer:o,tileBoundsIndexBuffer:s,tileBoundsSegments:h}=i.getTileBoundsBuffers(w);R.draw(i,l.TRIANGLES,e,r,tW.alphaBlended,tJ.disabled,z,a.id,o,s,h)}}i.resetStencilClippingMasks()}(i,r,a,n),i.style.map.triggerRepaint())},background:function(i,r,a,n){let o;let s=a.paint.get("background-color"),l=a.paint.get("background-opacity"),h=a.paint.get("background-emissive-strength"),u="viewport"===a.paint.get("background-pitch-alignment");if(0===l)return;let c=i.context,d=c.gl,p=i.transform,f=p.tileSize,m=a.paint.get("background-pattern");if(void 0!==m&&(null===m||!(o=i.imageManager.getPattern(m.toString(),a.scope,i.style.getLut(a.scope)))))return;let _=!m&&1===s.a&&1===l&&i.opaquePassEnabledForLayer()?"opaque":"translucent";if(i.renderPass!==_)return;let g=tY.disabled,y=i.depthModeForSublayer(0,"opaque"===_?tX.ReadWrite:tX.ReadOnly),x=i.colorModeForDrapableLayerRenderPass(h),v=m?"backgroundPattern":"background",b,w=n;if(w||(w=Object.values(b=i.getBackgroundTiles()).map(e=>e.tileID)),m&&(c.activeTexture.set(d.TEXTURE0),i.imageManager.bind(i.context,a.scope)),u){let r=i.getOrCreateProgram(v,{overrideFog:!1,overrideRtt:!0}),n=new Float32Array(e.a6.mat4.identity([])),c=new e.aA(0,0,0,0,0),p=m?r$(n,h,l,i,0,a.scope,o,u,{tileID:c,tileSize:f}):rZ(n,h,l,s.toRenderColor(a.lut));r.draw(i,d.TRIANGLES,y,g,x,tJ.disabled,p,a.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments)}else for(let e of w){let _=i.isTileAffectedByFog(e),w=i.getOrCreateProgram(v,{overrideFog:_}),T=e.toUnwrapped(),S=n?e.projMatrix:i.transform.calculateProjMatrix(T);i.prepareDrawTile();let E=r?r.getTile(e):b?b[e.key]:new e2(e,f,p.zoom,i),M=m?r$(S,h,l,i,0,a.scope,o,u,{tileID:e,tileSize:f}):rZ(S,h,l,s.toRenderColor(a.lut));i.uploadCommonUniforms(c,w,T);let{tileBoundsBuffer:I,tileBoundsIndexBuffer:A,tileBoundsSegments:C}=i.getTileBoundsBuffers(E);w.draw(i,d.TRIANGLES,y,g,x,tJ.disabled,M,a.id,I,A,C)}},sky:function(i,r,a){let n=i._atmosphere?e.a9(i.transform.zoom):1,o=a.paint.get("sky-opacity")*n;if(0===o)return;let s=i.context,l=a.paint.get("sky-type"),h=new tX(s.gl.LEQUAL,tX.ReadOnly,[0,1]),u=i.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===i.renderPass?a.needsSkyboxCapture(i)&&(function(i,r,a,n){let o=i.context,s=o.gl,l=r.skyboxFbo;if(!l){l=r.skyboxFbo=o.createFramebuffer(32,32,!0,null),r.skyboxGeometry=new ay(o),r.skyboxTexture=o.gl.createTexture(),s.bindTexture(s.TEXTURE_CUBE_MAP,r.skyboxTexture),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,s.LINEAR);for(let e=0;e<6;++e)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,s.RGBA,32,32,0,s.RGBA,s.UNSIGNED_BYTE,null)}o.bindFramebuffer.set(l.framebuffer),o.viewport.set([0,0,32,32]);let h=r.getCenter(i,!0),u=i.getOrCreateProgram("skyboxCapture"),c=new Float64Array(16);e.a6.mat4.identity(c),e.a6.mat4.rotateY(c,c,-(.5*Math.PI)),ax(i,r,u,c,h,0),e.a6.mat4.identity(c),e.a6.mat4.rotateY(c,c,.5*
98Math.PI),ax(i,r,u,c,h,1),e.a6.mat4.identity(c),e.a6.mat4.rotateX(c,c,-(.5*Math.PI)),ax(i,r,u,c,h,2),e.a6.mat4.identity(c),e.a6.mat4.rotateX(c,c,.5*Math.PI),ax(i,r,u,c,h,3),e.a6.mat4.identity(c),ax(i,r,u,c,h,4),e.a6.mat4.identity(c),e.a6.mat4.rotateY(c,c,Math.PI),ax(i,r,u,c,h,5),o.viewport.set([0,0,i.width,i.height])}(i,a),a.markSkyboxValid(i)):"sky"===i.renderPass&&function(e,i,r,a,n){let o=e.context,s=o.gl,l=e.transform,h=e.getOrCreateProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture);let u={u_matrix:l.skyboxMatrix,u_sun_direction:i.getCenter(e,!1),u_cubemap:0,u_opacity:a,u_temporal_offset:n};e.uploadCommonUniforms(o,h),h.draw(e,s.TRIANGLES,r,tY.disabled,e.colorModeForRenderPass(),tJ.backCW,u,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(i,a,h,o,u):"gradient"===l&&"sky"===i.renderPass&&function(i,r,a,n,o){let s,l,h;let u=i.context,c=u.gl,d=i.transform,p=i.getOrCreateProgram("skyboxGradient");r.skyboxGeometry||(r.skyboxGeometry=new ay(u)),u.activeTexture.set(c.TEXTURE0);let f=r.colorRampTexture;f||(f=r.colorRampTexture=new e.T(u,r.colorRamp,c.RGBA8)),f.bind(c.LINEAR,c.CLAMP_TO_EDGE);let m=(s=d.skyboxMatrix,l=r.getCenter(i,!1),h=r.paint.get("sky-gradient-radius"),{u_matrix:s,u_color_ramp:0,u_center_direction:l,u_radius:e.bB(h),u_opacity:n,u_temporal_offset:o});i.uploadCommonUniforms(u,p),p.draw(i,c.TRIANGLES,a,tY.disabled,i.colorModeForRenderPass(),tJ.backCW,m,"skyboxGradient",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}(i,a,h,o,u)},debug:function(i,r,a,n,o,s){for(let l=0;l<a.length;l++)if(o){let o=new e.bz(.8*n.r,.8*n.g,.8*n.b,1);ad(i,r,a[l],n,-1,-1,s),ad(i,r,a[l],n,-1,1,s),ad(i,r,a[l],n,1,1,s),ad(i,r,a[l],n,1,-1,s),ad(i,r,a[l],o,0,0,s)}else ad(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.a9(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.a5(a.x+n[0].wrap*(1<<a.z),a.y,a.z);o.setDepthMode(tX.disabled),o.setStencilMode(tY.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(tY.disabled);let r="3d"===s.renderingMode?new tX(i.context.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D):i.depthModeForSublayer(0,tX.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.a9(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");if(0===o)return;let s=a.paint.get("model-cast-shadows");if("shadow"===i.renderPass&&(!s||i.terrain&&o<.65&&a._transitionablePaint._values["model-opacity"].value.expression instanceof e.a4))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 void 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={...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);let _=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.ap(n.x,s,l)-n.x,p=e.ap(n.y,h,u)-n.y,f=e.bD(c,r.center.lat)-n.z;return r._zoomFromMercatorZ(Math.sqrt(d*d+p*p+f*f))}(f,s);d.zoom=_;let g=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.di.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),aC.shadowUniformsInitialized=!1,aC.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(aC.tileMatrix.set(r),aC.shadowTileMatrix=Float32Array.from(u.calculateShadowPassMatrixFromMatr
98ix(r)),aC.aabb.min.fill(0),aC.aabb.max[0]=aC.aabb.max[1]=e.ab,aC.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.a6.vec3.transformMat4(l.min,l.min,r.tileMatrix),e.a6.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,aC,i,a.scope))continue}let y=1<<f.canonical.z,x=[((l.x-f.wrap)*y-f.canonical.x)*e.ab,(l.y*y-f.canonical.y)*e.ab,l.z*y*e.ab];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=g.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 tX(h.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D),p=i.isTileAffectedByFog(s);if(a.meshes)for(let e of a.meshes){let f,m,_;let g=["MODEL_POSITION_ON_GPU"],y=[];n.instancedDataArray.length>20&&g.push("INSTANCED_ARRAYS");let x=t9(i,r.paint.get("model-cutoff-fade-range"));if(x.shouldRenderCutoff&&g.push("RENDER_CUTOFF"),u&&c)f=i.getOrCreateProgram("modelDepth",{defines:g}),m=rX(l.shadowTileMatrix,l.shadowTileMatrix,Float32Array.from(a.matrix)),_=c.getShadowPassColorMode();else{aM(g,y,e,i,r.lut),f=i.getOrCreateProgram("model",{defines:g,overrideFog:p});let n=e.material,u=n.pbrMetallicRoughness,d=r.paint.get("model-opacity"),v=r.paint.get("model-emissive-strength").constantOr(0);m=rW(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?tW.alphaBlended:tW.unblended}i.uploadCommonUniforms(h,f,s.toUnwrapped(),null,x);let v=e.material.doubleSided?tJ.disabled:tJ.backCCW;if(n.instancedDataArray.length>20)y.push(n.instancedDataBuffer),f.draw(i,h.gl.TRIANGLES,d,tY.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,tY.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,x,f,aC)}}}(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 void e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);let u=i.transform.getFreeCameraOptions().position,c=e.a6.vec3.scale([],[u.x,u.y,u.z],i.transform.worldSize),d=e.a6.vec3.negate([],c),p=e.a6.mat4.identity([]),f=e.de(s.center.lat,s.zoom),m=e.a6.mat4.fromScaling([],[1,1,1/f]);e.a6.mat4.translate(p,p,d);let _=a.paint.get("model-opacity"),g=new tX(o.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D),y=new tX(o.gl.LEQUAL,tX.ReadOnly,i.depthRangeFor3D),x=new e.c9([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=t9
98(i,a.paint.get("model-cutoff-fade-range")),E=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&&(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,M;T?(u=n.length-1,d=-1,M=-1):(u=0,d=n.length,M=1);let I=new Float64Array(16),A=e.a6.vec3.create(),C=new e.P(0,0);for(let P=u;P!==d;P+=M){let u=n[P],d=r.getTile(u).getBucket(a);if(!d||!d.uploaded)continue;let M=!1;h&&(M=0===h.getMaxCascadeForTile(u.toUnwrapped()));let z=s.calculatePosMatrix(u.toUnwrapped(),s.worldSize),D=d.modelTraits;!v&&T&&(e.a6.mat4.invert(I,z),e.a6.vec3.transformMat4(A,c,I),C.x=A[0],C.y=A[1]);let R=[];for(let r of 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.a6.vec3.transformMat4(x.min,x.min,z),e.a6.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.bu(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.a6.mat4.translate(h,h,[u*(l[0]-1),d*(l[1]-1),n]),e.a6.vec3.exactEquals(l,e.dh)||e.a6.mat4.scale(h,h,l);let p=e.a6.mat4.multiply([],h,a.matrix),m=e.a6.mat4.multiply([],s.expandedFarZProjMatrix,p),g=e.a6.mat4.multiply([],s.expandedFarZProjMatrix,h),y=e.a6.vec4.transformMat4([],[u,d,n,1],m)[2];a.hidden=!1;let E=_;v||(T&&(E*=r.cameraCollisionOpacity*function(i,r,a,n){let o,s;if(r.pitch<20)return 1;let l=r.getWorldToCameraMatrix();e.a6.mat4.multiply(l,l,i);let h=e.a6.vec4.fromValues(a.min[0],a.min[1],a.min[2],1),u=e.a6.vec4.transformMat4(e.a6.vec4.create(),h,l),c=u,d=u;h[1]=a.max[1],c=(u=e.a6.vec4.transformMat4(e.a6.vec4.create(),h,l))[1]<c[1]?u:c,d=u[1]>d[1]?u:d,h[0]=a.max[0],c=(u=e.a6.vec4.transformMat4(e.a6.vec4.create(),h,l))[1]<c[1]?u:c,d=u[1]>d[1]?u:d,h[1]=a.min[1],c=(u=e.a6.vec4.transformMat4(e.a6.vec4.create(),h,l))[1]<c[1]?u:c,d=u[1]>d[1]?u:d;let p=e.ap(n[0],0,1),f=100*r.pixelsPerMeter*e.ap(n[1],0,1),m=e.ap(n[2],0,1),_=e.a6.vec4.lerp(e.a6.vec4.create(),c,d,p),g=Math.tan(.5*r.fovX),y=-_[2]*g;if(0===f)return _[1]<-Math.abs(y)?m:1;let x=(-Math.abs(y)-_[1])/f;return o=e.ap((1-x)*1+x*m,m,1),(1-(s=e.ap((r.pitch-20)/20,0,1)))*1+s*o}(h,s,r.aabb,w)),E*=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.ap(((r-a)/(n-a)-o)/(s-o),0,1)}(S,y)),0!==E?R.push({nodeInfo:r,depth:y,opacity:E,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.a6.mat4.multiply([],m,r.tileModelMatrix);e.a6.mat4.multiply(c,p,c);let d=e.a6.mat4.invert([],c);e.a6.mat4.transpose(d,d),e.a6.mat4.scale(d,d,aP),c=e.a6.mat4.multiply(c,c,u.matrix);let f="light-beam"===i.renderPass,_=D&e.dj.HasMapboxMeshFeatures,x=_?0:n.evaluatedRMEA[0][2];for(let e=0;e<u.meshes.length;++e){let p;let m=u.meshes[e],b=e===u.lightMeshIndex,w=r.wvpForNode;if(b){if(!f&&!i.terrain&&i.shadowRenderer){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);continue}w=r.wvpForTile}else if(f)continue;let T={defines:[]},S=[];if(aM(T.defines,S,m,i,a.lut),_||T.defines.push("DIFFUSE_SHADED"),M&&T.defines.push("SHADOWS_SINGLE_CASCADE"),E&&(v?E.numRenderedVerticesInShadowPass+=m.vertexArray.length:E.numRenderedVerticesInTransparentPass+=m.vertexArray.length),v){aA(m,r.nodeModelMatrix,i,a);continue}let I=null;if(l){let e=aE(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]);T.overrideFog=a>=.05||n>=.05}}let A=m.material;A.occlusionTexture&&A.occlusionTexture.offsetScale&&(p=A.occlusionTexture.offsetScale,T.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!v&&h&&(h.useNormalOffset=!!m.normalBuffer);let C=i.getOrCreateProgram("model",T);
98!v&&h&&h.setupShadowsFromMatrix(r.tileModelMatrix,C,h.useNormalOffset),i.uploadCommonUniforms(o,C,null,I);let P=A.pbrMetallicRoughness;P.metallicFactor=.9,P.roughnessFactor=.5;let z=rW(new Float32Array(w),new Float32Array(c),new Float32Array(d),new Float32Array(u.matrix),i,r.opacity,P.baseColorFactor.toRenderColor(null),A.emissiveFactor,P.metallicFactor,P.roughnessFactor,A,x,a,[0,0,0],p);!b&&(n.hasTranslucentParts||r.opacity<1)&&C.draw(i,o.gl.TRIANGLES,g,tY.disabled,tW.disabled,tJ.backCCW,z,a.id,m.vertexBuffer,m.indexBuffer,m.segments,a.paint,i.transform.zoom,void 0,S),C.draw(i,o.gl.TRIANGLES,b?y:g,tY.disabled,b||r.opacity<1||n.hasTranslucentParts?tW.alphaBlended:tW.unblended,tJ.backCCW,z,a.id,m.vertexBuffer,m.indexBuffer,m.segments,a.paint,i.transform.zoom,void 0,S)}}}}()}(i,r,a,n),void u();if("model"!==c.type)return;let d=c.getModels(),p=[],f=i.transform.getFreeCameraOptions().position,m=e.a6.vec3.scale([],[f.x,f.y,f.z],i.transform.worldSize);e.a6.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.a6.mat4.identity([]),h=e.de(r.position.lat,i.transform.zoom),u=e.a6.mat4.fromScaling([],[1,1,1/h]);for(let a of(e.a6.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.dg(n,r):[...n],e.a6.mat4.multiply(u,u,a.matrix);let c=e.a6.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 r=e.a6.vec3.transformMat4([],i.centroid,c);r[2]>0&&l.push({mesh:i,depth:r[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)aI(e,i,a,p[e.modelIndex],tY.disabled,i.colorModeForRenderPass());else{for(let e of g)aI(e,i,a,p[e.modelIndex],tY.disabled,tW.disabled);for(let e of g)aI(e,i,a,p[e.modelIndex],i.stencilModeFor3D(),i.colorModeForRenderPass());i.resetStencilClippingMasks()}for(let e of _)aI(e,i,a,p[e.modelIndex],tY.disabled,i.colorModeForRenderPass());u()}else{for(let e of g)aA(e.mesh,e.nodeModelMatrix,i,a);for(let e of _)aA(e.mesh,e.nodeModelMatrix,i,a);u()}}},ak={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 e$&&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 e$&&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)}};class aO{constructor(i,r,a,n){this.context=new r1(i,r),this.transform=a,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=n,this._timeStamp=e.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};let o=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(let e of o)this._debugParams.enabledLayers[e]=!0;for(let e of(n.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),n.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),n.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),n.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),n.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200}),o))n.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new aR(n),this.setup(),this.numSublayers=e6.maxUnderzooming+e6.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.dl,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new ii(this),this._wireframeDebugCache=new aD,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];let s=new e.r({width:1,height:1},Uint8Array.of(0,0,0,0));
98this.emptyDepthTexture=new e.T(this.context,s,i.RGBA8),this._clippingActiveLastFrame=!1}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 rv(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 rv(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.a_;r.emplaceBack(0,0),r.emplaceBack(e.ab,0),r.emplaceBack(0,e.ab),r.emplaceBack(e.ab,e.ab),this.tileExtentBuffer=i.createVertexBuffer(r,e.b0.members),this.tileExtentSegments=e.b1.simpleSegment(0,0,4,2);let a=new e.a_;a.emplaceBack(0,0),a.emplaceBack(e.ab,0),a.emplaceBack(0,e.ab),a.emplaceBack(e.ab,e.ab),this.debugBuffer=i.createVertexBuffer(a,e.b0.members),this.debugSegments=e.b1.simpleSegment(0,0,4,5);let n=new e.a_;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(n,e.b0.members),this.viewportSegments=e.b1.simpleSegment(0,0,4,2);let o=new e.aN;o.emplaceBack(0,0,0,0),o.emplaceBack(e.ab,0,e.ab,0),o.emplaceBack(0,e.ab,0,e.ab),o.emplaceBack(e.ab,e.ab,e.ab,e.ab),this.mercatorBoundsBuffer=i.createVertexBuffer(o,e.b3.members),this.mercatorBoundsSegments=e.b1.simpleSegment(0,0,4,2);let s=new e.aO;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(s);let l=new e.a$;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.a6.mat4.create();let h=this.context.gl;this.stencilClearMode=new tY({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,tX.disabled,this.stencilClearMode,tW.disabled,tJ.disabled,rm(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(tW.disabled),a.setDepthMode(tX.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,tX.disabled,new tY({func:n.ALWAYS,mask:0},a,255,n.KEEP,n.KEEP,n.REPLACE),tW.disabled,tJ.disabled,rm(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 tY({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 tY({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 tY({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[a]:tY.disabled},r]}colorModeForRenderPass(){let i=this.context.gl;if(this._showOverdrawInspector){let r=1/8;return new tW([i.CONSTANT_COLOR,i.ONE,i.CONSTANT_COLOR,i.ONE],new e.bz(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?tW.unblended:tW.alphaBlended}colorModeForDrapableLayerRenderPass(i){let r=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&"translucent"===this.renderPass?new tW([r.ONE,r.ONE_MINUS_SRC_ALPHA,r.CONSTANT_ALPHA,r.ONE_MINUS_SRC_ALPHA],new e.bz(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 tX(this.context.gl.GREATER,tX.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!a)return tX.disabled;let n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new tX(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 r0(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){let a=e.q.now();this._dt=a-this._timeStamp,this._timeStamp=a,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=i.map.repaint,this.style=i,this.options=r;let n=this.style._mergedLayers,o=this.style.order.filter(e=>{let i=n[e];return!(i.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[i.type]}),s=!1,l=!1;for(let e of o){let i=n[e];"circle"===i.type&&(s=!0),"symbol"===i.type&&(i.hasInitialOcclusionOpacityProperties?l=!0:s=!0)}let h=o.map(e=>n[e]),u=this.style._mergedSourceCaches;this.imageManager=i.imageManager,this.modelManager=i.modelManager,this.symbolFadeChange=i.placement.symbolFadeChange(e.q.now()),this.imageManager.beginFrame();let c=0,d=!1;for(let e in u){let i=u[e];i.used&&(i.prepare(this.context),i.getSource().usedInConflation&&++c)}let p=!1;for(let e of h)e.isHidden(this.transform.zoom)||("clip"===e.type&&(p=!0),this.prepareLayer(e));let f={},m={},_={},g={},y={};for(let e in u){let i=u[e];f[e]=i.getVisibleCoordinates(),m[e]=f[e].slice().reverse(),_[e]=i.getVisibleCoordinates(!0).reverse(),g[e]=i.getShadowCasterCoordinates(),y[e]=i.sortCoordinatesByDistance(f[e])}let x=e=>{let i=this.style.getLayerSourceCache(e);return i&&i.used?i.getSource():null};if(c||p||this._clippingActiveLastFrame){let i=[],r=[],a=0;for(let e of h)this.isSourceForClippingOrConflation(e,x(e))&&(i.push(e),r.push(a)),a++;if(i&&(p||i.length>1)||this._clippingActiveLastFrame){p=!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.dn,u=e.bs.None,c=[],d=!0;
98if("clip"===o.type){for(let i of(h=s,o.layout.get("clip-layer-types")))u|="model"===i?e.bs.Model:"symbol"===i?e.bs.Symbol:e.bs.FillExtrusion;for(let e of o.layout.get("clip-layer-scope"))c.push(e);o.isHidden(this.transform.zoom)?d=!1:p=!0}d&&a.push({layer:o.fqid,cache:l,order:h,clipMask:u,clipScope:c})}this.replacementSource.setSources(a),d=!0}}this._clippingActiveLastFrame=p,d||this.replacementSource.clear(),this.conflationActive=d,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let e=0;e<h.length;e++){let i=h[e],r=i.cutoffRange();if(this.longestCutoffRange=Math.max(r,this.longestCutoffRange),r>0){let e=x(i);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),i.minzoom&&(this.minCutoffZoom=Math.max(i.minzoom,this.minCutoffZoom))}i.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}let v=this.style&&this.style.fog;v?(this._fogVisible=0!==v.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=v.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(_),this.opaquePassCutoff=0);let b=this._shadowRenderer;if(b)for(let e in b.updateShadowParameters(this.transform,this.style.directionalLight),u)for(let i of f[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(i)||e),b.addShadowReceiver(i.toUnwrapped(),e.min,e.max)}if("globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.dm(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new aS(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!q.has(this.context.gl))return;for(let e of(this.renderPass="offscreen",h)){let r=i.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;let a=r?m[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-(h.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,g)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);let w="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),T=(()=>{if(r.showOverdrawInspector)return e.bz.black;let i=this.style.fog;if(i&&this.transform.projection.supportsFog){let r=this.style.getLut(i.scope);if(!w){let a=i.properties.get("color").toRenderColor(r).toArray01();return new e.bz(...a)}if(w){let a=i.properties.get("space-color").toRenderColor(r).toArray01();return new e.bz(...a)}}return e.bz.transparent})();if(this.context.clear({color:T,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&w&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){let e=h[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())continue;let a=r?(e.is3D()?y:m)[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&&w&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.a9(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){let e=h[this.currentLayer],r=i.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,r,e,r?m[r.id]:void 0)}function S(e,i){let r;return i&&(r=("symbol"===e.type?_:e.is3D()?y:m)[i.id]),r}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<o.length;){let e=h[this.currentLayer];if("raster"===e.type||"raster-particle"===e.type){let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,S(e,r))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let E=0;b&&(E=b.getShadowCastingLayerCount());let M=!1,I=-1;for(let e=0;e<o.length;++e){let i=h[e];i.isHidden(this.transform.zoom)||i.is3D()&&(I=e)}for(l&&-1===I&&(s=!0);this.currentLayer<o.length;){let e=h[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(s&&!M&&this.terrain&&!this.transform.isOrthographic&&(M=!0,this.blitDepth()),l&&-1!==I&&this.currentLayer===I+1&&!this.transform.isOrthographic&&this.blitDepth(),e.is3D()||this.terrain||this._renderTileClippingMasks(e,r,r?f[r.id]:void 0),this.renderLayer(this,r,e,S(e,r)),!this.terrain&&b&&E>0&&e.hasShadowPass()&&0==--E&&(b.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=h[this.currentLayer];if(!e.hasLightBeamPass())continue;let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,r?m[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=h[this.currentLayer],a=i.getLayerSourceCache(r),n=a?m[a.id]:void 0;r.is3D()||this.terrain||this._renderTileClippingMasks(r,a,a?f[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.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let r=null;
98h.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&&aL.debug(this,r,r.getVisibleCoordinates(),e.bz.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&aL.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.bz(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(e){var i,r;let a=e.transform.padding;ap(e,e.transform.height-(a.top||0),3,as),ap(e,a.bottom||0,3,al),af(e,a.left||0,3,ah),af(e,e.transform.width-(a.right||0),3,au);let n=e.transform.centerPoint;i=n.x,r=e.transform.height-n.y,am(e,i-1,r-10,2,20,ac),am(e,i-10,r-1,20,2,ac)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),d||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);let{unsupportedLayers:i}=this.transform.projection,r=!i||!i.includes(e.type);if(ak[e.type]&&(r||this.terrain&&"custom"===e.type)){let i=this.style.getLayerSourceCache(e);ak[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||aL[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.extTimerQuery,r=this.context.gl,a=0;for(let n of e)a+=i.getQueryParameter(n,r.QUERY_RESULT)/1e6,i.deleteQueryEXT(n);return a}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.ak(r,a[0],this.transform.zoom),o?a[1]:e.ak(r,a[1],this.transform.zoom),0],h=new Float32Array(16);return e.a6.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.shadowRenderer&&(this.shadowRenderer.useNormalOffset?n.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):n.push("RENDER_SHADOWS","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=rT.cacheKey(iz[e],e,n,a);
98return this.cache[o]||(this.cache[o]=new rT(this.context,e,iz[e],a,rY[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.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(i,r){if(this.style.enable3dLights()){let a=this.style.directionalLight,n=this.style.ambientLight;if(a&&n){let o=((i,r,a)=>{let n=i.properties.get("direction"),o=i.properties.get("color").toRenderColor(a.getLut(i.scope)).toArray01(),s=i.properties.get("intensity"),l=r.properties.get("color").toRenderColor(a.getLut(r.scope)).toArray01(),h=r.properties.get("intensity"),u=[n.x,n.y,n.z],c=e.cH(l,h),d=e.cH(o,s);return{u_lighting_ambient_color:c,u_lighting_directional_dir:u,u_lighting_directional_color:d,u_ground_radiance:function(i,r,a){let n=function(i,r,a){let n,o,s;let l=e.a6.vec3.dot(r,i),h=(n=1-.3*Math.min(e.a6.vec3.dot(a,[.2126,.7152,.0722]),1),(1-(o=Math.min(l+1,1)))*n+1*o);return((1-(s=Math.asin(e.ap(r[2],-1,1))/Math.PI+.5))*.92+1*s)*h}(i,[0,0,1],r),o=[0,0,0];e.a6.vec3.scale(o,a.slice(0,3),n);let s=[0,0,0];e.a6.vec3.scale(s,r.slice(0,3),i[2]);let l=[0,0,0];return e.a6.vec3.add(l,o,s),e.cb(l)}(u,d,c)}})(a,n,this.style);r.setLightsUniformValues(i,o)}}}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=r.properties.get("color").toRenderColor(i.style.getLut(r.scope)).toArray01();m[3]=n;let _=i.frameCounter/1e3%1,[g,y]=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:m,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(g,y),y],u_fog_temporal_offset:_,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.a9(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)}
98getBackgroundTiles(){let e=this._backgroundTiles,i=this._backgroundTiles={};for(let r of this.transform.coveringTiles({tileSize:512}))i[r.key]=e[r.key]||new e2(r,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,i){return!(!e.is3D()||"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:-.0001,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.emptyDepthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),n.activeTexture.set(o.TEXTURE0),s||i.setTerrainUniformValues(n,r)}}function aB(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 aF{constructor(i){this._hashName=i&&encodeURIComponent(i),e.aJ(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=aB(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=aN(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 aN(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 aV={linearity:.3,easing:e.dp(0,0,.3,1)},aU=e.l({deceleration:2500,maxSpeed:1400},aV),aj=e.l({deceleration:20,maxSpeed:1400},aV),aG=e.l({deceleration:1e3,maxSpeed:360},aV),aq=e.l({deceleration:1e3,maxSpeed:90},aV);class aZ{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=aH(r.pan.mag(),a,e.l({},aU,i||{}));n.offset=r.pan.mult(o.amount/r.pan.mag()),n.center=this._map.transform.center,a$(n,o)}if(r.zoom){let e=aH(r.zoom,a,aj);n.zoom=this._map.transform.zoom+e.amount,a$(n,e)}if(r.bearing){let i=aH(r.bearing,a,aG);
98n.bearing=this._map.transform.bearing+e.ap(i.amount,-179,179),a$(n,i)}if(r.pitch){let e=aH(r.pitch,a,aq);n.pitch=this._map.transform.pitch+e.amount,a$(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 a$(e,i){(!e.duration||e.duration<i.duration)&&(e.duration=i.duration,e.easing=i.easing)}function aH(i,r,a){let{maxSpeed:n,linearity:o,deceleration:s}=a,l=e.ap(i*o/(r/1e3),-n,n),h=Math.abs(l)/(s*o);return{easing:a.easing,duration:1e3*h,amount:h/2*l}}class aW extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){let o=w(r.getCanvasContainer(),a);super(i,e.l({point:o,lngLat:r.unproject(o),originalEvent:a},n)),this._defaultPrevented=!1,this.target=r}}class aX extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a){let n="touchend"===i?a.changedTouches:a.touches,o=T(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 aY extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i){super("wheel",{originalEvent:i}),this._defaultPrevented=!1}}class aJ{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new aY(this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new aW(e.type,this._map,e))}mouseup(e){this._map.fire(new aW(e.type,this._map,e))}preclick(i){let r=e.l({},i);r.type="preclick",this._map.fire(new aW(r.type,this._map,r))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||(this.preclick(e),this._map.fire(new aW(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new aW(e.type,this._map,e))}mouseover(e){this._map.fire(new aW(e.type,this._map,e))}mouseout(e){this._map.fire(new aW(e.type,this._map,e))}touchstart(e){return this._firePreventable(new aX(e.type,this._map,e))}touchmove(e){this._map.fire(new aX(e.type,this._map,e))}touchend(e){this._map.fire(new aX(e.type,this._map,e))}touchcancel(e){this._map.fire(new aX(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class aK{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new aW(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new aW("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new aW(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class aQ{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&&(y(),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=f("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(),b(),a.x!==r.x||a.y!==r.y)return this._map.fire(new e.x("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),x(),delete this._startPos,delete this._lastPos}_fireEvent(i,r){return this._map.fire(new e.x(i,{originalEvent:r}))}}function a0(e,i){let r={};for(let a=0;a<e.length;a++)r[e[a].identifier]=i[a];return r}class a1{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=a0(a,r)))}touchmove(e,i,r){if(this.aborted||!this.centroid)return;let a=a0(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 a2{constructor(e){this.singleTap=new a1(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 a3{constructor(){this._zoomIn=new a2({numTouches:1,numTaps:2}),this._zoomOut=new a2({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 a4={0:1,2:2};class a5{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=S(e);this._correctButton(e,r)&&(this._lastPoint=i,this._eventButton=r)}mousemoveWindow(e,i){let r=this._lastPoint;if(r){if(e.preventDefault(),null!=this._eventButton&&function(e,i){let r=a4[i];return void 0===e.buttons||(e.buttons&r)!==r}(e,this._eventButton))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&&S(e)===this._eventButton&&(this._moved&&b(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class a6 extends a5{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 a8 extends a5{_correctButton(e,i){return 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){e.preventDefault()}}class a9 extends a5{_correctButton(e,i){return 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){e.preventDefault()}}class a7{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),e.aJ(["_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.dq())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=a0(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=f("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 ne{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=nt(r,i,n),l=nt(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=nt(r,i,a),s=nt(r,i,n);o&&s||(this._active&&b(),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 nt(e,i,r){for(let a=0;a<e.length;a++)if(e[a].identifier===r)return i[a]}function ni(e,i){return Math.log(e/i)/Math.LN2}class nr extends ne{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(ni(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:ni(this._distance,r),pinchAround:i}}}function na(e,i){return 180*e.angleWith(i)/Math.PI}class nn extends ne{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:na(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(na(e,r))<i}}function no(e){return Math.abs(e.y)>Math.abs(e.x)}class ns extends ne{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,no(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.dq()&&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 no(e)&&no(i)&&o}}class nl{constructor(){this._panStep=100,this._bearingStep=15,this._pitchStep=10,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:nh,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 nh(e){return e*(2-e)}let nu=1/450;class nc{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._handler=r,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=nu,e.aJ(["_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.dq()))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=w(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.aa(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.dr;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;r=e.dp(o,Math.sqrt(.0729-o*o),.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=f("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 nd{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 np{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 nf{constructor(){this._tap=new a2({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 nm{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 n_{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 ng{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 ny=e=>e.zoom||e.drag||e.pitch||e.rotate;class nx extends e.x{}class nv{constructor(){this.constants=[1,1,.01],this.radius=0}setup(i,r){let a=e.a6.vec3.sub([],r,i);this.radius=e.a6.vec3.length(a[2]<0?e.a6.vec3.div([],a,this.constants):[a[0],a[1],0])}projectRay(i){e.a6.vec3.div(i,i,this.constants),e.a6.vec3.normalize(i,i),e.a6.vec3.mul(i,i,this.constants);let r=e.a6.vec3.scale([],i,this.radius);if(r[2]>0){let i=e.a6.vec3.scale([],[0,0,1],e.a6.vec3.dot(r,[0,0,1])),a=e.a6.vec3.scale([],e.a6.vec3.normalize([],[r[0],r[1],0]),this.radius),n=e.a6.vec3.add([],r,e.a6.vec3.scale([],e.a6.vec3.sub([],e.a6.vec3.add([],a,i),r),2));r[0]=n[0],r[1]=n[1]}return r}}function nb(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class nw{constructor(i,r){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new aZ(i),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new nv,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),e.aJ(["handleEvent","handleWindowEvent"],this);let a=this._el;for(let[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)){let 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 aJ(i,e));let a=i.boxZoom=new aQ(i,e);this._add("boxZoom",a);let n=new a3,o=new np;i.doubleClickZoom=new nd(o,n),this._add("tapZoom",n),this._add("clickZoom",o);let s=new nf;this._add("tapDragZoom",s);let l=i.touchPitch=new ns(i);this._add("touchPitch",l);let h=new a8(e),u=new a9(e);i.dragRotate=new n_(e,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);let c=new a6(e),d=new a7(i,e);i.dragPan=new nm(r,c,d),this._add("mousePan",c),this._add("touchPan",d,["touchZoom","touchRotate"]);let p=new nn,f=new nr;i.touchZoomRotate=new ng(r,f,p,s),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),this._add("blockableMapEvent",new aK(i));let m=i.scrollZoom=new nc(i,this);this._add("scrollZoom",m,["mousePan"]);let _=i.keyboard=new nl;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!!ny(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?T(this._el,l):r?void 0:w(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||nb(n))&&(this._changes.push([n,o,u]),this._triggerRenderFrame()),(Object.keys(s).length||nb(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;let o=this._map,s=o.transform,l=e=>[e.x,e.y,e.z];if((e=>{let i=this._eventsInProgress.drag;return i&&!this._handlersById[i.handlerName].isActive()})()&&!nb(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),!nb(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[n="drag"]&&!this._eventsInProgress[n])&&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.ds(e.aM(i.y))*r,_[1]=-h.y*e.ds(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.a6.vec3.normalize([],e.a6.vec3.sub([],i,s._camera.position))};if(r.dir[2]<0){let a=s.zoomDeltaToMovement(i,u);e.a6.vec3.scale(y,r.dir,a)}}let x=e.a6.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;let o=ny(this._eventsInProgress),s=ny(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=ny(this._eventsInProgress);if(a&&(o||s)&&!u){let i,r;this._updatingCamera=!0;let a=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);a?(0!==(i=a.bearing||this._map.getBearing())&&-this._bearingSnap<i&&i<this._bearingSnap&&(a.bearing=0),this._map.easeTo(a,{originalEvent:n})):(this._map.fire(new e.x("moveend",{originalEvent:n})),0!==(r=this._map.getBearing())&&-this._bearingSnap<r&&r<this._bearingSnap&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,r){this._map.fire(new e.x(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 nT="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class nS 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.aJ(["_renderFrameCallback"],this)}getCenter(){return new e.bK(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.as.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.bK.convert(r),c=e.bK.convert(a),d=.5*(u.lat+c.lat),p=.5*(u.lng+c.lng),f=e.dt(d,p),m=e.a6.vec3.normalize([],f),_=e.a6.vec3.normalize([],e.a6.vec3.cross([],m,[0,1,0])),g=e.a6.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.dt(u.lat,u.lng),e.dt(c.lat,u.lng),e.dt(c.lat,c.lng),e.dt(u.lat,c.lng),e.dt(d,u.lng),e.dt(d,c.lng),e.dt(u.lat,p),e.dt(c.lat,p)],v=e.c9.fromPoints(x.map(i=>[e.a6.vec3.dot(_,i),e.a6.vec3.dot(g,i),e.a6.vec3.dot(m,i)])),b=e.a6.vec3.transformMat4([],v.center,y);0===e.a6.vec3.squaredLength(b)&&e.a6.vec3.set(b,0,0,1),e.a6.vec3.normalize(b,b),e.a6.vec3.scale(b,b,e.aq),l.center=e.du(b);let w=l.getWorldToCameraMatrix(),T=e.a6.mat4.invert(new Float64Array(16),w);v=e.c9.applyTransform(v,e.a6.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.a6.vec3.transformMat4(b,b,w);let E=.5*(v.max[2]-v.min[2]),M=this._minimumAABBFrustumDistance(l,v),I=e.a6.vec3.scale([],[0,0,1],E),A=e.a6.vec3.add(I,b,I),C=M+(0===l.pitch?0:e.a6.vec3.distance(b,A)),P=l.globeCenterInViewSpace,z=e.a6.vec3.sub([],b,[P[0],P[1],P[2]]);e.a6.vec3.normalize(z,z),e.a6.vec3.scale(z,z,C);let D=e.a6.vec3.add([],b,z);e.a6.vec3.transformMat4(D,D,T);let R=e.dw/e.aq,L=e.a6.vec3.length(D),k=e.bD(Math.max(L*R-e.dw,Number.EPSILON),0),O=Math.min(l.zoomFromMercatorZAdjusted(k),h.maxZoom);return O>.5*(e.c2+e.bU)?(l.setProjection({name:"mercator"}),l.zoom=O,this._cameraForBounds(l,r,a,n,o,s)):{center:l.center,zoom:O,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.a6.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.c9([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.bB(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.a5.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.bK.convert(r),c=e.bK.convert(a),d=new e.bK(u.lng,c.lat),p=new e.bK(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.c9.fromPoints(v),w=l.getWorldToCameraMatrix(),T=e.a6.mat4.invert(new Float64Array(16),w);b=e.c9.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 E=.5*e.a6.vec3.sub([],b.max,b.min)[2],M=this._minimumAABBFrustumDistance(l,b),I=[0,0,1,0];e.a6.vec4.transformMat4(I,I,w),e.a6.vec4.normalize(I,I);let A=e.a6.vec3.scale([],I,M+E),C=e.a6.vec3.add([],b.center,A);e.a6.vec3.transformMat4(b.center,b.center,T),e.a6.vec3.transformMat4(C,C,T);let P=l.unproject(new e.P(b.center[0],b.center[1])),z=Math.pow(2,e.dv(l.projection,P)),D=Math.min(l._zoomFromMercatorZ(C[2]*l.pixelsPerMeter*z/l.worldSize),h.maxZoom);return l.mercatorFromTransition&&D<.5*(e.c2+e.bU)?(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.bK.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.x("movestart",r)).fire(new e.x("move",r)),n&&this.fire(new e.x("zoomstart",r)).fire(new e.x("zoom",r)).fire(new e.x("zoomend",r)),o&&this.fire(new e.x("rotatestart",r)).fire(new e.x("rotate",r)).fire(new e.x("rotateend",r)),s&&this.fire(new e.x("pitchstart",r)).fire(new e.x("pitch",r)).fire(new e.x("pitchend",r)),this.fire(new e.x("moveend",r)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(nT),this.transform.getFreeCameraOptions()}setFreeCameraOptions(i,r){let a=this.transform;if(!a.projection.supportsFreeCamera)return e.w(nT),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.x("movestart",r)).fire(new e.x("move",r)),l&&this.fire(new e.x("zoomstart",r)).fire(new e.x("zoom",r)).fire(new e.x("zoomend",r)),u&&this.fire(new e.x("rotatestart",r)).fire(new e.x("rotate",r)).fire(new e.x("rotateend",r)),h&&this.fire(new e.x("pitchstart",r)).fire(new e.x("pitch",r)).fire(new e.x("pitchend",r)),this.fire(new e.x("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.dr},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.a5.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.bK.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.am(u.lng),e.at(u.lat)).mult(h.worldSize).sub(n)}else{a=h.centerPoint.add(y);let r=h.pointLocation(a),s=e.bK.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.bK.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,E=h=>E=>{if(v&&(h.zoom=e.aa(u,f,E)),b&&(h.bearing=e.aa(c,m,E)),w&&(h.pitch=e.aa(d,_,E)),T&&(S.interpolatePadding(p,g,E),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-E),r=h.unproject(n.add(o.mult(E*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(E,i.duration,h);return this._preloadTiles(e),this}let M={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,M),this._ease(E(h
98),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.moving||this.fire(new e.x("movestart",i)),this._zooming&&!a.zooming&&this.fire(new e.x("zoomstart",i)),this._rotating&&!a.rotating&&this.fire(new e.x("rotatestart",i)),this._pitching&&!a.pitching&&this.fire(new e.x("pitchstart",i))}_fireMoveEvents(i){this.fire(new e.x("move",i)),this._zooming&&this.fire(new e.x("zoom",i)),this._rotating&&this.fire(new e.x("rotate",i)),this._pitching&&this.fire(new e.x("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.x("zoomend",i)),n&&this.fire(new e.x("rotateend",i)),o&&this.fire(new e.x("pitchend",i)),this.fire(new e.x("moveend",i))}flyTo(i,r){if(this._prefersReducedMotion(i)){let a=e.ar(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.dr},i);let a=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),l=this.getPadding(),h="zoom"in i?e.ap(+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.bK.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.ap(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 E(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 M(e){return(Math.exp(e)-Math.exp(-e))/2}function I(e){return(Math.exp(e)+Math.exp(-e))/2}let A=E(0),C=function(e){return I(A)/I(A+v*e)},P=function(e){var i;return(I(A)*(M(i=A+v*e)/I(i))-M(A))/S*b/T},z=(E(1)-A)/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),k=!1===i.retainPadding?a.clone():a,O=a=>p=>{let _=p*z,v=1/C(_);a.zoom=1===p?h:n+a.scaleZoom(v),D&&(a.bearing=e.aa(o,u,p)),R&&(a.pitch=e.aa(s,c,p)),L&&(k.interpolatePadding(l,d,p),m=k.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(O,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(O(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.bA(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:r<-180?360:0}_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 nE{constructor(i={}){this.options=i,e.aJ(["_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=f("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=f("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=f("span","mapboxgl-ctrl-icon",this._compactButton);return a.setAttribute("aria-hidden","true"),a.setAttribute("title",r),this._innerContainer=f("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}#${aN(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 nM{constructor(){e.aJ(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=f("div","mapboxgl-ctrl");let i=f("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 nI{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 nA{constructor(e){this.jumpTo(e)}getValue(i){if(i<=this._startTime)return this._start;if(i>=this._endTime)return this._end;let r=e.cw((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 nC={"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 nP{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class nz{constructor(e){this.map=e,this.interactionsByType=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this)}
98add(i,r){if(this.typeById.has(i))throw Error(`Interaction id "${i}" already exists.`);let{type:a,filter:n}=r;if(n){let r=e.M(n,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===r.result)throw Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));this.filters.set(i,r.value)}let o=this.interactionsByType.get(a)||new Map;0===o.size&&(this.map.on(a,this.handleType),this.interactionsByType.set(a,o)),o.set(i,r),this.typeById.set(i,a)}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),0===r.size&&this.map.off(i,this.handleType))}handleType(e){let i=e.features||this.map.queryRenderedFeatures(e.point);if(!i)return;let r=this.interactionsByType.get(e.type),a={zoom:0};for(let[e,n]of r){let r=this.filters.get(e),{handler:o,layers:s}=n;for(let l of i)if((!s||s.includes(l.layer.id))&&(!r||r.evaluate(a,l))&&!1!==o({id:e,feature:l,interaction:n}))break}}}let nD={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},nR={showCompass:!0,showZoom:!0,visualizePitch:!1};class nL{constructor(i,r,a=!1){this._clickTolerance=10,this.element=r,this.mouseRotate=new a8({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,a&&(this.mousePitch=new a9({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),e.aJ(["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),y()}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(){x(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(e.l({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),w(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,w(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=T(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=T(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 nk(i,r,a){if(i=new e.bK(i.lng,i.lat),r){let n=new e.bK(i.lng-360,i.lat),o=new e.bK(i.lng+360,i.lat),s=360*Math.ceil(Math.abs(i.lng-a.center.lng)/360),l=a.locationPoint(i).distSqr(r),h=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint(n).distSqr(r)<l&&(h||Math.abs(n.lng-a.center.lng)<s)?i=n:a.locationPoint(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.locationPoint(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 nO={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%)"};class nB extends e.E{constructor(i,r){if(super(),(i instanceof HTMLElement||r)&&(i=e.l({element:i},r)),e.aJ(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=i&&i.occludedOpacity||.2,i&&i.element)this._element=i.element,this._offset=e.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=f("div");let r=m("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),a=m("radialGradient",{id:"shadowGradient"},m("defs",{},r));m("stop",{offset:"10%","stop-opacity":.4},a),m("stop",{offset:"100%","stop-opacity":.05},a),m("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r),m("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},r),m("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},r),m("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),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()});let a=this._element.classList;for(let e in nO)a.remove(`mapboxgl-marker-anchor-${e}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`);let n=i&&i.className?i.className.trim().split(/\s+/):[];a.add(...n),this._popup=null}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.bK.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}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,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),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;let 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);r._showingGlobe()&&e.dz(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 ${nO[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.c0(e.dA(r.transform,this._lngLat)),o=i.sub(e.dB(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.bK(this._lngLat.lng,this._lngLat.lat+.001)),n=r.project(new e.bK(this._lngLat.lng,this._lngLat.lat-.001)).sub(i);a=e.c0(Math.atan2(n.y,n.x))-90}else a=-r.getBearing()}else if("horizon"===n){let n=e.a7(4,6,r.getZoom()),o=e.dB(r.transform);o.y+=n*r.transform.height;let s=i.sub(o),l=e.c0(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=nk(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),!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.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.x("dragstart"))),this.fire(new e.x("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.x("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||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",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||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let nF={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},nN={maxWidth:100,unit:"metric"},nV={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},nU={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"};function nj(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:s,supported:p.supported,setRTLTextPlugin:e.dC,getRTLTextPluginStatus:e.dD,Map:class extends nS{constructor(i){h.mark(l.create);let r=i;if(null!=(i=e.l({},nD,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.dx(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 t8(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),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 nI,this._domRenderTaskQueue=new nI,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aP(),this._locale=e.l({},nC,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._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new nA(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._requestManager=new I(i.transformRequest,i.accessToken,i.testMode),this._silenceAuthErrors=!!i.testMode,this._contextCreateOptions=i.contextCreateOptions?{...i.contextCreateOptions}:{},"string"==typeof i.container){let 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),e.aJ(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new nP),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._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 nw(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),i.hash&&(this._hash=new aF("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});let a=i.bounds;a&&(this.resize(),this.fitBounds(a,e.l({},i.fitBoundsOptions,{duration:0})))}this.resize(),i.attributionControl&&this.addControl(new nE({customAttribution:i.customAttribution}
103)),this._logoControl=new nM,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.x(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new e.x(`${i.dataType}dataloading`,i))}),this._interactions=new nz(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.t(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.t(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.x("movestart",i)).fire(new e.x("move",i)),this.fire(new e.x("resize",i)),r&&this.fire(new e.x("moveend",i)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(i){return this.transform.setMaxBounds(e.as.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.x("zoomstart")).fire(new e.x("zoom")).fire(new e.x("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.x("zoomstart")).fire(new e.x("zoom")).fire(new e.x("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.x("pitchstart")).fire(new e.x("pitch")).fire(new e.x("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.x("pitchstart")).fire(new e.x("pitch")).fire(new e.x("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}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.bU?(r.setMercatorFromTransition(),i=!0):"mercator"===a&&r.zoom<e.bU&&(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.bU?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){return this.transform.locationPoint3D(e.bK.convert(i))}unproject(i){return this.transform.pointLocation3D(e.P.convert(i))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,i,r){if("mouseenter"===e||"mouseover"===e){let a=!1;return{layers:new Set(i),listener:r,delegates:{mousemove:n=>{let o=i.filter(e=>this.getLayer(e)),s=o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];s.length?a||(a=!0,r.call(this,new aW(e,this,n.originalEvent,{features:s}))):a=!1},mouseout:()=>{a=!1}}}}if("mouseleave"===e||"mouseout"===e){let a=!1;return{layers:new Set(i),listener:r,delegates:{mousemove:n=>{let o=i.filter(e=>this.getLayer(e));(o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?a=!0:a&&(a=!1,r.call(this,new aW(e,this,n.originalEvent)))},mouseout:i=>{a&&(a=!1,r.call(this,new aW(e,this,i.originalEvent)))}}}}return{layers:new Set(i),listener:r,delegates:{[e]:e=>{let a=i.filter(e=>this.getLayer(e)),n=a.length?this.queryRenderedFeatures(e.point,{layers:a}):[];n.length&&(e.features=n,r.call(this,e),delete e.features)}}}}on(e,i,r){if("function"==typeof i||void 0===r)return super.on(e,i);if(Array.isArray(i)||(i=[i]),i){for(let e of i)if(!this._isValidId(e))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(Array.isArray(i)||(i=[i]),i){for(let e of i)if(!this._isValidId(e))return this}let a=this._createDelegatedListener(e,i,r);for(let e in a.delegates)this.once(e,a.delegates[e]);return this}off(e,i,r){if("function"==typeof i||void 0===r)return super.off(e,i);let a=new Set(Array.isArray(i)?i:[i]);for(let e of a)if(!this._isValidId(e))return this;let n=(e,i)=>{if(e.size!==i.size)return!1;for(let r of e)if(!i.has(r))return!1;return!0},o=this._delegatedListeners?this._delegatedListeners[e]:void 0;return o&&(e=>{for(let i=0;i<e.length;i++){let o=e[i];if(o.listener===r&&n(o.layers,a)){for(let e in o.delegates)this.off(e,o.delegates[e]);return e.splice(i,1),this}}})(o),this}queryRenderedFeatures(i,r){if(!this.style)return[];if(void 0!==r||void 0===i||i instanceof e.P||Array.isArray(i)||(r=i,i=void 0),i=i||[[0,0],[this.transform.width,this.transform.height]],(r=r||{}).layers&&Array.isArray(r.layers)){for(let e of r.layers)if(!this._isValidId(e))return[]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(e,i){return 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}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 im(this,a).load(i),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new im(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.t(Error("IDs can't be empty."))),!1):!e.cn(i)||(this.fire(new e.t(Error(`IDs can't
103contain special symbols: "${i}".`))),!1)}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}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){let{width:h,height:u,data:c}=e.q.getImageData(r);this.style.addImage(i,{data:new e.r({width:h,height:u},c),pixelRatio:a,stretchX:o,stretchY:s,content:l,sdf:n,version:0})}else if(void 0===r.width||void 0===r.height)this.fire(new e.t(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:h,height:u}=r;this.style.addImage(i,{data:new e.r({width:h,height:u},new Uint8Array(r.data)),pixelRatio:a,stretchX:o,stretchY:s,content:l,sdf:n,version:0,userImage:r}),r.onAdd&&r.onAdd(this,i)}}updateImage(i,r){this._lazyInitEmptyStyle();let a=this.style.getImage(i);if(!a)return void this.fire(new e.t(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:o,data:s}=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?e.q.getImageData(r):r;if(void 0===n||void 0===o)return void this.fire(new e.t(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(n!==a.data.width||o!==a.data.height)return void this.fire(new e.t(Error(`The width and height of the updated image (${n}, ${o}) 104 must be that same as the previous version of the image 105 (${a.data.width}, ${a.data.height})`)));let l=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);a.data.replace(s,l),this.style.updateImage(i,a)}hasImage(i){return i?!!this.style&&!!this.style.getImage(i):(this.fire(new e.t(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}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()}addModel(e,i){this._lazyInitEmptyStyle(),this.style.addModel(e,i)}hasModel(i){return i?this.style.hasModel(i):(this.fire(new e.t(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}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)}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}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),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.bK.convert(i),this.transform):0}setFeatureState(e,i){return this._isValidId(e.source)?(this.style.setFeatureState(e,i),this._update()):this}removeFeatureState(e,i){return this._isValidId(e.source)?(this.style.removeFeatureState(e,i),this._update()):this}getFeatureState(e){return this._isValidId(e.source)?this.style.getFeatureState(e):null}_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=f("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();let i=this._canvasContainer=f("div","mapboxgl-canvas-container",e);this._canvas=f("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=f("div","mapboxgl-control-container",e),a=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(e=>{a[e]=f("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({},p.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",i);r?(Z(r,!0),this.painter=new aO(r,this._contextCreateOptions,this.transform,this._tp),this.on("data",e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)}),e.m.testSupport(r)):this.fire(new e.t(Error("Failed to initialize WebGL")))}_contextLost(i){i.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.x("webglcontextlost",{originalEvent:i}))}_contextRestored(i){this._setupPainter(),this.resize(),this._update(),this.fire(new e.x("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.x("renderstart")),++this._frameId;let a=this.painter.context.extTimerQuery,n=e.q.now(),o=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=o.createQuery(),o.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 s=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.a3(i,{now:a,fadeDuration:s,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._forceMarkerAndPopupUpdate()):u=this._updateAverageElevation(n);let c=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,this.painter.replacementSource);if(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:s,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.x("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.mark(l.load),this.fire(new e.x("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){let i=e.q.now()-n;o.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{let a=o.getQueryParameter(r,o.QUERY_RESULT)/1e6;o.deleteQuery(r),this.fire(new e.x("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.x("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.x("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.x("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let i=this._calculateSpeedIndex();this.fire(new e.x("speedindexcompleted",{speedIndex:i})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,h.mark(l.fullLoad),this._performanceMetricsCollection&&U(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(){G(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,i=>{if(i&&(i.message===M||401===i.status)){let i=this.painter.context.gl;Z(i,!1),this._logoControl instanceof nM&&this._logoControl._updateLogo(),i&&i.clear(i.DEPTH_BUFFER_BIT|i.COLOR_BUFFER_BIT|i.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.t(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/")))}}),B(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&N(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,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.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),q.delete(this.painter.context.gl),j.remove(),O.remove(),this._removed=!0,this.fire(new e.x("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.bf(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.dy(i,r)}get version(){return s}},NavigationControl:class{constructor(i={}){this.options=e.l({},nR,i),this._container=f("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.aJ(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",e=>{this._map&&this._map.zoomIn({},{originalEvent:e})}),f("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})}),f("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aJ(["_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=f("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 nL(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=f("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();let r=navigator.geolocation;this.options=e.l({geolocation:r},nF,i),e.aJ(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=aB(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=f("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.x("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.x("geolocate",i)),this._finish()}}_updateCamera(i){let r=new e.bK(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.bK(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.bD(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.x("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=f("button","mapboxgl-ctrl-geolocate",this._container),f("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=f("div","mapboxgl-user-location"),this._dotElement.appendChild(f("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(f("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new nB({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=f("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new nB({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.x("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.x("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.x("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.x("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)};"undefined"!=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:nE,ScaleControl:class{constructor(i={}){this.options=e.l({},nN,i),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aJ(["_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(()=>{let a=function(e){let i=Math.pow(10,`${Math.floor(e)}`.length-1),r=e/i;return i*(r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(e){let i=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*i)/i}(r))}(i),n=a/i;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==r?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:r}).format(a):`${a} ${nV[r]}`,this._container.style.width=e*n+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=f("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.aJ(["_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=f("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=f("button","mapboxgl-ctrl-fullscreen",this._controlContainer);f("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(nU),i),e.aJ(["_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.x("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.x("close")),this}getLngLat(){return this._lngLat}setLngLat(i){this._lngLat=e.bK.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}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;let 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=f("div","mapboxgl-popup-content",this._container||void 0);if(i.appendChild(e),this.options.closeButton){let e=this._closeButton=f("button","mapboxgl-popup-close-button",i);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",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=f("div","mapboxgl-popup",r.getContainer()),this._tip=f("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=nk(this._lngLat,this._pos,r.transform)),!this._trackPointer||i){let a=this._pos=this._trackPointer&&i instanceof e.P?i:r.project(this._lngLat),n=nj(this.options.offset),o=this._anchor=this._getAnchor(n.y),s=nj(this.options.offset,o),l=a.add(s).round();r._requestDomTask(()=>{this._container&&o&&(this._container.style.transform=`${nO[o]} translate(${l.x}px,${l.y}px)`)})}if(!this._marker&&r._showingGlobe()){let i=e.dz(r.transform,this._lngLat)?0:1;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:nB,Style:im,LngLat:e.bK,LngLatBounds:e.as,Point:e.P,MercatorCoordinate:e.a5,FreeCameraOptions:t1,Evented:e.E,config:e.e,prewarm:e.dE,clearPrewarmedResources:e.dF,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.dG.workerCount},set workerCount(t){e.dG.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(i){e.dH(i)},get workerUrl(){return e.dI.workerUrl},set workerUrl(t){e.dI.workerUrl=t},get workerClass(){return e.dI.workerClass},set workerClass(t){e.dI.workerClass=t},get workerParams(){return e.dI.workerParams},set workerParams(t){e.dI.workerParams=t},get dracoUrl(){return e.dJ()},set dracoUrl(t){e.dK(t)},get meshoptUrl(){return e.dL()},set meshoptUrl(t){e.dM(t)},setNow:e.q.setNow,restoreNow:e.q.restoreNow}}),r},e.exports=a()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.