vendor: 4,197 bytes, line 1
1import{c as Ml,g as n2,a as ax}from"./turfbuffer-Bu_pcq0T.js";var Jm={exports:{}},o2=Jm.exports,L1;function NA(){return L1||(L1=1,(function(S,L){(function(V,X){S.exports=X()})(o2,(function(){var V,X,W;function ae(s,we){if(!V)V=we;else if(!X)X=we;else{var Pe="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 = {}; ("+V+")(sharedChunk); ("+X+")(sharedChunk); self.onerror = null;",rt={};V(rt),W=we(rt),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(W.workerUrl=window.URL.createObjectURL(new Blob([Pe],{type:"text/javascript"})))}}ae(["exports"],function(s){var we=1e-6,Pe=typeof Float32Array<"u"?Float32Array:Array;function rt(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=i*u-a*n;return h?(r[0]=u*(h=1/h),r[1]=-n*h,r[2]=-a*h,r[3]=i*h,r):null}function ot(){var r=new Pe(9);return Pe!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function ke(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8];return r[0]=h*v-f*g,r[1]=a*g-n*v,r[2]=n*f-a*h,r[3]=f*_-u*v,r[4]=i*v-a*_,r[5]=a*u-i*f,r[6]=u*g-h*_,r[7]=n*_-i*g,r[8]=i*h-n*u,r}function dt(r,e,i){var n=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=i[0],I=i[1],A=i[2],R=i[3],O=i[4],D=i[5],k=i[6],U=i[7],G=i[8];return r[0]=w*n+I*h+A*g,r[1]=w*a+I*f+A*v,r[2]=w*u+I*_+A*b,r[3]=R*n+O*h+D*g,r[4]=R*a+O*f+D*v,r[5]=R*u+O*_+D*b,r[6]=k*n+U*h+G*g,r[7]=k*a+U*f+G*v,r[8]=k*u+U*_+G*b,r}function Be(){var r=new Pe(16);return Pe!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function Xe(r){var e=new Pe(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function pe(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Ye(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=e[9],w=e[10],I=e[11],A=e[12],R=e[13],O=e[14],D=e[15],k=i*f-n*h,U=i*_-a*h,G=i*g-u*h,K=n*_-a*f,Y=n*g-u*f,re=a*g-u*_,oe=v*R-b*A,ie=v*O-w*A,ce=v*D-I*A,de=b*O-w*R,De=b*D-I*R,Ce=w*D-I*O,Le=k*Ce-U*De+G*de+K*ce-Y*ie+re*oe;return Le?(r[0]=(f*Ce-_*De+g*de)*(Le=1/Le),r[1]=(a*De-n*Ce-u*de)*Le,r[2]=(R*re-O*Y+D*K)*Le,r[3]=(w*Y-b*re-I*K)*Le,r[4]=(_*ce-h*Ce-g*ie)*Le,r[5]=(i*Ce-a*ce+u*ie)*Le,r[6]=(O*G-A*re-D*U)*Le,r[7]=(v*re-w*G+I*U)*Le,r[8]=(h*De-f*ce+g*oe)*Le,r[9]=(n*ce-i*De-u*oe)*Le,r[10]=(A*Y-R*G+D*k)*Le,r[11]=(b*G-v*Y-I*k)*Le,r[12]=(f*ie-h*de-_*oe)*Le,r[13]=(i*de-n*ie+a*oe)*Le,r[14]=(R*U-A*K-O*k)*Le,r[15]=(v*K-b*U+w*k)*Le,r):null}function at(r,e,i){var n=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],I=e[10],A=e[11],R=e[12],O=e[13],D=e[14],k=e[15],U=i[0],G=i[1],K=i[2],Y=i[3];return r[0]=U*n+G*f+K*b+Y*R,r[1]=U*a+G*_+K*w+Y*O,r[2]=U*u+G*g+K*I+Y*D,r[3]=U*h+G*v+K*A+Y*k,r[4]=(U=i[4])*n+(G=i[5])*f+(K=i[6])*b+(Y=i[7])*R,r[5]=U*a+G*_+K*w+Y*O,r[6]=U*u+G*g+K*I+Y*D,r[7]=U*h+G*v+K*A+Y*k,r[8]=(U=i[8])*n+(G=i[9])*f+(K=i[10])*b+(Y=i[11])*R,r[9]=U*a+G*_+K*w+Y*O,r[10]=U*u+G*g+K*I+Y*D,r[11]=U*h+G*v+K*A+Y*k,r[12]=(U=i[12])*n+(G=i[13])*f+(K=i[14])*b+(Y=i[15])*R,r[13]=U*a+G*_+K*w+Y*O,r[14]=U*u+G*g+K*I+Y*D,r[15]=U*h+G*v+K*A+Y*k,r}function gt(r,e,i){var n,a,u,h,f,_,g,v,b,w,I,A,R=i[0],O=i[1],D=i[2];return e===r?(r[12]=e[0]*R+e[4]*O+e[8]*D+e[12],r[13]=e[1]*R+e[5]*O+e[9]*D+e[13],r[14]=e[2]*R+e[6]*O+e[10]*D+e[14],r[15]=e[3]*R+e[7]*O+e[11]*D+e[15]):(a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],I=e[10],A=e[11],r[0]=n=e[0],r[1]=a,r[2]=u,r[3]=h,r[4]=f,r[5]=_,r[6]=g,r[7]=v,r[8]=b,r[9]=w,r[10]=I,r[11]=A,r[12]=n*R+f*O+b*D+e[12],r[13]=a*R+_*O+w*D+e[13],r[14]=u*R+g*O+I*D+e[14],r[15]=h*R+v*O+A*D+e[15]),r}function Qe(r,e,i){var n=i[0],a=i[1],u=i[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*u,r[9]=e[9]*u,r[10]=e[10]*u,r[11]=e[11]*u,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}
vendor: 5,141 bytes, line 1
1function He(r,e,i){var n=Math.sin(i),a=Math.cos(i),u=e[4],h=e[5],f=e[6],_=e[7],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=u*a+g*n,r[5]=h*a+v*n,r[6]=f*a+b*n,r[7]=_*a+w*n,r[8]=g*a-u*n,r[9]=v*a-h*n,r[10]=b*a-f*n,r[11]=w*a-_*n,r}function yt(r,e,i){var n=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a-g*n,r[1]=h*a-v*n,r[2]=f*a-b*n,r[3]=_*a-w*n,r[8]=u*n+g*a,r[9]=h*n+v*a,r[10]=f*n+b*a,r[11]=_*n+w*a,r}function Tt(r,e,i){var n=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],g=e[4],v=e[5],b=e[6],w=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a+g*n,r[1]=h*a+v*n,r[2]=f*a+b*n,r[3]=_*a+w*n,r[4]=g*a-u*n,r[5]=v*a-h*n,r[6]=b*a-f*n,r[7]=w*a-_*n,r}function Mt(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function li(r,e,i){var n,a,u,h=i[0],f=i[1],_=i[2],g=Math.sqrt(h*h+f*f+_*_);return g<we?null:(h*=g=1/g,f*=g,_*=g,n=Math.sin(e),a=Math.cos(e),r[0]=h*h*(u=1-a)+a,r[1]=f*h*u+_*n,r[2]=_*h*u-f*n,r[3]=0,r[4]=h*f*u-_*n,r[5]=f*f*u+a,r[6]=_*f*u+h*n,r[7]=0,r[8]=h*_*u+f*n,r[9]=f*_*u-h*n,r[10]=_*_*u+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function ri(r,e){var i=e[0],n=e[1],a=e[2],u=e[4],h=e[5],f=e[6],_=e[8],g=e[9],v=e[10];return r[0]=Math.sqrt(i*i+n*n+a*a),r[1]=Math.sqrt(u*u+h*h+f*f),r[2]=Math.sqrt(_*_+g*g+v*v),r}function Vi(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=i+i,f=n+n,_=a+a,g=i*h,v=n*h,b=n*f,w=a*h,I=a*f,A=a*_,R=u*h,O=u*f,D=u*_;return r[0]=1-b-A,r[1]=v+D,r[2]=w-O,r[3]=0,r[4]=v-D,r[5]=1-g-A,r[6]=I+R,r[7]=0,r[8]=w+O,r[9]=I-R,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}var xi=at;function Wt(){var r=new Pe(3);return Pe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function _o(r){var e=new Pe(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function rn(r){var e=r[0],i=r[1],n=r[2];return Math.sqrt(e*e+i*i+n*n)}function Ci(r,e,i){var n=new Pe(3);return n[0]=r,n[1]=e,n[2]=i,n}function Li(r,e,i,n){return r[0]=e,r[1]=i,r[2]=n,r}function sr(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function go(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function Wn(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function Xn(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r}function hn(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r}function Ui(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function In(r,e,i,n){return r[0]=e[0]+i[0]*n,r[1]=e[1]+i[1]*n,r[2]=e[2]+i[2]*n,r}function za(r,e){var i=e[0]-r[0],n=e[1]-r[1],a=e[2]-r[2];return Math.sqrt(i*i+n*n+a*a)}function Jo(r,e){var i=e[0]-r[0],n=e[1]-r[1],a=e[2]-r[2];return i*i+n*n+a*a}function br(r){var e=r[0],i=r[1],n=r[2];return e*e+i*i+n*n}function nn(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function Ii(r,e){var i=e[0],n=e[1],a=e[2],u=i*i+n*n+a*a;return u>0&&(u=1/Math.sqrt(u)),r[0]=e[0]*u,r[1]=e[1]*u,r[2]=e[2]*u,r}function tr(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Kr(r,e,i){var n=e[0],a=e[1],u=e[2],h=i[0],f=i[1],_=i[2];return r[0]=a*_-u*f,r[1]=u*h-n*_,r[2]=n*f-a*h,r}function aa(r,e,i,n){var a=e[0],u=e[1],h=e[2];return r[0]=a+n*(i[0]-a),r[1]=u+n*(i[1]-u),r[2]=h+n*(i[2]-h),r}function pr(r,e,i){var n=e[0],a=e[1],u=e[2],h=i[3]*n+i[7]*a+i[11]*u+i[15];return r[0]=(i[0]*n+i[4]*a+i[8]*u+i[12])/(h=h||1),r[1]=(i[1]*n+i[5]*a+i[9]*u+i[13])/h,r[2]=(i[2]*n+i[6]*a+i[10]*u+i[14])/h,r}function Ss(r,e,i){var n=e[0],a=e[1],u=e[2];return r[0]=n*i[0]+a*i[3]+u*i[6],r[1]=n*i[1]+a*i[4]+u*i[7],r[2]=n*i[2]+a*i[5]+u*i[8],r}function Is(r,e,i){var n=i[0],a=i[1],u=i[2],h=i[3],f=e[0],_=e[1],g=e[2],v=a*g-u*_,b=u*f-n*g,w=n*_-a*f;return r[0]=f+h*(v+=v)+a*(w+=w)-u*(b+=b),r[1]=_+h*b+u*v-n*w,r[2]=g+h*w+n*b-a*v,r}function la(r){return r[0]=0,r[1]=0,r[2]=0,r}function Io(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var _r=go,Oa=Wn,As=rn;function Fa(){var r=new Pe(4);return Pe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function ca(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r}function Rl(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=i*i+n*n+a*a+u*u;return h>0&&(h=1/Math.sqrt(h)),r[0]=i*h,r[1]=n*h,r[2]=a*h,r[3]=u*h,r}function kn(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function An(r,e,i){var n=e[0],a=e[1],u=e[2],h=e[3];return r[0]=i[0]*n+i[4]*a+i[8]*u+i[12]*h,r[1]=i[1]*n+i[5]*a+i[9]*u+i[13]*h,r[2]=i[2]*n+i[6]*a+i[10]*u+i[14]*h,r[3]=i[3]*n+i[7]*a+i[11]*u+i[15]*h,r}function Qo(){var r=new Pe(4);return Pe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function es(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function Ms(r,e,i){i*=.5;var n=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=n*_+h*f,r[1]=a*_+u*f,r[2]=u*_-a*f,r[3]=h*_-n*f,r}function ua(r,e,i){i*=.5;var n=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=n*_-u*f,r[1]=a*_+h*f,r[2]=u*_+n*f,r[3]=h*_-a*f,r}Wt(),Fa();
1var dn,ka,Yn,Ll=Rl,ts=(dn=Wt(),ka=Ci(1,0,0),Yn=Ci(0,1,0),function(r,e,i){var n=tr(e,i);return n<-.999999?(Kr(dn,ka,e),As(dn)<1e-6&&Kr(dn,Yn,e),Ii(dn,dn),(function(a,u,h){h*=.5;var f=Math.sin(h);a[0]=f*u[0],a[1]=f*u[1],a[2]=f*u[2],a[3]=Math.cos(h)})(r,dn,Math.PI),r):n>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Kr(dn,e,i),r[0]=dn[0],r[1]=dn[1],r[2]=dn[2],r[3]=1+n,Ll(r,r))});function Jr(){var r=new Pe(2);return Pe!=Float32Array&&(r[0]=0,r[1]=0),r}function is(r,e){var i=new Pe(2);return i[0]=r,i[1]=e,i}function rs(r,e,i){return r[0]=e,r[1]=i,r}function Cs(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function ns(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function Ps(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function Rs(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)}function Ba(r,e){var i=e[0],n=e[1],a=i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function qi(r,e){return r[0]*e[0]+r[1]*e[1]}Qo(),Qo(),ot();var Wr,zc,Na=ns;function Kn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Jr();var oh=(function(){if(zc)return Wr;function r(e,i,n,a){this.cx=3*e,this.bx=3*(n-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=n,this.p2y=a}return zc=1,Wr=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,a=0;a<8;a++){var u=this.sampleCurveX(n)-e;if(Math.abs(u)<i)return n;var h=this.sampleCurveDerivativeX(n);if(Math.abs(h)<1e-6)break;n-=u/h}var f=0,_=1;for(n=e,a=0;a<20&&(u=this.sampleCurveX(n),!(Math.abs(u-e)<i));a++)e>u?f=n:_=n,n=.5*(_-f)+f;return n},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Wr})(),Va=Kn(oh);function Ke(r,e){this.x=r,this.y=e}function os(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!os(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!os(r[i],e[i]))return!1;return!0}return r===e}Ke.prototype={clone(){return new Ke(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround(r,e){const i=Math.cos(r),n=Math.sin(r),a=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ke},Ke.convert=function(r){if(r instanceof Ke)return r;if(Array.isArray(r))return new Ke(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Ke(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};const sh=Math.PI/180,Dl=180/Math.PI;function ci(r){return r*sh}function ye(r){return r*Dl}const N=[[0,0],[1,0],[1,1],[0,1]];function q(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function Q(r,e,i,n){const a=new Va(r,e,i,n);return function(u){return a.solve(u)}}const fe=Q(.25,.1,.25,1);function te(r,e,i){return Math.min(i,Math.max(e,r))}function me(r,e,i){return(i=te((i-r)/(e-r),0,1))*i*(3-2*i)}function Ie(r,e,i){const n=i-e,a=((r-e)%n+n)%n+e;return a===e?i:a}function ge(r,e,i){if(!r.length)return i(null,[]);let n=r.length;const a=new Array(r.length);let u=null;r.forEach((h,f)=>{e(h,(_,g)=>{_&&(u=_),a[f]=g,--n===0&&i(u,a)})})}let Re=1;function Je(){return Re++}function Ze(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log2(r)))}function xt(r,e){r.forEach(i=>
1{e[i]&&(e[i]=e[i].bind(e))})}function Pt(r,e,i){const n={};for(const a in r)n[a]=e.call(this,r[a],a,r);return n}function Lt(r,e,i){const n={};for(const a in r)e.call(this,r[a],a,r)&&(n[a]=r[a]);return n}function Gt(r){return Array.isArray(r)?r.map(Gt):typeof r=="object"&&r?Pt(r,Gt):r}function Xt(r,e){for(let i=0;i<r.length;i++)if(e.indexOf(r[i])>=0)return!0;return!1}const Nt={};function Ft(r){Nt[r]||(typeof console<"u"&&console.warn(r),Nt[r]=!0)}function Oi(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function wr(r){let e=0;for(let i,n,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],n=r[h],e+=(n.x-i.x)*(i.y+n.y);return e}function ar([r,e,i]){const n=ci(e+90),a=ci(i);return{x:r*Math.cos(n)*Math.sin(a),y:r*Math.sin(n)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function lr(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function $i(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,a,u)=>{const h=a||u;return e[n]=!h||h.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let si=null;function Yi(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function Pi(r,e,i,n){for(;e<i;){const a=e+i>>1;r[a]<n?e=a+1:i=a}return e}function Ri(r,e,i,n){for(;e<i;){const a=e+i>>1;r[a]<=n?e=a+1:i=a}return e}function or(r){return r>0?1/(1.001-r):1+r}function Xr(r){return r>0?1-1/(1.001-r):-r}function Ur(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const Ir={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Ir.API_URL)return null;try{const r=new URL(Ir.API_URL);return r.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":r.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_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",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Ls(r){return Ir.API_URL_REGEX.test(r)}function on(r){return Ir.API_SPRITE_REGEX.test(r)}let Bn,yo,Ao,Nn,fn,ss;function ha(){return Bn==null&&(Bn=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Bn}const Jn={now:()=>Nn!==void 0?Nn:performance.now(),setNow(r){Nn=r},restoreNow(){Nn=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:n}=r;fn||(fn=document.createElement("canvas"));const a=fn.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>fn.width||n>fn.height)&&(fn.width=i,fn.height=n),a.clearRect(-e,-e,i+2*e,n+2*e),a.drawImage(r,0,0,i,n),a.getImageData(-e,-e,i+2*e,n+2*e)},resolveURL:r=>(yo||(yo=document.createElement("a")),yo.href=r,yo.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Ao==null&&(Ao=window.matchMedia("(prefers-reduced-motion: reduce)")),Ao.matches)},hasCanvasFingerprintNoise(){if(ss!==void 0)return ss;if(!ha())return ss=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<r.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const n=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<n.data.length;++a)if(a%4!=3&&i++!==n.data[a])return ss=!0,!0;return ss=!1,!1}};function zl(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
1const n=new URLSearchParams(r.slice(i));for(const a in e)n.set(a,e[a]);return`${r.slice(0,i)}?${n.toString()}`}function Ol(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const n=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const h of e.persistentParams){const f=a.get(h);f&&n.set(h,f)}const u=n.toString();return`${r.slice(0,i)}${u.length>0?`?${u}`:""}`}const Sf="mapbox-tiles";let If=500,ah=50;const lh=["language","worldview","jobid"];let jr,Qn;function as(){try{return caches}catch{}}function eo(){const r=as();r&&jr==null&&(jr=r.open(Sf))}let Oo=1/0;const Ua={supported:!1,testSupport:function(r){!Ds&&da&&(Oc?Mf(r):ja=r)}};let ja,da,Ds=!1,Oc=!1;const Af=typeof self<"u"?self:{};function Mf(r){const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,da),r.isContextLost())return;Ua.supported=!0}catch{}r.deleteTexture(e),Ds=!0}Af.document&&(da=Af.document.createElement("img"),da.onload=function(){ja&&Mf(ja),ja=null,Oc=!0},da.onerror=function(){Ds=!0,ja=null},da.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Mn={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(Mn);class Fl extends Error{constructor(e,i,n){i===401&&Ls(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const kl=lr()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,ls=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(kl())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return(function(n,a){const u=new AbortController,h=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:kl(),referrerPolicy:n.referrerPolicy,signal:u.signal});let f=!1,_=!1;const g=(v=h.url).indexOf("sku=")>0&&Ls(v);var v;n.type==="json"&&h.headers.set("Accept","application/json");const b=(I,A,R)=>{if(_)return;if(I&&I.message!=="SecurityError"&&Ft(I.toString()),A&&R)return w(A);const O=Date.now();fetch(h).then(D=>
1{if(D.ok){const k=g?D.clone():null;return w(D,k,O)}return a(new Fl(D.statusText,D.status,n.url))}).catch(D=>{D.name!=="AbortError"&&a(new Error(`${D.message} ${n.url}`))})},w=(I,A,R)=>{(n.type==="arrayBuffer"?I.arrayBuffer():n.type==="json"?I.json():I.text()).then(O=>{_||(A&&R&&(function(D,k,U){if(eo(),jr==null)return;const G=$i(k.headers.get("Cache-Control")||"");if(G["no-store"])return;const K={status:k.status,statusText:k.statusText,headers:new Headers};k.headers.forEach((oe,ie)=>K.headers.set(ie,oe)),G["max-age"]&&K.headers.set("Expires",new Date(U+1e3*G["max-age"]).toUTCString());const Y=K.headers.get("Expires");if(!Y||new Date(Y).getTime()-U<42e4)return;let re=Ol(D.url,{persistentParams:lh});if(k.status===206){const oe=D.headers.get("Range");if(!oe)return;K.status=200,re=zl(re,{range:oe})}(function(oe,ie){if(Qn===void 0)try{new Response(new ReadableStream),Qn=!0}catch{Qn=!1}Qn?ie(oe.body):oe.blob().then(ie).catch(ce=>Ft(ce.message))})(k,oe=>{const ie=new Response((ce=k.status)!==200&&ce!==404&&[101,103,204,205,304].includes(ce)?null:oe,K);var ce;eo(),jr?.then(de=>de.put(re,ie)).catch(de=>Ft(de.message))})})(h,A,R),f=!0,a(null,O,I.headers))}).catch(O=>{_||a(new Error(O.message))})};return g?(function(I,A){if(eo(),jr==null)return A(null);jr.then(R=>
1{let O=Ol(I.url,{persistentParams:lh});const D=I.headers.get("Range");D&&(O=zl(O,{range:D})),R.match(O).then(k=>{const U=(function(G){if(!G)return!1;const K=new Date(G.headers.get("Expires")||0),Y=$i(G.headers.get("Cache-Control")||"");return Number(K)>Date.now()&&!Y["no-cache"]})(k);R.delete(O).catch(A),U&&R.put(O,k.clone()).catch(A),A(null,k,U)}).catch(A)}).catch(A)})(h,b):b(null,null),{cancel:()=>{_=!0,f||u.abort()}}})(r,e);if(lr(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return(function(n,a){const u=new XMLHttpRequest;u.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const h in n.headers)u.setRequestHeader(h,n.headers[h]);return n.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=n.credentials==="include",u.onerror=()=>{a(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let h=u.response;if(n.type==="json")try{h=JSON.parse(u.response)}catch(_){return a(_)}const f=new Headers;u.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(_=>{const g=_.split(": "),v=g.shift(),b=g.join(": ");f.append(v,b)}),a(null,h,f)}else a(new Fl(u.statusText,u.status,n.url))},u.send(n.body),{cancel:()=>u.abort()}})(r,e)},Bl=function(r,e){return ls(Object.assign(r,{type:"arrayBuffer"}),e)};function u_(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const ch="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let di,Ga;di=[],Ga=0;const Fc=function(r,e){if(Ua.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),Ga>=Ir.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return di.push(u),u}Ga++;let i=!1;const n=()=>
1{if(!i)for(i=!0,Ga--;di.length&&Ga<Ir.MAX_PARALLEL_IMAGE_REQUESTS;){const u=di.shift(),{requestParameters:h,callback:f,cancelled:_}=u;_||(u.cancel=Fc(h,f).cancel)}},a=Bl(r,(u,h,f)=>{n(),u?e(u):h&&(self.createImageBitmap?(function(_,g){const v=new Blob([new Uint8Array(_)],{type:"image/png"});createImageBitmap(v).then(b=>{g(null,b)}).catch(b=>{g(new Error(`Could not load image because of ${b.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})})(h,(_,g)=>e(_,g,f)):(function(_,g){const v=new Image;v.onload=()=>{g(null,v),URL.revokeObjectURL(v.src),v.onload=null,requestAnimationFrame(()=>{v.src=ch})},v.onerror=()=>g(new 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."));const b=new Blob([new Uint8Array(_)],{type:"image/png"});v.src=_.byteLength?URL.createObjectURL(b):ch})(h,(_,g)=>e(_,g,f)))});return{cancel:()=>{a.cancel(),n()}}};var Cf,Pf,Nl,zs={exports:{}},Vl={exports:{}},kc={exports:{}},h_=(function(){if(Nl)return zs.exports;Nl=1;var r=(Cf||(Cf=1,Vl.exports=function(i,n){var a,u,h,f,_,g,v,b;for(u=i.length-(a=3&i.length),h=n,_=3432918353,g=461845907,b=0;b<u;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,h=27492+(65535&(f=5*(65535&(h=(h^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+(((f>>>16)+58964&65535)<<16);switch(v=0,a){case 3:v^=(255&i.charCodeAt(b+2))<<16;case 2:v^=(255&i.charCodeAt(b+1))<<8;case 1:h^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(b)))*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),Vl.exports),e=(Pf||(Pf=1,kc.exports=function(i,n){for(var a,u=i.length,h=n^u,f=0;u>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(a>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),u-=4,++f;switch(u){case 3:h^=(255&i.charCodeAt(f+2))<<16;case 2:h^=(255&i.charCodeAt(f+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(f)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),kc.exports);return zs.exports=r,zs.exports.murmur3=r,zs.exports.murmur2=e,zs.exports})(),qa=Kn(h_);class cs{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class Ul extends cs{constructor(e,i={}){super("error",Object.assign({error:e},i))}}function Rf(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function fa(r,e,i){if(i&&i[r]){const n=i[r].indexOf(e);n!==-1&&i[r].splice(n,1)}}class us{on(e,i){return this._listeners=this._listeners||{},Rf(e,i,this._listeners),this}off(e,i){return fa(e,i,this._listeners),fa(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Rf(e,i,this._oneTimeListeners),this):new Promise(n=>{this.once(e,n)})}fire(e,i){const n=typeof e=="string"?new cs(e,i):e,a=n.type;if(this.listens(a)){n.target=this;const u=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of u)_.call(this,n);const h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of h)fa(a,_,this._oneTimeListeners),_.call(this,n);const f=this._eventedParent;if(f){const _=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(n,_),f.fire(n)}}else n instanceof Ul&&console.error(n.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class Cn{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new Cn(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,n]=e.split("�");return new Cn({name:i,iconsetId:n})}
vendor: 24,189 bytes, line 1
1static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return Cn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var xo,Bc={},Lf=(function(){if(xo)return Bc;xo=1;var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(u){return(u=Math.round(u))<0?0:u>255?255:u}function i(u){return e(u[u.length-1]==="%"?parseFloat(u)/100*255:parseInt(u))}function n(u){return(h=u[u.length-1]==="%"?parseFloat(u)/100:parseFloat(u))<0?0:h>1?1:h;var h}function a(u,h,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?u+(h-u)*f*6:2*f<1?h:3*f<2?u+(h-u)*(2/3-f)*6:u}try{Bc.parseCSSColor=function(u){var h,f=u.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(h=parseInt(f.substr(1),16))>=0&&h<=4095?[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]:null:f.length===7&&(h=parseInt(f.substr(1),16))>=0&&h<=16777215?[(16711680&h)>>16,(65280&h)>>8,255&h,1]:null;var _=f.indexOf("("),g=f.indexOf(")");if(_!==-1&&g+1===f.length){var v=f.substr(0,_),b=f.substr(_+1,g-(_+1)).split(","),w=1;switch(v){case"rgba":if(b.length!==4)return null;w=n(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),w];case"hsla":if(b.length!==4)return null;w=n(b.pop());case"hsl":if(b.length!==3)return null;var I=(parseFloat(b[0])%360+360)%360/360,A=n(b[1]),R=n(b[2]),O=R<=.5?R*(A+1):R+A-R*A,D=2*R-O;return[e(255*a(D,O,I+1/3)),e(255*a(D,O,I)),e(255*a(D,O,I-1/3)),w];default:return null}}return null}}catch{}return Bc})();class vi{constructor(e,i,n,a=1){this.r=e,this.g=i,this.b=n,this.a=a}static parse(e){if(!e)return;if(e instanceof vi)return e;if(typeof e!="string")return;const i=Lf.parseCSSColor(e);return i?new vi(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,n,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:n,b:a,a:u}=this;return new Df(e,i,n,a,u)}toPremultipliedRenderColor(e){const{r:i,g:n,b:a,a:u}=this;return new zf(e,i*u,n*u,a*u,u)}clone(){return new vi(this.r,this.g,this.b,this.a)}}class uh{constructor(e,i,n,a,u,h=!1){if(this.premultiplied=!1,this.premultiplied=h,e){const f=e.image.height,_=f*f;this.premultiplied?(i=u===0?0:i/u*(f-1),n=u===0?0:n/u*(f-1),a=u===0?0:a/u*(f-1)):(i*=f-1,n*=f-1,a*=f-1),i=Math.max(0,Math.min(f-1,i)),n=Math.max(0,Math.min(f-1,n)),a=Math.max(0,Math.min(f-1,a));const g=Math.floor(i),v=Math.floor(n),b=Math.floor(a),w=Math.ceil(i),I=Math.ceil(n),A=Math.ceil(a),R=i-g,O=n-v,D=a-b,k=e.image.data,U=4*(g+v*_+b*f),G=4*(g+v*_+A*f),K=4*(g+I*_+b*f),Y=4*(g+I*_+A*f),re=4*(w+v*_+b*f),oe=4*(w+v*_+A*f),ie=4*(w+I*_+b*f),ce=4*(w+I*_+A*f);this.r=Dt(Dt(Dt(k[U],k[G],D),Dt(k[K],k[Y],D),O),Dt(Dt(k[re],k[oe],D),Dt(k[ie],k[ce],D),O),R)/255*(this.premultiplied?u:1),this.g=Dt(Dt(Dt(k[U+1],k[G+1],D),Dt(k[K+1],k[Y+1],D),O),Dt(Dt(k[re+1],k[oe+1],D),Dt(k[ie+1],k[ce+1],D),O),R)/255*(this.premultiplied?u:1),this.b=Dt(Dt(Dt(k[U+2],k[G+2],D),Dt(k[K+2],k[Y+2],D),O),Dt(Dt(k[re+2],k[oe+2],D),Dt(k[ie+2],k[ce+2],D),O),R)/255*(this.premultiplied?u:1),this.a=u}else this.r=i,this.g=n,this.b=a,this.a=u}toArray(){const{r:e,g:i,b:n,a}=this;return[255*e,255*i,255*n,a]}toHslaArray(){let{r:e,g:i,b:n,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];const A=1/a;e*=A,i*=A,n*=A}const u=Math.min(Math.max(e,0),1),h=Math.min(Math.max(i,0),1),f=Math.min(Math.max(n,0),1),_=Math.min(u,h,f),g=Math.max(u,h,f),v=g-_,b=.5*(_+g);if(v===0)return[0,0,100*b,a];const w=b>.5?v/(2-g-_):v/(g+_);let I;switch(g){case u:I=60*((h-f)/v+(h<f?6:0));break;case h:I=60*((f-u)/v+2);break;default:I=60*((u-h)/v+4)}return[I,100*w,100*b,a]}toArray01(){const{r:e,g:i,b:n,a}=this;return[e,i,n,a]}toArray01Scaled(e){const{r:i,g:n,b:a}=this;return[i*e,n*e,a*e]}toArray01Linear(){const{r:e,g:i,b:n,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(n,2.2),a]}}class Df extends uh{constructor(e,i,n,a,u){super(e,i,n,a,u,!1)}}class zf extends uh{constructor(e,i,n,a,u){super(e,i,n,a,u,!0)}}function Dt(r,e,i){return r*(1-i)+e*i}function hh(r,e,i){return r.map((n,a)=>Dt(n,e[a],i))}vi.black=new vi(0,0,0,1),vi.white=new vi(1,1,1,1),vi.transparent=new vi(0,0,0,0),vi.red=new vi(1,0,0,1),vi.blue=new vi(0,0,1,1);var pa=Object.freeze({__proto__:null,array:hh,color:function(r,e,i){return new vi(Dt(r.r,e.r,i),Dt(r.g,e.g,i),Dt(r.b,e.b,i),Dt(r.a,e.a,i))},number:Dt});class pn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Nc{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[n,a]of i)this.bindings[n]=a}concat(e){return new Nc(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Pn={kind:"null"},At={kind:"number"},yi={kind:"string"},fi={kind:"boolean"},mn={kind:"color"},$a={kind:"object"},wi={kind:"value"},Vc={kind:"collator"},Ha={kind:"formatted"},ma={kind:"resolvedImage"};function sn(r,e){return{kind:"array",itemType:r,N:e}}function mr(r){if(r.kind==="array"){const e=mr(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const d_=[Pn,At,yi,fi,mn,Ha,$a,sn(wi),ma];function jl(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!jl(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of d_)if(!jl(i,e))return null}}return`Expected ${mr(r)} but found ${mr(e)} instead.`}function dh(r,e){return e.some(i=>i.kind===r.kind)}function Gl(r,e){return e.some(i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r)}function Uc(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&Uc(r.itemType,e.itemType):r.kind===e.kind}class fh{constructor(e,i,n){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=n,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 jc{constructor(e,i,n,a,u){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=n,this.fontStack=a,this.textColor=u}}class an{constructor(e){this.sections=e}static fromString(e){return new an([new jc(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof an?e:an.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(n)}return e}}class Rn{constructor(e,i={}){this.id=Cn.from(e),this.params=i.params,this.sx=i.sx||1,this.sy=i.sy||1}toString(){return JSON.stringify(this)}static parse(e){let i,n,a,u;try{({id:i,params:n,sx:a,sy:u}=JSON.parse(e)||{})}catch{return null}return i?new Rn(i,{params:n,sx:a,sy:u}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class Ln{constructor(e,i,n,a,u=!1){this.primaryId=Cn.from(e),this.primaryOptions=i,n&&(this.secondaryId=Cn.from(n)),this.secondaryOptions=a,this.available=u}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Rn(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Rn(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?Ln.build({name:e}):e}static build(e,i,n,a){return!e||typeof e=="object"&&!("name"in e)?null:new Ln(e,n,i,a)}}function ph(r,e,i,n){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[r,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[r,e,i,n]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Os(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof vi||r instanceof fh||r instanceof an||r instanceof Ln)return!0;if(Array.isArray(r)){for(const e of r)if(!Os(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Os(r[e]))return!1;return!0}return!1}function Dr(r){if(r===null)return Pn;if(typeof r=="string")return yi;if(typeof r=="boolean")return fi;if(typeof r=="number")return At;if(r instanceof vi)return mn;if(r instanceof fh)return Vc;if(r instanceof an)return Ha;if(r instanceof Ln)return ma;if(Array.isArray(r)){const e=r.length;let i;for(const n of r){const a=Dr(n);if(i){if(i===a)continue;i=wi;break}i=a}return sn(i||wi,e)}return $a}function Fo(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof an||r instanceof Ln||r instanceof vi?r.toString():JSON.stringify(r)}class hs{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Os(e[1]))return i.error("invalid value");const n=e[1];let a=Dr(n);const u=i.expectedType;return a.kind!=="array"||a.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(a=u),new hs(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof vi?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof an?this.value.serialize():this.value}}class Ar{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Fs={string:yi,number:At,boolean:fi,object:$a};class Ut{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 n,a=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in Fs)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=Fs[g],a++}else f=wi;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);_=e[2],a++}n=sn(f,_)}else n=Fs[u];const h=[];for(;a<e.length;a++){const f=i.parse(e[a],a,wi);if(!f)return null;h.push(f)}return new Ut(n,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const n=this.args[i].evaluate(e);if(!jl(this.type,Dr(n)))return n;if(i===this.args.length-1)throw new Ar(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${mr(Dr(n))} but was expected to be of type ${mr(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){i.push(n.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(n=>n.serialize()))}}class It{constructor(e){this.type=Ha,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");const a=[];let u=!1;for(let h=1;h<=e.length-1;++h){const f=e[h];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=i.parseObjectValue(f["font-scale"],h,"font-scale",At),!_))return null;let g=null;if(f["text-font"]&&(g=i.parseObjectValue(f["text-font"],h,"text-font",sn(yi)),!g))return null;let v=null;if(f["text-color"]&&(v=i.parseObjectValue(f["text-color"],h,"text-color",mn),!v))return null;const b=a[a.length-1];b.scale=_,b.font=g,b.textColor=v}else{const _=i.parse(e[h],h,wi);if(!_)return null;const g=_.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new It(a)}evaluate(e){return new an(this.sections.map(i=>{const n=i.content.evaluate(e);return Uc(Dr(n),ma)?new jc("",n,null,null,null):new jc(Fo(n),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(const 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(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),e.push(n)}return e}}class Za{constructor(e,i,n,a){this._imageWarnHistory={},this.type=ma,this.namePrimary=e,this.nameSecondary=i,n&&(this.paramsPrimary=n.params,this.iconsetIdPrimary=n.iconset?n.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let n=1;const a=[];function u(){if(n<e.length){const f=i.parse(e[n],n++,yi);return f?(a.push({image:f,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function h(){if(n<e.length){const _=e[n];if((f=_)===null||typeof f!="object"||Array.isArray(f))return!0;const g=_.params,v=_.iconset,b=i.concat(n);if(!g&&!v)return n++,!0;if(g){if(typeof g!="object"||g.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const w={},I=b.concat(void 0,"params");for(const A in g){if(!A)return I.error("Image parameter name should be non-empty"),!1;const R=I.concat(void 0,A).parse(g[A],void 0,mn,void 0,{typeAnnotation:"coerce"});if(!R)return!1;w[A]=R}a[a.length-1].options.params=w}if(v){if(typeof v!="object"||v.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!v.id)return b.error('Image options "iconset" should have an "id" property'),!1;a[a.length-1].options.iconset=v}return n++,!0}var f;return!0}for(let f=0;f<2;f++)if(!u()||!h())return;return new Za(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const n={};if(i){for(const a in i)if(i[a])try{n[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(n).length!==0)return{params:n}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},n=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=Ln.build(i,n,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const u=a.getPrimary().id;if(a.available=e.availableImages.some(h=>Cn.isEqual(h,u)),a.available){const h=a.getSecondary()?a.getSecondary().id:null;h&&(a.available=e.availableImages.some(f=>Cn.isEqual(f,h)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const n={};if(i&&(n.iconset={id:i}),e){n.params={};for(const a in e)e[a]&&(n.params[a]=e[a].serialize())}return Object.keys(n).length>0?n:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function kt(r){return ql(r)?"string":zt(r)?"number":mh(r)?"boolean":Array.isArray(r)?"array":r===null?"null":Gc(r)?"object":typeof r}function Gc(r){return r!=null&&!Array.isArray(r)&&typeof r!="function"&&!(r instanceof String||r instanceof Number||r instanceof Boolean)&&typeof r=="object"}function ql(r){return typeof r=="string"||r instanceof String}function zt(r){return typeof r=="number"||r instanceof Number}function mh(r){return typeof r=="boolean"||r instanceof Boolean}const _h={"to-boolean":fi,"to-color":mn,"to-number":At,"to-string":yi};class ko{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.");const n=e[0],a=[];let u=Pn;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);u=sn(i.expectedType.itemType,h)}else{if(!(h>0&&Os(e[1][0])))return null;u=sn(Dr(e[1][0]),h)}for(let f=0;f<h;f++){const _=e[1][f];let g;if(Array.isArray(_))g=i.parse(_,void 0,u.itemType);else{const v=kt(_);if(v!==u.itemType.kind)return i.error(`Expected ${u.itemType.kind} but found ${v}.`);g=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!g)return null;a.push(g)}}else{if((n==="to-boolean"||n==="to-string")&&e.length!==2)return i.error("Expected one argument.");u=_h[n];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,wi);if(!f)return null;a.push(f)}}return new ko(u,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,n;for(const a of this.args){if(i=a.evaluate(e),n=null,i instanceof vi)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(n=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ph(i[0],i[1],i[2],i[3]),!n))return new vi(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Ar(n||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const n of this.args){if(i=n.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new Ar(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?an.fromString(Fo(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Ln.build(Fo(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):Fo(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new It([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Za(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const Of=["Unknown","Point","LineString","Polygon"];class Wa{constructor(e,i,n){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i,this.iconImageUseTheme=n}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Of[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:n,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];
1return i||(i=this._parseColorCache[e]=vi.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Dn{constructor(e,i,n,a,u){this.name=e,this.type=i,this._evaluate=n,this.args=a,this._overloadIndex=u}evaluate(e){if(!this._evaluate){const i=Dn.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.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){const n=e[0],a=Dn.definitions[n];if(!a)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=[];let _=null,g=-1;for(const[v,b]of h){if(Array.isArray(v)&&v.length!==e.length-1)continue;f.push(v),g++,_=new Qc(i.registry,i.path,null,i.scope,void 0,i._scope,i.options,i.iconImageUseTheme);const w=[];let I=!1;for(let A=1;A<e.length;A++){const R=e[A],O=Array.isArray(v)?v[A-1]:v.type,D=_.parse(R,1+w.length,O);if(!D){I=!0;break}w.push(D)}if(!I)if(Array.isArray(v)&&v.length!==w.length)_.error(`Expected ${v.length} arguments, but found ${w.length} instead.`);else{for(let A=0;A<w.length;A++){const R=Array.isArray(v)?v[A]:v.type,O=w[A];_.concat(A+1).checkSubtype(R,O.type)}if(_.errors.length===0)return new Dn(n,u,b,w,g)}}if(f.length===1)i.errors.push(..._.errors);else{const v=(f.length?f:h.map(([w])=>w)).map(gh).join(" | "),b=[];for(let w=1;w<e.length;w++){const I=i.parse(e[w],1+b.length);if(!I)return null;b.push(mr(I.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){Dn.definitions=i;for(const n in i)e[n]=Dn}}function gh(r){return Array.isArray(r)?`(${r.map(mr).join(", ")})`:`(${mr(r.type)}...)`}class Bo{constructor(e,i,n){this.type=Vc,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return i.error("Collator options argument must be an object.");const a=n["case-sensitive"]===void 0?i.parse(!1,1,fi):i.parseObjectValue(n["case-sensitive"],1,"case-sensitive",fi);if(!a)return null;const u=n["diacritic-sensitive"]===void 0?i.parse(!1,1,fi):i.parseObjectValue(n["diacritic-sensitive"],1,"diacritic-sensitive",fi);if(!u)return null;let h=null;return n.locale&&(h=i.parseObjectValue(n.locale,1,"locale",yi),!h)?null:new Bo(a,u,h)}evaluate(e){return new fh(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function qc(r,e,i=0,n=r.length-1,a=ks){for(;n>i;){if(n-i>600){const _=n-i+1,g=e-i+1,v=Math.log(_),b=.5*Math.exp(2*v/3),w=.5*Math.sqrt(v*b*(_-b)/_)*(g-_/2<0?-1:1);qc(r,e,Math.max(i,Math.floor(e-g*b/_+w)),Math.min(n,Math.floor(e+(_-g)*b/_+w)),a)}const u=r[e];let h=i,f=n;for(vo(r,i,e),a(r[n],u)>0&&vo(r,i,n);h<f;){for(vo(r,h,f),h++,f--;a(r[h],u)<0;)h++;for(;a(r[f],u)>0;)f--}a(r[i],u)===0?vo(r,i,f):(f++,vo(r,f,n)),f<=e&&(i=f+1),e<=f&&(n=f-1)}}function vo(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}function ks(r,e){return r<e?-1:r>e?1:0}function f_(r){let e=0;for(let i,n,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],n=r[h],e+=(n.x-i.x)*(i.y+n.y);return e}function $l(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Hl(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function $c(r,e,i){const n=r[0]-e[0],a=r[1]-e[1],u=r[0]-i[0],h=r[1]-i[1];return n*h-u*a===0&&n*u<=0&&a*h<=0}function Ff(r,e,i){return e[1]>r[1]!=i[1]>r[1]&&r[0]<(i[0]-e[0])*(r[1]-e[1])/(i[1]-e[1])+e[0]}function bo(r,e,i=!1){let n=!1;for(let a=0,u=e.length;a<u;a++){const h=e[a];for(let f=0,_=h.length,g=_-1;f<_;g=f++){const v=h[g],b=h[f];if($c(r,v,b))return i;Ff(r,v,b)&&(n=!n)}}return n}function kf(r,e,i,n){const a=n[0]-i[0],u=n[1]-i[1],h=(r[0]-i[0])*u-a*(r[1]-i[1]),f=(e[0]-i[0])*u-a*(e[1]-i[1]);return h>0&&f<0||h<0&&f>0}function Hc(r,e,i,n){return(a=[n[0]-i[0],n[1]-i[1]])[0]*(u=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*u[0]!==0&&!(!kf(r,e,i,n)||!kf(i,n,r,e));var a,u}function Zl(r){const e=new Ke(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Ke(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of r[0])e.x>n.x&&(e.x=n.x),e.y>n.y&&(e.y=n.y),i.x<n.x&&(i.x=n.x),i.y<n.y&&(i.y=n.y);return{min:e,max:i}}const Bs=8192;function p_(r,e){const i=(180+r[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*Bs),Math.round(n*a*Bs)]}function Bf(r,e){for(let i=0;i<e.length;i++)if(bo(r,e[i]))return!0;return!1}function m_(r,e,i){for(const n of i)for(let a=0,u=n.length,h=u-1;a<u;h=a++)if(Hc(r,e,n[h],n[a]))return!0;return!1}function yh(r,e){for(let i=0;i<r.length;++i)if(!bo(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(m_(r[i],r[i+1],e))return!1;return!0}function __(r,e){for(let i=0;i<e.length;i++)if(yh(r,e[i]))return!0;return!1}function ds(r,e,i){const n=[];for(let a=0;a<r.length;a++){const u=[];for(let h=0;h<r[a].length;h++){const f=p_(r[a][h],i);$l(e,f),u.push(f)}n.push(u)}return n}function Nf(r,e,i){const n=[];for(let a=0;a<r.length;a++){const u=ds(r[a],e,i);n.push(u)}return n}function Vf(r,e,i,n){if(r[0]<i[0]||r[0]>i[2]){const a=.5*n;let u=r[0]-i[0]>a?-n:i[0]-r[0]>a?n:0;u===0&&(u=r[0]-i[2]>a?-n:i[2]-r[0]>a?n:0),r[0]+=u}$l(e,r)}function Zc(r,e,i,n){const a=Math.pow(2,n.z)*Bs,u=[n.x*Bs,n.y*Bs],h=[];if(!r)return h;for(const f of r)for(const _ of f){const g=[_.x+u[0],_.y+u[1]];Vf(g,e,i,a),h.push(g)}return h}function xh(r,e,i,n){const a=Math.pow(2,n.z)*Bs,u=[n.x*Bs,n.y*Bs],h=[];if(!r)return h;for(const _ of r){const g=[];for(const v of _){const b=[v.x+u[0],v.y+u[1]];$l(e,b),g.push(b)}h.push(g)}if(e[2]-e[0]<=a/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of h)for(const g of _)Vf(g,e,i,a)}var f;return h}class Ns{constructor(e,i){this.type=fi,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Os(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let a=0;a<n.features.length;++a){const u=n.features[a].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Ns(n,n.features[a].geometry)}else if(n.type==="Feature"){const a=n.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new Ns(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Ns(n,n)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,n){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const f=ds(n.coordinates,u,h),_=Zc(i.geometry(),a,u,h);if(!Hl(a,u))return!1;for(const g of _)if(!bo(g,f))return!1}if(n.type==="MultiPolygon"){const f=Nf(n.coordinates,u,h),_=Zc(i.geometry(),a,u,h);if(!Hl(a,u))return!1;for(const g of _)if(!Bf(g,f))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,n){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const f=ds(n.coordinates,u,h),_=xh(i.geometry(),a,u,h);if(!Hl(a,u))return!1;for(const g of _)if(!yh(g,f))return!1}if(n.type==="MultiPolygon"){const f=Nf(n.coordinates,u,h),_=xh(i.geometry(),a,u,h);if(!Hl(a,u))return!1;for(const g of _)if(!__(g,f))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Vn={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},vh=1/298.257223563,bh=vh*(2-vh),Xa=Math.PI/180;class Ya{static fromTile(e,i,n){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),u=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/Xa;return new Ya(u,n)}static get units(){return Vn}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!Vn[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Vn).join(", ")}`);const n=6378.137*Xa*(i?Vn[i]:1),a=Math.cos(e*Xa),u=1/(1-bh*(1-a*a)),h=Math.sqrt(u);this.kx=n*h*a,this.ky=n*h*u*(1-bh)}distance(e,i){const n=to(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(n*n+a*a)}bearing(e,i){const n=to(i[0]-e[0])*this.kx;return Math.atan2(n,(i[1]-e[1])*this.ky)/Xa}destination(e,i,n){const a=n*Xa;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,n){return[e[0]+i/this.kx,e[1]+n/this.ky]}lineDistance(e){let i=0;for(let n=0;n<e.length-1;n++)i+=this.distance(e[n],e[n+1]);return i}area(e){let i=0;for(let n=0;n<e.length;n++){const a=e[n];for(let u=0,h=a.length,f=h-1;u<h;f=u++)i+=to(a[u][0]-a[f][0])*(a[u][1]+a[f][1])*(n?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let n=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const u=e[a],h=e[a+1],f=this.distance(u,h);if(n+=f,n>i)return Wc(u,h,(i-(n-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,i,n){let[a,u]=i,h=to(n[0]-a)*this.kx,f=(n[1]-u)*this.ky;if(h!==0||f!==0){const _=(to(e[0]-a)*this.kx*h+(e[1]-u)*this.ky*f)/(h*h+f*f);_>1?(a=n[0],u=n[1]):_>0&&(a+=h/this.kx*_,u+=f/this.ky*_)}return h=to(e[0]-a)*this.kx,f=(e[1]-u)*this.ky,Math.sqrt(h*h+f*f)}pointOnLine(e,i){let n=1/0,a=e[0][0],u=e[0][1],h=0,f=0;for(let _=0;_<e.length-1;_++){let g=e[_][0],v=e[_][1],b=to(e[_+1][0]-g)*this.kx,w=(e[_+1][1]-v)*this.ky,I=0;b===0&&w===0||(I=(to(i[0]-g)*this.kx*b+(i[1]-v)*this.ky*w)/(b*b+w*w),I>
11?(g=e[_+1][0],v=e[_+1][1]):I>0&&(g+=b/this.kx*I,v+=w/this.ky*I)),b=to(i[0]-g)*this.kx,w=(i[1]-v)*this.ky;const A=b*b+w*w;A<n&&(n=A,a=g,u=v,h=_,f=I)}return{point:[a,u],index:h,t:Math.max(0,Math.min(1,f))}}lineSlice(e,i,n){let a=this.pointOnLine(n,e),u=this.pointOnLine(n,i);if(a.index>u.index||a.index===u.index&&a.t>u.t){const g=a;a=u,u=g}const h=[a.point],f=a.index+1,_=u.index;!wh(n[f],h[0])&&f<=_&&h.push(n[f]);for(let g=f+1;g<=_;g++)h.push(n[g]);return wh(n[_],u.point)||h.push(u.point),h}lineSliceAlong(e,i,n){let a=0;const u=[];for(let h=0;h<n.length-1;h++){const f=n[h],_=n[h+1],g=this.distance(f,_);if(a+=g,a>e&&u.length===0&&u.push(Wc(f,_,(e-(a-g))/g)),a>=i)return u.push(Wc(f,_,(i-(a-g))/g)),u;a>e&&u.push(_)}return u}bufferPoint(e,i){const n=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-n,e[0]+a,e[1]+n]}bufferBBox(e,i){const n=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-n,e[2]+a,e[3]+n]}insideBBox(e,i){return to(e[0]-i[0])>=0&&to(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function wh(r,e){return r[0]===e[0]&&r[1]===e[1]}function Wc(r,e,i){const n=to(e[0]-r[0]);return[r[0]+n*i,r[1]+(e[1]-r[1])*i]}function to(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class Wl{constructor(e=[],i=(n,a)=>n<a?-1:n>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:n}=this,a=i[e];for(;e>0;){const u=e-1>>1,h=i[u];if(n(a,h)>=0)break;i[e]=h,e=u}i[e]=a}_down(e){const{data:i,compare:n}=this,a=this.length>>1,u=i[e];for(;e<a;){let h=1+(e<<1);const f=h+1;if(f<this.length&&n(i[f],i[h])<0&&(h=f),n(i[h],u)>=0)break;i[e]=i[h],e=h}i[e]=u}}var lt=8192;function Th(r,e){return e.dist-r.dist}function Eh(r){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==r[i])return!1;return!0}function Xl(r){return r[1]-r[0]+1}function No(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function Sh(r,e){if(r[0]>r[1])return[null,null];const i=Xl(r);if(e){if(i===2)return[r,null];const n=Math.floor(i/2);return[[r[0],r[0]+n],[r[0]+n,r[1]]]}{if(i===1)return[r,null];const n=Math.floor(i/2)-1;return[[r[0],r[0]+n],[r[0]+n+1,r[1]]]}}function _a(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!No(e,r.length))return i;for(let n=e[0];n<=e[1];++n)$l(i,r[n]);return i}function ga(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let n=0;n<r[i].length;++n)$l(e,r[i][n]);return e}function Vs(r,e,i){if(Eh(r)||Eh(e))return NaN;let n=0,a=0;return r[2]<e[0]&&(n=e[0]-r[2]),r[0]>e[2]&&(n=r[0]-e[2]),r[1]>e[3]&&(a=r[1]-e[3]),r[3]<e[1]&&(a=e[1]-r[3]),i.distance([0,0],[n,a])}function Xc(r){return 360*r-180}function Uf(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Yc(r,e){const i=Math.pow(2,e.z),n=(r.y/lt+e.y)/i;return[Xc((r.x/lt+e.x)/i),Uf(n)]}function g_(r,e){const i=[];for(let n=0;n<r.length;++n)i.push(Yc(r[n],e));return i}function jf(r,e,i){const n=i.pointOnLine(e,r).point;return i.distance(r,n)}function Ih(r,e,i,n,a){const u=i.slice(n[0],n[1]+1);let h=1/0;for(let f=e[0];f<=e[1];++f)if((h=Math.min(h,jf(r[f],u,a)))===0)return 0;return h}function Us(r,e,i,n,a){const u=Math.min(a.pointToSegmentDistance(r,i,n),a.pointToSegmentDistance(e,i,n)),h=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(n,r,e));return Math.min(u,h)}function ni(r,e,i,n,a){if(!No(e,r.length)||!No(n,i.length))return NaN;let u=1/0;for(let h=e[0];h<e[1];++h)for(let f=n[0];f<n[1];++f){if(Hc(r[h],r[h+1],i[f],i[f+1]))return 0;u=Math.min(u,Us(r[h],r[h+1],i[f],i[f+1],a))}return u}function y_(r,e,i,n,a){if(!No(e,r.length)||!No(n,i.length))return NaN;let u=1/0;for(let h=e[0];h<=e[1];++h)for(let f=n[0];f<=n[1];++f)if((u=Math.min(u,a.distance(r[h],i[f])))===0)return u;return u}function x_(r,e,i){if(bo(r,e,!0))return 0;let n=1/0;for(const a of e){const u=a.length;if(u<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[u-1]&&(n=Math.min(n,i.pointToSegmentDistance(r,a[u-1],a[0])))===0||(n=Math.min(n,jf(r,a,i)))===0)return n}return n}function v_(r,e,i,n){if(!No(e,r.length))return NaN;for(let u=e[0];u<=e[1];++u)if(bo(r[u],i,!0))return 0;let a=1/0;for(let u=e[0];u<e[1];++u)for(const h of i)for(let f=0,_=h.length,g=_-1;f<_;g=f++){if(Hc(r[u],r[u+1],h[g],h[f]))return 0;a=Math.min(a,Us(r[u],r[u+1],h[g],h[f],n))}return a}function Ah(r,e){for(const i of r)for(let n=0;n<=i.length-1;++n)if(bo(i[n],e,!0))return!0;return!1}function b_(r,e,i,n=1/0){const a=ga(r),u=ga(e);if(n!==1/0&&Vs(a,u,i)>=n)return n;if(Hl(a,u)){if(Ah(r,e))return 0}else if(Ah(e,r))return 0;let h=n;for(const f of r)for(let _=0,g=f.length,v=g-1;_<g;v=_++)for(const b of e)for(let w=0,I=b.length,A=I-1;w<I;A=w++){if(Hc(f[v],f[_],b[A],b[w]))return 0;h=Math.min(h,Us(f[v],f[_],b[A],b[w],i))}return h}function ji(r,e,i,n,a,u,h){if(u===null||h===null)return;const f=Vs(_a(n,u),_a(a,h),i);f<e&&r.push({dist:f,range1:u,range2:h})}function w_(r,e,i,n,a=1/0){let u=Math.min(n.distance(r[0],i[0][0]),a);if(u===0)return u;const h=new Wl([{dist:0,range1:[0,r.length-1],range2:[0,0]}],Th),f=e?50:100,_=ga(i);for(;h.length;){const g=h.pop();if(g.dist>=u)continue;const v=g.range1;if(Xl(v)<=f){if(!No(v,r.length))return NaN;if(e){const b=v_(r,v,i,n);if((u=Math.min(u,b))===0)return u}else for(let b=v[0];b<=v[1];++b){const w=x_(r[b],i,n);if((u=Math.min(u,w))===0)return u}}else{const b=Sh(v,e);if(b[0]!==null){const w=Vs(_a(r,b[0]),_,n);w<u&&h.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=Vs(_a(r,b[1]),_,n);w<u&&h.push({dist:w,range1:b[1],range2:[0,0]})}}}return u}function Gf(r,e,i,n,a,u=1/0){let h=Math.min(u,a.distance(r[0],i[0]));if(h===0)return h;const f=new Wl([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],Th),_=e?50:100,g=n?50:100;for(;f.length;){const v=f.pop();if(v.dist>=h)continue;const b=v.range1,w=v.range2;if(Xl(b)<=_&&Xl(w)<=g){if(!No(b,r.length)||!No(w,i.length))return NaN;if(e&&n?h=Math.min(h,ni(r,b,i,w,a)):e||n?e&&!n?h=Math.min(h,Ih(i,w,r,b,a)):!e&&n&&(h=Math.min(h,Ih(r,b,i,w,a))):h=Math.min(h,y_(r,b,i,w,a)),h===0)return h}else{const I=Sh(b,e),A=Sh(w,n);ji(f,h,a,r,i,I[0],A[0]),ji(f,h,a,r,i,I[0],A[1]),ji(f,h,a,r,i,I[1],A[0]),ji(f,h,a,r,i,I[1],A[1])}}return h}function Mh(r,e,i,n,a=1/0){let u=a;const h=_a(r,[0,r.length-1]);for(const f of i)if(!(u!==1/0&&Vs(h,_a(f,[0,f.length-1]),n)>=u)&&(u=Math.min(u,Gf(r,e,f,!0,n,u)),u===0))return u;return u}function Kc(r,e,i,n,a=1/0){let u=a;const h=_a(r,[0,r.length-1]);for(const f of i){if(u!==1/0&&Vs(h,ga(f),n)>=u)continue;const _=w_(r,e,f,n,u);if(isNaN(_))return _;if((u=Math.min(u,_))===0)return u}return u}function Ch(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class ya{constructor(e,i){this.type=At,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Os(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let a=0;a<n.features.length;++a)if(Ch(n.features[a].geometry.type))return new ya(n,n.features[a].geometry)}else if(n.type==="Feature"){if(Ch(n.geometry.type))return new ya(n,n.geometry)}
1else if(Ch(n.type))return new ya(n,n)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),n=e.canonicalID();if(i!=null&&n!=null){if(e.geometryType()==="Point")return(function(a,u,h){const f=[];for(const g of a)for(const v of g)f.push(Yc(v,u));const _=new Ya(f[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?Gf(f,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",_):h.type==="MultiLineString"?Mh(f,!1,h.coordinates,_):h.type==="Polygon"||h.type==="MultiPolygon"?Kc(f,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,_):null})(i,n,this.geometries);if(e.geometryType()==="LineString")return(function(a,u,h){const f=[];for(const g of a){const v=[];for(const b of g)v.push(Yc(b,u));f.push(v)}const _=new Ya(f[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Mh(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let g=1/0;for(let v=0;v<h.coordinates.length;v++){const b=Mh(h.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(h.type==="Polygon"||h.type==="MultiPolygon"){let g=1/0;for(let v=0;v<f.length;v++){const b=Kc(f[v],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null})(i,n,this.geometries);if(e.geometryType()==="Polygon")return(function(a,u,h){const f=[];for(const g of(function(v){const b=v.length;if(b<=1)return[v];const w=[];let I,A;for(let R=0;R<b;R++){const O=f_(v[R]);O!==0&&(v[R].area=Math.abs(O),A===void 0&&(A=O<0),A===O<0?(I&&w.push(I),I=[v[R]]):I.push(v[R]))}return I&&w.push(I),w})(a)){const v=[];for(let b=0;b<g.length;++b)v.push(g_(g[b],u));f.push(v)}const _=new Ya(f[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Kc(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let g=1/0;for(let v=0;v<h.coordinates.length;v++){const b=Kc(h.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return h.type==="Polygon"||h.type==="MultiPolygon"?(function(g,v,b){let w=1/0;for(const I of g)for(const A of v){const R=b_(I,A,b,w);if(isNaN(R))return R;if((w=Math.min(w,R))===0)return w}return w})(h.type==="Polygon"?[h.coordinates]:h.coordinates,f,_):null})(i,n,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 Ka(r){if(r instanceof Dn&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Ns||r instanceof ya)return!1;if(r instanceof Qa)return r.featureConstant;let e=!0;return r.eachChild(i=>{e&&!Ka(i)&&(e=!1)}),e}function Yl(r){if(r instanceof Dn&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!Yl(i)&&(e=!1)}),e}function Ja(r,e){if(r instanceof Dn&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild(n=>{i&&!Ja(n,e)&&(i=!1)}),i}function qf(r,e,i){return[r,e,i].filter(Boolean).join("�")}function Ph(r,e){switch(r){case"string":return Fo(e);case"number":return+e;case"boolean":return!!e;case"color":return vi.parse(e);case"formatted":return an.fromString(Fo(e));case"resolvedImage":return Ln.build(Fo(e))}return e}function $f(r,e,i,n){return n!==void 0&&(r=n*Math.round(r/n)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class Qa{constructor(e,i,n,a=!1){this.type=e,this.key=i,this.scope=n,this.featureConstant=a}static parse(e,i){let n=i.expectedType;if(n==null&&(n=wi),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof hs))return i.error("Key name of 'config' expression must be a string literal.");let u,h=!0;const f=Fo(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof hs))return i.error("Scope of 'config' expression must be a string literal.");u=Fo(_.value)}if(i.options){const _=qf(f,u,i._scope),g=i.options.get(_);g&&(h=Ka(g.value||g.default))}return new Qa(n,f,u,h)}evaluate(e){const i=qf(this.key,this.scope,e.scope),n=e.getConfig(i);if(!n)return null;const{type:a,value:u,values:h,minValue:f,maxValue:_,stepValue:g}=n,v=n.default.evaluate(e);let b=v;if(u){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=u.evaluate(e),e.scope=w}return a&&(b=Ph(a,b)),b===void 0||f===void 0&&_===void 0&&g===void 0||(typeof b=="number"?b=$f(b,f,_,g):Array.isArray(b)&&(b=b.map(w=>typeof w=="number"?$f(w,f,_,g):w))),u!==void 0&&b!==void 0&&h&&!h.includes(b)&&(b=v,a&&(b=Ph(a,b))),(a&&a!==this.type||b!==void 0&&!Uc(Dr(b),this.type))&&(b=Ph(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Jc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}
vendor: 10,047 bytes, line 1
1static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const n=e[1];return i.scope.has(n)?new Jc(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Qc{constructor(e,i=[],n,a=new Nc,u=[],h,f,_){this.registry=e,this.path=i,this.key=i.map(g=>typeof g=="string"?`['${g}']`:`[${g}]`).join(""),this.scope=a,this.errors=u,this.expectedType=n,this._scope=h,this.options=f,this.iconImageUseTheme=_}parse(e,i,n,a,u={}){return i||n?this.concat(i,null,n,a)._parse(e,u):this._parse(e,u)}parseObjectValue(e,i,n,a,u,h={}){return this.concat(i,n,a,u)._parse(e,h)}_parse(e,i){function n(a,u,h){return h==="assert"?new Ut(u,[a]):h==="coerce"?new ko(u,[a]):a}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let u=a.parse(e,this);if(!u)return null;if(this.expectedType){const h=this.expectedType,f=u.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||f.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(h,f))return null}else u=n(u,h,i.typeAnnotation||"coerce");else u=n(u,h,i.typeAnnotation||"assert")}if(!(u instanceof hs)&&u.type.kind!=="resolvedImage"&&Rh(u)){const h=new Wa(this._scope,this.options,this.iconImageUseTheme);try{u=new hs(u.type,u.evaluate(h))}catch(f){return this.error(f.message),null}}return u}return ko.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,n,a){let u=typeof e=="number"?this.path.concat(e):this.path;u=typeof i=="string"?u.concat(i):u;const h=a?this.scope.concat(a):this.scope;return new Qc(this.registry,u,n||null,h,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...i){const n=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new pn(n,e))}checkSubtype(e,i){const n=jl(e,i);return n&&this.error(n),n}}function Rh(r){if(r instanceof Jc)return Rh(r.boundExpression);if(r instanceof Dn&&r.name==="error"||r instanceof Bo||r instanceof Ns||r instanceof ya||r instanceof Qa)return!1;const e=r instanceof ko||r instanceof Ut;let i=!0;return r.eachChild(n=>{i=e?i&&Rh(n):i&&n instanceof hs}),!!i&&Ka(r)&&Ja(r,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function eu(r,e){const i=r.length-1;let n,a,u=0,h=i,f=0;for(;u<=h;)if(f=Math.floor((u+h)/2),n=r[f],a=r[f+1],n<=e){if(f===i||e<a)return f;u=f+1}else{if(!(n>e))throw new Ar("Input is not a number.");h=f-1}return 0}class Kl{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,u]of n)this.labels.push(a),this.outputs.push(u)}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.");const n=i.parse(e[1],1,At);if(!n)return null;const a=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],_=e[h+1],g=h,v=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',g);if(a.length&&a[a.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const b=i.parse(_,v,u);if(!b)return null;u=u||b.type,a.push([f,b])}return new Kl(u,n,a)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return n[0].evaluate(e);const u=i.length;return a>=i[u-1]?n[u-1].evaluate(e):n[eu(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const 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}}const Hf=.95047,Zf=1.08883,Wf=4/29,el=6/29,Xf=3*el*el,T_=el*el*el,E_=Math.PI/180,S_=180/Math.PI;function Lh(r){return r>T_?Math.pow(r,1/3):r/Xf+Wf}function Dh(r){return r>el?r*r*r:Xf*(r-Wf)}function zh(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function Oh(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Yf(r){const e=Oh(r.r),i=Oh(r.g),n=Oh(r.b),a=Lh((.4124564*e+.3575761*i+.1804375*n)/Hf),u=Lh((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*u-16,a:500*(a-u),b:200*(u-Lh((.0193339*e+.119192*i+.9503041*n)/Zf)),alpha:r.a}}function tu(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,n=isNaN(r.b)?e:e-r.b/200;return e=1*Dh(e),i=Hf*Dh(i),n=Zf*Dh(n),new vi(zh(3.2404542*i-1.5371385*e-.4985314*n),zh(-.969266*i+1.8760108*e+.041556*n),zh(.0556434*i-.2040259*e+1.0572252*n),r.alpha)}function iu(r,e,i){const n=e-r;return r+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const tl={forward:Yf,reverse:tu,interpolate:function(r,e,i){return{l:Dt(r.l,e.l,i),a:Dt(r.a,e.a,i),b:Dt(r.b,e.b,i),alpha:Dt(r.alpha,e.alpha,i)}}},Jl={forward:function(r){const{l:e,a:i,b:n}=Yf(r),a=Math.atan2(n,i)*S_;return{h:a<0?a+360:a,c:Math.sqrt(i*i+n*n),l:e,alpha:r.a}},reverse:function(r){const e=r.h*E_,i=r.c;return tu({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:iu(r.h,e.h,i),c:Dt(r.c,e.c,i),l:Dt(r.l,e.l,i),alpha:Dt(r.alpha,e.alpha,i)}}};var Kf=Object.freeze({__proto__:null,hcl:Jl,lab:tl});class io{constructor(e,i,n,a,u){this.type=e,this.operator=i,this.interpolation=n,this.input=a,this.labels=[],this.outputs=[];for(const[h,f]of u)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,i,n,a){let u=0;if(e.name==="exponential")u=ru(i,e.base,n,a);else if(e.name==="linear")u=ru(i,1,n,a);else if(e.name==="cubic-bezier"){const h=e.controlPoints;u=new Va(h[0],h[1],h[2],h[3]).solve(ru(i,1,n,a))}return u}static parse(e,i){let[n,a,u,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const g=a[1];if(typeof g!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:g}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const g=a.slice(1);if(g.length!==4||g.some(v=>typeof v!="number"||v<0||v>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,At),!u)return null;const f=[];let _=null;n==="interpolate-hcl"||n==="interpolate-lab"?_=mn:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let g=0;g<h.length;g+=2){const v=h[g],b=h[g+1],w=g+3,I=g+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const A=i.parse(b,I,_);if(!A)return null;_=_||A.type,f.push([v,A])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new io(_,n,a,u,f):i.error(`Type ${mr(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return n[0].evaluate(e);const u=i.length;if(a>=i[u-1])return n[u-1].evaluate(e);const h=eu(i,a),f=io.interpolationFactor(this.interpolation,a,i[h],i[h+1]),_=n[h].evaluate(e),g=n[h+1].evaluate(e);return this.operator==="interpolate"?pa[this.type.kind.toLowerCase()](_,g,f):this.operator==="interpolate-hcl"?Jl.reverse(Jl.interpolate(Jl.forward(_),Jl.forward(g),f)):tl.reverse(tl.interpolate(tl.forward(_),tl.forward(g),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)i.push(this.labels[n],this.outputs[n].serialize());return i}}function ru(r,e,i,n){const a=n-i,u=r-i;return a===0?0:e===1?u/a:(Math.pow(e,u)-1)/(Math.pow(e,a)-1)}class Ql{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 n=null;const a=i.expectedType;a&&a.kind!=="value"&&(n=a);const u=[];for(const f of e.slice(1)){const _=i.parse(f,1+u.length,n,void 0,{typeAnnotation:"omit"});if(!_)return null;n=n||_.type,u.push(_)}const h=a&&u.some(f=>jl(a,f.type));return new Ql(h?wi:n,u)}evaluate(e){let i,n=null,a=0;for(const u of this.args){if(a++,n=u.evaluate(e),n&&n instanceof Ln&&!n.available&&(i||(i=n),n=null,a===this.args.length))return i;if(n!==null)break}return n}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class fs{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const 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.`);const n=[];for(let u=1;u<e.length-1;u+=2){const h=e[u];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,u);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=i.parse(e[u+1],u+1);if(!f)return null;n.push([h,f])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,n);return a?new fs(n,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,n]of this.bindings)e.push(i,n.serialize());return e.push(this.result.serialize()),e}}class nu{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,At),a=i.parse(e[2],2,sn(i.expectedType||wi));return n&&a?new nu(a.type.itemType,n,a):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new Ar("Array index out of bounds: negative index");if(i>=n.length)throw new Ar("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new Ar("Array index must be an integer. Use at-interpolated for fractional indices");return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class ou{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,At),a=i.parse(e[2],2,sn(i.expectedType||wi));return n&&a?new ou(a.type.itemType,n,a):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new Ar(`Array index out of bounds: ${i} < 0.`);if(i>n.length-1)throw new Ar(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i===Math.floor(i))return n[i];const a=Math.floor(i),u=Math.ceil(i),h=n[a],f=n[u];if(typeof h!="number"||typeof f!="number")throw new Ar(`Cannot interpolate between non-number values at index ${i}.`);const _=i-a;return h*(1-_)+f*_}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Fh{constructor(e,i){this.type=fi,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,wi),a=i.parse(e[2],2,wi);return n&&a?dh(n.type,[fi,yi,At,Pn,wi])?new Fh(n,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${mr(n.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!Gl(i,["boolean","string","number","null"]))throw new Ar(`Expected first argument to be of type boolean, string, number or null, but found ${mr(Dr(i))} instead.`);if(!Gl(n,["string","array"]))throw new Ar(`Expected second argument to be of type array or string, but found ${mr(Dr(n))} instead.`);return n.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class il{constructor(e,i,n){this.type=At,this.needle=e,this.haystack=i,this.fromIndex=n}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.`);const n=i.parse(e[1],1,wi),a=i.parse(e[2],2,wi);if(!n||!a)return null;if(!dh(n.type,[fi,yi,At,Pn,wi]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${mr(n.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,At);return u?new il(n,a,u):null}return new il(n,a)}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Gl(i,["boolean","string","number","null"]))throw new Ar(`Expected first argument to be of type boolean, string, number or null, but found ${mr(Dr(i))} instead.`);if(!Gl(n,["string","array"]))throw new Ar(`Expected second argument to be of type array or string, but found ${mr(Dr(n))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return n.indexOf(i,a)}return n.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class ec{constructor(e,i,n,a,u,h){this.inputType=e,this.type=i,this.input=n,this.cases=a,this.outputs=u,this.otherwise=h}static parse(e,i){if(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.");let n,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const u={},h=[];for(let g=2;g<e.length-1;g+=2){let v=e[g];const b=e[g+1];Array.isArray(v)||(v=[v]);const w=i.concat(g);if(v.length===0)return w.error("Expected at least one branch label.");for(const A of v){if(typeof A!="number"&&typeof A!="string")return w.error("Branch labels must be numbers or strings.");if(typeof A=="number"&&Math.abs(A)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof A=="number"&&Math.floor(A)!==A)return w.error("Numeric branch labels must be integer values.");if(n){if(w.checkSubtype(n,Dr(A)))return null}else n=Dr(A);if(u[String(A)]!==void 0)return w.error("Branch labels must be unique.");u[String(A)]=h.length}const I=i.parse(b,g,a);if(!I)return null;a=a||I.type,h.push(I)}const f=i.parse(e[1],1,wi);if(!f)return null;const _=i.parse(e[e.length-1],e.length-1,a);return _?f.type.kind!=="value"&&i.concat(1).checkSubtype(n,f.type)?null:new ec(n,a,f,u,h,_):null}evaluate(e){const i=this.input.evaluate(e);return(Uc(Dr(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
vendor: 18,971 bytes, line 1
1eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),n=[],a={};for(const h of i){const f=a[this.cases[h]];f===void 0?(a[this.cases[h]]=n.length,n.push([this.cases[h],[h]])):n[f][1].push(h)}const u=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,f]of n)e.push(f.length===1?u(f[0]):f.map(u)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}class tc{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}static parse(e,i){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.");let n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);const a=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,fi);if(!f)return null;const _=i.parse(e[h+1],h+1,n);if(!_)return null;a.push([f,_]),n=n||_.type}const u=i.parse(e[e.length-1],e.length-1,n);return u?new tc(n,a,u):null}evaluate(e){for(const[i,n]of this.branches)if(i.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,n]of this.branches)e(i),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class su{constructor(e,i,n,a){this.type=e,this.input=i,this.beginIndex=n,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.`);const n=i.parse(e[1],1,wi),a=i.parse(e[2],2,At);if(!n||!a)return null;if(!dh(n.type,[sn(wi),yi,wi]))return i.error(`Expected first argument to be of type array or string, but found ${mr(n.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,At);return u?new su(n.type,n,a,u):null}return new su(n.type,n,a)}evaluate(e){const i=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!Gl(i,["string","array"]))throw new Ar(`Expected first argument to be of type array or string, but found ${mr(Dr(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(n,a)}return i.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class kh{constructor(e,i){this.type=sn(yi),this.str=e,this.delimiter=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,yi),a=i.parse(e[2],2,yi);return n&&a?new kh(n,a):void 0}evaluate(e){const i=this.str.evaluate(e),n=this.delimiter.evaluate(e);return i.split(n)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Bh(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Nh(r,e,i,n){return n.compare(e,i)===0}function rl(r,e,i){const n=r!=="=="&&r!=="!=";return class Pw{constructor(u,h,f){this.type=fi,this.lhs=u,this.rhs=h,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||h.type.kind==="value"}static parse(u,h){if(u.length!==3&&u.length!==4)return h.error("Expected two or three arguments.");const f=u[0];let _=h.parse(u[1],1,wi);if(!_)return null;if(!Bh(f,_.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${mr(_.type)}'.`);let g=h.parse(u[2],2,wi);if(!g)return null;if(!Bh(f,g.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${mr(g.type)}'.`);if(_.type.kind!==g.type.kind&&_.type.kind!=="value"&&g.type.kind!=="value")return h.error(`Cannot compare types '${mr(_.type)}' and '${mr(g.type)}'.`);n&&(_.type.kind==="value"&&g.type.kind!=="value"?_=new Ut(g.type,[_]):_.type.kind!=="value"&&g.type.kind==="value"&&(g=new Ut(_.type,[g])));let v=null;if(u.length===4){if(_.type.kind!=="string"&&g.type.kind!=="string"&&_.type.kind!=="value"&&g.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(v=h.parse(u[3],3,Vc),!v)return null}return new Pw(_,g,v)}evaluate(u){const h=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(n&&this.hasUntypedArgument){const _=Dr(h),g=Dr(f);if(_.kind!==g.kind||_.kind!=="string"&&_.kind!=="number")throw new Ar(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${g.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const _=Dr(h),g=Dr(f);if(_.kind!=="string"||g.kind!=="string")return e(u,h,f)}return this.collator?i(u,h,f,this.collator.evaluate(u)):e(u,h,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}serialize(){const u=[r];return this.eachChild(h=>{u.push(h.serialize())}),u}}}const I_=rl("==",function(r,e,i){return e===i},Nh),A_=rl("!=",function(r,e,i){return e!==i},function(r,e,i,n){return!Nh(0,e,i,n)}),Jf=rl("<",function(r,e,i){return e<i},function(r,e,i,n){return n.compare(e,i)<0}),Qf=rl(">",function(r,e,i){return e>i},function(r,e,i,n){return n.compare(e,i)>0}),au=rl("<=",function(r,e,i){return e<=i},function(r,e,i,n){return n.compare(e,i)<=0}),M_=rl(">=",function(r,e,i){return e>=i},function(r,e,i,n){return n.compare(e,i)>=0});class lu{constructor(e,i,n,a,u,h){this.type=yi,this.number=e,this.locale=i,this.currency=n,this.unit=a,this.minFractionDigits=u,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const n=i.parse(e[1],1,At);if(!n)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let u=null;if(a.locale&&(u=i.parseObjectValue(a.locale,2,"locale",yi),!u))return null;let h=null;if(a.currency&&(h=i.parseObjectValue(a.currency,2,"currency",yi),!h))return null;let f=null;if(a.unit&&(f=i.parseObjectValue(a.unit,2,"unit",yi),!f))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",At),!_))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",At),!g)?null:new lu(n,u,h,f,_,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Vh{constructor(e){this.type=At,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${mr(n.type)} instead.`):new Vh(n):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new Ar(`Expected value to be of type string or array, but found ${mr(Dr(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function ep(r){return function(){r=1831565813+(r|=0)|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const xa={"==":I_,"!=":A_,">":Qf,"<":Jf,">=":M_,"<=":au,array:Ut,at:nu,"at-interpolated":ou,boolean:Ut,case:tc,coalesce:Ql,collator:Bo,format:It,image:Za,in:Fh,"index-of":il,interpolate:io,"interpolate-hcl":io,"interpolate-lab":io,length:Vh,let:fs,literal:hs,match:ec,number:Ut,"number-format":lu,object:Ut,slice:su,step:Kl,string:Ut,"to-boolean":ko,"to-color":ko,"to-number":ko,"to-string":ko,var:Jc,within:Ns,distance:ya,config:Qa,split:kh};function Uh(r,[e,i,n,a]){e=e.evaluate(r),i=i.evaluate(r),n=n.evaluate(r);const u=a?a.evaluate(r):1,h=ph(e,i,n,u);if(h)throw new Ar(h);return new vi(e/255,i/255,n/255,u)}function tp(r,[e,i,n,a]){e=e.evaluate(r),i=i.evaluate(r),n=n.evaluate(r);const u=a?a.evaluate(r):1,h=(function(g,v,b,w){return typeof g=="number"&&g>=0&&g<=360?typeof v=="number"&&v>=0&&v<=100&&typeof b=="number"&&b>=0&&b<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,v,b,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 'h' must be between 0 and 360.`})(e,i,n,u);if(h)throw new Ar(h);const f=`hsla(${e}, ${i}%, ${n}%, ${u})`,_=vi.parse(f);if(!_)throw new Ar(`Failed to parse HSLA color: ${f}`);return _}function ip(r,e){return r in e}function jh(r,e){const i=e[r];return i===void 0?null:i}function js(r){return{type:r}}function va(r){if(r instanceof Qa)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...va(i)])}),e}function cu(r){if(r instanceof Dn&&r.name==="is-active-floor")return!0;let e=!1;return r.eachChild(i=>{!e&&cu(i)&&(e=!0)}),e}function rp(r){return{result:"success",value:r}}function Gs(r){return{result:"error",value:r}}function Gh(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function uu(r){return r["property-type"]==="data-driven"}function qh(r){return Gh(r.expression,"measure-light")}function np(r){return Gh(r.expression,"zoom")}function $h(r){return!!r.expression&&r.expression.interpolated}function hu(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function op(r){return r}function Hh(r,e){const i=e.type==="color",n=r.stops&&typeof r.stops[0][0]=="object",a=n||!(n||r.property!==void 0),u=r.type||($h(e)?"exponential":"interval");if(i&&((r=Object.assign({},r)).stops&&(r.stops=r.stops.map(g=>[g[0],vi.parse(g[1])])),r.default=vi.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!Kf[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let h,f,_;if(u==="exponential")h=sp;else if(u==="interval")h=C_;else if(u==="categorical"){h=nl,f=Object.create(null);for(const g of r.stops)f[g[0]]=g[1];_=typeof r.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);h=P_}if(n){const g={},v=[];for(let I=0;I<r.stops.length;I++){const A=r.stops[I],R=A[0].zoom;g[R]===void 0&&(g[R]={zoom:R,type:r.type,property:r.property,default:r.default,stops:[]},v.push(R)),g[R].stops.push([A[0].value,A[1]])}const b=[];for(const I of v)b.push([g[I].zoom,Hh(g[I],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:io.interpolationFactor.bind(void 0,w),zoomStops:b.map(I=>I[0]),evaluate:({zoom:I},A)=>sp({stops:b,base:r.base},e,I).evaluate(I,A)}}if(a){const g=u==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:io.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map(v=>v[0]),evaluate:({zoom:v})=>h(r,e,v,f,_)}}return{kind:"source",evaluate(g,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?ic(r.default,e.default):h(r,e,b,f,_)}}}function ic(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function nl(r,e,i,n,a){return ic(typeof i===a?n[i]:void 0,r.default,e.default)}function C_(r,e,i){if(!zt(i))return ic(r.default,e.default);const n=r.stops.length;if(n===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[n-1][0])return r.stops[n-1][1];const a=eu(r.stops.map(u=>u[0]),i);return r.stops[a][1]}function sp(r,e,i){const n=r.base!==void 0?r.base:1;if(!zt(i))return ic(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const u=eu(r.stops.map(v=>v[0]),i),h=(function(v,b,w,I){const A=I-w,R=v-w;return A===0?0:b===1?R/A:(Math.pow(b,R)-1)/(Math.pow(b,A)-1)})(i,n,r.stops[u][0],r.stops[u+1][0]),f=r.stops[u][1],_=r.stops[u+1][1];let g=pa[e.type]||op;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=Kf[r.colorSpace];g=(b,w)=>v.reverse(v.interpolate(v.forward(b),v.forward(w),h))}return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),w=_.evaluate.apply(void 0,v);if(b!==void 0&&w!==void 0)return g(b,w,h)}}:g(f,_,h)}function P_(r,e,i){return e.type==="color"?i=vi.parse(i):e.type==="formatted"?i=an.fromString(i.toString()):e.type==="resolvedImage"?i=Ln.build(i.toString()):kt(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),ic(i,r.default,e.default)}Dn.register(xa,{error:[{kind:"error"},[yi],(r,[e])=>{throw new Ar(e.evaluate(r))}],typeof:[yi,[wi],(r,[e])=>mr(Dr(e.evaluate(r)))],"to-rgba":[sn(At,4),[mn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[sn(At,4),[mn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[mn,[At,At,At],Uh],rgba:[mn,[At,At,At,At],Uh],hsl:[mn,[At,At,At],tp],hsla:[mn,[At,At,At,At],tp],has:{type:fi,overloads:[[[yi],(r,[e])=>ip(e.evaluate(r),r.properties())],[[yi,$a],(r,[e,i])=>ip(e.evaluate(r),i.evaluate(r))]]},get:{type:wi,overloads:[[[yi],(r,[e])=>jh(e.evaluate(r),r.properties())],[[yi,$a],(r,[e,i])=>jh(e.evaluate(r),i.evaluate(r))]]},"feature-state":[wi,[yi],(r,[e])=>jh(e.evaluate(r),r.featureState||{})],properties:[$a,[],r=>r.properties()],"geometry-type":[yi,[],r=>r.geometryType()],worldview:[yi,[],r=>r.globals.worldview||""],"is-active-floor":[fi,js(yi),(r,e)=>{if(!(r.globals.activeFloors&&r.globals.activeFloors.size>0))return!1;const i=r.globals.activeFloors;return e.some(n=>{const a=n.evaluate(r);return i.has(a)})}],id:[wi,[],r=>r.id()],zoom:[At,[],r=>r.globals.zoom],pitch:[At,[],r=>r.globals.pitch||0],"distance-from-center":[At,[],r=>r.distanceFromCenter()],"measure-light":[At,[yi],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[At,[],r=>r.globals.heatmapDensity||0],"line-progress":[At,[],r=>r.globals.lineProgress||0],"raster-value":[At,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[At,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[At,[],r=>r.globals.skyRadialProgress||0],accumulated:[wi,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[At,js(At),(r,e)=>{let i=0;for(const n of e)i+=n.evaluate(r);return i}],"*":[At,js(At),(r,e)=>{let i=1;for(const n of e)i*=n.evaluate(r);return i}],"-":{type:At,overloads:[[[At,At],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[At],(r,[e])=>-e.evaluate(r)]]},"/":[At,[At,At],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[At,[At,At],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[At,[],()=>Math.LN2],pi:[At,[],()=>Math.PI],e:[At,[],()=>Math.E],"^":[At,[At,At],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[At,[At],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[At,[At],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[At,[At],(r,[e])=>Math.log(e.evaluate(r))],log2:[At,[At],(r,[e])=>Math.log2(e.evaluate(r))],sin:[At,[At],(r,[e])=>Math.sin(e.evaluate(r))],cos:[At,[At],(r,[e])=>Math.cos(e.evaluate(r))],tan:[At,[At],(r,[e])=>Math.tan(e.evaluate(r))],asin:[At,[At],(r,[e])=>Math.asin(e.evaluate(r))],acos:[At,[At],(r,[e])=>Math.acos(e.evaluate(r))],atan:[At,[At],(r,[e])=>Math.atan(e.evaluate(r))],min:[At,js(At),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[At,js(At),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[At,[At],(r,[e])=>Math.abs(e.evaluate(r))],round:[At,[At],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[At,[At],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[At,[At],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[fi,[yi,wi],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[fi,[wi],(r,[e])=>r.id()===e.value],"filter-type-==":[fi,[yi],(r,[e])=>r.geometryType()===e.value],"filter-<":[fi,[yi,wi],(r,[e,i])=>{const n=r.properties()[e.value],a=i.value;return typeof n==typeof a&&n<a}],"filter-id-<":[fi,[wi],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[fi,[yi,wi],(r,[e,i])=>{const n=r.properties()[e.value],a=i.value;return typeof n==typeof a&&n>a}],"filter-id->":[fi,[wi],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[fi,[yi,wi],(r,[e,i])=>{const n=r.properties()[e.value],a=i.value;return typeof n==typeof a&&n<=a}],"filter-id-<=":[fi,[wi],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[fi,[yi,wi],(r,[e,i])=>{const n=r.properties()[e.value],a=i.value;return typeof n==typeof a&&n>=a}],"filter-id->=":[fi,[wi],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[fi,[wi],(r,[e])=>e.value in r.properties()],"filter-has-id":[fi,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[fi,[sn(yi)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[fi,[sn(wi)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[fi,[yi,sn(wi)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[fi,[yi,sn(wi)],(r,[e,i])=>(function(n,a,u,h){for(;u<=h;){const f=u+h>>1;if(a[f]===n)return!0;a[f]>n?h=f-1:u=f+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:fi,overloads:[[[fi,fi],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[js(fi),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:fi,overloads:[[[fi,fi],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[js(fi),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[fi,[fi],(r,[e])=>!e.evaluate(r)],"is-supported-script":[fi,[yi],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[yi,[yi],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[yi,[yi],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[yi,js(wi),(r,e)=>e.map(i=>Fo(i.evaluate(r))).join("")],"resolved-locale":[yi,[Vc],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[At,[At,At,wi],(r,e)=>{const[i,n,a]=e.map(h=>h.evaluate(r));if(i>n||i===n)return i;let u;
1if(typeof a=="string")u=(function(h){let f=0;if(h.length===0)return f;for(let _=0;_<h.length;_++)f=(f<<5)-f+h.charCodeAt(_),f&=f;return f})(a);else{if(typeof a!="number")throw new Ar(`Invalid seed input: ${a}`);u=a}return i+ep(u)()*(n-i)}]});class du{constructor(e,i,n,a,u){this.expression=e,this._warningHistory={},this._scope=n,this._options=a,this._iconImageUseTheme=u,this._evaluator=new Wa(n,a,u),this._defaultValue=i?(function(h){return h.type==="color"&&(hu(h.default)||Array.isArray(h.default))?new vi(0,0,0,0):h.type==="color"?vi.parse(h.default)||null:h.default===void 0?null:h.default})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=va(e),this.isIndoorDependent=cu(e)}evaluateWithoutErrorHandling(e,i,n,a,u,h,f,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=n,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,n,a,u,h,f,_,g){this._evaluator||(this._evaluator=new Wa(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=n||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this._evaluator.iconImageUseTheme=g||null;try{const v=this.expression.evaluate(this._evaluator);if(v==null||typeof v=="number"&&v!=v)return this._defaultValue;if(this._enumValues&&!(v in this._enumValues))throw new Ar(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(v)} instead.`);return v}catch(v){const b=v;return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${b.message}`)),this._defaultValue}}}function rc(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in xa}function qs(r,e,i,n,a){const u=new Qc(xa,[],e?(function(f){const _={color:mn,string:yi,number:At,enum:yi,boolean:fi,formatted:Ha,resolvedImage:ma};return f.type==="array"?sn(_[f.value]||wi,f.length):_[f.type]})(e):void 0,void 0,void 0,i,n,a),h=u.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?rp(new du(h,e,i,n,a)):Gs(u.errors)}class nc{constructor(e,i,n,a){this.kind=e,this._styleExpression=i,this.isLightConstant=n,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!Yl(i.expression),this.configDependencies=va(i.expression),this.isIndoorDependent=cu(i.expression)}evaluateWithoutErrorHandling(e,i,n,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,a,u,h)}evaluate(e,i,n,a,u,h,f){return this._styleExpression.evaluate(e,i,n,a,u,h,void 0,void 0,f)}}class ba{constructor(e,i,n,a,u,h){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Yl(i.expression),this.isIndoorDependent=cu(i.expression),this.isLightConstant=u,this.isLineProgressConstant=h,this.configDependencies=va(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,n,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,a,u,h)}evaluate(e,i,n,a,u,h){return this._styleExpression.evaluate(e,i,n,a,u,h)}interpolationFactor(e,i,n){return this.interpolationType?io.interpolationFactor(this.interpolationType,e,i,n):0}}function fu(r,e,i,n,a){if((r=qs(r,e,i,n,a)).result==="error")return r;const u=r.value.expression,h=Ka(u);if(!h&&!uu(e))return Gs([new pn("","data expressions not supported")]);const f=Ja(u,["zoom","pitch","distance-from-center"]);if(!f&&!np(e))return Gs([new pn("","zoom expressions not supported")]);const _=Ja(u,["measure-light"]);if(!_&&!qh(e))return Gs([new pn("","measure-light expression not supported")]);const g=Ja(u,["line-progress"]);if(!g&&!(function(w){return Gh(w.expression,"line-progress")})(e))return Gs([new pn("","line-progress expression not supported")]);const v=e.expression&&e.expression.relaxZoomRestriction,b=pu(u);return b||f||v?b instanceof pn?Gs([b]):b instanceof io&&!$h(e)?Gs([new pn("",'"interpolate" expressions cannot be used with this property')]):rp(b?new ba(h&&g?"camera":"composite",r.value,b.labels,b instanceof io?b.interpolation:void 0,_,g):new nc(h&&g?"constant":"source",r.value,_,g)):Gs([new pn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class oc{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,Hh(this._parameters,this._specification))}static deserialize(e){return new oc(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function pu(r){let e=null;if(r instanceof fs)e=pu(r.result);else if(r instanceof Ql){for(const i of r.args)if(e=pu(i),e)break}else(r instanceof Kl||r instanceof io)&&r.input instanceof Dn&&r.input.name==="zoom"&&(e=r);return e instanceof pn||r.eachChild(i=>{const n=pu(i);n instanceof pn?e=n:e&&n&&e!==n&&(e=new pn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var Vo,ap,R_=(function(){if(ap)return Vo;ap=1,Vo=e;var r=3;function e(i,n,a){var u=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var h=new Int32Array(this.arrayBuffer);i=h[0],this.d=(n=h[1])+2*(a=h[2]);for(var f=0;f<this.d*this.d;f++){var _=h[r+f],g=h[r+f+1];u.push(_===g?null:h.subarray(_,g))}var v=h[r+u.length+1];this.keys=h.subarray(h[r+u.length],v),this.bboxes=h.subarray(v),this.insert=this._insertReadonly}else{this.d=n+2*a;for(var b=0;b<this.d*this.d;b++)u.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=i,this.padding=a,this.scale=n/i,this.uid=0;var w=a/n*i;this.min=-w,this.max=i+w}
1return e.prototype.insert=function(i,n,a,u,h){this._forEachCell(n,a,u,h,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(h)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,n,a,u,h,f){this.cells[h].push(f)},e.prototype.query=function(i,n,a,u,h){var f=this.min,_=this.max;if(i<=f&&n<=f&&_<=a&&_<=u&&!h)return Array.prototype.slice.call(this.keys);var g=[];return this._forEachCell(i,n,a,u,this._queryCell,g,{},h),g},e.prototype._queryCell=function(i,n,a,u,h,f,_,g){var v=this.cells[h];if(v!==null)for(var b=this.keys,w=this.bboxes,I=0;I<v.length;I++){var A=v[I];if(_[A]===void 0){var R=4*A;(g?g(w[R+0],w[R+1],w[R+2],w[R+3]):i<=w[R+2]&&n<=w[R+3]&&a>=w[R+0]&&u>=w[R+1])?(_[A]=!0,f.push(b[A])):_[A]=!1}}},e.prototype._forEachCell=function(i,n,a,u,h,f,_,g){for(var v=this._convertToCellCoord(i),b=this._convertToCellCoord(n),w=this._convertToCellCoord(a),I=this._convertToCellCoord(u),A=v;A<=w;A++)for(var R=b;R<=I;R++){var O=this.d*R+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(R),this._convertFromCellCoord(A+1),this._convertFromCellCoord(R+1)))&&h.call(this,i,n,a,u,O,f,_,g))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,n=r+this.cells.length+1+1,a=0,u=0;u<this.cells.length;u++)a+=this.cells[u].length;var h=new Int32Array(n+a+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;for(var f=n,_=0;_<i.length;_++){var g=i[_];h[r+_]=f,h.set(g,f),f+=g.length}return h[r+i.length]=f,h.set(this.keys,f),h[r+i.length+1]=f+=this.keys.length,h.set(this.bboxes,f),f+=this.bboxes.length,h.buffer},Vo})(),wa=Kn(R_);const mu={};function vt(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),mu[e]={klass:r,omit:i.omit||[]}}vt(Object,"Object"),wa.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},wa.deserialize=function(r){return new wa(r.buffer)},Object.defineProperty(wa,"name",{value:"Grid"}),vt(wa,"Grid"),delete Ke.prototype.constructor,vt(vi,"Color"),vt(Error,"Error"),vt(an,"Formatted"),vt(jc,"FormattedSection"),vt(Fl,"AJAXError"),vt(Ln,"ResolvedImage"),vt(oc,"StylePropertyFunction"),vt(du,"StyleExpression",{omit:["_evaluator"]}),vt(Cn,"ImageId"),vt(Rn,"ImageVariant"),vt(ba,"ZoomDependentExpression"),vt(nc,"ZoomConstantExpression"),vt(Dn,"CompoundExpression",{omit:["_evaluate"]});for(const r in xa)mu[xa[r]._classRegistryKey]||vt(xa[r],`Expression${r}`);function Zh(r){return r&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Mo(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp)return r;if(Zh(r)||r instanceof ImageBitmap)return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const i=[];for(const n of r)i.push(Mo(n,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[n,a]of r.entries())i.entries.push(Mo(n),Mo(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let n=0;for(const a of r.values())i[++n]=Mo(a);return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,n=i._classRegistryKey;if(!n)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(r,e):{};if(!i.serialize){for(const u in r)r.hasOwnProperty(u)&&(mu[n].omit.indexOf(u)>=0||(a[u]=Mo(r[u],e)));r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(a.$name=n),a}throw new Error("can't serialize object of type "+typeof r)}function ps(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||Zh(r)||r instanceof ImageBitmap||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(ps);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const a=r.entries||[],u=new Map;for(let h=0;h<a.length;h+=2)u.set(ps(a[h]),ps(a[h+1]));return u}if(e==="Set"){const a=new Set;for(const u of Object.keys(r))u!=="$name"&&a.add(ps(r[u]));return a}if(e==="BigInt")return BigInt(r.value);const{klass:i}=mu[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const n=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(n[a]=ps(r[a]));return n}throw new Error("can't deserialize object of type "+typeof r)}const lp=r=>r>=1536&&r<=1791,cp=r=>r>=1872&&r<=1919,_u=r=>r>=2208&&r<=2303,gu=r=>r>=11904&&r<=12031,Wh=r=>r>=12032&&r<=12255,Xh=r=>r>=12272&&r<=12287,ol=r=>r>=12288&&r<=12351,sl=r=>r>=12352&&r<=12447,sc=r=>r>=12448&&r<=12543,Uo=r=>r>=12544&&r<=12591,up=r=>r>=12704&&r<=12735,hp=r=>r>=12736&&r<=12783,dp=r=>r>=12784&&r<=12799,fp=r=>r>=12800&&r<=13055,Yh=r=>r>=13056&&r<=13311,al=r=>r>=13312&&r<=19903,yu=r=>r>=19968&&r<=40959,Kh=r=>r>=40960&&r<=42127,xu=r=>r>=42128&&r<=42191,pp=r=>r>=44032&&r<=55215,mp=r=>r>=63744&&r<=64255,Jh=r=>r>=64336&&r<=65023,_p=r=>r>=65040&&r<=65055,Qh=r=>r>=65072&&r<=65103,gp=r=>r>=65104&&r<=65135,ed=r=>r>=65136&&r<=65279,td=r=>r>=65280&&r<=65519;function id(r){for(const e of r)if($s(e.charCodeAt(0)))return!0;return!1}function L_(r){for(const e of r)if(!D_(e.charCodeAt(0)))return!1;return!0}function D_(r){return!(lp(r)||cp(r)||_u(r)||Jh(r)||ed(r))}function yp(r){return!(r<11904||!(up(r)||Uo(r)||Qh(r)||mp(r)||Yh(r)||gu(r)||hp(r)||ol(r)||al(r)||yu(r)||fp(r)||td(r)||sl(r)||Xh(r)||Wh(r)||dp(r)||sc(r)||_p(r)||xu(r)||Kh(r)))}function $s(r){return!(r!==746&&r!==747&&(r<4352||!(up(r)||Uo(r)||Qh(r)&&!(r>=65097&&r<=65103)||mp(r)||Yh(r)||gu(r)||hp(r)||!(!ol(r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||al(r)||yu(r)||fp(r)||(e=>e>=12592&&e<=12687)(r)||(e=>e>=43360&&e<=43391)(r)||(e=>e>=55216&&e<=55295)(r)||(e=>e>
vendor: 9,136 bytes, line 1
1=4352&&e<=4607)(r)||pp(r)||sl(r)||Xh(r)||(e=>e>=12688&&e<=12703)(r)||Wh(r)||dp(r)||sc(r)&&r!==12540||!(!td(r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!gp(r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||(e=>e>=5120&&e<=5759)(r)||(e=>e>=6320&&e<=6399)(r)||_p(r)||(e=>e>=19904&&e<=19967)(r)||Kh(r)||xu(r))))}function xp(r){return r===12312||r===12313||r===12316||r===12540||r===12448}function rd(r){return!($s(r)||(function(e){return!!((i=>i>=128&&i<=255)(e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||(i=>i>=8192&&i<=8303)(e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||(i=>i>=8448&&i<=8527)(e)||(i=>i>=8528&&i<=8591)(e)||(i=>i>=8960&&i<=9215)(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||(i=>i>=9216&&i<=9279)(e)&&e!==9251||(i=>i>=9280&&i<=9311)(e)||(i=>i>=9312&&i<=9471)(e)||(i=>i>=9632&&i<=9727)(e)||(i=>i>=9728&&i<=9983)(e)&&!(e>=9754&&e<=9759)||(i=>i>=11008&&i<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ol(e)||sc(e)||(i=>i>=57344&&i<=63743)(e)||Qh(e)||gp(e)||td(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)})(r))}function vu(r){return lp(r)||cp(r)||_u(r)||Jh(r)||ed(r)}function vp(r){return r>=1424&&r<=2303||Jh(r)||ed(r)}function z_(r,e){return!(!e&&vp(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||(i=>i>=6016&&i<=6143)(r))}function Hs(r){for(const e of r)if(vp(e.charCodeAt(0)))return!0;return!1}const zn={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Zs=null,_n=zn.unavailable,Ws=null;const bp=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(_n=zn.error),Zs&&Zs(r)};function nd(){od.fire(new cs("pluginStateChange",{pluginStatus:_n,pluginURL:Ws}))}const od=new us,sd=function(){return _n},ad=function(){if(_n!==zn.deferred||!Ws)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");_n=zn.loading,nd(),Ws&&Bl({url:Ws},r=>{r?bp(r):(_n=zn.loaded,nd())})},Co={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>_n===zn.loaded||Co.applyArabicShaping!=null,isLoading:()=>_n===zn.loading,setState(r){_n=r.pluginStatus,Ws=r.pluginURL},isParsing:()=>_n===zn.parsing,isParsed:()=>_n===zn.parsed,getPluginURL:()=>Ws};class Ai{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.worldview=i.worldview,this.activeFloors=i.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return(function(i,n){for(const a of i)if(!z_(a.charCodeAt(0),n))return!1;return!0})(e,Co.isLoaded())}}class ac{constructor(e,i,n,a,u){this.property=e,this.value=i,this.expression=(function(h,f,_,g,v){if(hu(h))return new oc(h,f);if(rc(h)||Array.isArray(h)&&h.length>0){const b=fu(h,f,_,g,v);if(b.result==="error")throw new Error(b.value.map(w=>`${w.key}: ${w.message}`).join(", "));return b.value}{let b=h;return typeof h=="string"&&f.type==="color"&&(b=vi.parse(h)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>b}}})(i===void 0?e.specification.default:i,e.specification,n,a,u)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,n,a){return this.property.possiblyEvaluate(this,e,i,n,a)}}class lc{constructor(e,i,n,a){this.property=e,this.value=new ac(e,void 0,i,n,a)}transitioned(e,i){return new wp(this.property,this.value,i,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new wp(this.property,this.value,null,{},0)}}class ll{constructor(e,i,n,a){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=n,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Gt(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new lc(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new ac(this._values[e].property,i===null?void 0:Gt(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,i){i&&(this._options=i);const n=this._properties.properties;if(e)for(const a in e){const u=e[a];if(a.endsWith("-transition")){const h=a.slice(0,-11);n[h]&&this.setTransition(h,u)}else n.hasOwnProperty(a)&&this.setValue(a,u)}}getTransition(e){return Gt(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new lc(this._values[e].property)),this._values[e].transition=Gt(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const n=new Tp(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].transitioned(e,i._values[a]);return n}untransitioned(){const e=new Tp(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class wp{constructor(e,i,n,a,u){const h=a.delay||0,f=a.duration||0;u=u||0,this.property=e,this.value=i,this.begin=u+h,this.end=this.begin+f,e.specification.transition&&(a.delay||a.duration)&&(this.prior=n)}possiblyEvaluate(e,i,n){const a=e.now||0,u=this.value.possiblyEvaluate(e,i,n),h=this.prior;if(h){if(a>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(a<this.begin)return h.possiblyEvaluate(e,i,n);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,n),u,q(f))}}return u}}class Tp{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,n){const a=new gn(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,n);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ld{constructor(e,i,n,a){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=n,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Gt(this._values[e].value)}setValue(e,i){this._values[e]=new ac(this._values[e].property,i===null?void 0:Gt(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndoorDependent())}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n)}return e}possiblyEvaluate(e,i,n,a){const u=new gn(this._properties);for(const h of Object.keys(this._values))u._values[h]=this._values[h].possiblyEvaluate(e,i,n,a);return u}isIndoorDependent(){return this._isIndoorDependent}}class Ta{constructor(e,i,n,a){this.property=e,this.value=i,this.parameters=n,this.iconImageUseTheme=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,n,a){return this.property.evaluate(this.value,this.parameters,e,i,n,a,this.iconImageUseTheme)}}class gn{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class it{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,n){const a=pa[this.specification.type];return a?a(e,i,n):e}}class ht{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,n,a,u){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Ta(this,{kind:"constant",value:e.expression.evaluate(i,null,{},n,a,void 0,u)},i):new Ta(this,e.expression,i,u)}interpolate(e,i,n){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Ta(this,{kind:"constant",value:void 0},e.parameters);const a=pa[this.specification.type];return a?new Ta(this,{kind:"constant",value:a(e.value.value,i.value.value,n)},e.parameters):e}evaluate(e,i,n,a,u,h,f){return e.kind==="constant"?e.value:e.evaluate(i,n,a,u,h,void 0,f)}}class cl{constructor(e){this.specification=e}
vendor: 4,887 bytes, line 1
1possiblyEvaluate(e,i,n,a){return!!e.expression.evaluate(i,null,{},n,a)}interpolate(){return!1}}class ir{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Ai(0,{});for(const n in e){const a=e[n];a.specification.overridable&&this.overridableProperties.push(n);const u=this.defaultPropertyValues[n]=new ac(a,void 0),h=this.defaultTransitionablePropertyValues[n]=new lc(a);this.defaultTransitioningPropertyValues[n]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=u.possiblyEvaluate(i)}}}vt(ht,"DataDrivenProperty"),vt(it,"DataConstantProperty"),vt(cl,"ColorRampProperty");var be=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}}
1,"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
1ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"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","use-theme":true,"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)","use-theme":true,"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"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"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","use-theme":true,"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)","use-theme":true,"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"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default
1":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Ep(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function bu(r){if(Array.isArray(r))return r.map(bu);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=bu(r[i]);return e}return Ep(r)}function cd(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!cd(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function ud(r,e="",i=null,n="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};cd(r)||(r=cc(r));const a=r;let u=!0;try{u=(function(v){if(!ul(v))return v;let b=bu(v);return hd(b),b=Sp(b),b})(a)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(a,null,2)} 7 `)}let h=null,f=null;if(n!=="background"&&n!=="sky"&&n!=="slot"){f=be[`filter_${n}`];const v=qs(u,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));h=(b,w,I)=>v.value.evaluate(b,w,{},I)}let _=null,g=null;if(u!==a){const v=qs(a,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));_=(b,w,I,A,R)=>v.value.evaluate(b,w,{},I,void 0,void 0,A,R),g=!Ka(v.value.expression)}return{filter:h,dynamicFilter:_||void 0,needGeometry:dd(u),needFeature:!!g}}function Sp(r){if(!Array.isArray(r))return r;const e=(function(i){if(O_.has(i[0])){for(let n=1;n<i.length;n++)if(ul(i[n]))return!0}return i})(r);return e===!0?e:e.map(i=>Sp(i))}function hd(r){let e=!1;const i=[];if(r[0]==="case"){for(let n=1;n<r.length-1;n+=2)e=e||ul(r[n]),i.push(r[n+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||ul(r[1]);for(let n=2;n<r.length-1;n+=2)i.push(r[n+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||ul(r[1]);for(let n=1;n<r.length-1;n+=2)i.push(r[n+1])}e&&(r.length=0,r.push("any",...i));for(let n=1;n<r.length;n++)hd(r[n])}function ul(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
7for(let i=1;i<r.length;i++)if(ul(r[i]))return!0;return!1}const O_=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function F_(r,e){return r<e?-1:r>e?1:0}function dd(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(dd(r[e]))return!0;return!1}function cc(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?jo(r[1],r[2],"=="):e==="!="?wu(jo(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?jo(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(cc))):e==="all"?["all"].concat(r.slice(1).map(cc)):e==="none"?["all"].concat(r.slice(1).map(cc).map(wu)):e==="in"?fd(r[1],r.slice(2)):e==="!in"?wu(fd(r[1],r.slice(2))):e==="has"?Ip(r[1]):e!=="!has"||wu(Ip(r[1]));var i}function jo(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function fd(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",r,["literal",e.sort(F_)]]:["filter-in-small",r,["literal",e]]}}function Ip(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function wu(r){return["!",r]}const uc="�";function Ea(r,e){return e?`${r}${uc}${e}`:r}let pd;const md=()=>pd||(pd=new ir({"icon-size":new ht(be.layout_symbol["icon-size"]),"icon-image":new ht(be.layout_symbol["icon-image"]),"icon-rotate":new ht(be.layout_symbol["icon-rotate"]),"icon-offset":new ht(be.layout_symbol["icon-offset"]),"text-size":new ht(be.layout_symbol["text-size"]),"text-rotate":new ht(be.layout_symbol["text-rotate"]),"text-offset":new ht(be.layout_symbol["text-offset"])}));class Ap{constructor(e,i,n,a,u,h){const f=qs(e,be.appearance.condition);if(f.result==="success"&&(this.condition=f.value),this.name=i,n){this.properties=new gn(md()),this.unevaluatedLayout=new ld(md(),a,u,h);for(const _ in n)this.unevaluatedLayout.setValue(_,n[_])}}isActive(e){return!(this.condition||!e.isHidden||this.name!=="hidden")||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(e){return this.properties.get(e)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(e){return this.unevaluatedLayout._values[e]}recalculate(e,i,n){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,n))}serialize(){const e={};return e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name),this.unevaluatedLayout&&(e.properties=this.unevaluatedLayout.serialize()),e}hasIconProperties(){const e=this.hasProperty("icon-image"),i=this.hasProperty("icon-size"),n=this.hasProperty("icon-offset"),a=this.hasProperty("icon-rotate");return e||i||n||a}hasTextProperties(){const e=this.hasProperty("text-size"),i=this.hasProperty("text-offset"),n=this.hasProperty("text-rotate");return e||i||n}hasProperty(e){return this.getUnevaluatedProperty(e).value!==void 0}}const Mp="-transition",Cp=new Set(["fill","line","background","hillshade","raster"]);class yn extends us{constructor(e,i,n,a,u,h){if(super(),this.id=e.id,this.fqid=Ea(this.id,n),this.type=e.type,this.scope=n,this.lut=a,this.options=u,this.iconImageUseTheme=h,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const f=qs(this.filter,be[`filter_${e.type}`]);f.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...f.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||f.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new ld(i.layout,this.scope,u,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),i.paint){this._transitionablePaint=new ll(i.paint,this.scope,u);for(const f in e.paint)this.setPaintProperty(f,e.paint[f]);for(const f in e.layout)this.setLayoutProperty(f,e.layout[f]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new gn(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Cp.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}
7setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...n.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||n.isIndoorDependent(),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(i=>{this.appearances.push(new Ap(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Mp)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){const n=this._transitionablePaint,a=n._properties.properties;if(e.endsWith(Mp)){const b=e.slice(0,-11);return a[b]&&n.setTransition(b,i||void 0),!1}if(!a[e])return!1;const u=n._values[e],h=u.value.isDataDriven(),f=u.value;n.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...n.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||n.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const _=n._values[e].value,g=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return g||h||v||this._handleOverridablePaintPropertyUpdate(e,f,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,n){return null}_handleOverridablePaintPropertyUpdate(e,i,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
vendor: 15,558 bytes, line 7
7serialize(){const e={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.appearances.length!==0&&(e.appearances=this.appearances.map(i=>i.serialize())),Lt(e,(i,n)=>!(i===void 0||n==="layout"&&!Object.keys(i).length||n==="paint"&&!Object.keys(i).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Ta&&uu(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const e of this.appearances)if(!Yl(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=ud(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&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,i,n){return{}}queryRadius(e){}queryIntersectsFeature(e,i,n,a,u,h,f,_,g,v){}}const Pp={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Xs{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}}const k_=new ArrayBuffer(0);class Bi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,i){return e._trim(),i&&e.arrayBuffer&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,e.arrayBuffer?i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement:(i.capacity=0,i.arrayBuffer=k_),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._reallocCount++,this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function ei(r,e=1){let i=0,n=0;return{members:r.map(a=>{const u=Pp[a.type].BYTES_PER_ELEMENT,h=i=Rp(i,Math.max(e,u)),f=a.components||1;return n=Math.max(n,u),i+=u*f,{name:a.name,type:a.type,components:f,offset:h}}),size:Rp(i,Math.max(n,e)),alignment:e}}function Rp(r,e){return Math.ceil(r/e)*e}class Ys extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=n,e}}Ys.prototype.bytesPerElement=4,vt(Ys,"StructArrayLayout2i4");class ms extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=n,this.int16[u+2]=a,e}}ms.prototype.bytesPerElement=6,vt(ms,"StructArrayLayout3i6");class _s extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,a)}emplace(e,i,n,a,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=n,this.int16[h+2]=a,this.int16[h+3]=u,e}}_s.prototype.bytesPerElement=8,vt(_s,"StructArrayLayout4i8");class Gr extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}Gr.prototype.bytesPerElement=4,vt(Gr,"StructArrayLayout1f4");class hl extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=4*e,h=2*e;return this.int16[u+0]=i,this.int16[u+1]=n,this.float32[h+1]=a,e}}hl.prototype.bytesPerElement=8,vt(hl,"StructArrayLayout2i1f8");class _d extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=n,this.int16[u+2]=a,e}}_d.prototype.bytesPerElement=8,vt(_d,"StructArrayLayout3i8");class gd extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,u)}emplace(e,i,n,a,u,h){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=n,this.int16[f+2]=a,this.int16[f+3]=u,this.int16[f+4]=h,e}}gd.prototype.bytesPerElement=10,vt(gd,"StructArrayLayout5i10");class yd extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,n,a,u,h,f)}emplace(e,i,n,a,u,h,f,_){const g=6*e,v=12*e,b=3*e;return this.int16[g+0]=i,this.int16[g+1]=n,this.uint8[v+4]=a,this.uint8[v+5]=u,this.uint8[v+6]=h,this.uint8[v+7]=f,this.float32[b+2]=_,e}}yd.prototype.bytesPerElement=12,vt(yd,"StructArrayLayout2i4ub1f12");class wo extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=n,this.float32[u+2]=a,e}}wo.prototype.bytesPerElement=12,vt(wo,"StructArrayLayout3f12");class Go extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,u)}emplace(e,i,n,a,u,h){const f=6*e,_=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=n,this.uint16[f+2]=a,this.uint16[f+3]=u,this.float32[_+2]=h,e}}Go.prototype.bytesPerElement=12,vt(Go,"StructArrayLayout4ui1f12");class dl extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,a)}emplace(e,i,n,a,u){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=n,this.uint16[h+2]=a,this.uint16[h+3]=u,e}}dl.prototype.bytesPerElement=8,vt(dl,"StructArrayLayout4ui8");class fl extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,a,u,h)}emplace(e,i,n,a,u,h,f){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.int16[_+2]=a,this.int16[_+3]=u,this.int16[_+4]=h,this.int16[_+5]=f,e}}fl.prototype.bytesPerElement=12,vt(fl,"StructArrayLayout6i12");class xd extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b,w){const I=this.length;return this.resize(I+1),this.emplace(I,e,i,n,a,u,h,f,_,g,v,b,w)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,I){const A=12*e;return this.int16[A+0]=i,this.int16[A+1]=n,this.int16[A+2]=a,this.int16[A+3]=u,this.uint16[A+4]=h,this.uint16[A+5]=f,this.uint16[A+6]=_,this.uint16[A+7]=g,this.int16[A+8]=v,this.int16[A+9]=b,this.int16[A+10]=w,this.int16[A+11]=I,e}}xd.prototype.bytesPerElement=24,vt(xd,"StructArrayLayout4i4ui4i24");class vd extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,a,u,h)}emplace(e,i,n,a,u,h,f){const _=10*e,g=5*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.int16[_+2]=a,this.float32[g+2]=u,this.float32[g+3]=h,this.float32[g+4]=f,e}}vd.prototype.bytesPerElement=20,vt(vd,"StructArrayLayout3i3f20");class Ks extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,a)}emplace(e,i,n,a,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=n,this.float32[h+2]=a,this.float32[h+3]=u,e}}Ks.prototype.bytesPerElement=16,vt(Ks,"StructArrayLayout4f16");class bd extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}bd.prototype.bytesPerElement=4,vt(bd,"StructArrayLayout1ul4");class ro extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=n,e}}ro.prototype.bytesPerElement=4,vt(ro,"StructArrayLayout2ui4");class hc extends Bi{_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,n,a,u,h,f,_,g,v,b,w,I){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,n,a,u,h,f,_,g,v,b,w,I)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,I,A){const R=20*e,O=10*e;return this.int16[R+0]=i,this.int16[R+1]=n,this.int16[R+2]=a,this.int16[R+3]=u,this.int16[R+4]=h,this.float32[O+3]=f,this.float32[O+4]=_,this.float32[O+5]=g,this.float32[O+6]=v,this.int16[R+14]=b,this.uint32[O+8]=w,this.uint16[R+18]=I,this.uint16[R+19]=A,e}}hc.prototype.bytesPerElement=40,vt(hc,"StructArrayLayout5i4f1i1ul2ui40");class Tu extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,n,a,u,h,f)}emplace(e,i,n,a,u,h,f,_){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=n,this.int16[g+2]=a,this.int16[g+4]=u,this.int16[g+5]=h,this.int16[g+6]=f,this.int16[g+7]=_,e}}Tu.prototype.bytesPerElement=16,vt(Tu,"StructArrayLayout3i2i2i16");class Eu extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,u)}emplace(e,i,n,a,u,h){const f=4*e,_=8*e;return this.float32[f+0]=i,this.float32[f+1]=n,this.float32[f+2]=a,this.int16[_+6]=u,this.int16[_+7]=h,e}}Eu.prototype.bytesPerElement=16,vt(Eu,"StructArrayLayout2f1f2i16");class Su extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,a,u,h)}emplace(e,i,n,a,u,h,f){const _=20*e,g=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=n,this.float32[g+1]=a,this.float32[g+2]=u,this.float32[g+3]=h,this.float32[g+4]=f,e}}Su.prototype.bytesPerElement=20,vt(Su,"StructArrayLayout2ub4f20");class Mr extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=n,this.uint16[u+2]=a,e}}Mr.prototype.bytesPerElement=6,vt(Mr,"StructArrayLayout3ui6");class dc extends Bi{_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,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k,U,G,K){const Y=this.length;return this.resize(Y+1),this.emplace(Y,e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k,U,G,K)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k,U,G,K,Y){const re=30*e,oe=15*e,ie=60*e;return this.int16[re+0]=i,this.int16[re+1]=n,this.int16[re+2]=a,this.float32[oe+2]=u,this.float32[oe+3]=h,this.uint16[re+8]=f,this.uint16[re+9]=_,this.uint32[oe+5]=g,this.uint32[oe+6]=v,this.uint32[oe+7]=b,this.uint16[re+16]=w,this.uint16[re+17]=I,this.uint16[re+18]=A,this.float32[oe+10]=R,this.float32[oe+11]=O,this.uint8[ie+48]=D,this.uint8[ie+49]=k,this.uint8[ie+50]=U,this.uint32[oe+13]=G,this.int16[re+28]=K,this.uint8[ie+58]=Y,e}}dc.prototype.bytesPerElement=60,vt(dc,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class pl extends Bi{_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,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k,U,G,K,Y,re,oe,ie,ce,de,De,Ce,Le,Ue,Ne,Ve){const Se=this.length;return this.resize(Se+1),this.emplace(Se,e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k,U,G,K,Y,re,oe,ie,ce,de,De,Ce,Le,Ue,Ne,Ve)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k,U,G,K,Y,re,oe,ie,ce,de,De,Ce,Le,Ue,Ne,Ve,Se){const Ge=20*e,Oe=40*e,qe=80*e;return this.float32[Ge+0]=i,this.float32[Ge+1]=n,this.int16[Oe+4]=a,this.int16[Oe+5]=u,this.int16[Oe+6]=h,this.int16[Oe+7]=f,this.int16[Oe+8]=_,this.int16[Oe+9]=g,this.int16[Oe+10]=v,this.int16[Oe+11]=b,this.int16[Oe+12]=w,this.uint16[Oe+13]=I,this.uint16[Oe+14]=A,this.uint16[Oe+15]=R,this.uint16[Oe+16]=O,this.uint16[Oe+17]=D,this.uint16[Oe+18]=k,this.uint16[Oe+19]=U,this.uint16[Oe+20]=G,this.uint16[Oe+21]=K,this.uint16[Oe+22]=Y,this.uint16[Oe+23]=re,this.uint16[Oe+24]=oe,this.uint16[Oe+25]=ie,this.uint16[Oe+26]=ce,this.uint16[Oe+27]=de,this.uint32[Ge+14]=De,this.float32[Ge+15]=Ce,this.float32[Ge+16]=Le,this.float32[Ge+1
vendor: 10,151 bytes, line 7
77]=Ue,this.float32[Ge+18]=Ne,this.uint8[qe+76]=Ve,this.uint16[Oe+39]=Se,e}}pl.prototype.bytesPerElement=80,vt(pl,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Iu extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,a,u,h)}emplace(e,i,n,a,u,h,f){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=n,this.float32[_+2]=a,this.float32[_+3]=u,this.float32[_+4]=h,this.float32[_+5]=f,e}}Iu.prototype.bytesPerElement=24,vt(Iu,"StructArrayLayout6f24");class Sa extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,u)}emplace(e,i,n,a,u,h){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=n,this.float32[f+2]=a,this.float32[f+3]=u,this.float32[f+4]=h,e}}Sa.prototype.bytesPerElement=20,vt(Sa,"StructArrayLayout5f20");class Au extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,n,a,u,h,f)}emplace(e,i,n,a,u,h,f,_){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=n,this.float32[g+2]=a,this.float32[g+3]=u,this.float32[g+4]=h,this.float32[g+5]=f,this.float32[g+6]=_,e}}Au.prototype.bytesPerElement=28,vt(Au,"StructArrayLayout7f28");class wd extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,n,a,u,h,f,_,g,v,b)}emplace(e,i,n,a,u,h,f,_,g,v,b,w){const I=11*e;return this.float32[I+0]=i,this.float32[I+1]=n,this.float32[I+2]=a,this.float32[I+3]=u,this.float32[I+4]=h,this.float32[I+5]=f,this.float32[I+6]=_,this.float32[I+7]=g,this.float32[I+8]=v,this.float32[I+9]=b,this.float32[I+10]=w,e}}wd.prototype.bytesPerElement=44,vt(wd,"StructArrayLayout11f44");class fc extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,n,a,u,h,f,_,g)}emplace(e,i,n,a,u,h,f,_,g,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=n,this.float32[b+2]=a,this.float32[b+3]=u,this.float32[b+4]=h,this.float32[b+5]=f,this.float32[b+6]=_,this.float32[b+7]=g,this.float32[b+8]=v,e}}fc.prototype.bytesPerElement=36,vt(fc,"StructArrayLayout9f36");class Ia extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=n,e}}Ia.prototype.bytesPerElement=8,vt(Ia,"StructArrayLayout2f8");class Td extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,a)}emplace(e,i,n,a,u){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=n,this.uint16[h+3]=a,this.uint16[h+4]=u,e}}Td.prototype.bytesPerElement=12,vt(Td,"StructArrayLayout1ul3ui12");class pc extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}pc.prototype.bytesPerElement=2,vt(pc,"StructArrayLayout1ui2");class Ed extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D){const k=16*e;return this.float32[k+0]=i,this.float32[k+1]=n,this.float32[k+2]=a,this.float32[k+3]=u,this.float32[k+4]=h,this.float32[k+5]=f,this.float32[k+6]=_,this.float32[k+7]=g,this.float32[k+8]=v,this.float32[k+9]=b,this.float32[k+10]=w,this.float32[k+11]=I,this.float32[k+12]=A,this.float32[k+13]=R,this.float32[k+14]=O,this.float32[k+15]=D,e}}Ed.prototype.bytesPerElement=64,vt(Ed,"StructArrayLayout16f64");class mc extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,n,a,u,h,f)}emplace(e,i,n,a,u,h,f,_){const g=10*e,v=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=n,this.uint16[g+2]=a,this.uint16[g+3]=u,this.float32[v+2]=h,this.float32[v+3]=f,this.float32[v+4]=_,e}}mc.prototype.bytesPerElement=20,vt(mc,"StructArrayLayout4ui3f20");class Sd extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}Sd.prototype.bytesPerElement=2,vt(Sd,"StructArrayLayout1i2");class Mu extends Bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}Mu.prototype.bytesPerElement=1,vt(Mu,"StructArrayLayout1ub1");class Lp extends Xs{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Lp.prototype.size=40;class Dp extends hc{get(e){return new Lp(this,e)}}vt(Dp,"CollisionBoxArray");class zp extends Xs{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}}zp.prototype.size=60;class Op extends dc{get(e){return new zp(this,e)}}vt(Op,"PlacedSymbolArray");class Fp extends Xs{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27
vendor: 25,382 bytes, line 7
7]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Fp.prototype.size=80;class kp extends pl{get(e){return new Fp(this,e)}}vt(kp,"SymbolInstanceArray");class _c extends Gr{getoffsetX(e){return this.float32[1*e+0]}}vt(_c,"GlyphOffsetArray");class Bp extends Ys{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}vt(Bp,"SymbolLineVertexArray");class Np extends Xs{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]}}Np.prototype.size=12;class gc extends Td{get(e){return new Np(this,e)}}vt(gc,"FeatureIndexArray");class Vp extends ro{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}vt(Vp,"FillExtrusionCentroidArray");class Id extends Xs{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]}}Id.prototype.size=6;class Up extends ms{get(e){return new Id(this,e)}}vt(Up,"FillExtrusionWallArray");const jp=ei([{name:"a_pos",components:2,type:"Int16"}],4),Gp=ei([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),qp=ei([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Hi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,n,a){let u=this.segments[this.segments.length-1];return e>Hi.MAX_VERTEX_ARRAY_LENGTH&&Ft(`Max vertices per segment is ${Hi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Hi.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==a)&&(u={vertexOffset:i,primitiveOffset:n,vertexLength:0,primitiveLength:0},a!==void 0&&(u.sortKey=a),this.segments.push(u)),u}prepareSegment(e,i,n,a){return this._prepareSegment(e,i.length,n.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,n,a){return new Hi([{vertexOffset:e,primitiveOffset:i,vertexLength:n,primitiveLength:a,vaos:{},sortKey:0}])}}function $p(r,e){return 256*(r=te(Math.floor(r),0,255))+te(Math.floor(e),0,255)}Hi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,vt(Hi,"SegmentVector");const Hp=ei([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),B_=ei([{name:"a_pattern_b",components:4,type:"Uint16"}]),N_=ei([{name:"a_dash",components:4,type:"Uint16"}]);class yc{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,n,a){this.ids.push(Zp(e)),this.positions.push(i,n,a)}eachPosition(e,i){const n=Zp(e);let a=0,u=this.ids.length-1;for(;a<u;){const h=a+u>>1;this.ids[h]>=n?u=h:a=h+1}for(;this.ids[a]===n;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const n=new Float64Array(e.ids),a=new Uint32Array(e.positions);return Ad(n,a,0,n.length-1),i&&(i.add(n.buffer),i.add(a.buffer)),{ids:n,positions:a}}static deserialize(e){const i=new yc;let n;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==n&&i.uniqueIds.push(a),n=a;return i.indexed=!0,i}}function Zp(r){const e=+r;return Number.isSafeInteger(e)?e:qa(String(r))}function Ad(r,e,i,n){for(;i<n;){const a=r[i+n>>1];let u=i-1,h=n+1;for(;;){do u++;while(r[u]<a);do h--;while(r[h]>a);if(u>=h)break;xc(r,u,h),xc(e,3*u,3*h),xc(e,3*u+1,3*h+1),xc(e,3*u+2,3*h+2)}h-i<n-h?(Ad(r,e,i,h),i=h+1):(Ad(r,e,h+1,n),n=h)}}function xc(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}vt(yc,"FeaturePositionMap");class Po{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,n){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class no extends Po{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}class gr extends Po{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class oo extends Po{constructor(e){super(e),this.current=[0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}class vc extends Po{constructor(e){super(e),this.current=[0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}}class Cu extends Po{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class Wp extends Po{constructor(e){super(e),this.current=vi.transparent.toPremultipliedRenderColor(null)}set(e,i,n){this.fetchUniformLocation(e,i)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}const V_=new Float32Array(16);class ml extends Po{constructor(e){super(e),this.current=V_}set(e,i,n){if(this.fetchUniformLocation(e,i)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let a=1;a<16;a++)if(n[a]!==this.current[a]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}}const gx=new Float32Array(9),l=new Float32Array(4);class t extends Po{constructor(e){super(e),this.current=l}set(e,i,n){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(n[a]!==this.current[a]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}}function o(r){return[$p(255*r.r,255*r.g),$p(255*r.b,255*r.a)]}function c(r,e,i,n,a,u,h,f){return!!r&&(r.kind==="composite"||r.kind==="source"?r.evaluate(new Ai(0,{brightness:u,worldview:f}),e,i,a,n,h)==="none":r.value==="none")}class d{constructor(e,i,n,a){this.value=e,this.uniformNames=i.map(u=>`u_${u}`),this.type=n,this.context=a}setUniform(e,i,n,a,u){const h=a.constantOr(this.value);i.set(e,u,h instanceof vi?h.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new Wp(e):new gr(e)}}class p{constructor(e,i){this.uniformNames=i.map(n=>`u_${n}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,n,a,u){let h=null;u!=="u_pattern"&&u!=="u_dash"||(h=this.pattern),u==="u_pattern_b"&&(h=this.patternTransition),u==="u_pixel_ratio"&&(h=this.pixelRatio),h&&i.set(e,u,h)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new Cu(e):new gr(e)}}class m{constructor(e,i,n,a){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=i.map(u=>({name:`a_${u}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,n,a,u,h,f,_){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Ai(0,{brightness:h,worldview:_}),i,{},u,a,f):this.expression.kind==="constant"&&this.expression.value,b=c(this.lutExpression,i,{},a,u,h,f,_);this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,b?null:this.context.lut)}updatePaintArray(e,i,n,a,u,h,f,_){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:_},n,a,void 0,u):this.expression.kind==="constant"&&this.expression.value,v=c(this.lutExpression,n,a,u,void 0,f,void 0,_);this._setPaintValue(e,i,g,v?null:this.context.lut)}_setPaintValue(e,i,n,a){if(this.type==="color"){const u=o(n.toPremultipliedRenderColor(a));for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,u[0],u[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class y{constructor(e,i,n,a,u,h){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=n,this.useIntegerZoom=a,this.context=u,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,n,a,u,h,f,_){const g=this.expression.evaluate(new Ai(this.context.zoom,{brightness:h,worldview:_}),i,{},u,a,f),v=this.expression.evaluate(new Ai(this.context.zoom+1,{brightness:h,worldview:_}),i,{},u,a,f),b=c(this.lutExpression,i,{},a,u,h,f,_),w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,v,b?null:this.context.lut)}updatePaintArray(e,i,n,a,u,h,f,_){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:_},n,a,void 0,u),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:_},n,a,void 0,u),b=c(this.lutExpression,n,a,u,void 0,f,void 0,_);this._setPaintValue(e,i,g,v,b?null:this.context.lut)}_setPaintValue(e,i,n,a,u){if(this.type==="color"){const h=o(n.toPremultipliedRenderColor(u)),f=o(a.toPremultipliedRenderColor(u));for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,h[0],h[1],f[0],f[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,n,a);this.maxValue=Math.max(this.maxValue,Math.abs(n),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,n,a,u){const h=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,f=te(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,u,f)}getBinding(e,i){return new gr(e)}}class x{constructor(e,i,n,a,u){this.expression=e,this.layerId=u,this.paintVertexAttributes=(n==="array"?N_:Hp).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a,this.paintTransitionVertexArray=new dl}populatePaintArray(e,i,n,a){const u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(u,e,i.patterns&&i.patterns[this.layerId],n)}updatePaintArray(e,i,n,a,u,h,f){this._setPaintValues(e,i,n.patterns&&n.patterns[this.layerId],h)}_setPaintValues(e,i,n,a){if(!a||!n)return;const u=a[n[0]],h=a[n[1]];if(u){if(u){const{tl:f,br:_,pixelRatio:g}=u;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,f[0],f[1],_[0],_[1],g)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:_}=h;for(let g=e;g<i;g++)this.paintTransitionVertexArray.emplace(g,f[0],f[1],_[0],_[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,B_.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class T{constructor(e,i,n=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const u in e.paint._values){const h=e.paint.get(u);if(u.endsWith("-use-theme")||!n(u)||!(h instanceof Ta&&uu(h.property.specification)))continue;const f=M(u,e.type),_=h.value,g=h.property.specification.type,v=!!h.property.useIntegerZoom,b=u==="line-dasharray"||u.endsWith("pattern"),w=e.paint.get(`${u}-use-theme`),I=u==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||w&&w.value.kind!=="constant";if(_.kind!=="constant"||I)if(_.kind==="source"||I||b){const A=z(u,g,"source");this.binders[u]=b?new x(_,f,g,A,e.id):new m(_,f,g,A),a.push(`/a_${u}`)}else{const A=z(u,g,"composite");this.binders[u]=new y(_,f,g,v,i,A),a.push(`/z_${u}`)}else this.binders[u]=b?new p(_.value,f):new d(_.value,f,g,i),a.push(`/u_${u}`);w&&(this.binders[u].lutExpression=w.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof m||i instanceof y?i.maxValue:0}populatePaintArrays(e,i,n,a,u,h,f,_){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof m||v instanceof y||v instanceof x)&&v.populatePaintArray(e,i,n,a,u,h,f,_)}}setConstantPatternPositions(e,i){for(const n in this.binders){const a=this.binders[n];a instanceof p&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof x?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,n,a,u,h,f,_,g,v){let b=!1;const w=Object.keys(e),I=w.length!==0&&!_,A=I?w:i.uniqueIds;this.context.lut=u.lut;for(const R in this.binders){const O=this.binders[R];if(O.context=this.context,(O instanceof m||O instanceof y||O instanceof x)&&O.expression&&O.expression.kind&&O.expression.kind!=="constant"&&(O.expression.isStateDependent===!0||O.expression.isLightConstant===!1)){const D=u.paint.get(R);O.expression=D.value;for(const k of A){const U=e[k.toString()];i.eachPosition(k,(G,K,Y)=>{const re=a.feature(G);O.updatePaintArray(K,Y,re,U,h,f,g,v)})}if(!I)for(const k of n.uniqueIds){const U=e[k.toString()];n.eachPosition(k,(G,K,Y)=>{const re=a.feature(G);O.updatePaintArray(K,Y,re,U,h,f,g,v)})}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const n=this.binders[i];(n instanceof d||n instanceof p)&&e.push(...n.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof d||a instanceof p||a instanceof y)for(const u of a.uniformNames)i.push({name:u,property:n,binding:a.getBinding(e,u)})}return i}setUniforms(e,i,n,a,u){for(const{name:h,property:f,binding:_}of n)this.binders[f].setUniform(e,_,u,a.get(f),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof m||i instanceof y||i instanceof x)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof x&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const n=this.binders[i];(n instanceof m||n instanceof y||n instanceof x)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof m||i instanceof y||i instanceof x)&&i.destroy()}}}class E{constructor(e,i,n=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new T(a,i,n);this.needsUpload=!1,this._featureMap=new yc,this._featureMapWithoutIds=new yc,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,n,a,u,h,f,_,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,u,h,f,_,g);i.id!==void 0?this._featureMap.add(i.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,n,a,u,h,f,_){for(const g of n)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,u,h,f||0,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const C={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function M(r,e){return C[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const P={"line-pattern":{source:Go,composite:Go},"fill-pattern":{source:Go,composite:Go},"fill-extrusion-pattern":{source:Go,composite:Go},"line-dasharray":{source:dl,composite:dl}},F={color:{source:Ia,composite:Ks},number:{source:Gr,composite:Ia}};function z(r,e,i){const n=P[r];return n&&n[i]||F[e][i]}vt(d,"ConstantBinder"),vt(p,"PatternConstantBinder"),vt(m,"SourceExpressionBinder"),vt(x,"PatternCompositeBinder"),vt(y,"CompositeExpressionBinder"),vt(T,"ProgramConfiguration",{omit:["_buffers"]}),vt(E,"ProgramConfigurationSet");const B=lt/Math.PI/2,j=64,Z=[j,32,16],H=-B,$=B;function le(r,e,i,n=B){return i=ci(i),[r*Math.sin(i)*n,-e*n,r*Math.cos(i)*n]}function ne(r,e,i){return le(Math.cos(ci(r)),Math.sin(ci(r)),e,i)}const se=63710088e-1,ee=2*Math.PI*se;class J{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new J(Ie(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,n=this.lat*i,a=e.lat*i,u=Math.sin(n)*Math.sin(a)+Math.cos(n)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return se*Math.acos(Math.min(u,1))}toBounds(e=0){const i=360*e/40075017,n=i/Math.cos(Math.PI/180*this.lat);return new ue({lng:this.lng-n,lat:this.lat-i},{lng:this.lng+n,lat:this.lat+i})}toEcef(e){return ne(this.lat,this.lng,B+e*B/se)}static convert(e){if(e instanceof J)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new J(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new J(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class ue{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof J?new J(e.lng,e.lat):J.convert(e),this}setSouthWest(e){return this._sw=e instanceof J?new J(e.lng,e.lat):J.convert(e),this}extend(e){const i=this._sw,n=this._ne;let a,u;if(e instanceof J)a=e,u=e;else{if(!(e instanceof ue))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ue.convert(e)):this.extend(J.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(J.convert(e)):this;if(a=e._sw,u=e._ne,!a||!u)return this}return i||n?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),n.lng=Math.max(u.lng,n.lng),n.lat=Math.max(u.lat,n.lat)):(this._sw=new J(a.lng,a.lat),this._ne=new J(u.lng,u.lat)),this}getCenter(){return new J((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 J(this.getWest(),this.getNorth())}getSouthEast(){return new J(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:n}=J.convert(e);let 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<=n&&n<=this._ne.lat&&a}static convert(e){if(e)return e instanceof ue?e:new ue(e)}}function _e(r){return ee*Math.cos(r*Math.PI/180)}function xe(r){return(180+r)/360}function Ae(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Ee(r,e){return r/_e(e)}function Fe(r){return 360*r-180}function $e(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Te(r,e){return r*_e($e(e))}const he=85.051129;function ze(r){return Math.cos(ci(te(r,-85.051129,he)))}function Me(r,e){const i=te(e,0,25.5),n=Math.pow(2,i);return ze(r)*ee/(512*n)}function We(r){return 1/Math.cos(r*Math.PI/180)}function et(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/lt)/(1<<r.z)*2));return 80150034*i/(i*i+1)/lt/(1<<r.z)}class ut{constructor(e,i,n=0){this.x=+e,this.y=+i,this.z=+n}static fromLngLat(e,i=0){const n=J.convert(e);return new ut(xe(n.lng),Ae(n.lat),Ee(i,n.lat))}toLngLat(){return new J(Fe(this.x),$e(this.y))}toAltitude(){return Te(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ee*We($e(this.y))}}function tt(r,e,i,n,a,u,h,f,_){const g=(e+n)/2,v=(i+a)/2,b=new Ke(g,v);f(b),(function(w,I,A,R,O,D){const k=A-O,U=R-D;return Math.abs((R-I)*k-(A-w)*U)/Math.hypot(k,U)})(b.x,b.y,u.x,u.y,h.x,h.y)>=_?(tt(r,e,i,g,v,u,b,f,_),tt(r,g,v,n,a,b,h,f,_)):r.push(h)}function nt(r,e,i){let n=r[0],a=n.x,u=n.y;e(n);const h=[n];for(let f=1;f<r.length;f++){const _=r[f],{x:g,y:v}=_;e(_),tt(h,a,u,g,v,n,_,e,i),a=g,u=v,n=_}return h}function Et(r,e,i,n){if(n(e,i)){const a=e.add(i)._mult(.5);Et(r,e,a,n),Et(r,a,i,n)}else r.push(i)}function wt(r,e){let i=r[0];const n=[i];for(let a=1;a<r.length;a++){const u=r[a];Et(n,i,u,e),i=u}return n}const pt=Math.pow(2,14)-1,bt=-pt-1;function Ct(r,e){const i=Math.round(r.x*e),n=Math.round(r.y*e);return r.x=te(i,bt,pt),r.y=te(n,bt,pt),(i<r.x||i>r.x+1||n<r.y||n>r.y+1)&&Ft("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function Ot(r,e,i){const n=r.loadGeometry(),a=r.extent,u=lt/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:f,x:_,y:g,projection:v}=i,b=w=>{const I=Fe((e.x+w.x/a)/h),A=$e((e.y+w.y/a)/h),R=v.project(I,A);w.x=(R.x*f-_)*a,w.y=(R.y*f-g)*a};for(let w=0;w<n.length;w++)if(r.type!==1)n[w]=nt(n[w],b,1);else{const I=[];for(const A of n[w])A.x<0||A.x>=a||A.y<0||A.y>=a||(b(A),I.push(A));n[w]=I}}for(const h of n)for(const f of h)Ct(f,u);return n}function Ht(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Ot(r):[]}}class ti{constructor(e,i,n,a,u){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=u,e.readFields(Vt,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,n=[];let a,u=1,h=0,f=0,_=0;for(;e.pos<i;){if(h<=0){const g=e.readVarint();u=7&g,h=g>>3}if(h--,u===1||u===2)f+=e.readSVarint(),_+=e.readSVarint(),u===1&&(a&&n.push(a),a=[]),a&&a.push(new Ke(f,_));else{if(u!==7)throw new Error(`unknown command ${u}`);a&&a.push(a[0].clone())}}return a&&n.push(a),n}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let n=1,a=0,u=0,h=0,f=1/0,_=-1/0,g=1/0,v=-1/0;for(;e.pos<i;){if(a<=0){const b=e.readVarint();n=7&b,a=b>>3}if(a--,n===1||n===2)u+=e.readSVarint(),h+=e.readSVarint(),u<f&&(f=u),u>_&&(_=u),h<g&&(g=h),h>v&&(v=h);else if(n!==7)throw new Error(`unknown command ${n}`)}return[f,g,_,v]}toGeoJSON(e,i,n){const a=this.extent*Math.pow(2,n),u=this.extent*e,h=this.extent*i,f=this.loadGeometry();function _(w){return[360*(w.x+u)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(w.y+h)/a)*Math.PI))-90]}function g(w){return w.map(_)}let v;
7if(this.type===1){const w=[];for(const A of f)w.push(A[0]);const I=g(w);v=w.length===1?{type:"Point",coordinates:I[0]}:{type:"MultiPoint",coordinates:I}}else if(this.type===2){const w=f.map(g);v=w.length===1?{type:"LineString",coordinates:w[0]}:{type:"MultiLineString",coordinates:w}}else{if(this.type!==3)throw new Error("unknown feature type");{const w=(function(A){const R=A.length;if(R<=1)return[A];const O=[];let D,k;for(let U=0;U<R;U++){const G=ui(A[U]);G!==0&&(k===void 0&&(k=G<0),k===G<0?(D&&O.push(D),D=[A[U]]):D&&D.push(A[U]))}return D&&O.push(D),O})(f),I=[];for(const A of w)I.push(A.map(g));v=I.length===1?{type:"Polygon",coordinates:I[0]}:{type:"MultiPolygon",coordinates:I}}}const b={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function Vt(r,e,i){r===1?e.id=i.readVarint():r===2?(function(n,a){const u=n.readVarint()+n.pos;for(;n.pos<u;){const h=a._keys[n.readVarint()],f=a._values[n.readVarint()];a.properties[h]=f}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function ui(r){let e=0;for(let i,n,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],n=r[h],e+=(n.x-i.x)*(i.y+n.y);return e}ti.types=["Unknown","Point","LineString","Polygon"];class jt{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Ti,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new ti(this._pbf,i,this.extent,this._keys,this._values)}}function Ti(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(n){let a=null;const u=n.readVarint()+n.pos;for(;n.pos<u;){const h=n.readVarint()>>3;a=h===1?n.readString():h===2?n.readFloat():h===3?n.readDouble():h===4?n.readVarint64():h===5?n.readVarint():h===6?n.readSVarint():h===7?n.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a})(i))}class bi{constructor(e,i){this.layers=e.readFields(Si,{},i)}}function Si(r,e,i){if(r===3){const n=new jt(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}const ii="3d_elevation_id",qt="level";class mi{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,n){return this.get(e,!0,i,n)}optional(e,i,n){return this.get(e,!1,i,n)}success(){return this._valid}get(e,i,n,a){const u=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&u!==void 0&&!Number.isNaN(u)?n(a?a(u):u):i&&(this._valid=!1),this}}class Zi{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,n){return this.featureFunc(e,i,n)}parseVertex(e,i,n){return this.vertexFunc(e,i,n)}}const Wi=new Zi((r,e,i)=>r.reset(e).require(ii,n=>{i.id=n}).optional("fixed_height_relative",n=>{i.constantHeight=n},Qt.decodeRelativeHeight).geometry(n=>{i.bounds=n},Zl).success(),(r,e,i)=>r.reset(e).require(ii,n=>{i.id=n}).require("elevation_idx",n=>{i.idx=n}).require("extent",n=>{i.extent=n}).require("height_relative",n=>{i.height=n},Qt.decodeRelativeHeight).geometry(n=>{i.position=n},Qt.getPoint).success()),_i=new Zi((r,e,i)=>r.reset(e).require(ii,n=>{i.id=n}).optional("fixed_height",n=>{i.constantHeight=n},Qt.decodeMetricHeight).geometry(n=>{i.bounds=n},Zl).success(),(r,e,i)=>r.reset(e).require(ii,n=>{i.id=n}).require("elevation_idx",n=>{i.idx=n}).require("extent",n=>{i.extent=n}).require("height",n=>{i.height=n},Qt.decodeMetricHeight).geometry(n=>{i.position=n},Qt.getPoint).success());class Qt{static getPoint(e){return is(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?e==="1.0.1"?_i:void 0:Wi}static parse(e){const i=[],n=[],a=e.length,u=new mi;for(let h=0;h<a;h++){const f=e.feature(h),_=f.properties.version,g=Qt.getVersionSchema(_);if(g===void 0){Ft(`Unknown elevation feature version number ${_||"(unknown)"}`);continue}const v=f.properties.type;if(!v)continue;const b=ti.types[f.type];if(b==="Point"&&v==="curve_point"){const w={};g.parseVertex(u,f,w)&&i.push(w)}else if(b==="Polygon"&&v==="curve_meta"){const w={};g.parseFeature(u,f,w)&&n.push(w)}}return{vertices:i,features:n}}}class $t{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const a=qi(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return n[0]=this.pos[0]+this.dir[0]*u,n[1]=this.pos[1]+this.dir[1]*u,!0}}class Di{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const a=tr(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return n[0]=this.pos[0]+this.dir[0]*u,n[1]=this.pos[1]+this.dir[1]*u,n[2]=this.pos[2]+this.dir[2]*u,!0}closestPointOnSphere(e,i,n){if((function(I,A){var R=I[0],O=I[1],D=I[2],k=A[0],U=A[1],G=A[2];return Math.abs(R-k)<=we*Math.max(1,Math.abs(R),Math.abs(k))&&Math.abs(O-U)<=we*Math.max(1,Math.abs(O),Math.abs(U))&&Math.abs(D-G)<=we*Math.max(1,Math.abs(D),Math.abs(G))})(this.pos,e)||i===0)return n[0]=n[1]=n[2]=0,!1;const[a,u,h]=this.dir,f=this.pos[0]-e[0],_=this.pos[1]-e[1],g=this.pos[2]-e[2],v=a*
vendor: 32,341 bytes, line 7
7a+u*u+h*h,b=2*(f*a+_*u+g*h),w=b*b-4*v*(f*f+_*_+g*g-i*i);if(w<0){const I=Math.max(-b/2,0),A=f+a*I,R=_+u*I,O=g+h*I,D=Math.hypot(A,R,O);return n[0]=A*i/D,n[1]=R*i/D,n[2]=O*i/D,!1}{const I=(-b-Math.sqrt(w))/(2*v);if(I<0){const A=Math.hypot(f,_,g);return n[0]=f*i/A,n[1]=_*i/A,n[2]=g*i/A,!1}return n[0]=f+a*I,n[1]=_+u*I,n[2]=g+h*I,!0}}}class rr{constructor(e,i,n,a,u){this.TL=e,this.TR=i,this.BR=n,this.BL=a,this.horizon=u}static fromInvProjectionMatrix(e,i,n){const a=[-1,1,1],u=[1,1,1],h=[1,-1,1],f=[-1,-1,1],_=pr(a,a,e),g=pr(u,u,e),v=pr(h,h,e),b=pr(f,f,e);return new rr(_,g,v,b,i/n)}}function Fi(r,e,i){let n=1/0,a=-1/0;const u=[];for(const h of r){_r(u,h,e);const f=tr(u,i);n=Math.min(n,f),a=Math.max(a,f)}return[n,a]}function Ni(r,e){let i=!0;for(let n=0;n<r.planes.length;n++){const a=r.planes[n];let u=0;for(let h=0;h<e.length;h++)u+=+(tr(a,e[h])+a[3]>=0);if(u===0)return 0;u!==e.length&&(i=!1)}return i?2:1}function xn(r,e){for(const i of r.projections){const n=Fi(e,r.points[0],i.axis);if(i.projection[1]<n[0]||i.projection[0]>n[1])return 0}return 1}function On(r,e){let i=0;const n=[0,0,0,0];for(let a=0;a<r.length;a++)n[0]=r[a][0],n[1]=r[a][1],n[2]=r[a][2],n[3]=1,kn(n,e)>=0&&i++;return i}class Fr{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=gi.fromPoints(this.points),this.projections=[],this.frustumEdges=[_r([],this.points[2],this.points[3]),_r([],this.points[0],this.points[3]),_r([],this.points[4],this.points[0]),_r([],this.points[5],this.points[1]),_r([],this.points[6],this.points[2]),_r([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const a=[0,-n[2],n[1]],u=[n[2],0,-n[0]];this.projections.push({axis:a,projection:Fi(this.points,this.points[0],a)}),this.projections.push({axis:u,projection:Fi(this.points,this.points[0],u)})}}static fromInvProjectionMatrix(e,i,n,a){const u=Math.pow(2,n),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(g=>{const v=An([],g,e),b=1/v[3]/i*u;return(w=v)[0]=(I=v)[0]*(A=[b,b,a?1/v[3]:b,b])[0],w[1]=I[1]*A[1],w[2]=I[2]*A[2],w[3]=I[3]*A[3],w;var w,I,A}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const v=Ii([],Kr([],_r([],h[g[0]],h[g[1]]),_r([],h[g[2]],h[g[1]]))),b=-tr(v,h[g[1]]);return v.concat(b)}),_=[];for(let g=0;g<h.length;g++)_.push([h[g][0],h[g][1],h[g][2]]);return new Fr(_,f)}intersectsPrecise(e,i,n){for(let a=0;a<i.length;a++)if(!On(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!On(e,this.planes[a]))return 0;for(const a of n)for(const u of this.frustumEdges){const h=Kr([],a,u),f=rn(h);if(f===0)continue;Ui(h,h,1/f);const _=Fi(this.points,this.points[0],h),g=Fi(e,this.points[0],h);if(_[0]>g[1]||g[0]>_[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const n=i[3];if(tr([i[0],i[1],i[2]],e)+n<0)return!1}return!0}}class gi{static fromPoints(e){const i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const a of e)Xn(i,i,a),hn(n,n,a);return new gi(i,n)}static fromTileIdAndHeight(e,i,n){const a=1<<e.canonical.z,u=e.canonical.x,h=e.canonical.y;return new gi([u/a,h/a,i],[(u+1)/a,(h+1)/a,n])}static applyTransform(e,i){const n=e.getCorners();for(let a=0;a<n.length;++a)pr(n[a],n[a],i);return gi.fromPoints(n)}static applyTransformFast(e,i){const n=[i[12],i[13],i[14]],a=[...n];for(let u=0;u<3;u++)for(let h=0;h<3;h++){const f=i[4*h+u],_=f*e.min[h],g=f*e.max[h];n[u]+=Math.min(_,g),a[u]+=Math.max(_,g)}return new gi(n,a)}static projectAabbCorners(e,i){const n=e.getCorners();for(let a=0;a<n.length;++a)pr(n[a],n[a],i);return n}constructor(e,i){this.min=e,this.max=i,this.center=Ui([],sr([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=_o(this.min),a=_o(this.max);for(let u=0;u<i.length;u++)n[u]=i[u]?this.min[u]:this.center[u],a[u]=i[u]?this.center[u]:this.max[u];return a[2]=this.max[2],new gi(n,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(){const 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)?Ni(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Ni(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)?xn(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?xn(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])]}}vt(gi,"Aabb");class Un{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,n=i[1],a=-i[0],u=(e.extent+1)*this.metersToTile;return[new Ke(Math.trunc(e.position[0]+n*u),Math.trunc(e.position[1]+a*u)),new Ke(Math.trunc(e.position[0]-n*u),Math.trunc(e.position[1]-a*u))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class Yr{constructor(e,i,n,a,u,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[Jr(),Jr(),Jr(),Jr(),Jr(),Jr(),Jr()],this.id=e,this.heightRange={min:n,max:n},this.safeArea=i,this.constantHeight=n,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=u,this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((_=this.vertices[f.a].position)[0]===(g=this.vertices[f.b].position)[0]&&_[1]===g[1]);var _,g}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:is(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const _=this.vertices[f.a].position,g=this.vertices[f.b].position,v=ns(Jr(),g,_),b=Rs(v),w=Ps(Jr(),v,1/b);this.edgeProps.push({vec:v,dir:w,len:b});const I=this.vertexProps[f.a].dir,A=this.vertexProps[f.b].dir;Cs(I,I,w),Cs(A,A,w)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||Ba(f.dir,f.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[n,a]=i;return Dt(this.vertices[this.edges[n].a].height,this.vertices[this.edges[n].b].height,a)}computeSlopeNormal(e,i){const n=this.getClosestEdge(e);if(!n)return Ci(0,0,1);const a=n[0],u=this.edges[a],h=this.edgeProps[a].vec,f=Ci(h[0],h[1],(this.vertices[u.b].height-this.vertices[u.a].height)*i),_=Ci(f[1],-f[0],0);Kr(_,_,f);const g=rn(_);return g>0?Ui(_,_,1/g):Li(_,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,n=Number.POSITIVE_INFINITY,a=0;const[u,h,f,_,g,v,b]=this._tmpVec2;rs(b,e.x,e.y);const w=new $t(b,null);for(let I=0;I<this.edges.length;I++){const A=this.edges[I],R=this.edgeProps[I].dir;w.dir=R;const O=this.vertices[A.a].position,D=this.vertices[A.b].position,k=w.intersectsPlane(O,this.vertexProps[A.a].dir,u),U=w.intersectsPlane(D,this.vertexProps[A.b].dir,h);if(!k||!U)continue;ns(f,h,u),ns(_,b,u);const G=qi(f,f),K=G>0?qi(_,f)/G:0,Y=te(K,0,1),re=Math.abs((K-Y)*this.edgeProps[I].len);ns(g,b,O),rs(v,R[1],-R[0]);const oe=re+Math.abs(qi(g,v));oe<n&&(i=I,n=oe,a=Y)}return[i,a]}tessellate(e){const i=Wt(),n=Wt(),a=Wt(),u=Wt();for(let h=this.edges.length-1;h>=0;--h){const f=this.edges[h].a,_=this.edges[h].b,{position:g,height:v,extent:b}=this.vertices[f],{position:w,height:I,extent:A}=this.vertices[_],R=this.vertexProps[f].dir,O=this.vertexProps[_].dir;if(Li(i,g[0]/e,g[1]/e,v),Li(n,w[0]/e,w[1]/e,I),Li(a,R[1],-R[0],0),Ui(a,a,b),Li(u,O[1],-O[0],0),Ui(u,u,A),this.distSqLines(Ci(i[0]+.5*a[0],i[1]+.5*a[1],i[2]+.5*a[2]),Ci(n[0]-.5*u[0],n[1]-.5*u[1],n[2]-.5*u[2]),Ci(i[0]-.5*a[0],i[1]-.5*a[1],i[2]-.5*a[2]),Ci(n[0]+.5*u[0],n[1]+.5*u[1],n[2]+.5*u[2]))<=.0025000000000000005)continue;const D=this.vertices.length,k=Cs(Jr(),g,w);this.vertices.push({position:Ps(k,k,.5),height:.5*(v+I),extent:.5*(b+A)});const U=Cs(Jr(),R,O);this.vertexProps.push({dir:Ba(U,U)}),this.edges.splice(h,1),this.edgeProps.splice(h,1),this.edges.push({a:f,b:D}),this.edges.push({a:D,b:_});const G=ns(Jr(),this.vertices[D].position,g),K=Rs(G),Y={vec:G,dir:Ps(Jr(),G,1/K),len:K};this.edgeProps.push(Y),this.edgeProps.push(Y)}}distSqLines(e,i,n,a){const u=go(Wt(),i,e),h=go(Wt(),a,n),f=go(Wt(),e,n),_=tr(u,u),g=tr(u,h),v=tr(u,f),b=tr(h,h),w=tr(h,f),I=_*b-g*g;if(I===0)return Jo(aa(u,n,a,tr(f,h)/tr(h,h)),e);const A=(_*w-g*v)/I;return Jo(aa(u,e,i,(g*w-v*b)/I),aa(h,n,a,A))}}class vn{static parseFrom(e,i){const n=Qt.parse(e);if(!n)return[];let{vertices:a,features:u}=n;const h=1/et(i);u.sort((v,b)=>v.id-b.id),a.sort((v,b)=>v.id-b.id||v.idx-b.idx),a=a.filter((v,b,w)=>b===w.findIndex(I=>I.id===v.id&&I.idx===v.idx));const f=new Array;let _=0;const g=a.length;for(const v of u){if(v.constantHeight){f.push(new Yr(v.id,v.bounds,v.constantHeight));continue}for(;_!==g&&a[_].id<v.id;)_++;if(_===g||a[_].id!==v.id)continue;const b=new Array,w=new Array,I=_;for(;_!==g&&a[_].id===v.id;){const A=a[_];if(b.push({position:A.position,height:A.height,extent:A.extent}),_!==I&&a[_-1].idx===A.idx-1){const R=_-I;w.push({a:R-1,b:R})}_++}f.push(new Yr(v.id,v.bounds,void 0,b,w,h))}return f}static getElevationFeature(e,i){if(!i)return;const n=+e.properties[ii];return Number.isNaN(n)?void 0:i.find(a=>a.id===n)}}class To{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*lt,this.yOffset=(e.y*this.zScale-i.y)*lt)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,n){const a=this.constantElevation(i,n);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),n))}computeBiasedHeight(e,i){return i<=0?e:e+i*me(0,i,e>=0?e:Math.abs(.5*e))}}vt(Yr,"ElevationFeature");class bn{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Ys,this.indexArray=new Mr,this.segments=new Hi,this.programConfigurations=new E(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Gr),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){const u=this.layers[0],h=[];let f=null;u.type==="circle"&&(f=u.layout.get("circle-sort-key"));for(const{feature:g,id:v,index:b,sourceLayerIndex:w}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Ht(g,I);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),A,n))continue;const R=f?f.evaluate(A,{},n):void 0,O={id:v,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:I?A.geometry:Ot(g,n,a),patterns:{},sortKey:R};h.push(O)}f&&h.sort((g,v)=>g.sortKey-v.sortKey);let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new fl,_=a.projection);for(const g of h){const{geometry:v,index:b,sourceLayerIndex:w}=g,I=e[b].feature;this.addFeature(g,v,b,i.availableImages,n,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(I,v,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,n,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,jp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,qp.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Gp.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,n,a,u,h,f,_){let g;this.elevationMode!=="none"&&(g=vn.getElevationFeature(e,_));for(const v of i)for(const b of v){const w=b.x,I=b.y;if(w<0||w>=lt||I<0||I>=lt)continue;if(h){const O=h.projectTilePoint(w,I,u),D=h.upVector(u,w,I);this.addGlobeExtVertex(O,D),this.addGlobeExtVertex(O,D),this.addGlobeExtVertex(O,D),this.addGlobeExtVertex(O,D)}const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),R=A.vertexLength;if(this.addCircleVertex(w,I,-1,-1),this.addCircleVertex(w,I,1,-1),this.addCircleVertex(w,I,1,1),this.addCircleVertex(w,I,-1,1),this.elevationMode!=="none"){const O=g?g.pointElevation(new Ke(w,I)):0;this.hasElevation=this.hasElevation||O!==0;for(let D=0;D<4;D++)this.elevatedLayoutVertexArray.emplaceBack(O)}this.indexArray.emplaceBack(R,R+1,R+2),this.indexArray.emplaceBack(R,R+2,R+3),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},a,u,f,void 0,this.worldview)}addCircleVertex(e,i,n,a){this.layoutVertexArray.emplaceBack(2*e+(n+1)/2,2*i+(a+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function Ki(r,e){for(let i=0;i<r.length;i++)if(Gn(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Gn(r,e[i]))return!0;return!!Qr(r,e)}function fr(r,e,i){return!!Gn(r,e)||!!qo(e,r,i)}function ki(r,e){if(r.length===1)return gl(e,r[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let a=0;a<n.length;a++)if(Gn(r,n[a]))return!0}for(let i=0;i<r.length;i++)if(gl(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Qr(r,e[i]))return!0;return!1}function yr(r,e,i){if(r.length>1){if(Qr(r,e))return!0;for(let n=0;n<e.length;n++)if(qo(e[n],r,i))return!0}for(let n=0;n<r.length;n++)if(qo(r[n],e,i))return!0;return!1}function Qr(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const n=r[i],a=r[i+1];for(let u=0;u<e.length-1;u++)if(cr(n,a,e[u],e[u+1]))return!0}return!1}function cr(r,e,i,n){return Oi(r,i,n)!==Oi(e,i,n)&&Oi(r,e,i)!==Oi(r,e,n)}function jn(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function bc(r,e,i,n){const a=jn(r,e,n),u=jn(r,e,i);if(Math.sign(a)===Math.sign(u))return;const h=jn(i,n,r),f=h+u-a;return Math.sign(h)!==Math.sign(f)?[h/(h-f),u/(u-a)]:void 0}function qo(r,e,i){const n=i*i;if(e.length===1)return r.distSqr(e[0])<n;for(let a=1;a<e.length;a++)if(_l(r,e[a-1],e[a])<n)return!0;return!1}function _l(r,e,i){const n=e.distSqr(i);if(n===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/n;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function gl(r,e){let i,n,a,u=!1;for(let h=0;h<r.length;h++){i=r[h];for(let f=0,_=i.length-1;f<i.length;_=f++)n=i[f],a=i[_],n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(u=!u)}return u}function Gn(r,e){let i=!1;for(let n=0,a=r.length-1;n<r.length;a=n++){const u=r[n],h=r[a];u.y>e.y!=h.y>e.y&&e.x<(h.x-u.x)*(e.y-u.y)/(h.y-u.y)+u.x&&(i=!i)}return i}function $o(r,e,i,n,a){for(const h of r)if(e<=h.x&&i<=h.y&&n>=h.x&&a>=h.y)return!0;const u=[new Ke(e,i),new Ke(e,a),new Ke(n,a),new Ke(n,i)];if(r.length>2){for(const h of u)if(Gn(r,h))return!0}for(let h=0;h<r.length-1;h++)if(Ho(r[h],r[h+1],u))return!0;return!1}function Ho(r,e,i){const n=i[0],a=i[2];if(r.x<n.x&&e.x<n.x||r.x>a.x&&e.x>a.x||r.y<n.y&&e.y<n.y||r.y>a.y&&e.y>a.y)return!1;const u=Oi(r,e,i[0]);return u!==Oi(r,e,i[1])||u!==Oi(r,e,i[2])||u!==Oi(r,e,i[3])}function so(r,e,i,n,a,u){let h=e.y-r.y,f=r.x-e.x;if(u=u||0){const _=h*h+f*f;if(_===0)return!0;const g=Math.sqrt(_);h/=g,f/=g}return!((i.x-r.x)*h+(i.y-r.y)*f-u<0||(n.x-r.x)*h+(n.y-r.y)*f-u<0||(a.x-r.x)*h+(a.y-r.y)*f-u<0)}function gs(r,e,i,n,a,u,h){return!(so(r,e,n,a,u,h)||so(e,i,n,a,u,h)||so(i,r,n,a,u,h)||so(n,a,r,e,i,h)||so(a,u,r,e,i,h)||so(u,n,r,e,i,h))}function Aa(r,e,i){const n=e.paint.get(r).value;return n.kind==="constant"?n.value:i.programConfigurations.get(e.id).getMaxValue(r)}function Pu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function yx(r,e,i,n,a){if(!e[0]&&!e[1])return r;const u=Ke.convert(e)._mult(a);i==="viewport"&&u._rotate(-n);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(u));return h}function xx(r,e,i,n){const a=Ke.convert(r)._mult(n);return e==="viewport"&&a._rotate(-i),a}let vx,bx;function wx(r,e,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[r*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}vt(bn,"CircleBucket",{omit:["layers"]});class wc{constructor(e,i,n){this.z=e,this.x=i,this.y=n,this.key=Ru(0,e,e,i,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const i=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>i&&e.y===this.y>>i}url(e,i){const n=(function(u,h,f){var _=wx(256*u,256*(h=Math.pow(2,f)-h-1),f),g=wx(256*(u+1),256*(h+1),f);return _[0]+","+_[1]+","+g[0]+","+g[1]})(this.x,this.y,this.z),a=(function(u,h,f){let _,g="";for(let v=u;v>0;v--)_=1<<v-1,g+=(h&_?1:0)+(f&_?2:0);return g})(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Tx{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Ru(e,i.z,i.z,i.x,i.y)}}class wn{constructor(e,i,n,a,u){this.overscaledZ=e,this.wrap=i,this.canonical=new wc(n,+a,+u),this.key=i===0&&e===n?this.canonical.key:Ru(i,e,n,a,u)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new wn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new wn(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 Ru(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return Ru(this.wrap*+i,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new wn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,n=2*this.canonical.x,a=2*this.canonical.y;return[new wn(i,this.wrap,i,n,a),new wn(i,this.wrap,i,n+1,a),new wn(i,this.wrap,i,n,a+1),new wn(i,this.wrap,i,n+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 wn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new wn(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 Tx(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Ru(r,e,i,n,a){const u=1<<Math.min(i,22);let h=u*(a%u)+n%u;return r&&i<22&&(h+=u*u*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const oT=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new wn(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,i=r.wrap;return e===1<<r.canonical.z&&(e=0,i++),new wn(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new wn(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new wn(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];vt(wc,"CanonicalTileID"),vt(wn,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const sT=ei([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Xp}=sT,aT=ei([{name:"a_pos_3",components:3,type:"Int16"}]);var Ex=ei([{name:"a_pos",type:"Int16",components:2}]);function Yp(r){return r*B/se}const lT=[new gi([H,H,H],[$,$,$]),new gi([H,H,H],[0,0,$]),new gi([0,H,H],[$,0,$]),new gi([H,0,H],[0,$,$]),new gi([0,0,H],[$,$,$])];function Sx(r,e,i,n=!0){const a=Ui([],r._camera.position,r.worldSize),u=[e,i,1,1];An(u,u,r.pixelMatrixInverse),ca(u,u,1/u[3]);const h=Ii([],_r([],u,a)),f=r.globeMatrix,_=[f[12],f[13],f[14]],g=_r([],_,a),v=rn(g),b=Ii([],g),w=r.worldSize/(2*Math.PI),I=tr(b,h),A=Math.asin(w/v);if(A<Math.acos(I)){if(!n)return null;const ce=[],de=[];Ui(ce,h,v/I),Ii(de,_r(de,ce,g)),Ii(h,sr(h,g,Ui(h,de,Math.tan(A)*v)))}const R=[];new Di(a,h).closestPointOnSphere(_,w,R);const O=Ii([],Yi(f,0)),D=Ii([],Yi(f,1)),k=Ii([],Yi(f,2)),U=tr(O,R),G=tr(D,R),K=tr(k,R),Y=ye(Math.asin(-G/w));let re=ye(Math.atan2(U,K));re=r.center.lng+(function(ce,de){const De=(de-ce+180)%360-180;return De<-180?De+360:De})(r.center.lng,re);const oe=xe(re),ie=te(Ae(Y),0,1);return new ut(oe,ie)}class cT{constructor(e,i,n){this.a=_r([],e,n),this.b=_r([],i,n),this.center=n;const a=Ii([],this.a),u=Ii([],this.b);this.angle=Math.acos(tr(a,u))}}function U_(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:(function(n,a,u,h){const f=Math.sin(u);return n*(Math.sin((1-h)*u)/f)+a*(Math.sin(h*u)/f)})(r.a[e],r.b[e],r.angle,te(i,0,1))+r.center[e]}function Js(r){if(r.z<=1)return lT[r.z+2*r.y+r.x];const e=j_(Kp(r));return gi.fromPoints(e)}function Ma(r,e,i){return Ui(r,r,1-i),In(r,r,e,i)}function Ix(r,e,i){for(const n of r)pr(n,n,e),Ui(n,n,i)}function Ax(r,e,i,n){const a=e/r.worldSize,u=r.globeMatrix;if(i.z<=1){const ie=Js(i).getCorners();return Ix(ie,u,a),gi.fromPoints(ie)}const h=Kp(i,n),f=j_(h,B+Yp(r._tileCoverLift));Ix(f,u,a);const _=Number.MAX_VALUE,g=[-_,-_,-_],v=[_,_,_];if(h.contains(r.center)){for(const de of f)Xn(v,v,de),hn(g,g,de);g[2]=0;const ie=r.point,ce=[ie.x*a,ie.y*a,0];return Xn(v,v,ce),hn(g,g,ce),new gi(v,g)}if(r._tileCoverLift>0){for(const ie of f)Xn(v,v,ie),hn(g,g,ie);return new gi(v,g)}const b=[u[12]*a,u[13]*a,u[14]*a],w=h.getCenter(),I=te(r.center.lat,-85.051129,he),A=te(w.lat,-85.051129,he),R=xe(r.center.lng),O=Ae(I);let D=R-xe(w.lng);const k=O-Ae(A);D>.5?D-=1:D<-.5&&(D+=1);let U=0;Math.abs(D)>Math.abs(k)?U=D>=0?1:3:(U=k>=0?0:2,In(b,b,[u[4]*a,u[5]*a,u[6]*a],-Math.sin(ci(k>=0?h.getSouth():h.getNorth()))*B));const G=f[U],K=f[(U+1)%4],Y=new cT(G,K,b),re=[U_(Y,0)||G[0],U_(Y,1)||G[1],U_(Y,2)||G[2]],oe=yl(r.zoom);if(oe>0){const ie=(function({x:de,y:De,z:Ce},Le,Ue,Ne,Ve){const Se=1/(1<<Ce);let Ge=de*Se,Oe=Ge+Se,qe=De*Se,je=qe+Se,mt=0;const _t=(Ge+Oe)/2-Ne;return _t>.5?mt=-1:_t<-.5&&(mt=1),Ge=((Ge+mt)*Le-(Ne*=Le))*Ue+Ne,Oe=((Oe+mt)*Le-Ne)*Ue+Ne,qe=(qe*Le-(Ve*=Le))*Ue+Ve,je=(je*Le-Ve)*Ue+Ve,[[Ge,je,0],[Oe,je,0],[Oe,qe,0],[Ge,qe,0]]})(i,e,r._pixelsPerMercatorPixel,R,O);for(let de=0;de<f.length;de++)Ma(f[de],ie[de],oe);const ce=sr([],ie[U],ie[(U+1)%4]);Ui(ce,ce,.5),Ma(re,ce,oe)}for(const ie of f)Xn(v,v,ie),hn(g,g,ie);return v[2]=Math.min(G[2],K[2]),Xn(v,v,re),hn(g,g,re),new gi(v,g)}function Kp({x:r,y:e,z:i},n=!1){const a=1/(1<<i),u=new J(Fe(r*a),e===(1<<i)-1&&n?-90:$e((e+1)*a)),h=new J(Fe((r+1)*a),e===0&&n?90:$e(e*a));return new ue(u,h)}function j_(r,e=B){const i=ci(r.getNorth()),n=ci(r.getSouth()),a=Math.cos(i),u=Math.cos(n),h=Math.sin(i),f=Math.sin(n),_=r.getWest(),g=r.getEast();return[le(u,f,_,e),le(u,f,g,e),le(a,h,g,e),le(a,h,_,e)]}function Md(r,e,i,n){const a=1<<i.z,u=(r/lt+i.x)/a;return ne($e((e/lt+i.y)/a),Fe(u),n)}function Jp({min:r,max:e}){return 16383/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const Mx=new Float64Array(16);function Qp(r){const e=Jp(r),i=Mt(Mx,[e,e,e]);return gt(i,i,nn([],r.min))}function G_(r){const e=(function(n,a){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=a[0],n[13]=a[1],n[14]=a[2],n[15]=1,n})(Mx,r.min),i=1/Jp(r);return Qe(e,e,[i,i,i])}function q_(r){const e=lt/(2*Math.PI);return r/(2*Math.PI)/e}function Cx(r,e){return lt/(512*Math.pow(2,r))*Jp(Js(e))}function Px(r,e,i,n,a){const u=q_(i),h=[r,e,-i/(2*Math.PI)],f=pe(new Float64Array(16));return gt(f,f,h),Qe(f,f,[u,u,u]),He(f,f,ci(-a)),yt(f,f,ci(-n)),f}function yl(r){return me(5,6,r)}function Rx(r,e){const i=ne(e.lat,e.lng),n=(function(A){const R=ne(A._center.lat,A._center.lng);let O=Kr([],Ci(0,1,0),R);const D=li([],-A.angle,R);O=pr(O,O,D),li(D,-A._pitch,O);const k=Ii([],R);return Ui(k,k,Yp(A.cameraToCenterDistance/A.pixelsPerMeter)),pr(k,k,D),sr([],R,k)})(r);return h=(a=go([],n,i))[0],f=a[1],_=a[2],g=(u=i)[0],v=u[1],b=u[2],I=(w=Math.sqrt((h*h+f*f+_*_)*(g*g+v*v+b*b)))&&tr(a,u)/w,Math.acos(Math.min(Math.max(I,-1),1));var a,u,h,f,_,g,v,b,w,I}function $_(r,e){return Rx(r,e)>Math.PI/2*1.01}const Lx=ci(85),uT=Math.cos(Lx),hT=Math.sin(Lx),dT=Be(),Dx=r=>{const e=[];return r.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),r.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function zx(r,e,i,n,a,u,h,f,_){if(u&&r.queryGeometry.isAboveHorizon)return!1;u&&(_*=r.pixelToTileUnitsFactor);const g=r.tileID.canonical,v=i.projection.upVectorScale(g,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const w of b){const I=w.add(f),A=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(I.x,I.y,!0):0,R=i.projection.projectTilePoint(I.x,I.y,g);if(A>0){const U=i.projection.upVector(g,I.x,I.y);R.x+=U[0]*v*A,R.y+=U[1]*v*A,R.z+=U[2]*v*A}const O=u?I:fT(R.x,R.y,R.z,n),D=u?r.tilespaceRays.map(U=>mT(U,A)):r.queryGeometry.screenGeometry,k=An([],[R.x,R.y,R.z,1],n);if(!h&&u?_*=k[3]/i.cameraToCenterDistance:h&&!u&&(_*=i.cameraToCenterDistance/k[3]),u){const U=$e((w.y/lt+g.y)/(1<<g.z));_/=i.projection.pixelsPerMeter(U,1)/Ee(1,U)}if(fr(D,O,_))return!0}return!1}function fT(r,e,i,n){const a=An([],[r,e,i,1],n);return new Ke(a[0]/a[3],a[1]/a[3])}const Ox=Ci(0,0,0),pT=Ci(0,0,1);function mT(r,e){const i=Wt();return Ox[2]=e,r.intersectsPlane(Ox,pT,i),new Ke(i[0],i[1])}class Fx extends bn{}let kx,Bx,Nx,Vx;function Ux(r,{width:e,height:i},n,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*n)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*n);return r.width=e,r.height=i,r.data=a,r}function jx(r,e,i){const{width:n,height:a}=e;n===r.width&&a===r.height||(H_(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,n),height:Math.min(r.height,a)},i,null),r.width=n,r.height=a,r.data=e.data)}function H_(r,e,i,n,a,u,h,f){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||n.x>e.width-a.width||n.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,g=e.data,v=u===4&&f;for(let b=0;b<a.height;b++){const w=((i.y+b)*r.width+i.x)*u,I=((n.y+b)*e.width+n.x)*u;if(v)for(let A=0;A<a.width;A++){const R=w+A*u+3,O=I+A*u;g[O+0]=255,g[O+1]=255,g[O+2]=255,g[O+3]=_[R]}else if(h)for(let A=0;A<a.width;A++){const R=w+A*u,O=I+A*u,D=new vi(_[R+0]/255,_[R+1]/255,_[R+2]/255,_[R+3]).toNonPremultipliedRenderColor(h).toArray();g[O+0]=D[0],g[O+1]=D[1],g[O+2]=D[2],g[O+3]=D[3]}else for(let A=0;A<a.width*u;A++)g[I+A]=_[w+A]}return e}vt(Fx,"HeatmapBucket",{omit:["layers"]});class xl{constructor(e,i){Ux(this,e,1,i)}resize(e){jx(this,new xl(e),1)}clone(){return new xl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,a,u){H_(e,i,n,a,u,1,null)}}class en{constructor(e,i){Ux(this,e,4,i)}resize(e){jx(this,new en(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new en({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,a,u,h,f){H_(e,i,n,a,u,4,h,f)}}class Gx{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Cd(r){const e={},i=r.resolution||256,n=r.clips?r.clips.length:1,a=r.image||new en({width:i,height:n}),u=(h,f,_)=>{e[r.evaluationKey]=_;const g=r.expression.evaluate(e),v=g?g.toNonPremultipliedRenderColor(null):null;v&&(a.data[h+f+0]=Math.floor(255*v.r),a.data[h+f+1]=Math.floor(255*v.g),a.data[h+f+2]=Math.floor(255*v.b),a.data[h+f+3]=Math.floor(255*v.a))};if(r.clips)for(let h=0,f=0;h<n;++h,f+=4*i)for(let _=0,g=0;_<i;_++,g+=4){const v=_/(i-1),{start:b,end:w}=r.clips[h];u(f,g,b*(1-v)+w*v)}else for(let h=0,f=0;h<i;h++,f+=4)u(0,f,h/(i-1));return a}vt(xl,"AlphaImage"),vt(en,"RGBAImage");const _T=ei([{name:"a_pos",components:2,type:"Int16"}],4),gT=ei([{name:"a_road_z_offset",components:1,type:"Float32"}],4),yT=ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),xT=ei([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Lu(r,e,i=2){const n=e&&e.length,a=n?e[0]*i:r.length;let u=qx(r,0,a,i,!0);const h=[];if(!u||u.next===u.prev)return h;let f,_,g;if(n&&(u=(function(v,b,w,I){const A=[];for(let R=0,O=b.length;R<O;R++){const D=qx(v,b[R]*I,R<O-1?b[R+1]*I:v.length,I,!1);D===D.next&&(D.steiner=!0),A.push(AT(D))}A.sort(ET);for(let R=0;R<A.length;R++)w=ST(A[R],w);return w})(r,e,u,i)),r.length>80*i){f=r[0],_=r[1];let v=f,b=_;for(let w=i;w<a;w+=i){const I=r[w],A=r[w+1];I<f&&(f=I),A<_&&(_=A),I>v&&(v=I),A>b&&(b=A)}g=Math.max(v-f,b-_),g=g!==0?32767/g:0}return Pd(u,h,i,f,_,g,0),h}function qx(r,e,i,n,a){let u;if(a===(function(h,f,_,g){let v=0;for(let b=f,w=_-g;b<_;b+=g)v+=(h[w]-h[b])*(h[b+1]+h[w+1]),w=b;return v})(r,e,i,n)>0)for(let h=e;h<i;h+=n)u=Wx(h/n|0,r[h],r[h+1],u);else for(let h=i-n;h>=e;h-=n)u=Wx(h/n|0,r[h],r[h+1],u);return u&&Du(u,u.next)&&(Dd(u),u=u.next),u}function Tc(r,e){if(!r)return r;e||(e=r);let i,n=r;do if(i=!1,n.steiner||!Du(n,n.next)&&kr(n.prev,n,n.next)!==0)n=n.next;else{if(Dd(n),n=e=n.prev,n===n.next)break;i=!0}while(i||n!==e);return e}function Pd(r,e,i,n,a,u,h){if(!r)return;!h&&u&&(function(_,g,v,b){let w=_;do w.z===0&&(w.z=Z_(w.x,w.y,g,v,b)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==_);w.prevZ.nextZ=null,w.prevZ=null,(function(I){let A,R=1;do{let O,D=I;I=null;let k=null;for(A=0;D;){A++;let U=D,G=0;for(let Y=0;Y<R&&(G++,U=U.nextZ,U);Y++);let K=R;for(;G>0||K>0&&U;)G!==0&&(K===0||!U||D.z<=U.z)?(O=D,D=D.nextZ,G--):(O=U,U=U.nextZ,K--),k?k.nextZ=O:I=O,O.prevZ=k,k=O;D=U}k.nextZ=null,R*=2}while(A>1)})(w)})(r,n,a,u);let f=r;for(;r.prev!==r.next;){const _=r.prev,g=r.next;if(u?bT(r,n,a,u):vT(r))e.push(_.i,r.i,g.i),Dd(r),r=g.next,f=g.next;else if((r=g)===f){h?h===1?Pd(r=wT(Tc(r),e),e,i,n,a,u,2):h===2&&TT(r,e,i,n,a,u):Pd(Tc(r),e,i,n,a,u,1);break}}}function vT(r){const e=r.prev,i=r,n=r.next;
vendor: 1,477 bytes, line 7
7if(kr(e,i,n)>=0)return!1;const a=e.x,u=i.x,h=n.x,f=e.y,_=i.y,g=n.y,v=Math.min(a,u,h),b=Math.min(f,_,g),w=Math.max(a,u,h),I=Math.max(f,_,g);let A=n.next;for(;A!==e;){if(A.x>=v&&A.x<=w&&A.y>=b&&A.y<=I&&Rd(a,f,u,_,h,g,A.x,A.y)&&kr(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function bT(r,e,i,n){const a=r.prev,u=r,h=r.next;if(kr(a,u,h)>=0)return!1;const f=a.x,_=u.x,g=h.x,v=a.y,b=u.y,w=h.y,I=Math.min(f,_,g),A=Math.min(v,b,w),R=Math.max(f,_,g),O=Math.max(v,b,w),D=Z_(I,A,e,i,n),k=Z_(R,O,e,i,n);let U=r.prevZ,G=r.nextZ;for(;U&&U.z>=D&&G&&G.z<=k;){if(U.x>=I&&U.x<=R&&U.y>=A&&U.y<=O&&U!==a&&U!==h&&Rd(f,v,_,b,g,w,U.x,U.y)&&kr(U.prev,U,U.next)>=0||(U=U.prevZ,G.x>=I&&G.x<=R&&G.y>=A&&G.y<=O&&G!==a&&G!==h&&Rd(f,v,_,b,g,w,G.x,G.y)&&kr(G.prev,G,G.next)>=0))return!1;G=G.nextZ}for(;U&&U.z>=D;){if(U.x>=I&&U.x<=R&&U.y>=A&&U.y<=O&&U!==a&&U!==h&&Rd(f,v,_,b,g,w,U.x,U.y)&&kr(U.prev,U,U.next)>=0)return!1;U=U.prevZ}for(;G&&G.z<=k;){if(G.x>=I&&G.x<=R&&G.y>=A&&G.y<=O&&G!==a&&G!==h&&Rd(f,v,_,b,g,w,G.x,G.y)&&kr(G.prev,G,G.next)>=0)return!1;G=G.nextZ}return!0}function wT(r,e){let i=r;do{const n=i.prev,a=i.next.next;!Du(n,a)&&Hx(n,i,i.next,a)&&Ld(n,a)&&Ld(a,n)&&(e.push(n.i,i.i,a.i),Dd(i),Dd(i.next),i=r=a),i=i.next}while(i!==r);return Tc(i)}function TT(r,e,i,n,a,u){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&MT(h,f)){let _=Zx(h,f);return h=Tc(h,h.next),_=Tc(_,_.next),Pd(h,e,i,n,a,u,0),void Pd(_,e,i,n,a,u,0)}f=f.next}h=h.next}while(h!==r)}function ET(r,e){let i=r.x-e.x;
vendor: 32,140 bytes, line 7
7return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function ST(r,e){const i=(function(a,u){let h=u;const f=a.x,_=a.y;let g,v=-1/0;if(Du(a,h))return h;do{if(Du(a,h.next))return h.next;if(_<=h.y&&_>=h.next.y&&h.next.y!==h.y){const R=h.x+(_-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(R<=f&&R>v&&(v=R,g=h.x<h.next.x?h:h.next,R===f))return g}h=h.next}while(h!==u);if(!g)return null;const b=g,w=g.x,I=g.y;let A=1/0;h=g;do{if(f>=h.x&&h.x>=w&&f!==h.x&&$x(_<I?f:v,_,w,I,_<I?v:f,_,h.x,h.y)){const R=Math.abs(_-h.y)/(f-h.x);Ld(h,a)&&(R<A||R===A&&(h.x>g.x||h.x===g.x&&IT(g,h)))&&(g=h,A=R)}h=h.next}while(h!==b);return g})(r,e);if(!i)return e;const n=Zx(i,r);return Tc(n,n.next),Tc(i,i.next)}function IT(r,e){return kr(r.prev,r,e.prev)<0&&kr(e.next,r,r.next)<0}function Z_(r,e,i,n,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function AT(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function $x(r,e,i,n,a,u,h,f){return(a-h)*(e-f)>=(r-h)*(u-f)&&(r-h)*(n-f)>=(i-h)*(e-f)&&(i-h)*(u-f)>=(a-h)*(n-f)}function Rd(r,e,i,n,a,u,h,f){return!(r===h&&e===f)&&$x(r,e,i,n,a,u,h,f)}function MT(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,n){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==n.i&&a.next.i!==n.i&&Hx(a,a.next,i,n))return!0;a=a.next}while(a!==i);return!1})(r,e)&&(Ld(r,e)&&Ld(e,r)&&(function(i,n){let a=i,u=!1;const h=(i.x+n.x)/2,f=(i.y+n.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&h<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(u=!u),a=a.next;while(a!==i);return u})(r,e)&&(kr(r.prev,r,e.prev)||kr(r,e.prev,e))||Du(r,e)&&kr(r.prev,r,r.next)>0&&kr(e.prev,e,e.next)>0)}function kr(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Du(r,e){return r.x===e.x&&r.y===e.y}function Hx(r,e,i,n){const a=tm(kr(r,e,i)),u=tm(kr(r,e,n)),h=tm(kr(i,n,r)),f=tm(kr(i,n,e));return a!==u&&h!==f||!(a!==0||!em(r,i,e))||!(u!==0||!em(r,n,e))||!(h!==0||!em(i,r,n))||!(f!==0||!em(i,e,n))}function em(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function tm(r){return r>0?1:r<0?-1:0}function Ld(r,e){return kr(r.prev,r,r.next)<0?kr(r,e,r.next)>=0&&kr(r,r.prev,e)>=0:kr(r,e,r.prev)<0||kr(r,r.next,e)<0}function Zx(r,e){const i=W_(r.i,r.x,r.y),n=W_(e.i,e.x,e.y),a=r.next,u=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,n.next=i,i.prev=n,u.next=n,n.prev=u,n}function Wx(r,e,i,n){const a=W_(r,e,i);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function Dd(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function W_(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function zd(r,e){const i=r.length;if(i<=1)return[r];const n=[];let a,u;for(let h=0;h<i;h++){const f=wr(r[h]);f!==0&&(r[h].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(a&&n.push(a),a=[r[h]]):a.push(r[h]))}if(a&&n.push(a),e>1)for(let h=0;h<n.length;h++)n[h].length<=e||(qc(n[h],e,1,n[h].length-1,CT),n[h]=n[h].slice(0,e));return n}function CT(r,e){return e.area-r.area}function Xx(r,e,i=1){if(!r)return null;const n=typeof r=="string"?Ln.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const u of[n,a]){if(!u)continue;const h=u.id.toString();e.has(h)||e.set(h,[]),u.scaleSelf(i),e.get(h).push(u)}return{primary:n.toString(),secondary:a?a.toString():null}}function X_(r,e,i,n){const a=n.patternDependencies;let u=!1;for(const h of e){const f=h.paint.get(`${r}-pattern`);f.isConstant()||(u=!0),Xx(f.constantOr(null),a,i)&&(u=!0)}return u}function Y_(r,e,i,n,a,u){const h=u.patternDependencies;for(const f of e){const _=f.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let g=_.evaluate({zoom:n},i,{},u.availableImages);g=g&&g.name?g.name:g;const v=Xx(g,h,a);if(!v)continue;const{primary:b,secondary:w}=v;b&&(i.patterns[f.id]=[b,w].filter(Boolean))}}return i}class Ca{constructor(){this.portals=[]}static isOnBorder(e,i){return e<=0&&i<=0||e>=lt&&i>=lt}static evaluate(e){if(e.length===0)return new Ca;let i=[];for(const _ of e)i.push(..._.portals);if(i.length===0)return new Ca;for(const _ of i){const g=_.va,v=_.vb;(Ca.isOnBorder(g.x,v.x)||Ca.isOnBorder(g.y,v.y))&&(_.type="border")}const n=i.filter(_=>_.type!=="unevaluated"),a=i.filter(_=>_.type==="unevaluated");if(a.length===0)return new Ca;a.sort((_,g)=>_.hash===g.hash?_.isTunnel===g.isTunnel?0:_.isTunnel?-1:1:_.hash<g.hash?1:-1),i=n.concat(a);let u=n.length,h=u,f=u;do if(h++,h===i.length||i[u].hash!==i[h].hash){if(h-u===2){f<u&&(i[f]=i[u],i[u]=null);const _=i[f],g=i[h-1];_.type=_.isTunnel!==g.isTunnel?"tunnel":"polygon",_.connection={a:_.connection.a,b:g.connection.a},f++}u=h}while(u!==i.length);return i.splice(f),i.sort((_,g)=>_.hash<g.hash?1:-1),{portals:i}}}vt(Ca,"ElevationPortalGraph");class PT{constructor(e,i,n){this.outPositions=e,this.outNormals=i,this.outIndices=n,this.vertexLookup=new Map}addVertex(e,i,n){let a=e[2];n!=null&&(a*=n);const u=`${e[0]},${e[1]},${e[2]},${i[0]},${i[1]},${i[2]}`,h=this.vertexLookup.get(u);if(h!=null)return h;const f=this.outPositions.length;this.vertexLookup.set(u,f);const _=Math.trunc(16384*i[0]),g=Math.trunc(16384*i[1]),v=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(_,g,v),f}addTriangle(e,i,n){this.outIndices.emplaceBack(e,i,n)}addTriangles(e,i,n){if(e.length===0)return;const a=n.length===1,u=Wt(),h=Wt();for(let f=0;f<e.length;f+=3){const _=i[e[f+0]],g=i[e[f+1]],v=i[e[f+2]],b=a?n[0]:n[e[f+1]],w=a?n[0]:n[e[f+2]];Li(u,_.x,_.y,a?n[0]:n[e[f+0]]);const I=this.addVertex(u,h);Li(u,g.x,g.y,b);const A=this.addVertex(u,h);Li(u,v.x,v.y,w);const R=this.addVertex(u,h);this.outIndices.emplaceBack(I,A,R)}}addQuad(e,i,n,a,u,h){const f=this.addVertex(e,u,h),_=this.addVertex(i,u,h),g=this.addVertex(n,u,h),v=this.addVertex(a,u,h);this.addTriangle(f,_,g),this.addTriangle(g,v,f)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class ao{constructor(e,i,n,a){this.unevaluatedPortals=new Ca,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new hl,this.vertexNormals=new _d,this.indexArray=new Mr,this.tileToMeters=et(e),this.bridgeProgramConfigurations=new E(i,{zoom:n,lut:a},u=>u!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new E(i,{zoom:n,lut:a},u=>u!=="fill-bridge-guard-rail-color")}addVertices(e,i){const n=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return n}addTriangles(e,i,n){const a=n?this.unevalTunnelTriangles:this.unevalTriangles;for(const u of e)a.push(u+i)}addRenderableRing(e,i,n,a,u,h){const f=[new Ke(u.min.x,u.min.y),new Ke(u.max.x,u.min.y),new Ke(u.max.x,u.max.y),new Ke(u.min.x,u.max.y)];for(let _=0;_<n-1;_++){const g=i+_,v=g+1,b=this.unevalVertices[g],w=this.unevalVertices[v];if(!(b.x>=u.min.x&&b.x<=u.max.x&&b.y>=u.min.y&&b.y<=u.max.y||w.x>=u.min.x&&w.x<=u.max.x&&w.y>=u.min.y&&w.y<=u.max.y||Ho(b,w,f))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const I=ao.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let A,R=this.vertexHashLookup.get(ao.computePosHash(b));R!=null?A=R.next:(R=this.vertexHashLookup.get(ao.computePosHash(w)),A=R!=null?R.prev:I),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:I,portalHash:A,isTunnel:a,type:"unevaluated",featureInfo:h})}}addPortalCandidates(e,i,n,a,u){if(i.length!==0){this.vertexHashLookup.clear();for(const h of i){if(h.length===0)continue;const f=h[0];let _=ao.computeEdgeHash(f[f.length-2],f[f.length-1]);for(let g=0;g<f.length-1;g++){const v=f[g+0],b=f[g+1],w=is(b.x-v.x,b.y-v.y),I=Rs(w);if(I===0)continue;let A="unevaluated";const R=a.pointElevation(v),O=a.pointElevation(b);Math.abs(R)<.01&&Math.abs(O)<.01?A="entrance":(this.isOnBorder(v.x,b.x)||this.isOnBorder(v.y,b.y))&&(A="border");const D=ao.computeEdgeHash(v,b);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:v,vb:b,vab:w,length:I,hash:D,isTunnel:n,type:A});const k=ao.computePosHash(v);this.vertexHashLookup.set(k,{prev:_,next:D}),_=D}}}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),n=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},a=new PT(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const u=i(),h=i(),f=i(),_=(w,I)=>{w.sort((R,O)=>R.type===I&&O.type!==I?-1:R.type!==I&&O.type===I?1:0);const A=w.findIndex(R=>R.type!==I);return A>=0?A:w.length};let g=0;this.unevalEdges.length>0&&(g=_(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},this.tileToMeters)),n(f);const v=i(),b=i();if(this.unevalEdges.length>0){const w=this.unevalEdges.splice(g),I=_(w,"tunnel")+g;this.unevalEdges.push(...w),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},{min:g,max:I})}n(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),n(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),n(h),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),n(u),this.maskSegments=Hi.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=Hi.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableBridgeSegments=Hi.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=Hi.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=Hi.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength)}update(e,i,n,a,u,h,f,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,u,n,a,h,f,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,u,n,a,h,f,_)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,yT.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,xT.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,i,n,a,u){const h=(f,_)=>{for(let g=0;g<_.length-1;g++){const v=_[g].featureIndex,b=_[g+1].vertexStart,w=e.feature(v);f.populatePaintArrays(b,w,v,{},n,i,a,void 0,u)}};h(this.bridgeProgramConfigurations,this.bridgeFeatureSections),h(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,n,a,u){const h=new Map;for(let f=a;f<u;f++){const _=n[f],g=_.a,v=_.b,b=ao.computePosHash(e[g]),w=ao.computePosHash(e[v]);let I=h.get(b);I||(I={},h.set(b,I));let A=h.get(w);A||(A={},h.set(w,A)),i[g]<=0&&i[v]<=0||(I.to=v,A.from=g)}return h}isTerminalVertex(e,i){const n=ao.computePosHash(this.unevalVertices[e]),a=i.get(n);return!a||!a.from||!a.to}constructBridgeStructures(e,i,n,a,u,h){e.clearVertexLookup();const f=this.computeVertexConnections(i,n,a,u.min,u.max),_=1/h,g=.5*_,v=(Ue,Ne)=>Li(Ue,i[Ne].x,i[Ne].y,n[Ne]*_),b=Wt(),w=Wt(),I=Wt(),A=Wt(),R=Wt(),O=(Ue,Ne)=>{const Ve=f.get(ao.computePosHash(i[Ne])),Se=Ve.from,Ge=Ve.to;if(!Se||!Ge)return;v(b,Se),v(w,Ne),v(I,Ge),la(A),Io(b,w)||(_r(R,w,b),Ii(A,R)),Io(I,w)||(_r(R,I,w),sr(A,A,Ii(R,R)));const Oe=As(A);return Oe>0?Ui(Ue,A,1/Oe):void 0};let D=Number.POSITIVE_INFINITY;this.sortSubarray(a,u.min,u.max,(Ue,Ne)=>Ue.featureInfo.featureIndex-Ne.featureInfo.featureIndex);const k=Wt(),U=Wt(),G=Wt(),K=Wt(),Y=Wt(),re=Wt(),oe=Wt(),ie=Wt(),ce=Wt(),de=[Wt(),Wt(),Wt(),Wt()],De=[Wt(),Wt(),Wt(),Wt()],Ce=[{coord:new Ke(0,0),height:0},{coord:new Ke(0,0),height:0}],Le=(Ue,Ne)=>Ue>Ne;for(let Ue=u.min;Ue<u.max;Ue++){const Ne=a[Ue];if(!Ne.featureInfo.guardRailEnabled||!this.prepareEdgePoints(Ce,i,n,Ne,Le))continue;const[Ve,Se]=Ce;if(Li(k,Ve.coord.x,Ve.coord.y,_*Ve.height),Li(U,Se.coord.x,Se.coord.y,_*Se.height),Io(k,U))continue;_r(G,U,k),Ii(G,G);const Ge=O(ie,Ne.a)||G,Oe=O(ce,Ne.b)||G;Li(K,Ge[1],-Ge[0],0),Ii(K,K),Li(Y,Oe[1],-Oe[0],0),Ii(Y,Y),Kr(ie,K,Ge),Ii(re,ie),Kr(ie,Y,Oe),Ii(oe,ie),sr(de[0],k,Ui(ie,_r(ie,K,re),g)),sr(de[1],k,Ui(ie,sr(ie,K,re),g)),sr(de[2],k,Ui(ie,re,g)),de[3]=k,sr(De[0],U,Ui(ie,_r(ie,Y,oe),g)),sr(De[1],U,Ui(ie,sr(ie,Y,oe),g)),sr(De[2],U,Ui(ie,oe,g)),De[3]=U,D=this.addFeatureSection(Ne.featureInfo.featureIndex,D,this.bridgeFeatureSections,e);const qe=e.addVertex(de[0],K,h),je=e.addVertex(de[1],K,h),mt=e.addVertex(De[0],Y,h),_t=e.addVertex(De[1],Y,h);e.addTriangle(qe,je,mt),e.addTriangle(je,_t,mt);const st=e.addVertex(de[1],re,h),ct=e.addVertex(de[2],re,h),Rt=e.addVertex(De[1],oe,h),St=e.addVertex(De[2],oe,h);e.addTriangle(st,ct,Rt),e.addTriangle(ct,St,Rt),nn(K,K),nn(Y,Y);const ft=e.addVertex(de[2],K,h),Bt=e.addVertex(de[3],K,h),Jt=e.addVertex(De[2],Y,h),pi=e.addVertex(De[3],Y,h);e.addTriangle(ft,Bt,Jt),e.addTriangle(Bt,pi,Jt);const Yt=this.isTerminalVertex(Ne.a,f),Mi=this.isTerminalVertex(Ne.b,f);Ve.height<.01&&Yt&&e.addQuad(de[3],de[2],de[1],de[0],nn(Ge,Ge),h),Se.height<.01&&Mi&&e.addQuad(De[0],De[1],De[2],De[3],Oe,h)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,n,a,u,h){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const _=(D,k)=>D.featureInfo.featureIndex-k.featureInfo.featureIndex;this.sortSubarray(a,u.min,u.max,_),this.sortSubarray(a,h.min,h.max,_);const g=D=>Ii(D,D),v=[{coord:new Ke(0,0),height:0},{coord:new Ke(0,0),height:0}],b=(D,k)=>D<k,w=Wt(),I=Wt(),A=Wt(),R=Wt(),O=Wt();for(let D=u.min;D<u.max;D++){if(!this.prepareEdgePoints(v,i,n,a[D],b))continue;const[k,U]=v,G=g(Li(O,-(U.coord.y-k.coord.y),U.coord.x-k.coord.x,0));f=this.addFeatureSection(a[D].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(Li(w,k.coord.x,k.coord.y,k.height),Li(I,U.coord.x,U.coord.y,U.height),Li(A,U.coord.x,U.coord.y,a[D].isTunnel?-.1:0),Li(R,k.coord.x,k.coord.y,a[D].isTunnel?-.1:0),G)}for(let D=h.min;D<h.max;D++){const k=a[D];k.isTunnel&&([k.a,k.b]=[k.b,k.a]);const U=i[k.a],G=i[k.b],K=g(Li(O,-(G.y-U.y),G.x-U.x,0));f=this.addFeatureSection(k.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(Li(w,G.x,G.y,0),Li(I,U.x,U.y,0),Li(A,U.x,U.y,n[k.a]+4),Li(R,G.x,G.y,n[k.b]+4),K),e.addQuad(Li(w,U.x,U.y,0),Li(I,G.x,G.y,0),Li(A,G.x,G.y,n[k.b]+4),Li(R,U.x,U.y,n[k.a]+4),K)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,n,a){e.coord.x=i,e.coord.y=n,e.height=a}prepareEdgePoints(e,i,n,a,u){let h=i[a.a].x,f=i[a.a].y,_=i[a.b].x,g=i[a.b].y,v=n[a.a],b=n[a.b];const w=u(v,0),I=u(b,0);if(w&&I)return this.setElevatedPoint(e[0],h,f,v),this.setElevatedPoint(e[1],_,g,b),!0;if(!w&&!I)return!1;if(w){if(!I){const A=b/(b-v);_=Dt(_,h,A),g=Dt(g,f,A),b=Dt(b,v,A)}}else{const A=v/(v-b);h=Dt(h,_,A),f=Dt(f,g,A),v=Dt(v,b,A)}return this.setElevatedPoint(e[0],h,f,v),this.setElevatedPoint(e[1],_,g,b),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((f,_)=>f.hash===_.hash?_.polygonIdx-f.polygonIdx:_.hash>f.hash?1:-1);let n=0,a=0,u=0,h=i[n].polygonIdx;do a++,(a===i.length||i[n].hash!==i[a].hash)&&((a-n===1||i[a-1].polygonIdx!==h)&&(u<n&&(i[u]=i[n],i[n]=null),i[u].type="none",u++),n=a,n!==i.length&&(h=i[n].polygonIdx));while(n!==i.length);if(i.splice(u),i.length!==0&&e.length!==0){i.sort((g,v)=>g.portalHash<v.portalHash?1:-1);let f=0,_=0;for(;f!==i.length&&_!==e.length;){const g=i[f],v=e[_];g.portalHash>v.hash?f++:v.hash>g.portalHash?_++:(g.type=v.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=lt&&i>=lt}addFeatureSection(e,i,n,a){return e!==i&&(i=e,n.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,n,a){const u=e.slice(i,n);u.sort(a),e.splice(i,u.length,...u)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(ao.computePosHash(e))<<32n|BigInt(ao.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}function RT(r,e){return r>e?1:r<e?-1:0}class K_{constructor(e=RT,i=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!i}rotateLeft(e){var i=e.right;i&&(e.right=i.left,i.left&&(i.left.parent=e),i.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.left=e),e.parent=i}rotateRight(e){var i=e.left;i&&(e.left=i.right,i.right&&(i.right.parent=e),i.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.right=e),e.parent=i}_splay(e){for(;e.parent;){var i=e.parent;i.parent?i.left===e&&i.parent.left===i?(this.rotateRight(i.parent),this.rotateRight(i)):i.right===e&&i.parent.right===i?(this.rotateLeft(i.parent),this.rotateLeft(i)):i.left===e&&i.parent.right===i?(this.rotateRight(i),this.rotateLeft(i)):(this.rotateLeft(i),this.rotateRight(i)):i.left===e?this.rotateRight(i):this.rotateLeft(i)}}splay(e){for(var i,n,a,u,h;e.parent;)(n=(i=e.parent).parent)&&n.parent?((a=n.parent).left===n?a.left=e:a.right=e,e.parent=a):(e.parent=null,this._root=e),u=e.left,h=e.right,e===i.left?(n&&(n.left===i?(i.right?(n.left=i.right,n.left.parent=n):n.left=null,i.right=n,n.parent=i):(u?(n.right=u,u.parent=n):n.right=null,e.left=n,n.parent=e)),h?(i.left=h,h.parent=i):i.left=null,e.right=i,i.parent=e):(n&&(n.right===i?(i.left?(n.right=i.left,n.right.parent=n):n.right=null,i.left=n,n.parent=i):(h?(n.left=h,h.parent=n):n.left=null,e.right=n,n.parent=e)),u?(i.right=u,u.parent=i):i.right=null,e.left=i,i.parent=e)}replace(e,i){e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,i){var n=this._root,a=null,u=this._compare;if(this._noDuplicates)for(;n;){if(a=n,u(n.key,e)===0)return;n=u(n.key,e)<0?n.right:n.left}else for(;n;)a=n,n=u(n.key,e)<0?n.right:n.left;return n={key:e,data:i,left:null,right:null,parent:a},a?u(a.key,n.key)<0?a.right=n:a.left=n:this._root=n,this.splay(n),this._size++,n}find(e){for(var i=this._root,n=this._compare;i;){var a=n(i.key,e);if(a<0)i=i.right;else{if(!(a>0))return i;i=i.left}}return null}contains(e){for(var i=this._root,n=this._compare;i;){var a=n(e,i.key);if(a===0)return!0;i=a<0?i.left:i.right}return!1}remove(e){var i=this.find(e);if(!i)return!1;if(this.splay(i),i.left)if(i.right){var n=this.minNode(i.right);n.parent!==i&&(this.replace(n,n.right),n.right=i.right,n.right.parent=n),this.replace(i,n),n.left=i.left,n.left.parent=n}else this.replace(i,i.left);else this.replace(i,i.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var i=this.minNode(e.right);i.parent!==e&&(this.replace(i,i.right),i.right=e.right,i.right.parent=i),this.replace(e,i),i.left=e.left,i.left.parent=i}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var i=this.find(e);if(i){this.splay(i);var n=i.left,a=i.right,u=null;n&&(n.parent=null,u=this.maxNode(n),this.splay(u),this._root=u),a&&(n?u.right=a:this._root=a,a.parent=u),this._size--}}pop(){var e=this._root,i=null;if(e){for(;e.left;)e=e.left;i={key:e.key,data:e.data},this.remove(e.key)}return i}next(e){var i=e;if(i)if(i.right)for(i=i.right;i&&i.left;)i=i.left;else for(i=e.parent;i&&i.right===e;)e=i,i=i.parent;return i}prev(e){var i=e;if(i)if(i.left)for(i=i.left;i&&i.right;)i=i.right;else for(i=e.parent;i&&i.left===e;)e=i,i=i.parent;return i}forEach(e){for(var i=this._root,n=[],a=!1,u=0;!a;)i?(n.push(i),i=i.left):n.length>0?(e(i=n.pop(),u++),i=i.right):a=!0;return this}range(e,i,n,a){const u=[],h=this._compare;let f,_=this._root;for(;u.length!==0||_;)if(_)u.push(_),_=_.left;else{if(_=u.pop(),f=h(_.key,i),f>0)break;if(h(_.key,e)>=0&&n.call(a,_))return this;_=_.right}return this}keys(){for(var e=this._root,i=[],n=[],a=!1;!a;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),n.push(e.key),e=e.right):a=!0;return n}values(){for(var e=this._root,i=[],n=[],a=!1;!a;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),n.push(e.data),e=e.right):a=!0;return n}at(e){for(var i=this._root,n=[],a=!1,u=0;!a;)if(i)n.push(i),i=i.left;else if(n.length>0){if(i=n.pop(),u===e)return i;u++,i=i.right}else a=!0;return null}load(e=[],i=[],n=!1){if(this._size!==0)throw new Error("bulk-load: tree is not empty");const a=e.length;return n&&Q_(e,i,0,a-1,this._compare),this._root=J_(null,e,i,0,a),this._size=a,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return this._root===null}get size(){return this._size}static createTree(e,i,n,a,u){return new K_(n,u).load(e,i,a)}}function J_(r,e,i,n,a){const u=a-n;if(u>0){const h=n+Math.floor(u/2),f={key:e[h],data:i[h],parent:r};return f.left=J_(f,e,i,n,h),f.right=J_(f,e,i,h+1,a),f}return null}function Q_(r,e,i,n,a){if(i>=n)return;const u=r[i+n>>1];let h=i-1,f=n+1;for(;;){do h++;while(a(r[h],u)<0);do f--;while(a(r[f],u)>0);if(h>=f)break;let _=r[h];r[h]=r[f],r[f]=_,_=e[h],e[h]=e[f],e[f]=_}Q_(r,e,i,f,a),Q_(r,e,f+1,n,a)}const Yx=11102230246251565e-32,qn=134217729,LT=(3+8*Yx)*Yx;function eg(r,e,i,n,a){let u,h,f,_,g=e[0],v=n[0],b=0,w=0;v>g==v>-g?(u=g,g=e[++b]):(u=v,v=n[++w]);let I=0;if(b<r&&w<i)for(v>g==v>-g?(h=g+u,f=u-(h-g),g=e[++b]):(h=v+u,f=u-(h-v),v=n[++w]),u=h,f!==0&&(a[I++]=f);b<r&&w<i;)v>g==v>-g?(h=u+g,_=h-u,f=u-(h-_)+(g-_),g=e[++b]):(h=u+v,_=h-u,f=u-(h-_)+(v-_),v=n[++w]),u=h,f!==0&&(a[I++]=f);for(;b<r;)h=u+g,_=h-u,f=u-(h-_)+(g-_),g=e[++b],u=h,f!==0&&(a[I++]=f);for(;w<i;)h=u+v,_=h-u,f=u-(h-_)+(v-_),v=n[++w],u=h,f!==0&&(a[I++]=f);return u===0&&I!==0||(a[I++]=u),I}function Od(r){return new Float64Array(r)}const zu=Od(4),Kx=Od(8),Jx=Od(12),Qx=Od(16),lo=Od(4);function Fd(r,e,i){e===null?(r.inOut=!1,r.otherInOut=!0):(r.isSubject===e.isSubject?(r.inOut=!e.inOut,r.otherInOut=e.otherInOut):(r.inOut=!e.otherInOut,r.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(r.prevInResult=!ev(e,i)||e.isVertical()?e.prevInResult:e)),r.resultTransition=ev(r,i)?(function(n,a){let u,h=!n.inOut,f=!n.otherInOut;switch(a){case 0:u=h&&f;break;case 1:u=h||f;break;case 3:u=h!==f;break;case 2:u=n.isSubject?h&&!f:f&&!h}return u?1:-1})(r,i):0}function ev(r,e){switch(r.type){case 0:switch(e){case 0:return!r.otherInOut;case 1:return r.otherInOut;case 2:return r.isSubject&&r.otherInOut||!r.isSubject&&!r.otherInOut;case 3:return!0}break;case 2:return e===0||e===1;case 3:return e===2;case 1:return!1}return!1}class Ou{constructor(e,i,n,a,u){this.left=i,this.point=e,this.otherEvent=n,this.isSubject=a??!1,this.type=u||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(e){const i=this.point,n=this.otherEvent.point;return this.left?(i[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(i[1]-e[1])>0:(n[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(n[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return this.resultTransition!==0}clone(){const e=new Ou(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e}}function Qs(r,e){return r[0]===e[0]&&r[1]===e[1]}function tg(r,e,i){const n=(function(a,u,h,f,_,g){const v=(u-g)*(h-_),b=(a-_)*(f-g),w=v-b;if(v===0||b===0||v>0!=b>0)return w;const I=Math.abs(v+b);return Math.abs(w)>=33306690738754716e-32*I?w:-(function(A,R,O,D,k,U,G){let K,Y,re,oe,ie,ce,de,De,Ce,Le,Ue,Ne,Ve,Se,Ge,Oe,qe,je;const mt=A-k,_t=O-k,st=R-U,ct=D-U;Se=mt*ct,ce=qn*mt,de=ce-(ce-mt),De=mt-de,ce=qn*ct,Ce=ce-(ce-ct),Le=ct-Ce,Ge=De*Le-(Se-de*Ce-De*Ce-de*Le),Oe=st*_t,ce=qn*st,de=ce-(ce-st),De=st-de,ce=qn*_t,Ce=ce-(ce-_t),Le=_t-Ce,qe=De*Le-(Oe-de*Ce-De*Ce-de*Le),Ue=Ge-qe,ie=Ge-Ue,zu[0]=Ge-(Ue+ie)+(ie-qe),Ne=Se+Ue,ie=Ne-Se,Ve=Se-(Ne-ie)+(Ue-ie),Ue=Ve-Oe,ie=Ve-Ue,zu[1]=Ve-(Ue+ie)+(ie-Oe),je=Ne+Ue,ie=je-Ne,zu[2]=Ne-(je-ie)+(Ue-ie),zu[3]=je;let Rt=(function(pi,Yt){let Mi=Yt[0];for(let ai=1;ai<4;ai++)Mi+=Yt[ai];return Mi})(0,zu),St=22204460492503146e-32*G;if(Rt>=St||-Rt>=St||(ie=A-mt,K=A-(mt+ie)+(ie-k),ie=O-_t,re=O-(_t+ie)+(ie-k),ie=R-st,Y=R-(st+ie)+(ie-U),ie=D-ct,oe=D-(ct+ie)+(ie-U),K===0&&Y===0&&re===0&&oe===0)||(St=11093356479670487e-47*G+LT*Math.abs(Rt),Rt+=mt*oe+ct*K-(st*re+_t*Y),Rt>=St||-Rt>=St))return Rt;Se=K*ct,ce=qn*K,de=ce-(ce-K),De=K-de,ce=qn*ct,Ce=ce-(ce-ct),Le=ct-Ce,Ge=De*Le-(Se-de*Ce-De*Ce-de*Le),Oe=Y*_t,ce=qn*Y,de=ce-(ce-Y),De=Y-de,ce=qn*_t,Ce=ce-(ce-_t),Le=_t-Ce,qe=De*Le-(Oe-de*Ce-De*Ce-de*Le),Ue=Ge-qe,ie=Ge-Ue,lo[0]=Ge-(Ue+ie)+(ie-qe),Ne=Se+Ue,ie=Ne-Se,Ve=Se-(Ne-ie)+(Ue-ie),Ue=Ve-Oe,ie=Ve-Ue,lo[1]=Ve-(Ue+ie)+(ie-Oe),je=Ne+Ue,ie=je-Ne,lo[2]=Ne-(je-ie)+(Ue-ie),lo[3]=je;const ft=eg(4,zu,4,lo,Kx);Se=mt*oe,ce=qn*mt,de=ce-(ce-mt),De=mt-de,ce=qn*oe,Ce=ce-(ce-oe),Le=oe-Ce,Ge=De*Le-(Se-de*Ce-De*Ce-de*Le),Oe=st*re,ce=qn*st,de=ce-(ce-st),De=st-de,ce=qn*re,Ce=ce-(ce-re),Le=re-Ce,qe=De*Le-(Oe-de*Ce-De*Ce-de*Le),Ue=Ge-qe,ie=Ge-Ue,lo[0]=Ge-(Ue+ie)+(ie-qe),Ne=Se+Ue,ie=Ne-Se,Ve=Se-(Ne-ie)+(Ue-ie),Ue=Ve-Oe,ie=Ve-Ue,lo[1]=Ve-(Ue+ie)+(ie-Oe),je=Ne+Ue,ie=je-Ne,lo[2]=Ne-(je-ie)+(Ue-ie),lo[3]=je;const Bt=eg(ft,Kx,4,lo,Jx);Se=K*oe,ce=qn*K,de=ce-(ce-K),De=K-de,ce=qn*oe,Ce=ce-(ce-oe),Le=oe-Ce,Ge=De*Le-(Se-de*Ce-De*Ce-de*Le),Oe=Y*re,ce=qn*Y,de=ce-(ce-Y),De=Y-de,ce=qn*re,Ce=ce-(ce-re),Le=re-Ce,qe=De*Le-(Oe-de*Ce-De*Ce-de*Le),Ue=Ge-qe,ie=Ge-Ue,lo[0]=Ge-(Ue+ie)+(ie-qe),Ne=Se+Ue,ie=Ne-Se,Ve=Se-(Ne-ie)+(Ue-ie),Ue=Ve-Oe,ie=Ve-Ue,lo[1]=Ve-(Ue+ie)+(ie-Oe),je=Ne+Ue,ie=je-Ne,lo[2]=Ne-(je-ie)+(Ue-ie),lo[3]=je;const Jt=eg(Bt,Jx,4,lo,Qx);return Qx[Jt-1]})(a,u,h,f,_,g,I)})(r[0],r[1],e[0],e[1],i[0],i[1]);return n>0?-1:n<0?1:0}function vl(r,e){const i=r.point,n=e.point;return i[0]>n[0]?1:i[0]<n[0]?-1:i[1]!==n[1]?i[1]>n[1]?1:-1:(function(a,u,h){return a.left!==u.left?a.left?1:-1:tg(h,a.otherEvent.point,u.otherEvent.point)!==0?a.isBelow(u.otherEvent.point)?-1:1:!a.isSubject&&u.isSubject?1:-1})(r,e,i)}function bl(r,e,i){const n=new Ou(e,!1,r,r.isSubject),a=new Ou(e,!0,r.otherEvent,r.isSubject);return Qs(r.point,r.otherEvent.point)&&console.warn("what is that, a collapsed segment?",r),n.contourId=a.contourId=r.contourId,vl(a,r.otherEvent)>0&&(r.otherEvent.left=!0,a.left=!1),r.otherEvent.otherEvent=a,r.otherEvent=n,i.push(a),i.push(n),i}function im(r,e){return r[0]*e[1]-r[1]*e[0]}function ig(r,e){return r[0]*e[0]+r[1]*e[1]}function rg(r,e,i){const n=(function(_,g,v,b){const w=[g[0]-_[0],g[1]-_[1]],I=[b[0]-v[0],b[1]-v[1]];function A(re,oe,ie){return[re[0]+oe*ie[0],re[1]+oe*ie[1]]}const R=[v[0]-_[0],v[1]-_[1]];let O=im(w,I),D=O*O;const k=ig(w,w);if(D>0){const re=im(R,I)/O;if(re<0||re>1)return null;const oe=im(R,w)/O;return oe<0||oe>1?null:re===0||re===1?[A(_,re,w)]:oe===0||oe===1?[A(v,oe,I)]:[A(_,re,w)]}if(O=im(R,w),D=O*O,D>0)return null;const U=ig(w,R)/k,G=U+ig(w,I)/k,K=Math.min(U,G),Y=Math.max(U,G);return K<=1&&Y>=0?K===1?[A(_,K>0?K:0,w)]:Y===0?[A(_,Y<1?Y:1,w)]:[A(_,K>0?K:0,w),A(_,Y<1?Y:1,w)]:null})(r.point,r.otherEvent.point,e.point,e.otherEvent.point),a=n?n.length:0;if(a===0||a===1&&(Qs(r.point,e.point)||Qs(r.otherEvent.point,e.otherEvent.point))||a===2&&r.isSubject===e.isSubject)return 0;if(a===1)return!Qs(r.point,n[0])&&!Qs(r.otherEvent.point,n[0])&&bl(r,n[0],i),!Qs(e.point,n[0])&&!Qs(e.otherEvent.point,n[0])&&bl(e,n[0],i),1;const u=[];let h=!1,f=!1;return Qs(r.point,e.point)?h=!0:vl(r,e)===1?u.push(e,r):u.push(r,e),Qs(r.otherEvent.point,e.otherEvent.point)?f=!0:vl(r.otherEvent,e.otherEvent)===1?u.push(e.otherEvent,r.otherEvent):u.push(r.otherEvent,e.otherEvent),h&&f||h?(e.type=1,r.type=e.inOut===r.inOut?2:3,h&&!f&&bl(u[1].otherEvent,u[0].point,i),2):f?(bl(u[0],u[1].point,i),3):u[0]!==u[3].otherEvent?(bl(u[0],u[1].point,i),bl(u[1],u[2].point,i),3):(bl(u[0],u[1].point,i),bl(u[3].otherEvent,u[2].point,i),3)}function DT(r,e){if(r===e)return 0;if(tg(r.point,r.otherEvent.point,e.point)!==0||tg(r.point,r.otherEvent.point,e.otherEvent.point)!==0)return Qs(r.point,e.point)?r.isBelow(e.otherEvent.point)?-1:1:r.point[0]===e.point[0]?r.point[1]<e.point[1]?-1:1:vl(r,e)===1?e.isAbove(r.point)?-1:1:r.isBelow(e.point)?-1:1;if(r.isSubject!==e.isSubject)return r.isSubject?-1:1;{let i=r.point,n=e.point;if(i[0]===n[0]&&i[1]===n[1])return i=r.otherEvent.point,n=e.otherEvent.point,i[0]===n[0]&&i[1]===n[1]?0:(r.contourId??0)>(e.contourId??0)?1:-1}return vl(r,e)===1?1:-1}class zT{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return this.holeOf==null}}function OT(r,e,i,n){let a,u=r+1,h=e[r].point;const f=e.length;for(u<f&&(a=e[u].point);u<f&&a[0]===h[0]&&a[1]===h[1];){if(!i[u])return u;u++,u<f&&(a=e[u].point)}for(u=r-1;i[u]&&u>n;)u--;return u}function FT(r,e,i){const n=new zT;if(r.prevInResult!=null){const a=r.prevInResult,u=a.outputContourId;if(a.resultTransition>0){const h=e[u];if(h.holeOf!=null){const f=h.holeOf;e[f].holeIds.push(i),n.holeOf=f,n.depth=e[u].depth}else e[u].holeIds.push(i),n.holeOf=u,n.depth=e[u].depth+1}else n.holeOf=null,n.depth=e[u].depth}else n.holeOf=null,n.depth=0;return n}const tv=Math.max,iv=Math.min;let rm=0;function rv(r,e,i,n,a,u){let h,f,_,g,v,b;for(h=0,f=r.length-1;h<f;h++){if(_=r[h],g=r[h+1],v=new Ou(_,!1,void 0,e),b=new Ou(g,!1,v,e),v.otherEvent=b,_[0]===g[0]&&_[1]===g[1])continue;v.contourId=b.contourId=i,u||(v.isExteriorRing=!1,b.isExteriorRing=!1),vl(v,b)>0?b.left=!0:v.left=!0;const w=_[0],I=_[1];a[0]=iv(a[0],w),a[1]=iv(a[1],I),a[2]=tv(a[2],w),a[3]=tv(a[3],I),n.push(v),n.push(b)}}const nm=[];function nv(r,e,i){let n=r,a=e;typeof r[0][0][0]=="number"&&(n=[r]),typeof e[0][0][0]=="number"&&(a=[e]);let u=(function(w,I,A){let R=null;return w.length*I.length===0&&(A===0?R=nm:A===2?R=w:(A===1||A===3)&&(R=w.length===0?I:w)),R})(n,a,i);if(u)return u===nm?null:u;const h=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],_=(function(w,I,A,R,O){const D=new Wl(void 0,vl);let k,U,G,K,Y,re;for(G=0,K=w.length;G<K;G++)for(k=w[G],Y=0,re=k.length;Y<re;Y++)U=Y===0,U&&rm++,rv(k[Y],!0,rm,D,A,U);for(G=0,K=I.length;G<K;G++)for(k=I[G],Y=0,re=k.length;Y<re;Y++)U=Y===0,O===2&&(U=!1),U&&rm++,rv(k[Y],!1,rm,D,R,U);return D})(n,a,h,f,i);if(u=(function(w,I,A,R,O){let D=null;return(A[0]>R[2]||R[0]>A[2]||A[1]>R[3]||R[1]>A[3])&&(O===0?D=nm:O===2?D=w:(O===1||O===3)&&(D=w.concat(I))),D})(n,a,h,f,i),u)return u===nm?null:u;const g=(function(w,I,A,R,O,D){const k=new K_(DT),U=[],G=Math.min(R[2],O[2]);let K,Y,re;for(;w.length!==0;){let oe=w.pop();if(U.push(oe),D===0&&oe.point[0]>G||D===2&&oe.point[0]>R[2])break;if(oe.left){Y=K=k.insert(oe),re=k.minNode(),K=K!==re?k.prev(K):null,Y=k.next(Y);const ie=K?K.key:null;let ce;if(Fd(oe,ie,D),Y&&rg(oe,Y.key,w)===2&&(Fd(oe,ie,D),Fd(Y.key,oe,D)),K&&rg(K.key,oe,w)===2){let de=K;de=de!==re?k.prev(de):null,ce=de?de.key:null,Fd(ie,ce,D),Fd(oe,ie,D)}}else oe=oe.otherEvent,Y=K=k.find(oe),K&&Y&&(K=K!==re?k.prev(K):null,Y=k.next(Y),k.remove(oe),Y&&K&&rg(K.key,Y.key,w))}return U})(_,0,0,h,f,i),v=(function(w){let I,A;const R=(function(k){let U,G,K,Y,re;const oe=[];for(G=0,K=k.length;G<K;G++)U=k[G],(U.left&&U.inResult||!U.left&&U.otherEvent.inResult)&&oe.push(U);let ie=!1;for(;!ie;)for(ie=!0,G=0,K=oe.length;G<K;G++)G+1<K&&vl(oe[G],oe[G+1])===1&&(Y=oe[G],oe[G]=oe[G+1],oe[G+1]=Y,ie=!1);for(G=0,K=oe.length;G<K;G++)U=oe[G],U.otherPos=G;for(G=0,K=oe.length;G<K;G++)U=oe[G],U.left||(re=U.otherPos,U.otherPos=U.otherEvent.otherPos,U.otherEvent.otherPos=re);return oe})(w),O={},D=[];for(I=0,A=R.length;I<A;I++){if(O[I])continue;
7const k=D.length,U=FT(R[I],D,k),G=re=>{O[re]=!0,re<R.length&&R[re]&&(R[re].outputContourId=k)};let K=I,Y=I;for(U.points.push(R[I].point);G(K),K=R[K].otherPos,G(K),U.points.push(R[K].point),K=OT(K,R,O,Y),!(K==Y||K>=R.length)&&R[K];);D.push(U)}return D})(g),b=[];for(let w=0;w<v.length;w++){let I=v[w];if(I.isExterior()){let A=[I.points];for(let R=0;R<I.holeIds.length;R++)A.push(v[I.holeIds[R]].points);b.push(A)}}return b}function om(r,e,i,n){const a=[],u=n===0?(h,f,_,g,v,b)=>{h.push(new Ke(b,_+(b-f)/(g-f)*(v-_)))}:(h,f,_,g,v,b)=>{h.push(new Ke(f+(b-_)/(v-_)*(g-f),b))};for(const h of r){const f=[];for(const _ of h){if(_.length<=2)continue;const g=[];for(let w=0;w<_.length-1;w++){const I=_[w].x,A=_[w].y,R=_[w+1].x,O=_[w+1].y,D=n===0?I:A,k=n===0?R:O;D<e?k>e&&u(g,I,A,R,O,e):D>i?k<i&&u(g,I,A,R,O,i):g.push(_[w]),k<e&&D>=e&&u(g,I,A,R,O,e),k>i&&D<=i&&u(g,I,A,R,O,i)}let v=_[_.length-1];const b=n===0?v.x:v.y;b>=e&&b<=i&&g.push(v),g.length&&(v=g[g.length-1],g[0].x===v.x&&g[0].y===v.y||g.push(g[0]),f.push(g))}f.length&&a.push(f)}return a}function kT(r,e){const i=nv(ng(r),ng([e]),0);return i==null?[]:ov(i)}function BT(r,e){let n=ng(r,65536);const a=[];for(;e.valid();e.next()){const[u,h]=e.get(),f=u.x*65536,_=u.y*65536,g=h.x*65536,v=h.y*65536,b=g-f,w=v-_,I=Math.hypot(b,w);if(I===0)continue;const A=Math.trunc(w/I*3),R=-Math.trunc(b/I*3);a.push([[[f,_],[g,v],[g+A,v+R],[f+A,_+R],[f,_]]])}return a.length>0&&(n=nv(n,a,2)),ov(n,1/65536,128)}function ng(r,e=1){return[r.map(i=>i.map(n=>[n.x*e,n.y*e]))]}function ov(r,e=1,i){return r.map(n=>n.map((a,u)=>{const h=a.map(f=>{let _=f[0],g=f[1];return i&&(_=Math.round(_/i)*i,g=Math.round(g/i)*i),new Ke(_*e,g*e)._round()});return u>0&&h.reverse(),h}))}class og{constructor(e,i){this.layoutVertexArray=new Ys,this.indexArray=new Mr,this.lineIndexArray=new ro,this.triangleSegments=new Hi,this.lineSegments=new Hi,this.programConfigurations=new E(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new Gr)}update(e,i,n,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,_)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_T.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,gT.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,n,a,u,h,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,a,u,h,void 0,f)}}class sg{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new og(e,!1),this.elevationBufferData=new og(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){this.hasPattern=X_("fill",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:f,id:_,index:g,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,w=Ht(f,b);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),w,n))continue;const I=u?u.evaluate(w,{},n,i.availableImages):void 0,A={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:g,geometry:b?w.geometry:Ot(f,n,a),patterns:{},sortKey:I};h.push(A)}u&&h.sort((f,_)=>f.sortKey-_.sortKey);for(const f of h){const{geometry:_,index:g,sourceLayerIndex:v}=f;if(this.hasPattern){const b=Y_("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,_,g,n,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[g].feature,_,g,v,this.index)}}update(e,i,n,a,u,h,f){this.bufferData.update(e,i,n,a,u,h,f,this.worldview),this.elevationBufferData.update(e,i,n,a,u,h,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,n,a,u,h,f,this.worldview)}addFeatures(e,i,n,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,n,a,h,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}
7addFeature(e,i,n,a,u,h=[],f,_){const g=zd(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,a,n,_):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,n,u,h,a,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,n,u,h,a,f,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,i,n,a,u){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,n,a,u,this.worldview))}addElevatedRoadFeature(e,i,n,a,u){const h=new Array,f=vn.getElevationFeature(e,u);if(!f)return void this.addGeometry(i,this.bufferData);{const g=this.clipPolygonsToTile(i,1);g.length>0&&h.push({polygons:g,elevationFeature:f,elevationTileID:n})}const _={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},n),featureIndex:a};for(const g of h)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new ao(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;e.properties.hasOwnProperty(qt)&&(w=+e.properties[qt]),this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,g.polygons,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new To(n,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,_)}}addElevatedGeometry(e,i,n,a,u,h){const f={elevation:n,elevationSampler:i,bias:a,index:u,featureInfo:h},[_,g]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:_,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,_),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,n){let a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,h=null;n&&(h=n.elevationSampler.constantElevation(n.elevation,n.bias),h!=null&&(a=h,u=h));const f=(_,g,v)=>{if(n!=null)if(g.push(_),h!=null)i.elevatedLayoutVertexArray.emplaceBack(h),v.push(h);else{const b=n.elevationSampler.pointElevation(_,n.elevation,n.bias);i.elevatedLayoutVertexArray.emplaceBack(b),v.push(b),a=Math.min(a,b),u=Math.max(u,b)}};for(const _ of e){let g=0;for(const U of _)g+=U.length;const v=i.triangleSegments.prepareSegment(g,i.layoutVertexArray,i.indexArray),b=v.vertexLength,w=[],I=[],A=[],R=[],O=[],D=i.layoutVertexArray.length;for(const U of _){if(U.length===0)continue;U!==_[0]&&I.push(w.length/2);const G=i.lineSegments.prepareSegment(U.length,i.layoutVertexArray,i.lineIndexArray),K=G.vertexLength;n&&O.push(i.layoutVertexArray.length-D),f(U[0],A,R),i.layoutVertexArray.emplaceBack(U[0].x,U[0].y),i.lineIndexArray.emplaceBack(K+U.length-1,K),w.push(U[0].x),w.push(U[0].y);for(let Y=1;Y<U.length;Y++)f(U[Y],A,R),i.layoutVertexArray.emplaceBack(U[Y].x,U[Y].y),i.lineIndexArray.emplaceBack(K+Y-1,K+Y),w.push(U[Y].x),w.push(U[Y].y);G.vertexLength+=U.length,G.primitiveLength+=U.length}const k=Lu(w,I);for(let U=0;U<k.length;U+=3)i.indexArray.emplaceBack(b+k[U],b+k[U+1],b+k[U+2]);if(k.length>0&&n&&this.elevationMode==="hd-road-base"){const U=n.elevation.isTunnel(),G=n.elevation.safeArea,K=this.elevatedStructures.addVertices(A,R);this.elevatedStructures.addTriangles(k,K,U);const Y=O.length;if(Y>0){for(let re=0;re<Y-1;re++)this.elevatedStructures.addRenderableRing(n.index,O[re]+K,O[re+1]-O[re],U,G,n.featureInfo);this.elevatedStructures.addRenderableRing(n.index,O[Y-1]+K,A.length-O[Y-1],U,G,n.featureInfo)}}v.vertexLength+=g,v.primitiveLength+=k.length/3}return[a,u]}prepareElevatedPolygons(e,i,n){const a=1/et(n),u=[];for(const h of e){const f=BT(h,new Un(i,a));u.push(...f)}return u}clipPolygonsToTile(e,i){const n=-i,a=-i,u=lt+i,h=lt+i;let f=0;const _=[],g=[];for(;f<e.length;f++){const w=e[f],I=Zl(w);(I.min.x>=n&&I.max.x<=u&&I.min.y>=a&&I.max.y<=h?_:g).push(w)}if(_.length===e.length)return e;const v=[new Ke(n,a),new Ke(u,a),new Ke(u,h),new Ke(n,h),new Ke(n,a)],b=_;for(const w of g)b.push(...kT(w,v));return b}}let sv,av,lv,cv;vt(sg,"FillBucket",{omit:["layers","patternFeatures"]}),vt(og,"FillBufferData"),vt(ao,"ElevatedStructures");class sm{constructor(e,i,n,a){if(this.triangleCount=i.length/3,this.min=new Ke(0,0),this.max=new Ke(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[u,h]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const w=e[b];u.x=Math.min(u.x,w.x),u.y=Math.min(u.y,w.y),h.x=Math.max(h.x,w.x),h.y=Math.max(h.y,w.y)}
vendor: 39,048 bytes, line 7
7if(a){const b=Math.ceil(Math.max(h.x-u.x,h.y-u.y)/a);n=Math.max(n,b)}if(n===0)return;this.min=u,this.max=h;const f=this.max.sub(this.min);f.x=Math.max(f.x,1),f.y=Math.max(f.y,1);const _=Math.max(f.x,f.y)/n;this.cellsX=Math.max(1,Math.ceil(f.x/_)),this.cellsY=Math.max(1,Math.ceil(f.y/_)),this.xScale=1/_,this.yScale=1/_;const g=[];for(let b=0;b<this.triangleCount;b++){const w=e[i[3*b+0]].sub(this.min),I=e[i[3*b+1]].sub(this.min),A=e[i[3*b+2]].sub(this.min),R=ea(Math.floor(Math.min(w.x,I.x,A.x)),this.xScale,this.cellsX),O=ea(Math.floor(Math.max(w.x,I.x,A.x)),this.xScale,this.cellsX),D=ea(Math.floor(Math.min(w.y,I.y,A.y)),this.yScale,this.cellsY),k=ea(Math.floor(Math.max(w.y,I.y,A.y)),this.yScale,this.cellsY),U=new Ke(0,0),G=new Ke(0,0),K=new Ke(0,0),Y=new Ke(0,0);for(let re=D;re<=k;++re){U.y=G.y=re*_,K.y=Y.y=(re+1)*_;for(let oe=R;oe<=O;++oe)U.x=K.x=oe*_,G.x=Y.x=(oe+1)*_,(gs(w,I,A,U,G,Y)||gs(w,I,A,U,Y,K))&&g.push({cellIdx:re*this.cellsX+oe,triIdx:b})}}if(g.length===0)return;g.sort((b,w)=>b.cellIdx-w.cellIdx||b.triIdx-w.triIdx);let v=0;for(;v<g.length;){const b=g[v].cellIdx,w={start:this.payload.length,len:0};for(;v<g.length&&g[v].cellIdx===b;)++w.len,this.payload.push(g[v++].triIdx);this.cells[b]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const n=ea(e.x-this.min.x,this.xScale,this.cellsX),a=ea(e.y-this.min.y,this.yScale,this.cellsY),u=this.cells[a*this.cellsX+n];if(u){this._lazyInitLookup();for(let h=0;h<u.len;h++){const f=this.payload[u.start+h],_=Math.floor(f/8),g=1<<f%8;if(!(this.lookup[_]&g)&&(this.lookup[_]|=g,i.push(f),i.length===this.triangleCount))return}}}query(e,i,n){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=ea(e.x-this.min.x,this.xScale,this.cellsX),u=ea(i.x-this.min.x,this.xScale,this.cellsX),h=ea(e.y-this.min.y,this.yScale,this.cellsY),f=ea(i.y-this.min.y,this.yScale,this.cellsY);for(let _=h;_<=f;_++)for(let g=a;g<=u;g++){const v=this.cells[_*this.cellsX+g];if(v)for(let b=0;b<v.len;b++){const w=this.payload[v.start+b],I=Math.floor(w/8),A=1<<w%8;if(!(this.lookup[I]&A)&&(this.lookup[I]|=A,n.push(w),n.length===this.triangleCount))return}}}}function ea(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}vt(sm,"TriangleGridIndex");class uv{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){for(const n of this.footprints)i.push({footprint:n,id:e})}updateAppearances(e,i,n,a){}populate(e,i,n,a){const u=[];for(const{feature:h,id:f,index:_,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,b=Ht(h,v);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),b,n))continue;const w={id:f,properties:h.properties,type:h.type,sourceLayerIndex:g,index:_,geometry:v?b.geometry:Ot(h,n,a),patterns:{}};u.push(w)}for(const h of u){const{geometry:f,index:_,sourceLayerIndex:g}=h;this.addFeature(h,f,_,n,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,f,_,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,n,a,u,h,f){}destroy(){}addFeature(e,i,n,a,u,h=[],f){for(const _ of zd(i,2)){const g=[],v=[],b=[],w=new Ke(1/0,1/0),I=new Ke(-1/0,-1/0);for(const O of _)if(O.length!==0){O!==_[0]&&b.push(v.length/2);for(let D=0;D<O.length;D++)v.push(O[D].x),v.push(O[D].y),g.push(O[D]),w.x=Math.min(w.x,O[D].x),w.y=Math.min(w.y,O[D].y),I.x=Math.max(I.x,O[D].x),I.y=Math.max(I.y,O[D].y)}const A=Lu(v,b),R=new sm(g,A,8,256);this.footprints.push({vertices:g,indices:A,grid:R,min:w,max:I})}}}vt(uv,"ClipBucket",{omit:["layers"]});const NT=ei([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),VT=ei([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),UT=ei([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),jT=ei([{name:"a_centroid_pos",components:2,type:"Uint16"}]),GT=ei([{name:"a_join_normal_inside",components:3,type:"Int16"}]),qT=ei([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),$T=ei([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:HT}=NT,kd=Number.MAX_SAFE_INTEGER,ZT=kd-1;function hv(r,e,i,n){return r.order<e||r.order===kd||!(r.clipMask&i)||(function(a,u){return u.length!==0&&u.find(h=>h===a)===void 0})(n,r.clipScope)}function am(r,e){return r.x-e.x||r.y-e.y}function dv(r,e){return am(r.min,e.min)===0&&am(r.max,e.max)===0}function ag(r,e){return!(r.min.x>e.max.x||r.max.x<e.min.x||r.min.y>e.max.y||r.max.y<e.min.y)}function lm(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!dv(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!os(r[i].clipScope,e[i].clipScope))return!1;return!0}function fv(r,e,i){const n=1/lt,a=1/(1<<i.canonical.z),u=(e.x*n+i.canonical.x)*a+i.wrap,h=(e.y*n+i.canonical.y)*a;return{min:new Ke((r.x*n+i.canonical.x)*a+i.wrap,(r.y*n+i.canonical.y)*a),max:new Ke(u,h)}}function WT(r,e,i){const n=1<<i.canonical.z,a=((e.x-i.wrap)*n-i.canonical.x)*lt,u=(e.y*n-i.canonical.y)*lt;return{min:new Ke(((r.x-i.wrap)*n-i.canonical.x)*lt,(r.y*n-i.canonical.y)*lt),max:new Ke(a,u)}}function lg(r,e,i,n,a,u,h){const f=r.indices,_=r.vertices,g=[];for(let v=n;v<n+a;v+=3){const b=e[i[v+0]+u],w=e[i[v+1]+u],I=e[i[v+2]+u],A=Math.min(b.x,w.x,I.x),R=Math.max(b.x,w.x,I.x),O=Math.min(b.y,w.y,I.y),D=Math.max(b.y,w.y,I.y);g.length=0,r.grid.query(new Ke(A,O),new Ke(R,D),g);for(let k=0;k<g.length;k++){const U=g[k];if(gs(_[f[3*U+0]],_[f[3*U+1]],_[f[3*U+2]],b,w,I,h))return!0}}return!1}function pv(r,e,i,n){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(i.vertices.length<r.vertices.length)return pv(i,n,r,e);const u=e.canonical,h=n.canonical,f=Math.pow(2,h.z-u.z);a=r.vertices.map(_=>new Ke((_.x+u.x*lt)*f-h.x*lt,(_.y+u.y*lt)*f-h.y*lt))}return lg(i,a,r.indices,0,r.indices.length,0,0)}function mv(r,e,i,n){const a=Math.pow(2,n.z-i.z);return new Ke((r+i.x*lt)*a-n.x*lt,(e+i.y*lt)*a-n.y*lt)}function _v(r,e){const i=[];e.grid.queryPoint(r,i);const n=e.indices,a=e.vertices;for(let u=0;u<i.length;u++){const h=i[u];if(Gn([a[n[3*h+0]],a[n[3*h+1]],a[n[3*h+2]]],r))return!0}return!1}const cg=[new Ke(0,0),new Ke(lt,0),new Ke(lt,lt),new Ke(0,lt)];function gv(r,e){const i=[];let n=[];if(!e||r.length<2)return[r];if(r.length===2)return Ho(r[0],r[1],cg)?[r]:[];for(let a=0;a<r.length+2;a++){const u=r[a%r.length],h=r[(a+1)%r.length],f=Ho(a===0?r[r.length-1]:r[(a-1)%r.length],u,cg),_=Ho(u,h,cg),g=f||_;g&&n.push(u),g&&_||n.length>0&&(n.length>1&&i.push(n),n=[])}return n.length>1&&i.push(n),i}const ug=ti.types,XT=["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"],YT=["fill-extrusion-flood-light-ground-radius"],KT=Math.pow(2,13),JT=Math.pow(2,15)-1,yv=new Ke(0,1),Pa=2147483648;function Bd(r,e,i,n,a,u,h,f){r.emplaceBack((e<<1)+h,(i<<1)+u,(Math.floor(n*KT)<<1)+a,Math.round(f))}function Nd(r,e,i){r.emplaceBack(e.x*lt,e.y*lt,i?1:0)}function cm(r,e,i,n,a,u){r.emplaceBack(e.x,e.y,(i.x<<1)+n,(i.y<<1)+a,u)}function Vd(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class xv{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class vv{constructor(){this.centroidXY=new Ke(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 Ke(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ke(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Ke(this.max.x-this.min.x,this.max.y-this.min.y)}}class bv{constructor(){this.acc=new Ke(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,n){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),((i.x===0||i.x===lt)&&i.x===n.x)!=((i.y===0||i.y===lt)&&i.y===n.y)&&this.processBorderOverlap(i,n),a&&this.checkBorderIntersection(i,n)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Dt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>lt!=e.x>lt&&this.addBorderIntersection(1,Dt(i.y,e.y,(lt-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Dt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>lt!=e.y>lt&&this.addBorderIntersection(3,Dt(i.x,e.x,(lt-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]]);const n=this.borders[e];i<n[0]&&(n[0]=i),i>n[1]&&(n[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,i.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,i.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new Ke(0,0):new Ke(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 wv(r,e){const i=r.add(e)._unit(),n=te(r.x*i.x+r.y*i.y,-1,1);var a,u,h;return h=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(h)))/4*JT*((a=r).x*(u=e).y-a.y*u.x<0?-1:1)}const QT=[r=>r.x<0,r=>r.x>lt,r=>r.y<0,r=>r.y>lt];function eE(r,e,i,n){const a=[4];if(n===0)return a;i._mult(n);const u=r.sub(i),h=e.sub(i),f=[r,e,u,h];for(let _=0;_<4;_++)for(const g of f)if(QT[_](g)){a.push(_);break}return a}class hg{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new gd,this.indexArray=new Mr,this.programConfigurations=new E(e.layers,{zoom:e.zoom,lut:e.lut},i=>YT.includes(i)),this._segments=new Hi,this.hiddenByLandmarkVertexArray=new Mu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Hi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,n,a=!1){const u=e.length;if(u>2){let h=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*u,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let _;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const g=e[0],v=e[1];_=wv(g.sub(e[u-1])._perp()._unit(),v.sub(g)._perp()._unit())}for(let g=0;g<u;g++){const v=g===u-1?0:g+1,b=e[g],w=e[v],I=e[v===u-1?0:v+1],A=w.sub(b)._perp()._unit(),R=wv(A,I.sub(w)._perp()._unit()),O=_,D=R;if(dg(b,w,i)||a&&Sv(b,i)&&Sv(w,i)){_=R;continue}const k=f.vertexLength;cm(this.vertexArray,b,w,1,1,O),cm(this.vertexArray,b,w,1,0,O),cm(this.vertexArray,b,w,0,1,D),cm(this.vertexArray,b,w,0,0,D),f.vertexLength+=4;const U=eE(b,w,A,n);for(const G of U)this._segmentToGroundQuads[h].push({id:k,region:G}),this._segmentToRegionTriCounts[h][G]+=2,f.primitiveLength+=2;_=R}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let n=0;n<i;n++)this._segmentToGroundQuads[n].sort((a,u)=>a.region-u.region);for(let n=0;n<i;n++){const a=this._segmentToGroundQuads[n],u=e[n],h=this._segmentToRegionTriCounts[n];h.reduce((_,g)=>_+g,0);let f=0;for(let _=0;_<=4;_++){const g=h[_];if(g!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new Hi);const b={vertexOffset:u.vertexOffset,primitiveOffset:u.primitiveOffset+f,vertexLength:u.vertexLength,primitiveLength:g};v.get().push(b)}f+=g}for(let _=0;_<a.length;_++){const g=a[_].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,n,a,u,h,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,n,a,u,h,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,VT.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,UT.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,n,a,u,h,f,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,n,a,u,h,f,_)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Pa))}updateHiddenByLandmarkRange(e,i,n){if(!this.hasData())return;const a=i+e;if(i!==0){for(let u=e;u<a;++u)this.hiddenByLandmarkVertexArray.emplace(u,n?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,qT.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class um{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.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 Mr,this.footprintVertices=new Ys,this.footprintSegments=[],this.layoutVertexArray=new _s,this.centroidVertexArray=new Vp,this.wallVertexArray=new Up,this.indexArray=new Mr,this.programConfigurations=new E(e.layers,{zoom:e.zoom,lut:e.lut},i=>XT.includes(i)),this.segments=new Hi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new hg(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){this.features=[],this.hasPattern=X_("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=et(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:u,id:h,index:f,sourceLayerIndex:_}of e){const g=this.layers[0]._featureFilter.needGeometry,v=Ht(u,g);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),v,n))continue;const b={id:h,sourceLayerIndex:_,index:f,geometry:g?v.geometry:Ot(u,n,a),properties:u.properties,type:u.type,patterns:{}},w=this.layoutVertexArray.length,I=ug[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:u.id,feature:Y_("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const A of b.geometry)for(const R of gv(A,I))this.addFeature(u.id,b,[R],f,n,{},i.availableImages,a,i.brightness);else this.addFeature(u.id,b,b.geometry,f,n,{},i.availableImages,a,i.brightness);i.featureIndex.insert(u,b.geometry,f,_,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,n,a,u,h){for(const{featureId:f,feature:_}of this.features){const g=ug[_.type]==="Polygon",{geometry:v}=_;if(this.wallMode)for(const b of v)for(const w of gv(b,g))this.addFeature(f,_,[w],_.index,i,n,a,u,h);else this.addFeature(f,_,v,_.index,i,n,a,u,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,n,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,this.worldview),this.groundEffect.update(e,i,u,n,a,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,HT),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,GT.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,$T.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,jT.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,n,a,u,h,f,_,g){const v=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,b=[new Ke(0,0),new Ke(lt,lt)],w=_.projection,I=w.name==="globe",A=this.wallMode||ug[i.type]==="Polygon",R=new bv;R.centroidDataIndex=this.centroidData.length;const O=new vv;O.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(O.buildingId=Number(i.properties.building_id));const D=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},u)<=0,k=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},u);let U;if(O.height=k,O.vertexArrayOffset=this.layoutVertexArray.length,O.groundVertexArrayOffset=this.groundEffect.vertexArray.length,I&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new fl),this.wallMode){if(I)return void Ft("Non zero fill-extrusion-line-width is not yet supported on globe.");if(n.length!==1)return;U=(function(ce){const de=ce[0].x===ce[ce.length-1].x&&ce[0].y===ce[ce.length-1].y;(function(st){let ct=0;const Rt=st.length;for(let St=0;St<Rt;St++)ct+=(st[(St+1)%Rt].x-st[St].x)*(st[(St+1)%Rt].y+st[St].y);return ct>=0})(ce)||(ce=ce.reverse());const Ce={geometry:[],joinNormals:[],indices:[]},Le=[],Ue=[],Ne=[];let Ve=ce.length;for(;Ve>=2&&ce[Ve-1].equals(ce[Ve-2]);)Ve--;if(Ve<(de?3:2))return Ce;let Se,Ge,Oe,qe,je,mt=0;for(;mt<Ve-1&&ce[mt].equals(ce[mt+1]);)mt++;de&&(Se=ce[Ve-2],je=ce[mt].sub(Se)._unit()._perp());for(let st=mt;st<Ve;st++){if(Oe=st===Ve-1?de?ce[mt+1]:void 0:ce[st+1],Oe&&ce[st].equals(Oe))continue;je&&(qe=je),Se&&(Ge=Se),Se=ce[st],je=Oe?Oe.sub(Se)._unit()._perp():qe,qe=qe||je;let ct=qe.add(je);ct.x===0&&ct.y===0||ct._unit();const Rt=ct.x*je.x+ct.y*je.y,St=Rt!==0?1/Rt:1/0,ft=qe.x*je.y-qe.y*je.x>0;let Bt="miter";const Jt=2;Bt==="miter"&&St>Jt&&(Bt="bevel"),Bt==="bevel"&&(St>100&&(Bt="flipbevel"),St<Jt&&(Bt="miter"));const pi=(Yt,Mi,ai,ur)=>{const hi=new Ke(Yt.x,Yt.y),Ei=new Ke(Yt.x,Yt.y);hi.x+=Mi.x*ur,hi.y+=Mi.y*ur,Ei.x-=Mi.x*Math.max(ai,1),Ei.y-=Mi.y*Math.max(ai,1),Ne.push(Mi),Le.push(hi),Ue.push(Ei)};if(Bt==="miter")ct._mult(St),pi(Se,ct,0,0);else if(Bt==="flipbevel")ct=je.mult(-1),pi(Se,ct,0,0),pi(Se,ct.mult(-1),0,0);else{const Yt=-Math.sqrt(St*St-1),Mi=ft?Yt:0,ai=ft?0:Yt;Ge&&pi(Se,qe,Mi,ai),Oe&&pi(Se,je,Mi,ai)}}Ce.geometry=[...Le,...Ue.reverse(),Le[0]],Ce.joinNormals=[...Ne,...Ne.reverse(),Ne[Ne.length-1]];const _t=Ce.geometry.length-1;for(let st=0;st<_t/2;st++)if(st+1<_t/2){let ct=st,Rt=st+1,St=_t-1-st,ft=_t-2-st;ct=ct===0?_t-1:ct-1,Rt=Rt===0?_t-1:Rt-1,St=St===0?_t-1:St-1,ft=ft===0?_t-1:ft-1,Ce.indices.push(St),Ce.indices.push(Rt),Ce.indices.push(ct),Ce.indices.push(St),Ce.indices.push(ft),Ce.indices.push(Rt)}return Ce})(n[0]),n=[U.geometry]}const G=(ce,de)=>ce<(de.length-1)/2||ce===de.length-1,K=this.wallMode?[n]:zd(n,500);for(let ce=K.length-1;ce>=0;ce--){const de=K[ce];(de.length===0||iE(de[0]))&&K.splice(ce,1)}let Y;if(I)Y=Cv(K,b,u);else{Y=[];for(const ce of K)Y.push({polygon:ce,bounds:b})}const re=A?this.edgeRadius:0,oe=re>0&&this.zoom<17,ie=(ce,de)=>{if(ce.length===0)return!1;const De=ce[ce.length-1];return de.x===De.x&&de.y===De.y};for(const{polygon:ce,bounds:de}of Y){let De=0,Ce=0;for(const Ve of ce)A&&!Ve[0].equals(Ve[Ve.length-1])&&Ve.push(Ve[0]),Ce+=A?Ve.length-1:Ve.length;const Le=this.segments.prepareSegment((A?5:4)*Ce,this.layoutVertexArray,this.indexArray);O.footprintSegIdx<0&&(O.footprintSegIdx=this.footprintSegments.length),O.polygonSegIdx<0&&(O.polygonSegIdx=this.polygonSegments.length);const Ue={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Ne=new xv;if(Ne.vertexOffset=this.footprintVertices.length,Ne.indexOffset=3*this.footprintIndices.length,Ne.ringIndices=[],A){const Ve=[],Se=[];De=Le.vertexLength;for(let Oe=0;Oe<ce.length;Oe++){const qe=ce[Oe];qe.length&&Oe!==0&&Se.push(Ve.length/2);const je=[];let mt,_t;mt=qe[1].sub(qe[0])._perp()._unit(),Ne.ringIndices.push(qe.length-1);for(let st=1;st<qe.length;st++){const ct=qe[st],Rt=qe[st===qe.length-1?1:st+1],St=ct.clone();if(re){_t=Rt.sub(ct)._perp()._unit();const ft=mt.add(_t)._unit(),Bt=re*Math.min(4,1/(mt.x*ft.x+mt.y*ft.y));St.x+=Bt*ft.x,St.y+=Bt*ft.y,St.x=Math.round(St.x),St.y=Math.round(St.y),mt=_t}if(!D||re!==0&&!oe||ie(je,St)||je.push(St),Bd(this.layoutVertexArray,St.x,St.y,0,0,1,1,0),this.wallMode){const ft=G(st,qe);Nd(this.wallVertexArray,U.joinNormals[st],!ft)}Le.vertexLength++,this.footprintVertices.emplaceBack(ct.x,ct.y),Ve.push(ct.x,ct.y),I&&Vd(this.layoutVertexExtArray,w.projectTilePoint(St.x,St.y,u),w.upVector(u,St.x,St.y))}D&&(re===0||oe)&&(je.length!==0&&ie(je,je[0])&&je.pop(),this.groundEffect.addData(je,de,v))}const Ge=this.wallMode?U.indices:Lu(Ve,Se);for(let Oe=0;Oe<Ge.length;Oe+=3)this.footprintIndices.emplaceBack(Ne.vertexOffset+Ge[Oe+0],Ne.vertexOffset+Ge[Oe+1],Ne.vertexOffset+Ge[Oe+2]),this.indexArray.emplaceBack(De+Ge[Oe],De+Ge[Oe+2],De+Ge[Oe+1]),Le.primitiveLength++;Ne.indexCount+=Ge.length,Ne.vertexCount+=this.footprintVertices.length-Ne.vertexOffset}for(let Ve=0;Ve<ce.length;Ve++){const Se=ce[Ve];R.startRing(O,Se[0]);let Ge=Se.length>4&&Iv(Se[Se.length-2],Se[0],Se[1]),Oe=re?tE(Se[Se.length-2],Se[0],Se[1],re):0;const qe=[];let je,mt,_t;mt=Se[1].sub(Se[0])._perp()._unit();let st=!0;for(let ct=1,Rt=0;ct<Se.length;ct++){let St=Se[ct-1],ft=Se[ct];const Bt=Se[ct===Se.length-1?1:ct+1];if(R.appendEdge(O,ft,St),dg(ft,St,de)){re&&(mt=Bt.sub(ft)._perp()._unit(),st=!st);continue}const Jt=ft.sub(St)._perp(),pi=Jt.x/(Math.abs(Jt.x)+Math.abs(Jt.y)),Yt=Jt.y>0?1:0,Mi=St.dist(ft);if(Rt+Mi>32768&&(Rt=0),re){_t=Bt.sub(ft)._perp()._unit();let Ei=Ev(St,ft,Bt,Tv(mt,_t),re);isNaN(Ei)&&(Ei=0);const Gi=ft.sub(St)._unit();St=St.add(Gi.mult(Oe))._round(),ft=ft.add(Gi.mult(-Ei))._round(),Oe=Ei,mt=_t,D&&this.zoom>=17&&(ie(qe,St)||qe.push(St),ie(qe,ft)||qe.push(ft))}const ai=Le.vertexLength,ur=Se.length>4&&Iv(St,ft,Bt);let hi=Av(Rt,Ge,st);if(Bd(this.layoutVertexArray,St.x,St.y,pi,Yt,0,0,hi),Bd(this.layoutVertexArray,St.x,St.y,pi,Yt,0,1,hi),this.wallMode){const Ei=G(ct-1,Se),Gi=U.joinNormals[ct-1];Nd(this.wallVertexArray,Gi,Ei),Nd(this.wallVertexArray,Gi,Ei)}if(Rt+=Mi,hi=Av(Rt,ur,!st),Ge=ur,Bd(this.layoutVertexArray,ft.x,ft.y,pi,Yt,0,0,hi),Bd(this.layoutVertexArray,ft.x,ft.y,pi,Yt,0,1,hi),this.wallMode){const Ei=G(ct,Se),Gi=U.joinNormals[ct];Nd(this.wallVertexArray,Gi,Ei),Nd(this.wallVertexArray,Gi,Ei)}if(Le.vertexLength+=4,this.indexArray.emplaceBack(ai+0,ai+1,ai+2),this.indexArray.emplaceBack(ai+1,ai+3,ai+2),Le.primitiveLength+=2,re){const Ei=De+(ct===1?Se.length-2:ct-2),Gi=ct===1?De:Ei+1;if(this.indexArray.emplaceBack(ai+1,Ei,ai+3),this.indexArray.emplaceBack(Ei,Gi,ai+3),Le.primitiveLength+=2,je===void 0&&(je=ai),!dg(Bt,Se[ct],de)){const Ji=ct===Se.length-1?je:Le.vertexLength;this.indexArray.emplaceBack(ai+2,ai+3,Ji),this.indexArray.emplaceBack(ai+3,Ji+1,Ji),this.indexArray.emplaceBack(ai+3,Gi,Ji+1),Le.primitiveLength+=3}st=!st}if(I){const Ei=this.layoutVertexExtArray,Gi=w.projectTilePoint(St.x,St.y,u),Ji=w.projectTilePoint(ft.x,ft.y,u),Qi=w.upVector(u,St.x,St.y),hr=w.upVector(u,ft.x,ft.y);Vd(Ei,Gi,Qi),Vd(Ei,Gi,Qi),Vd(Ei,Ji,hr),Vd(Ei,Ji,hr)}}A&&(De+=Se.length-1),D&&re&&this.zoom>=17&&(qe.length!==0&&ie(qe,qe[0])&&qe.pop(),this.groundEffect.addData(qe,de,v,re>0))}this.footprintSegments.push(Ne),Ue.triangleCount=this.indexArray.length-Ue.triangleArrayOffset,this.polygonSegments.push(Ue),++O.footprintSegLen,++O.polygonSegLen}if(O.vertexCount=this.layoutVertexArray.length-O.vertexArrayOffset,O.groundVertexCount=this.groundEffect.vertexArray.length-O.groundVertexArrayOffset,O.vertexCount!==0){if(O.centroidXY=R.borders?yv:this.encodeCentroid(R,O),this.centroidData.push(O),R.borders){this.featuresOnBorder.push(R);const ce=this.featuresOnBorder.length-1;for(let de=0;de<R.borders.length;de++)R.borders[de][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[de].push(ce)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,h,f,u,g,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,a,h,f,u,g,this.worldview),this.maxHeight=Math.max(this.maxHeight,k)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,n)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const _=this.centroidData[f],g=+(_.min.y+_.max.y>lt),v=2*g+(+(_.min.x+_.max.x>lt)^g);for(let b=0;b<_.polygonSegLen;b++){const w=_.polygonSegIdx+b;e.push({centroidIdx:f,subtile:v,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Mr;e.sort((f,_)=>f.triangleSegmentIdx===_.triangleSegmentIdx?f.subtile-_.subtile:f.triangleSegmentIdx-_.triangleSegmentIdx);let n=0,a=0,u=0;for(const f of e){if(f.triangleSegmentIdx!==n)break;u++}const h=e.length;for(;a!==e.length;){n=e[a].triangleSegmentIdx;let f=0,_=a,g=a;for(let v=_;v<u&&e[v].subtile===f;v++)g++;for(;_!==u;){const v=e[_];f=v.subtile;const b=this.centroidData[v.centroidIdx].min.clone(),w=this.centroidData[v.centroidIdx].max.clone(),I={vertexOffset:this.segments.segments[n].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[n].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let A=_;A<g;A++){const R=e[A],O=this.polygonSegments[R.polygonSegmentIdx],D=this.centroidData[R.centroidIdx].min,k=this.centroidData[R.centroidIdx].max,U=this.indexArray.uint16;for(let G=O.triangleArrayOffset;G<O.triangleArrayOffset+O.triangleCount;G++)i.emplaceBack(U[3*G],U[3*G+1],U[3*G+2]);I.primitiveLength+=O.triangleCount,b.x=Math.min(b.x,D.x),b.y=Math.min(b.y,D.y),w.x=Math.max(w.x,k.x),w.y=Math.max(w.y,k.y)}I.primitiveLength>0&&this.triangleSubSegments.push({segment:I,min:b,max:w}),_=g;for(let A=_;A<u&&e[A].subtile===e[_].subtile;A++)g++}a=u;for(let v=a;v<h&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)u++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,n){const a=new Hi;if(this.wallMode){for(const R of this.triangleSubSegments)a.segments.push(R.segment);return a}let u=0,h=0;const f=1<<e.canonical.z;if(i){const R=i.getMinMaxForTile(e);R&&(u=R.min,h=R.max)}h+=this.maxHeight;const _=e.toUnwrapped();let g;const v=[_.canonical.x/f+_.wrap,_.canonical.y/f],b=[(_.canonical.x+1)/f+_.wrap,(_.canonical.y+1)/f],w=(R,O,D)=>[R[0]*(1-D[0])+O[0]*D[0],R[1]*(1-D[1])+O[1]*D[1]],I=[],A=[];for(const R of this.triangleSubSegments){I[0]=R.min.x/lt,I[1]=R.min.y/lt,A[0]=R.max.x/lt,A[1]=R.max.y/lt;const O=w(v,b,I),D=w(v,b,A);if(new gi([O[0],O[1],u],[D[0],D[1],h]).intersectsPrecise(n)===0){g&&(a.segments.push(g),g=void 0);continue}const k=R.segment;g&&g.vertexOffset!==k.vertexOffset&&(a.segments.push(g),g=void 0),g?(g.vertexLength+=k.vertexLength,g.primitiveLength+=k.primitiveLength):g={vertexOffset:k.vertexOffset,primitiveLength:k.primitiveLength,vertexLength:k.vertexLength,primitiveOffset:k.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&a.segments.push(g),a}encodeCentroid(e,i){const n=e.centroid(),a=i.span(),u=Math.min(7,Math.round(a.x*this.tileToMeter/10)),h=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new Ke(te(n.x,1,8191)<<3|u,te(n.y,1,8191)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new Ke(0,0);const i=e.borders,n=Number.MAX_VALUE;if(i[0][0]!==n||i[1][0]!==n){const a=i[0][0]!==n?0:1;return new Ke(6|(i[0][0]!==n?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==n?2:3;return new Ke((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==n?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=2147483647,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,a=e.flags&Pa?yv:e.centroidXY,u=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||u!==a.x){for(let h=i;h<n;++h)this.centroidVertexArray.emplace(h,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,n){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(lm(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const h of this.centroidData)h.flags&=2147483647;const u=[];for(const h of this.activeReplacements){if(h.order<n)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));if(h.footprint.buildingIds)for(const _ of this.centroidData)_.flags&Pa||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y||h.footprint.buildingIds.has(_.buildingId)&&(_.flags|=Pa);else for(const _ of this.centroidData)if(!(_.flags&Pa||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y))for(let g=0;g<_.footprintSegLen;g++){const v=this.footprintSegments[_.footprintSegIdx+g];if(u.length=0,rE(this.footprintVertices,v.vertexOffset,v.vertexCount,h.footprintTileId.canonical,e.canonical,u),lg(h.footprint,u,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,-f)){_.flags|=Pa;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,n){let a=!1;for(let u=0;u<n.footprintSegLen;u++){const h=this.footprintSegments[n.footprintSegIdx+u];let f=0;for(const _ of h.ringIndices){for(let g=f,v=_+f-1;g<_+f;v=g++){const b=this.footprintVertices.int16[2*(g+h.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+h.vertexOffset)+1],I=this.footprintVertices.int16[2*(v+h.vertexOffset)+1];w>i!=I>i&&e<(this.footprintVertices.int16[2*(v+h.vertexOffset)+0]-b)*(i-w)/(I-w)+b&&(a=!a)}f=_}}return a}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+lt)*lt+(i+lt);if(this.partLookup.hasOwnProperty(u)){const h=this.partLookup[u];return h?{height:h.height,hidden:!!(h.flags&Pa)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||h.height<=n||this.footprintContainsPoint(e,i,h)&&(n=h.height,this.partLookup[u]=h,a=!!(h.flags&Pa));if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:a};this.partLookup[u]=void 0}}function Tv(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function tE(r,e,i,n){const a=e.sub(r)._perp()._unit(),u=i.sub(e)._perp()._unit();return Ev(r,e,i,Tv(a,u),n)}function Ev(r,e,i,n,a){const u=Math.sqrt(1-n*n);return Math.min(r.dist(e)/3,e.dist(i)/3,a*u/n)}function dg(r,e,i){return r.x<i[0].x&&e.x<i[0].x||r.x>i[1].x&&e.x>i[1].x||r.y<i[0].y&&e.y<i[0].y||r.y>i[1].y&&e.y>i[1].y}function Sv(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function iE(r){return r.every(e=>e.x<=0)||r.every(e=>e.x>=lt)||r.every(e=>e.y<=0)||r.every(e=>e.y>=lt)}function Iv(r,e,i){if(r.x<0||r.x>=lt||e.x<0||e.x>=lt||i.x<0||i.x>=lt)return!1;const n=i.sub(e),a=n.perp(),u=r.sub(e);return(n.x*u.x+n.y*u.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(u.x*u.x+u.y*u.y))>-.866&&a.x*u.x+a.y*u.y<0}function Av(r,e,i){const n=e?2|r:-3&r;return i?1|n:-2&n}function Mv(){const r=Math.PI/32,e=Math.tan(r),i=se;return i*Math.sqrt(1+2*e*e)-i}function Cv(r,e,i){const n=1<<i.z,a=Fe(i.x/n),u=Fe((i.x+1)/n),h=$e(i.y/n),f=$e((i.y+1)/n);return(function(_,g,v,b,w=0,I){const A=[];if(!_.length||!v||!b)return A;const R=(Y,re)=>{for(const oe of Y)A.push({polygon:oe,bounds:re})},O=Math.ceil(Math.log2(v)),D=Math.ceil(Math.log2(b)),k=O-D,U=[];for(let Y=0;Y<Math.abs(k);Y++)U.push(k>0?0:1);for(let Y=0;Y<Math.min(O,D);Y++)U.push(0),U.push(1);let G=_;if(G=om(G,g[0].y-w,g[1].y+w,1),G=om(G,g[0].x-w,g[1].x+w,0),!G.length)return A;const K=[];for(U.length?K.push({polygons:G,bounds:g,depth:0}):R(G,g);K.length;){const Y=K.pop(),re=Y.depth,oe=U[re],ie=Y.bounds[0],ce=Y.bounds[1],de=oe===0?ie.x:ie.y,De=oe===0?ce.x:ce.y,Ce=I?I(oe,de,De):.5*(de+De),Le=om(Y.polygons,de-w,Ce+w,oe),Ue=om(Y.polygons,Ce-w,De+w,oe);if(Le.length){const Ne=[ie,new Ke(oe===0?Ce:ce.x,oe===1?Ce:ce.y)];U.length>re+1?K.push({polygons:Le,bounds:Ne,depth:re+1}):R(Le,Ne)}if(Ue.length){const Ne=[new Ke(oe===0?Ce:ie.x,oe===1?Ce:ie.y),ce];U.length>re+1?K.push({polygons:Ue,bounds:Ne,depth:re+1}):R(Ue,Ne)}}return A})(r,e,Math.ceil((u-a)/11.25),Math.ceil((h-f)/11.25),1,(_,g,v)=>{if(_===0)return .5*(g+v);{const b=$e((i.y+g/lt)/n);return(Ae(.5*($e((i.y+v/lt)/n)+b))*n-i.y)*lt}})}function rE(r,e,i,n,a,u){const h=Math.pow(2,n.z-a.z);for(let f=0;f<i;f++){let _=r.int16[2*(f+e)+0],g=r.int16[2*(f+e)+1];_=(_+a.x*lt)*h-n.x*lt,g=(g+a.y*lt)*h-n.y*lt,u.push(new Ke(_,g))}}let Pv,Rv;vt(um,"FillExtrusionBucket",{omit:["layers","features"]}),vt(vv,"PartData"),vt(xv,"FootprintSegment"),vt(bv,"BorderCentroidData"),vt(hg,"GroundEffect");class Ec extends Ke{constructor(e,i,n){super(e,i),this.z=n}}class Lv extends Ec{constructor(e,i,n,a){super(e,i,n),this.w=a}}function Dv(r,e,i,n){const a=i==="x"?"y":"x",u=(n-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*u),r[i]=n,r.hasOwnProperty("z")&&(r.z=Dt(r.z,e.z,u)),r.hasOwnProperty("w")&&(r.w=Dt(r.w,e.w,u))}function zv(r,e,i,n){const a=i,u=n;for(const h of["x","y"]){let f=r,_=e;f[h]>=_[h]&&(f=e,_=r),f[h]<a&&_[h]>a&&Dv(f,_,h,a),f[h]<u&&_[h]>u&&Dv(_,f,h,u)}}function hm(r,e,i,n,a,u){const h=[];for(let f=0;f<r.length;f++){const _=r[f];let g;const v=h.length;let b=0;for(let w=0;w<_.length-1;w++){let I=_[w],A=_[w+1],R=0;const O=b;let D,k;u&&(R=Math.hypot(A.x-I.x,A.y-I.y),b+=R,D=I,k=A),I.x<e&&A.x<e||(I.x<e?I=new Ke(e,I.y+(e-I.x)/(A.x-I.x)*(A.y-I.y))._round():A.x<e&&(A=new Ke(e,I.y+(e-I.x)/(A.x-I.x)*(A.y-I.y))._round()),I.y<i&&A.y<i||(I.y<i?I=new Ke(I.x+(i-I.y)/(A.y-I.y)*(A.x-I.x),i)._round():A.y<i&&(A=new Ke(I.x+(i-I.y)/(A.y-I.y)*(A.x-I.x),i)._round()),I.x>=n&&A.x>=n||(I.x>=n?I=new Ke(n,I.y+(n-I.x)/(A.x-I.x)*(A.y-I.y))._round():A.x>=n&&(A=new Ke(n,I.y+(n-I.x)/(A.x-I.x)*(A.y-I.y))._round()),I.y>=a&&A.y>=a||(I.y>=a?I=new Ke(I.x+(a-I.y)/(A.y-I.y)*(A.x-I.x),a)._round():A.y>=a&&(A=new Ke(I.x+(a-I.y)/(A.y-I.y)*(A.x-I.x),a)._round()),g&&I.equals(g[g.length-1])||(g=[I],h.push(g),u&&u.push({progress:{min:O+Ov(D,k,I)*R,max:1},parentIndex:f,prevPoint:D,nextPoint:k})),g.push(A),u&&(u[u.length-1].progress.max=O+Ov(D,k,A)*R,u[u.length-1].nextPoint=k)))))}if(u&&b>0)for(let w=v;w<h.length;w++)u[w].progress.min/=b,u[w].progress.max/=b}return h}function nE(r,e,i,n,a){if(r.length<2)return void n.push(r);const u=[];for(;e.valid();){const[g,v]=e.get();for(let b=0;b<r.length-1;b++){const w=r[b],I=r[b+1],A=bc(w,I,g,v);if(A){const[R]=A,O=new Ke(Dt(w.x,I.x,R),Dt(w.y,I.y,R));u.push({t:b+R,distance:0,point:O})}}e.next()}if(u.length===0)return void n.push(r);u.sort((g,v)=>g.t-v.t);let h=0,f=0,_=[];for(n.push(_);h!==r.length;){if(f===u.length){for(;h!==r.length;)_.length!==0&&_[_.length-1].equals(r[h])||_.push(r[h]),h++;break}u[f].t<=h?(_.length!==0&&_[_.length-1].equals(u[f].point)||_.push(u[f].point),Math.trunc(u[f].t),f++):(_.length!==0&&_[_.length-1].equals(r[h])||_.push(r[h]),h++)}}function Ov(r,e,i){return r.x!==e.x?(i.x-r.x)/(e.x-r.x):r.y!==e.y?(i.y-r.y)/(e.y-r.y):0}function Ud(r,e){return r.x*e.x+r.y*e.y}function Fv(r,e){if(r.length===1){let i=0;const n=e[i++];let a;for(;!a||n.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],f=a.sub(n),_=u.sub(n),g=h.sub(n),v=Ud(f,f),b=Ud(f,_),w=Ud(_,_),I=Ud(g,f),A=Ud(g,_),R=v*w-b*b,O=(w*I-b*A)/R,D=(v*A-b*I)/R,k=n.z*(1-O-D)+a.z*O+u.z*D;if(isFinite(k))return k}return 1/0}{let i=1/0;for(const n of e)i=Math.min(i,n.z);return i}}function kv(r,e,i){let n=1/0;ki(i,e)&&(n=Fv(i,e[0]));for(let a=0;a<e.length;a++){const u=e[a],h=r[a];for(let f=0;f<u.length-1;f++){const _=u[f],g=[_,u[f+1],h[f+1],h[f],_];Ki(i,g)&&(n=Math.min(n,Fv(i,g)))}}return n!==1/0&&n}function Bv(r,e,i,n,a,u,h,f,_,g,v){return r.projection.name==="globe"?(function(b,w,I,A,R,O,D,k,U,G,K){const Y=[],re=[],oe=b.projection.upVectorScale(K,b.center.lat,b.worldSize).metersToTile,ie=[0,0,0,1],ce=[0,0,0,1],de=(Ce,Le,Ue,Ne)=>{Ce[0]=Le,Ce[1]=Ue,Ce[2]=Ne,Ce[3]=1},De=Mv();I>0&&(I+=De),A+=De;for(const Ce of w){const Le=[],Ue=[];for(const Ne of Ce){const Ve=Ne.x+R.x,Se=Ne.y+R.y,Ge=b.projection.projectTilePoint(Ve,Se,K),Oe=b.projection.upVector(K,Ne.x,Ne.y);let qe=I,je=A;if(D){const mt=Nv(Ve,Se,I,A,D,k,U,G);qe+=mt.base,je+=mt.top}I!==0?de(ie,Ge.x+Oe[0]*oe*qe,Ge.y+Oe[1]*oe*qe,Ge.z+Oe[2]*oe*qe):de(ie,Ge.x,Ge.y,Ge.z),de(ce,Ge.x+Oe[0]*oe*je,Ge.y+Oe[1]*oe*je,Ge.z+Oe[2]*oe*je),pr(ie,ie,O),pr(ce,ce,O),Le.pu
7sh(new Ec(ie[0],ie[1],ie[2])),Ue.push(new Ec(ce[0],ce[1],ce[2]))}Y.push(Le),re.push(Ue)}return[Y,re]})(r,e,i,n,a,u,h,f,_,g,v):h?(function(b,w,I,A,R,O,D,k,U){const G=[],K=[],Y=[0,0,0,1];for(const re of b){const oe=[],ie=[];for(const ce of re){const de=ce.x+A.x,De=ce.y+A.y,Ce=Nv(de,De,w,I,O,D,k,U);Y[0]=de,Y[1]=De,Y[2]=Ce.base,Y[3]=1,An(Y,Y,R),Y[3]=Math.max(Y[3],1e-5);const Le=new Ec(Y[0]/Y[3],Y[1]/Y[3],Y[2]/Y[3]);Y[0]=de,Y[1]=De,Y[2]=Ce.top,Y[3]=1,An(Y,Y,R),Y[3]=Math.max(Y[3],1e-5);const Ue=new Ec(Y[0]/Y[3],Y[1]/Y[3],Y[2]/Y[3]);oe.push(Le),ie.push(Ue)}G.push(oe),K.push(ie)}return[G,K]})(e,i,n,a,u,h,f,_,g):(function(b,w,I,A,R){const O=[],D=[],k=R[8]*w,U=R[9]*w,G=R[10]*w,K=R[11]*w,Y=R[8]*I,re=R[9]*I,oe=R[10]*I,ie=R[11]*I;for(const ce of b){const de=[],De=[];for(const Ce of ce){const Le=Ce.x+A.x,Ue=Ce.y+A.y,Ne=R[0]*Le+R[4]*Ue+R[12],Ve=R[1]*Le+R[5]*Ue+R[13],Se=R[2]*Le+R[6]*Ue+R[14],Ge=R[3]*Le+R[7]*Ue+R[15],Oe=Ne+k,qe=Ve+U,je=Se+G,mt=Math.max(Ge+K,1e-5),_t=Ne+Y,st=Ve+re,ct=Se+oe,Rt=Math.max(Ge+ie,1e-5);de.push(new Ec(Oe/mt,qe/mt,je/mt)),De.push(new Ec(_t/Rt,st/Rt,ct/Rt))}O.push(de),D.push(De)}return[O,D]})(e,i,n,a,u)}function Nv(r,e,i,n,a,u,h,f){const _=h*a.getElevationAt(r,e,!0,!0),g=u[0]!==0,v=g?u[1]===0?h*(u[0]/7-450):h*(function(b,w,I){const A=Math.floor(w[0]/8),R=Math.floor(w[1]/8),O=10*(w[0]-8*A),D=10*(w[1]-8*R),k=b.getElevationAt(A,R,!0,!0),U=b.getMeterToDEM(I),G=Math.floor(.5*(O*U-1)),K=Math.floor(.5*(D*U-1)),Y=b.tileCoordToPixel(A,R),re=2*G+1,oe=2*K+1,ie=(function(Ue,Ne,Ve,Se,Ge){return[Ue.getElevationAtPixel(Ne,Ve,!0),Ue.getElevationAtPixel(Ne+Ge,Ve,!0),Ue.getElevationAtPixel(Ne,Ve+Ge,!0),Ue.getElevationAtPixel(Ne+Se,Ve+Ge,!0)]})(b,Y.x-G,Y.y-K,re,oe),ce=Math.abs(ie[0]-ie[1]),de=Math.abs(ie[2]-ie[3]),De=Math.abs(ie[0]-ie[2])+Math.abs(ie[1]-ie[3]),Ce=Math.min(.25,.5*U*(ce+de)/re),Le=Math.min(.25,.5*U*De/oe);return k+Math.max(Ce*O,Le*D)})(a,u,f):_;return{base:_+(i===0?-1:i),top:g?Math.max(v+n,_+i+2):_+n}}class oE{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class sE{constructor(){this.tasks={},this.taskQueue=[],xt(["process"],this),this.invoker=new oE(this.process),this.nextId=0}add(e,i){const n=this.nextId++,a=(function({type:u,isSymbolTile:h,zoom:f}){return f=f||0,u==="message"?0:u!=="maybePrepare"||h?u!=="parseTile"||h?u==="parseTile"&&h?300-f:u==="maybePrepare"&&h?400-f:500:200-f:100-f})(i);return a===0?(e(),null):(this.tasks[n]={fn:e,metadata:i,priority:a,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const 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 a=0;a<this.taskQueue.length;a++){const u=this.tasks[this.taskQueue[a]];u.priority<i&&(i=u.priority,e=a)}if(e===null)return null;const n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}remove(){this.invoker.remove()}}class Vv{constructor(e,i,n){this.target=e,this.parent=i,this.mapId=n,this.callbacks={},this.cancelCallbacks={},xt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new sE}send(e,i,n,a,u=!1,h){const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=h,this.callbacks[f]=n);const _=new Set;return this.target.postMessage({id:f,type:e,hasCallback:!!n,targetMapId:a,mustQueue:u,sourceMapId:this.mapId,data:Mo(i,_)},_),{cancel:()=>{n&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const n=i.id;if(n&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[n];delete this.cancelCallbacks[n],a&&a.cancel()}else if(i.mustQueue||lr(self)){const a=this.callbacks[n],u=this.scheduler.add(()=>this.processTask(n,i),a&&a.metadata||{type:"message"});u&&(this.cancelCallbacks[n]=u)}else this.processTask(n,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const n=this.callbacks[e];delete this.callbacks[e],n&&(i.error?n(ps(i.error)):n(null,ps(i.data)))}else{const n=new Set,a=i.hasCallback?(h,f)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?Mo(h):null,data:Mo(f,n)},n)}:()=>{},u=ps(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,u,a);else if(this.parent.getWorkerSource){const h=i.type.split("."),{source:f,scope:_}=u;this.parent.getWorkerSource(i.sourceMapId,h[0],f,_)[h[1]](u,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var jd={workerUrl:"",workerClass:null,workerParams:void 0};function aE(r){return jd.workerClass!=null?new jd.workerClass:new self.Worker(jd.workerUrl,Object.assign({name:r},jd.workerParams))}const fg="mapboxgl_preloaded_worker_pool";class Sc{constructor(e){this.active={},this.name=e}acquire(e,i=Sc.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;){const n=aE(`${this.name||""}WorkerPool: ${e}-${this.workers.length}`);this.workers.push(n)}return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEac
7h(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[fg]}numActive(){return Object.keys(this.active).length}}Sc.workerCount=2;class Fu{constructor(e,i,n="Worker",a=Sc.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Je();const u=this.workerPool.acquire(this.id,a);for(let h=0;h<u.length;h++){const f=new Fu.Actor(u[h],i,this.id);f.name=`${n} ${h}`,this.actors.push(f)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,n){ge(this.actors,(a,u)=>{a.send(e,i,u)},n=n||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)}}let Gd,pg;function dm(){return Gd||(Gd=new Sc),Gd}Fu.Actor=Vv;const mg=4096;class lE{constructor(e){this.module=e,this.memoryStack=this.module.malloc(mg),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>mg?-1:(new Int32Array(this.module.heap32.buffer,i,e.length).set(e),i)}createFloatArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>mg?-1:(new Float32Array(this.module.heapF32.buffer,i,e.length).set(e),i)}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.normalScale;this.module.setStyle(i[0],i[1],i[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,i?1:0)}setFauxFacadeOptions(e,i,n){this.module.setFauxFacadeOptions(e?1:0,i?1:0,n)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){this.memoryStackNextFree=this.memoryStack;for(const f of e){const _=this.createIntArray(f.ringIndices),g=this.createFloatArray(f.coordinates);if(_===-1||g===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,f.roofType,g,_,f.ringIndices.length-1)}for(const f of i){let _;_=f.entrances?JSON.parse(f.entrances):[];const g=this.createFloatArray(_),v=this.createFloatArray(f.coordinates);if(g===-1||v===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,g,_.length,v,f.coordinates.length)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}const n=this.module.getMeshCount(),a=new Array(n);for(let f=0;f<n;f++){const _=this.module.getPositionsPtr(f),g=this.module.getPositionsLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g),b=this.module.getNormalsPtr(f),w=this.module.getNormalsLength(f),I=new Float32Array(this.module.heapF32.buffer,b,w),A=this.module.getAOPtr(f),R=this.module.getAOLength(f),O=new Float32Array(this.module.heapF32.buffer,A,R),D=this.module.getUVPtr(f),k=this.module.getUVLength(f),U=new Float32Array(this.module.heapF32.buffer,D,k),G=this.module.getFauxFacadePtr(f),K=this.module.getFauxFacadeLength(f),Y=new Uint8Array(this.module.heapU8.buffer,G,K),re=this.module.getIndicesPtr(f),oe=this.module.getIndicesLength(f),ie=new Int16Array(this.module.heap16.buffer,re,oe),ce=this.module.getBuildingPart(f);a[f]={positions:v,normals:I,ao:O,uv:U,isFauxFacade:Y,indices:ie,buildingPart:ce}}const u=this.module.getRingCount(),h=[];for(let f=0;f<u;f++){const _=this.module.getRingPtr(f),g=this.module.getRingLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g);h.push(v)}return{meshes:a,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:h}}}let qd,_g,ys,ku,gg,Bu=null,Nu=null,Uv=null,fm=null;function jv(){return lr(self)&&self.worker.dracoUrl?self.worker.dracoUrl:_g||Ir.DRACO_URL}function Gv(){if(lr(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(ku)return ku;
7const r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return ku=WebAssembly.validate(r)?Ir.MESHOPT_SIMD_URL:Ir.MESHOPT_URL,ku}function cE(){return fm}const qv=5120,$v=5121,Hv=5122,Zv=5123,Wv=5125,Xv=5126,pm={[qv]:Int8Array,[$v]:Uint8Array,[Hv]:Int16Array,[Zv]:Uint16Array,[Wv]:Uint32Array,[Xv]:Float32Array},uE={[qv]:"DT_INT8",[$v]:"DT_UINT8",[Hv]:"DT_INT16",[Zv]:"DT_UINT16",[Wv]:"DT_UINT32",[Xv]:"DT_FLOAT32"},$d={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Yv(r,e,i){const n=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=n,i.json.bufferViews[n]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const yg="KHR_draco_mesh_compression";function hE(r,e){const i=r.extensions&&r.extensions[yg];if(!i)return;const n=new ys.Decoder,a=e0(e,i.bufferView),u=new ys.Mesh;if(!n.DecodeArrayToMesh(a,a.byteLength,u))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],f=pm[h.componentType],_=h.count*f.BYTES_PER_ELEMENT,g=ys._malloc(_);f===Uint16Array?n.GetTrianglesUInt16Array(u,_,g):n.GetTrianglesUInt32Array(u,_,g),Yv(ys.memory.buffer.slice(g,g+_),h,e),ys._free(g);for(const v of Object.keys(i.attributes)){const b=n.GetAttributeByUniqueId(u,i.attributes[v]),w=e.json.accessors[r.attributes[v]],I=uE[w.componentType],A=w.count*$d[w.type]*pm[w.componentType].BYTES_PER_ELEMENT,R=ys._malloc(A);n.GetAttributeDataArrayForAllPoints(u,b,ys[I],A,R),Yv(ys.memory.buffer.slice(R,R+A),w,e),ys._free(R)}n.destroy(),u.destroy(),delete r.extensions[yg]}const mm="EXT_meshopt_compression";function dE(r,e){if(!r.extensions||!r.extensions[mm])return;const i=r.extensions[mm],n=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);gg.decodeGltfBuffer(a,i.count,i.byteStride,n,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[mm]}const Kv=1179937895,Jv=new TextDecoder("utf8");function Qv(r,e){return new URL(r,e).href}function fE(r,e,i,n){return fetch(Qv(r.uri,n)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function e0(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function pE(r,e,i,n){if(r.uri){const a=Qv(r.uri,n);return fetch(a).then(u=>u.blob()).then(u=>createImageBitmap(u)).then(u=>{e.images[i]=u})}if(r.bufferView!==void 0){const a=e0(e,r.bufferView),u=new Blob([a],{type:r.mimeType});return createImageBitmap(u).then(h=>{e.images[i]=h})}}function t0(r,e=0,i){const n={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===Kv){const v=new Uint32Array(r,e);let b=2;const w=(v[b++]>>2)-3,I=v[b++]>>2;if(b++,n.json=JSON.parse(Jv.decode(v.subarray(b,b+I))),b+=I,b<w){const A=v[b++];b++;const R=e+(b<<2);n.buffers[0]=r.slice(R,R+A)}}else n.json=JSON.parse(Jv.decode(new Uint8Array(r,e)));const{buffers:a,images:u,meshes:h,extensionsUsed:f,bufferViews:_}=n.json;let g=Promise.resolve();if(a){const v=[];for(let b=0;b<a.length;b++){const w=a[b];w.uri?v.push(fE(w,n,b,i)):n.buffers[b]||(n.buffers[b]=null)}g=Promise.all(v)}return g.then(()=>{const v=[],b=f&&f.includes(yg),w=f&&f.includes(mm);if(b&&v.push((function(){if(!ys)return qd??(qd=(function(I){let A,R=null;function O(){A=new Uint8Array(R.buffer)}function D(){throw new Error("Unexpected Draco error.")}const k={a:{a:D,d:function(U,G,K){return A.copyWithin(U,G,G+K)},c:function(U){const G=A.length,K=Math.max(U>>>0,Math.ceil(1.2*G)),Y=Math.ceil((K-G)/65536);try{return R.grow(Y),O(),!0}catch{return!1}},b:D}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(I,k):I.then(U=>U.arrayBuffer()).then(U=>WebAssembly.instantiate(U,k))).then(U=>{const{Rb:G,Qb:K,P:Y,T:re,X:oe,Ja:ie,La:ce,Qa:de,Va:De,Wa:Ce,eb:Le,jb:Ue,f:Ne,e:Ve,yb:Se,zb:Ge,Ab:Oe,Bb:qe,Db:je,Gb:mt}=U.instance.exports;R=Ve;const _t=(()=>{let st=0,ct=0,Rt=0,St=0;return ft=>{Rt&&(G(St),G(st),ct+=Rt,Rt=st=0),st||(ct+=128,st=K(ct));const Bt=ft.length+7&-8;let Jt=st;Bt>=ct&&(Rt=Bt,Jt=St=K(Bt));for(let pi=0;pi<ft.length;pi++)A[Jt+pi]=ft[pi];return Jt}})();return O(),Ne(),{memory:Ve,_free:G,_malloc:K,Mesh:class{constructor(){this.ptr=Y()}destroy(){re(this.ptr)}},Decoder:class{constructor(){this.ptr=ie()}destroy(){Ue(this.ptr)}DecodeArrayToMesh(st,ct,Rt){const St=_t(st),ft=ce(this.ptr,St,ct,Rt.ptr);return!!oe(ft)}GetAttributeByUniqueId(st,ct){return{ptr:de(this.ptr,st.ptr,ct)}}GetTrianglesUInt16Array(st,ct,Rt){De(this.ptr,st.ptr,ct,Rt)}GetTrianglesUInt32Array(st,ct,Rt){Ce(this.ptr,st.ptr,ct,Rt)}GetAttributeDataArrayForAllPoints(st,ct,Rt,St,ft){Le(this.ptr,st.ptr,ct.ptr,Rt,St,ft)}},DT_INT8:Se(),DT_UINT8:Ge(),DT_INT16:Oe(),DT_UINT16:qe(),DT_UINT32:je(),DT_FLOAT32:mt()}})})(fetch(jv())),qd.then(I=>{ys=I,qd=void 0}))})()),w&&v.push((function(){if(gg)return;const I=(function(A){let R;const O=WebAssembly.instantiateStreaming(A,{}).then(U=>{R=U.instance,R.exports.__wasm_call_ctors()}),D={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},k={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:O,supported:!0,decodeGltfBuffer(U,G,K,Y,re,oe){(function(ie,ce,de,De,Ce,Le,Ue){const Ne=ie.exports.sbrk,Ve=De+3&-4,Se=Ne(Ve*Ce),Ge=Ne(Le.length),Oe=new Uint8Array(ie.exports.memory.buffer);Oe.set(Le,Ge);const qe=ce(Se,De,Ce,Ge,Le.length);if(qe===0&&Ue&&Ue(Se,Ve,Ce),de.set(Oe.subarray(Se,Se+De*Ce)),Ne(Se-Ne(0)),qe!==0)throw new Error(`Malformed buffer data: ${qe}`)})(R,R.exports[k[re]],U,G,K,Y,R.exports[D[oe]])}}})(fetch(Gv()));return I.ready.then(()=>{gg=I})})()),u)for(let I=0;I<u.length;I++)v.push(pE(u[I],n,I,i));return(v.length?Promise.all(v):Promise.resolve()).then(()=>
vendor: 12,318 bytes, line 7
7{if(b&&h)for(const{primitives:I}of h)for(const A of I)hE(A,n);if(w&&h&&_)for(const I of _)dE(I,n);return n})})}function i0(r){return fetch(r).then(e=>e.arrayBuffer()).then(e=>t0(e,0,r))}function xg(r){switch(r){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 vg(r){switch(r){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 bg{constructor(e,i,n,a){this.context=e,this.format=n,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const n=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:u}=this,{gl:h}=u,{x:f,y:_}=i&&i.position?i.position:{x:0,y:0},g=f+n,v=_+a;!this.size||this.size[0]===g&&this.size[1]===v||(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.RGBA8&&(!i||i.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&g>0&&v>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(g,v)))+1:1;h.texStorage2D(h.TEXTURE_2D,w,this.format,g,v),this.size=[g,v]}this.size&&(b?h.texSubImage2D(h.TEXTURE_2D,0,f,_,xg(this.format),vg(this.format),e):"data"in e&&e.data&&h.texSubImage2D(h.TEXTURE_2D,0,f,_,n,a,xg(this.format),vg(this.format),e.data)),this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,n=!1){const{context:a}=this,{gl:u}=a;u.bindTexture(u.TEXTURE_2D,this.texture),e!==this.minFilter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===u.NEAREST?u.NEAREST_MIPMAP_NEAREST:u.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,n,a,u){const{context:h}=this,{gl:f}=h;f.bindTexture(f.TEXTURE_2D,this.texture),i!==this.magFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this.useMipmap?e===f.NEAREST?f.NEAREST_MIPMAP_NEAREST:f.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,n),this.wrapS=n),a!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,a),this.wrapT=a),u!==this.compareMode&&(u?(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.COMPARE_REF_TO_TEXTURE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_FUNC,u)):f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.NONE),this.compareMode=u)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Hd{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:n}=this,{gl:a}=n;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)}}const mE=ei([{name:"a_pos_3f",components:3,type:"Float32"}]),_E=ei([{name:"a_color_3f",components:3,type:"Float32"}]),gE=ei([{name:"a_color_4f",components:4,type:"Float32"}]),yE=ei([{name:"a_uv_2f",components:2,type:"Float32"}]),xE=ei([{name:"a_normal_3f",components:3,type:"Float32"}]),vE=ei([{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"}]),bE=ei([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function r0(r,e){const i=_m(r.projection,r.zoom,r.width,r.height),n=(function(u,h,f,_,g){const v=new J(f.lng-180*wl,f.lat),b=new J(f.lng+180*wl,f.lat),w=u.project(v.lng,v.lat),I=u.project(b.lng,b.lat),A=-Math.atan2(I.y-w.y,I.x-w.x),R=ut.fromLngLat(f);R.y=te(R.y,-1+wl,1-wl);const O=R.toLngLat(),D=u.project(O.lng,O.lat),k=ut.fromLngLat(O);k.x+=wl;const U=k.toLngLat(),G=u.project(U.lng,U.lat),K=o0(G.x-D.x,G.y-D.y,A),Y=ut.fromLngLat(O);Y.y+=wl;const re=Y.toLngLat(),oe=u.project(re.lng,re.lat),ie=o0(oe.x-D.x,oe.y-D.y,A),ce=Math.abs(K.x)/Math.abs(ie.y),de=pe([]);Tt(de,de,-A*(1-(g?0:_)));const De=pe([]);return Qe(De,De,[1,1-(1-ce)*_,1]),De[4]=-ie.x/ie.y*_,Tt(De,De,A),at(De,de,De),De})(r.projection,0,r.center,i,e),a=n0(r);return Qe(n,n,[a,a,1]),n}function n0(r){const e=r.projection,i=_m(r.projection,r.zoom,r.width,r.height),n=wg(e,r.center),a=wg(e,J.convert(e.center));return Math.pow(2,n*i+(1-i)*a)}function _m(r,e,i,n,a=1/0){const u=r.range;if(!u)return 0;const h=Math.min(a,Math.max(i,n)),f=Math.log2(h/1024);return me(u[0]+f,u[1]+f,e)}const wl=1/4e4;function wg(r,e){const i=te(e.lat,-85.051129,he),n=new J(e.lng-180*wl,i),a=new J(e.lng+180*wl,i),u=r.project(n.lng,i),h=r.project(a.lng,i),f=ut.fromLngLat(n),_=ut.fromLngLat(a),g=h.x-u.x,v=h.y-u.y,b=_.x-f.x,w=_.y-f.y,I=Math.sqrt((b*b+w*w)/(g*g+v*v));return Math.log2(I)}function o0(r,e,i){const n=Math.cos(i),a=Math.sin(i);return{x:r*n-e*a,y:r*a+e*n}}function s0(r,e,i){pe(r),Tt(r,r,ci(e[2])),He(r,r,ci(e[0])),yt(r,r,ci(e[1])),Qe(r,r,i),at(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function gm(r,e,i,n,a,u,h,f){const _=[i[0]-e[0],i[1]-e[1],0],g=[n[0]-e[0],n[1]-e[1],0];if(rn(_)<1e-12||rn(g)<1e-12)return es(r);const v=Kr([],_,g);Ii(v,v),go(g,n,e),_[2]=(u-a)*f,g[2]=(h-a)*f;const b=_;return Kr(b,_,g),Ii(b,b),ts(r,v,b)}function ym(r,e,i=!1){const n=yl(e.zoom),a=(function(u,h,f){const _=h.worldSize,g=[u[12],u[13],u[14]],v=$e(g[1]/_),b=Fe(g[0]/_),w=pe([]),I=Ee(1,v)*_,A=Ee(1,0)*_*Me(v,h.zoom),R=1/q_(_);let O=A*R;if(f){const G=_m(h.projection,h.zoom,h.width,h.height,1024);O=R*h.projection.pixelSpaceConversion(h.center.lat,_,G)}const D=ne(v,b);sr(D,D,Ui([],Ii([],D),I*O*g[2]));const k=(function(G){const K=[G[0],G[1],G[2]];let Y=[0,1,0];const re=Kr([],Y,K);return Kr(Y,K,re),br(Y)===0&&(Y=[0,1,0],Kr(re,K,Y)),Ii(re,re),Ii(Y,Y),Ii(K,K),[re[0],re[1],re[2],0,Y[0],Y[1],Y[2],0,K[0],K[1],K[2],0,G[0],G[1],G[2],1]})(D);Qe(w,w,[O,O,O*I]),gt(w,w,[-g[0],-g[1],-g[2]]);const U=at([],h.globeMatrix,k);return at(U,U,w),at(U,U,u),U})(r,e,i);if(n>0){const u=(function(h,f){const _=f.worldSize,g=Ee(1,0)*_*Me(f.center.lat,f.zoom)/q_(_),v=Ee(1,f.center.lat)*_,b=pe([]);yt(b,b,ci(f.center.lng)),He(b,b,ci(f.center.lat)),gt(b,b,[0,0,B]),Qe(b,b,[g,g,g*v]);const w=f.point;return gt(b,b,[-w.x,-w.y,0]),at(b,b,h),at(b,f.globeMatrix,b)})(r,e);return(function(h,f,_){const g=(A,R,O)=>{const D=rn(A),k=rn(R),U=Ma(A,R,O);return Ui(U,U,1/rn(U)*Dt(D,k,O))},v=g([h[0],h[1],h[2]],[f[0],f[1],f[2]],_),b=g([h[4],h[5],h[6]],[f[4],f[5],f[6]],_),w=g([h[8],h[9],h[10]],[f[8],f[9],f[10]],_),I=Ma([h[12],h[13],h[14]],[f[12],f[13],f[14]],_);return[v[0],v[1],v[2],0,b[0],b[1],b[2],0,w[0],w[1],w[2],0,I[0],I[1],I[2],1]})(a,u,n)}return a}function Tg(r,e,i,n){const a=gi.projectAabbCorners(n,i);let u=Number.MAX_VALUE;for(let f=0;f<a.length;++f){const _=a[f];_[0]=(.5*_[0]+.5)*e.width,_[1]=(.5-.5*_[1])*e.height,_[2]<u&&(u=_[2])}const h=(function(f){const _=[];let g=0;for(let I=1;I<f.length;I++)(f[I][0]<f[g][0]||f[I][0]===f[g][0]&&f[I][1]<f[g][1])&&(g=I);let v,b=g;const w=new Uint8Array(f.length);do{if(w[b])break;_.push(new Ke(f[b][0],f[b][1])),w[b]=1,v=(b+1)%f.length;for(let I=0;I<f.length;I++){if(f[I][0]===f[v][0]&&f[I][1]===f[v][1]||f[I][0]===f[b][0]&&f[I][1]===f[b][1])continue;const A=[f[I][0]-f[b][0],f[I][1]-f[b][1]],R=[f[v][0]-f[b][0],f[v][1]-f[b][1]],O=A[0]*R[1]-A[1]*R[0];(O>0||O===0&&A[0]*R[0]+A[1]*R[1]>=0&&A[0]*A[0]+A[1]*A[1]>R[0]*R[0]+R[1]*R[1])&&(v=I)}b=v}while(b!==g);return _.length>0&&_.push(_[0]),_})(a);if(Ki(r,h))return u}const Ic=64,Vu={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function xm(r,e,i,n,a,u,h,f,_,g=!1){const v=i.zoom,b=i.project(n),w=Me(n.lat,v),I=1/w;pe(r),gt(r,r,[b.x+h[0]*I,b.y+h[1]*I,h[2]]);let A=1,R=1;const O=i.worldSize;if(g){if(i.projection.name==="mercator"){let G=0;i.elevation&&(G=i.elevation.getAtPointOrZero(new ut(b.x/O,b.y/O),0));const K=An([],[b.x,b.y,G,1],i.projMatrix)[3]/i.cameraToCenterDistance;A=K,R=K*Me(i.center.lat,v)}else if(i.projection.name==="globe"){const G=ym(r,i),K=[0,0,0,1];An(K,K,at([],i.projMatrix,G));const Y=K[3]/i.cameraToCenterDistance,re=yl(v),oe=i.projection.pixelsPerMeter(n.lat,O)*Me(n.lat,v),ie=i.projection.pixelsPerMeter(i.center.lat,O)*Me(i.center.lat,v);A=Y/Dt(oe,ze(i.center.lat),re),R=Y*w/oe,A*=ie,R*=ie}}else A=I;Qe(r,r,[A,A,R]);const D=[...r],k=e.orientation,U=[];if(s0(U,[k[0]+(a?a[0]:0),k[1]+(a?a[1]:0),k[2]+(a?a[2]:0)],u),at(r,D,U),f&&i.elevation){let G=0;const K=[];if(_&&i.elevation){G=(function(re,oe,ie,ce,de){const De=oe.elevation;if(!De)return 0;const Ce=gi.projectAabbCorners(ie,ce),Le=Ee(1,de.lat)*oe.worldSize,Ue=(function(ct,Rt){const St=[0,0,1],ft=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const Bt of ft){const Jt=ct[Bt.corners[0]],pi=ct[Bt.corners[1]],Yt=ct[Bt.corners[2]],Mi=[pi[0]-Jt[0],pi[1]-Jt[1],Rt*(pi[2]-Jt[2])],ai=Kr(Mi,Mi,[Yt[0]-Jt[0],Yt[1]-Jt[1],Rt*(Yt[2]-Jt[2])]);Ii(ai,ai),Bt.dotProductWithUp=tr(ai,St)}return ft.sort((Bt,Jt)=>Bt.dotProductWithUp-Jt.dotProductWithUp),ft[0].corners})(Ce,Le),Ne=Ce[Ue[0]],Ve=Ce[Ue[1]],Se=Ce[Ue[2]],Ge=Ce[Ue[3]],Oe=De.getAtPointOrZero(new ut(Ne[0]/oe.worldSize,Ne[1]/oe.worldSize),0),qe=De.getAtPointOrZero(new ut(Ve[0]/oe.worldSize,Ve[1]/oe.worldSize),0),je=De.getAtPointOrZero(new ut(Se[0]/oe.worldSize,Se[1]/oe.worldSize),0),mt=De.getAtPointOrZero(new ut(Ge[0]/oe.worldSize,Ge[1]/oe.worldSize),0),_t=(Oe+mt)/2,st=(qe+je)/2;return _t>st?qe<je?gm(re,Ve,Ge,Ne,qe,mt,Oe,Le):gm(re,Se,Ne,Ge,je,Oe,mt,Le):Oe<mt?gm(re,Ne,Ve,Se,Oe,qe,je,Le):gm(re,Ge,Se,Ve,mt,je,qe,Le),Math.max(_t,st)})(K,i,e.aabb,r,n);const Y=at([],Vi([],K),U);at(r,D,Y)}else G=i.elevation.getAtPointOrZero(new ut(b.x/O,b.y/O),0);G!==0&&(r[14]+=G)}}class a0{constructor(e,i,n,a,u){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=i,this.position=n!=null?new J(n[0],n[1]):new J(0,0),this.orientation=a??[0,0,0],this.nodes=u,this.uploaded=!1,this.aabb=new gi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){at(e.globalMatrix,i,e.localMatrix);const n=this.nodeOverrides.get(e.name);if(n!==void 0){const h=[];u=n.orientation,pe(a=h),yt(a,a,ci(u[1])),Tt(a,a,ci(u[2])),He(a,a,ci(u[0])),at(e.globalMatrix,e.globalMatrix,h)}var a,u;if(e.meshes)for(const h of e.meshes){const f=gi.applyTransformFast(h.aabb,e.globalMatrix);this.aabb.encapsulate(f)}if(e.children)for(const h of e.children)this._applyTransformations(h,e.globalMatrix)}computeBoundsAndApplyParent(){const e=pe([]);this.aabb=new gi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,n,a,u,h,f=!1){xm(this.matrix,this,e.transform,this.position,i,n,a,u,h,f)}upload(e){if(!this.uploaded){for(const i of this.nodes)Eg(i,e);for(const i of this.nodes)vm(i);this.uploaded=!0}}destroy(){for(const e of this.nodes)Sg(e)}}function Zd(r,e,i=!1){r.uploaded||(r.gfxTexture=new bg(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}
7function wE(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,mE.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,xE.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,yE.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?_E:gE).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,bE.members,!0)),r.segments=Hi.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const n=r.material;n.pbrMetallicRoughness.baseColorTexture&&Zd(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&Zd(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&Zd(n.normalTexture,e),n.occlusionTexture&&Zd(n.occlusionTexture,e,i),n.emissionTexture&&Zd(n.emissionTexture,e)}function Eg(r,e,i){if(r.meshes)for(const n of r.meshes)wE(n,e,i);if(r.children)for(const n of r.children)Eg(n,e,i)}function vm(r){if(r.meshes)for(const e of r.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(r.children)for(const e of r.children)vm(e)}function TE(r){r.pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),r.pbrMetallicRoughness.metallicRoughnessTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),r.normalTexture&&r.normalTexture.gfxTexture&&r.normalTexture.gfxTexture.destroy(),r.emissionTexture&&r.emissionTexture.gfxTexture&&r.emissionTexture.gfxTexture.destroy(),r.occlusionTexture&&r.occlusionTexture.gfxTexture&&r.occlusionTexture.gfxTexture.destroy()}function Sg(r){if(r.meshes)for(const e of r.meshes)e.vertexBuffer&&(e.vertexBuffer.destroy(),e.indexBuffer.destroy(),e.normalBuffer&&e.normalBuffer.destroy(),e.texcoordBuffer&&e.texcoordBuffer.destroy(),e.colorBuffer&&e.colorBuffer.destroy(),e.pbrBuffer&&e.pbrBuffer.destroy(),e.segments.destroy(),e.material&&TE(e.material));if(r.children)for(const e of r.children)Sg(e)}function Ac(r,e){const i=r.json.bufferViews[e.bufferView],n=pm[e.componentType];return new n(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==$d[e.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:$d[e.type]))}function Ig(r,e,i,n){const a=pm[e.componentType],u=(function(v){switch(v){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}})(a),h=r.json.bufferViews[e.bufferView],f=h.byteStride?h.byteStride/a.BYTES_PER_ELEMENT:$d[e.type],_=i.float32,g=_.length/i.capacity;for(let v=0,b=0;v<e.count*f;v+=f,b+=g)for(let w=0;w<g;w++)_[b+w]=n[v+w]*u;i._trim()}function EE(r,e,i){const n=r.indices,a=r.attributes,u={};u.indexArray=new Mr;const h=e.json.accessors[n],f=h.count/3;u.indexArray.reserve(f);const _=Ac(e,h);for(let w=0;w<f;w++)u.indexArray.emplaceBack(_[3*w],_[3*w+1],_[3*w+2]);u.indexArray._trim(),u.vertexArray=new wo;const g=e.json.accessors[a.POSITION];u.vertexArray.reserve(g.count);const v=Ac(e,g);for(let w=0;w<g.count;w++)u.vertexArray.emplaceBack(v[3*w],v[3*w+1],v[3*w+2]);if(u.vertexArray._trim(),u.aabb=new gi(g.min,g.max),u.centroid=(function(w,I){const A=[0,0,0],R=w.length;if(R>0){for(let O=0;O<R;O++){const D=3*w[O];A[0]+=I[D],A[1]+=I[D+1],A[2]+=I[D+2]}A[0]/=R,A[1]/=R,A[2]/=R}return A})(_,v),a.COLOR_0!==void 0){const w=e.json.accessors[a.COLOR_0],I=$d[w.type],A=Ac(e,w);u.colorArray=I===3?new wo:new Ks,u.colorArray.resize(w.count),Ig(e,w,u.colorArray,A)}if(a.NORMAL!==void 0){u.normalArray=new wo;const w=e.json.accessors[a.NORMAL];u.normalArray.resize(w.count);const I=Ac(e,w);Ig(e,w,u.normalArray,I)}if(a.TEXCOORD_0!==void 0&&i.length>0){u.texcoordArray=new Ia;const w=e.json.accessors[a.TEXCOORD_0];u.texcoordArray.resize(w.count);const I=Ac(e,w);Ig(e,w,u.texcoordArray,I)}if(a._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(u.featureData=Ac(e,w))}a._FEATURE_RGBA4444!==void 0&&(u.featureData=new Uint32Array(Ac(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const b=r.material;return u.material=(function(w,I){const{emissiveFactor:A=[0,0,0],alphaMode:R="OPAQUE",alphaCutoff:O=.5,normalTexture:D,occlusionTexture:k,emissiveTexture:U,doubleSided:G,name:K}=w,{baseColorFactor:Y=[1,1,1,1],metallicFactor:re=1,roughnessFactor:oe=1,baseColorTexture:ie,metallicRoughnessTexture:ce}=w.pbrMetallicRoughness||{},de=k?I[k.index]:void 0;if(k&&k.extensions&&k.extensions.KHR_texture_transform&&de){const De=k.extensions.KHR_texture_transform;de.offsetScale=[De.offset[0],De.offset[1],De.scale[0],De.scale[1]]}return{name:K,pbrMetallicRoughness:{baseColorFactor:new vi(...Y),metallicFactor:re,roughnessFactor:oe,baseColorTexture:ie?I[ie.index]:void 0,metallicRoughnessTexture:ce?I[ce.index]:void 0},doubleSided:G,emissiveFactor:new vi(...A),alphaMode:R,alphaCutoff:O,normalTexture:D?I[D.index]:void 0,occlusionTexture:de,emissionTexture:U?I[U.index]:void 0,defined:w.defined===void 0}})(b!==void 0?e.json.materials[b]:{defined:!1},i),u}function l0(r,e,i){const{matrix:n,rotation:a,translation:u,scale:h,mesh:f,extras:_,children:g,name:v}=r,b={};if(b.name=v,b.localMatrix=n||(function(w,I,A,R){var O=I[0],D=I[1],k=I[2],U=I[3],G=O+O,K=D+D,Y=k+k,re=O*G,oe=O*K,ie=O*Y,ce=D*K,de=D*Y,De=k*Y,Ce=U*G,Le=U*K,Ue=U*Y,Ne=R[0],Ve=R[1],Se=R[2];return w[0]=(1-(ce+De))*Ne,w[1]=(oe+Ue)*Ne,w[2]=(ie-Le)*Ne,w[3]=0,w[4]=(oe-Ue)*Ve,w[5]=(1-(re+De))*Ve,w[6]=(de+Ce)*Ve,w[7]=0,w[8]=(ie+Le)*Se,w[9]=(de-Ce)*Se,w[10]=(1-(re+ce))*Se,w[11]=0,w[12]=A[0],w[13]=A[1],w[14]=A[2],w[15]=1,w})([],a||[0,0,0,1],u||[0,0,0],h||[1,1,1]),b.globalMatrix=Xe(b.localMatrix),f!==void 0){b.meshes=i[f];const w=b.anchor=[0,0];for(const I of b.meshes){const{min:A,max:R}=I.aabb;w[0]+=A[0]+R[0],w[1]+=A[1]+R[1]}w[0]=Math.floor(w[0]/b.meshes.length/2),w[1]=Math.floor(w[1]/b.meshes.length/2)}if(_&&(_.id&&(b.id=_.id),_.lights&&(b.lights=(function(w){if(!w.length)return[];const I=(function(k){const U=atob(k),G=new Uint8Array(U.length);for(let K=0;K<U.length;K++)G[K]=U.codePointAt(K);return G})(w),A=[],R=I.length/24,O=new Uint16Array(I.buffer),D=new Float32Array(I.buffer);for(let k=0;k<R;k++){const U=O[2*k*6]/30,G=O[2*k*6+1]/30,K=O[2*k*6+10]/100,Y=D[6*k+1],re=D[6*k+2],oe=D[6*k+3],ie=D[6*k+4],ce=oe-Y,de=ie-re,De=Math.hypot(ce,de);A.push({pos:[Y+.5*ce,re+.5*de,G],normal:[de/De,-ce/De,0],width:De,he
vendor: 4,389 bytes, line 7
7ight:U,depth:K,points:[Y,re,oe,ie]})}return A})(_.lights)),_.MAPBOX_geometry_bloom&&(b.isGeometryBloom=_.MAPBOX_geometry_bloom)),g){const w=[];for(const I of g)w.push(l0(e.json.nodes[I],e,i));b.children=w}return b}function SE(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new sm(r.vertices,r.indices,8,256),[i,n]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:n}}function IE(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const n=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const f=h[0],_=h[1];typeof f=="number"&&typeof _=="number"&&n.push(new Ke(f,_))}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let a=0;for(let h=0;h<n.length;h++){const f=n[h],_=n[(h+1)%n.length],g=n[(h+2)%n.length];a+=(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)}a>0&&n.reverse();const u=Lu(n.flatMap(h=>[h.x,h.y]),[]);return u.length===0?null:{vertices:n,indices:u}}function AE(r,e){const i=[],n=[];let a=0;const u=[];for(const h of r){a=i.length;const f=h.vertexArray.float32,_=h.indexArray.uint16;for(let g=0;g<h.vertexArray.length;g++)u[0]=f[3*g+0],u[1]=f[3*g+1],u[2]=f[3*g+2],pr(u,u,e),i.push(new Ke(u[0],u[1]));for(let g=0;g<3*h.indexArray.length;g++)n.push(_[g]+a)}if(n.length%3!=0)return null;for(let h=0;h<n.length;h+=3){const f=i[n[h+0]],_=i[n[h+1]],g=i[n[h+2]];(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)>0&&([n[h+1],n[h+2]]=[n[h+2],n[h+1]])}return{vertices:i,indices:n}}function Ag(r){const e=(function(_,g){const v=[],b=WebGL2RenderingContext;if(_.json.textures)for(const w of _.json.textures){const I={magFilter:b.LINEAR,minFilter:b.NEAREST,wrapS:b.REPEAT,wrapT:b.REPEAT};w.sampler!==void 0&&Object.assign(I,_.json.samplers[w.sampler]),v.push({image:g[w.source],sampler:I,uploaded:!1})}return v})(r,r.images),i=(function(_,g){const v=[];for(const b of _.json.meshes){const w=[];for(const I of b.primitives)w.push(EE(I,_,g));v.push(w)}return v})(r,e),{scenes:n,scene:a,nodes:u}=r.json,h=n?n[a||0].nodes:[...u.keys()],f=[];for(const _ of h)f.push(l0(u[_],r,i));return(function(_,g,v){const b={},w=new Set;for(let I=0;I<_.length;I++){const A=v[g[I]];if(!A.extras)continue;const R=A.extras["mapbox:footprint:version"],O=A.extras["mapbox:footprint:id"];(R||O)&&w.add(I),R==="1.0.0"&&O&&(b[O]=I)}for(let I=0;I<_.length;I++){if(w.has(I))continue;const A=_[I],R=v[g[I]];if(!R.extras)continue;let O=null;A.id in b&&(O=AE(_[b[A.id]].meshes,A.localMatrix)),O||(O=IE(R)),O&&(A.footprint=SE(O))}if(w.size>0){const I=Array.from(w.values()).sort((A,R)=>A-R);for(let A=I.length-1;A>=0;A--)_.splice(I[A],1)}})(f,h,r.json.nodes),f}function ME(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,n=r.aabb.min[1]-1,a=Ic/(r.aabb.max[0]-i+2),u=Ic/(r.aabb.max[1]-n+2);for(let h=0;h<e.length;h+=3){const f=e[h+2],_=(e[h+0]-i)*a|0,g=(e[h+1]-n)*u|0;f>r.heightmap[g*Ic+_]&&(r.heightmap[g*Ic+_]=f)}}function c0(r,e,i,n,a){i.reserve(i.length+4*r.length),n.reserve(n.length+10*r.length),a.reserve(a.length+10*r.length);let u=n.length;for(const h of r){const f=Math.min(10,Math.max(4,1.3*h.height))*e,_=[-h.normal[1],h.normal[0],0],g=Math.min(.29,.1*h.width/h.depth),v=h.width-2*h.depth*e*(g+.01),b=In([],h.pos,_,v/2),w=In([],h.pos,_,-v/2),I=[b[0],b[1],b[2]+h.height],A=[w[0],w[1],w[2]+h.height],R=In([],h.normal,_,g);Ui(R,R,f);const O=In([],h.normal,_,-g);Ui(O,O,f),sr(R,b,R),sr(O,w,O),b[2]+=.1,w[2]+=.1,n.emplaceBack(R[0],R[1],R[2]),n.emplaceBack(O[0],O[1],O[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(w[0],w[1],w[2]),n.emplaceBack(I[0],I[1],I[2]),n.emplaceBack(A[0],A[1],A[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(w[0],w[1],w[2]),n.emplaceBack(R[0],R[1],R[2]),n.emplaceBack(O[0],O[1],O[2]);const D=v/f/2;a.emplaceBack(-D-g,-1,D,.8),a.emplaceBack(D+g,-1,D,.8),a.emplaceBack(-D,0,D,1.3),a.emplaceBack(D,0,D,1.3),a.emplaceBack(D+g,-.8,D,.7),a.emplaceBack(D+g,-.8,D,.7),a.emplaceBack(0,0,D,1.3),a.emplaceBack(0,0,D,1.3),a.emplaceBack(D+g,-1.2,D,.8),a.emplaceBack(D+g,-1.2,D,.8),i.emplaceBack(6+u,4+u,8+u),i.emplaceBack(7+u,9+u,5+u),i.emplaceBack(0+u,1+u,2+u),i.emplaceBack(1+u,3+u,2+u),u+=10}}function CE(r,e){const i={};i.indexArray=new Mr,i.vertexArray=new wo,i.colorArray=new Ks,c0(r,e,i.indexArray,i.vertexArray,i.c
7olorArray);const n={defined:!0};n.emissiveFactor=vi.black;const a={};return a.baseColorFactor=vi.white,n.pbrMetallicRoughness=a,i.material=n,i.aabb=new gi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const u0=ei([{name:"a_pos_3f",components:3,type:"Float32"}]),PE=ei([{name:"a_normal_3",components:3,type:"Int16"}]),RE=ei([{name:"a_centroid_3",components:3,type:"Int16"}]),h0=ei([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),LE=ei([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),DE=ei([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),zE=ei([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),OE=ei([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),FE=ei([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),d0=ti.types,bm=32767;function kE(r,e){const i=lt+e;for(const n of r)for(const a of n)if(a.x<-e||a.x>i||a.y<-e||a.y>i)return!1;return!0}function BE(r){switch(r){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${r}`)}}class Mg{constructor(){this.layoutVertexArray=new wo,this.layoutAttenuationArray=new Ks,this.layoutColorArray=new ro,this.indexArray=new Mr,this.indexArrayForConflation=new Mr,this.segmentsBucket=new Hi}}class Cg{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Hi,this.entranceBloom=new Mg;const i=66560;this.layoutVertexArray=new wo,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new ms,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new ms,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new ro,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new pc,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new Mu,this.layoutAOArray.reserve(i),this.indexArray=new Mr,this.indexArray.reserve(66560),this.indexArrayForConflation=new Mr,this.segmentsBucket=new Hi,this.entranceBloom=new Mg,e&&(this.layoutFacadePaintArray=new ro,this.layoutFacadeDataArray=new dl,this.layoutFacadeVerticalRangeArray=new ro)}reserve(e,i,n){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(i),n&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class f0{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Ia,this.footprintsIndices=new pc,this.footprintsMin=new Ke(1/0,1/0),this.footprintsMax=new Ke(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Cg(!1),this.buildingWithFacade=new Cg(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new E(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.groundEffect=new hg(e),this.groundEffect.groundRadiusArray=new Gr,this.hasAppearances=null}updateFootprints(e,i){const n=new sm([],[],1),a={vertices:[],indices:new Uint32Array(0),grid:n,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:a,id:e})}updateAppearances(e,i,n,a){}prepare(){return(function(){if(fm!=null||Uv!=null)return null;if(Nu!=null)return Nu;const e=fetch(Ir.BUILDING_GEN_URL);return Nu=(function(i){let n,a,u,h,f;function _(){n=new Uint8Array(f.buffer),a=new Int16Array(f.buffer),u=new Int32Array(f.buffer),h=new Float32Array(f.buffer)}function g(){throw new Error("Unexpected BuildingGen error.")}const v=()=>{}
vendor: 25,947 bytes, line 7
7,b={a:{a:g,f:function(w){const I=n.length,A=Math.max(w>>>0,Math.ceil(1.2*I)),R=Math.ceil((A-I)/65536);try{return f.grow(R),_(),!0}catch{return!1}},g,b:v,c:v,d:v,e:v}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,b):i.then(w=>w.arrayBuffer()).then(w=>WebAssembly.instantiate(w,b))).then(w=>{const I=w.instance.exports;return(0,I.g)(),f=I.f,_(),new lE({setStyle:I.h,setAOOptions:I.i,setMetricOptions:I.j,setStructuralOptions:I.k,setFacadeOptions:I.l,setFauxFacadeOptions:I.m,setFacadeClassifierOptions:I.n,addFeature:I.o,addFacade:I.p,generateMesh:I.q,getLastError:I.r,getOuterRingLength:I.s,getMeshCount:I.t,getPositionsPtr:I.u,getPositionsLength:I.v,getNormalsPtr:I.w,getNormalsLength:I.x,getAOPtr:I.y,getAOLength:I.z,getUVPtr:I.A,getUVLength:I.B,getFauxFacadePtr:I.C,getFauxFacadeLength:I.D,getIndicesPtr:I.E,getIndicesLength:I.F,getBuildingPart:I.G,getRingCount:I.H,getRingPtr:I.I,getRingLength:I.J,malloc:I.K,free:I.L,heapU8:n,heap16:a,heap32:u,heapF32:h})})})(e).then(i=>(Nu=null,fm=i,fm)).catch(i=>{Ft("Could not load building-gen"),Nu=null,Uv=i}),Nu})()}populate(e,i,n,a){const u=cE();if(!u)return;const h=et(n);this.tileToMeter=h,this.brightness=i.brightness,u.setStyle({normalScale:[1,-1,h],tileToMeters:h}),u.setAOOptions(!1,.3),u.setMetricOptions(!1,16),u.setStructuralOptions(!0),u.setFacadeClassifierOptions(3);const f=new Map,_=new Map;let g=0;for(const{feature:D}of e){if(d0[D.type]!=="LineString"){f.set(D.id,D.properties.source_id);continue}const k=this.layers[0]._featureFilter.needGeometry;if(k&&!this.layers[0]._featureFilter.filter(new Ai(this.zoom),D,n))continue;const U=Ht(D,k);if(!k&&!this.layers[0]._featureFilter.filter(new Ai(this.zoom),U,n))continue;const G=k?U.geometry:Ot(D,n,a),K=[];for(const ie of G)for(const ce of ie)K.push(ce.x),K.push(ce.y);const Y={coordinates:K,crossPerc:D.properties.cross_perc,distanceToRoad:D.properties.distance_to_road,entrances:D.properties.entrances,sourceId:0},re=D.properties.source_id;let oe=_.get(re);oe||(oe=[],_.set(re,oe)),oe.push(Y),++g}this.maxHeight=0;const v=new Array,b=new Set,w=D=>{D!=null&&b.add(D)},I=(D,k)=>{D!=null&&v.push({buildingId:D,footprintIndex:k})},A=64*(e.length-g),R=A/2;this.buildingWithFacade.reserve(A,R,!0),this.buildingWithoutFacade.reserve(2*A,2*R,!1),this.footprintsIndices.reserve(16*(e.length-g)),this.footprintsVertices.reserve(8*(e.length-g));for(const{feature:D,id:k,index:U,sourceLayerIndex:G}of e){if(d0[D.type]==="LineString")continue;const K=this.layers[0]._featureFilter.needGeometry;if(K&&!this.layers[0]._featureFilter.filter(new Ai(this.zoom),D,n))continue;let Y=null;if(D.properties&&D.properties.hasOwnProperty("building_id")&&(Y=Number(D.properties.building_id),b.has(Y)))continue;const re=Ht(D,K);if(!K&&!this.layers[0]._featureFilter.filter(new Ai(this.zoom),re,n))continue;const oe=K?re.geometry:Ot(D,n,a),ie=zd(oe,500);let ce=!1;for(const Kt of ie)if(Kt.length!==1){ce=!0;break}if(ce){w(Y);continue}if(!kE(oe,163)){w(Y);continue}const de=this.layers[0],De=BE(de.layout.get("building-roof-shape").evaluate(D,{},n)),Ce=de.layout.get("building-base").evaluate(D,{},n),Le=de.layout.get("building-height").evaluate(D,{},n),Ue=de.layout.get("building-flood-light-ground-radius").evaluate(D,{},n),Ne=de.paint.get("building-ambient-occlusion-intensity"),Ve=Ue/this.tileToMeter;D.properties["building-part"]="roof";const Se=de.paint.get("building-color").evaluate(D,{},this.canonical).toPremultipliedRenderColor(this.lut),Ge=de.paint.get("building-emissive-strength").evaluate(D,{},this.canonical);D.properties["building-part"]="wall";const Oe=de.paint.get("building-color").evaluate(D,{},this.canonical).toPremultipliedRenderColor(this.lut),qe=de.paint.get("building-emissive-strength").evaluate(D,{},this.canonical);D.properties["building-part"]="window";const je=de.paint.get("building-color").evaluate(D,{},this.canonical).toPremultipliedRenderColor(this.lut),mt=de.paint.get("building-emissive-strength").evaluate(D,{},this.canonical);D.properties["building-part"]="door";const _t=de.paint.get("building-color").evaluate(D,{},this.canonical).toPremultipliedRenderColor(this.lut),st=de.paint.get("building-emissive-strength").evaluate(D,{},this.canonical);let ct=de.layout.get("building-flood-light-wall-radius").evaluate(D,{},n);ct=te(ct,0,2048);const Rt=ct/2048*bm,St=f.get(k),ft=_.get(St)||[],Bt=ft.length!==0&&de.layout.get("building-facade").evaluate(D,{},n);u.setFacadeOptions(4,!0),u.setFauxFacadeOptions(Bt,!1,1);let Jt=0,pi=0,Yt=0,Mi=0,ai=0,ur=0,hi=0,Ei=0,Gi=0,Ji=0,Qi=0;if(Bt){let Kt=Math.round(de.layout.get("building-facade-floors").evaluate(D,{},n));if(Ce===0){Kt=Math.max(1,Kt-(ft.length>0?1:0));let dr=4;if(Le>100){const Rr=[10,13,15];dr=Rr[D.id?D.id%Rr.length:0]}else Le<=10&&(dr=3);u.setFacadeOptions(dr,!0),ai=(Le<15?1.3:1.61803)*dr/h}else ai=Ce/h;ur=Le/h,ai=Math.min(ai,ur),Yt=de.layout.get("building-facade-unit-width").evaluate(D,{},n)/h,Mi=(ur-ai)/Kt,u.setFauxFacadeOptions(!0,!0,Yt);const Nr=de.layout.get("building-facade-window").evaluate(D,{},n);Jt=Nr[0],pi=Nr[1],hi=Math.floor(65535*Math.min(1,ai/lt)),Ei=Math.floor(65535*Math.min(1,ur/lt)),Gi=Math.floor(255*Jt)<<8|Math.floor(255*pi),Ji=Math.floor(65535*Math.min(1,Yt/lt)),Qi=Math.floor(65535*Math.min(1,Mi/lt))}const hr=Array(ie.length),qr={x:1/0,y:1/0},tn={x:-1/0,y:-1/0},Tr={x:0,y:0};let Pr=0;for(let Kt=0;Kt<ie.length;Kt++){const Nr=ie[Kt];if(Nr.length>0){const dr=[],Rr=Array(Nr.length+1);Rr[0]=0;for(let Do=0;Do<Nr.length;Do++){const $n=Nr[Do];for(let ho=0;ho<$n.length;ho++){const Vr=$n[$n.length-ho-1];qr.x=Math.min(qr.x,Vr.x),qr.y=Math.min(qr.y,Vr.y),tn.x=Math.max(tn.x,Vr.x),tn.y=Math.max(tn.y,Vr.y),Tr.x+=Vr.x,Tr.y+=Vr.y,Pr++,dr.push(Vr.x),dr.push(Vr.y)}Rr[Do+1]=dr.length}hr[Kt]={id:D.id?D.id:0,height:Le,minHeight:Ce,sourceId:0,roofType:De,coordinates:dr,ringIndices:Rr}}}Tr.x/=Pr||1,Tr.y/=Pr||1;const zr=u.generateMesh(hr,ft);if(typeof zr=="string"){Ft(`Unable to generate building ${D.id}: ${zr}`),w(Y);continue}if(zr.meshes.length===0||zr.modifiedPolygonRings.length===0){w(Y);continue}const Zt=Bt?this.buildingWithFacade:this.buildingWithoutFacade;let er=0;for(const Kt of zr.meshes)er+=Kt.positions.length/3;const nr=Zt.segmentsBucket.prepareSegment(er,Zt.layoutVertexArray,Zt.indexArray),uo=[];let Tn=null,$r=0,En=-1;const ta=Zt.layoutVertexArray.length,ln=ta+er;Zt.layoutVertexArray.resize(ln),Zt.layoutCentroidArray.resize(ln),Zt.layoutNormalArray.resize(ln),Zt.layoutAOArray.resize(ln),Zt.layoutColorArray.resize(ln),Zt.layoutFloodLightDataArray.resize(ln),Bt&&(Zt.layoutFacadePaintArray.resize(ln),Zt.layoutFacadeDataArray.resize(ln),Zt.layoutFacadeVerticalRangeArray.resize(ln));const Hm=Zt.indexArray.length;let Ju=0,Fn=ta;for(const Kt of zr.meshes){let Nr,dr;if(Kt.buildingPart===1)Nr=Se,dr=Ge;else if(Kt.buildingPart===0)Nr=Oe,dr=qe;else if(Kt.buildingPart===2)Nr=je,dr=mt;else{if(Kt.buildingPart!==3)continue;Nr=_t,dr=st}if(dr=te(dr,0,1),Kt.buildingPart===3){const Er=new Array;for(let un=0;un<Kt.positions.length;un+=12){const Al=Kt.positions[un+0],Zr=Kt.positions[un+1],Hn=Kt.positions[un+3],Xo=Kt.positions[un+4],na=Kt.positions[un+2],py=Kt.positions[un+8]-na,my=1,yf=Hn-Al,eh=Xo-Zr,bs=Math.hypot(yf,eh);Er.push({pos:[Al+.5*yf,Zr+.5*eh,na],normal:[eh/bs,-yf/bs,0],width:bs,height:py,depth:my,points:[Al,Zr,Hn,Xo]})}const Hr=Zt.entranceBloom.segmentsBucket.prepareSegment(10*Er.length,Zt.entranceBloom.layoutVertexArray,Zt.entranceBloom.indexArray),Lr=Zt.entranceBloom.layoutVertexArray.length;$r=Zt.entranceBloom.indexArray.length,c0(Er,.5/this.tileToMeter,Zt.entranceBloom.indexArray,Zt.entranceBloom.layoutVertexArray,Zt.entranceBloom.layoutAttenuationArray);const cn=Zt.entranceBloom.layoutVertexArray.length-Lr;En=Zt.entranceBloom.indexArray.length-$r;for(let un=0;un<cn;un++)Zt.entranceBloom.layoutColorArray.emplaceBack(255*_t.r<<8|255*_t.g,255*_t.b<<8|51*st);Hr.vertexLength+=cn,Hr.primitiveLength+=En,Tn={part:Kt.buildingPart,vertexOffset:Lr,vertexLength:cn}}Zt.layoutVertexArray.float32.set(Kt.positions,3*Fn);const Rr=Kt.positions.length/3;for(let Er=0;Er<Rr;++Er){const Hr=3*Er;Ju=Math.max(Ju,Kt.positions[Hr+2]);const Lr=Kt.normals[Hr+1]*bm,cn=Kt.normals[Hr+2]*bm,un=3*(Fn+Er);Zt.layoutNormalArray.int16[un]=Kt.normals[Hr]*bm,Zt.layoutNormalArray.int16[un+1]=Lr,Zt.layoutNormalArray.int16[un+2]=cn;const Al=Kt.ao[Er];Zt.layoutAOArray.uint8[Fn+Er]=255*Al;const Zr=1+(Al-1)*Ne,Hn=255*Nr.b*Zr<<8|255*dr;Zt.layoutColorArray.uint16[2*(Fn+Er)]=255*Nr.r*Zr<<8|255*Nr.g*Zr,Zt.layoutColorArray.uint16[2*(Fn+Er)+1]=Hn}const Do=Math.floor(Tr.x),$n=Math.floor(Tr.y),ho=Math.floor(Le);for(let Er=0;Er<Rr;++Er){const Hr=3*(Fn+Er);Zt.layoutCentroidArray.int16[Hr]=Do,Zt.layoutCentroidArray.int16[Hr+1]=$n,Zt.layoutCentroidArray.int16[Hr+2]=ho}if(Zt.layoutFloodLightDataArray.uint16.fill(Kt.buildingPart===0?Rt:0,Fn,Fn+Rr),Bt){const Er=255*je.r<<8|255*je.g,Hr=255*je.b<<8|255*mt;for(let Lr=0;Lr<Rr;++Lr){const cn=2*(Fn+Lr);Zt.layoutFacadePaintArray.uint16[cn]=Er,Zt.layoutFacadePaintArray.uint16[cn+1]=Hr}for(let Lr=0;Lr<Rr;++Lr)if(Kt.isFauxFacade[Lr]){const cn=Math.min(65535,Math.floor(Kt.uv[2*Lr]*zr.outerRingLength));Zt.layoutFacadeDataArray.emplace(Fn+Lr,1|cn,Gi,Ji,Qi),Zt.layoutFacadeVerticalRangeArray.emplace(Fn+Lr,hi,Ei)}else Zt.layoutFacadeDataArray.emplace(Fn+Lr,0,0,0,0),Zt.layoutFacadeVerticalRangeArray.emplace(Fn+Lr,0,0)}const Vr=nr.vertexLength,gf=Kt.indices.length/3,ra=Zt.indexArray.length;Zt.indexArray.resize(ra+gf);for(let Er=0;Er<gf;++Er){const Hr=3*Er,Lr=3*ra+Hr;Zt.indexArray.uint16[Lr]=Vr+Kt.indices[Hr],Zt.indexArray.uint16[Lr+1]=Vr+Kt.indices[Hr+1],Zt.indexArray.uint16[Lr+2]=Vr+Kt.indices[Hr+2]}Kt.buildingPart!==1&&Kt.buildingPart!==0&&Kt.buildingPart!==2&&Kt.buildingPart!==3||uo.push({part:Kt.buildingPart,vertexOffset:Fn,vertexLength:Kt.positions.length/3}),Fn+=Rr,nr.vertexLength+=Rr,nr.primitiveLength+=Kt.indices.length/3}this.maxHeight=Math.max(this.maxHeight,Ju);const Zm=Zt.indexArray.length-Hm,ia=this.footprintsIndices.length,Da=this.footprintsVertices.length,Il=[],Lo=new Ke(1/0,1/0),Wo=new Ke(-1/0,-1/0),_f=this.groundEffect.vertexArray.length;for(const Kt of zr.modifiedPolygonRings){const Nr=[],dr=new Ke(1/0,1/0),Rr=new Ke(-1/0,-1/0);for(let Do=0;Do<Kt.length;Do+=2){const $n=Kt.length-Do-2;dr.x=Math.min(dr.x,Kt[$n]),dr.y=Math.min(dr.y,Kt[$n+1]),Rr.x=Math.max(Rr.x,Kt[$n]),Rr.y=Math.max(Rr.y,Kt[$n+1]);const ho=new Ke(Kt[$n],Kt[$n+1]);Nr.push(ho),Il.push(ho.x,ho.y),this.footprintsVertices.emplaceBack(ho.x,ho.y)}Lo.x=Math.min(Lo.x,dr.x),Lo.y=Math.min(Lo.y,dr.y),Wo.x=Math.max(Wo.x,Rr.x),Wo.y=Math.max(Wo.y,Rr.y),this.groundEffect.addData(Nr,[dr,Rr],Ve)}const Qu=this.groundEffect.vertexArray.length-_f;this.groundEffect.groundRadiusArray.reserveForAdditional(Qu);for(let Kt=0;Kt<Qu;Kt++)this.groundEffect.groundRadiusArray.emplaceBack(Ue);(qr.x<0||tn.x>lt||qr.y<0||tn.y>lt)&&this.featuresOnBorder.push({featureId:D.id,footprintIndex:this.footprints.length});{const Kt=Lu(Il,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Kt.length),this.footprintsIndices.uint16.set(Kt,ia),this.buildingIds.add(Y??D.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Lo.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Lo.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Wo.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Wo.y);const Nr={footprintVertexOffset:Da,footprintVertexLength:this.footprintsVertices.length-Da,footprintIndexOffset:ia,footprintIndexLength:this.footprintsIndices.length-ia,min:Lo,max:Wo,hiddenFlags:0,indicesOffset:Hm,indicesLength:Zm,bloomIndicesOffset:$r,bloomIndicesLength:En,groundEffectVertexOffset:_f,groundEffectVertexLength:Qu,hasFauxFacade:Bt,height:Ju,promoteId:k,feature:re,parts:uo,buildingBloom:Tn},dr=this.footprints.length;D.id!==void 0&&this.featureFootprintLookup.set(D.id,dr),I(Y,dr),this.footprints.push(Nr)}this.programConfigurations.populatePaintArrays(Zt.layoutVertexArray.length,D,U,{},i.availableImages,n,i.brightness),this.groundEffect.addPaintPropertiesData(D,U,{},i.availableImages,n,i.brightness),i.featureIndex.insert(D,oe,U,G,this.index,ta)}v.forEach(({buildingId:D,footprintIndex:k})=>{b.has(D)&&(this.footprints[k].hiddenFlags|=4)});const O=new Set;this.buildingIds.forEach((D,k,U)=>{b.has(D)||O.add(D)}),this.buildingIds=O,this.groundEffect.prepareBorderSegments()}update(e,i,n,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f),this.groundEffect.update(e,i,u,n,a,h,f),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const i=n=>{n.layoutVertexBuffer=e.createVertexBuffer(n.layoutVertexArray,u0.members),n.layoutNormalBuffer=e.createVertexBuffer(n.layoutNormalArray,PE.members),n.layoutCentroidBuffer=e.createVertexBuffer(n.layoutCentroidArray,RE.members),n.layoutFloodLightDataBuffer=e.createVertexBuffer(n.layoutFloodLightDataArray,FE.members),n.layoutFacadeDataArray&&n.layoutFacadeDataArray.length&&(n.layoutFacadeDataBuffer=e.createVertexBuffer(n.layoutFacadeDataArray,DE.members)),n.layoutFacadeVerticalRangeArray&&n.layoutFacadeVerticalRangeArray.length&&(n.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(n.layoutFacadeVerticalRangeArray,zE.members)),n.entranceBloom.layoutVertexArray.length&&(n.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(n.entranceBloom.layoutVertexArray,u0.members),n.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(n.entranceBloom.layoutAttenuationArray,OE.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=i=>{i.layoutVertexBuffer&&(i.layoutVertexBuffer.destroy(),i.layoutNormalBuffer.destroy(),i.layoutColorBuffer.destroy(),i.segmentsBucket.destroy(),i.indexBuffer&&i.indexBuffer.destroy(),i.entranceBloom.layoutVertexBuffer&&(i.entranceBloom.layoutVertexBuffer.destroy(),i.entranceBloom.layoutColorBuffer.destroy(),i.entranceBloom.layoutAttenuationBuffer.destroy(),i.entranceBloom.indexBuffer.destroy(),i.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,i,n=!0){let a=!1;const u=n?i:0,h=0|(n?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of e){const _=this.footprints[f],g=_.hiddenFlags&h|u;_.hiddenFlags!==g&&(_.hiddenFlags=g,a=!0,this.groundEffect.updateHiddenByLandmarkRange(_.groundEffectVertexOffset,_.groundEffectVertexLength,_.hiddenFlags!==0))}return a&&(this.indexArrayForConflationUploaded=!1),a}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const i=a=>{a.indexArray.length!==0&&(a.indexArrayForConflation.resize(a.indexArray.length),a.indexArrayForConflation.uint16.set(a.indexArray.uint16),a.entranceBloom.indexArrayForConflation.resize(a.entranceBloom.indexArray.length),a.entranceBloom.indexArrayForConflation.uint16.set(a.entranceBloom.indexArray.uint16))};i(this.buildingWithoutFacade),i(this.buildingWithFacade);for(const a of this.footprints){const u=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,h=a.indicesOffset+a.indicesLength;if(a.hiddenFlags!==0){for(let _=a.indicesOffset;_<h;_++)u.indexArrayForConflation.uint16[3*_+0]=0,u.indexArrayForConflation.uint16[3*_+1]=0,u.indexArrayForConflation.uint16[3*_+2]=0;const f=a.bloomIndicesOffset+a.bloomIndicesLength;for(let _=a.bloomIndicesOffset;_<f;_++)u.entranceBloom.indexArrayForConflation.uint16[3*_+0]=0,u.entranceBloom.indexArrayForConflation.uint16[3*_+1]=0,u.entranceBloom.indexArrayForConflation.uint16[3*_+2]=0}}const n=a=>{a.indexArray.length!==0&&(a.indexBuffer?a.indexBuffer.updateData(a.indexArrayForConflation):a.indexBuffer=e.createIndexBuffer(a.indexArrayForConflation,!0),a.entranceBloom.indexBuffer?a.entranceBloom.indexBuffer.updateData(a.entranceBloom.indexArrayForConflation):a.entranceBloom.indexBuffer=e.createIndexBuffer(a.entranceBloom.indexArrayForConflation,!0))};n(this.buildingWithoutFacade),n(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const i=n=>{n.layoutColorBuffer?n.layoutColorBuffer.updateData(n.layoutColorArray):n.layoutColorBuffer=e.createVertexBuffer(n.layoutColorArray,h0.members,!0),n.layoutFacadePaintArray&&(n.layoutFacadePaintBuffer?n.layoutFacadePaintBuffer.updateData(n.layoutFacadePaintArray):n.layoutFacadePaintBuffer=e.createVertexBuffer(n.layoutFacadePaintArray,LE.members,!0)),n.entranceBloom.layoutColorBuffer?n.entranceBloom.layoutColorBuffer.updateData(n.entranceBloom.layoutColorArray):n.entranceBloom.layoutColorBuffer=e.createVertexBuffer(n.entranceBloom.layoutColorArray,h0.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){const n=e.paint.get("building-ambient-occlusion-intensity");for(const a of this.footprints){if(4&a.hiddenFlags)continue;const u=i[a.promoteId],h=a.feature;h.properties["building-part"]="roof";const f=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),_=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="wall";const g=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),v=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="window";const b=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),w=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="door";const I=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),A=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical),R=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const D of a.parts){let k,U=f;D.part===1?(U=f,k=_):D.part===0?(U=g,k=v):D.part===2?(U=b,k=w):D.part===3&&(U=I,k=A),k=te(k,0,1);for(let G=0;G<D.vertexLength;G++){const K=D.vertexOffset+G,Y=1+(R.layoutAOArray.uint8[K]/255-1)*n;R.layoutColorArray.emplace(K,U.r*Y*255<<8|U.g*Y*255,U.b*Y*255<<8|255*k),a.hasFauxFacade&&R.layoutFacadePaintArray.emplace(K,255*b.r<<8|255*b.g,255*b.b<<8|255*w)}}const O=a.buildingBloom;if(O)for(let D=0;D<O.vertexLength;D++)R.entranceBloom.layoutColorArray.emplace(O.vertexOffset+D,255*I.r<<8|255*I.g,255*I.b<<8|51*A)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,i,n){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(lm(this.activeReplacements,a))return;this.activeReplacements=a;for(const h of this.footprints)h.hiddenFlags&=-2;const u=[];for(const h of this.activeReplacements){if(h.order<n)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.footprints)_.min.x>h.max.x||_.max.x<h.min.x||_.min.y>h.max.y||_.max.y<h.min.y||(u.length=0,VE(this.footprintsVertices,_.footprintVertexOffset,_.footprintVertexLength,h.footprintTileId.canonical,e.canonical,u),lg(h.footprint,u,this.footprintsIndices.uint16,_.footprintIndexOffset,_.footprintIndexLength,0,-f)&&(_.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const h of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(h.groundEffectVertexOffset,h.groundEffectVertexLength,h.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(e.id!==void 0){const i=this.featureFootprintLookup.get(e.id);return this.footprints[i]}return null}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+lt)*lt+(i+lt);if(this.footprintLookup.hasOwnProperty(u)){const f=this.footprintLookup[u];return f?{height:f.height,hidden:f.hiddenFlags!==0}:void 0}const h=new Ke(e,i);for(const f of this.footprints)e>f.max.x||f.min.x>e||i>f.max.y||f.min.y>i||f.height<=n||NE(h,this.footprintsVertices.float32.subarray(2*f.footprintVertexOffset,2*(f.footprintVertexOffset+f.footprintVertexLength)),this.footprintsIndices.uint16.subarray(f.footprintIndexOffset,f.footprintIndexOffset+f.footprintIndexLength))&&(n=f.height,this.footprintLookup[u]=f,a=f.hiddenFlags!==0);if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:a};this.footprintLookup[u]=void 0}}function NE(r,e,i){for(let n=0;n<i.length;n+=3){const a=i[n],u=i[n+1],h=i[n+2],f=e[2*a+0],_=e[2*a+1],g=e[2*u+0],v=e[2*u+1],b=e[2*h+0],w=e[2*h+1],I=(f-b)*(r.y-w)-(_-w)*(r.x-b),A=(g-f)*(r.y-_)-(v-_)*(r.x-f);if(I<0!=A<0&&I!==0&&A!==0)continue;const R=(b-g)*(r.y-v)-(w-v)*(r.x-g);if(R===0||R<0==I+A<=0)return!0}return!1}function VE(r,e,i,n,a,u){const h=Math.pow(2,n.z-a.z);for(let f=0;f<i;f++){let _=r.float32[2*(f+e)+0],g=r.float32[2*(f+e)+1];_=(_+a.x*lt)*h-n.x*lt,g=(g+a.y*lt)*h-n.y*lt,u.push(new Ke(_,g))}}let p0,m0;vt(f0,"BuildingBucket",{omit:["layers"]}),vt(Cg,"BuildingGeometry"),vt(Mg,"BuildingBloomGeometry");const UE=ei([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),jE=ei([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:GE}=UE,qE=ei([{name:"a_packed",components:3,type:"Float32"}]),{members:$E}=qE,HE=ei([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:ZE}=HE;class _0{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new xl({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const n=this.getKey(e,i);return this.positions[n]}trim(){const e=this.width,i=this.height=Ze(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,n){const a=[];let u=e.length%2==1?-e[e.length-1]*n:0,h=e[0]*n,f=!0;a.push({left:u,right:h,isDash:f,zeroLength:e[0]===0});let _=e[0];for(let g=1;g<e.length;g++){f=!f;const v=e[g];u=_*n,_+=v,h=_*n,a.push({left:u,right:h,isDash:f,zeroLength:v===0})}return a}addRoundDash(e,i,n){const a=i/2;for(let u=-n;u<=n;u++){const h=this.width*(this.nextRow+n+u);let f=0,_=e[f];for(let g=0;g<this.width;g++){g/_.right>1&&(_=e[++f]);const v=Math.abs(g-_.left),b=Math.abs(g-_.right),w=Math.min(v,b);let I;const A=u/n*(a+1);if(_.isDash){const R=a-Math.abs(A);I=Math.sqrt(w*w+R*R)}else I=a-Math.sqrt(w*w+A*A);this.image.data[h+g]=Math.max(0,Math.min(255,I+128))}}}addRegularDash(e,i){for(let _=e.length-1;_>=0;--_){const g=e[_],v=e[_+1];g.zeroLength?e.splice(_,1):v&&v.isDash===g.isDash&&(v.left=g.left,e.splice(_,1))}const n=e[0],a=e[e.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const u=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const g=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(g,v);this.image.data[u+_]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}addDash(e,i){const n=this.getKey(e,i);if(this.positions[n])return this.positions[n];const a=i==="round",u=a?7:0,h=2*u+1;if(this.nextRow+h>this.height)return Ft("LineAtlas out of space"),null;e.length===0&&e.push(1);let f=0;for(let v=0;v<e.length;v++)e[v]<0&&(Ft("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),f+=e[v];if(f!==0){const v=this.width/f,b=this.getDashRanges(e,this.width,v);a?this.addRoundDash(b,v,u):this.addRegularDash(b,i==="square"?.5*v:0)}const _=this.nextRow+u;this.nextRow+=h;const g={tl:[_,u],br:[f,0]};return this.positions[n]=g,g}}vt(_0,"LineAtlas");const WE=ti.types,XE=Math.cos(Math.PI/180*37.5),YE=Math.cos(Math.PI/180*5);class Pg{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new yd,this.layoutVertexArray2=new wo,this.patternVertexArray=new wo,this.indexArray=new Mr,this.programConfigurations=new E(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Hi,this.maxLineLength=0,this.zOffsetVertexArray=new wo,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){this.hasPattern=X_("line",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("line-sort-key");this.tileToMeter=et(n);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const w=this.layers[0].layout.get("line-z-offset"),I=w.isConstant()&&!w.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&I?"none":"offset",this.elevationType==="offset"&&h==="none"&&Ft(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const _=[];for(const{feature:w,id:I,index:A,sourceLayerIndex:R}of e){const O=this.layers[0]._featureFilter.needGeometry,D=Ht(w,O);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),D,n))continue;
7const k=u?u.evaluate(D,{},n):void 0,U={id:I,properties:w.properties,type:w.type,sourceLayerIndex:R,index:A,geometry:O?D.geometry:Ot(w,n,a),patterns:{},sortKey:k};_.push(U)}u&&_.sort((w,I)=>w.sortKey-I.sortKey);const{lineAtlas:g,featureIndex:v}=i,b=this.addConstantDashes(g);for(const w of _){const{geometry:I,index:A,sourceLayerIndex:R}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const O=Y_("line",this.layers,w,this.zoom,this.pixelRatio,i);this.patternFeatures.push(O)}else this.addFeature(w,I,A,n,g.positions,i.availableImages,i.brightness,i.elevationFeatures);v.insert(e[A].feature,I,A,R,this.index)}}addConstantDashes(e){let i=!1;for(const n of this.layers){const a=n.paint.get("line-dasharray").value,u=n.layout.get("line-cap").value;if(a.kind!=="constant"||u.kind!=="constant")i=!0;else{const h=u.value,f=a.value;if(!f)continue;e.addDash(f,h)}}return i}addFeatureDashes(e,i){const n=this.zoom;for(const a of this.layers){const u=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if(u.kind==="constant"&&h.kind==="constant")continue;let f,_;if(u.kind==="constant"){if(f=u.value,!f)continue}else f=u.evaluate({zoom:n},e);_=h.kind==="constant"?h.value:h.evaluate({zoom:n},e),i.addDash(f,_),e.patterns[a.id]=[i.getKey(f,_)]}}update(e,i,n,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,_)}addFeatures(e,i,n,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,n,a,h,e.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,$E)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,ZE)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,jE.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,GE),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,i){let n,a;if(i&&i>0?(n=`mapbox_clip_start_${i}`,a=`mapbox_clip_end_${i}`):(n="mapbox_clip_start",a="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(n)&&e.properties.hasOwnProperty(a))return{start:+e.properties[n],end:+e.properties[a]}}addFeature(e,i,n,a,u,h,f,_){const g=this.layers[0].layout,v=g.get("line-join").evaluate(e,{}),b=g.get("line-cap").evaluate(e,{}),w=g.get("line-miter-limit"),I=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const A=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=g.get("line-z-offset").value;const R=this.layers[0].paint.get("line-width").value;if(R.kind!=="constant"&&R.isLineProgressConstant===!1&&(this.variableWidthValue=R),this.elevationType==="road"){const O=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,_,v,b,w,I)){const[D,k]=this.clipRuntimeLinesToTile(i,1);for(let U=0;U<D.length;U++){const G=D[U],K=k[U],Y={progress:{min:K.progress.min,max:K.progress.max},nextDir:this.computeSegNextDir(K,G),prevDir:this.computeSegPrevDir(K,G)};this.addLine(G,e,a,v,b,w,I,Y,A&&K.parentIndex>0?K.parentIndex:null)}this.fillNonElevatedRoadSegment(O)}}else for(let O=0;O<i.length;O++)this.addLine(i[O],e,a,v,b,w,I,void 0,A&&O>0?O:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,u,h,a,f,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return hm(e,-i,-i,lt+i,lt+i)}clipRuntimeLinesToTile(e,i){const n=[];return[hm(e,-i,-i,lt+i,lt+i,n),n]}addElevatedRoadFeature(e,i,n,a,u,h,f,_){const g=[],v=vn.getElevationFeature(e,a);if(v){const b=this.clipLinesToTile(i,1),w=this.prepareElevatedLines(b,v,n);for(const I of w)g.push({geometry:I,elevation:v,elevationTileID:n,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(g.length===0)return!1;for(const b of g){const w=this.layoutVertexArray.length;this.addLine(b.geometry,e,n,u,h,f,_);const I=new To(n,b.elevationTileID);if(b.elevation)for(let A=w;A<this.layoutVertexArray.length;A++){const R=new Ke(this.layoutVertexArray.int16[6*A]>>1,this.layoutVertexArray.int16[6*A+1]>>1),O=I.pointElevation(R,b.elevation,.05);this.updateHeightRange(O),this.zOffsetVertexArray.emplaceBack(O,0,0)}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,i,n){if(i.constantHeight!=null)return e;const a=[],u=1/et(n);for(const h of e)nE(h,new Un(i,u),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,n,a,u,h,f,_,g){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineS
vendor: 4,169 bytes, line 7
7oFar=0,this.currentVertex=void 0,this.lineClips=g?this.lineFeatureClips(i,g):this.lineClips;const v=a==="none";this.patternJoinNone=this.hasPattern&&v,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const b=_&&_.progress.min>0,w=_&&_.progress.max<1;if(this.lineClips){let ie={min:this.lineClips.start,max:this.lineClips.end},ce=1;if(_){const Ce=this.lineClips.end-this.lineClips.start;ie=(function(Le,Ue,Ne){return{min:Ur(Le.min,Ue,Ne),max:Ur(Le.max,Ue,Ne)}})(_.progress,{min:0,max:1},ie),Ce>0&&(ce=(ie.max-ie.min)/Ce)}const de=+i.properties.mapbox_clip_feature_len,De=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(de)||Number.isNaN(De)){for(let Le=0;Le<e.length-1;Le++)this.totalDistance+=e[Le].dist(e[Le+1]);const Ce=this.totalDistance/(ie.max-ie.min);this.totalFeatureLength=Number.isFinite(Ce)?Ce:0,this.lineClips.start=ie.min,this.lineClips.end=ie.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=de,this.distance=De*ce,this.lineClips.start=ie.min,this.lineClips.end=ie.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const I=WE[i.type]==="Polygon";let A=e.length;for(;A>=2&&e[A-1].equals(e[A-2]);)A--;let R=0;for(;R<A-1&&e[R].equals(e[R+1]);)R++;if(A<(I?3:2))return;a==="bevel"&&(h=1.05);const O=this.segments.prepareSegment(10*A,this.layoutVertexArray,this.indexArray);let D,k,U,G,K,Y,re,oe;_&&_.prevDir&&(Y=_.prevDir.perp()),_&&_.nextDir&&(re=_.nextDir.perp()),this.e1=this.e2=-1,I&&(D=e[A-2],K=e[R].sub(D)._unit()._perp());for(let ie=R;ie<A;ie++){if(U=ie===A-1?I?e[R+1]:void 0:e[ie+1],U&&e[ie].equals(U))continue;K&&(G=K),D&&(k=D),D=e[ie],oe=this.evaluateLineProgressFeatures(k?k.dist(D):0),K=U?U.sub(D)._unit()._perp():G,G=G||K;const ce=k&&U;let de=ce?a:I||v?"butt":u;const De=G.x*K.x+G.y*K.y;if(v){const Oe=function(qe){if(qe.patternJoinNone){const je=qe.segmentPoints.length/2,mt=qe.lineSoFar-qe.segmentStart;for(let _t=0;_t<je;++_t){const st=qe.segmentPoints[2*_t+1],ct=Math.round(qe.segmentPoints[2*_t])+.5+.25*st;qe.patternVertexArray.emplaceBack(ct,mt,qe.segmentStart),qe.patternVertexArray.emplaceBack(ct,mt,qe.segmentStart)}qe.segmentPoints.length=0}qe.e1=qe.e2=-1};if(ce&&De<YE){this.updateDistance(k,D),this.addCurrentVertex(D,G,1,1,O,oe),Oe(this),this.addCurrentVertex(D,K,-1,-1,O,oe);continue}if(k){if(!U){this.updateDistance(k,D),this.addCurrentVertex(D,G,1,1,O,oe),Oe(this);continue}de="miter"}}let Ce=G.add(K);Ce.x===0&&Ce.y===0||Ce._unit();const Le=Ce.x*K.x+Ce.y*K.y,Ue=Le!==0?1/Le:1/0,Ne=2*Math.sqrt(2-2*Le),Ve=Le<XE&&k&&U,Se=G.x*K.y-G.y*K.x>0,Ge=this.overscaling<=16?122880/(512*this.overscaling):0;if(ce&&de==="round"){if(Ue<f)de="miter";else if(Ue<=2){const Oe=Rg(D,-10,8202);de=this.elevationType==="offset"&&(Oe||this.hasCrossSlope)?"miter":"fakeround"}}if(de==="miter"&&Ue>h&&(de="bevel"),de==="bevel"&&(Ue>2&&(de="flipbevel"),Ue<h&&(de="miter")),k&&!(de==="miter"&&Ve)&&this.updateDistance(k,D),de==="miter")if(Ve){const Oe=D.dist(k);if(Oe>2*Ge){const je=D.sub(D.sub(k)._mult(Ge/Oe)._round());this.updateDistance(k,je),this.addCurrentVertex(je,G,0,0,O,oe),k=je}this.updateDistance(k,D),Ce._mult(Ue),this.addCurrentVertex(D,Ce,0,0,O,oe);const qe=D.dist(U);if(qe>2*Ge){const je=D.add(U.sub(D)._mult(Ge/qe)._round());this.updateDistance(D,je),this.addCurrentVertex(je,K,0,0,O,oe),D=je}}else Ce._mult(Ue),this.addCurrentVertex(D,Ce,0,0,O,oe);else if(de==="flipbevel"){if(Ue>100)Ce=K.mult(-1);else{const Oe=Ue*G.add(K).mag()/G.sub(K).mag();Ce._perp()._mult(Oe*(Se?-1:1))}this.addCurrentVertex(D,Ce,0,0,O,oe),this.addCurrentVertex(D,Ce.mult(-1),0,0,O,oe)}else if(de==="bevel"||de==="fakeround"){oe!=null&&k&&this.addCurrentVertex(D,re||G,-1,-1,O,oe);const Oe=D.dist(k)<=2*Ge&&de!=="bevel",qe=Ce.mult(Se?1:-1);qe._mult(Ue);const je=K.mult(Se?-1:1),mt=G.mult(Se?-1:1),_t=this.evaluateLineProgressFeatures(this.distance);if(oe==null&&(this.addHalfVertex(D,qe.x,qe.y,!1,!Se,0,O,_t),Oe||this.addHalfVertex(D,qe.x+2*mt.x,qe.y+2*mt.y,!1,Se,0,O,_t)),de==="fakeround"){const st=Math.round(180*Ne/Math.PI/20);this.addHalfVertex(D,mt.x,mt.y,!1,Se,0,O,_t);for(let ct=0;ct<st;ct++){let Rt=ct/st;
7if(Rt!==.5){const ft=Rt-.5;Rt+=Rt*ft*(Rt-1)*((1.0904+De*(De*(3.55645-1.43519*De)-3.2452))*ft*ft+(.848013+De*(.215638*De-1.06021)))}const St=je.sub(mt)._mult(Rt)._add(mt)._unit();this.addHalfVertex(D,St.x,St.y,!1,Se,0,O,_t)}this.addHalfVertex(D,je.x,je.y,!1,Se,0,O,_t)}Oe||oe!=null||this.addHalfVertex(D,qe.x+2*je.x,qe.y+2*je.y,!1,Se,0,O,_t),oe!=null&&U&&this.addCurrentVertex(D,Y||K,1,1,O,oe)}else if(de==="butt")this.addCurrentVertex(D,Ce,0,0,O,oe);else if(de==="square"){if(!k){const Oe=b?0:-1;this.addCurrentVertex(D,Ce,Oe,Oe,O,oe)}if(this.addCurrentVertex(D,Ce,0,0,O,oe),k){const Oe=w?0:1;this.addCurrentVertex(D,Ce,Oe,Oe,O,oe)}}else if(de==="round"){if(k){const Oe=!ce&&re?re:G;this.addCurrentVertex(D,Oe,0,0,O,oe),!ce&&w||this.addCurrentVertex(D,Oe,1,1,O,oe,!0)}if(U){const Oe=!ce&&Y?Y:K;!ce&&b||this.addCurrentVertex(D,Oe,-1,-1,O,oe,!0),this.addCurrentVertex(D,Oe,0,0,O,oe)}}}}addVerticesTo(e,i,n,a,u,h,f,_,g,v){const b=(i.w-e.w)/this.tessellationStep|0;let w=0;const I=this.scaledDistance;if(b>1){this.lineSoFar=e.w;const R=(i.x-e.x)/b,O=(i.y-e.y)/b,D=(i.z-e.z)/b,k=(i.w-e.w)/b;for(let U=1;U<b;++U){e.x+=R,e.y+=O,e.z+=D,this.lineSoFar+=k,w+=k;const G=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,n,a,v,!1,f,g,G),this.addHalfVertex(e,u,h,v,!0,-_,g,G)}}this.lineSoFar=i.w,this.scaledDistance=I;const A=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,n,a,v,!1,f,g,A),this.addHalfVertex(i,u,h,v,!0,-_,g,A)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):Ft(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,n,a,u,h,f=!1){const _=i.x+i.y*n,g=i.y-i.x*n,v=i.y*a-i.x,b=-i.y-i.x*a;if(h!=null){const w=this.elevationType==="offset",I=-10,A=8202,R=h.zOffset,O=new Lv(e.x,e.y,R,this.lineSoFar),D=!!w&&Rg(e,I,A),k=this.lineS
7oFar,U=this.distance;if(this.currentVertex)if(D){const G=this.currentVertexIsOutside,K=this.currentVertex,Y=new Lv(e.x,e.y,R,this.lineSoFar);if(zv(K,Y,I,A),!Rg(Y,I,A)){if(G){this.e1=this.e2=-1,this.distance-=K.dist(O),this.lineSoFar=K.w;const re=this.evaluateLineProgressFeatures(K.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(K,_,g,f,!1,n,u,re),this.addHalfVertex(K,v,b,f,!0,-a,u,re),this.prevDistance=this.distance}this.distance=this.prevDistance+K.dist(Y),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(K,Y,_,g,v,b,n,a,u,f),this.distance=U,this.scaledDistance=this.distance/this.totalDistance}}else{const G=this.currentVertex;if(this.currentVertexIsOutside){zv(G,O,I,A),this.e1=this.e2=-1,this.distance-=G.dist(O),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=G.w;const K=this.evaluateLineProgressFeatures(G.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(G,_,g,f,!1,n,u,K),this.addHalfVertex(G,v,b,f,!0,-a,u,K),this.prevDistance=this.distance,this.distance=U,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(G,O,_,g,v,b,n,a,u,f)}else D||(this.addHalfVertex(e,_,g,f,!1,n,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h));this.currentVertex=O,this.currentVertexIsOutside=D,this.lineSoFar=k}else this.addHalfVertex(e,_,g,f,!1,n,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h)}addHalfVertex({x:e,y:i},n,a,u,h,f,_,g){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*n)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=Dt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),h?this.e2=v:this.e1=v,g!=null&&this.zOffsetVertexArray.emplaceBack(g.zOffset,g.variableWidth,g.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function Rg(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let g0,y0;function x0(r,e,i){return e*(lt/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}vt(Pg,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const v0=(r,e,i)=>(1-i)*r+i*e;function b0(r,e){return 1/x0(r,1,e.tileZoom)}function w0(r,e,i,n){return r.translatePosMatrix(n||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const T0=r=>{const e=[];E0(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const n=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return n&&a&&e.push("LINE_JOIN_NONE"),e};function E0(r){const e=r.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let Lg;const S0=()=>Lg||(Lg={layout:g0||(g0=new ir({"line-cap":new ht(be.layout_line["line-cap"]),"line-join":new ht(be.layout_line["line-join"]),"line-miter-limit":new it(be.layout_line["line-miter-limit"]),"line-round-limit":new it(be.layout_line["line-round-limit"]),"line-sort-key":new ht(be.layout_line["line-sort-key"]),"line-z-offset":new ht(be.layout_line["line-z-offset"]),"line-elevation-reference":new it(be.layout_line["line-elevation-reference"]),"line-cross-slope":new it(be.layout_line["line-cross-slope"]),visibility:new it(be.layout_line.visibility),"line-width-unit":new it(be.layout_line["line-width-unit"])})),paint:y0||(y0=new ir({"line-opacity":new ht(be.paint_line["line-opacity"]),"line-color":new ht(be.paint_line["line-color"]),"line-translate":new it(be.paint_line["line-translate"]),"line-translate-anchor":new it(be.paint_line["line-translate-anchor"]),"line-width":new ht(be.paint_line["line-width"]),"line-gap-width":new ht(be.paint_line["line-gap-width"]),"line-offset":new ht(be.paint_line["line-offset"]),"line-blur"
vendor: 5,346 bytes, line 7
7:new ht(be.paint_line["line-blur"]),"line-dasharray":new ht(be.paint_line["line-dasharray"]),"line-pattern":new ht(be.paint_line["line-pattern"]),"line-pattern-cross-fade":new it(be.paint_line["line-pattern-cross-fade"]),"line-gradient":new cl(be.paint_line["line-gradient"]),"line-trim-offset":new it(be.paint_line["line-trim-offset"]),"line-trim-fade-range":new it(be.paint_line["line-trim-fade-range"]),"line-trim-color":new it(be.paint_line["line-trim-color"]),"line-emissive-strength":new ht(be.paint_line["line-emissive-strength"]),"line-border-width":new ht(be.paint_line["line-border-width"]),"line-border-color":new ht(be.paint_line["line-border-color"]),"line-occlusion-opacity":new it(be.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},Lg);class KE extends ht{possiblyEvaluate(e,i){return i=new Ai(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,n,a){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,n,a)}}let Wd;function I0(r,e){return e>0?e+2*r:r}const JE=ei([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),QE=ei([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),eS=ei([{name:"a_projected_pos",components:4,type:"Float32"}],4);ei([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const tS=ei([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),iS=ei([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),rS=ei([{name:"a_texb",components:2,type:"Uint16"}]),nS=ei([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),oS=ei([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);ei([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const A0=ei([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),sS=ei([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ei([{name:"triangle",components:3,type:"Uint16"}]),ei([{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"}]),ei([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
vendor: 10,465 bytes, line 7
7]),ei([{type:"Float32",name:"offsetX"}]),ei([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Br=24;function aS(r,e,i){return r.sections.forEach(n=>{n.text=(function(a,u,h){const f=u.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),Co.applyArabicShaping&&(a=Co.applyArabicShaping(a)),a})(n.text,e,i)}),r}const Xd={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function lS(r){return r==="︶"||r==="ï¹"||r==="︸"||r==="ï¹"||r==="ï¹"||r==="︾"||r==="︼"||r==="︺"||r==="ï¸"||r==="ï¹"||r==="ï¸"||r==="ï¸"||r==="ï¸"||r==="ï½"||r==="ï¿£"||r==="ï¸"||r==="ï¸"}function cS(r){return r==="︵"||r==="ï¹"||r==="︷"||r==="ï¹"||r==="ï¹"||r==="︽"||r==="︻"||r==="︹"||r==="ï¸"||r==="︿"}const Dg=4294967296,M0=1/Dg,C0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let wm=class{constructor(r=new Uint8Array(16)){this.buf=ArrayBuffer.isView(r)?r:new Uint8Array(r),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(r,e,i=this.length){for(;this.pos<i;){const n=this.readVarint(),a=n>>3,u=this.pos;this.type=7&n,r(a,e,this),this.pos===u&&this.skip(n)}return e}readMessage(r,e){return this.readFields(r,e,this.readVarint()+this.pos)}readFixed32(){const r=this.dataView.getUint32(this.pos,!0);return this.pos+=4,r}readSFixed32(){const r=this.dataView.getInt32(this.pos,!0);return this.pos+=4,r}readFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Dg;return this.pos+=8,r}readSFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Dg;return this.pos+=8,r}readFloat(){const r=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,r}readDouble(){const r=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,r}readVarint(r){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,(function(a,u,h){const f=h.buf;let _,g;if(g=f[h.pos++],_=(112&g)>>4,g<128||(g=f[h.pos++],_|=(127&g)<<3,g<128)||(g=f[h.pos++],_|=(127&g)<<10,g<128)||(g=f[h.pos++],_|=(127&g)<<17,g<128)||(g=f[h.pos++],_|=(127&g)<<24,g<128)||(g=f[h.pos++],_|=(1&g)<<31,g<128))return Uu(a,_,u);throw new Error("Expected varint not more than 10 bytes")})(i,r,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const r=this.readVarint();return r%2==1?(r+1)/-2:r/2}readBoolean(){return!!this.readVarint()}readString(){const r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&C0?C0.decode(this.buf.subarray(e,r)):(function(i,n,a){let u="",h=n;for(;h<a;){const f=i[h];let _,g,v,b=null,w=f>239?4:f>223?3:f>191?2:1;if(h+w>a)break;w===1?f<128&&(b=f):w===2?(_=i[h+1],(192&_)==128&&(b=(31&f)<<6|63&_,b<=127&&(b=null))):w===3?(_=i[h+1],g=i[h+2],(192&_)==128&&(192&g)==128&&(b=(15&f)<<12|(63&_)<<6|63&g,(b<=2047||b>=55296&&b<=57343)&&(b=null))):w===4&&(_=i[h+1],g=i[h+2],v=i[h+3],(192&_)==128&&(192&g)==128&&(192&v)==128&&(b=(15&f)<<18|(63&_)<<12|(63&g)<<6|63&v,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,w=1):b>65535&&(b-=65536,u+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),u+=String.fromCharCode(b),h+=w}return u})(this.buf,e,r)}readBytes(){const r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e}readPackedVarint(r=[],e){const i=this.readPackedEnd();for(;this.pos<i;)r.push(this.readVarint(e));return r}readPackedSVarint(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSVarint());return r}readPackedBoolean(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readBoolean());return r}readPackedFloat(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFloat());return r}readPackedDouble(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readDouble());return r}readPackedFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed32());return r}readPackedSFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed32());return r}readPackedFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed64());return r}readPackedSFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed64());return r}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(r){const e=7&r;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(r,e){this.writeVarint(r<<3|e)}realloc(r){let e=this.length||16;for(;e<this.pos+r;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeSFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*M0),!0),this.pos+=8}writeSFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*M0),!0),this.pos+=8}writeVarint(r){(r=+r||0)>268435455||r<0?(function(e,i){let n,a;if(e>=0?(n=e%4294967296|0,a=e/4294967296|0):(n=~(-e%4294967296),a=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),(function(u,h,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)})(n,0,i),(function(u,h){const f=(7&u)<<4;h.buf[h.pos++]|=f|((u>>>=3)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u)))))})(a,i)})(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))}writeSVarint(r){this.writeVarint(r<0?2*-r-1:2*r)}writeBoolean(r){this.writeVarint(+r)}writeString(r){r=String(r),this.realloc(4*r.length),this.pos++;const e=this.pos;this.pos=(function(n,a,u){for(let h,f,_=0;_<a.length;_++){if(h=a.charCodeAt(_),h>55295&&h<57344){if(!f){h>56319||_+1===a.length?(n[u++]=239,n[u++]=191,n[u++]=189):f=h;continue}if(h<56320){n[u++]=239,n[u++]=191,n[u++]=189,f=h;continue}h=f-55296<<10|h-56320|65536,f=null}else f&&(n[u++]=239,n[u++]=191,n[u++]=189,f=null);h<128?n[u++]=h:(h<2048?n[u++]=h>>6|192:(h<65536?n[u++]=h>>12|224:(n[u++]=h>>18|240,n[u++]=h>>12&63|128),n[u++]=h>>6&63|128),n[u++]=63&h|128)}return u})(this.buf,r,this.pos);const i=this.pos-e;i>=128&&P0(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(r){this.realloc(4),this.dataView.setFloat32(this.pos,r,!0),this.pos+=4}writeDouble(r){this.realloc(8),this.dataView.setFloat64(this.pos,r,!0),this.pos+=8}writeBytes(r){const e=r.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=r[i]}writeRawMessage(r,e){this.pos++;const i=this.pos;r(e,this);const n=this.pos-i;n>=128&&P0(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(r,e,i){this.writeTag(r,2),this.writeRawMessage(e,i)}writePackedVarint(r,e){e.length&&this.writeMessage(r,uS,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,hS,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,pS,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,dS,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,fS,e)}writePackedFixed32(r,e){e.length&&this.writeMessage(r,mS,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,_S,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,gS,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,yS,e)}writeBytesField(r,e){this.writeTag(r,2),this.writeBytes(e)}writeFixed32Field(r,e){this.writeTag(r,5),this.writeFixed32(e)}writeSFixed32Field(r,e){this.writeTag(r,5),this.writeSFixed32(e)}writeFixed64Field(r,e){this.writeTag(r,1),this.writeFixed64(e)}writeSFixed64Field(r,e){this.writeTag(r,1),this.writeSFixed64(e)}writeVarintField(r,e){this.writeTag(r,0),this.writeVarint(e)}writeSVarintField(r,e){this.writeTag(r,0),this.writeSVarint(e)}writeStringField(r,e){this.writeTag(r,2),this.writeString(e)}writeFloatField(r,e){this.writeTag(r,5),this.writeFloat(e)}writeDoubleField(r,e){this.writeTag(r,1),this.writeDouble(e)}writeBooleanField(r,e){this.writeVarintField(r,+e)}};function Uu(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function P0(r,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let a=i.pos-1;a>=r;a--)i.buf[a+n]=i.buf[a]}function uS(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function hS(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function dS(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function fS(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function pS(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function mS(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function _S(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function gS(r,e){for(let i=0;i<r.length;
7i++)e.writeFixed64(r[i])}function yS(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function xS(r,e,i){e.glyphs=[],r===1&&i.readMessage(vS,e)}function vS(r,e,i){if(r===3){const{id:n,bitmap:a,width:u,height:h,left:f,top:_,advance:g}=i.readMessage(bS,{});e.glyphs.push({id:n,bitmap:new xl({width:u+6,height:h+6},a),metrics:{width:u,height:h,left:f,top:_,advance:g}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function bS(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}const co={horizontal:1,vertical:2,horizontalOnly:3};class Yd{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const n=new Yd;return n.scale=e||1,n.fontStack=i,n}static forImage(e){const i=new Yd;return i.image=e,i}}class ju{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,n){const a=new ju;for(let u=0;u<e.sections.length;u++){const h=e.sections[u];h.image?a.addImageSection(h,n):a.addTextSection(h,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=(function(i,n){let a="";for(let u=0;u<i.length;u++){const h=i.charCodeAt(u+1)||null,f=i.charCodeAt(u-1)||null;a+=!n&&(h&&rd(h)&&!Xd[i[u+1]]||f&&rd(f)&&!Xd[i[u-1]])||!Xd[i[u]]?i[u]:Xd[i[u]]}return a})(this.text,e)}trim(){let e=0;for(let n=0;n<this.text.length&&Tm[this.text.charCodeAt(n)];n++)e++;let i=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Tm[this.text.charCodeAt(n)];n--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const n=new ju;return n.text=this.text.substring(e,i),n.sectionIndex=this.sectionIndex.slice(e,i),n.sections=this.sections,n}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(Yd.forText(e.scale,e.fontStack||i));const n=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(n)}addImageSection(e,i){const n=e.image?e.image.getPrimary():null;if(!n)return void Ft("Can't add FormattedSection with an empty image.");n.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(Yd.forImage(n)),this.sectionIndex.push(this.sections.length-1)):Ft("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function zg(r,e,i,n,a,u,h,f,_,g,v,b,w,I,A,R=1){const O=ju.fromFeature(r,a,R);b===co.vertical&&O.verticalizePunctuation(w);let D=[];const k=(function(re,oe,ie,ce,de,De){if(!re)return[];const Ce=[],Le=(function(Ve,Se,Ge,Oe,qe,je){let mt=0;for(let _t=0;_t<Ve.length();_t++){const st=Ve.getSection(_t);mt+=R0(Ve.getCodePoint(_t),st,Oe,qe,Se,je)}return mt/Math.max(1,Math.ceil(mt/Ge))})(re,oe,ie,ce,de,De),Ue=re.text.indexOf("â")>=0;let Ne=0;for(let Ve=0;Ve<re.length();Ve++){const Se=re.getSection(Ve),Ge=re.getCodePoint(Ve);if(Tm[Ge]||(Ne+=R0(Ge,Se,ce,de,oe,De)),Ve<re.length()-1){const Oe=yp(Ge);(wS[Ge]||Oe||Se.image)&&Ce.push(D0(Ve+1,Ne,Le,Ce,TS(Ge,re.getCodePoint(Ve+1),Oe&&Ue),!1))}}return z0(D0(re.length(),Ne,Le,Ce,0,!0))})(O,g,u,e,n,I),{processBidirectionalText:U,processStyledBidirectionalText:G}=Co;if(U&&O.sections.length===1){const re=U(O.toString(),k);for(const oe of re){const ie=new ju;ie.text=oe,ie.sections=O.sections;for(let ce=0;ce<oe.length;ce++)ie.sectionIndex.push(0);D.push(ie)}}else if(G){const re=G(O.text,O.sectionIndex,k);for(const oe of re){const ie=new ju;ie.text=oe[0],ie.sectionIndex=oe[1],ie.sections=O.sections,D.push(ie)}}else D=(function(re,oe){const ie=[],ce=re.text;let de=0;for(const De of oe)ie.push(re.substring(de,De)),de=De;
7return de<ce.length&&ie.push(re.substring(de,ce.length)),ie})(O,k);const K=[],Y={positionedLines:K,text:O.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if((function(re,oe,ie,ce,de,De,Ce,Le,Ue,Ne,Ve,Se){let Ge=0,Oe=0,qe=0;const je=Le==="right"?1:Le==="left"?0:.5;let mt=!1;for(const St of de){const ft=St.getSections();for(const Bt of ft){if(Bt.image)continue;const Jt=oe[Bt.fontStack];if(Jt&&(mt=Jt.ascender!==void 0&&Jt.descender!==void 0,!mt))break}if(!mt)break}let _t=0;for(const St of de){St.trim();const ft=St.getMaxScale(),Bt=(ft-1)*Br,Jt={positionedGlyphs:[],lineOffset:0};re.positionedLines[_t]=Jt;const pi=Jt.positionedGlyphs;let Yt=0;if(!St.length()){Oe+=De,++_t;continue}let Mi=0,ai=0;for(let hi=0;hi<St.length();hi++){const Ei=St.getSection(hi),Gi=St.getSectionIndex(hi),Ji=St.getCodePoint(hi);let Qi=Ei.scale,hr=null,qr=null,tn=null,Tr=Br,Pr=0,zr=Ue;zr===co.vertical&&xp(Ji)&&(zr=co.horizontal);const Zt=!(zr===co.horizontal||!Ve&&!$s(Ji)||Ve&&(Tm[Ji]||vu(Ji)));if(Ei.image){const er=ce.get(Ei.image.toString());if(!er)continue;tn=Ei.image,re.iconsInText=re.iconsInText||!0,qr=er.paddedRect;const nr=er.displaySize;Qi=Qi*Br/Se,hr={width:nr[0],height:nr[1],left:0,top:-3,advance:Zt?nr[1]:nr[0],localGlyph:!1},Pr=mt?-hr.height*Qi:ft*Br-17-nr[1]*Qi,Tr=hr.advance;const uo=(Zt?nr[0]:nr[1])*Qi-Br*ft;uo>0&&uo>Yt&&(Yt=uo)}else{const er=ie[Ei.fontStack];if(!er)continue;er[Ji]&&(qr=er[Ji]);const nr=oe[Ei.fontStack];if(!nr)continue;const uo=nr.glyphs[Ji];if(!uo)continue;if(hr=uo.metrics,Tr=Ji!==8203?Br:0,mt){const Tn=nr.ascender!==void 0?Math.abs(nr.ascender):0,$r=nr.descender!==void 0?Math.abs(nr.descender):0,En=(Tn+$r)*Qi;Mi<En&&(Mi=En,ai=(Tn-$r)/2*Qi),Pr=-Tn*Qi}else Pr=(ft-Qi)*Br-17}Zt?(re.verticalizable=!0,pi.push({glyph:Ji,image:tn,x:Ge,y:Oe+Pr,vertical:Zt,scale:Qi,localGlyph:hr.localGlyph,fontStack:Ei.fontStack,sectionIndex:Gi,metrics:hr,rect:qr}),Ge+=Tr*Qi+Ne):(pi.push({glyph:Ji,image:tn,x:Ge,y:Oe+Pr,vertical:Zt,scale:Qi,localGlyph:hr.localGlyph,fontStack:Ei.fontStack,sectionIndex:Gi,metrics:hr,rect:qr}),Ge+=hr.advance*Qi+Ne)}pi.length!==0&&(qe=Math.max(Ge-Ne,qe),mt?O0(pi,je,Yt,ai,De*ft/2):O0(pi,je,Yt,0,De/2)),Ge=0;const ur=De*ft+Yt;Jt.lineOffset=Math.max(Yt,Bt),Oe+=ur,++_t}const st=Oe,{horizontalAlign:ct,verticalAlign:Rt}=Og(Ce);(function(St,ft,Bt,Jt,pi,Yt){const Mi=(ft-Bt)*pi,ai=-Yt*Jt;for(const ur of St)for(const hi of ur.positionedGlyphs)hi.x+=Mi,hi.y+=ai})(re.positionedLines,je,ct,Rt,qe,st),re.top+=-Rt*st,re.bottom=re.top+st,re.left+=-ct*qe,re.right=re.left+qe,re.hasBaseline=mt})(Y,e,i,n,D,h,f,_,b,g,w,A),!(function(re){for(const oe of re)if(oe.positionedGlyphs.length!==0)return!1;return!0})(K))return Y}const Tm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},wS={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 R0(r,e,i,n,a,u){if(e.image){const h=n.get(e.image.toString());return h?h.displaySize[0]*e.scale*Br/u+a:0}{const h=i[e.fontStack],f=h&&h.glyphs[r];return f?f.metrics.advance*e.scale+a:0}}function L0(r,e,i,n){const a=Math.pow(r-e,2);return n?r<e?a/2:2*a:a+Math.abs(i)*i}function TS(r,e,i){let n=0;return r===10&&(n-=1e4),i&&(n+=150),r!==40&&r!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function D0(r,e,i,n,a,u){let h=null,f=L0(e,i,a,u);for(const _ of n){const g=L0(e-_.x,i,a,u)+_.badness;g<=f&&(h=_,f=g)}return{index:r,x:e,priorBreak:h,badness:f}}function z0(r){return r?z0(r.priorBreak).concat(r.index):[]}function Og(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function O0(r,e,i,n,a){if(!(e||i||n||a))return;const u=r.length-1,h=r[u],f=(h.x+h.metrics.advance*h.scale)*e;for(let _=0;_<=u;_++)r[_].x-=f,r[_].y+=i+n+a}function Fg(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function Em(r,e,i,n){const{horizontalAlign:a,verticalAlign:u}=Og(n),h=i[0]-r.displaySize[0]*a,f=i[1]-r.displaySize[1]*u;return{imagePrimary:r,imageSecondary:e,top:f,bottom:f+r.displaySize[1],left:h,right:h+r.displaySize[0]}}function kg(r,e,i,n,a,u){const h=r.imagePrimary;let f;if(h.content){const O=h.content,D=h.pixelRatio||1;f=[O[0]/D,O[1]/D,h.displaySize[0]-O[2]/D,h.displaySize[1]-O[3]/D]}const _=e.left*u,g=e.right*u;let v,b,w,I;i==="width"||i==="both"?(I=a[0]+_-n[3],b=a[0]+g+n[1]):(I=a[0]+(_+g-h.displaySize[0])/2,b=I+h.displaySize[0]);const A=e.top*u,R=e.bottom*u;return i==="height"||i==="both"?(v=a[1]+A-n[0],w=a[1]+R+n[2]):(v=a[1]+(A+R-h.displaySize[1])/2,w=v+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:v,right:b,bottom:w,left:I,collisionPadding:f}}function F0(r){return!r.imagePrimary.stretchX}function k0(r){return!r.imagePrimary.stretchY}function B0(r){return{width:r.right-r.left,height:r.bottom-r.top}}const Ra=128;function Mc(r,e,i,n){const{expression:a}=e;if(a.kind==="constant")return{kind:"constant",layoutSize:a.evaluate(new Ai(r+1,{worldview:i}),void 0,void 0,void 0,n)};if(a.kind==="source")return{kind:"source"};{const{zoomStops:u,interpolationType:h}=a;let f=0;for(;f<u.length&&u[f]<=r;)f++;f=Math.max(0,f-1);let _=f;for(;_<u.length&&u[_]<r+1;)_++;_=Math.min(u.length-1,_);const g=u[f],v=u[_];return a.kind==="composite"?{kind:"composite",minZoom:g,maxZoom:v,interpolationType:h}:{kind:"camera",minZoom:g,maxZoom:v,minSize:a.evaluate(new Ai(g,{worldview:i}),void 0,void 0,void 0,n),maxSize:a.evaluate(new Ai(v,{worldview:i}),void 0,void 0,void 0,n),interpolationType:h}}}function Bg(r,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:a}){return r.kind==="source"?n/Ra:r.kind==="composite"?Dt(n/Ra,a/Ra,i):e}function Gu(r,e,i=1){let n=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:u,minZoom:h,maxZoom:f}=r,_=u?te(io.interpolationFactor(u,e,h,f),0,1):0;r.kind==="camera"?a=Dt(r.minSize,r.maxSize,_)*i:n=_*i}return{uSizeT:n,uSize:a}}class La extends Ke{constructor(e,i,n,a,u){super(e,i),this.angle=a,this.z=n,u!==void 0&&(this.segment=u)}
vendor: 14,075 bytes, line 7
7clone(){return new La(this.x,this.y,this.z,this.angle,this.segment)}}function N0(r,e,i,n,a){if(e.segment===void 0)return!0;let u=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(u),u=r[h]}f+=r[h].dist(r[h+1]),h++;const _=[];let g=0;for(;f<i/2;){const v=r[h],b=r[h+1];if(!b)return!1;let w=r[h-1].angleTo(v)-v.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:w}),g+=w;f-_[0].distance>n;)g-=_.shift().angleDelta;if(g>a)return!1;h++,f+=v.dist(b)}return!0}function V0(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function U0(r,e,i){return r?.6*e*i:0}function j0(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function ES(r,e,i,n,a,u){const h=U0(i,a,u),f=j0(i,n)*u;let _=0;const g=V0(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],w=r[v+1],I=b.dist(w);if(_+I>g){const A=(g-_)/I,R=Dt(b.x,w.x,A),O=Dt(b.y,w.y,A),D=new La(R,O,0,w.angleTo(b),v);return!h||N0(r,D,f,h,e)?D:void 0}_+=I}}function SS(r,e,i,n,a,u,h,f,_){const g=U0(n,u,h),v=j0(n,a),b=v*h,w=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),G0(r,w?e/2*f%e:(v/2+2*u)*h*f%e,e,g,i,b,w,!1,_)}function G0(r,e,i,n,a,u,h,f,_){const g=u/2,v=V0(r);let b=0,w=e-i,I=[];for(let A=0;A<r.length-1;A++){const R=r[A],O=r[A+1],D=R.dist(O),k=O.angleTo(R);for(;w+i<b+D;){w+=i;const U=(w-b)/D,G=Dt(R.x,O.x,U),K=Dt(R.y,O.y,U);if(G>=0&&G<_&&K>=0&&K<_&&w-g>=0&&w+g<=v){const Y=new La(G,K,0,k,A);n&&!N0(r,Y,u,n,a)||I.push(Y)}}b+=D}return f||I.length||h||(I=G0(r,b/2,i,n,a,u,h,!0,_)),I}function q0(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort((h,f)=>f.h-h.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,u=0;for(const h of r)for(let f=n.length-1;f>=0;f--){const _=n[f];if(!(h.w>_.w||h.h>_.h)){if(h.x=_.x,h.y=_.y,u=Math.max(u,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===_.w&&h.h===_.h){const g=n.pop();g&&f<n.length&&(n[f]=g)}else h.h===_.h?(_.x+=h.w,_.w-=h.w):h.w===_.w?(_.y+=h.h,_.h-=h.h):(n.push({x:_.x+h.w,y:_.y,w:_.w-h.w,h:h.h}),_.y+=h.h,_.h-=h.h);break}}return{w:a,h:u,fill:e/(a*u)||0}}vt(La,"Anchor");class Kd{static getImagePositionScale(e,i,n){if(i&&e){const{sx:a,sy:u}=e;return{x:a,y:u}}return{x:n,y:n}}constructor(e,i,n,a){this.paddedRect=e;const{pixelRatio:u,version:h,stretchX:f,stretchY:_,content:g,sdf:v,usvg:b}=i;this.pixelRatio=u,this.stretchX=f,this.stretchY=_,this.content=g,this.version=h,this.padding=n,this.sdf=v,this.usvg=b,this.scale=Kd.getImagePositionScale(a,b,u)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function Ng(r,e,i){const n=Rn.parse(r),a=(function(u,h,f=[1,1]){return{x:0,y:0,w:(u.data?u.data.width:u.width*f[0])+2*h,h:(u.data?u.data.height:u.height*f[1])+2*h}})(e,i,[n.sx,n.sy]);return{bin:a,imagePosition:new Kd(a,e,i,n),imageVariant:n}}class $0{constructor(e,i,n){const a=new Map,u=new Map;this.haveRenderCallbacks=[];const h=[];this.addImages(e,a,1,h),this.addImages(i,u,2,h);const{w:f,h:_}=q0(h),g=new en({width:f||1,height:_||1});for(const[v,b]of e.entries()){const w=a.get(v).paddedRect;en.copy(b.data,g,{x:0,y:0},{x:w.x+1,y:w.y+1},b.data,null,b.sdf)}for(const[v,b]of i.entries()){const w=u.get(v),I=w.paddedRect;let A=w.padding;const R=I.x+A,O=I.y+A,D=b.data.width,k=b.data.height;A=A>1?A-1:A,en.copy(b.data,g,{x:0,y:0},{x:R,y:O},b.data,n),en.copy(b.data,g,{x:0,y:k-A},{x:R,y:O-A},{width:D,height:A},n),en.copy(b.data,g,{x:0,y:0},{x:R,y:O+k},{width:D,height:A},n),en.copy(b.data,g,{x:D-A,y:0},{x:R-A,y:O},{width:A,height:k},n),en.copy(b.data,g,{x:0,y:0},{x:R+D,y:O},{width:A,height:k},n),en.copy(b.data,g,{x:D-A,y:k-A},{x:R-A,y:O-A},{width:A,height:A},n),en.copy(b.data,g,{x:0,y:k-A},{x:R+D,y:O-A},{width:A,height:A},n),en.copy(b.data,g,{x:0,y:0},{x:R+D,y:O+k},{width:A,height:A},n),en.copy(b.data,g,{x:D-A,y:0},{x:R-A,y:O+k},{width:A,height:A},n)}this.lut=n,this.image=g,this.iconPositions=a,this.patternPositions=u}addImages(e,i,n,a){for(const[u,h]of e.entries()){const{bin:f,imagePosition:_,imageVariant:g}=Ng(u,h,n);i.set(u,_),a.push(f),h.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,i,n,a){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(u=>e.hasImage(u,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const u of e.getUpdatedImages(n)){for(const h of this.iconPositions.keys()){const f=Rn.parse(h);if(Cn.isEqual(f.id,u)){const _=e.getImage(u,n);this.patchUpdatedImage(this.iconPositions.get(h),_,i,null)}}for(const h of this.patternPositions.keys()){const f=Rn.parse(h);if(Cn.isEqual(f.id,u)){const _=e.getImage(u,n);this.patchUpdatedImage(this.patternPositions.get(h),_,i,a||this.lut)}}}}patchUpdatedImage(e,i,n,a=null){if(!e||!i||e.version===i.version)return;e.version=i.version;const[u,h]=e.tl,f=e.sdf;if(this.lut||f){const _={width:i.data.width,height:i.data.height},g=new en(_);en.copy(i.data,g,{x:0,y:0},{x:0,y:0},_,a,f),n.update(g,{position:{x:u,y:h}})}else n.update(i.data,{position:{x:u,y:h}})}}vt(Kd,"ImagePosition"),vt($0,"ImageAtlas",{omit:["lut"]});const Jd=1e20;function H0(r,e,i,n,a,u,h,f,_){for(let g=e;g<e+n;g++)Z0(r,i*u+g,u,a,h,f,_);for(let g=i;g<i+a;g++)Z0(r,g*u+e,1,n,h,f,_)}function Z0(r,e,i,n,a,u,h){u[0]=0,h[0]=-Jd,h[1]=Jd,a[0]=r[e];for(let f=1,_=0,g=0;f<n;f++){a[f]=r[e+f*i];const v=f*f;do{const b=u[_];g=(a[f]-a[b]+v-b*b)/(f-b)/2}while(g<=h[_]&&--_>-1);_++,u[_]=f,h[_]=g,h[_+1]=Jd}for(let f=0,_=0;f<n;f++){for(;h[_+1]<f;)_++;const g=u[_],v=f-g;r[e+f*i]=a[g]+v*v}}const Vg={none:0,ideographs:1,all:2};class qu{constructor(e,i,n){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=n,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,i){const n=[],a=this.url||Ir.GLYPHS_URL;for(const u in e)for(const h of e[u])n.push({stack:u,id:h});ge(n,({stack:u,id:h},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let g=_.glyphs[h];if(g!==void 0)return void f(null,{stack:u,id:h,glyph:g});if(g=this._tinySDF(_,u,h),g)return _.glyphs[h]=g,void f(null,{stack:u,id:h,glyph:g});const v=Math.floor(h/256);if(256*v>65535)return Ft("glyphs > 65535 not supported"),void f(null,{stack:u,id:h,glyph:g});if(_.ranges[v])return void f(null,{stack:u,id:h,glyph:g});let b=_.requests[v];b||(b=_.requests[v]=[],qu.loadGlyphRange(u,v,a,this.requestManager,(w,I)=>{if(I){_.ascender=I.ascender,_.descender=I.descender;for(const A in I.glyphs)this._doesCharSupportLocalGlyph(+A)||(_.glyphs[+A]=I.glyphs[+A]);_.ranges[v]=!0}for(const A of b)A(w,I);delete _.requests[v]})),b.push((w,I)=>{w?f(w):I&&f(null,{stack:u,id:h,glyph:I.glyphs[h]||null})})},(u,h)=>{if(u)i(u);else if(h){const f={};for(const{stack:_,id:g,glyph:v}of h)f[_]===void 0&&(f[_]={}),f[_].glyphs===void 0&&(f[_].glyphs={}),f[_].glyphs[g]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},f[_].ascender=this.entries[_].ascender,f[_].descender=this.entries[_].descender;i(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Vg.none&&(this.localGlyphMode===Vg.all?!!this.localFontFamily:!!this.localFontFamily&&(yu(e)||pp(e)||sl(e)||sc(e)||ol(e)||al(e)||(i=e)>=131072&&i<=173791||(n=>n>=66736&&n<=66815)(e)));var i}_tinySDF(e,i,n){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(n))return;let u=e.tinySDF;if(!u){let R="400";/bold/i.test(i)?R="900":/medium/i.test(i)?R="500":/light/i.test(i)&&(R="200"),u=e.tinySDF=new qu.TinySDF({fontFamily:a,fontWeight:R,fontSize:48,buffer:6,radius:16}),u.fontWeight=R}if(this.localGlyphs[u.fontWeight][n])return this.localGlyphs[u.fontWeight][n];const h=String.fromCodePoint(n),{data:f,width:_,height:g,glyphWidth:v,glyphHeight:b,glyphLeft:w,glyphTop:I,glyphAdvance:A}=u.draw(h);return this.localGlyphs[u.fontWeight][n]={id:n,bitmap:new xl({width:_,height:g},f),metrics:{width:v/2,height:b/2,left:w/2,top:I/2-27,advance:A/2,localGlyph:!0}}}}function W0(r,e){return r+e[1]-e[0]}function Ug(r,e,i,n,a=1){const u=[],h=r.imagePrimary,f=h.pixelRatio,_=h.paddedRect.w-2,g=h.paddedRect.h-2,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,w=h.stretchX||[[0,_]],I=h.stretchY||[[0,g]],A=w.reduce(W0,0),R=I.reduce(W0,0),O=_-A,D=g-R;let k=0,U=A,G=0,K=R,Y=0,re=O,oe=0,ie=D;if(h.content&&n){const de=h.content;k=Sm(w,0,de[0]),G=Sm(I,0,de[1]),U=Sm(w,de[0],de[2]),K=Sm(I,de[1],de[3]),Y=de[0]-k,oe=de[1]-G,re=de[2]-de[0]-U,ie=de[3]-de[1]-K}const ce=(de,De,Ce,Le)=>{const Ue=Im(de.stretch-k,U,v,r.left*a),Ne=Am(de.fixed-Y,re,de.stretch,A),Ve=Im(De.stretch-G,K,b,r.top*a),Se=Am(De.fixed-oe,ie,De.stretch,R),Ge=Im(Ce.stretch-k,U,v,r.left*a),Oe=Am(Ce.fixed-Y,re,Ce.stretch,A),qe=Im(Le.stretch-G,K,b,r.top*a),je=Am(Le.fixed-oe,ie,Le.stretch,R),mt=new Ke(Ue,Ve),_t=new Ke(Ge,Ve),st=new Ke(Ge,qe),ct=new Ke(Ue,qe),Rt=new Ke(Ne/f,Se/f),St=new Ke(Oe/f,je/f),ft=e*Math.PI/180;if(ft){const ai=Math.sin(ft),ur=Math.cos(ft),hi=[ur,-ai,ai,ur];mt._matMult(hi),_t._matMult(hi),ct._matMult(hi),st._matMult(hi)}const Bt=de.stretch+de.fixed,Jt=Ce.stretch+Ce.fixed,pi=De.stretch+De.fixed,Yt=Le.stretch+Le.fixed,Mi=r.imageSecondary;return{tl:mt,tr:_t,bl:ct,br:st,texPrimary:{x:h.paddedRect.x+1+Bt,y:h.paddedRect.y+1+pi,w:Jt-Bt,h:Yt-pi},texSecondary:Mi?{x:Mi.paddedRect.x+1+Bt,y:Mi.paddedRect.y+1+pi,w:Jt-Bt,h:Yt-pi}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Rt,pixelOffsetBR:St,minFontScaleX:re/f/v,minFontScaleY:ie/f/b,isSDF:i}};if(h.stretchX||h.stretchY){const de=X0(w,O,A),De=X0(I,D,R);for(let Ce=0;Ce<de.length-1;Ce++){const Le=de[Ce],Ue=de[Ce+1];for(let Ne=0;Ne<De.length-1;Ne++)u.push(ce(Le,De[Ne],Ue,De[Ne+1]))}}else u.push(ce({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:g+1}));return u}function IS(r,e){const i=r.stretchY||[[0,r.paddedRect.h-2]];return r.stretchX||r.stretchY?Y0(r.stretchX||[[0,r.paddedRect.w-2]])*Y0(i):1}function Sm(r,e,i){let n=0;for(const a of r)n+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return n}function X0(r,e,i){const n=[{fixed:-1,stretch:0}];for(const[a,u]of r){const h=n[n.length-1];n.push({fixed:a-h.stretch,stretch:h.stretch}),n.push({fixed:a-h.stretch,stretch:h.stretch+(u-a)})}return n.push({fixed:e+1,stretch:i}),n}function Y0(r){return 2*r.length+1}function Im(r,e,i,n){return r/e*i+n}function Am(r,e,i,n){return r-e*i/n}function AS(r,e,i,n){const a=e+r.positionedLines[n].lineOffset;return n===0?i+a/2:i+(a+(e+r.positionedLines[n-1].lineOffset))/2}function K0(r,e,i,n,a,u,h,f,_){const g=[];if(e.positionedLines.length===0)return g;const v=(_!==void 0?_:n.layout.get("text-rotate").evaluate(u,{}))*Math.PI/180,b=(function(O){const D=O[0],k=O[1],U=D*k;return U>0?[D,-k]:U<0?[-D,k]:D===0?[k,D]:[k,-D]})(i);let w=Math.abs(e.top-e.bottom);for(const O of e.positionedLines)w-=O.lineOffset;const I=e.positionedLines.length,A=w/I;let R=e.top-i[1];for(let O=0;O<I;++O){const D=e.positionedLines[O];R=AS(e,A,R,O);for(const k of D.positionedGlyphs){if(!k.rect)continue;const U=k.rect||{};let G=4,K=!0,Y=1,re=0;if(k.image){const _t=h.get(k.image.toString());if(!_t)continue;if(_t.sdf){Ft("SDF images are not supported in formatted text and will be ignored.");continue}K=!1,Y=_t.pixelRatio,G=1/Y}const oe=(a||f)&&k.vertical,ie=k.metrics.advance*k.scale/2,ce=k.metrics,de=k.rect;if(de===null)continue;f&&e.verticalizable&&(re=k.image?ie-k.metrics.width*k.scale/2:0);const De=a?[k.x+ie,k.y]:[0,0];let Ce=[0,0],Le=[0,0],Ue=!1;a||(oe?(Le=[k.x+ie+b[0],k.y+b[1]-re],Ue=!0):Ce=[k.x+ie+i[0],k.y+i[1]-re]);const Ne=de.w*k.scale/(Y*(k.localGlyph?2:1)),Ve=de.h*k.scale/(Y*(k.localGlyph?2:1));let Se,Ge,Oe,qe;if(oe){const _t=k.y-R,st=new Ke(-ie,ie-_t),ct=-Math.PI/2,Rt=new Ke(...Le);Se=new Ke(-ie+Ce[0],Ce[1]),Se._rotateAround(ct,st)._add(Rt),Se.x+=-_t+ie,Se.y-=(ce.left-G)*k.scale;const St=k.image?ce.advance*k.scale:Br*k.scale,ft=String.fromCodePoint(k.glyph);lS(ft)?Se.x+=(1-G)*k.scale:cS(ft)?Se.x+=St-ce.height*k.scale+(-G-1)*k.scale:Se.x+=k.image||ce.width+2*G===de.w&&ce.height+2*G===de.h?(St-Ve)/2:(St-(ce.height+2*G)*k.scale)/2,Ge=new Ke(Se.x,Se.y-Ne),Oe=new Ke(Se.x+Ve,Se.y),qe=new Ke(Se.x+Ve,Se.y-Ne)}else{const _t=(ce.left-G)*k.scale-ie+Ce[0],st=(-ce.top-G)*k.scale+Ce[1],ct=_t+Ne,Rt=st+Ve;Se=new Ke(_t,st),Ge=new Ke(ct,st),Oe=new Ke(_t,Rt),qe=new Ke(ct,Rt)}if(v){let _t;_t=a?new Ke(0,0):Ue?new Ke(b[0],b[1]):new Ke(i[0],i[1]),Se._rotateAround(v,_t),Ge._rotateAround(v,_t),Oe._rotateAround(v,_t),qe._rotateAround(v,_t)}const je=new Ke(0,0),mt=new Ke(0,0);g.push({tl:Se,tr:Ge,bl:Oe,br:qe,texPrimary:U,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:De,sectionIndex:k.sectionIndex,isSDF:K,pixelOffsetTL:je,pixelOffsetBR:mt,minFontScaleX:0,minFontScaleY:0})}}return g}function MS(r,e=1,i=!1){let n=1/0,a=1/0,u=-1/0,h=-1/0;const f=r[0];for(let I=0;I<f.length;I++){const A=f[I];(!I||A.x<n)&&(n=A.x),(!I||A.y<a)&&(a=A.y),(!I||A.x>u)&&(u=A.x),(!I||A.y>h)&&(h=A.y)}const _=Math.min(u-n,h-a);let g=_/2;const v=new Wl([],CS);if(_===0)return new Ke(n,a);for(let I=n;I<u;I+=_)for(let A=a;A<h;A+=_)v.push(new $u(I+g,A+g,g,r));let b=(function(I){let A=0,R=0,O=0;const D=I[0];for(let k=0,U=D.length,G=U-1;k<U;G=k++){const K=D[k],Y=D[G],re=K.x*Y.y-Y.x*K.y;R+=(K.x+Y.x)*re,O+=(K.y+Y.y)*re,A+=3*re}return new $u(R/A,O/A,0,I)})(r),w=v.length;for(;v.length;){const I=v.pop();(I.d>b.d||!b.d)&&(b=I,i&&console.log("found best %d after %d probes",Math.round(1e4*I.d)/1e4,w)),I.max-b.d<=e||(g=I.h/2,v.push(new $u(I.p.x-g,I.p.y-g,g,r)),v.push(new $u(I.p.x+g,I.p.y-g,g,r)),v.push(new $u(I.p.x-g,I.p.y+g,g,r)),v.push(new $u(I.p.x+g,I.p.y+g,g,r)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function CS(r,e){return e.max-r.max}qu.loadGlyphRange=function(r,e,i,n,a){const u=256*e,h=u+255,f=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${u}-${h}`),Mn.Glyphs);Bl(f,(_,g)=>{if(_)a(_);else if(g){const v={},b=(function(w){return new wm(w).readFields(xS,{})})(g);for(const w of b.glyphs)v[w.id]=w;
7a(null,{glyphs:v,ascender:b.ascender,descender:b.descender})}})},qu.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:a="sans-serif",fontWeight:u="normal",fontStyle:h="normal",lang:f=null}={}){this.buffer=e,this.cutoff=n,this.radius=i,this.lang=f;const _=this.size=r+4*e,g=this._createCanvas(_),v=this.ctx=g.getContext("2d",{willReadFrequently:!0});v.font=`${h} ${u} ${r}px ${a}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:u}=this.ctx.measureText(r),h=Math.ceil(i),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-a))),_=Math.min(this.size-this.buffer,h+Math.ceil(n)),g=f+2*this.buffer,v=_+2*this.buffer,b=Math.max(g*v,0),w=new Uint8ClampedArray(b),I={data:w,width:g,height:v,glyphWidth:f,glyphHeight:_,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(f===0||_===0)return I;const{ctx:A,buffer:R,gridInner:O,gridOuter:D}=this;this.lang&&(A.lang=this.lang),A.clearRect(R,R,f,_),A.fillText(r,R,R+h);const k=A.getImageData(R,R,f,_);D.fill(Jd,0,b),O.fill(0,0,b);for(let U=0;U<_;U++)for(let G=0;G<f;G++){const K=k.data[4*(U*f+G)+3]/255;if(K===0)continue;const Y=(U+R)*g+G+R;if(K===1)D[Y]=0,O[Y]=Jd;else{const re=.5-K;D[Y]=re>0?re*re:0,O[Y]=re<0?re*re:0}}H0(D,0,0,g,v,g,this.f,this.v,this.z),H0(O,R,R,f,_,g,this.f,this.v,this.z);for(let U=0;U<b;U++){const G=Math.sqrt(D[U])-Math.sqrt(O[U]);w[U]=Math.round(255-255*(G/this.radius+this.cutoff))}return I}};class $u{constructor(e,i,n,a){this.p=new Ke(e,i),this.h=n,this.d=(function(u,h){let f=!1,_=1/0;for(let g=0;g<h.length;g++){const v=h[g];for(let b=0,w=v.length,I=w-1;b<w;I=b++){const A=v[b],R=v[I];A.y>u.y!=R.y>u.y&&u.x<(R.x-A.x)*(u.y-A.y)/(R.y-A.y)+A.x&&(f=!f),_=Math.min(_,_l(u,A,R))}}return(f?1:-1)*Math.sqrt(_)})(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const PS=Object.keys,jg=Number.POSITIVE_INFINITY,RS=Math.sqrt(2);function Tl(r,e,i,n,a){const u=Fg(r)&&r.collisionPadding?r.collisionPadding:[0,0,0,0],h={top:r.top-u[1],bottom:r.bottom+u[3],left:r.left-u[0],right:r.right+u[2],scaled:!1};return n!==void 0&&(function(f,_){f.top*=_,f.bottom*=_,f.left*=_,f.right*=_,f.scaled=!0}
7)(h,n),i&&(function(f,_){if(!_)return;const g=ci(_),v=new Ke(f.left,f.top),b=new Ke(f.right,f.top),w=new Ke(f.left,f.bottom),I=new Ke(f.right,f.bottom),A=new Ke(0,0);v._rotateAround(g,A),b._rotateAround(g,A),w._rotateAround(g,A),I._rotateAround(g,A),f.left=Math.min(v.x,b.x,w.x,I.x),f.right=Math.max(v.x,b.x,w.x,I.x),f.top=Math.min(v.y,b.y,w.y,I.y),f.bottom=Math.max(v.y,b.y,w.y,I.y)})(h,i),a&&(h.left+=a[0],h.right+=a[0],h.top+=a[1],h.bottom+=a[1]),e?{top:Math.min(e.top,h.top),bottom:Math.max(e.bottom,h.bottom),left:Math.min(e.left,h.left),right:Math.max(e.right,h.right),scaled:e.scaled||h.scaled}:h}function J0(r,[e,i]){let n=0,a=0;if(i===jg){e<0&&(e=0);const u=e/RS;switch(r){case"top-right":case"top-left":a=u-7;break;case"bottom-right":case"bottom-left":a=7-u;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":n=-u;break;case"top-left":case"bottom-left":n=u;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,a]}function LS(r,e,i,n,a,u,h,f,_,g,v,b,w,I,A){const R=r.layers[0],O=R.appearances;if(O.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const D={iconBBox:null,iconVerticalBBox:null},k={textBBox:null,textVerticalBBox:null},{baseIconRotate:U,baseTextRotate:G,iconScaleFactor:K}=(function(re,oe,ie){const ce=re.get("icon-rotate").evaluate(oe,{},ie),de=re.get("text-rotate").evaluate(oe,{},ie),[De,Ce]=re.get("icon-size-scale-range");return{baseIconRotate:ce,baseTextRotate:de,iconScaleFactor:te(1,De,Ce)}})(n,a,u);e&&(D.iconBBox=Tl(e,D.iconBBox,U,h),i)&&(D.iconVerticalBBox=Tl(i,D.iconVerticalBBox,U+90,h));const Y=Cm(b.horizontal);Y&&(k.textBBox=Tl(Y,k.textBBox,G,1,I)),b.vertical&&(k.textVerticalBBox=Tl(b.vertical,k.textVerticalBBox,G+90,1,I));for(const re of O)re.hasIconProperties()&&DS(D,r,R,re,a,u,f,U,h,_,e,g,K,v,A),re.hasTextProperties()&&zS(k,R,re,a,u,I,G,w,Y,b.vertical);return{iconBBox:D.iconBBox,iconVerticalBBox:D.iconVerticalBBox,textBBox:k.textBBox,textVerticalBBox:k.textVerticalBBox}}function DS(r,e,i,n,a,u,h,f,_,g,v,b,w,I,A){const{appearanceIconOffset:R,appearanceIconRotate:O,appearanceIconSize:D}=Q0(n,i,a,u,h,f,_,g.iconScaleFactor);let k=null,U=null,G=null;n.hasProperty("icon-image")?G=(function(K,Y,re,oe,ie,ce,de,De){let Ce=null;const Le=Y.getAppearanceValueAndResolveTokens(re,"icon-image",oe,ie,De);if(Le){const Ue=K.getResolvedImageFromTokens(Le),Ne=re.getUnevaluatedProperty("icon-size"),Ve=Qd(Ue,Mc(K.zoom,Ne,K.worldview,De),Ne,ie,K.zoom,oe,K.pixelRatio,de,K.worldview,De);Ce=ce.get(Ve.iconPrimary.toString())}return Ce})(e,i,n,a,u,b,w,A):v&&(G=v.imagePrimary),G&&(k=Em(G,null,R,I),e.allowVerticalPlacement&&(U=Em(G,null,R,I))),k&&(r.iconBBox=Tl(k,r.iconBBox,O,D)),U&&(r.iconVerticalBBox=Tl(U,r.iconVerticalBBox,O+90,D))}function Q0(r,e,i,n,a,u,h,f){const _=r.hasProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(r,"icon-offset",i,n,[]):null,g=_&&Array.isArray(_)?_:a,v=r.hasProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(r,"icon-rotate",i,n,[]):null,b=typeof v=="number"?v:u,w=r.hasProperty("icon-size")?e.getAppearanceValueAndResolveTokens(r,"icon-size",i,n,[]):null;return{appearanceIconOffset:g,appearanceIconRotate:b,appearanceIconSize:typeof w=="number"?w*f:h}}function zS(r,e,i,n,a,u,h,f,_,g){const{appearanceTextOffset:v,appearanceTextRotate:b,appearanceTextSize:w}=eb(i,e,n,a,u,h,f),I=w/f;_&&(r.textBBox=Tl(_,r.textBBox,b,I,v)),g&&(r.textVerticalBBox=Tl(g,r.textVerticalBBox,b+90,I,v))}function eb(r,e,i,n,a,u,h){const f=r.hasProperty("text-offset")?e.getAppearanceValueAndResolveTokens(r,"text-offset",i,n,[]):null,_=f&&Array.isArray(f)?[f[0]*Br,f[1]*Br]:a,g=r.hasProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(r,"text-rotate",i,n,[]):null,v=typeof g=="number"?g:u,b=r.hasProperty("text-size")?e.getAppearanceValueAndResolveTokens(r,"text-size",i,n,[]):null;return{appearanceTextOffset:_,appearanceTextRotate:v,appearanceTextSize:typeof b=="number"?b:h}}
7function Mm(r,e,i,n,a,u,h,f,_){if(!e||!e.usvg)return;const g=B0(n),v=B0(a),b=u!=="both"&&u!=="width"||!F0(n)?1:v.width/g.width,w=u!=="both"&&u!=="height"||!k0(n)?1:v.height/g.height;i.scaleSelf(b,w);const I=i.toString();h.set(I,i),f.set(I,e);const{imagePosition:A}=Ng(I,e,1);_.set(I,A)}function tb(r,e,i,n,a,u,h,f,_,g){if(!r)return;const v=(function(b,w,I,A,R,O,D){if(b.kind==="camera")return b.maxSize;if(b.kind==="composite"){const k=w.possiblyEvaluate(new Ai(b.maxZoom,{worldview:O}),I,D).evaluate(R,{},I,D),U=w.possiblyEvaluate(new Ai(b.minZoom,{worldview:O}),I,D).evaluate(R,{},I,D);return Math.max(k,U)}return w.possiblyEvaluate(new Ai(A,{worldview:O}),I,D).evaluate(R,{},I,D)})(e,i,n,a,u,_,g);return r.scaleSelf(v*f*h)}function Qd(r,e,i,n,a,u,h,f,_,g){return{iconPrimary:tb(r.getPrimary(),e,i,n,a,u,h,f,_,g),iconSecondary:tb(r.getSecondary(),e,i,n,a,u,h,f,_,g)}}function OS(r,e,i){if(!e)return;const n=i.get(r.toString()),a=i.get(e.toString());n&&a&&(n.paddedRect.w===a.paddedRect.w&&n.paddedRect.h===a.paddedRect.h||Ft(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),n.usvg!==a.usvg&&Ft(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function ib(r,e,i,n){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,n){const u=e.get(n.toString());r.imageSecondary=u}}function FS(r,e){for(const i in r.horizontal)rb(r.horizontal[i],e);rb(r.vertical,e)}function rb(r,e){if(r){for(const i of r.positionedLines)for(const n of i.positionedGlyphs)if(n.image!==null){const a=n.image.toString();n.rect=e.get(a).paddedRect}}}function Gg(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function kS(r,e,i,n,a,u,h,f,_){const g=Cm(u.horizontal)||u.vertical,v=i.get("icon-text-fit-padding").evaluate(n,{},a);let b,w=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&u.vertical&&(b=kg(e,u.vertical,_,v,f,h)),g&&(w=kg(e,g,_,v,f,h))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function nb(r,e){return r*e/24}function BS(r,e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k,U,G,K,Y,re){let oe=h.textMaxSize.evaluate(e,{},w);oe===void 0?oe=f*h.textScaleFactor:oe*=h.textScaleFactor;const ie=r.layers[0].layout,ce=nb(f,h.textScaleFactor),de=Cm(i.horizontal)||i.vertical,De=r.hasAnyAppearanceProperty(["text-size","text-offset","text-rotate"]);if((O!=="none"||De)&&r.appearanceFeatureData&&r.featureToAppearanceIndex[e.index]<r.appearanceFeatureData.length){const st=r.appearanceFeatureData[r.featureToAppearanceIndex[e.index]];st&&(st.textShaping=de,st.iconTextFitPadding=ie.get("icon-text-fit-padding").evaluate(e,{},w),st.fontScale=ce,st.textScaleFactor=h.textScaleFactor)}const Ce=I.name==="globe",Le=r.tilePixelRatio*oe/24,Ue=(qe=r.overscaling,r.zoom>18&&qe>2&&(qe>>=1),Math.max(lt/(512*qe),1)*ie.get("symbol-spacing")),Ne=ie.get("text-padding")*r.tilePixelRatio,Ve=ie.get("icon-padding")*r.tilePixelRatio,Se=ci(ie.get("text-max-angle")),Ge=ie.get("icon-rotation-alignment")==="map"&&U!=="point",Oe=Ue/2;var qe;r.hasAnyIconTextFit===!1&&O!=="none"&&(r.hasAnyIconTextFit=!0);const je=e.properties?+e.properties[ii]:null,mt=je&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(je):65535,_t=(st,ct,Rt)=>{if(ct.x<0||ct.x>=lt||ct.y<0||ct.y>=lt)return;let St=null;if(Ce){const{x:ft,y:Bt,z:Jt}=I.projectTilePoint(ct.x,ct.y,Rt);St={anchor:new La(ft,Bt,Jt,0,void 0),up:I.upVector(Rt,ct.x,ct.y)}}(function(ft,Bt,Jt,pi,Yt,Mi,ai,ur,hi,Ei,Gi,Ji,Qi,hr,qr,tn,Tr,Pr,zr,Zt,er,nr,uo,Tn,$r,En,ta,ln,Hm,Ju,Fn,Zm){const ia=ft.addToLineVertexArray(Bt,pi);let Da,Il,Lo,Wo,_f,Qu,Kt,Nr=0,dr=0,Rr=0,Do=0,$n=-1,ho=-1;const Vr={};let gf=qa("");const ra=Jt?Jt.anchor:Bt,Er=ln!=="none";let Hr=0,Lr=0;if(hi._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Zr=hi.layout.get("text-offset").evaluate(er,{},$r);Hr=Zr[0]*Br,Lr=Zr[1]*Br}else Hr=hi.layout.get("text-radial-offset").evaluate(er,{},$r)*Br,Lr=jg;if(ft.allowVerticalPlacement&&Yt.vertical){const Zr=Yt.vertical;if(qr)Qu=Hg(Zr),ur&&(Kt=Hg(ur));else{const Hn=hi.layout.get("text-rotate").evaluate(er,{},$r)+90;Lo=Pm(Ei,ra,Bt,Gi,Ji,Qi,Zr,hr,Hn,tn,Zm),ur&&(Wo=Pm(Ei,ra,Bt,Gi,Ji,Qi,ur,Pr,Hn,null,Fn))}}if(Mi){const Zr=hi.layout.get("icon-rotate").evaluate(er,{},$r),Hn=Ug(Mi,Zr,uo,Er,nr.iconScaleFactor),Xo=ur?Ug(ur,Zr,uo,Er,nr.iconScaleFactor):void 0;Il=Pm(Ei,ra,Bt,Gi,Ji,Qi,Mi,Pr,Zr,null,Ju);const na=(function(bs,YI,w1,KI,JI,T1,E1,QI,kA,_y){const S1=bs.layers[0],I1=S1.appearances;let th=YI.length;if(w1&&(th=Math.max(th,w1.length)),I1.length===0)return th;const[e2,t2]=KI.get("icon-size-scale-range"),i2=te(1,e2,t2);for(const gy of I1){const A1=gy.getUnevaluatedProperties();if(A1._values["icon-image"].value!==void 0){const M1=S1.getAppearanceValueAndResolveTokens(gy,"icon-image",T1,E1,_y);if(M1){const C1=bs.getResolvedImageFromTokens(M1);if(C1){const P1=gy.hasProperty("icon-size")?A1._values["icon-size"]:JI._values["icon-size"],r2=Qd(C1,Mc(bs.zoom,P1,bs.worldview,_y),P1,E1,bs.zoom,T1,bs.pixelRatio,i2,bs.worldview,_y),R1=QI.get(r2.iconPrimary.toString());R1&&(th=Math.max(th,IS(R1)))}}}}return th})(ft,Hn,Xo,hi.layout,hi._unevaluatedLayout,er,$r,ft.iconAtlasPositions,0,Tn);Nr=4*na;const py=hi.layout.get("icon-size").evaluate(er,{},$r,Tn),my=nr.compositeIconSizes?nr.compositeIconSizes[0].evaluate(er,{},$r,Tn):0,yf=nr.compositeIconSizes?nr.compositeIconSizes[1].evaluate(er,{},$r,Tn):0,eh=$g(ft.layerIds[0],ft.iconSizeData,py,nr.iconScaleFactor,my,yf);ft.addSymbols(ft.icon,Hn,eh,Zt,zr,er,void 0,Jt,Bt,ia.lineStartIndex,ia.lineLength,-1,Tn,$r,En,ta,ft.symbolInstances.length,na),$n=ft.icon.placedSymbolArray.length-1,Xo&&(dr=4*na,ft.addSymbols(ft.icon,Xo,eh,Zt,zr,er,co.vertical,Jt,Bt,ia.lineStartIndex,ia.lineLength,-1,Tn,$r,En,ta,ft.symbolInstances.length,na),ho=ft.icon.placedSymbolArray.length-1)}for(const Zr in Yt.horizontal){const Hn=Zr,Xo=Yt.horizontal[Hn];Da||(gf=qa(Xo.text),qr?_f=Hg(Xo):Da=Pm(Ei,ra,Bt,Gi,Ji,Qi,Xo,hr,hi.layout.get("text-rotate").evaluate(er,{},$r),tn,Zm));const na=Xo.positionedLines.length===1;if(Rr+=ob(ft,Jt,Bt,Xo,ai,hi,qr,er,tn,ia,Yt.vertical?co.horizontal:co.horizontalOnly,na?PS(Yt.horizontal):[Hn],Vr,$n,nr,Tn,$r,ft.symbolInstances.length,En),na)break}Yt.vertical&&(Do+=ob(ft,Jt,Bt,Yt.vertical,ai,hi,qr,er,tn,ia,co.vertical,["vertical"],Vr,ho,nr,Tn,$r,ft.symbolInstances.length,En));let cn=-1;const un=(Zr,Hn)=>Zr?Math.max(Zr,Hn):Hn;cn=un(_f,cn),cn=un(Qu,cn),cn=un(Kt,cn);const Al=cn>-1?1:0;ft.glyphOffsetArray.length>=65535&&Ft("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),er.sortKey!==void 0&&ft.addToSortKey
7Ranges(ft.symbolInstances.length,er.sortKey),ft.symbolInstances.emplaceBack(Bt.x,Bt.y,ra.x,ra.y,ra.z,Vr.right>=0?Vr.right:-1,Vr.center>=0?Vr.center:-1,Vr.left>=0?Vr.left:-1,Vr.vertical>=0?Vr.vertical:-1,$n,ho,gf,Da!==void 0?Da:ft.collisionBoxArray.length,Da!==void 0?Da+1:ft.collisionBoxArray.length,Lo!==void 0?Lo:ft.collisionBoxArray.length,Lo!==void 0?Lo+1:ft.collisionBoxArray.length,Il!==void 0?Il:ft.collisionBoxArray.length,Il!==void 0?Il+1:ft.collisionBoxArray.length,Wo||ft.collisionBoxArray.length,Wo?Wo+1:ft.collisionBoxArray.length,Gi,Rr,Do,Nr,dr,Al,0,Hr,Lr,cn,0,Er?1:0,Hm)})(r,ct,St,st,i,n,u,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Ne,k,g,0,Ve,Ge,D,e,h,v,b,w,A,R,O,mt,G,K,Y)};if(U==="line")for(const st of hm(e.geometry,0,0,lt,lt)){const ct=SS(st,Ue,Se,i.vertical||de,n,24,Le,r.overscaling,lt);for(const Rt of ct)de&&NS(r,de.text,Oe,Rt)||_t(st,Rt,w)}else if(U==="line-center"){for(const st of e.geometry)if(st.length>1){const ct=ES(st,Se,i.vertical||de,n,24,Le);ct&&_t(st,ct,w)}}else if(e.type==="Polygon")for(const st of zd(e.geometry,0)){const ct=MS(st,16);_t(st[0],new La(ct.x,ct.y,0,0,void 0),w)}else if(e.type==="LineString")for(const st of e.geometry)_t(st,new La(st[0].x,st[0].y,0,0,void 0),w);else if(e.type==="Point")for(const st of e.geometry)for(const ct of st)_t([ct],new La(ct.x,ct.y,0,0,void 0),w)}const qg=255,Cc=qg*Ra;function ob(r,e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k){const U=K0(0,n,_,u,h,f,a,r.allowVerticalPlacement,void 0),G=u.layout.get("text-size").evaluate(f,{},O),K=A.compositeTextSizes?A.compositeTextSizes[0].evaluate(f,{},O):0,Y=A.compositeTextSizes?A.compositeTextSizes[1].evaluate(f,{},O):0,re=$g(r.layerIds[0],r.textSizeData,G,A.textScaleFactor,K,Y);r.addSymbols(r.text,U,re,_,h,f,v,e,i,g.lineStartIndex,g.lineLength,I,R,O,k,!1,D,U.length);for(const oe of b)w[oe]=r.text.placedSymbolArray.length-1;return 4*U.length}function $g(r,e,i,n,a,u){const h=e;let f=null;return h.kind==="source"?(f=[Ra*i*n],f[0]>Cc&&Ft(`${r}: Value for "text-size" is >= ${qg}. Reduce your "text-size".`)):h.kind==="composite"&&(f=[Ra*a*n,Ra*u*n],(f[0]>Cc||f[1]>Cc)&&Ft(`${r}: Value for "text-size" is >= ${qg}. Reduce your "text-size".`)),f}function Cm(r){for(const e in r)return r[e];return null}function Pm(r,e,i,n,a,u,h,f,_,g,v){let b,w,I,A;if(b=v?v.top:h.top,w=v?v.bottom:h.bottom,I=v?v.left:h.left,A=v?v.right:h.right,Fg(h)&&h.collisionPadding){const R=h.collisionPadding;I-=R[0],b-=R[1],A+=R[2],w+=R[3]}if(_){const R=new Ke(I,b),O=new Ke(A,b),D=new Ke(I,w),k=new Ke(A,w),U=ci(_);let G=new Ke(0,0);g&&(G=new Ke(g[0],g[1])),R._rotateAround(U,G),O._rotateAround(U,G),D._rotateAround(U,G),k._rotateAround(U,G),I=Math.min(R.x,O.x,D.x,k.x),A=Math.max(R.x,O.x,D.x,k.x),b=Math.min(R.y,O.y,D.y,k.y),w=Math.max(R.y,O.y,D.y,k.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,I,b,A,w,f,n,a,u),r.length-1}function Hg(r){Fg(r)&&r.collisionPadding&&(r.top-=r.collisionPadding[1],r.bottom+=r.collisionPadding[3]);const e=r.bottom-r.top;return e>0?Math.max(10,e):null}function NS(r,e,i,n){const a=r.compareText;if(e in a){const u=a[e];for(let h=u.length-1;h>=0;h--)if(n.dist(u[h])<i)return!0}else a[e]=[];return a[e].push(n),!1}function sb(r,e){const i=r.fovAboveCenter,n=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-n)/Math.cos(r._pitch),u=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let h=Math.sin(r._pitch)*u+a;const f=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let _=Math.max(r.zoom-17,0);r.isOrthographic&&(_/=10),h*=1+_}return Math.min(1.01*h,f)}function ef(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),n=r.x*i,a=(r.x+1)*i,u=r.y*i,h=(r.y+1)*i,f=Fe(n),_=Fe(a),g=$e(u),v=$e(h),b=e.project(f,g),w=e.project(_,g),I=e.project(_,v),A=e.project(f,v);let R=Math.min(b.x,w.x,I.x,A.x),O=Math.min(b.y,w.y,I.y,A.y),D=Math.max(b.x,w.x,I.x,A.x),k=Math.max(b.y,w.y,I.y,A.y);const U=i/16;function G(Y,re,oe,ie,ce,de){const De=(oe+ce)/2,Ce=(ie+de)/2,Le=e.project(Fe(De),$e(Ce)),Ue=Math.max(0,R-Le.x,O-Le.y,Le.x-D,Le.y-k);R=Math.min(R,Le.x),D=Math.max(D,Le.x),O=Math.min(O,Le.y),k=Math.max(k,Le.y),Ue>U&&(G(Y,Le,oe,ie,De,Ce),G(Le,re,De,Ce,ce,de))}G(b,w,n,u,a,u),G(w,I,a,u,a,h),G(I,A,a,h,n,h),G(A,b,n,h,n,u),R-=U,O-=U,D+=U,k+=U;const K=1/Math.max(D-R,k-O);return{scale:K,x:R*K,y:O*K,x2:D*K,y2:k*K,projection:e}}function ab(r,{x:e,y:i},n=0){return new Ke(((e-n)*r.scale-r.x)*lt,(i*r.scale-r.y)*lt)}const VS=pe(new Float32Array(16));class El{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}}
vendor: 4,210 bytes, line 7
7unproject(e,i){return new J(0,0)}projectTilePoint(e,i,n){return{x:e,y:i,z:0}}locationPoint(e,i,n,a=!0){return e._coordinatePoint(e.locationCoordinate(i,n),a)}pixelsPerMeter(e,i){return Ee(1,e)*i}pixelSpaceConversion(e,i,n){return 1}farthestPixelDistance(e){return sb(e,e.pixelsPerMeter)}pointCoordinate(e,i,n,a){const u=e.horizonLineFromTop(!1),h=new Ke(i,Math.max(u,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,n){const a=new Ke(i,n);if(e.elevation)return e.elevation.pointCoordinate(a);{const u=this.pointCoordinate(e,a.x,a.y,0);return[u.x,u.y,u.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const n=e.horizonLineFromTop();return i.y<n}createInversionMatrix(e,i){return VS}createTileMatrix(e,i,n){let a,u,h;const f=n.canonical,_=pe(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=ef(f,this);a=1,u=g.x+n.wrap*g.scale,h=g.y,Qe(_,_,[a/g.scale,a/g.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(f.z),u=(f.x+Math.pow(2,f.z)*n.wrap)*a,h=f.y*a;return gt(_,_,[u,h,0]),Qe(_,_,[a/lt,a/lt,1]),_}upVector(e,i,n){return[0,0,1]}upVectorScale(e,i,n){return{metersToTile:1}}}class US extends El{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,n]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(ci(i));this.n=(a+Math.sin(ci(n)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n,c:a,r0:u}=this,h=ci(e-this.center[0]),f=ci(i),_=Math.sqrt(a-2*n*Math.sin(f))/n;return{x:_*Math.sin(h*n),y:_*Math.cos(h*n)-u,z:0}}unproject(e,i){const{n,c:a,r0:u}=this,h=u+i;let f=Math.atan2(e,Math.abs(h))*Math.sign(h);h*n<0&&(f-=Math.PI*Math.sign(e)*Math.sign(h));const _=ci(this.center[0])*n;f=Ie(f,-Math.PI-_,Math.PI-_);const g=te(ye(f/n)+this.center[0],-180,180),v=Math.asin(te((a-(e*e+h*h)*n*n)/(2*n),-1,1)),b=te(ye(v),-85.051129,he);return new J(g,b)}}const tf=1.340264,rf=-.081106,nf=893e-6,of=.003796,Rm=Math.sqrt(3)/2;class jS extends El{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(Rm*Math.sin(i)),a=n*n,u=a*a*a;return{x:.5*(e*Math.cos(n)/(Rm*(tf+3*rf*a+u*(7*nf+9*of*a)))/Math.PI+.5),y:1-.5*(n*(tf+rf*a+u*(nf+of*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,a=n*n,u=a*a*a;for(let v,b,w,I=0;I<12&&(b=n*(tf+rf*a+u*(nf+of*a))-i,w=tf+3*rf*a+u*(7*nf+9*of*a),v=b/w,n=te(n-v,-Math.PI/3,Math.PI/3),a=n*n,u=a*a*a,!(Math.abs(v)<1e-12));++I);const h=Rm*e*(tf+3*rf*a+u*(7*nf+9*of*a))/Math.cos(n),f=Math.asin(Math.sin(n)/Rm),_=te(180*h/Math.PI,-180,180),g=te(180*f/Math.PI,-85.051129,he);return new J(_,g)}}class GS extends El{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){const n=360*(e-.5),a=te(360*(.5-i),-85.051129,he);return new J(n,a)}}const Hu=Math.PI/2;function Lm(r){return Math.tan((Hu+r)/2)}class qS extends El{constructor(e){super(e),this.center=e.center||[0,30];const[i,n]=this.parallels=e.parallels||[30,30];let a=ci(i),u=ci(n);this.southernCenter=a+u<0,this.southernCenter&&(a=-a,u=-u);const h=Math.cos(a),f=Lm(a);this.n=a===u?Math.sin(a):Math.log(h/Math.cos(u))/Math.log(Lm(u)/f),this.f=h*Math.pow(Lm(a),this.n)/this.n}project(e,i){i=ci(i),this.southernCenter&&(i=-i),e=ci(e-this.center[0]);const n=1e-6,{n:a,f:u}=this;u>0?i<-Hu+n&&(i=-Hu+n):i>Hu-n&&(i=Hu-n);const h=u/Math.pow(Lm(i),a);let f=h*Math.sin(a*e),_=u-h*Math.cos(a*e);return f=.5*(f/Math.PI+.5),_=.5*(_/Math.PI+.5),{x:f,y:this.southernCenter?_:1-_,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n,f:a}=this,u=a-i,h=Math.sign(u),f=Math.sign(n)*Math.sqrt(e*e+u*u);let _=Math.atan2(e,Math.abs(u))*h;u*n<0&&(_-=Math.PI*Math.sign(e)*h);const g=te(ye(_/n)+this.center[0],-180,180),v=te(ye(2*Math.atan(Math.pow(a/f,1/n))-Hu),-85.051129,he);return new J(g,this.southernCenter?-v:v)}}class lb extends El{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:xe(e),y:Ae(i),z:0}}unproject(e,i){const n=Fe(e),a=$e(i);
vendor: 4,189 bytes, line 7
7return new J(n,a)}}const cb=ci(he);class $S extends El{project(e,i){const n=(i=ci(i))*i,a=n*n;return{x:.5*((e=ci(e))*(.8707-.131979*n+a*(a*(.003971*n-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+n*(.015085+a*(.028874*n-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,a=25,u=0,h=n*n;do{h=n*n;const g=h*h;u=(n*(1.007226+h*(.015085+g*(.028874*h-.044475-.005916*g)))-i)/(1.007226+h*(.045255+g*(.259866*h-.311325-.005916*11*g))),n=te(n-u,-cb,cb)}while(Math.abs(u)>1e-6&&--a>0);h=n*n;const f=te(ye(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),_=ye(n);return new J(f,_)}}const ub=ci(he);class HS extends El{project(e,i){i=ci(i),e=ci(e);const n=Math.cos(i),a=2/Math.PI,u=Math.acos(n*Math.cos(e/2)),h=Math.sin(u)/u,f=.5*(e*a+2*n*Math.sin(e/2)/h)||0,_=.5*(i+Math.sin(i)/h)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(_/Math.PI+1),z:0}}unproject(e,i){let n=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,u=25;const h=1e-6;let f=0,_=0;do{const g=Math.cos(a),v=Math.sin(a),b=2*v*g,w=v*v,I=g*g,A=Math.cos(n/2),R=Math.sin(n/2),O=2*A*R,D=R*R,k=1-I*A*A,U=k?1/k:0,G=k?Math.acos(g*A)*Math.sqrt(1/k):0,K=.5*(2*G*g*R+2*n/Math.PI)-e,Y=.5*(G*v+a)-i,re=.5*U*(I*D+G*g*A*w)+1/Math.PI,oe=U*(O*b/4-G*v*R),ie=.125*U*(b*R-G*v*I*O),ce=.5*U*(w*A+G*D*g)+.5,de=oe*ie-ce*re;f=(Y*oe-K*ce)/de,_=(K*ie-Y*re)/de,n=te(n-f,-Math.PI,Math.PI),a=te(a-_,-ub,ub)}while((Math.abs(f)>h||Math.abs(_)>h)&&--u>0);return new J(ye(n),ye(a))}}class hb extends El{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ci(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:n,cosPhi:a}=this;return{x:ci(e)*a*n+.5,y:-Math.sin(ci(i))/a*n+.5,z:0}}unproject(e,i){const{scale:n,cosPhi:a}=this,u=-(i-.5)/n,h=te(ye((e-.5)/n)/a,-180,180),f=Math.asin(te(u*a,-1,1)),_=te(ye(f),-85.051129,he);return new J(h,_)}}class ZS extends lb{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,n){const a=Md(e,i,n);return pr(a,a,Qp(Js(n))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,n){const a=ne(i.lat,i.lng),u=Ii([],a),h=n?e._centerAltitude+n:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;In(a,a,u,Ee(1,0)*lt*h);const f=pe(new Float64Array(16));return at(f,e.pixelMatrix,e.globeMatrix),pr(a,a,f),new Ke(a[0],a[1])}pixelsPerMeter(e,i){return Ee(1,0)*i}pixelSpaceConversion(e,i,n){const a=Ee(1,e)*i,u=Dt(Ee(1,45)*i,a,n);return this.pixelsPerMeter(e,i)/u}createTileMatrix(e,i,n){const a=G_(Js(n.canonical));return at(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:n}=e,a=Qp(Js(i));return yt(a,a,ci(n.lng)),He(a,a,ci(n.lat)),Qe(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,n,a){return Sx(e,i,n,!0)||new ut(0,0)}pointCoordinate3D(e,i,n){const a=this.pointCoordinate(e,i,n,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!Sx(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=(function(a,u){const h=a.cameraToCenterDistance,f=a._centerAltitude*u,_=a._camera,g=a._camera.forward(),v=sr([],Ui([],g,-h),[0,0,f]),b=a.worldSize/(2*Math.PI),w=[0,0,-b],I=a.width/a.height,A=Math.tan(a.fovAboveCenter),R=Ui([],_.up(),A),O=Ui([],_.right(),A*I),D=Ii([],sr([],sr([],g,R),O)),k=[];let U;if(new Di(v,D).closestPointOnSphere(w,b,k)){const G=sr([],k,w),K=_r([],G,v);U=Math.cos(a.fovAboveCenter)*rn(K)}else{const G=_r([],v,w),K=_r([],w,v);Ii(K,K);const Y=rn(G)-b;U=Math.sqrt(Y*(Y+2*b));const re=Math.acos(U/(b+Y))-Math.acos(tr(g,K));U*=Math.cos(re)}return 1.01*U})(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=yl(e.zoom);if(n>0){const a=sb(e,Ee(1,e.center.lat)*e.worldSize),u=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Dt(i,a+u*(1-Math.cos(h)),Math.pow(n,10))}return i}upVector(e,i,n){return Md(i,n,e,1)}upVectorScale(e){return{metersToTile:Yp(Jp(Js(e)))}}}function db(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;
7switch(r.name){case"mercator":return new lb(r);case"equirectangular":return new GS(r);case"naturalEarth":return new $S(r);case"equalEarth":return new jS(r);case"winkelTripel":return new HS(r);case"albers":return i?new hb(r):new US(r);case"lambertConformalConic":return i?new hb(r):new qS(r);case"globe":return new ZS(r)}throw new Error(`Invalid projection name: ${r.name}`)}const WS=ti.types,XS=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function sf(r,e,i,n,a,u,h,f,_,g,v,b,w){const I=f?Math.min(Cc,Math.round(f[0])):0,A=f?Math.min(Cc,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*n),Math.round(32*a),u,h,(I<<1)+(_?1:0),0+(A<<1),16*g,16*v,256*b,256*w)}function af(r,e,i){r.emplaceBack(e,i)}function lf(r,e,i,n,a,u,h){r.emplaceBack(e,i,n,a,u,h)}const Dm=(r,e,i,n)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],n[0],n[1],n[2])};function Zu(r,e,i,n,a){r.emplaceBack(e,i,n,a),r.emplaceBack(e,i,n,a),r.emplaceBack(e,i,n,a),r.emplaceBack(e,i,n,a)}function YS(r){for(const e of r.sections)if(Hs(e.text))return!0;return!1}class Zg{constructor(e){this.layoutVertexArray=new xd,this.indexArray=new Mr,this.programConfigurations=e,this.segments=new Hi,this.dynamicLayoutVertexArray=new Ks,this.opacityVertexArray=new bd,this.placedSymbolArray=new Op,this.iconTransitioningVertexArray=new ro,this.globeExtVertexArray=new vd,this.zOffsetVertexArray=new Gr,this.orientationVertexArray=new Iu,this.symbolInstanceIndices=[]}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getSymbolVertexData(e,i){const n=[],a=this.layoutVertexArray.uint16;for(let u=0;u<i;++u){const h=12*(e+u);n.push(...a.slice(h,h+12))}return n}updateSymbolVertexData(e,i,n,a,u,h,f,_,g,v,b,w,I){const A=this.layoutVertexArray.uint16,R=12*e;A[R]=i,A[R+1]=n,A[R+2]=a,A[R+3]=u,A[R+4]=h,A[R+5]=f,A[R+6]=_,A[R+7]=g,A[R+8]=v,A[R+9]=b,A[R+10]=w,A[R+11]=I}upload(e,i,n,a,u,h){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,JE.members,!!h),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,eS.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,XS,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,rS.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,QE.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||u)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,tS.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,iS.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||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(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}vt(Zg,"SymbolBuffers");class Wg{constructor(e,i,n){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new n,this.segments=new Hi,this.collisionVertexArray=new Su,this.collisionVertexArrayExt=new Ks}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,nS.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,oS.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
vendor: 4,856 bytes, line 7
7stroy())}}vt(Wg,"CollisionBuffers");class zm{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=pe([]),this.placementViewportMatrix=pe([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.textSizeData=Mc(this.zoom,i["text-size"],this.worldview,e.availableImages),this.iconSizeData=Mc(this.zoom,i["icon-size"],this.worldview,e.availableImages);const n=this.layers[0].layout,a=n.get("symbol-sort-key"),u=n.get("symbol-z-order");this.lut=e.lut,this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(h=>co[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(e){const i=this.layers[0].getAppearances();if(!i||i.length===0)return!1;const n=Array.isArray(e)?e:[e];return i.some(a=>n.some(u=>a.getProperty(u)!=null))}createArrays(){this.text=new Zg(new E(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new Zg(new E(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new _c,this.lineVertexArray=new Bp,this.symbolInstances=new kp}calculateGlyphDependencies(e,i,n,a,u){for(const h of e){const f=h.codePointAt(0);if(f===void 0)break;if(i[f]=!0,a&&u&&f<=65535){const _=Xd[h];_&&(i[_.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,i,n,a,u,h,f){if(!e.hasProperty("icon-size"))return f*h;let _=1;const g=e.getUnevaluatedProperties()._values["icon-size"],v=Mc(this.zoom,g,this.worldview,u),b=Gu(v,i);if(v.kind!=="constant"&&v.kind!=="camera"||(_=b.uSize),v.kind==="composite"){const{minZoom:w,maxZoom:I}=v,A=g.possiblyEvaluate(new Ai(w,{worldview:this.worldview}),a),R=g.possiblyEvaluate(new Ai(I,{worldview:this.worldview}),a),O=A.evaluate(n,{},a,u);_=O+(R.evaluate(n,{},a,u)-O)*b.uSizeT}return v.kind==="source"&&(_=g.possiblyEvaluate(new Ai(this.zoom,{worldview:this.worldview}),a).evaluate(n,{},a,u)),_*h}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!lm(this.activeReplacements,n)&&(this.activeReplacements=n,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?Ln.build(e):e}populate(e,i,n,a){const u=this.layers[0],h=u.layout,f=this.projection.name==="globe",_=h.get("text-font"),g=h.get("text-field"),v=h.get("icon-image"),[b,w]=h.get("icon-size-scale-range"),I=te(i.scaleFactor||1,b,w),A=(g.value.kind!=="constant"||g.value.value instanceof an&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),R=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,O=this.hasAnyAppearanceProperty("icon-image"),D=h.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!A&&!R&&!O)return;const k=i.iconDependencies,U=i.glyphDependencies,G=i.availableImages,K=new Ai(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),Y=re=>{const oe=re.id.toString();k.has(oe)?k.get(oe).push(re):k.set(oe,[re])};for(const re of e){const{feature:oe,id:ie,index:ce,sourceLayerIndex:de}=re,De=u._featureFilter.needGeometry,Ce=Ht(oe,De);if(!u._featureFilter.filter(K,Ce,n))continue;if(De||(Ce.geometry=Ot(oe,n,a)),f&&oe.type!==1&&n.z<=5){const qe=Ce.geometry,je=.98078528056,mt=(_t,st)=>tr(Md(_t.x,_t.y,n,1),Md(st.x,st.y,n,1))<je;for(let _t=0;_t<qe.length;_t++)qe[_t]=wt(qe[_t],mt)}let Le,Ue;if(A){const qe=u.getValueAndResolveTokens("text-field",Ce,n,G),je=an.factory(qe);YS(je)&&(this.hasRTLText=!0),(!this.hasRTLText||sd()==="unavailable"||this.hasRTLText&&Co.isParsed())&&(Le=aS(je,u,Ce))}if(R){const qe=u.getValueAndResolveTokens("icon-image",Ce,n,G);Ue=this.getResolvedImageFromTokens(qe)}const Ne=this.layers[0];let Ve=!1;
7if(!Ue&&O){const qe=Ne.getAppearances();for(const je of qe)if(je.getProperty("icon-image")){const mt=Ne.getAppearanceValueAndResolveTokens(je,"icon-image",Ce,n,G);if(mt){Ue=this.getResolvedImageFromTokens(mt),Ve=!0;break}}}if(!Le&&!Ue)continue;const Se=this.sortFeaturesByKey?D.evaluate(Ce,{},n):void 0,Ge={id:ie,text:Le,icon:Ue,index:ce,sourceLayerIndex:de,geometry:Ce.geometry,properties:oe.properties,type:WS[oe.type],sortKey:Se};if(this.features.push(Ge),this.featureToAppearanceIndex[ce]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:ie,properties:oe.properties,usesAppearanceIconAsPlaceholder:Ve,isUsingAppearanceIconVertexData:!1,isUsingAppearanceTextVertexData:!1,layoutBasedIconVertexData:[],layoutBasedTextVertexData:[],activeAppearance:null}),Ue){const qe=Ne._unevaluatedLayout._values,{iconPrimary:je,iconSecondary:mt}=Qd(Ue,this.iconSizeData,qe["icon-size"],n,this.zoom,Ge,this.pixelRatio,I,this.worldview,G);Y(je),mt&&(this.hasAnySecondaryIcon=!0,Y(mt))}const Oe=Ne.getAppearances();if(Oe.length!==0&&Oe.forEach(qe=>{if(!qe.getProperty("icon-image"))return;const je=this.getCombinedIconPrimary(qe,Ne,Ce,n,G,Ge,I);je&&Y(je)}),Le){const qe=_.evaluate(Ce,{},n).join(","),je=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(co.vertical)>=0;for(const mt of Le.sections)if(mt.image){const _t=mt.image.getPrimary().scaleSelf(this.pixelRatio),st=_t.id.toString(),ct=k.get(st)||[];ct.push(_t),k.set(st,ct)}else{const _t=id(Le.toString()),st=mt.fontStack||qe,ct=U[st]=U[st]||{};this.calculateGlyphDependencies(mt.text,ct,je,this.allowVerticalPlacement,_t)}}}if(h.get("symbol-placement")==="line"&&(this.features=(function(re){const oe={},ie={},ce=[];let de=0;function De(Ne){ce.push(re[Ne]),de++}function Ce(Ne,Ve,Se){const Ge=ie[Ne];return delete ie[Ne],ie[Ve]=Ge,ce[Ge].geometry[0].pop(),ce[Ge].geometry[0]=ce[Ge].geometry[0].concat(Se[0]),Ge}function Le(Ne,Ve,Se){const Ge=oe[Ve];return delete oe[Ve],oe[Ne]=Ge,ce[Ge].geometry[0].shift(),ce[Ge].geometry[0]=Se[0].concat(ce[Ge].geometry[0]),Ge}function Ue(Ne,Ve,Se){const Ge=Se?Ve[0][Ve[0].length-1]:Ve[0][0];return`${Ne}:${Ge.x}:${Ge.y}`}for(let Ne=0;Ne<re.length;Ne++){const Ve=re[Ne],Se=Ve.geometry,Ge=Ve.text?Ve.text.toString():null;if(!Ge){De(Ne);continue}const Oe=Ue(Ge,Se),qe=Ue(Ge,Se,!0);if(Oe in ie&&qe in oe&&ie[Oe]!==oe[qe]){const je=Le(Oe,qe,Se),mt=Ce(Oe,qe,ce[je].geometry);delete oe[Oe],delete ie[qe],ie[Ue(Ge,ce[mt].geometry,!0)]=mt,ce[je].geometry=null}else Oe in ie?Ce(Oe,qe,Se):qe in oe?Le(Oe,qe,Se):(De(Ne),oe[Oe]=de-1,ie[qe]=de-1)}return ce.filter(Ne=>Ne.geometry)})(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const re of i.elevationFeatures)this.elevationFeatureIdToIndex.set(re.id,this.elevationFeatures.length),this.elevationFeatures.push(re)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((re,oe)=>re.sortKey-oe.sortKey)}getCombinedIconPrimary(e,i,n,a,u,h,f){let _,g;const v=e.getUnevaluatedProperties();if(v._values["icon-image"].value!==void 0){const b=i.getAppearanceValueAndResolveTokens(e,"icon-image",n,a,u);_=this.getResolvedImageFromTokens(b)}else{const b=i.getValueAndResolveTokens("icon-image",n,a,u);_=this.getResolvedImageFromTokens(b)}if(_){const b=e.hasProperty("icon-size")?v._values["icon-size"]:i._unevaluatedLayout._values["icon-size"];g=Qd(_,Mc(this.zoom,b,this.worldview,u),b,a,this.zoom,h,this.pixelRatio,f,this.worldview,u).iconPrimary}return g}updateSymbolInstanceIconVertices(e,i,n,a,u,h,f,_,g,v,b,w,I,A){if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(i.activeAppearance===n)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};if(n){const R=this.getCombinedIconPrimary(n,g,a,h,f,{sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:i.properties,type:"Point",id:i.id},v);if(!R)return{vertexOffsetDelta:0,hasChanges:!1};const O=R.toString(),D=this.iconAtlasPositions&&this.iconAtlasPositions.get(O);if(D){const{appearanceIconOffset:k,appearanceIconRotate:U}=Q0(n,g,a,h,w,A,I,v);let G=Em(D,void 0,k,g.layout.get("icon-anchor").evaluate(a,b,h));const K=D.sdf,Y=g.layout.get("icon-text-fit").constantOr("none");Y!=="none"&&i.textShaping&&i.iconTextFitPadding&&i.fontScale&&(G=kg(G,i.textShaping,Y,i.iconTextFitPadding,k,i.fontScale));
7const re=this.calculateEffectiveAppearanceIconSize(n,_.zoom,a,h,f,v,I),oe=0,ie=1+(Math.min(Cc,Math.round(re*Ra))<<1),ce=Ug(G,U,K,Y!=="none",v);i.isUsingAppearanceIconVertexData||(i.isUsingAppearanceIconVertexData=!0,i.layoutBasedIconVertexData=this.icon.getSymbolVertexData(u,e.numIconVertices));let de=u;for(let Ce=0;Ce<ce.length;++Ce){const Le=ce[Ce],Ue=i.layoutBasedIconVertexData[0]||e.tileAnchorX,Ne=i.layoutBasedIconVertexData[1]||e.tileAnchorY,Ve=16*Le.pixelOffsetTL.x,Se=16*Le.pixelOffsetTL.y,Ge=16*Le.pixelOffsetBR.x,Oe=16*Le.pixelOffsetBR.y,qe=16*Le.minFontScaleX,je=16*Le.minFontScaleY;this.icon.updateSymbolVertexData(de,Ue,Ne,Math.round(32*Le.tl.x),Math.round(32*Le.tl.y),Le.texPrimary.x,Le.texPrimary.y,oe,ie,Ve,Se,qe,je),this.icon.updateSymbolVertexData(de+1,Ue,Ne,Math.round(32*Le.tr.x),Math.round(32*Le.tr.y),Le.texPrimary.x+Le.texPrimary.w,Le.texPrimary.y,oe,ie,Ge,Se,qe,je),this.icon.updateSymbolVertexData(de+2,Ue,Ne,Math.round(32*Le.bl.x),Math.round(32*Le.bl.y),Le.texPrimary.x,Le.texPrimary.y+Le.texPrimary.h,oe,ie,Ve,Oe,qe,je),this.icon.updateSymbolVertexData(de+3,Ue,Ne,Math.round(32*Le.br.x),Math.round(32*Le.br.y),Le.texPrimary.x+Le.texPrimary.w,Le.texPrimary.y+Le.texPrimary.h,oe,ie,Ge,Oe,qe,je),de+=4}const De=e.numIconVertices-4*ce.length;for(let Ce=0;Ce<De;++Ce)this.icon.updateSymbolVertexData(de+Ce,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else if(i.usesAppearanceIconAsPlaceholder){if(this.layers[0].appearances&&this.layers[0].appearances.length>0)return this.icon.updateSymbolVertexData(u,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(u+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(u+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(u+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}else if(i.isUsingAppearanceIconVertexData){const O=i.layoutBasedIconVertexData.length/12;for(let D=0;D<O;++D){const k=D*12;this.icon.updateSymbolVertexData(u+D,i.layoutBasedIconVertexData[k+0],i.layoutBasedIconVertexData[k+1],i.layoutBasedIconVertexData[k+2],i.layoutBasedIconVertexData[k+3],i.layoutBasedIconVertexData[k+4],i.layoutBasedIconVertexData[k+5],i.layoutBasedIconVertexData[k+6],i.layoutBasedIconVertexData[k+7],i.layoutBasedIconVertexData[k+8],i.layoutBasedIconVertexData[k+9],i.layoutBasedIconVertexData[k+10],i.layoutBasedIconVertexData[k+11])}return i.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:O,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k){const U=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!U)return{vertexOffsetDelta:U?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(i.activeAppearance===n)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};if(n&&i.textShaping){const{appearanceTextOffset:G,appearanceTextRotate:K,appearanceTextSize:Y}=eb(n,f,a,h,b,I,w);i.fontScale=nb(Y,i.textScaleFactor);const re=n.getUnevaluatedProperty("text-size");let oe=this.textSizeData,ie=O,ce=D;n.hasProperty("text-size")&&(oe=Mc(this.zoom,re,this.worldview,k),ie=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,ce=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0);const de=i.textShaping.bottom-b[1],De=i.textShaping.left-b[0],Ce=i.textShaping.right-b[0];i.textShaping.top=G[1]+(i.textShaping.top-b[1]),i.textShaping.bottom=G[1]+de,i.textShaping.left=G[0]+De,i.textShaping.right=G[0]+Ce;const Le=K0(0,i.textShaping,G,f,!1,a,g,this.allowVerticalPlacement,K),Ue=Y&&oe.kind==="composite"?re.possiblyEvaluate(new Ai(ie,{}),h).evaluate(a,v,h):A,Ne=Y&&oe.kind==="composite"?re.possiblyEvaluate(new Ai(ce,{}),h).evaluate(a,v,h):R,Ve=$g(n.name,oe,Y,_,Ue,Ne),Se=Array.isArray(Ve)?Ve[1]:Y,Ge=0,Oe=1+(Math.min(Cc,Math.round(Se*Ra))<<1);i.isUsingAppearanceTextVertexData||(i.isUsingAppearanceTextVertexData=!0,i.layoutBasedTextVertexData=this.text.getSymbolVertexData(u,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let qe=0;qe<Le.length&&qe<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++qe){const je=Le[qe],mt=je.glyphOffset[1],_t=e.tileAnchorX,st=e.tileAnchorY,ct=u+4*qe;this.text.updateSymbolVertexData(ct,_t,st,Math.round(32*je.tl.x),Math.round(32*(mt+je.tl.y)),je.texPrimary.x,je.texPrimary.y,Ge,Oe,je.pixelOffsetTL.x,je.pixelOffsetTL.y,je.minFontScaleX,je.minFontScaleY),this.text.updateSymbolVertexData(ct+1,_t,st,Math.round(32*je.tr.x),Math.round(32*(mt+je.tr.y)),je.texPrimary.x+je.texPrimary.w,je.texPrimary.y,Ge,Oe,je.pixelOffsetBR.x,je.pixelOffsetTL.y,je.minFontScaleX,je.minFontScaleY),this.text.updateSymbolVertexData(ct+2,_t,st,Math.round(32*je.bl.x),Math.round(32*(mt+je.bl.y)),je.texPrimary.x,je.texPrimary.y+je.texPrimary.h,Ge,Oe,je.pixelOffsetTL.x,je.pixelOffsetBR.y,je.minFontScaleX,je.minFontScaleY),this.text.updateSymbolVertexData(ct+3,_t,st,Math.round(32*je.br.x),Math.round(32*(mt+je.br.y)),je.texPrimary.x+je.texPrimary.w,je.texPrimary.y+je.texPrimary.h,Ge,Oe,je.pixelOffsetBR.x,je.pixelOffsetBR.y,je.minFontScaleX,je.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}if(i.isUsingAppearanceTextVertexData){const K=i.layoutBasedTextVertexData.length/12;for(let Y=0;Y<K;++Y){const re=Y*12;this.text.updateSymbolVertexData(u+Y,i.layoutBasedTextVertexData[re+0],i.layoutBasedTextVertexData[re+1],i.layoutBasedTextVertexData[re+2],i.layoutBasedTextVertexData[re+3],i.layoutBasedTextVertexData[re+4],i.layoutBasedTextVertexData[re+5],i.layoutBasedTextVertexData[re+6],i.layoutBasedTextVertexData[re+7],i.layoutBasedTextVertexData[re+8],i.layoutBasedTextVertexData[re+9],i.layoutBasedTextVertexData[re+10],i.layoutBasedTextVertexData[re+11])}return i.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:K,hasChanges:!0}}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}update(e,i,n,a,u,h,f){this.text.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const n=et(e),a=1/n;let u=!1,h=!1;for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f),g=Ci(1,0,0),v=Ci(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:I,numVerticalIconVertices:A}=_,R=b>0||w>0,O=I>0,D=this.elevationFeatures[_.elevationFeatureIndex];if(D){const k=new Ke(_.tileAnchorX,_.tileAnchorY),U=.075+D.pointElevation(k);_.zOffset!==U&&(i=!0,_.zOffset=U),U!==0&&(this.hasAnyZOffset=!0);const G=D.computeSlopeNormal(k,a),K=ts(Qo(),Ci(0,0,1),G);Is(g,g,K),Is(v,v,K),g[2]*=n,v[2]*=n,g[0]===1&&g[1]===0&&g[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(u=u||R,h=h||O)}if(R&&(Dm(this.text.orientationVertexArray,b,g,v),Dm(this.text.orientationVertexArray,w,g,v)),O){const{placedIconSymbolIndex:k,verticalPlacedIconSymbolIndex:U}=_;k>=0&&Dm(this.icon.orientationVertexArray,I,g,v),U>=0&&Dm(this.icon.orientationVertexArray,A,g,v)}}u||(this.text.orientationVertexArray=void 0),h||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(u,h,f)=>{n+=h,n>u.length&&u.resize(n);for(let _=-h;_<0;_++)u.emplace(_+n,f)},i=(u,h,f)=>{a+=h,a>u.length&&u.resize(a);for(let _=-h;_<0;_++)u.emplace(_+a,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,a=0;for(let u=0;u<this.symbolInstances.length;u++){const h=this.symbolInstances.get(u),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:_,numIconVertices:g}=h,v=h.zOffset,b=g>0;if((f>0||_>0)&&(e(this.text.zOffsetVertexArray,f,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:I}=h;w>=0&&i(this.icon.zOffsetVertexArray,g,v),I>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,v)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,i,n,a,u){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(h=>h.appearances&&h.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,i,n,a,u){if(!(e&&i&&n&&this.appearanceFeatureData))return!1;const h=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,f=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!h&&!f)return!1;const _=this.layers[0],g=_.layout;let v=1,b=0,w=!1;if(h){const[D,k]=g.get("icon-size-scale-range");v=te(1,D,k)}let I=1,A=0,R=!1;if(f){const[D,k]=g.get("text-size-scale-range");I=te(1,D,k)}const O=new Map;if(u&&n)for(const D of n){const k=u.getImage(D,_.scope);if(k){const U=new Rn(D.toString());O.set(U.toString(),k)}}for(let D=0;D<this.symbolInstances.length;D++){const k=this.symbolInstances.get(D),U=this.featureToAppearanceIndex[k.featureIndex],G=U!==void 0?this.appearanceFeatureData[U]:void 0;if(!G)continue;const K=G.id,Y=i&&K!==void 0?i[String(K)]:void 0,re={type:"Point",id:G.id,properties:G.properties,geometry:[]},oe=_.appearances&&_.appearances.find(ie=>ie.isActive({globals:a,feature:re,canonical:e,featureState:Y}));if(f){const ie=g.get("text-size"),ce=g.get("text-offset").evaluate(re,Y,e),de=ie.evaluate(re,Y,e),De=g.get("text-rotate").evaluate(re,Y,e),Ce=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,Le=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0,Ue=ie.evaluate(re,{zoom:Ce},e),Ne=ie.evaluate(re,{zoom:Le},e),Ve=this.updateSymbolInstanceTextVertices(k,G,oe,re,A,e,_,I,O,Y,ce,de,De,Ue,Ne,Ce,Le,n);A+=Ve.vertexOffsetDelta,R=R||Ve.hasChanges}if(h){const ie=g.get("icon-offset").evaluate(re,Y,e),ce=g.get("icon-size").evaluate(re,Y,e,n),de=g.get("icon-rotate").evaluate(re,Y,e),De=this.updateSymbolInstanceIconVertices(k,G,oe,re,b,e,n,a,_,v,Y,ie,ce,de);b+=De.vertexOffsetDelta,w=w||De.hasChanges}G.activeAppearance=oe}return w&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),R&&this.text.layoutVertexBuffer&&this.text.layoutVertexArray.arrayBuffer!==null&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),w||R}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=db(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:u}of i)this.lineVertexArray.emplaceBack(a,u);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,i,n,a,u,h,f,_,g,v,b,w,I,A,R,O,D,k){const U=e.indexArray,G=e.layoutVertexArray,K=e.globeExtVertexArray,Y=e.segments.prepareSegment(4*k,G,U,this.canOverlap?h.sortKey:void 0),re=this.glyphOffsetArray.length,oe=Y.vertexLength,ie=this.allowVerticalPlacement&&f===co.vertical?Math.PI/2:0,ce=h.text&&h.text.sections;for(let Ce=0;Ce<i.length;Ce++){const{tl:Le,tr:Ue,bl:Ne,br:Ve,texPrimary:Se,texSecondary:Ge,pixelOffsetTL:Oe,pixelOffsetBR:qe,minFontScaleX:je,minFontScaleY:mt,glyphOffset:_t,isSDF:st,sectionIndex:ct}=i[Ce],Rt=Y.vertexLength,St=_t[1];if(sf(G,g.x,g.y,Le.x,St+Le.y,Se.x,Se.y,n,st,Oe.x,Oe.y,je,mt),sf(G,g.x,g.y,Ue.x,St+Ue.y,Se.x+Se.w,Se.y,n,st,qe.x,Oe.y,je,mt),sf(G,g.x,g.y,Ne.x,St+Ne.y,Se.x,Se.y+Se.h,n,st,Oe.x,qe.y,je,mt),sf(G,g.x,g.y,Ve.x,St+Ve.y,Se.x+Se.w,Se.y+Se.h,n,st,qe.x,qe.y,je,mt),_){const{x:ft,y:Bt,z:Jt}=_.anchor,[pi,Yt,Mi]=_.up;lf(K,ft,Bt,Jt,pi,Yt,Mi),lf(K,ft,Bt,Jt,pi,Yt,Mi),lf(K,ft,Bt,Jt,pi,Yt,Mi),lf(K,ft,Bt,Jt,pi,Yt,Mi),Zu(e.dynamicLayoutVertexArray,ft,Bt,Jt,ie)}else Zu(e.dynamicLayoutVertexArray,g.x,g.y,g.z,ie);
vendor: 16,545 bytes, line 7
7if(O){const ft=Ge||Se;af(e.iconTransitioningVertexArray,ft.x,ft.y),af(e.iconTransitioningVertexArray,ft.x+ft.w,ft.y),af(e.iconTransitioningVertexArray,ft.x,ft.y+ft.h),af(e.iconTransitioningVertexArray,ft.x+ft.w,ft.y+ft.h)}U.emplaceBack(Rt,Rt+1,Rt+2),U.emplaceBack(Rt+1,Rt+2,Rt+3),Y.vertexLength+=4,Y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_t[0]),Ce!==i.length-1&&ct===i[Ce+1].sectionIndex||e.programConfigurations.populatePaintArrays(G.length,h,h.index,{},I,A,R,ce&&ce[ct],this.worldview)}const de=k-i.length;de!==0&&this._addNullVertices(de,G,n,_,K,e,O,Y,U);const De=_?_.anchor:g;e.placedSymbolArray.emplaceBack(De.x,De.y,De.z,g.x,g.y,re,this.glyphOffsetArray.length-re,oe,v,b,g.segment,n?n[0]:0,n?n[1]:0,a[0],a[1],f,0,0,0,w,0),e.symbolInstanceIndices.push(D)}_addNullVertices(e,i,n,a,u,h,f,_,g){for(let v=0;v<e;v++){for(let w=0;w<4;w++)sf(i,0,0,0,0,0,0,n,!1,0,0,0,0),a&&lf(u,0,0,0,0,0,0),Zu(h.dynamicLayoutVertexArray,0,0,0,0),f&&af(h.iconTransitioningVertexArray,0,0);const b=_.vertexLength;g.emplaceBack(b,b+1,b+2),g.emplaceBack(b+1,b+2,b+3),_.vertexLength+=4,_.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,i,n,a,u,h,f){e.emplaceBack(i,n,a,u,h,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,n,a,u,h,f){const _=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),g=_.vertexLength,v=f.tileAnchorX,b=f.tileAnchorY;for(let I=0;I<4;I++)n.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(n.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(n.layoutVertexArray,a,u,h,v,b,new Ke(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,u,h,v,b,new Ke(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,u,h,v,b,new Ke(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,a,u,h,v,b,new Ke(e.x1,e.y2)),_.vertexLength+=4;const w=n.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),_.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,n,a,u,h){for(let f=a;f<u;f++){const _=n.get(f),g=this.getSymbolInstanceTextSize(e,h,i,f);this._addCollisionDebugVertices(_,g,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,n,a,u,h){for(let f=a;f<u;f++){const _=n.get(f),g=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(_,g,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,n){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Wg(Tu,A0.members,ro),this.iconCollisionBox=new Wg(Tu,A0.members,ro);const a=Gu(this.iconSizeData,e),u=Gu(this.textSizeData,e,n);for(let h=0;h<this.symbolInstances.length;h++){const f=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(u,e,i,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(u,e,i,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,i,n,a){const u=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),h=Bg(this.textSizeData,e,u)/Br;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,n){const a=this.icon.placedSymbolArray.get(n),u=Bg(this.iconSizeData,e,a);return this.tilePixelRatio*u}_commitDebugCollisionVertexUpdate(e,i,n,a){e.emplaceBack(i,-n,-n,a),e.emplaceBack(i,n,-n,a),e.emplaceBack(i,n,n,a),e.emplaceBack(i,-n,n,a)}_updateTextDebugCollisionBoxes(e,i,n,a,u,h,f){for(let _=a;_<u;_++){const g=n.get(_),v=this.getSymbolInstanceTextSize(e,h,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,g.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,n,a,u,h,f){for(let _=a;_<u;_++){const g=n.get(_),v=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,g.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,n,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const u=Gu(this.iconSizeData,e,a),h=Gu(this.textSizeData,e,n);for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(h,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,n),this._updateTextDebugCollisionBoxes(h,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,n),this._updateIconDebugCollisionBoxes(u,e,i,_.iconBoxStartIndex,_.iconBoxEndIndex,_,a),this._updateIconDebugCollisionBoxes(u,e,i,_.verticalIconBoxStartIndex,_.verticalIconBoxEndIndex,_,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,n,a,u,h,f,_,g){const v={};if(i<n){const{x1:b,y1:w,x2:I,y2:A,padding:R,projectedAnchorX:O,projectedAnchorY:D,projectedAnchorZ:k,tileAnchorX:U,tileAnchorY:G,featureIndex:K}=e.get(i);v.textBox={x1:b,y1:w,x2:I,y2:A,padding:R,projectedAnchorX:O,projectedAnchorY:D,projectedAnchorZ:k,tileAnchorX:U,tileAnchorY:G},v.textFeatureIndex=K}if(a<u){const{x1:b,y1:w,x2:I,y2:A,padding:R,projectedAnchorX:O,projectedAnchorY:D,projectedAnchorZ:k,tileAnchorX:U,tileAnchorY:G,featureIndex:K}=e.get(a);v.verticalTextBox={x1:b,y1:w,x2:I,y2:A,padding:R,projectedAnchorX:O,projectedAnchorY:D,projectedAnchorZ:k,tileAnchorX:U,tileAnchorY:G},v.verticalTextFeatureIndex=K}if(h<f){const{x1:b,y1:w,x2:I,y2:A,padding:R,projectedAnchorX:O,projectedAnchorY:D,projectedAnchorZ:k,tileAnchorX:U,tileAnchorY:G,featureIndex:K}=e.get(h);v.iconBox={x1:b,y1:w,x2:I,y2:A,padding:R,projectedAnchorX:O,projectedAnchorY:D,projectedAnchorZ:k,tileAnchorX:U,tileAnchorY:G},v.iconFeatureIndex=K}if(_<g){const{x1:b,y1:w,x2:I,y2:A,padding:R,projectedAnchorX:O,projectedAnchorY:D,projectedAnchorZ:k,tileAnchorX:U,tileAnchorY:G,featureIndex:K}=e.get(_);v.verticalIconBox={x1:b,y1:w,x2:I,y2:A,padding:R,projectedAnchorX:O,projectedAnchorY:D,projectedAnchorZ:k,tileAnchorX:U,tileAnchorY:G},v.verticalIconFeatureIndex=K}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const n=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const n=e.placedSymbolArray.get(i),a=n.vertexStartIndex+4*n.numGlyphs;for(let u=n.vertexStartIndex;u<a;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),n=Math.cos(e),a=[],u=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const _=this.symbolInstances.get(f);a.push(0|Math.round(i*_.tileAnchorX+n*_.tileAnchorY)),u.push(_.featureIndex)}return h.sort((f,_)=>a[f]-a[_]||u[_]-u[f]),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===i?n.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)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const n=this.symbolInstances.get(i);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:u,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:g}=n;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),u>=0&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),h>=0&&h!==u&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(e){const i=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let n;return this.elevationFeatures&&i<this.elevationFeatures.length&&(n=this.elevationFeatures[i]),n}}function fb(r,e){return e.replace(/{([^{}]+)}/g,(i,n)=>n in r?String(r[n]):"")}let pb,mb,Xg;vt(zm,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),zm.addDynamicAttributes=Zu;class _b{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Pn,this.defaultValue=e}evaluate(e){if(e.formattedSection){const 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}}vt(_b,"FormatSectionOverride",{omit:["defaultValue"]});const Yg=()=>Xg||(Xg={layout:pb||(pb=new ir({"symbol-placement":new it(be.layout_symbol["symbol-placement"]),"symbol-spacing":new it(be.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new it(be.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ht(be.layout_symbol["symbol-sort-key"]),"symbol-z-order":new it(be.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new it(be.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new it(be.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new it(be.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new it(be.layout_symbol["icon-ignore-placement"]),"icon-optional":new it(be.layout_symbol["icon-optional"]),"icon-rotation-alignment":new it(be.layout_symbol["icon-rotation-alignment"]),"icon-size":new ht(be.layout_symbol["icon-size"]),"icon-size-scale-range":new it(be.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new ht(be.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ht(be.layout_symbol["icon-text-fit-padding"]),"icon-image":new ht(be.layout_symbol["icon-image"]),"icon-image-use-theme":new it({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new ht(be.layout_symbol["icon-rotate"]),"icon-padding":new it(be.layout_symbol["icon-padding"]),"icon-keep-upright":new it(be.layout_symbol["icon-keep-upright"]),"icon-offset":new ht(be.layout_symbol["icon-offset"]),"icon-anchor":new ht(be.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new it(be.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new it(be.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new it(be.layout_symbol["text-rotation-alignment"]),"text-field":new ht(be.layout_symbol["text-field"]),"text-font":new ht(be.layout_symbol["text-font"]),"text-size":new ht(be.layout_symbol["text-size"]),"text-size-scale-range":new it(be.layout_symbol["text-size-scale-range"]),"text-max-width":new ht(be.layout_symbol["text-max-width"]),"text-line-height":new ht(be.layout_symbol["text-line-height"]),"text-letter-spacing":new ht(be.layout_symbol["text-letter-spacing"]),"text-justify":new ht(be.layout_symbol["text-justify"]),"text-radial-offset":new ht(be.layout_symbol["text-radial-offset"]),"text-variable-anchor":new it(be.layout_symbol["text-variable-anchor"]),"text-anchor":new ht(be.layout_symbol["text-anchor"]),"text-max-angle":new it(be.layout_symbol["text-max-angle"]),"text-writing-mode":new it(be.layout_symbol["text-writing-mode"]),"text-rotate":new ht(be.layout_symbol["text-rotate"]),"text-padding":new it(be.layout_symbol["text-padding"]),"text-keep-upright":new it(be.layout_symbol["text-keep-upright"]),"text-transform":new ht(be.layout_symbol["text-transform"]),"text-offset":new ht(be.layout_symbol["text-offset"]),"text-allow-overlap":new it(be.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new it(be.layout_symbol["text-ignore-placement"]),"text-optional":new it(be.layout_symbol["text-optional"]),visibility:new it(be.layout_symbol.visibility)})),paint:mb||(mb=new ir({"icon-opacity":new ht(be.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new ht(be.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new ht(be.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new ht(be.paint_symbol["text-emissive-strength"]),"icon-color":new ht(be.paint_symbol["icon-color"]),"icon-halo-color":new ht(be.paint_symbol["icon-halo-color"]),"icon-halo-width":new ht(be.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ht(be.paint_symbol["icon-halo-blur"]),"icon-translate":new it(be.paint_symbol["icon-translate"]),"icon-translate-anchor":new it(be.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new it(be.paint_symbol["icon-image-cross-fade"]),"text-opacity":new ht(be.paint_symbol["text-opacity"]),"text-occlusion-opacity":new ht(be.paint_symbol["text-occlusion-opacity"]),"text-color":new ht(be.paint_symbol["text-color"],{runtimeType:mn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new ht(be.paint_symbol["text-halo-color"]),"text-halo-width":new ht(be.paint_symbol["text-halo-width"]),"text-halo-blur":new ht(be.paint_symbol["text-halo-blur"]),"text-translate":new it(be.paint_symbol["text-translate"]),"text-translate-anchor":new it(be.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new it(be.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new it(be.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new it(be.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new it(be.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new ht(be.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},Xg);class Om extends yn{constructor(e,i,n,a){super(e,Yg(),i,n,a,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=pe([]),this.hasOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){e!=="icon-occlusion-opacity"&&e!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,i){super.recalculate(e,i),this.appearances&&this.appearances.forEac
7h(a=>{a.recalculate(e,i,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const a=[];for(const u of n)a.indexOf(u)<0&&a.push(u);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,n,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===n&&this._brightnessMax===a||(this._colorAdjustmentMatrix=(function(u,h,f,_){u=Xr(u),h=or(h);const g=Be(),v=u/3,b=1-2*v,w=[b,v,v,0,v,b,v,0,v,v,b,0,0,0,0,1],I=.5-.5*h,A=_-f;return at(g,[A,0,0,0,0,A,0,0,0,0,A,0,f,f,f,1],[h,0,0,0,0,h,0,0,0,0,h,0,I,I,I,1]),at(g,g,w),g})(e,i,n,a),this._saturation=e,this._contrast=i,this._brightnessMin=n,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,n,a){const u=this.layout.get(e).evaluate(i,{},n,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||rc(h.value)||!u?u:fb(i.properties,u)}getAppearanceValueAndResolveTokens(e,i,n,a,u){const h=e.getProperty(i);if(!h)return;const f=h.evaluate(n,{},a,u),_=e.getUnevaluatedProperties()._values[i];return _.isDataDriven()||rc(_.value)||!f||typeof f!="string"?f:fb(n.properties,f)}createBucket(e){return new zm(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Yg().paint.overridableProperties){if(!Om.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),n=new _b(i),a=new du(n,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new nc("source",a):new ba("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Ta(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&Om.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const n=e.get("text-field"),a=Yg().paint.properties[i];let u=!1;const h=f=>{for(const _ of f)if(a.overrides&&a.overrides.hasOverride(_))return void(u=!0)};if(n.value.kind==="constant"&&n.value.value instanceof an)h(n.value.value.sections);else if(n.value.kind==="source"){const f=g=>{u||(g instanceof hs&&Dr(g.value)===Ha?h(g.value.sections):g instanceof It?h(g.sections):g.eachChild(f))},_=n.value;_._styleExpression&&f(_._styleExpression.expression)}return u}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,n){return{config:new T(this,{zoom:i,lut:n}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let gb,yb,xb,vb;var Kg=ei([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function Fm(r,e,i,n,a,u,h,f){const _=[r,e,1,i,n,1,a,u,1],g=[h,f,1],v=ke([],_),[b,w,I]=Ss(g,g,v);return dt(_,_,[b,0,0,0,w,0,0,0,I])}function bb(r,e,i,n,a,u,h,f){const _=(function(g,v,b,w,I,A,R,O){const D=Fm(0,0,1,0,1,1,0,1),k=Fm(g,v,b,w,I,A,R,O);return dt(k,k,ke([],D))})(r,e,i,n,a,u,h,f);return[_[2]/_[8]/lt,_[5]/_[8]/lt]}function km(r){return[r[0],Math.min(Math.max(r[1],-85.051129),he)]}class wb extends us{constructor(e,i,n,a){super(),this.id=e,this.dispatcher=n,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 cs("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Fc(this.map._requestManager.transformRequest(this.url,Mn.Image),(n,a)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new Ul(n)):a&&(this.image=a instanceof HTMLImageElement?Jn.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Hd(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 cs("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 Hd||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],n=e[0][1];for(const u of e)u[1]>n&&(n=u[1]),u[1]<i&&(i=u[1]);const a=(n+i)/2;if(a>he?this.onNorthPole=!0:a<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const u=e.map(ut.fromLngLat);this.tileID=(function(h){let f=1/0,_=1/0,g=-1/0,v=-1/0;for(const R of h)f=Math.min(f,R.x),_=Math.min(_,R.y),g=Math.max(g,R.x),v=Math.max(v,R.y);const b=Math.max(g-f,v-_),w=Math.max(0,Math.floor(-Math.log2(b))),I=Math.pow(2,w);let A=Math.floor((f+g)/2*I);return A>1&&(A-=1),new wc(w,A,Math.floor((_+v)/2*I))})(u),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new cs("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Hd||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const D in this.tiles){const k=this.tiles[D];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=ef(new wc(0,0,0),this.map.transform.projection),n=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!(function(D){const k=D[1].x-D[0].x,U=D[1].y-D[0].y,G=D[2].x-D[1].x,K=D[2].y-D[1].y,Y=D[3].x-D[2].x,re=D[3].y-D[2].y,oe=D[0].x-D[3].x,ie=D[0].y-D[3].y,ce=k*K-G*U,de=G*re-Y*K,De=Y*ie-oe*re,Ce=oe*U-k*ie;return ce>0&&de>0&&De>0&&Ce>0||ce<0&&de<0&&De<0&&Ce<0})(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=ef(this.tileID,this.map.transform.projection),[u,h,f,_]=this.coordinates.map(D=>{const k=a.projection.project(D[0],D[1]);return ab(a,k)._round()});this.perspectiveTransform=bb(u.x,u.y,h.x,h.y,f.x,f.y,_.x,_.y);const g=this._boundsArray=new _s;g.emplaceBack(u.x,u.y,0,0),g.emplaceBack(h.x,h.y,lt,0),g.emplaceBack(_.x,_.y,0,lt),g.emplaceBack(f.x,f.y,lt,lt),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,Kg.members),this.boundsSegments=Hi.simpleSegment(0,0,4,2);const v=[],b=[km((w=this.coordinates)[0]),km(w[1]),km(w[2]),km(w[3])];var w;const[I,A,R,O]=(function(D){let k=D[0][0],U=k,G=D[0][1],K=G;for(let Y=1;Y<D.length;Y++)D[Y][0]<k?k=D[Y][0]:D[Y][0]>U&&(U=D[Y][0]),D[Y][1]<G?G=D[Y][1]:D[Y][1]>K&&(K=D[Y][1]);return[k,G,U-k,K-G]})(b);{const D=new _s,[k,U,G,K]=(function(Ve){let Se=Ve[0].x,Ge=Se,Oe=Ve[0].y,qe=Oe;for(let je=1;je<Ve.length;je++)Ve[je].x<Se?Se=Ve[je].x:Ve[je].x>Ge&&(Ge=Ve[je].x),Ve[je].y<Oe?Oe=Ve[je].y:Ve[je].y>qe&&(qe=Ve[je].y);return[Se,Oe,Ge-Se,qe-Oe]})(n),Y=Ve=>[(Ve.x-k)/G,(Ve.y-U)/K],[re,oe,ie,ce]=n.map(Y),de=(function(Ve,Se,Ge,Oe,qe,je,mt,_t){const st=Fm(0,0,1,0,1,1,0,1);return dt(st,st,ke([],Fm(Ve,Se,Ge,Oe,qe,je,mt,_t)))})(re[0],re[1],oe[0],oe[1],ie[0],ie[1],ce[0],ce[1]);this.elevatedGlobePerspectiveTransform=bb(re[0],re[1],oe[0],oe[1],ie[0],ie[1],ce[0],ce[1]);const De=(Ve,Se)=>{v.push(Ve.lng);const Ge=Math.round((Ve.lng-I)/R*lt),Oe=Math.round((Ve.lat-A)/O*lt),qe=Y(Se),je=Ss([],[qe[0],qe[1],1],de),mt=Math.round(je[0]/je[2]*lt),_t=Math.round(je[1]/je[2]*lt);D.emplaceBack(Ge,Oe,mt,_t)},Ce=n[3].x-n[0].x,Le=n[3].y-n[0].y,Ue=n[2].x-n[1].x,Ne=n[2].y-n[1].y;for(let Ve=0;Ve<65;Ve++){const Se=Ve/64,Ge=[n[0].x+Se*Ce,n[0].y+Se*Le],Oe=[n[1].x+Se*Ue,n[1].y+Se*Ne],qe=Oe[0]-Ge[0],je=Oe[1]-Ge[1];for(let mt=0;mt<65;mt++){const _t=mt/64,st={x:Ge[0]+qe*_t,y:Ge[1]+je*_t};De(i.projection.unproject(st.x,st.y),st)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(D,Kg.members)}{this.maxLongitudeTriangleSize=0;let D=[],k=new Mr;
7const U=(G,K,Y)=>{k.emplaceBack(G,K,Y);const re=v[G],oe=v[K],ie=v[Y],ce=Math.min(Math.min(re,oe),ie),de=Math.max(Math.max(re,oe),ie)-ce;de>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=de),D.push(ce+de/2)};for(let G=0;G<64;G++)for(let K=0;K<64;K++){const Y=65*G+K,re=Y+1,oe=Y+65,ie=oe+1;U(Y,oe,re),U(re,oe,ie)}[D,k]=(function(G,K){const Y=Array.from({length:G.length},(ie,ce)=>ce);Y.sort((ie,ce)=>G[ie]-G[ce]);const re=[],oe=new Mr;for(let ie=0;ie<Y.length;ie++){const ce=Y[ie];re.push(G[ce]);const de=3*ce,De=de+1;oe.emplaceBack(K.uint16[de],K.uint16[De],K.uint16[De+1])}return[re,oe]})(D,k),this.elevatedGlobeTrianglesCenterLongitudes=D,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(k)}this.elevatedGlobeSegments=Hi.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,R/lt,0,O/lt,0,0,A,I,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,n=i.gl;!this._dirty||this.texture instanceof Hd||(this.texture?this.texture.update(this.image):(this.texture=new bg(i,this.image,n.RGBA8),this.texture.bind(n.LINEAR,n.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={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const n=this.elevatedGlobeTrianglesCenterLongitudes;let a=(u=e+180)+360*Math.round((n[0]-u)/360);var u;const h=new Hi,f=(b,w)=>{h.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},_=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-a)<=_){const b=Ri(n,0,n.length,a+_);return b===n.length||f(b,Pi(n,b+1,n.length,a+360-_)-b),h}a<n[0]&&(a+=360);const g=Pi(n,0,n.length,a-_);if(g===n.length)return f(0,n.length),h;f(0,g-0);const v=Ri(n,g+1,n.length,a+_);return v!==n.length&&f(v,n.length-v),h}}const Jg=1024,KS=(Math.pow(Jg,2)-1)/268170240;class Tb extends yn{constructor(e,i,n,a){super(e,{layout:xb||(xb=new ir({visibility:new it(be.layout_raster.visibility)})),paint:vb||(vb=new ir({"raster-opacity":new it(be.paint_raster["raster-opacity"]),"raster-color":new cl(be.paint_raster["raster-color"]),"raster-color-mix":new it(be.paint_raster["raster-color-mix"]),"raster-color-range":new it(be.paint_raster["raster-color-range"]),"raster-hue-rotate":new it(be.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new it(be.paint_raster["raster-brightness-min"]),"raster-brightness-max":new it(be.paint_raster["raster-brightness-max"]),"raster-saturation":new it(be.paint_raster["raster-saturation"]),"raster-contrast":new it(be.paint_raster["raster-contrast"]),"raster-resampling":new it(be.paint_raster["raster-resampling"]),"raster-fade-duration":new it(be.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new it(be.paint_raster["raster-emissive-strength"]),"raster-array-band":new it(be.paint_raster["raster-array-band"]),"raster-elevation":new it(be.paint_raster["raster-elevation"]),"raster-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},i,n,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 wb&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[n,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(n)&&isNaN(a)||n===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Cd({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:n,end:a}],resolution:Jg}),this.colorRampTexture=null,this._curRampRange=[n,a])}is3D(e){return this.paint.get("raster-elevation")>0}}let Eb,Sb,Ib,Ab,Mb;class Cb extends yn{constructor(e,i,n,a){super(e,{layout:Eb||(Eb=new ir({visibility:new it(be["layout_raster-particle"].visibility)})),paint:Sb||(Sb=new ir({"raster-particle-array-band":new it(be["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new it(be["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new cl(be["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new it(be["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new it(be["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new it(be["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new it(be["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new it(be["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},i,n,a),this._updateColorRamp(),this.lastInvalidatedAt=Jn.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Cd({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}
vendor: 11,943 bytes, line 7
7_invalidateAnimationState(){this.lastInvalidatedAt=Jn.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class JS extends yn{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function Qg(r,e,i){const n=[0,0,1],a=es([]);return ua(a,a,i?-ci(r)+Math.PI:ci(r)),Ms(a,a,-ci(e)),Is(n,n,a),Ii(n,n)}const Pb={None:0,Model:1,Symbol:2,FillExtrusion:4};class Bm{constructor(e,i,n,a){this.message=(e?`${e}: `:"")+n,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function ey(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class Rb{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 Lb{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new Ed,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const i=16*e,n=this.instancedDataArray.float32;let a=Math.floor(n[i+2]);const u=1.05*(n[i+2]-a);return a/=100,[n[i]%1*1.05,n[i+1]%1*1.05,u,a]}tileCoordinatesForInstance(e){const i=16*e,n=this.instancedDataArray.float32;let a=n[i+0];return a=a>lt?a-lt:a,new Ke(Math.trunc(a),Math.trunc(n[i+1]))}translationForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+4],n[i+5],n[i+6]]}rotationScaleForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+7],n[i+8],n[i+9],n[i+10],n[i+11],n[i+12],n[i+13],n[i+14],n[i+15]]}transformForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+7],n[i+8],n[i+9],n[i+4],n[i+10],n[i+11],n[i+12],n[i+5],n[i+13],n[i+14],n[i+15],n[i+6],0,0,0,1]}}class ty{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){this.tileToMeter=et(n);const u=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const h=this.layers[0].paint.get("model-elevation-reference")==="hd-road-markup"?i.elevationFeatures:void 0;for(const{feature:f,id:_,index:g,sourceLayerIndex:v}of e){const b=_??(f.properties&&f.properties.hasOwnProperty("id")?f.properties.id:void 0),w=Ht(f,u);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),w,n))continue;const I={id:b,sourceLayerIndex:v,index:g,geometry:u?w.geometry:Ot(f,n,a),properties:f.properties,type:f.type,patterns:{}},A=this.addFeature(I,I.geometry,w,h,n);A&&i.featureIndex.insert(f,I.geometry,g,v,this.index,this.instancesPerModel[A].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,i=this.layers[0].scope;let n=0;for(const a of this.modelUris){const u=e.getModel(a,i);if(!u)continue;const h=this.instancesPerModel[a];if(h){const f=.5*za(u.aabb.max,u.aabb.min)*h.maxScale+h.maxXYTranslationDistance,_=Math.min(lt,Math.max(f/this.tileToMeter,256));n=Math.max(_,n)}}return n}update(e,i,n,a){for(const u in this.instancesPerModel){const h=this.instancesPerModel[u];for(const f in e)h.idToFeaturesIndex.hasOwnProperty(f)&&(this.evaluate(h.features[h.idToFeaturesIndex[f]],e[f],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];for(const a of n.features){const u=this.layers[0],h=a.feature,f=this.canonical,_=u.paint.get("model-rotation").evaluate(h,{},f),g=u.paint.get("model-scale").evaluate(h,{},f),v=u.paint.get("model-translation").evaluate(h,{},f);Io(a.rotation,_)&&Io(a.scale,g)&&Io(a.translation,v)||(this.evaluate(a,a.featureStates,n,!0),e=!0)}}return e}updateReplacement(e,i,n,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const u=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(lm(this.activeReplacements,u))return!1;this.activeReplacements=u;let h=!1;for(const f in this.instancesPerModel){const _=this.instancesPerModel[f],g=_.instancedDataArray;for(const v of _.features){const b=v.instancedDataOffset,w=v.instancedDataCount;for(let I=0;I<w;I++){const A=16*(I+b);let R=g.float32[A+0];const O=R>lt;R=O?R-lt:R;const D=Math.floor(R),k=Math.floor(g.float32[A+1]);let U=!1;for(const G of this.activeReplacements)if(!hv(G,n,Pb.Model,a)&&!(G.min.x>D||D>G.max.x||G.min.y>k||k>G.max.y)&&(U=_v(mv(D,k,e.canonical,G.footprintTileId.canonical),G.footprint),U))break;g.float32[A]=U?R+lt:R,h=h||U!==O}}}return h}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,vE.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const n in this.instancesPerModel){const a=this.instancesPerModel[n];a.instancedDataArray.length!==0&&a.instancedDataBuffer&&a.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(e&&i&&this.modelUris&&this.modelsRequested)for(const n of this.modelUris)i.removeModel(n,"",!0)}addFeature(e,i,n,a,u){const h=this.layers[0],f=h.layout.get("model-id"),_=h.layout.get("model-allow-density-reduction"),g=f.evaluate(n,{},this.canonical);if(!g)return Ft(`modelId is not evaluated for layer ${h.id} and it is not going to get rendered.`),g;(ey(g,!1)||this.styleDefinedModelURLs[g]!==void 0)&&(this.modelUris.includes(g)||this.modelUris.push(g)),this.instancesPerModel[g]||(this.instancesPerModel[g]=new Lb);const v=this.instancesPerModel[g],b=v.instancedDataArray,w=new Rb(n,b.length);let I;a&&(I=vn.getElevationFeature(e,a));for(const A of i)for(const R of A){if(R.x<0||R.x>=lt||R.y<0||R.y>=lt)continue;if(this.lookupDim!==0&&_){const D=(this.lookupDim-1)/lt,k=this.lookupDim*(R.y*D|0)+R.x*D|0;if(this.lookup){if(this.lookup[k]!==0)continue;this.lookup[k]=1}}this.instanceCount++;const O=b.length;if(b.resize(O+1),a){v.instancesRoadElevation||(v.instancesRoadElevation=[]);const D=I?I.pointElevation(new Ke(R.x,R.y)):0;v.instancesRoadElevation.push(D)}v.instancesEvaluatedElevation.push(0),b.float32[16*O]=R.x,b.float32[16*O+1]=R.y}return w.instancedDataCount=v.instancedDataArray.length-w.instancedDataOffset,w.instancedDataCount>0&&(e.id&&(v.idToFeaturesIndex[e.id]=v.features.length),v.features.push(w),this.evaluate(w,{},v,!1)),g}getModelUris(){return this.modelUris}evaluate(e,i,n,a){const u=this.layers[0],h=e.feature,f=this.canonical,_=e.rotation=u.paint.get("model-rotation").evaluate(h,i,f),g=e.scale=u.paint.get("model-scale").evaluate(h,i,f),v=e.translation=u.paint.get("model-translation").evaluate(h,i,f),b=Object.assign({},u.paint.get("model-color").evaluate(h,i,f));b.a=u.paint.get("model-color-mix-intensity").evaluate(h,i,f);const w=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]);const I=v[0]*v[0]+v[1]*v[1],A=I>0?Math.sqrt(I):0;n.maxScale=Math.max(Math.max(n.maxScale,g[0]),Math.max(g[1],g[2])),n.maxXYTranslationDistance=Math.max(n.maxXYTranslationDistance,A),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),s0(w,_,g);const R=Math.round(100*b.a)+b.b/1.05;for(let O=0;O<e.instancedDataCount;++O){const D=e.instancedDataOffset+O,k=16*D,U=n.instancedDataArray.float32;let G=0;a&&(G=U[k+6]-n.instancesEvaluatedElevation[D]);const K=0|U[k+1];U[k]=(0|U[k])+b.r/1.05,U[k+1]=K+b.g/1.05,U[k+2]=R,U[k+3]=1/(f.z>10?this.tileToMeter:et(f,K)),U[k+4]=v[0],U[k+5]=v[1],U[k+6]=v[2]+(n.instancesRoadElevation?n.instancesRoadElevation[D]:0)+G,U[k+7]=w[0],U[k+8]=w[1],U[k+9]=w[2],U[k+10]=w[4],U[k+11]=w[5],U[k+12]=w[6],U[k+13]=w[8],U[k+14]=w[9],U[k+15]=w[10],n.instancesEvaluatedElevation[D]=v[2]}}}let Db,zb;vt(ty,"ModelBucket",{omit:["layers"]}),vt(Lb,"PerModelAttributes"),vt(Rb,"ModelFeature");class Wu{constructor(e,i,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=n}static create(e,i,n){const a=n||e.findDEMTileFor(i);if(!a||!a.dem)return;const u=a.dem,h=a.tileID,f=1<<i.canonical.z-h.canonical.z;return new Wu(a,u.dim/lt/f,[(i.canonical.x/f-h.canonical.x)*u.dim,(i.canonical.y/f-h.canonical.y)*u.dim])}tileCoordToPixel(e,i){const n=i*this._scale+this._offset[1];return new Ke(Math.floor(e*this._scale+this._offset[0]),Math.floor(n))}getElevationAt(e,i,n,a){const u=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],f=Math.floor(u),_=Math.floor(h),g=this._dem;return a=!!a,n?Dt(Dt(g.get(f,_,a),g.get(f,_+1,a),h-_),Dt(g.get(f+1,_,a),g.get(f+1,_+1,a),h-_),u-f):g.get(f,_,a)}getElevationAtPixel(e,i,n){return this._dem.get(e,i,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Ee(1,e)*this._dem.stride}}const iy=new Float32Array(262144),Pc=new Uint8Array(262144);function Ob(r){let e=0;if(r.meshes)for(const i of r.meshes)e=Math.max(e,i.aabb.max[2]);if(r.children)for(const i of r.children)e=Math.max(e,Ob(i));return e}function Fb(r,e,i){if(r.meshes)for(const n of r.meshes){if(n.aabb.min[0]===1/0)continue;const a=gi.applyTransform(n.aabb,r.globalMatrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const n of r.children)Fb(n,e,i)}const kb=["","wall","door","roof","window","lamp","logo"];class Bb{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Ob(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new gi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new gi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&(n.transformedAabb=gi.applyTransformFast(n.aabb,this.node.globalMatrix),i.encapsulate(n.transformedAabb)),e++;this.aabb=i}return this.aabb}}class Nm{constructor(e,i,n,a,u,h,f,_){this.id=n,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=Vu.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=Vu.HasMapbox
7MeshFeatures),u&&(this.modelTraits|=Vu.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new Bb(g)),Fb(g,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,i){for(const n of this.getNodesInfo()){const a=n.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}updateAppearances(e,i,n,a){}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const n=i?this.stateDependentLayers:this.layers;if(!os(e,this.states))for(const a of n)this.evaluate(a,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const n of i){const a=n.node;this.uploaded?this.updatePbrBuffer(a):Eg(a,e,!0)}for(const n of i)vm(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);return i}needsReEvaluation(e,i,n){const a=e.transform.projectionOptions,u=e.style.getBrightness(),h=this.brightness!==u;if(!this.uploaded||this.dirty||a.name!==this.projection.name||cf(n.paint.get("model-color").value,h)||cf(n.paint.get("model-color-mix-intensity").value,h)||cf(n.paint.get("model-roughness").value,h)||cf(n.paint.get("model-emissive-strength").value,h)||cf(n.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=a,this.brightness=u;const f=this.getNodesInfo();for(const _ of f)_.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),a=this.id.canonical;for(const u of n){const h=u.feature;u.evaluatedTranslation=i.paint.get("model-translation").evaluate(h,{},a),u.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},a)}}evaluate(e,i){const n=this.getNodesInfo();for(const a of n){if(!a.node.meshes)continue;const u=a.feature,h=i&&i[u.id];if(os(h,a.state))continue;a.state=structuredClone(h);const f=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],g=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,f){for(let b=0;b<kb.length;b++){const w=kb[b];w.length&&(u.properties.part=w);const I=e.paint.get("model-color").evaluate(u,h,v).toPremultipliedRenderColor(null),A=e.paint.get("model-color-mix-intensity").evaluate(u,h,v);a.evaluatedColor[b]=[I.r,I.g,I.b,A],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(u,h,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v),a.evaluatedRMEA[b][3]=I.a,a.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(u,h,v),!a.hasTranslucentParts&&I.a<1&&(a.hasTranslucentParts=!0)}delete u.properties.part,eI(a,_!==a.evaluatedColor[2]||g!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(u,h,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(u,h,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,n,a){const u=e.findDEMTileFor(n);if(u&&(u.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(u.dem&&u.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=u.tileID.overscaledZ;const h=Wu.create(e,n,u);if(!h)return;this.modelTraits&Vu.HasMapboxMeshFeatures&&this.updateDEM(e,h,n,a);for(const f of this.getNodesInfo()){const _=f.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const g=_.footprint.vertices;let v=h.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)v=Math.min(v,h.getElevationAt(g[b].x,g[b].y,!0,!0));_.elevation=v}}this.terrainTile=u.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,n,a){let u=i._dem._modifiedForSources[a];if(u===void 0&&(i._dem._modifiedForSources[a]=[],u=i._dem._modifiedForSources[a]),u.includes(n.canonical))return;const h=i._dem.dim;u.push(n.canonical);let f=!1;for(const _ of this.getNodesInfo()){const g=_.node;if(!g.footprint||!g.footprint.grid)continue;const v=g.footprint.grid,b=i.tileCoordToPixel(v.min.x,v.min.y),w=i.tileCoordToPixel(v.max.x,v.max.y),I=Math.min(Math.min(h-w.y,b.x),Math.min(b.y,h-w.x));if(I<0)continue;const A=te(I,2,5);let R=Math.max(0,b.x-A),O=Math.max(0,b.y-A),D=Math.min(w.x+A,h-1),k=Math.min(w.y+A,h-1);for(let Y=O;Y<=k;++Y)for(let re=R;re<=D;++re)Pc[Y*h+re]=255;let U=0,G=0;for(let Y=0;Y<v.cellsY;++Y)for(let re=0;re<v.cellsX;++re){if(!v.cells[Y*v.cellsX+re])continue;const oe=i.tileCoordToPixel(v.min.x+re/v.xScale,v.min.y+Y/v.yScale),ie=i.tileCoordToPixel(v.min.x+(re+1)/v.xScale,v.min.y+(Y+1)/v.yScale);for(let ce=oe.y;ce<=Math.min(ie.y+1,h-1);++ce)for(let de=oe.x;de<=Math.min(ie.x+1,h-1);
7++de)Pc[ce*h+de]===255&&(Pc[ce*h+de]=0,U+=i.getElevationAtPixel(de,ce),G++)}const K=U/G;R=Math.max(1,b.x-A),O=Math.max(1,b.y-A),D=Math.min(w.x+A,h-2),k=Math.min(w.y+A,h-2),f=!0;for(let Y=O;Y<=k;++Y)for(let re=R;re<=D;++re)Pc[Y*h+re]===0&&(iy[Y*h+re]=i._dem.set(re,Y,K));for(let Y=1;Y<A;++Y){R=Math.max(1,b.x-Y),O=Math.max(1,b.y-Y),D=Math.min(w.x+Y,h-2),k=Math.min(w.y+Y,h-2);for(let re=O;re<=k;++re)for(let oe=R;oe<=D;++oe){const ie=re*h+oe;if(Pc[ie]===255){let ce=0,de=0,De=-1,Ce=-1;for(let Le=-1;Le<=1;++Le)for(let Ue=-1;Ue<=1;++Ue){const Ne=(re+Le)*h+oe+Ue;if(Pc[Ne]>=Y)continue;const Ve=iy[Ne],Se=Math.abs(Ve);Se>de&&(ce=Ve,de=Se,De=Ue,Ce=Le)}if(de>.1){const Le=1-(Y+.5*Math.abs(De*Ce))/A;let Ue=i._dem.get(oe,re)+ce*Le;const Ne=i._dem.get(oe+De,re+Ce),Ve=i._dem.get(oe-De,re-Ce,!0);(Ue-Ne)*(Ue-Ve)>0&&(Ue=(Ne+Ve)/2),iy[ie]=i._dem.set(oe,re,Ue),Pc[ie]=Y}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Jn.now())}setFilter(e){this.filter=e?ud(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Ai(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)vm(i.node),Sg(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const u=a.node.footprint;a.hiddenByReplacement=!!u&&!n.find(h=>h.footprint===u)}}getHeightAtTileCoord(e,i){const n=[],a=[0,0,0],u=pe([]);for(const h of this.getNodesInfo()){const f=h.node.meshes[0],_=f.transformedAabb;if(e<_.min[0]||i<_.min[1]||e>_.max[0]||i>_.max[1])continue;if(h.node.hidden===!0)return{height:1/0,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};Ye(u,h.node.globalMatrix),a[0]=e,a[1]=i,pr(a,a,u);const g=(a[0]-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*Ic|0,v=Math.min(63,(a[1]-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*Ic|0)*Ic+Math.min(63,g),b=f.heightmap[v];if(!(b<0&&h.node.footprint))return h.hiddenByReplacement?void 0:{height:b,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};if(h.node.footprint.grid.query(new Ke(e,i),new Ke(e,i),n),n.length>0)return{height:void 0,maxHeight:h.feature.properties.height,hidden:h.hiddenByReplacement,verticalScale:h.evaluatedScale[2]}}}}function cf(r,e){return r instanceof nc&&!r.isLightConstant&&e}function QS(r,e,i,n,a,u,h,f){let _=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,v=240&e|(240&e)>>4;i[3]>0&&(_=Dt(_,255*i[0],i[3]),g=Dt(g,255*i[1],i[3]),v=Dt(v,255*i[2],i[3]));const b=_<<8|g,w=v<<8|Math.floor(255*n[3]),I=(function(Y){const re=te(Y,0,2);return Math.min(Math.round(.5*re*255),255)})(n[2])<<8|15*n[0]<<4|15*n[1],A=te(a[0],0,1),R=te(a[1],0,1),O=te(a[2],0,1),D=te(a[3],0,1);let k,U,G,K;if(A!==R&&h!==u&&R!==A){const Y=h-u;U=1/(Y*(R-A)),G=-(u+Y*A)/(Y*(R-A));const re=te(a[4],-1,1);K=Math.pow(10,re),k=255*O<<8|255*D}else k=65535,U=0,G=1,K=1;if(r.emplaceBack(b,w,I,k,U,G,K),f){const Y=f.length;f.clear();for(let re=0;re<Y;re++)f.emplaceBack(b,w,I,k,U,G,K)}}function eI(r,e,i){const n=r.node;let a=0;const u=i&Vu.HasMeshoptCompression;for(const h of n.meshes){if(n.lights&&n.lightMeshIndex===a||!h.featureData)continue;h.featureArray=new mc,h.featureArray.reserve(h.featureData.length);let f=e;for(const _ of h.featureData){const g=u?65535&_:_>>16&65535,v=u?_>>16&65535:65535&_,b=(15&v)<8?15&v:0,w=r.evaluatedRMEA[b],I=r.evaluatedColor[b],A=r.emissionHeightBasedParams[b];let R;if(f&&b===2&&n.lights&&(R=new mc,R.resize(10*n.lights.length)),QS(h.featureArray,g,I,w,A,h.aabb.min[2],h.aabb.max[2],R),R&&f){f=!1;const O=n.meshes[n.lightMeshIndex];O.featureArray=R,O.featureArray._trim()}}h.featureArray._trim(),a++}}vt(Nm,"Tiled3dModelBucket",{omit:["layers"]}),vt(Bb,"Tiled3dModelFeature");const tI=["id","tile","layer","source","sourceLayer","state"];class Rc{constructor(e,i,n,a,u){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=n,this._y=a,this.properties=e?e.properties:{},this.id=u}clone(){const e=new Rc(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of tI)this[i]!==void 0&&(e[i]=this[i]);return e}}class Lc extends us{constructor(e,i,n,a){super(),this.id=e,this.type="model",this.models=[],this._options=i,this._modelsInfo=new Map}loadGLTFFromURI(e){return i0(this.map._requestManager.transformRequest(e,Mn.Model).url)}load(){for(const e in this._options.models){const i=this._options.models[e],n=this._modelsInfo.get(e);if(n){n.modelSpec=i;const a=n.model;a&&(a.position=i.position!=null?new J(i.position[0],i.position[1]):new J(0,0),a.orientation=i.orientation!=null?i.orientation:[0,0,0],Lc.applyModelSpecification(a,i),a.computeBoundsAndApplyParent(),this.models.push(a))}else this._modelsInfo.set(e,{modelSpec:i,model:null}),this.loadGLTFFromURI(i.uri).then(a=>{if(!a)return;const u=this._modelsInfo.get(e);if(!u)return;const h=Ag(a),f=u.modelSpec,_=new a0(e,f.uri,f.position,f.orientation,h);Lc.applyModelSpecification(_,f),_.computeBoundsAndApplyParent(),this.models.push(_),u.model=_,this.loaded()&&this.fire(new cs("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(a=>{this.fire(new Ul(new Error(`Could not load model ${e} from ${i.uri}: ${a.message}`)))})}this.loaded()&&this.fire(new cs("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,i){i.nodeOverrides&&Lc.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&Lc.convertMaterialOverrides(e,i.materialOverrides),i.nodeOverrideNames&&(e.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(e.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(e.featureProperties=i.featureProperties)}static convertNodeOverrides(e,i){if(Array.isArray(i)&&i.every(n=>typeof n=="string")){e.nodeOverrideNames=[];for(const n of i)e.nodeOverrideNames.push(n)}
7else Object.entries(i).forEach(([n,a])=>{const u={orientation:[0,0,0]};if(a.hasOwnProperty("orientation")){const h=a.orientation;h&&(u.orientation=h)}e.nodeOverrides.set(n,u)})}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every(n=>typeof n=="string")){e.materialOverrideNames=[];for(const n of i)e.materialOverrideNames.push(n)}else Object.entries(i).forEach(([n,a])=>{const u={color:new vi(1,1,1),colorMix:0,emissionStrength:0,opacity:1},h=a["model-color"];h!==void 0&&(u.color.r=h[0],u.color.g=h[1],u.color.b=h[2]);const f=a["model-color-mix-intensity"];f!==void 0&&(u.colorMix=f);const _=a["model-emissive-strength"];_!==void 0&&(u.emissionStrength=_);const g=a["model-opacity"];g!==void 0&&(u.opacity=g),e.materialOverrides.set(n,u)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(this._modelsInfo.size===0)return!0;for(const e of this._modelsInfo.values())if(e.model==null)return!1;return!0}getModels(){return this.models}loadTile(e,i){}serialize(){return this._options}setProperty(e,i){return!1}reload(){const e=Ea(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}setModels(e){this.models=[];const i=new Map;for(const n in e){const a=e[n];if(this._modelsInfo.has(n)){const u=this._modelsInfo.get(n);u&&u.modelSpec.uri===a.uri&&i.set(n,u)}}this._modelsInfo=i,this._options.models=e,this.load()}}function ry(r,e,i,n){const a=1<<r.z;e.lat=$e((n/lt+r.y)/a),e.lng=Fe((i/lt+r.x)/a)}function iI(r,e,i,n){const a=r.getNodesInfo()[e];
vendor: 21,784 bytes, line 7
7if(!a||a.hiddenByReplacement||!a.node.meshes)return;let u=Number.MAX_VALUE;const h=a.node,f=i.tile,_=n.calculatePosMatrix(f.tileID.toUnwrapped(),n.worldSize),g=a.evaluatedScale;let v=0;n.elevation&&h.elevation&&(v=h.elevation*n.elevation.exaggeration()),gt(_,_,[(h.anchor?h.anchor[0]:0)*(g[0]-1),(h.anchor?h.anchor[1]:0)*(g[1]-1),v]),Qe(_,_,g);const b=i.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,I=function(R){const O=at([],_,R.globalMatrix);at(O,n.expandedFarZProjMatrix,O);for(let D=0;D<R.meshes.length;++D){const k=R.meshes[D];if(D===R.lightMeshIndex)continue;const U=Tg(w,n,O,k.aabb);U!=null&&(u=Math.min(U,u))}if(R.children)for(const D of R.children)I(D)};if(I(h),u===Number.MAX_VALUE)return;const A=new J(0,0);return ry(f.tileID.canonical,A,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:u,position:A,feature:a.feature}}const rI={circle:class extends yn{constructor(r,e,i,n){super(r,{layout:vx||(vx=new ir({"circle-sort-key":new ht(be.layout_circle["circle-sort-key"]),"circle-elevation-reference":new it(be.layout_circle["circle-elevation-reference"]),visibility:new it(be.layout_circle.visibility)})),paint:bx||(bx=new ir({"circle-radius":new ht(be.paint_circle["circle-radius"]),"circle-color":new ht(be.paint_circle["circle-color"]),"circle-blur":new ht(be.paint_circle["circle-blur"]),"circle-opacity":new ht(be.paint_circle["circle-opacity"]),"circle-translate":new it(be.paint_circle["circle-translate"]),"circle-translate-anchor":new it(be.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new it(be.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new it(be.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ht(be.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ht(be.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ht(be.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new it(be.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}createBucket(r){return new bn(r)}queryRadius(r){const e=r;return Aa("circle-radius",this,e)+Aa("circle-stroke-width",this,e)+Pu(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,n,a,u,h,f){const _=xx(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return zx(r,n,u,h,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const n=Dx(this);return{config:new T(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}is3D(r){return!r&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends yn{createBucket(r){return new Fx(r)}constructor(r,e,i,n){super(r,{layout:kx||(kx=new ir({visibility:new it(be.layout_heatmap.visibility)})),paint:Bx||(Bx=new ir({"heatmap-radius":new ht(be.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ht(be.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new it(be.paint_heatmap["heatmap-intensity"]),"heatmap-color":new cl(be.paint_heatmap["heatmap-color"]),"heatmap-opacity":new it(be.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Cd({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(r){return Aa("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,n,a,u,h,f){const _=this.paint.get("heatmap-radius").evaluate(e,i);return zx(r,n,u,h,f,!0,!0,new Ke(0,0),_)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new T(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends yn{constructor(r,e,i,n){super(r,{layout:Nx||(Nx=new ir({visibility:new it(be.layout_hillshade.visibility)})),paint:Vx||(Vx=new ir({"hillshade-illumination-direction":new it(be.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new it(be.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new it(be.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new it(be.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new it(be.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new it(be.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new it(be.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}},fill:class extends yn{constructor(r,e,i,n){super(r,{layout:sv||(sv=new ir({"fill-sort-key":new ht(be.layout_fill["fill-sort-key"]),visibility:new it(be.layout_fill.visibility),"fill-elevation-reference":new it(be.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new ht(be.layout_fill["fill-construct-bridge-guard-rail"])})),paint:av||(av=new ir({"fill-antialias":new it(be.paint_fill["fill-antialias"]),"fill-opacity":new ht(be.paint_fill["fill-opacity"]),"fill-color":new ht(be.paint_fill["fill-color"]),"fill-outline-color":new ht(be.paint_fill["fill-outline-color"]),"fill-translate":new it(be.paint_fill["fill-translate"]),"fill-translate-anchor":new it(be.paint_fill["fill-translate-anchor"]),"fill-pattern":new ht(be.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new it(be.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new it(be.paint_fill["fill-emissive-strength"]),"fill-z-offset":new ht(be.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new ht(be.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new ht(be.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new T(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new sg(r)}queryRadius(){return Pu(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,n,a,u){return!r.queryGeometry.isAboveHorizon&&ki(yx(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),n)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends yn{constructor(r,e,i,n){super(r,{layout:Pv||(Pv=new ir({visibility:new it(be["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new it(be["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:Rv||(Rv=new ir({"fill-extrusion-opacity":new it(be["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ht(be["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new it(be["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new it(be["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ht(be["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new it(be["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new ht(be["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ht(be["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new it(be["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new it(be["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new it(be["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new it(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new it(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new it(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new it(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new it(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new it(be["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new it(be["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new ht(be["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new ht(be["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new it(be["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new it(be["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new it(be["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new it(be["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new ht(be["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new ht(be["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new it(be["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new um(r)}queryRadius(){return Pu(this.paint.get("fill-extrusion-translate"))}is3D(r){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(r,e,i,n,a,u,h,f,_){const g=xx(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),v=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],I=f&&u.elevation,A=u.elevation?u.elevation.exaggeration():1,R=r.tile.getBucket(this);if(I&&R instanceof um){const G=R.centroidVertexArray,K=_+1;K<G.length&&(w[0]=G.geta_centroid_pos0(K),w[1]=G.geta_centroid_pos1(K))}if(w[0]===0&&w[1]===1)return!1;u.projection.name==="globe"&&(n=Cv([n],[new Ke(0,0),new Ke(lt,lt)],r.tileID.canonical).map(G=>G.polygon).flat());const O=I?f:null,[D,k]=Bv(u,n,b,v,g,h,O,w,A,u.center.lat,r.tileID.canonical),U=r.queryGeometry;return kv(D,k,U.isPointQuery()?U.screenBounds:U.screenGeometry)}},building:class extends yn{constructor(r,e,i,n){super(r,{layout:p0||(p0=new ir({visibility:new it(be.layout_building.visibility),"building-facade":new ht(be.layout_building["building-facade"]),"building-facade-floors":new ht(be.layout_building["building-facade-floors"]),"building-facade-unit-width":new ht(be.layout_building["building-facade-unit-width"]),"building-facade-window":new ht(be.layout_building["building-facade-window"]),"building-roof-shape":new ht(be.layout_building["building-roof-shape"]),"building-height":new ht(be.layout_building["building-height"]),"building-base":new ht(be.layout_building["building-base"]),"building-flood-light-wall-radius":new ht(be.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new ht(be.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new ht(be.layout_building["building-flip-roof-orientation"])})),paint:m0||(m0=new ir({"building-opacity":new it(be.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new it(be.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new it(be.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new it(be.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new it(be.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new it(be.paint_building["building-vertical-scale"]),"building-cast-shadows":new it(be.paint_building["building-cast-shadows"]),"building-color":new ht(be.paint_building["building-color"]),"building-emissive-strength":new ht(be.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new it(be.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new it(be.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new it(be.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new it(be.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new it(be.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new f0(r)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(r){return!0}queryRadius(r){return 0}queryIntersectsFeature(r,e,i,n,a,u,h,f,_,g){let v=this.layout.get("building-height").evaluate(e,i);const b=this.layout.get("building-base").evaluate(e,i),w=r.tile.getBucket(this).getFootprint(e);if(w){if(w.hiddenFlags!==0)return!1;v=w.height}const[I,A]=Bv(u,n,b,v,new Ke(0,0),h,null,[0,0],1,u.center.lat,r.tileID.canonical),R=r.queryGeometry;return kv(I,A,R.isPointQuery()?R.screenBounds:R.screenGeometry)}},line:class extends yn{constructor(r,e,i,n){const a=S0();super(r,a,e,i,n),a.layout&&(this.layout=new gn(a.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Kl,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>{if(Wd)return Wd;const i=S0();return Wd=new KE(i.paint.properties["line-width"].specification),Wd.useIntegerZoom=!0,Wd})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Pg(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const n=T0(this);return{config:new T(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}queryRadius(r){const e=r,i=I0(Aa("line-width",this,e),Aa("line-gap-width",this,e)),n=Aa("line-offset",this,e);return i/2+Math.abs(n)+Pu(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,n,a,u){if(r.queryGeometry.isAboveHorizon)return!1;const h=yx(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*I0(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),_=this.paint.get("line-offset").evaluate(e,i);return _&&(n=(function(g,v){const b=[],w=new Ke(0,0);for(let I=0;I<g.length;I++){const A=g[I],R=[];for(let O=0;O<A.length;O++){const D=A[O],k=A[O+1],U=O===0?w:D.sub(A[O-1])._unit()._perp(),G=O===A.length-1?w:k.sub(D)._unit()._perp(),K=U._add(G)._unit();K._mult(1/(K.x*G.x+K.y*G.y)),R.push(K._mult(v)._add(D))}b.push(R)}return b})(n,_*r.pixelToTileUnitsFactor)),(function(g,v,b){for(let w=0;w<v.length;w++){const I=v[w];if(g.length>=3){for(let A=0;A<I.length;A++)if(Gn(g,I[A]))return!0}if(yr(g,I,b))return!0}return!1})(h,n,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:Om,background:class extends yn{constructor(r,e,i,n){super(r,{layout:gb||(gb=new ir({visibility:new it(be.layout_background.visibility)})),paint:yb||(yb=new ir({"background-pitch-alignment":new it(be.paint_background["background-pitch-alignment"]),"background-color":new it(be.paint_background["background-color"]),"background-pattern":new it(be.paint_background["background-pattern"]),"background-opacity":new it(be.paint_background["background-opacity"]),"background-emissive-strength":new it(be.paint_background["background-emissive-strength"]),"background-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:Tb,"raster-particle":Cb,sky:class extends yn{constructor(r,e,i,n){super(r,{layout:Ib||(Ib=new ir({visibility:new it(be.layout_sky.visibility)})),paint:Ab||(Ab=new ir({"sky-type":new it(be.paint_sky["sky-type"]),"sky-atmosphere-sun":new it(be.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new it(be.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new it(be.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new it(be.paint_sky["sky-gradient-radius"]),"sky-gradient":new cl(be.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new it(be.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new it(be.paint_sky["sky-atmosphere-color"]),"sky-opacity":new it(be.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvali
7dated=!0)}_updateColorRamp(){this.colorRamp=Cd({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),a=!n,u=r.style.light,h=u.properties.get("position");return a&&u.properties.get("anchor")==="viewport"&&Ft("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?Qg(h.azimuthal,90-h.polar,e):Qg(n[0],90-n[1],e)}const i=this.paint.get("sky-gradient-center");return Qg(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(r){this._skyboxInvalidated=!1,this._lightPosition=r.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const r=this.paint.get("sky-type");return r==="atmosphere"?["skyboxCapture","skybox"]:r==="gradient"?["skyboxGradient"]:null}},slot:class extends yn{constructor(r,e,i,n){super(r,{paint:Mb||(Mb=new ir({}))},e,null)}},model:class extends yn{constructor(r,e,i,n){super(r,{layout:Db||(Db=new ir({visibility:new it(be.layout_model.visibility),"model-id":new ht(be.layout_model["model-id"]),"model-allow-density-reduction":new it(be.layout_model["model-allow-density-reduction"])})),paint:zb||(zb=new ir({"model-opacity":new ht(be.paint_model["model-opacity"]),"model-rotation":new ht(be.paint_model["model-rotation"]),"model-scale":new ht(be.paint_model["model-scale"]),"model-translation":new ht(be.paint_model["model-translation"]),"model-color":new ht(be.paint_model["model-color"]),"model-color-mix-intensity":new ht(be.paint_model["model-color-mix-intensity"]),"model-type":new it(be.paint_model["model-type"]),"model-cast-shadows":new it(be.paint_model["model-cast-shadows"]),"model-receive-shadows":new it(be.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new it(be.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new ht(be.paint_model["model-emissive-strength"]),"model-roughness":new ht(be.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new ht(be.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new it(be.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new it(be.paint_model["model-front-cutoff"]),"model-elevation-reference":new it(be.paint_model["model-elevation-reference"]),"model-color-use-theme":new ht({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this.layer=r,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new ty(r)}getProgramIds(){return["model"]}is3D(r){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(r){return r instanceof Nm?8191:0}queryRenderedFeatures(r,e,i){const n=e.getSource();if(!(n&&n instanceof Lc))return{};const a=n,u={};u[this.id]=[];const h=u[this.id];let f=0;for(const _ of a.models){const g=e.getFeatureState(this.sourceLayer,_.id),v={type:"Unknown",id:_.id,properties:_.featureProperties},b=this.paint.get("model-rotation").evaluate(v,g),w=this.paint.get("model-scale").evaluate(v,g),I=this.paint.get("model-translation").evaluate(v,g),A=this.paint.get("model-elevation-reference");let R=[];xm(R,_,i,_.position,b,w,I,A==="ground",A==="ground",!1),i.projection.name==="globe"&&(R=ym(R,i));const O=at([],i.projMatrix,R),D=Tg(r.isPointQuery()?r.screenBounds:r.screenGeometry,i,O,_.aabb);if(D!=null){const k=new Rc(void 0,0,0,0,_.id);k.layer=this.layer,k.properties=structuredClone(_.featureProperties),k.properties.layer=this.id,k.properties.uri=_.uri,k.properties.orientation=_.orientation,k.sourceLayer=this.sourceLayer,k.geometry={type:"Point",coordinates:[_.position.lng,_.position.lat]},k.state=g,k.source=this.source,h.push({featureIndex:f,feature:k,intersectionZ:D})}++f}return u}queryIntersectsFeature(r,e,i,n,a,u,h,f,_,g){if(!this.modelManager)return!1;const v=this.modelManager,b=r.tile.getBucket(this);if(!(b&&b instanceof ty))return!1;for(const w in b.instancesPerModel){const I=b.instancesPerModel[w],A=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(I.idToFeaturesIndex.hasOwnProperty(A)){const R=I.features[I.idToFeaturesIndex[A]],O=v.getModel(w,g||this.scope);if(!O)return!1;let D=[];const k=new J(0,0),U=b.canonical;let G=Number.MAX_VALUE;for(let K=0;K<R.instancedDataCount;++K){const Y=16*(R.instancedDataOffset+K),re=I.instancedDataArray.float32,oe=[re[Y+4],re[Y+5],re[Y+6]];ry(U,k,Math.floor(re[Y]),Math.floor(re[Y+1])),xm(D,O,u,k,R.rotation,R.scale,oe,!1,!1,!1),u.projection.name==="globe"&&(D=ym(D,u));const ie=at([],u.projMatrix,D),ce=r.queryGeometry,de=Tg(ce.isPointQuery()?ce.screenBounds:ce.screenGeometry,u,ie,O.aabb);de!=null&&(G=Math.min(de,G))}return G!==Number.MAX_VALUE&&G}}return!1}_handleOverridablePaintPropertyUpdate(r,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||r!=="model-color"&&r!=="model-color-mix-intensity"&&r!=="model-rotation"&&r!=="model-scale"&&r!=="model-translation"&&r!=="model-emissive-strength")}_isPropertyZoomDependent(r){const e=this._transitionablePaint._values[r];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof ba}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends yn{constructor(r,e,i,n){super(r,{layout:lv||(lv=new ir({"clip-layer-types":ne
7w it(be.layout_clip["clip-layer-types"]),"clip-layer-scope":new it(be.layout_clip["clip-layer-scope"]),visibility:new it(be.layout_clip.visibility)})),paint:cv||(cv=new ir({}))},e,i,n)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new uv(r)}is3D(r){return!0}}},ny=new vi(0,0,0);function nI(r,e,i){r===1&&e.icons.push((function(n,a){return(function(u){if(u.usvg_tree.height||(u.usvg_tree.height=u.usvg_tree.width),!u.metadata)return u;const{metadata:h}=u;if(h.content_area){const{content_area:f}=h;f.left==null&&(f.left=0),f.top==null&&(f.top=f.left),f.width==null&&(f.width=u.usvg_tree.width),f.height==null&&(f.height=f.width)}if(h.text_placeholder){const{text_placeholder:f}=h;f.top==null&&(f.top=f.left),f.height==null&&(f.height=f.width)}return h.stretch_x&&h.stretch_x.length&&Nb(h,"x"),h.stretch_y&&h.stretch_y.length&&Nb(h,"y"),u})(n.readFields(oI,{name:void 0},a))})(i,i.readVarint()+i.pos))}function Nb(r,e){const i=[],n=r[`stretch_${e}`];let a=null;for(let u=0;u<n.length;u++)a===null?a=i.length===0?n[0]:i[i.length-1][1]+n[u]:(i.push([a,a+n[u]]),a=null);r[`stretch_${e}_areas`]=i}function oI(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=(function(n,a){return n.readFields(sI,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)})(i,i.readVarint()+i.pos):r===3&&(e.usvg_tree=(function(n,a){return n.readFields(cI,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)})(i,i.readVarint()+i.pos),e.data="usvg_tree")}function sI(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=Vb(i,i.readVarint()+i.pos):r===4?e.variables.push((function(n,a){return n.readFields(lI,{name:void 0},a)})(i,i.readVarint()+i.pos)):r===5&&(e.text_placeholder=Vb(i,i.readVarint()+i.pos))}function Vb(r,e){return r.readFields(aI,{},e)}function aI(r,e,i){r===1?e.left=i.readVarint():r===2?e.width=i.readVarint():r===3?e.top=i.readVarint():r===4&&(e.height=i.readVarint())}function lI(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=jm(i.readVarint()),e.value="rgb_color")}function cI(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(Vm(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push((function(n,a){return n.readFields(_I,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)})(i,i.readVarint()+i.pos)):r===5?e.radial_gradients.push((function(n,a){return n.readFields(yI,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)})(i,i.readVarint()+i.pos)):r===7?e.clip_paths.push((function(n,a){return n.readFields(xI,{children:[]},a)})(i,i.readVarint()+i.pos)):r===8&&e.masks.push((function(n,a){const u=n.readFields(vI,{left:0,width:20,mask_type:1,children:[]},a);return u.height==null&&(u.height=u.width),u.top==null&&(u.top=u.left),u})(i,i.readVarint()+i.pos))}function Vm(r,e){return r.readFields(uI,{},e)}function uI(r,e,i){r===1?(e.group=(function(n,a){return n.readFields(hI,{opacity:255,children:[]},a)})(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=(function(n,a){return n.readFields(fI,{paint_order:1,commands:[],step:1,diffs:[],rule:1},a)})(i,i.readVarint()+i.pos),e.node="path")}function hI(r,e,i){r===1?e.transform=Um(i,i.readVarint()+i.pos):r===2?e.opacity=i.readVarint():r===5?e.clip_path_idx=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(Vm(i,i.readVarint()+i.pos))}function Um(r,e){return r.readFields(dI,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function dI(r,e,i){r===1?e.sx=i.readFloat():r===2?e.ky=i.readFloat():r===3?e.kx=i.readFloat():r===4?e.sy=i.readFloat():r===5?e.tx=i.readFloat():r===6&&(e.ty=i.readFloat())}function fI(r,e,i){r===1?e.fill=(function(n,a){return n.readFields(pI,{rgb_color:ny,paint:"rgb_color",opacity:255},a)})(i,i.readVarint()+i.pos):r===2?e.stroke=(function(n,a){return n.readFields(mI,{rgb_color:ny,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)})(i,i.readVarint()+i.pos):r===3?e.paint_order=i.readVarint():r===5?i.readPackedVarint(e.commands):r===6?e.step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function pI(r,e,i){r===1?(e.rgb_color=jm(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5&&(e.opacity=i.readVarint())}function jm(r){return new vi((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function mI(r,e,i){r===1?(e.rgb_color=jm(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5?i.readPackedFloat(e.dasharray):r===6?e.dashoffset=i.readFloat():r===7?e.miterlimit=i.readFloat():r===8?e.opacity=i.readVarint():r===9?e.width=i.readFloat():r===10?e.linecap=i.readVarint():r===11&&(e.linejoin=i.readVarint())}function _I(r,e,i){r===1?e.transform=Um(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(Ub(i,i.readVarint()+i.pos)):r===4?e.x1=i.readFloat():r===5?e.y1=i.readFloat():r===6?e.x2=i.readFloat():r===7&&
7(e.y2=i.readFloat())}function Ub(r,e){return r.readFields(gI,{offset:0,opacity:255,rgb_color:ny},e)}function gI(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=jm(i.readVarint()))}function yI(r,e,i){r===1?e.transform=Um(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(Ub(i,i.readVarint()+i.pos)):r===4?e.cx=i.readFloat():r===5?e.cy=i.readFloat():r===6?e.r=i.readFloat():r===7?e.fx=i.readFloat():r===8?e.fy=i.readFloat():r===9&&(e.fr=i.readFloat())}function xI(r,e,i){r===1?e.transform=Um(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(Vm(i,i.readVarint()+i.pos))}function vI(r,e,i){r===1?e.left=e.top=i.readFloat():r===2?e.width=e.height=i.readFloat():r===3?e.top=i.readFloat():r===4?e.height=i.readFloat():r===5?e.mask_type=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(Vm(i,i.readVarint()+i.pos))}class bI{static calculate(e={},i=[]){const n=new Map,a=new Map;if(Object.keys(e).length===0)return n;i.forEach(u=>{a.set(u.name,u.rgb_color||new vi(0,0,0))});for(const[u,h]of Object.entries(e))a.has(u)?n.set(a.get(u).toString(),h):console.warn(`Ignoring unknown image variable "${u}"`);return n}}function Xu(r,e=255,i){const n=e/255,a=r.toString(),u=i.has(a)?i.get(a).clone():r.clone();return u.a*=n,u.toString()}function uf(r,e){if(!ha()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}let oy,hf=null;function sy(r,e,i,n,a){for(const u of n.children)jb(r,e,i,u,a)}function jb(r,e,i,n,a){n.group?(r.save(),(function(u,h,f,_,g){const v=_.mask_idx!=null?f.masks[_.mask_idx]:null,b=_.clip_path_idx!=null?f.clip_paths[_.clip_path_idx]:null;if(_.transform&&(h=Yu(_.transform).preMultiplySelf(h)),!(function(A,R,O){return A.opacity!==255||R||O})(_,b!=null,v!=null))return void sy(u,h,f,_,g);const w=uf(u.canvas.width,u.canvas.height),I=w.getContext("2d");sy(I,h,f,_,g),b&&Xb(I,h,f,b),v&&Yb(I,h,f,v,g),u.globalAlpha=_.opacity/255,u.drawImage(w,0,0)})(r,e,i,n.group,a),r.restore()):n.path&&(r.save(),(function(u,h,f,_,g){u.setTransform(h),_.paint_order===1?(Gb(u,f,_,g),$b(u,f,_,g)):($b(u,f,_,g),Gb(u,f,_,g))})(r,e,i,n.path,a),r.restore())}function Gb(r,e,i,n){const a=i.fill;if(!a)return;const u=a.opacity/255;switch(r.save(),r.beginPath(),Kb(i,r),a.paint){case"rgb_color":r.fillStyle=Xu(a.rgb_color,a.opacity,n);break;case"linear_gradient_idx":{const h=e.linear_gradients[a.linear_gradient_idx];h.transform&&r.setTransform(Yu(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=Hb(r,h,u,n);break}case"radial_gradient_idx":{const h=e.radial_gradients[a.radial_gradient_idx];h.transform&&r.setTransform(Yu(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=Zb(r,h,u,n)}}r.fill(qb(i)),r.restore()}function qb(r){return r.rule===1?"nonzero":r.rule===2?"evenodd":void 0}function $b(r,e,i,n){const a=i.stroke;if(!a)return;const u=Jb(i);r.lineWidth=a.width,r.miterLimit=a.miterlimit,r.setLineDash(a.dasharray),r.lineDashOffset=a.dashoffset;const h=a.opacity/255;switch(a.paint){case"rgb_color":r.strokeStyle=Xu(a.rgb_color,a.opacity,n);break;case"linear_gradient_idx":r.strokeStyle=Hb(r,e.linear_gradients[a.linear_gradient_idx],h,n,!0);break;case"radial_gradient_idx":r.strokeStyle=Zb(r,e.radial_gradients[a.radial_gradient_idx],h,n,!0)}switch(a.linejoin){case 2:case 1:r.lineJoin="miter";break;case 3:r.lineJoin="round";break;case 4:r.lineJoin="bevel"}switch(a.linecap){case 1:r.lineCap="butt";break;case 2:r.lineCap="round";break;case 3:r.lineCap="square"}r.stroke(u)}function Hb(r,e,i,n,a=!1){if(e.stops.length===1){const w=e.stops[0];return Xu(w.rgb_color,w.opacity*i,n)}const{x1:u,y1:h,x2:f,y2:_}=e;let g=new DOMPoint(u,h),v=new DOMPoint(f,_);if(a){const w=Yu(e.transform);g=w.transformPoint(g),v=w.transformPoint(v)}const b=r.createLinearGradient(g.x,g.y,v.x,v.y);for(const w of e.stops)b.addColorStop(w.offset,Xu(w.rgb_color,w.opacity*i,n));return b}function Zb(r,e,i,n,a=!1){if(e.stops.length===1){const D=e.stops[0];return Xu(D.rgb_color,D.opacity*i,n)}const u=Yu(e.transform),{fx:h,fy:f,fr:_,cx:g,cy:v,r:b}=e;let w=new DOMPoint(h,f),I=new DOMPoint(g,v),A=_,R=b;if(a){w=u.transformPoint(w),I=u.transformPoint(I);const D=(u.a+u.d)/2;A=_*D,R=e.r*D}const O=r.createRadialGradient(w.x,w.y,A,I.x,I.y,R);for(const D of e.stops)O.addColorStop(D.offset,Xu(D.rgb_color,D.opacity*i,n));return O}function Wb(r,e,i,n){const a=n.transform?Yu(n.transform).preMultiplySelf(e):e,u=uf(r.canvas.width,r.canvas.height),h=u.getContext("2d");for(const _ of n.children)if(_.group)Wb(h,a,i,_.group);else if(_.path){const g=_.path,v=new Path2D;v.addPath(Jb(g),a),h.fill(v,qb(g))}const f=n.clip_path_idx!=null?i.clip_paths[n.clip_path_idx]:null;f&&Xb(h,a,i,f),r.globalCompositeOperation="source-over",r.drawImage(u,0,0)}function Xb(r,e,i,n){const a=uf(r.canvas.width,r.canvas.height);Wb(a.getContext("2d"),e,i,n),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function Yb(r,e,i,n,a){if(n.children.length===0)return;const u=n.mask_idx!=null?i.masks[n.mask_idx]:null;u&&Yb(r,e,i,u,a);const h=r.canvas.width,f=r.canvas.height,_=uf(h,f),g=_.getContext("2d"),v=n.width,b=n.height,w=n.left,I=n.top,A=new Path2D,R=new Path2D;R.rect(w,I,v,b),A.addPath(R,e),g.clip(A);for(const k of n.children)jb(g,e,i,k,a);const O=g.getImageData(0,0,h,f),D=O.data;if(n.mask_type===1)for(let k=0;k<D.length;k+=4)D[k+3]=D[k+3]/255*(.2126*D[k]+.7152*D[k+1]+.0722*D[k+2]);g.putImageData(O,0,0),r.globalCompositeOperation="destination-in",r.drawImage(_,0,0)}function Yu(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function Kb(r,e){const i=r.step;let n=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(n,a);for(let u=0,h=2;u<r.commands.length;u++)switch(r.commands[u]){case 1:n+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.moveTo(n,a);break;case 2:n+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.lineTo(n,a);break;case 3:{const f=n+r.diffs[h++]*i,_=a+r.diffs[h++]*i;n=f+r.diffs[h++]*i,a=_+r.diffs[h++]*i,e.quadraticCurveTo(f,_,n,a);break}case 4:{const f=n+r.diffs[h++]*i,_=a+r.diffs[h++]*i,g=f+r.diffs[h++]*i,v=_+r.diffs[h++]*i;n=g+r.diffs[h++]*i,a=v+r.diffs[h++]*i,e.bezierCurveTo(f,_,g,v,n,a);break}case 5:e.closePath();break}return e}function Jb(r){return Kb(r,new Path2D)}class Gm{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}vt(Gm,"LRUCache");class ay{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new en(e,e.data)}getFromCache(e,i,n){return this.cacheMap.has(n)||this.cacheMap.set(n,new Gm(150)),this.cacheMap.get(n).get(Ea(e.toString(),i))}setInCache(e,i,n,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new Gm(150));const u=this.cacheDependenciesMap.get(a),h=Ea(e.id.toString(),n);u.get(h)||u.set(h,new Set);const f=this.cacheMap.get(a),_=e.toString();u.get(h).add(_),f.put(Ea(e.toString(),n),i)}removeImagesFromCacheByIds(e,i,n=0){if(!this.cacheMap.has(n)||!this.cacheDependenciesMap.has(n))return;const a=this.cacheMap.get(n),u=this.cacheDependenciesMap.get(n);for(const h of e){const f=Ea(h.toString(),i);if(u.has(f)){for(const _ of u.get(f))a.delete(_);u.delete(f)}}}rasterize(e,i,n,a){const u=this.getFromCache(e,n,a);if(u)return u.clone();const h=(function(_,g){const v=bI.calculate(g.params,_.metadata?_.metadata.variables:[]),b=_.usvg_tree,w=b.width,I=b.height,A=Math.max(1,Math.round(w*g.sx)),R=Math.max(1,Math.round(I*g.sy)),O=new DOMMatrix([A/w,0,0,R/I,0,0]);return hf===null&&(hf=uf(10,10),oy=hf.getContext("2d",{willReadFrequently:!0}
vendor: 4,693 bytes, line 7
7)),hf.width=A,hf.height=R,sy(oy,O,b,b,v),oy.getImageData(0,0,A,R)})(i.icon,e),f=ay._getImage(h);return this.setInCache(e,f,n,a),f.clone()}}class Qb{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const n=this.toIdx(e,i);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function e1(r,e,i,n){let a=0,u=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(n[h])<1e-15){if(i[h]<r[h]||i[h]>e[h])return null}else{const f=1/n[h];let _=(r[h]-i[h])*f,g=(e[h]-i[h])*f;if(_>g){const v=_;_=g,g=v}if(_>a&&(a=_),g<u&&(u=g),a>u)return null}return a}function t1(r,e,i,n,a,u,h,f,_,g,v){const b=n-r,w=a-e,I=u-i,A=h-r,R=f-e,O=_-i,D=v[1]*O-v[2]*R,k=v[2]*A-v[0]*O,U=v[0]*R-v[1]*A,G=b*D+w*k+I*U;if(Math.abs(G)<1e-15)return null;const K=1/G,Y=g[0]-r,re=g[1]-e,oe=g[2]-i,ie=(Y*D+re*k+oe*U)*K;if(ie<0||ie>1)return null;const ce=re*I-oe*w,de=oe*b-Y*I,De=Y*w-re*b,Ce=(v[0]*ce+v[1]*de+v[2]*De)*K;return Ce<0||ie+Ce>1?null:(A*ce+R*de+O*De)*K}function i1(r,e,i){return(r-e)/(i-e)}function r1(r,e,i,n,a,u,h,f,_){const g=1<<i,v=u-n,b=h-a,w=(r+1)/g*v+n,I=(e+0)/g*b+a,A=(e+1)/g*b+a;f[0]=(r+0)/g*v+n,f[1]=I,_[0]=w,_[1]=A}class n1{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=(function(u){const h=Math.ceil(Math.log2(u.dim/8)),f=[];let _=Math.ceil(Math.pow(2,h));const g=1/_,v=(I,A,R,O,D)=>{const k=O?1:0,U=(I+1)*R-k,G=A*R,K=(A+1)*R-k;D[0]=I*R,D[1]=G,D[2]=U,D[3]=K};let b=new Qb(_);const w=[];for(let I=0;I<_*_;I++){v(I%_,Math.floor(I/_),g,!1,w);const A=Sl(w[0],w[1],u),R=Sl(w[2],w[1],u),O=Sl(w[2],w[3],u),D=Sl(w[0],w[3],u);b.minimums.push(Math.min(A,R,O,D)),b.maximums.push(Math.max(A,R,O,D)),b.leaves.push(1)}for(f.push(b),_/=2;_>=1;_/=2){const I=f[f.length-1];b=new Qb(_);for(let A=0;A<_*_;A++){v(A%_,Math.floor(A/_),2,!0,w);const R=I.getElevation(w[0],w[1]),O=I.getElevation(w[2],w[1]),D=I.getElevation(w[2],w[3]),k=I.getElevation(w[0],w[3]),U=I.isLeaf(w[0],w[1]),G=I.isLeaf(w[2],w[1]),K=I.isLeaf(w[2],w[3]),Y=I.isLeaf(w[0],w[3]),re=Math.min(R.min,O.min,D.min,k.min),oe=Math.max(R.max,O.max,D.max,k.max),ie=U&&G&&K&&Y;b.maximums.push(oe),b.minimums.push(re),b.leaves.push(oe-re<=5&&ie?1:0)}f.push(b)}return f})(this.dem),n=i.length-1,a=i[n];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,n,0)}raycastRoot(e,i,n,a,u,h,f=1){return e1([e,i,-100],[n,a,this.maximums[0]*f],u,h)}raycast(e,i,n,a,u,h,f=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,n,a,u,h,f);if(_==null)return null;const g=[],v=[],b=[],w=[],I=[{idx:0,t:_,nodex:0,nodey:0,depth:0}];for(;I.length>0;){const{idx:A,t:R,nodex:O,nodey:D,depth:k}=I.pop();if(this.leaves[A]){r1(O,D,k,e,i,n,a,b,w);const G=1<<k,K=(O+0)/G,Y=(O+1)/G,re=(D+0)/G,oe=(D+1)/G,ie=Sl(K,re,this.dem)*f,ce=Sl(Y,re,this.dem)*f,de=Sl(Y,oe,this.dem)*f,De=Sl(K,oe,this.dem)*f,Ce=t1(b[0],b[1],ie,w[0],b[1],ce,w[0],w[1],de,u,h),Le=t1(w[0],w[1],de,b[0],w[1],De,b[0],b[1],ie,u,h),Ue=Math.min(Ce!==null?Ce:Number.MAX_VALUE,Le!==null?Le:Number.MAX_VALUE);if(Ue!==Number.MAX_VALUE)return Ue;{const Ne=In([],u,h,R);if(o1(ie,ce,De,de,i1(Ne[0],b[0],w[0]),i1(Ne[1],b[1],w[1]))>=Ne[2])return R}continue}let U=0;for(let G=0;G<this._siblingOffset.length;G++){r1((O<<1)+this._siblingOffset[G][0],(D<<1)+this._siblingOffset[G][1],k+1,e,i,n,a,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[A]+G]*f;const K=e1(b,w,u,h);if(K!=null){const Y=K;g[G]=Y;let re=!1;for(let oe=0;oe<U&&!re;oe++)Y>=g[v[oe]]&&(v.splice(oe,0,G),re=!0);re||(v[U]=G),U++}}for(let G=0;G<U;G++){const K=v[G];I.push({idx:this.childOffsets[A]+K,t:g[K],nodex:(O<<1)+this._siblingOffset[K][0],nodey:(D<<1)+this._siblingOffset[K][1],depth:k+1})}}return null}_addNode(e,i,n){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,n,a,u){if(e[a].isLeaf(i,n)===1)return;this.childOffsets[u]||(this.childOffsets[u]=this.nodeCount);const h=a-1,f=e[h];let _=0,g=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],w=2*n+this._siblingOffset[v][1],I=f.getElevation(b,w),A=f.isLeaf(b,w),R=this._addNode(I.min,I.max,A);A&&(_|=1<<v),g||(g=R)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*n+this._siblingOffset[v][1],h,g+v)}}function o1(r,e,i,n,a,u){return Dt(Dt(r,i,u),Dt(e,n,u),a)}function Sl(r,e,i){const n=i.dim,a=te(r*n-.5,0,n-1),u=te(e*n-.5,0,n-1),h=Math.floor(a),f=Math.floor(u),_=Math.min(h+1,n-1),g=Math.min(f+1,n-1);return o1(i.get(h,f),i.get(_,f),i.get(h,g),i.get(_,g),a-h,u-f)}
vendor: 21,667 bytes, line 7
7const wI={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function TI(r,e,i){return(256*r*256+256*e+i)/10-1e4}function EI(r,e,i){return 256*r+e+i/256-32768}class qm{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,n,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return void Ft(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const u=this.dim=i.height-2,h=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 _=0;_<u;_++)h[this._idx(-1,_)]=h[this._idx(0,_)],h[this._idx(u,_)]=h[this._idx(u-1,_)],h[this._idx(_,-1)]=h[this._idx(_,0)],h[this._idx(_,u)]=h[this._idx(_,u-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(u,-1)]=h[this._idx(u-1,0)],h[this._idx(-1,u)]=h[this._idx(0,u-1)],h[this._idx(u,u)]=h[this._idx(u-1,u-1)]}const f=n==="terrarium"?EI:TI;for(let _=0;_<h.length;++_){const g=4*_;this.floatView[_]=f(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=Jn.now()}_buildQuadTree(){this._tree=new n1(this)}get(e,i,n=!1){n&&(e=te(e,-1,this.dim),i=te(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,n){const a=this._idx(e,i),u=this.floatView[a];return this.floatView[a]=n,n-u}static getUnpackVector(e){return wI[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const n=[0,0,0,0],a=qm.getUnpackVector(i);let u=Math.floor((e+a[3])/a[2]);return n[2]=u%256,u=Math.floor(u/256),n[1]=u%256,u=Math.floor(u/256),n[0]=u,n}getPixels(){return new Gx({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,u=i*this.dim+this.dim,h=n*this.dim,f=n*this.dim+this.dim;switch(i){case-1:a=u-1;break;case 1:u=a+1}switch(n){case-1:h=f-1;break;case 1:f=h+1}const _=-i*this.dim,g=-n*this.dim;for(let v=h;v<f;v++)for(let b=a;b<u;b++){const w=4*this._idx(b,v),I=4*this._idx(b+_,v+g);this.pixels[w+0]=e.pixels[I+0],this.pixels[w+1]=e.pixels[I+1],this.pixels[w+2]=e.pixels[I+2],this.pixels[w+3]=e.pixels[I+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function SI(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push((function(n,a){return n.readFields(PI,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)})(i,i.readVarint()+i.pos))}function II(r,e,i){r===1?(e.delta_filter=(function(n,a){return n.readFields(AI,{blockSize:0},a)})(i,i.readVarint()+i.pos),e.filter="delta_filter"):r===2?(i.readVarint(),e.filter="zigzag_filter"):r===3?(i.readVarint(),e.filter="bitshuffle_filter"):r===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function AI(r,e,i){r===1&&(e.blockSize=i.readVarint())}function MI(r,e,i){r===1?(i.readVarint(),e.codec="gzip_data"):r===2?(i.readVarint(),e.codec="jpeg_image"):r===3?(i.readVarint(),e.codec="webp_image"):r===4&&(i.readVarint(),e.codec="png_image")}function CI(r,e,i){let n=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push((function(u,h){return u.readFields(II,{},h)})(i,i.readVarint()+i.pos)):r===4?e.codec=(function(u,h){return u.readFields(MI,{},h)})(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?n=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=n)}function PI(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push((function(n,a){return n.readFields(CI,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)})(i,i.readVarint()+i.pos))}function RI(r,e,i){if(r===2)(function(n,a,u){n.readFields(LI,u,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function LI(r,e,i){if(r===1){let n=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[n++]=i.readVarint()}}function DI(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let n=2;n>=1;n--){const a=n===1?1:0,u=n===2?1:0;for(let h=0;h<e[0];h++){const f=e[1]*h;for(let _=a;_<e[1];_++){const g=e[2]*(_+f);for(let v=u;v<e[2];v++){const b=e[3]*(v+g);for(let w=0;w<e[3];w++){const I=b+w;r[I]+=r[I-i]}}}}i*=e[n]}return r}function zI(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function OI(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const n=r[i],a=r[i+1];r[i]=(240&n)>>4|(61440&n)>>8|(240&a)<<4|61440&a,r[i+1]=15&n|(3840&n)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const n=r[i],a=r[i+1],u=r[i+2],h=r[i+3];r[i+0]=(192&n)>>6|(192&a)>>4|(192&u)>>2|192&h,r[i+1]=(48&n)>>4|(48&a)>>2|48&u|(48&h)<<2,r[i+2]=(12&n)>>2|12&a|(12&u)<<2|(12&h)<<4,r[i+3]=3&n|(3&a)<<2|(3&u)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}vt(qm,"DEMData"),vt(n1,"DemMinMaxQuadTree",{omit:["dem"]});var Ro=Uint8Array,df=Uint16Array,FI=Int32Array,s1=new Ro([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]),a1=new Ro([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]),kI=new Ro([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l1=function(r,e){for(var i=new df(31),n=0;n<31;++n)i[n]=e+=1<<r[n-1];var a=new FI(i[30]);for(n=1;n<30;++n)for(var u=i[n];u<i[n+1];++u)a[u]=u-i[n]<<5|n;return{b:i,r:a}},c1=l1(s1,2),u1=c1.b,BI=c1.r;u1[28]=258,BI[258]=28;for(var NI=l1(a1,0).b,h1=new df(32768),Cr=0;Cr<32768;++Cr){var Ku=(43690&Cr)>>1|(21845&Cr)<<1;h1[Cr]=((65280&(Ku=(61680&(Ku=(52428&Ku)>>2|(13107&Ku)<<2))>>4|(3855&Ku)<<4))>>8|(255&Ku)<<8)>>1}var ff=function(r,e,i){for(var n=r.length,a=0,u=new df(e);a<n;++a)r[a]&&++u[r[a]-1];var h,f=new df(e);for(a=1;a<e;++a)f[a]=f[a-1]+u[a-1]<<1;h=new df(1<<e);var _=15-e;for(a=0;a<n;++a)if(r[a])for(var g=a<<4|r[a],v=e-r[a],b=f[r[a]-1]++<<v,w=b|(1<<v)-1;b<=w;++b)h[h1[b]>>_]=g;return h},pf=new Ro(288);for(Cr=0;Cr<144;++Cr)pf[Cr]=8;for(Cr=144;Cr<256;++Cr)pf[Cr]=9;for(Cr=256;Cr<280;++Cr)pf[Cr]=7;for(Cr=280;Cr<288;++Cr)pf[Cr]=8;var d1=new Ro(32);for(Cr=0;Cr<32;++Cr)d1[Cr]=5;var VI=ff(pf,9),UI=ff(d1,5),ly=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},xs=function(r,e,i){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(7&e)&i},cy=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},jI=function(r){return(r+7)/8|0},GI=["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"],vs=function(r,e,i){var n=new Error(e||GI[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,vs),!i)throw n;return n},qI=new Ro(0),$I=typeof TextDecoder<"u"&&new TextDecoder;try{$I.decode(qI,{stream:!0})}catch{}const HI={gzip_data:"gzip"};class Zo extends Error{constructor(e){super(e),this.name="MRTError"}}const ZI={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},f1={uint32:1,uint16:2,uint8:4},WI={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let uy;class $m{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new Zo(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),n=new DataView(e);if(i[0]!==13)throw new Zo("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),n=this.getHeaderLength(e);if(i.length<n)throw new Zo(`Expected header with length >= ${n} but got buffer of length ${i.length}`);const a=new uy(i.subarray(0,n)).readFields(SI,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new Zo(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const u of a.layers)this.layers[u.name]=new p1(u,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],n=this.getLayer(e.layerName);for(let a of e.blockIndices){const u=n.dataIndex[a],h=u.firstByte-e.firstByte,f=u.lastByte-e.firstByte;if(n._blocksInProgress.has(a))continue;const _={layerName:n.name,firstByte:h,lastByte:f,pixelFormat:n.pixelFormat,blockIndex:a,blockShape:[u.bands.length].concat(n.bandShape),buffer:n.buffer,codec:u.codec.codec,filters:u.filters.map(g=>g.filter)};n._blocksInProgress.add(a),i.push(_)}return new m1(i,()=>{i.forEach(a=>n._blocksInProgress.delete(a.blockIndex))},(a,u)=>{if(i.forEach(h=>n._blocksInProgress.delete(h.blockIndex)),a)throw a;u.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class p1{constructor({version:e,name:i,units:n,tileSize:a,pixelFormat:u,buffer:h,dataIndex:f},_){if(this.version=e,this.version!==1)throw new Zo(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=n,this.tileSize=a,this.buffer=h,this.pixelFormat=ZI[u],this.dataIndex=f,this.bandShape=[a+2*h,a+2*h,f1[this.pixelFormat]],this._decodedBlocks=new Gm(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return f1[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const 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(const[n,a]of this.dataIndex.entries()){for(const[u,h]of a.bands.entries())if(h===e)return{bandIndex:i+u,blockIndex:n,blockBandIndex:u};i+=a.bands.length}break;case"number":for(const[n,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:n,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new Zo(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,n=-1/0;const a=[],u=new Set;for(const h of e){const{blockIndex:f}=this.getBlockForBand(h);if(f<0)throw new Zo(`Invalid band: ${JSON.stringify(h)}`);const _=this.dataIndex[f];a.includes(f)||a.push(f),u.add(f),i=Math.min(i,_.firstByte),n=Math.max(n,_.lastByte)}if(u.size>this.cacheSize)throw new Zo(`Number of blocks to decode (${u.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:n,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:n}=this.getBlockForBand(e);if(i<0)throw new Zo(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new Zo(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const u=this.dataIndex[i],h=this.bandShape.reduce((g,v)=>g*v,1),f=n*h,_=a.subarray(f,f+h);return{data:_,bytes:new Uint8Array(_.buffer).subarray(_.byteOffset,_.byteOffset+_.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:u.offset,scale:u.scale}}}$m.setPbf=function(r){uy=r};class m1{constructor(e,i,n){this.tasks=e,this._onCancel=i,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}$m.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(n=>{const{layerName:a,firstByte:u,lastByte:h,pixelFormat:f,blockShape:_,blockIndex:g,filters:v,codec:b}=n,w=i.subarray(u,h+1),I=new Uint32Array(_[0]*_[1]*_[2]);let A;if(b!=="gzip_data")throw new Zo(`Unhandled codec: ${b}`);return A=(function(R,O){if(!globalThis.DecompressionStream&&O==="gzip_data")return Promise.resolve((K=(function(oe){oe[0]==31&&oe[1]==139&&oe[2]==8||vs(6,"invalid gzip data");var ie=oe[3],ce=10;4&ie&&(ce+=2+(oe[10]|oe[11]<<8));for(var de=(ie>>3&1)+(ie>>4&1);de>0;de-=!oe[ce++]);return ce+(2&ie)})(D=R),K+8>D.length&&vs(6,"invalid gzip data"),(function(oe,ie,ce,de){var De=oe.length;if(!De||ie.f&&!ie.l)return ce||new Ro(0);var Ce=!ce,Le=Ce||ie.i!=2,Ue=ie.i;Ce&&(ce=new Ro(3*De));var Ne=function(En){var ta=ce.length;if(En>ta){var ln=new Ro(Math.max(2*ta,En));ln.set(ce),ce=ln}},Ve=ie.f||0,Se=ie.p||0,Ge=ie.b||0,Oe=ie.l,qe=ie.d,je=ie.m,mt=ie.n,_t=8*De;do{if(!Oe){Ve=xs(oe,Se,1);var st=xs(oe,Se+1,3);if(Se+=3,!st){var ct=oe[(hi=jI(Se)+4)-4]|oe[hi-3]<<8,Rt=hi+ct;if(Rt>De){Ue&&vs(0);break}Le&&Ne(Ge+ct),ce.set(oe.subarray(hi,Rt),Ge),ie.b=Ge+=ct,ie.p=Se=8*Rt,ie.f=Ve;continue}if(st==1)Oe=VI,qe=UI,je=9,mt=5;else if(st==2){var St=xs(oe,Se,31)+257,ft=xs(oe,Se+10,15)+4,Bt=St+xs(oe,Se+5,31)+1;Se+=14;for(var Jt=new Ro(Bt),pi=new Ro(19),Yt=0;Yt<ft;++Yt)pi[kI[Yt]]=xs(oe,Se+3*Yt,7);Se+=3*ft;var Mi=ly(pi),ai=(1<<Mi)-1,ur=ff(pi,Mi);for(Yt=0;Yt<Bt;){var hi,Ei=ur[xs(oe,Se,ai)];if(Se+=15&Ei,(hi=Ei>>4)<16)Jt[Yt++]=hi;else{var Gi=0,Ji=0;for(hi==16?(Ji=3+xs(oe,Se,3),Se+=2,Gi=Jt[Yt-1]):hi==17?(Ji=3+xs(oe,Se,7),Se+=3):hi==18&&(Ji=11+xs(oe,Se,127),Se+=7);Ji--;)Jt[Yt++]=Gi}}var Qi=Jt.subarray(0,St),hr=Jt.subarray(St);je=ly(Qi),mt=ly(hr),Oe=ff(Qi,je),qe=ff(hr,mt)}else vs(1);if(Se>_t){Ue&&vs(0);break}}Le&&Ne(Ge+131072);for(var qr=(1<<je)-1,tn=(1<<mt)-1,Tr=Se;;Tr=Se){var Pr=(Gi=Oe[cy(oe,Se)&qr])>>4;if((Se+=15&Gi)>_t){Ue&&vs(0);break}if(Gi||vs(2),Pr<256)ce[Ge++]=Pr;else{if(Pr==256){Tr=Se,Oe=null;break}var zr=Pr-254;Pr>264&&(zr=xs(oe,Se,(1<<(nr=s1[Yt=Pr-257]))-1)+u1[Yt],Se+=nr);var Zt=qe[cy(oe,Se)&tn],er=Zt>>4;if(Zt||vs(3),Se+=15&Zt,hr=NI[er],er>3){var nr=a1[er];hr+=cy(oe,Se)&(1<<nr)-1,Se+=nr}if(Se>_t){Ue&&vs(0);break}Le&&Ne(Ge+131072);var uo=Ge+zr;if(Ge<hr){var Tn=0-hr,$r=Math.min(hr,uo);for(Tn+Ge<0&&vs(3);Ge<$r;++Ge)ce[Ge]=de[Tn+Ge]}for(;Ge<uo;++Ge)ce[Ge]=ce[Ge-hr]}}ie.l=Oe,ie.p=Tr,ie.b=Ge,ie.f=Ve,Oe&&(Ve=1,ie.m=je,ie.d=qe,ie.n=mt)}while(!Ve);return Ge!=ce.length&&Ce?(function(En,ta,ln){return(ln==null||ln>En.length)&&(ln=En.length),new Ro(En.subarray(0,ln))})(ce,0,Ge):ce.subarray(0,Ge)})(D.subarray(K,-8),{i:2},new Ro(((U=D)[(G=U.length)-4]|U[G-3]<<8|U[G-2]<<16|U[G-1]<<24)>>>0),k)));var D,k,U,G,K;const Y=HI[O];if(!Y)throw new Error(`Unhandled codec: ${O}`);const re=new globalThis.DecompressionStream(Y);return new Response(new Blob([R]).stream().pipeThrough(re)).arrayBuffer().then(oe=>new Uint8Array(oe))})(w,b).then(R=>((function(O,D){O.readFields(RI,D)})(new uy(R),I),new WI[f](I.buffer))),A.then(R=>{for(let O=v.length-1;O>=0;O--)switch(v[O]){case"delta_filter":DI(R,_);break;case"zigzag_filter":zI(R);break;case"bitshuffle_filter":OI(R,f);break;default:throw new Zo(`Unhandled filter "${v[O]}"`)}return{layerName:a,blockIndex:g,data:R}}).catch(R=>{throw R})}))},vt(m1,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),vt($m,"MapboxRasterTile"),vt(p1,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class _1{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const n=e[i];this._stringToNumber[n]=i,this._numberToString[i]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class g1{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new wa(lt,16,0),this.featureIndexArray=new gc,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,n,a,u,h=0,f=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,a,u,h);const g=this.grid;for(let v=0;v<i.length;v++){const b=i[v],w=[1/0,1/0,-1/0,-1/0];for(let I=0;I<b.length;I++){const A=b[I];w[0]=Math.min(w[0],A.x),w[1]=Math.min(w[1],A.y),w[2]=Math.max(w[2],A.x),w[3]=Math.max(w[3],A.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<lt&&w[1]<lt&&w[2]>=0&&w[3]>=0&&g.insert(_,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new bi(new wm(this.rawTileData)).layers,this.sourceLayerCoder=new _1(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:n,transform:a,tileTransform:u,pixelPosMatrix:h,availableImages:f,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=i.queryRadius?i.queryRadius:0,v=n.bufferedTilespaceBounds,b=this.grid.query(v.min.x,v.min.y,v.max.x,v.max.y,(R,O,D,k)=>$o(n.bufferedTilespaceGeometry,R-g,O-g,D+g,k+g));b.sort(XI);let w=null;a.elevation&&b.length>0&&(w=Wu.create(a.elevation,this.tileID));const I={};let A;for(let R=0;R<b.length;R++){const O=b[R];if(O===A)continue;A=O;const D=this.featureIndexArray.get(O);let k=null;this.is3DTile?this.loadMatchingModelFeature(I,D,e,n,a,_):this.loadMatchingFeature(I,D,e,f,_,(U,G,K,Y=0)=>(k||(k=Ot(U,this.tileID.canonical,u)),G.queryIntersectsFeature(n,U,K,k,this.z,a,h,w,Y,i.scope)))}return I}loadMatchingFeature(e,i,n,a,u,h){const{featureIndex:f,bucketIndex:_,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],w=n.layers,I=Object.keys(w);if(I.length&&!Xt(I,b))return;const A=n.sourceCache,R=this.sourceLayerCoder.decode(g),O=this.vtLayers[R].feature(f),D=this.getId(O,R);for(let k=0;k<b.length;k++){const U=b[k];if(!w[U])continue;const{styleLayer:G,targets:K}=w[U];let Y={};D!==void 0&&(Y=A.getFeatureState(G.sourceLayer,D));const re=!h||h(O,G,Y,v);if(!re)continue;const oe=new Rc(O,this.z,this.x,this.y,D);oe.tile=this.tileID.canonical,oe.state=Y;let ie=this.serializedLayersCache.get(U);ie||(ie=G.serialize(),ie.id=U,this.serializedLayersCache.set(U,ie)),oe.source=ie.source,oe.sourceLayer=ie["source-layer"],oe.layer=Object.assign({},ie),oe.layer.paint=y1(ie.paint,G.paint,O,Y,a),oe.layer.layout=y1(ie.layout,G.layout,O,Y,a);let ce=!1;for(const de of K){this.updateFeatureProperties(oe,de);const{filter:De}=de;if(De){if(O.properties=oe.properties,De.needGeometry){const Ce=Ht(O,!0);if(!De.filter(new Ai(this.tileID.overscaledZ,{worldview:u}),Ce,this.tileID.canonical))continue}else if(!De.filter(new Ai(this.tileID.overscaledZ,{worldview:u}),O))continue}ce=!0,de.targetId&&this.addFeatureVariant(oe,de)}ce&&this.appendToResult(e,U,f,oe,re)}}loadMatchingModelFeature(e,i,n,a,u,h){const{featureIndex:f,bucketIndex:_}=i,g=this.bucketLayerIDs[_],v=n.layers,b=Object.keys(v);if(!b.length||Xt(b,g))for(let w=0;w<g.length;w++){const I=g[w],{styleLayer:A,targets:R}=v[I];if(A.type!=="model")continue;const O=a.tile,D=O.getBucket(A);if(!(D&&D instanceof Nm))continue;const k=iI(D,f,a,u);if(!k)continue;const{z:U,x:G,y:K}=O.tileID.canonical,{feature:Y,intersectionZ:re,position:oe}=k;let ie={};Y.id!==void 0&&(ie=n.sourceCache.getFeatureState(A.sourceLayer,Y.id));const ce=new Rc({},U,G,K,Y.id);ce.tile=this.tileID.canonical,ce.state=ie,ce.properties=Y.properties,ce.geometry={type:"Point",coordinates:[oe.lng,oe.lat]};let de=this.serializedLayersCache.get(I);de||(de=A.serialize(),de.id=I,this.serializedLayersCache.set(I,de)),ce.source=de.source,ce.sourceLayer=de["source-layer"],ce.layer=Object.assign({},de);let De=!1;for(const Ce of R){this.updateFeatureProperties(ce,Ce);const{filter:Le}=Ce;if(Le){if(Y.properties=ce.properties,Le.needGeometry){if(!Le.filter(new Ai(this.tileID.overscaledZ,{worldview:h}),Y,this.tileID.canonical))continue}else if(!Le.filter(new Ai(this.tileID.overscaledZ,{worldview:h}),Y))continue}De=!0,Ce.targetId&&this.addFeatureVariant(ce,Ce)}De&&this.appendToResult(e,I,f,ce,re)}}updateFeatureProperties(e,i,n){if(i.properties){const a={};for(const u in i.properties){const h=i.properties[u].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,n);h!=null&&(a[u]=h)}e.properties=a}}addFeatureVariant(e,i,n){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,n,a,u){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:n,feature:a,intersectionZ:u})}lookupSymbolFeatures(e,i,n,a,u,h){const f={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:n,featureIndex:_,layoutVertexArrayOffset:0},a,u,h);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:n}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(n),u=this.vtFeatures[a];if(u[i])return u[i];const h=this.vtLayers[a].feature(i);return u[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const n of i)if(e===n)return!0;return!1}getId(e,i){let n=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const u=qs(a);if(u.result!=="success"){const h=u.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void Ft(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=u.value}n=this.promoteIdExpression.evaluate({zoom:0},e)}else n=e.properties[a];typeof n=="boolean"&&(n=Number(n))}return n}}function y1(r,e,i,n,a){return Pt(r,(u,h)=>{const f=e instanceof gn?e.get(h):null;return f&&f.evaluate?f.evaluate(i,n,void 0,a):f})}function XI(r,e){return e-r}vt(g1,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const x1=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,100 bytes, line 7
7];class hy{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=n>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const u=x1[15&n];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new hy(f,h,u,e)}constructor(e,i=64,n=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=x1.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${n}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=i,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return dy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:f}=this,_=[0,u.length-1,0],g=[];for(;_.length;){const v=_.pop()||0,b=_.pop()||0,w=_.pop()||0;if(b-w<=f){for(let O=w;O<=b;O++){const D=h[2*O],k=h[2*O+1];D>=e&&D<=n&&k>=i&&k<=a&&g.push(u[O])}continue}const I=w+b>>1,A=h[2*I],R=h[2*I+1];A>=e&&A<=n&&R>=i&&R<=a&&g.push(u[I]),(v===0?e<=A:i<=R)&&(_.push(w),_.push(I-1),_.push(1-v)),(v===0?n>=A:a>=R)&&(_.push(I+1),_.push(b),_.push(1-v))}return g}within(e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:u,nodeSize:h}=this,f=[0,a.length-1,0],_=[],g=n*n;for(;f.length;){const v=f.pop()||0,b=f.pop()||0,w=f.pop()||0;if(b-w<=h){for(let O=w;O<=b;O++)b1(u[2*O],u[2*O+1],e,i)<=g&&_.push(a[O]);continue}const I=w+b>>1,A=u[2*I],R=u[2*I+1];b1(A,R,e,i)<=g&&_.push(a[I]),(v===0?e-n<=A:i-n<=R)&&(f.push(w),f.push(I-1),f.push(1-v)),(v===0?e+n>=A:i+n>=R)&&(f.push(I+1),f.push(b),f.push(1-v))}return _}}function dy(r,e,i,n,a,u){if(a-n<=i)return;const h=n+a>>1;v1(r,e,h,n,a,u),dy(r,e,i,n,h-1,1-u),dy(r,e,i,h+1,a,1-u)}function v1(r,e,i,n,a,u){for(;a>n;){if(a-n>600){const g=a-n+1,v=i-n+1,b=Math.log(g),w=.5*Math.exp(2*b/3),I=.5*Math.sqrt(b*w*(g-w)/g)*(v-g/2<0?-1:1);v1(r,e,i,Math.max(n,Math.floor(i-v*w/g+I)),Math.min(a,Math.floor(i+(g-v)*w/g+I)),u)}const h=e[2*i+u];let f=n,_=a;for(mf(r,e,n,i),e[2*a+u]>h&&mf(r,e,n,a);f<_;){for(mf(r,e,f,_),f++,_--;e[2*f+u]<h;)f++;for(;e[2*_+u]>h;)_--}e[2*n+u]===h?mf(r,e,n,_):(_++,mf(r,e,_,a)),_<=i&&(n=_+1),i<=_&&(a=_-1)}}function mf(r,e,i,n){fy(r,i,n),fy(e,2*i,2*n),fy(e,2*i+1,2*n+1)}function fy(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}function b1(r,e,i,n){const a=r-i,u=e-n;return a*a+u*u}s.$=mh,s.A=Rn,s.B=Ea,s.C=2,s.D=Fu,s.E=us,s.F=Kd,s.G=q0,s.H=Gc,s.I=Cn,s.J=Ep,s.K=kt,s.L=zt,s.M=$h,s.N=uu,s.O=np,s.P=Ke,s.Q=rc,s.R=Mn,s.S=bu,s.T=bg,s.U=qs,s.V=Bm,s.W=fu,s.X=Ja,s.Y=Ka,s.Z=Yl,s._=Dn,s.a=function(r){return Ir.API_CDN_URL_REGEX.test(r)},s.a$=$e,s.a0=ql,s.a1=Lf,s.a2=cd,s.a3=class extends Bm{},s.a4=hu,s.a5=qh,s.a6=be,s.a7=function(r){const e=r.value;return e?ql(e)?ey(e,!0)?[]:[new Bm(r.key,e,`invalid url "${e}"`)]:[new Bm(r.key,e,`string expected, "${kt(e)}" found`)]:[]},s.a8=ll,s.a9=ir,s.aA=te,s.aB=at,s.aC=An,s.aD=B,s.aE=Gn,s.aF=xe,s.aG=nt,s.aH=function(r,e){const i={};for(let n=0;n<e.length;n++){const a=e[n];a in r&&(i[a]=r[a])}return i},s.aI=ue,s.aJ=Ae,s.aK=class{constructor(r){this.entries={}
7,this.scheduler=r}request(r,e,i,n){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[u,h]=a.result;return this.scheduler?this.scheduler.add(()=>{n(u,h)},e):n(u,h),()=>{}}return a.callbacks.push(n),a.cancel||(a.cancel=i((u,h)=>{a.result=[u,h];for(const f of a.callbacks)this.scheduler?this.scheduler.add(()=>{f(u,h)},e):f(u,h);setTimeout(()=>delete this.entries[r],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(u=>u!==n),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},s.aL=function(r,e,i){const n=JSON.stringify(r.request);return r.data&&(this.deduped.entries[n]={result:[null,r.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},a=>{const u=Bl(r.request,(h,f,_)=>{h?a(h):f&&a(null,{rawData:f,vectorTile:i?void 0:new bi(new wm(f)),responseHeaders:new Map(_.entries())})});return()=>{u.cancel(),a()}},e)},s.aM=function(r){return r?{cacheControl:r.get("Cache-Control"),expires:r.get("Expires")}:{cacheControl:void 0,expires:void 0}},s.aN=Fl,s.aO=function(r){Oo++,Oo>ah&&(r.getActor().send("enforceCacheSizeLimit",If),Oo=0)},s.aP=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log2(r)))},s.aQ=wn,s.aR=Tb,s.aS=Cb,s.aT=J,s.aU=wb,s.aV=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let n=0;n<r.length;n++){const a=document.createElement("source");u_(r[n])||(i.crossOrigin="Anonymous"),a.src=r[n],i.appendChild(a)}return{cancel:()=>{}}},s.aW=Hd,s.aX=Lc,s.aY=xt,s.aZ=ef,s.a_=Fe,s.aa=it,s.ab=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return ar(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Dt(r.x,e.x,i),y:Dt(r.y,e.y,i),z:Dt(r.z,e.z,i),azimuthal:Dt(r.azimuthal,e.azimuthal,i),polar:Dt(r.polar,e.polar,i)}}},s.ac=Ai,s.ad=ba,s.ae=ut,s.af=pr,s.ag=rn,s.ah=me,s.ai=gn,s.aj=yl,s.ak=Dt,s.al=lt,s.am=hh,s.an=ci,s.ao=vi,s.ap=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return(function([i,n]){const a=ar([1,i,n]);return{x:a.x,y:a.y,z:a.z}})(r.expression.evaluate(e))}interpolate(r,e,i){return{x:Dt(r.x,e.x,i),y:Dt(r.y,e.y,i),z:Dt(r.z,e.z,i)}}},s.aq=function(r,e,i=0,n=!0){const a=new Ke(i,i),u=r.sub(a),h=e.add(a),f=[u,new Ke(h.x,u.y),h,new Ke(u.x,h.y)];return n&&f.push(u.clone()),f},s.ar=function(r,e){const i=[];for(let n=0;n<r.length;n++){const a=Ie(n-1,-1,r.length-1),u=Ie(n+1,-1,r.length-1),h=r[n],f=r[u],_=r[a].sub(h).unit(),g=f.sub(h).unit(),v=g.angleWithSep(_.x,_.y),b=_.add(g).unit().mult(-1*e/Math.sin(v/2));i.push(h.add(b))}return i},s.as=ab,s.at=$o,s.au=function(r,e,i=0){return Ci(((e.x-i)*r.scale-r.x)*lt,(e.y*r.scale-r.y)*lt,Te(e.z,e.y))},s.av=_r,s.aw=Ii,s.ax=Di,s.ay=x0,s.az=function(r){let e=1/0,i=1/0,n=-1/0,a=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),n=Math.max(n,u.x),a=Math.max(a,u.y);return{min:new Ke(e,i),max:new Ke(n,a)}},s.b=function(r){return Ir.API_FONTS_REGEX.test(r)},s.b$=mv,s.b0=Mr,s.b1=_s,s.b2=Je,s.b3=Dp,s.b4=zm,s.b5=function(){Co.isLoading()||Co.isLoaded()||sd()!=="deferred"||ad()},s.b6=ud,s.b7=Ht,s.b8=Rc,s.b9=$i,s.bA=pe,s.bB=Tt,s.bC=Be,s.bD=function(r,e){const{x:i,y:n}=r.point,a=Px(i,n,r.worldSize/r._pixelsPerMercatorPixel,0,0);return at(a,a,G_(Js(e)))},s.bE=rt,s.bF=la,s.bG=za,s.bH=In,s.bI=Kr,s.bJ=tr,s.bK=Gu,s.bL=co,s.bM=Bg,s.bN=function(r,e,i,n,a){const u=5*e+2;r.float32[u+0]=i,r.float32[u+1]=n,r.float32[u+2]=a},s.bO=Zu,s.bP=is,s.bQ=Ps,s.bR=Cs,s.bS=Na,s.bT=Ie,s.bU=function(r,e,i,n){var a=new Pe(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=n,a},s.bV=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,n=1<<i,a=Math.floor(r.x),u=Math.floor((r.x-a)*n),h=Math.floor(r.y*n),f=this.findDEMTileFor(new wn(i,a,i,u,h));return!(!f||!f.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const n=this._source();if(!n||r.y<0||r.y>1)return e;const a=n.getSource().maxzoom,u=1<<a,h=Math.floor(r.x),f=r.x-h,_=new wn(a,h,a,Math.floor(f*u),Math.floor(r.y*u)),g=this.findDEMTileFor(_);if(!g||!g.dem)return e;const v=g.dem,b=1<<g.tileID.canonical.z,w=(f*b-g.tileID.canonical.x)*v.dim,I=(r.y*b-g.tileID.canonical.y)*v.dim,A=Math.floor(w),R=Math.floor(I);return(i?this.exaggeration():1)*Dt(Dt(v.get(A,R),v.get(A,R+1),I-R),Dt(v.get(A+1,R),v.get(A+1,R+1),I-R),w-A)}static getAtTileOffset(r,e,i,n){const a=1<<r.canonical.z;return n?n.pointElevation(e):i?i.getAtPointOrZero(new ut(r.wrap+(r.canonical.x+e.x/lt)/a,(r.canonical.y+e.
vendor: 21,087 bytes, line 7
7y/lt)/a)):0}static getAtTileOffsetFunc(r,e,i,n){return(a,u,h)=>{const f=this.getAtTileOffset(r,a,u,h),_=n.upVector(r.canonical,a.x,a.y);return Ui(_,_,f*n.upVectorScale(r.canonical,e,i).metersToTile),_}}getForTilePoints(r,e,i,n){if(this.isUsingMockSource())return!1;const a=Wu.create(this,r,n);return!!a&&(e.forEach(u=>{u[2]=this.exaggeration()*a.getElevationAt(u[0],u[1],i)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,n=e.tileID,a=1<<r.canonical.z-n.canonical.z;let u=r.canonical.x/a-n.canonical.x,h=r.canonical.y/a-n.canonical.y,f=0;for(let _=0;_<r.canonical.z-n.canonical.z&&!i.leaves[f];_++){u*=2,h*=2;const g=2*Math.floor(h)+Math.floor(u);f=i.childOffsets[f]+g,u%=1,h%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const a of r){const u=this.getMinMaxForTile(a.tileID);u&&(i=Math.min(i,u.min),n=Math.max(n,u.max),e=!0)}return e?{min:i,max:n}:null}},s.bW=hm,s.bX=Ki,s.bY=Br,s.bZ=hv,s.b_=Pb,s.ba=Pg,s.bb=sg,s.bc=Ot,s.bd=Ys,s.be=pc,s.bf=Ex,s.bg=Hi,s.bh=Lu,s.bi=Kg,s.bj=function(r,e){const i=yl(e.zoom);if(i===0)return Js(r);const n=Kp(r),a=j_(n),u=xe(n.getWest())*e.worldSize,h=xe(n.getEast())*e.worldSize,f=Ae(n.getNorth())*e.worldSize,_=Ae(n.getSouth())*e.worldSize,g=[u,f,0],v=[h,f,0],b=[u,_,0],w=[h,_,0],I=Ye([],e.globeMatrix);return pr(g,g,I),pr(v,v,I),pr(b,b,I),pr(w,w,I),a[0]=Ma(a[0],b,i),a[1]=Ma(a[1],w,i),a[2]=Ma(a[2],v,i),a[3]=Ma(a[3],g,i),gi.fromPoints(a)},s.bk=Qp,s.bl=Ye,s.bm=Md,s.bn=Ma,s.bo=ms,s.bp=aT,s.bq=Mt,s.br=gt,s.bs=$m,s.bt=wm,s.bu=Bl,s.bv=function(r,e){const i=[];for(const n in r)n in e||i.push(n);return i},s.bw=ge,s.bx=["type","source","source-layer","minzoom","maxzoom","filter","layout"],s.by=os,s.bz=Xe,s.c=on,s.c$=function(r,e,i){let n=0;for(let a=0;a<2;++a)r[a]>0&&(n+=(r[a]-0)*(r[a]-0)),e[a]<0&&(n+=(0-e[a])*(0-e[a]));return n},s.c0=_v,s.c1=Og,s.c2=J0,s.c3=Gg,s.c4=hy,s.c5=Ui,s.c6=As,s.c7=es,s.c8=function(r,e,i){i*=.5;var n=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=n*_+a*f,r[1]=a*_-n*f,r[2]=u*_+h*f,r[3]=h*_-u*f,r},s.c9=Ms,s.cA=Wt,s.cB=Fr,s.cC=n0,s.cD=wc,s.cE=Ax,s.cF=function(r,e,i,n,a,u,h,f,_){if(_.name==="globe")return Ax(r,e,new wc(i,n,a),!1);const g=ef({z:i,x:n,y:a},_);return new gi([(u+g.x/g.scale)*e,e*(g.y/g.scale),h],[(u+g.x2/g.scale)*e,e*(g.y2/g.scale),f])},s.cG=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},s.cH=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},s.cI=function(r){const e=Math.round((r+45+360)%360/90)%4;return N[e]},s.cJ=he,s.cK=ca,s.cL=6,s.cM=function(r){const e=pe(new Float64Array(16));at(e,r.pixelMatrix,r.globeMatrix);const i=[0,H,0],n=[0,$,0];return pr(i,i,e),pr(n,n,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!$_(r,new J(r.center.lat,90)),n[0]>0&&n[0]<=r.width&&n[1]>0&&n[1]<=r.height&&!$_(r,new J(r.center.lat,-90))]},s.cN=function(r,e){const{scale:i}=r.tileTransform,n=i*lt/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return(function(a,u,h){var f=u[1],_=u[2],g=u[3],v=h[0],b=h[1];return a[0]=u[0]*v,a[1]=f*v,a[2]=_*b,a[3]=g*b,a})(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])},s.cO=_m,s.cP=xi,s.cQ=r0,s.cR=function(r){const e=r0(r,!0);return rt([],[e[0],e[1],e[4],e[5]])},s.cS=Qe,s.cT=rr,s.cU=He,s.cV=function(r){const{x:e,y:i}=r.point,{lng:n,lat:a}=r._center;return Px(e,i,r.worldSize,n,a)},s.cW=Wn,s.cX=ye,s.cY=Ru,s.cZ=Ho,s.c_=5,s.ca=Yi,s.cb=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},s.cc=Vi,s.cd=function(r,e,i,n,a){var u=1/Math.tan(e/2);if(r[0]=u/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0){var h=1/(n-a);r[10]=(a+n)*h,r[14]=2*a*n*h}else r[10]=-1,r[14]=-2*n;return r},s.ce=function(r,e,i,n,a,u,h){var f=1/(e-i),_=1/(n-a),g=1/(u-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*g,r[11]=0,r[12]=(e+i)*f,r[13]=(a+n)*_,r[14]=(h+u)*g,r[15]=1,r},s.cf=Ee,s.cg=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},s.ch=no,s.ci=vc,s.cj=gr,s.ck=oo,s.cl=ml,s.cm=db,s.cn=function(){var r=new Pe(4);return Pe!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},s.co=function(r,e,i){var n=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=n*_+u*f,r[1]=a*_+h*f,r[2]=n*-f+u*_,r[3]=a*-f+h*_,r},s.cp=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},s.cq=Io,s.cr=function(r){var e=r[0],i=r[1],n=r[2],a=r[3];return Math.sqrt(e*e+i*i+n*n+a*a)},s.cs=Ll,s.ct=Is,s.cu=Tx,s.cv=3,s.cw=2,s.cx=7,s.cy=6,s.cz=aa,s.d=function(r){return Ir.API_TILEJSON_REGEX.test(r)},s.d$=class{constructor(r,e,i,n){this.context=r,this.format=n,this.size=i,this.texture=r.gl.createTexture();const[a,u,h]=this.size,{gl:f}=r;f.bindTexture(f.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&f.texImage3D(f.TEXTURE_3D,0,this.format,a,u,h,0,xg(this.format),vg(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_3D,this.texture),r!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,r),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},s.d0=function(r){return r*r*r*r*r},s.d1=_e,s.d2=45,s.d3=Cu,s.d4=function(r,e,i){const n=Math.sqrt(r*r+e*e+i*i),a=n>0?Math.acos(i/n)*Dl:0;let u=r!==0||e!==0?Math.atan2(-e,-r)*Dl+90:0;return u<0&&(u+=360),[n,u,a]},s.d5=Ci,s.d6=ar,s.d7=et,s.d8=sr,s.d9=gi,s.dA=function(r){return r({pluginStatus:_n,pluginURL:Ws}),od.on("pluginStateChange",r),r},s.dB=Wp,s.dC=class extends Po{constructor(r){super(r),this.current=gx}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let n=0;n<9;n++)if(i[n]!==this.current[n]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.dD=q,s.dE=function(r,e,i){const n=yl(i.zoom),a=r.style.map._antialias,u=r.terrain&&r.terrain.exaggeration()>0;return n===0&&!a&&!u},s.dF=function(r){const e=r.pixelsPerMeter,i=e/Ee(1,r.center.lat),n=pe(new Float64Array(16));return gt(n,n,[r.point.x,r.point.y,0]),Qe(n,n,[i,i,e]),Float32Array.from(n)},s.dG=Kp,s.dH=function(r){const e=80.051129;r=te(r,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(ci(r))),3);return Math.round(i*(Z.length-1))},s.dI=function(r,e,i,n){const a=e.getNorth(),u=e.getSouth(),h=e.getWest(),f=e.getEast(),_=1<<r.z,g=f-h,v=a-u,b=g/j,w=-v/Z[i],I=[0,b,0,w,0,0,a,h,0];if(r.z>0){const A=180/n;dt(I,I,[A/g+1,0,0,0,A/v+1,0,-.5*A/b,.5*A/w,1])}return I[2]=_,I[5]=r.x,I[8]=r.y,I},s.dJ=Js,s.dK=function(r,e,i){const n=pe(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return yt(n,i.globeMatrix,a),Float32Array.from(n)},s.dL=Gx,s.dM=Yp,s.dN=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},s.dO=ot,s.dP=function(r,e){var i=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=i,r[2]=0,r[3]=-i,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},s.dQ=Ss,s.dR=Cx,s.dS=or,s.dT=Xr,s.dU=Jg,s.dV=function(r,e){const i=[0,0,0];return pr(i,i,Qp(Js(e.canonical))),pr(i,i,r),i},s.dW=r=>({u_matrix:new ml(r),u_texsize:new oo(r),u_pixels_to_tile_units:new t(r),u_device_pixel_ratio:new gr(r),u_width_scale:new gr(r),u_floor_width_scale:new gr(r),u_image:new no(r),u_units_to_pixels:new oo(r),u_tile_units_to_pixels:new gr(r),u_alpha_discard_threshold:new gr(r),u_trim_offset:new oo(r),u_trim_fade_range:new oo(r),u_trim_gradient_mix_range:new oo(r),u_trim_color:new Cu(r),u_zbias_factor:new gr(r),u_tile_to_meter:new gr(r),u_ground_shadow_factor:new vc(r),u_pattern_transition:new gr(r)}),s.dX=r=>({u_matrix:new ml(r),u_pixels_to_tile_units:new t(r),u_device_pixel_ratio:new gr(r),u_width_scale:new gr(r),u_floor_width_scale:new gr(r),u_units_to_pixels:new oo(r),u_dash_image:new no(r),u_gradient_image:new no(r),u_image_height:new gr(r),u_texsize:new oo(r),u_tile_units_to_pixels:new gr(r),u_alpha_discard_threshold:new gr(r),u_trim_offset:new oo(r),u_trim_fade_range:new oo(r),u_trim_gradient_mix_range:new oo(r),u_trim_color:new Cu(r),u_zbias_factor:new gr(r),u_tile_to_meter:new gr(r),u_ground_shadow_factor:new vc(r)}),s.dY=r=>({u_camera_to_center_distance:new gr(r),u_extrude_scale:new t(r),u_device_pixel_ratio:new gr(r),u_matrix:new ml(r),u_inv_rot_matrix:new ml(r),u_merc_center:new oo(r),u_tile_id:new vc(r),u_zoom_transition:new gr(r),u_up_dir:new vc(r),u_emissive_strength:new gr(r)}),s.dZ=Eu,s.d_=sS,s.da=go,s.db=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},s.dc=i0,s.dd=Ag,s.de=a0,s.df=ey,s.dg=function(r,e){return r.readFields(nI,{icons:[]},e)},s.dh=dm,s.di=qu,s.dj=Vg,s.dk=kl,s.dl=bp,s.dm=Ol,s.dn=qa,s.dp=Gt,s.dq=function(r){const e=r.indexOf(uc);return e>=0?r.slice(0,e):r},s.dr=function(r){return r.indexOf(uc)>=0},s.ds=function(r){const e=r.lastIndexOf(uc);return e>=0?r.slice(e+1):""},s.dt=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.du=function(r,e,i,n){return r.type==="custom"?new JS(r,e):new rI[r.type](r,e,i,n)},s.dv=Lt,s.dw=function(r){const e=r.indexOf(uc);return e>=0?r.slice(e+1):""},s.dx=class extends Rc{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},s.dy=od,s.dz=ls,s.e=Ir,s.e$=Li,s.e0=Dx,s.e1=(r,e,i,n,a,u)=>{const h=r.transform,f=h.projection.name==="globe";let _;if(u.paint.get("circle-pitch-alignment")==="map")if(f){const v=Cx(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=h.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Jn.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:dT,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:u.paint.get("circle-emissive-strength")};if(f){g.u_inv_rot_matrix=n,g.u_merc_center=a,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=yl(h.zoom);const v=a[0]*lt,b=a[1]*lt;g.u_up_dir=h.projection.upVector(new wc(0,0,0),v,b)}return g},s.e2=T0,s.e3=Ln,s.e4=(r,e,i,n,a,u,h,f,_,g)=>{const v=r.transform,b=v.pitch<15?v0(.07,.7,te((14-v.zoom)/5,0,1)):.07,w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:w0(r,e,i,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:v.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:u,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:b0(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:f,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_zbias_factor:b,u_tile_to_meter:et(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:g}},s.e5=(r,e,i,n,a,u,h,f,_,g)=>{const v=r.transform,b=v.calculatePixelsToTileUnitsMatrix(e),w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",I=v.pitch<15?v0(.07,.7,te((14-v.zoom)/5,0,1)):.07;return{u_matrix:w0(r,e,i,n),u_pixels_to_tile_units:b,u_device_pixel_ratio:u,u_width_scale:h,u_floor_width_scale:f,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:E0(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:b0(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:_,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_zbias_factor:I,u_tile_to_meter:et(e.tileID.canonical,0),u_ground_shadow_factor:g}},s.e6=Ze,s.e7=Cd,s.e8=Te,s.e9=oT,s.eA=function(r,e){var i=2*Math.acos(e[3]),n=Math.sin(i/2);return n>we?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),i},s.eB=ry,s.eC=xm,s.eD=ym,s.eE=[1,1,1],s.eF=Wu,s.eG=Fa,s.eH=function(r,e,i,n){var a=e[0],u=e[1],h=e[2],f=e[3];return r[0]=a+n*(i[0]-a),r[1]=u+n*(i[1]-u),r[2]=h+n*(i[2]-h),r[3]=f+n*(i[3]-f),r},s.eI=Vu,s.eJ=ro,s.eK=Ia,s.eL=function(r,e,i,n,a,u,h,f,_,g,v,b,w,I,A,R){var O=new Pe(16);return O[0]=r,O[1]=e,O[2]=i,O[3]=n,O[4]=a,O[5]=u,O[6]=h,O[7]=f,O[8]=_,O[9]=g,O[10]=v,O[11]=b,O[12]=w,O[13]=I,O[14]=A,O[15]=R,O},s.eM=se,s.eN=fc,s.eO=wd,s.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Ke(1/0,1/0),max:new Ke(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(r,e=!1){const i=fv(new Ke(0,0),new Ke(lt,lt),r),n=[];if(e&&!ag(i,this._globalClipBounds))return n;for(const a of this._activeRegions){if(a.hiddenByOverlap||!ag(i,a))continue;const u=WT(a.min,a.max,r);n.push({min:u.min,max:u.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return n}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const n of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(n).buckets[e.layer];a&&a.updateFootprints(n.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),n=r.getClipMask(),a=r.getClipScope();for(const u of e){if(!u.footprint)continue;const h=fv(u.footprint.min,u.footprint.max,u.id);this._activeRegions.push({min:h.min,max:h.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:u.id,footprint:u.footprint,order:i,clipMask:n,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||am(e.min,i.min)||am(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(function(n,a){const u=(h,f)=>h+f;return n.length-a.length||n.reduce(u,"").localeCompare(a.reduce(u,""))})(e.clipScope,i.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],n=this._prevRegions[e];r=i.priority!==n.priority||!dv(i,n)||i.order!==n.order||i.clipMask!==n.clipMask||!os(i.clipScope,n.clipScope),this._activeRegions[e].hiddenByOverlap=n.hiddenByOverlap,++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==kd&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const n=this._activeRegions;if(i>=n.length)return i;const a=n[i].priority;for(;i<n.length&&n[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,n=e(i);for(;i!==n;){let a=i;const u=i;for(;a!==n;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let f=0;f<u;f++){const _=this._activeRegions[f];if(!_.hiddenByOverlap&&h.order===kd&&ag(h,_)&&(h.hiddenByOverlap=pv(h.footprint,h.tileId,_.footprint,_.tileId),h.hiddenByOverlap))break}++a}i=n,n=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},s.eQ=kd,s.eR=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new Ys,n=new Mr,a=[],u=r+1+2,h=e[0]+1,f=e[0]+1+(1+e.length),_=(g,v,b)=>{let w=g===u-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,v]};for(let g=0;g<u;++g)i.emplaceBack(..._(g,0,!0));for(let g=0;g<h;++g)for(let v=0;v<u;++v)i.emplaceBack(..._(v,g,(v===0||v===u-1)&&!0));for(let g=0;g<e.length;++g){const v=e[g];for(let b=0;b<u;++b)i.emplaceBack(..._(b,v,!0))}for(let g=0;g<e.length;++g){const v=n.length,b=e[g]+1+2,w=new Mr;for(let R=0;R<b-1;R++){const O=R===b-2,D=O?u*(f-e.length+g-R):u;for(let k=0;k<u-1;k++){const U=R*u+k;R===0||O||k===0||k===u-2?(w.emplaceBack(U+1,U,U+D),w.emplaceBack(U+D,U+D+1,U+1)):(n.emplaceBack(U+1,U,U+D),n.emplaceBack(U+D,U+D+1,U+1))}}const I=Hi.simpleSegment(0,v,i.length,n.length-v);for(let R=0;R<w.uint16.length;R+=3)n.emplaceBack(w.uint16[R],w.uint16[R+1],w.uint16[R+2]);const A=Hi.simpleSegment(0,v,i.length,n.length-v);a.push({withoutSkirts:I,withSkirts:A})}return{vertices:i,indices:n,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(j,Z);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,Ex.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Mr;for(let h=0;h<=j;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new Sa,n=new Sa,a=new Sa,u=new Sa;this._poleSegments=[];for(let h=0,f=0;h<5;h++){const _=360/(1<<h);i.emplaceBack(0,-B,0,.5,0),n.emplaceBack(0,-B,0,.5,1),a.emplaceBack(0,-B,0,.5,.5),u.emplaceBack(0,-B,0,.5,.5);for(let g=0;g<=j;g++){let v=g/j,b=0;const w=Dt(0,_,v),[I,A,R]=le(uT,hT,w,B);i.emplaceBack(I,A,R,v,b),n.emplaceBack(I,A,R,v,1-b);const O=ci(w);v=.5+.5*Math.sin(O),b=.5+.5*Math.cos(O),a.emplaceBack(I,A,R,v,b),u.emplaceBack(I,A,R,v,1-b)}this._poleSegments.push(Hi.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,Xp,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(n,Xp,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,Xp,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(u,Xp,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},s.eS=ZT,s.eT=Q,s.eU=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},s.eV=fe,s.eW=We,s.eX=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},s.eY=Oa,s.eZ=ne,s.e_=br,s.ea=um,s.eb=Mv,s.ec=Pa,s.ed=450,s.ee=7,s.ef=Me,s.eg=function(r,e){if(r===e){var i=e[1],n=e[2],a=e[3],u=e[6],h=e[7],f=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=u,r[11]=e[14],r[12]=a,r[13]=h,r[14]=f}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},s.eh=KS,s.ei=ei,s.ej=Sd,s.ek=256,s.el=G_,s.em=wo,s.en=yt,s.eo=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},s.ep=Sa,s.eq=ep,s.er=Au,s.es=function(r,e,i,n,a){return te((r-e)/(i-e)*(a-n)+n,n,a)},s.et=ua,s.eu=function(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=v*h-f*g,w=-v*u+f*_,I=g*u-h*_,A=i*b+n*w+a*I;
7return A?(r[0]=b*(A=1/A),r[1]=(-v*n+a*g)*A,r[2]=(f*n-a*h)*A,r[3]=w*A,r[4]=(v*i-a*_)*A,r[5]=(-f*i+a*u)*A,r[6]=I*A,r[7]=(-g*i+n*_)*A,r[8]=(h*i-n*u)*A,r):null},s.ev=2,s.ew=nn,s.ex=Qo,s.ey=ri,s.ez=function(r,e){var i=new Pe(3);ri(i,e);var n=1/i[0],a=1/i[1],u=1/i[2],h=e[0]*n,f=e[1]*a,_=e[2]*u,g=e[4]*n,v=e[5]*a,b=e[6]*u,w=e[8]*n,I=e[9]*a,A=e[10]*u,R=h+v+A,O=0;return R>0?(O=2*Math.sqrt(R+1),r[3]=.25*O,r[0]=(b-I)/O,r[1]=(w-_)/O,r[2]=(f-g)/O):h>v&&h>A?(O=2*Math.sqrt(1+h-v-A),r[3]=(b-I)/O,r[0]=.25*O,r[1]=(f+g)/O,r[2]=(w+_)/O):v>A?(O=2*Math.sqrt(1+v-h-A),r[3]=(w-_)/O,r[0]=(f+g)/O,r[1]=.25*O,r[2]=(b+I)/O):(O=2*Math.sqrt(1+A-h-v),r[3]=(f-g)/O,r[0]=(w+_)/O,r[1]=(b+I)/O,r[2]=.25*O),r},s.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},s.f0=function([r,e,i]){const n=Math.hypot(r,e,i),a=Math.atan2(r,i),u=.5*Math.PI-Math.acos(-e/n);return new J(ye(a),ye(u))},s.f1=Rl,s.f2=wg,s.f3=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!(function(i){if(si==null){const n=i.navigator?i.navigator.userAgent:null;si=!!i.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return si})(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},s.f4=function(r,e){If=r,ah=e},s.f5=$_,s.f6=Rx,s.f7=function(r){const e=[0,0,0],i=pe(new Float64Array(16));return at(i,r.pixelMatrix,r.globeMatrix),pr(e,e,i),new Ke(e[0],e[1])},s.f8=function(){const r=Gd;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(fg),Gd=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()"))},s.f9=function(){dm().acquire(fg)},s.fA=qm,s.fB=ti,s.fC=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==Kv){const i=new Uint32Array(r,0,7),[,,n,a,u,h]=i;e=i.byteLength+a+u+h+u,(n!==r.byteLength||e>=r.byteLength)&&Ft("Invalid b3dm header information.")}return t0(r,e)},s.fD=function(r,e){const i=Ag(r);for(const n of i){for(const a of n.meshes)ME(a);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(CE(n.lights,e)))}return i},s.fE=Nm,s.fF=lr,s.fG=Vv,s.fH=Co,s.fI=zn,s.fJ=function(r){eo(),jr?.then(e=>{e.keys().then(i=>{for(let n=0;n<i.length-r;n++)e.delete(i[n]).catch(a=>Ft(a.message))}).catch(i=>Ft(i.message))}).catch(e=>Ft(e.message))},s.fa=sd,s.fb=function(r,e,i=!1){if(_n===zn.deferred||_n===zn.loading||_n===zn.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ws=Jn.resolveURL(r),_n=zn.deferred,Zs=e,nd(),i||ad()},s.fc=function(r){ku=Jn.resolveURL(r),Bu||(Bu=new Fu(dm(),new us)),Bu.broadcast("setMeshoptUrl",ku)},s.fd=Gv,s.fe=function(r){_g=Jn.resolveURL(r),Bu||(Bu=new Fu(dm(),new us)),Bu.broadcast("setDracoUrl",_g)},s.ff=jv,s.fg=jd,s.fh=function(r){const e=as();if(!e)return;const i=e.delete(Sf);r&&i.then(()=>r()).catch(r)},s.fi=Sc,s.fj=vt,s.fk=xl,s.fl=2,s.fm=_1,s.fn=g1,s.fo=_0,s.fp=ii,s.fq="hd_road_elevation",s.fr=vn,s.fs=Pt,s.ft=Ca,s.fu=Ng,s.fv=1,s.fw=function(r,e,i,n,a,u,h,f=1,_,g,v,b){r.createArrays(),r.tilePixelRatio=lt/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const w=r.layers[0].layout,I=r.layers[0]._unevaluatedLayout._values,A={};A.scaleFactor=f,A.textSizeScaleRange=w.get("text-size-scale-range"),A.iconSizeScaleRange=w.get("icon-size-scale-range");const[R,O]=A.textSizeScaleRange,[D,k]=A.iconSizeScaleRange;A.textScaleFactor=te(A.scaleFactor,R,O),A.iconScaleFactor=te(A.scaleFactor,D,k);const U=I["text-size"],G=I["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:ce,maxZoom:de}=r.textSizeData;A.compositeTextSizes=[U.possiblyEvaluate(new Ai(ce,{worldview:v}),u),U.possiblyEvaluate(new Ai(de,{worldview:v}),u)]}if(r.iconSizeData.kind==="composite"){const{minZoom:ce,maxZoom:de}=r.iconSizeData;A.compositeIconSizes=[G.possiblyEvaluate(new Ai(ce,{worldview:v}),u,b),G.possiblyEvaluate(new Ai(de,{worldview:v}),u,b)]}A.layoutTextSize=U.possiblyEvaluate(new Ai(h+1,{worldview:v}),u),A.layoutIconSize=G.possiblyEvaluate(new Ai(h+1,{worldview:v}),u,b),A.textMaxSize=U.possiblyEvaluate(new Ai(18,{worldview:v}),u);const K=w.get("symbol-placement"),Y=w.get("text-rotation-alignment")==="map"&&K!=="point",re=w.get("text-size");let oe=!1;const ie=[];for(const ce of r.features){const de=w.get("text-font").evaluate(ce,{},u).join(","),De=re.evaluate(ce,{},u)*A.textScaleFactor,Ce=A.layoutTextSize.evaluate(ce,{},u)*A.textScaleFactor,Le=A.layoutIconSize.evaluate(ce,{},u,b)*A.iconScaleFactor,Ue={horizontal:{},vertical:void 0},Ne=ce.text;let Ve,Se=[0,0];if(Ne){const ai=Ne.toString(),ur=w.get("text-letter-spacing").evaluate(ce,{},u)*Br,hi=w.get("text-line-height").evaluate(ce,{},u)*Br,Ei=L_(ai)?ur:0,Gi=w.get("text-anchor").evaluate(ce,{},u),Ji=w.get("text-variable-anchor");if(!Ji){const Tr=w.get("text-radial-offset").evaluate(ce,{},u);if(Tr)Se=J0(Gi,[Tr*Br,jg]);else{const Pr=w.get("text-offset").evaluate(ce,{},u);Se=[Pr[0]*Br,Pr[1]*Br]}}
7let Qi=Y?"center":w.get("text-justify").evaluate(ce,{},u);const hr=K==="point",qr=hr?w.get("text-max-width").evaluate(ce,{},u)*Br:1/0,tn=Tr=>{r.allowVerticalPlacement&&id(ai)&&(Ue.vertical=zg(Ne,e,i,a,de,qr,hi,Gi,Tr,Ei,Se,co.vertical,!0,Ce,De,_))};if(!Y&&Ji){const Tr=Qi==="auto"?Ji.map(zr=>Gg(zr)):[Qi];let Pr=!1;for(let zr=0;zr<Tr.length;zr++){const Zt=Tr[zr];if(!Ue.horizontal[Zt])if(Pr)Ue.horizontal[Zt]=Ue.horizontal[0];else{const er=zg(Ne,e,i,a,de,qr,hi,"center",Zt,Ei,Se,co.horizontal,!1,Ce,De,_);er&&(Ue.horizontal[Zt]=er,Pr=er.positionedLines.length===1)}}tn("left")}else{if(Qi==="auto"&&(Qi=Gg(Gi)),hr||w.get("text-writing-mode").indexOf("horizontal")>=0||!id(ai)){const Tr=zg(Ne,e,i,a,de,qr,hi,Gi,Qi,Ei,Se,co.horizontal,!1,Ce,De,_);Tr&&(Ue.horizontal[Qi]=Tr)}tn(hr?"left":Qi)}}let Ge,Oe,qe,je,mt,_t,st=!1;const ct=w.get("icon-text-fit").evaluate(ce,{},u);if(ce.icon&&ce.icon.hasPrimary()){const ai=Qd(ce.icon,r.iconSizeData,I["icon-size"],u,r.zoom,ce,_,A.iconScaleFactor,v,b);Ge=ai.iconPrimary,qe=ai.iconSecondary;const ur=Ge.toString();if(Oe=n.get(ur),Oe&&(mt=w.get("icon-offset").evaluate(ce,{},u),_t=w.get("icon-anchor").evaluate(ce,{},u),Ve=Em(a.get(ur),qe?a.get(qe.toString()):void 0,mt,_t),st=Oe.sdf,r.sdfIcons===void 0?r.sdfIcons=Oe.sdf:r.sdfIcons!==Oe.sdf&&Ft("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Oe.pixelRatio!==r.pixelRatio||w.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),qe){const hi=qe.toString();je=n.get(hi)}}oe=oe||!(!ce.icon||!ce.icon.hasSecondary());const Rt=Cm(Ue.horizontal)||Ue.vertical;r.iconsInText||(r.iconsInText=!!Rt&&Rt.iconsInText);const St=Ce*A.textScaleFactor/Br,{defaultShapedIcon:ft,verticallyShapedIcon:Bt}=kS(r,Ve,w,ce,u,Ue,St,mt,ct);ct!=="none"&&Ve&&(F0(Ve)||k0(Ve))&&(Mm(0,Oe,Ge,Ve,ft,ct,g,n,a),Mm(0,je,qe,Ve,ft,ct,g,n,a),Bt&&(Mm(0,Oe,Ge,Ve,Bt,ct,g,n,a),Mm(0,je,qe,Ve,Bt,ct,g,n,a))),Ve=ft;const{iconBBox:Jt,iconVerticalBBox:pi,textBBox:Yt,textVerticalBBox:Mi}=LS(r,Ve,Bt,w,ce,u,Le,mt,A,a,_t,Ue,Ce,Se,b);ie.push({feature:ce,shapedTextOrientations:Ue,shapedText:Rt,shapedIcon:Ve,iconPrimary:Ge,iconSecondary:qe,iconOffset:mt,iconAnchor:_t,verticallyShapedIcon:Bt,layoutTextSize:Ce,layoutIconSize:Le,textOffset:Se,isSDFIcon:st,iconTextFit:ct,iconCollisionBounds:Jt,iconVerticalCollisionBounds:pi,textCollisionBounds:Yt,textVerticalCollisionBounds:Mi})}return{featureData:ie,sizes:A,hasAnySecondaryIcon:oe,textAlongLine:Y,symbolPlacement:K}},s.fx=$0,s.fy=function(r,e,i,n,a,u,h,f,_,g){r.iconAtlasPositions=g.iconPositions;const{featureData:v,hasAnySecondaryIcon:b,sizes:w,textAlongLine:I,symbolPlacement:A}=e;for(const R of v){const{shapedIcon:O,verticallyShapedIcon:D,feature:k,shapedTextOrientations:U,shapedText:G,layoutTextSize:K,textOffset:Y,isSDFIcon:re,iconPrimary:oe,iconSecondary:ie,iconTextFit:ce,iconOffset:de,iconCollisionBounds:De,iconVerticalCollisionBounds:Ce,textCollisionBounds:Le}=R;ib(O,g.iconPositions,oe,ie),ib(D,g.iconPositions,oe,ie),FS(U,g.iconPositions),OS(oe,ie,g.iconPositions),(G||O)&&BS(r,k,U,O,D,_,w,K,0,Y,re,n,a,h,f,b,ce,de,I,A,De,Ce,Le)}i&&r.generateCollisionDebugBuffers(u,r.collisionBoxArray,w.textScaleFactor)},s.fz=bi,s.g=function(r,e){return ls(Object.assign(r,{method:"GET"}),e)},s.h=function(r){return r.indexOf("mapbox:")===0},s.i=function(r){return Ir.API_STYLE_REGEX.test(r)&&!on(r)},s.j=Ls,s.k=Ua,s.l=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},s.m=function(r,e){return ls(Object.assign(r,{type:"json"}),e)},s.n=Fc,s.o=Jn,s.p=function(r,e){return ls(Object.assign(r,{method:"POST"}),e)},s.q=en,s.r=ha,s.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},s.t=function(){return pg||(pg=new Sc("ImageRasterizer")),pg},s.u=function(){return(function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)})()},s.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},s.w=Ft,s.x=ay,s.y=Ul,s.z=cs}),ae(["./shared"],function(s){function we(ye){const N=ye?ye.url.toString():void 0;return N?performance.getEntriesByName(N):[]}function Pe(ye){if(typeof ye=="number"||typeof ye=="boolean"||typeof ye=="string"||ye==null)return JSON.stringify(ye);if(Array.isArray(ye)){let q="[";for(const Q of ye)q+=`${Pe(Q)},`;return`${q}]`}let N="{";
7for(const q of Object.keys(ye).sort())N+=`${q}:${Pe(ye[q])},`;return`${N}}`}function rt(ye){let N="";for(const q of s.bx)N+=`/${Pe(ye[q])}`;return N}function ot(ye,N){return(function q(Q){return typeof Q=="string"&&Q===N||(Array.isArray(Q)?Q.some(q):!(!Q||typeof Q!="object")&&Object.values(Q).some(q))})(ye)}class ke{constructor(N){this.keyCache={},this._layers={},this._layerConfigs={},N&&this.replace(N)}replace(N,q){this._layerConfigs={},this._layers={},this.update(N,[],q)}update(N,q,Q){this._options=Q;for(const te of N)this._layerConfigs[te.id]=te,(this._layers[te.id]=s.du(te,this.scope,null,this._options)).compileFilter(Q),this.keyCache[te.id]&&delete this.keyCache[te.id];for(const te of q)delete this.keyCache[te],delete this._layerConfigs[te],delete this._layers[te];this.familiesBySource={};const fe=(function(te,me){const Ie={};for(let Re=0;Re<te.length;Re++){const Je=te[Re];let Ze=me&&me[Je.id];Ze||(Je.type==="symbol"?Ze=Je.id:(Ze=rt(Je),Je.type==="line"&&Je.paint&&ot(Je.paint["line-width"],"line-progress")&&(Ze+=`/${Pe(Je.paint["line-width"])}`))),me&&(me[Je.id]=Ze);let xt=Ie[Ze];xt||(xt=Ie[Ze]=[]),xt.push(Je)}const ge=[];for(const Re in Ie)ge.push(Ie[Re]);return ge})(Object.values(this._layerConfigs),this.keyCache);for(const te of fe){const me=te.map(xt=>this._layers[xt.id]),Ie=me[0];if(Ie.visibility==="none")continue;const ge=Ie.source||"";let Re=this.familiesBySource[ge];Re||(Re=this.familiesBySource[ge]={});const Je=Ie.sourceLayer||"_geojsonTileLayer";let Ze=Re[Je];Ze||(Ze=Re[Je]=[]),Ze.push(me)}}}const dt=1*s.fl;class Be{constructor(N){const q={},Q=[];for(const Ie in N){const ge=N[Ie],Re=q[Ie]={};for(const Je in ge.glyphs){const Ze=ge.glyphs[+Je];if(!Ze||Ze.bitmap.width===0||Ze.bitmap.height===0)continue;const xt=Ze.metrics.localGlyph?dt:1,Pt={x:0,y:0,w:Ze.bitmap.width+2*xt,h:Ze.bitmap.height+2*xt};Q.push(Pt),Re[Je]=Pt}}const{w:fe,h:te}=s.G(Q),me=new s.fk({width:fe||1,height:te||1});for(const Ie in N){const ge=N[Ie];for(const Re in ge.glyphs){const Je=ge.glyphs[+Re];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const Ze=q[Ie][Re],xt=Je.metrics.localGlyph?dt:1;s.fk.copy(Je.bitmap,me,{x:0,y:0},{x:Ze.x+xt,y:Ze.y+xt},Je.bitmap)}}this.image=me,this.positions=q}}function Xe(ye,N,q){ye[N]?q&&(ye[N].center=q):ye[N]={floorIds:new Set,center:q||[0,0],floors:{}}}function pe(ye,N,q,Q){for(const fe of N)Xe(ye,fe),ye[fe].floors[q]=Q,ye[fe].floorIds.add(q)}function Ye(ye){return{id:ye.properties.id.toString(),center:ye.properties.center.toString().split(";").map(Number)}}function at(ye){return{id:ye.properties.id.toString(),isDefault:!!ye.properties.is_default&&ye.properties.is_default,connections:ye.properties.connected_floor_ids?new Set(ye.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:ye.properties.conflicted_floor_ids?new Set(ye.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:ye.properties.building_ids?new Set(ye.properties.building_ids.toString().split(";")):new Set,name:ye.properties.name.toString(),zIndex:ye.properties.z_index}}function gt(ye,N){return N.every(q=>ye.properties&&ye.properties[q]!=null)}function Qe(ye){return gt(ye,["type","id","name"])&&ye.properties.type==="building"}function He(ye){return gt(ye,["type","id","name","z_index"])&&ye.properties.type==="floor"}s.fj(Be,"GlyphAtlas");class yt{constructor(N){this.tileID=new s.aQ(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.tileZoom=N.tileZoom,this.uid=N.uid,this.zoom=N.zoom,this.lut=N.lut,this.canonical=N.tileID.canonical,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.scope=N.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.request&&N.request.collectResourceTiming,this.promoteId=N.promoteId,this.isSymbolTile=N.isSymbolTile,this.tileTransform=s.aZ(N.tileID.canonical,N.projection),this.projection=N.projection,this.worldview=N.worldview,this.localizableLayerIds=N.localizableLayerIds,this.brightness=N.brightness,this.extraShadowCaster=!!N.extraShadowCaster,this.tessellationStep=N.tessellationStep,this.scaleFactor=N.scaleFactor,this.worldview=N.worldview,this.indoor=N.indoor}parse(N,q,Q,fe,te,me){this.status="parsing",this.data=N,this.collisionBoxArray=new s.b3;const Ie=new s.fm(Object.keys(N.layers).sort()),ge=new s.fn(this.tileID,this.promoteId);ge.bucketLayerIDs=[];const Re={},Je=new s.fo(256,256),Ze={featureIndex:ge,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Je,availableImages:Q,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const Gt=this.indoor.indoorState.activeFloorsVisible,Xt=(function(Nt,Ft,Oi){const wr=(function($i,si){if(!$i)return s.w("No source layers defined in indoor specification"),si;if($i.size===0)return si;const Yi=$i.difference(si);for(const Pi of Yi)s.w(`Missing source layer required in indoor specification: ${Pi}`);return si.intersection(si)})(Ft.sourceLayers,new Set(Object.keys(Nt.layers))),ar=Ft.indoorState,lr=(function($i,si,Yi,Pi){const Ri=new Set,or=new Set,Xr=new Set,Ur=new Map,Ir={},Ls=on=>{const Bn=Ur.get(on)||new Set;for(const yo of Ri)if((Ur.get(yo)||new Set).has(on)||Bn.has(yo))return!0;return!1};for(const on of si){const Bn=$i.layers[on];if(Bn)for(let yo=0;yo<Bn.length;yo++){const Ao=Bn.feature(yo);if(Qe(Ao)){const{id:Nn,center:fn}=Ye(Ao);Xe(Ir,Nn,fn),Ri.add(Nn);continue}if(He(Ao)){const{id:Nn,isDefault:fn,connections:ss,conflicts:ha,buildings:Jn,name:zl,zIndex:Ol}=at(Ao);pe(Ir,Jn,Nn,{name:zl,zIndex:Ol}),Ur.set(Nn,ha),(Nn===Pi||ss.has(Pi))&&Ri.add(Nn),or.add(Nn),fn&&Xr.add(Nn)}}else s.w(`indoor source layer not found: ${on}`)}if(Yi)for(const on of Yi)or.has(on)&&(Ls(on)||Ri.add(on));for(const on of Xr)Ri.has(on)||Ls(on)||Ri.add(on);return{buildings:Ir,activeFloors:Ri}})(Nt,wr,ar.lastActiveFloors,ar.selectedFloorId);return Oi.send("setIndoorData",lr),lr})(N,this.indoor,te);Ze.activeFloors=Gt?Xt.activeFloors:void 0}const xt=[],Pt=q.familiesBySource[this.source];for(const Gt in Pt){const Xt=N.layers[Gt];if(!Xt)continue;let Nt=!1,Ft=!1,Oi=!1;for(const si of Pt[Gt])si[0].type==="symbol"?Nt=!0:Ft=!0,si[0].is3D()&&si[0].type!=="model"&&(Oi=!0);if(this.extraShadowCaster&&!Oi||this.isSymbolTile===!0&&!Nt||this.isSymbolTile===!1&&!Ft)continue;Xt.version===1&&s.w(`Vector tile source "${this.source}" layer "${Gt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const wr=Ie.encode(Gt),ar=[],lr=this.localizableLayerIds&&this.localizableLayerIds.has(Gt);let $i=!1;for(let si=0,Yi=0;si<Xt.length;si++){const Pi=Xt.feature(si),Ri=ge.getId(Pi,Gt),or=Pi.properties?Pi.properties.worldview:null;if(lr&&this.worldview&&typeof or=="string")if(or==="all")Pi.properties.$localized=!0;else{if(!or.split(",").includes(this.worldview))continue;Pi.properties.$localized=!0,Pi.properties.worldview=this.worldview}!$i&&Pi.properties&&Pi.properties.hasOwnProperty(s.fp)&&($i=!0),ar.push({feature:Pi,id:Ri,index:Yi,sourceLayerIndex:wr}),Yi++}$i&&!Ze.elevationFeatures&&N.layers.hasOwnProperty(s.fq)&&(Ze.elevationFeatures=s.fr.parseFrom(N.layers[s.fq],this.canonical));for(const si of Pt[Gt]){const Yi=si[0];if(this.extraShadowCaster&&(!Yi.is3D()||Yi.type==="model")||this.isSymbolTile!==void 0&&Yi.type==="symbol"!==this.isSymbolTile||Yi.minzoom&&this.zoom<Math.floor(Yi.minzoom)||Yi.maxzoom&&this.zoom>=Yi.maxzoom||Yi.visibility==="none")continue;Tt(si,this.zoom,Ze.brightness,Q,this.worldview);const Pi=Re[Yi.id]=Yi.createBucket({index:ge.bucketLayerIDs.length,layers:si,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:wr,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:fe,worldview:this.worldview,localizable:lr,availableImages:Q});ge.bucketLayerIDs.push(si.map(or=>s.B(or.id,or.scope)));let Ri=Pi.prepare?Pi.prepare():null;Ri!=null?(Ri=Ri.then(()=>Pi.populate(ar,Ze,this.tileID.canonical,this.tileTransform)),xt.push(Ri)):Pi.populate(ar,Ze,this.tileID.canonical,this.tileTransform)}}const Lt=()=>{let Gt,Xt,Nt,Ft,Oi,wr;Je.trim();const ar={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},lr=()=>{if(Gt)return this.status="done",me(Gt);if(this.extraShadowCaster)this.status="done",me(null,{buckets:Object.values(Re).filter(si=>!si.isEmpty()),featureIndex:ge,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Ze.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Xt&&Nt&&Ft){const si=new Be(Xt),Yi=new Map;for(const[or,Xr]of Nt.entries()){const{imagePosition:Ur}=s.fu(or,Xr,s.fv);Yi.set(or,Ur)}const Pi={};for(const or in Re){const Xr=Re[or];Xr instanceof s.b4&&(Tt(Xr.layers,this.zoom,Ze.brightness,Q,this.worldview),Pi[or]=s.fw(Xr,Xt,si.positions,Nt,Yi,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Oi,this.worldview,Q))}const Ri={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(te,Nt,Oi,()=>{Ri.iconsPending=!1,$i(Pi,si,Ri)}),this.rasterizeIfNeeded(te,Ft,wr,()=>{Ri.patternsPending=!1,$i(Pi,si,Ri)})}},$i=(si,Yi,Pi,Ri)=>{if(Pi.iconsPending||Pi.patternsPending)return;const or=new s.fx(Nt,Ft,this.lut);for(const Xr in Re){const Ur=Re[Xr];if(Xr in si)s.fy(Ur,si[Xr],this.showCollisionBoxes,Q,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Nt,or);else if(Ur.hasPattern&&(Ur instanceof s.ba||Ur instanceof s.bb||Ur instanceof s.ea)){Tt(Ur.layers,this.zoom,Ze.brightness,Q,this.worldview);const Ir=Object.fromEntries(or.patternPositions);Ur.addFeatures(Ze,this.tileID.canonical,Ir,Q,this.tileTransform,this.brightness)}}this.status="done",me(null,{buckets:Object.values(Re).filter(Xr=>!Xr.isEmpty()),featureIndex:ge,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Yi.image,lineAtlas:Je,imageAtlas:or,brightness:Ze.brightness})};if(!this.extraShadowCaster){const si=s.fs(Ze.glyphDependencies,Ri=>Object.keys(Ri).map(Number));Object.keys(si).length?te.send("getGlyphs",{uid:this.uid,stacks:si},(Ri,or)=>{Gt||(Gt=Ri,Xt=or,lr())},void 0,!1,ar):Xt={};const Yi=Array.from(Ze.iconDependencies.keys()).map(Ri=>s.I.parse(Ri));Yi.length?te.send("getImages",{images:Yi,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Ri,or)=>{Gt||(Gt=Ri,Nt=new Map,Oi=this.updateImageMapAndGetImageTaskQueue(Nt,or,Ze.iconDependencies),lr())},void 0,!1,ar):(Nt=new Map,Oi=new Map);const Pi=Array.from(Ze.patternDependencies.keys()).map(Ri=>s.I.parse(Ri));Pi.length?te.send("getImages",{images:Pi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ri,or)=>{Gt||(Gt=Ri,Ft=new Map,wr=this.updateImageMapAndGetImageTaskQueue(Ft,or,Ze.patternDependencies),lr())},void 0,!1,ar):(Ft=new Map,wr=new Map)}if(Ze.elevationFeatures&&Ze.elevationFeatures.length>0){const si=[];for(const Pi of Object.values(Re))if(Pi instanceof s.bb){const Ri=Pi.getUnevaluatedPortalGraph();Ri&&si.push(Ri)}const Yi=s.ft.evaluate(si);for(const Pi of Object.values(Re))if(Pi instanceof s.bb){const Ri=N.layers[Ie.decode(Pi.sourceLayerIndex)];Pi.setEvaluatedPortalGraph(Yi,Ri,this.tileID.canonical,Ze.availableImages,Ze.brightness)}}lr()};xt.length>
70?Promise.allSettled(xt).then(Lt).catch(me):Lt()}updateParameters(N){this.scaleFactor=N.scaleFactor,this.showCollisionBoxes=N.showCollisionBoxes,this.projection=N.projection,this.brightness=N.brightness,this.tileTransform=s.aZ(N.tileID.canonical,N.projection),this.extraShadowCaster=N.extraShadowCaster,this.lut=N.lut,this.worldview=N.worldview,this.indoor=N.indoor}rasterizeIfNeeded(N,q,Q,fe){Array.from(q.values()).some(te=>te.usvg)?this.rasterize(N,q,Q,fe):fe()}updateImageMapAndGetImageTaskQueue(N,q,Q){const fe=new Map;for(const te of q.keys()){const me=Q.get(te)||[];for(const Ie of me){const ge=Ie.toString(),Re=q.get(Ie.id.toString());Re.usvg?fe.has(ge)||(fe.set(ge,Ie),N.set(ge,Object.assign({},Re))):N.set(ge,Re)}}return fe}rasterize(N,q,Q,fe){this.rasterizeTask=N.send("rasterizeImages",{scope:this.scope,tasks:Q},(te,me)=>{if(!te)for(const[Ie,ge]of me.entries()){const Re=Object.assign(q.get(Ie),{data:ge});q.set(Ie,Re)}fe()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Tt(ye,N,q,Q,fe){const te=new s.ac(N,{brightness:q,worldview:fe});for(const me of ye)me.recalculate(te,Q)}class Mt extends s.E{constructor(N,q,Q,fe,te,me,Ie){super(),this.actor=N,this.layerIndex=q,this.availableImages=Q,this.availableModels=fe,this.loadVectorData=me||s.aL,this.loading={},this.loaded={},this.deduped=new s.aK(N.scheduler),this.isSpriteLoaded=te,this.scheduler=N.scheduler,this.brightness=Ie}loadTile(N,q){const Q=N.uid,fe=N&&N.request,te=fe&&fe.collectResourceTiming,me=this.loading[Q]=new yt(N);me.abort=this.loadVectorData(N,(Ie,ge)=>{const Re=!this.loading[Q];if(delete this.loading[Q],me.cancelRasterize(),Re||Ie||!ge)return me.status="done",Re||(this.loaded[Q]=me),q(Ie);const Je=ge.rawData,Ze={},xt=s.aM(ge.responseHeaders);xt&&xt.expires&&(Ze.expires=xt.expires),xt&&xt.cacheControl&&(Ze.cacheControl=xt.cacheControl),me.vectorTile=ge.vectorTile||new s.fz(new s.bt(Je));const Pt=()=>{me.parse(me.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Lt,Gt)=>{if(Lt||!Gt)return q(Lt);const Xt={};if(te){const Nt=we(fe);Nt.length>0&&(Xt.resourceTiming=JSON.parse(JSON.stringify(Nt)))}q(null,Object.assign({rawTileData:Je.slice(0),responseHeaders:ge.responseHeaders},Gt,Ze,Xt))})};this.isSpriteLoaded?Pt():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Pt,{type:"parseTile",isSymbolTile:N.isSymbolTile,zoom:N.tileZoom}):Pt()}),this.loaded=this.loaded||{},this.loaded[Q]=me})}reloadTile(N,q){const Q=this.loaded,fe=N.uid;if(Q&&Q[fe]){const te=Q[fe];te.updateParameters(N);const me=(Ie,ge)=>{const Re=te.reloadCallback;Re&&(delete te.reloadCallback,te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Re)),q(Ie,ge)};te.status==="parsing"?te.reloadCallback=me:te.status==="done"&&(te.vectorTile?te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,me):me())}else q(null,void 0)}abortTile(N,q){const Q=N.uid,fe=this.loading[Q];fe&&(fe.abort&&fe.abort(),delete this.loading[Q]),q()}removeTile(N,q){const Q=this.loaded,fe=N.uid;Q&&Q[fe]&&delete Q[fe],q()}}class li{loadTile(N,q){const{uid:Q,encoding:fe,rawImageData:te,padding:me}=N,Ie=ImageBitmap&&te instanceof ImageBitmap?this.getImageData(te,me):te;q(null,new s.fA(Q,Ie,fe,me<1))}reloadTile(N,q){q(null,null)}abortTile(N,q){q()}removeTile(N,q){q()}getImageData(N,q){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(N.width,N.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=N.width,this.offscreenCanvas.height=N.height,this.offscreenCanvasContext.drawImage(N,0,0,N.width,N.height);const Q=this.offscreenCanvasContext.getImageData(-q,-q,N.width+2*q,N.height+2*q);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Q}}s.bs.setPbf(s.bt);class ri{constructor(N){this._mrt=new s.bs(N.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=N.uid,this.tileID=N.tileID,this.source=N.source}parse(N,q){const Q=this._mrt;this.status="parsing",this._entireBuffer=N;try{Q.parseHeader(N),this._isHeaderLoaded=!0;const fe=[];for(const te in Q.layers){const me=Q.getLayer(te),Ie=me.getDataRange(me.getBandList()),ge=Q.createDecodingTask(Ie),Re=N.slice(Ie.firstByte,Ie.lastByte+1),Je=s.bs.performDecoding(Re,ge).then(Ze=>ge.complete(null,Ze)).catch(Ze=>ge.complete(Ze,null));fe.push(Je)}Promise.allSettled(fe).then(()=>q(null,Q)).catch(te=>q(te))}catch(fe){q(fe)}}}class Vi{constructor(N){this.actor=N,this.loading={},this.loaded={}}loadTile(N,q){const Q=N.uid,fe=N.request,te=this.loading[Q]=new ri(N),{cancel:me}=s.bu(fe,(Ie,ge,Re)=>{const Je=!this.loading[Q];if(delete this.loading[Q],Je||Ie||!ge)return te.status="done",Je||(this.loaded[Q]=te),q(Ie);te.parse(ge,(Ze,xt)=>{if(Ze||!xt)return q(Ze);q(null,xt,Re)}),this.loaded[Q]=te});te.abort=me}reloadTile(N,q){q(null,void 0)}abortTile(N,q){const Q=N.uid,fe=this.loading[Q];fe&&(fe.abort&&fe.abort(),delete this.loading[Q]),q()}removeTile(N,q){const Q=N.uid;this.loaded[Q]&&delete this.loaded[Q],q()}decodeRasterArray(N,q){s.bs.performDecoding(N.buffer,N.task).then(Q=>q(null,Q)).catch(Q=>q(Q))}}const xi=s.fB.prototype.toGeoJSON;class Wt{constructor(N){this._feature=N,this.extent=s.al,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=p
7arseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const q of this._feature.geometry)N.push([new s.P(q[0],q[1])]);return N}{const N=[];for(const q of this._feature.geometry){const Q=[];for(const fe of q)Q.push(new s.P(fe[0],fe[1]));N.push(Q)}return N}}toGeoJSON(N,q,Q){return xi.call(this,N,q,Q)}}class _o{constructor(N,q){this.name=N,this.extent=s.al,this.length=q.length,this._jsonFeatures=q}feature(N){return new Wt(this._jsonFeatures[N])}}class rn{constructor(N){this.layers={},this.extent=s.al;for(const q of Object.keys(N))this.layers[q]=new _o(q,N[q])}}const Ci=64/4096;class Li{constructor(){this.features=new Map}clear(){this.features.clear()}load(N=[],q){for(const Q of N){const fe=Q.id;if(fe==null)continue;let te=this.features.get(fe);te&&this.updateCache(te,q),Q.geometry?(te=go(Q),this.updateCache(te,q),this.features.set(fe,te)):this.features.delete(fe),this.updateCache(te,q)}}updateCache(N,q){for(const{canonical:Q,uid:fe}of Object.values(q)){const{z:te,x:me,y:Ie}=Q;sr(N,Math.pow(2,te),me,Ie)&&delete q[fe]}}getTile(N,q,Q){const fe=Math.pow(2,N),te=[];for(const me of this.features.values())sr(me,fe,q,Q)&&te.push(Ui(me,fe,q,Q));return{features:te}}getFeatures(){return[...this.features.values()]}}function sr({minX:ye,minY:N,maxX:q,maxY:Q},fe,te,me){return ye<(te+1+Ci)/fe&&N<(me+1+Ci)/fe&&q>(te-Ci)/fe&&Q>(me-Ci)/fe}function go(ye){const{id:N,geometry:q,properties:Q}=ye;if(!q)return;if(q.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:fe,coordinates:te}=q,me={id:N,type:1,geometry:[],tags:Q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Ie=me.geometry;if(fe==="Point")Wn(te,Ie,me);else if(fe==="MultiPoint")for(const ge of te)Wn(ge,Ie,me);else if(fe==="LineString")me.type=2,Xn(te,Ie,me);else if(fe==="MultiLineString")me.type=2,hn(te,Ie,me);else if(fe==="Polygon")me.type=3,hn(te,Ie,me,!0);else{if(fe!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");me.type=3;for(const ge of te)hn(ge,Ie,me,!0)}return me}function Wn([ye,N],q,Q){const fe=s.aF(ye);let te=s.aJ(N);te=te<0?0:te>1?1:te,q.push(fe,te),Q.minX=Math.min(Q.minX,fe),Q.minY=Math.min(Q.minY,te),Q.maxX=Math.max(Q.maxX,fe),Q.maxY=Math.max(Q.maxY,te)}function Xn(ye,N,q,Q=!1,fe=!1){const te=[];for(const me of ye)Wn(me,te,q);N.push(te),Q&&(function(me,Ie){let ge=0;for(let Re=0,Je=me.length,Ze=Je-2;Re<Je;Ze=Re,Re+=2)ge+=(me[Re]-me[Ze])*(me[Re+1]+me[Ze+1]);if(ge>0===Ie)for(let Re=0,Je=me.length;Re<Je/2;Re+=2){const Ze=me[Re],xt=me[Re+1];me[Re]=me[Je-2-Re],me[Re+1]=me[Je-1-Re],me[Je-2-Re]=Ze,me[Je-1-Re]=xt}})(te,fe)}function hn(ye,N,q,Q=!1){for(let fe=0;fe<ye.length;fe++)Xn(ye[fe],N,q,Q,fe===0)}function Ui(ye,N,q,Q){const{id:fe,type:te,geometry:me,tags:Ie}=ye,ge=[];if(te===1)(function(Re,Je,Ze,xt,Pt){for(let Lt=0;Lt<Re.length;Lt+=2){const Gt=Math.round(s.al*(Re[Lt+0]*Je-Ze)),Xt=Math.round(s.al*(Re[Lt+1]*Je-xt));Pt.push([Gt,Xt])}})(me,N,q,Q,ge);else if(te===2)for(const Re of me)In(Re,N,q,Q,ge);else if(te===3)for(const Re of me)za(Re,N,q,Q,ge);return{id:fe,type:te,geometry:ge,tags:Ie}}function In(ye,N,q,Q,fe){const me=s.al+128;let Ie;for(let ge=0;ge<ye.length-2;ge+=2){let Re=Math.round(s.al*(ye[ge+0]*N-q)),Je=Math.round(s.al*(ye[ge+1]*N-Q)),Ze=Math.round(s.al*(ye[ge+2]*N-q)),xt=Math.round(s.al*(ye[ge+3]*N-Q));const Pt=Ze-Re,Lt=xt-Je;Re<-128&&Ze<-128||(Re<-128?(Je+=Math.round(Lt*((-128-Re)/Pt)),Re=-128):Ze<-128&&(xt=Je+Math.round(Lt*((-128-Re)/Pt)),Ze=-128),Je<-128&&xt<-128||(Je<-128?(Re+=Math.round(Pt*((-128-Je)/Lt)),Je=-128):xt<-128&&(Ze=Re+Math.round(Pt*((-128-Je)/Lt)),xt=-128),Re>=me&&Ze>=me||(Re>=me?(Je+=Math.round(Lt*((me-Re)/Pt)),Re=me):Ze>=me&&(xt=Je+Math.round(Lt*((me-Re)/Pt)),Ze=me),Je>=me&&xt>=me||(Je>=me?(Re+=Math.round(Pt*((me-Je)/Lt)),Je=me):xt>=me&&(Ze=Re+Math.round(Pt*((me-Je)/Lt)),xt=me),Ie&&Re===Ie[Ie.length-1][0]&&Je===Ie[Ie.length-1][1]||(Ie=[[Re,Je]],fe.push(Ie)),Ie.push([Ze,xt])))))}}function za(ye,N,q,Q,fe){const te=(q-Ci)/N,me=(Q-Ci)/N,Ie=(q+1+Ci)/N,ge=(Q+1+Ci)/N;function Re(xt,Pt){let Lt=0;return xt<te?Lt|=1:xt>Ie&&(Lt|=2),Pt<me?Lt|=4:Pt>ge&&(Lt|=8),Lt}let Je=[];for(let xt=1;xt<=8;xt*=2){let Pt=ye[ye.length-2],Lt=ye[ye.length-1],Gt=!(Re(Pt,Lt)&xt);for(let Xt=0;Xt<ye.length;Xt+=2){const Nt=ye[Xt],Ft=ye[Xt+1],Oi=!(Re(Nt,Ft)&xt);Oi!==Gt&&(8&xt?Je.push(Pt+(Nt-Pt)*(ge-Lt)/(Ft-Lt),ge):4&xt?Je.push(Pt+(Nt-Pt)*(me-Lt)/(Ft-Lt),me):2&xt?Je.push(Ie,Lt+(Ft-Lt)*(Ie-Pt)/(Nt-Pt)):1&xt&&Je.push(te,Lt+(Ft-Lt)*(te-Pt)/(Nt-Pt))),Oi&&Je.push(Nt,Ft),Pt=Nt,Lt=Ft,Gt=Oi}if(!(ye=Je).length||xt===8)break;Je=[]}const Ze=[];for(let xt=0;xt<Je.length;xt+=2)Ze.push([Math.round(s.al*(Je[xt]*N-q)),Math.round(s.al*(Je[xt+1]*N-Q))]);Ze.length&&fe.push(Ze)}function Jo({name:ye,features:N},q){q.writeStringField(1,ye),q.writeVarintField(5,s.al);const Q=new Map,fe=new Map,te={keys:Q,values:fe,feature:null};for(const me of N)te.feature=me,q.writeMessage(2,br,te);for(const me of Q.keys())q.writeStringField(3,me);for(const me of fe.keys())q.writeMessage(4,aa,me)}function br(ye,N){const q=ye.feature;q.id!==void 0&&Number.isSafeInteger(+q.id)&&N.writeVarintField(1,+q.id),q.tags&&N.writeMessage(2,nn,ye),N.writeVarintField(3,q.type),N.writeMessage(4,Kr,q)}function nn({keys:ye,values:N,feature:q}
vendor: 6,370 bytes, line 7
7,Q){for(const fe of Object.keys(q.tags)){let te=q.tags[fe];if(te===null)continue;let me=ye.get(fe);me===void 0&&(me=ye.size,ye.set(fe,me)),Q.writeVarint(me);const Ie=typeof te;Ie!=="string"&&Ie!=="boolean"&&Ie!=="number"&&(te=JSON.stringify(te));let ge=N.get(te);ge===void 0&&(ge=N.size,N.set(te,ge)),Q.writeVarint(ge)}}function Ii(ye,N){return(N<<3)+(7&ye)}function tr(ye){return ye<<1^ye>>31}function Kr(ye,N){const{geometry:q,type:Q}=ye;let fe=0,te=0;if(Q===1){N.writeVarint(Ii(1,q.length));for(const me of q){const Ie=me[0]-fe,ge=me[1]-te;N.writeVarint(tr(Ie)),N.writeVarint(tr(ge)),fe+=Ie,te+=ge}}else for(const me of q){if(me.length===0)continue;N.writeVarint(Ii(1,1));const Ie=me.length-(Q===3?1:0);for(let ge=0;ge<Ie;ge++){ge===1&&N.writeVarint(Ii(2,Ie-1));const Re=me[ge][0]-fe,Je=me[ge][1]-te;N.writeVarint(tr(Re)),N.writeVarint(tr(Je)),fe+=Re,te+=Je}Q===3&&N.writeVarint(Ii(7,1))}}function aa(ye,N){const q=typeof ye;q==="string"?N.writeStringField(1,ye):q==="boolean"?N.writeBooleanField(7,ye):q==="number"&&(ye%1!=0?N.writeDoubleField(3,ye):ye<0?N.writeSVarintField(6,ye):N.writeVarintField(5,ye))}const pr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ye=>ye},Ss=Math.fround||(Is=new Float32Array(1),ye=>(Is[0]=+ye,Is[0]));var Is;class la{constructor(N){this.options=Object.assign(Object.create(pr),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:q,minZoom:Q,maxZoom:fe}=this.options;q&&console.time("total time");const te=`prepare ${N.length} points`;q&&console.time(te),this.points=N;const me=[];for(let ge=0;ge<N.length;ge++){const Re=N[ge];if(!Re.geometry)continue;const[Je,Ze]=Re.geometry.coordinates,xt=Ss(Oa(Je)),Pt=Ss(As(Ze));me.push(xt,Pt,1/0,ge,-1,1),this.options.reduce&&me.push(0)}let Ie=this.trees[fe+1]=this._createTree(me);q&&console.timeEnd(te);for(let ge=fe;ge>=Q;ge--){const Re=+Date.now();Ie=this.trees[ge]=this._createTree(this._cluster(Ie,ge)),q&&console.log("z%d: %d clusters in %dms",ge,Ie.numItems,+Date.now()-Re)}return q&&console.timeEnd("total time"),this}getClusters(N,q){let Q=((N[0]+180)%360+360)%360-180;const fe=Math.max(-90,Math.min(90,N[1]));let te=N[2]===180?180:((N[2]+180)%360+360)%360-180;const me=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)Q=-180,te=180;else if(Q>te){const Ze=this.getClusters([Q,fe,180,me],q),xt=this.getClusters([-180,fe,te,me],q);return Ze.concat(xt)}const Ie=this.trees[this._limitZoom(q)],ge=Ie.range(Oa(Q),As(me),Oa(te),As(fe)),Re=Ie.data,Je=[];for(const Ze of ge){const xt=this.stride*Ze;Je.push(Re[xt+5]>1?Io(Re,xt,this.clusterProps):this.points[Re[xt+3]])}return Je}getChildren(N){const q=this._getOriginId(N),Q=this._getOriginZoom(N),fe="No cluster with the specified id.",te=this.trees[Q];if(!te)throw new Error(fe);const me=te.data;if(q*this.stride>=me.length)throw new Error(fe);const Ie=this.options.radius/(this.options.extent*Math.pow(2,Q-1)),ge=te.within(me[q*this.stride],me[q*this.stride+1],Ie),Re=[];for(const Je of ge){const Ze=Je*this.stride;me[Ze+4]===N&&Re.push(me[Ze+5]>1?Io(me,Ze,this.clusterProps):this.points[me[Ze+3]])}if(Re.length===0)throw new Error(fe);return Re}getLeaves(N,q,Q){const fe=[];return this._appendLeaves(fe,N,q=q||10,Q=Q||0,0),fe}getTile(N,q,Q){const fe=this.trees[this._limitZoom(N)],te=Math.pow(2,N),{extent:me,radius:Ie}=this.options,ge=Ie/me,Re=(Q-ge)/te,Je=(Q+1+ge)/te,Ze={features:[]};return this._addTileFeatures(fe.range((q-ge)/te,Re,(q+1+ge)/te,Je),fe.data,q,Q,te,Ze),q===0&&this._addTileFeatures(fe.range(1-ge/te,Re,1,Je),fe.data,te,Q,te,Ze),q===te-1&&this._addTileFeatures(fe.range(0,Re,ge/te,Je),fe.data,-1,Q,te,Ze),Ze.features.length?Ze:null}getClusterExpansionZoom(N){let q=this._getOriginZoom(N)-1;for(;q<=this.options.maxZoom;){const Q=this.getChildren(N);if(q++,Q.length!==1)break;N=Q[0].properties.cluster_id}return q}_appendLeaves(N,q,Q,fe,te){const me=this.getChildren(q);for(const Ie of me){const ge=Ie.properties;if(ge&&ge.cluster?te+ge.point_count<=fe?te+=ge.point_count:te=this._appendLeaves(N,ge.cluster_id,Q,fe,te):te<fe?te++:N.push(Ie),N.length===Q)break}return te}_createTree(N){const q=new s.c4(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Q=0;Q<N.length;Q+=this.stride)q.add(N[Q],N[Q+1]);return q.finish(),q.data=N,q}_addTileFeatures(N,q,Q,fe,te,me){for(const Ie of N){const ge=Ie*this.stride,Re=q[ge+5]>1;let Je,Ze,xt;if(Re)Je=_r(q,ge,this.clusterProps),Ze=q[ge],xt=q[ge+1];else{const Gt=this.points[q[ge+3]];Je=Gt.properties;const[Xt,Nt]=Gt.geometry.coordinates;Ze=Oa(Xt),xt=As(Nt)}const Pt={type:1,geometry:[[Math.round(this.options.extent*(Ze*te-Q)),Math.round(this.options.extent*(xt*te-fe))]],tags:Je};let Lt;Lt=Re||this.options.generateId?q[ge+3]:this.points[q[ge+3]].id,Lt!==void 0&&(Pt.id=Lt),me.features.push(Pt)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,q){const{radius:Q,extent:fe,reduce:te,minPoints:me}=this.options,Ie=Q/(fe*Math.pow(2,q)),ge=N.data,Re=[],Je=this.stride;for(let Ze=0;Ze<ge.length;Ze+=Je){if(ge[Ze+2]<=q)continue;ge[Ze+2]=q;const xt=ge[Ze],Pt=ge[Ze+1],Lt=N.within(ge[Ze],ge[Ze+1],Ie),Gt=ge[Ze+5];let Xt=Gt;for(const Nt of Lt){const Ft=Nt*Je;ge[Ft+2]>q&&(Xt+=ge[Ft+5])}if(Xt>Gt&&Xt>=me){let Nt,Ft=xt*Gt,Oi=Pt*Gt,wr=-1;const ar=(Ze/Je<<5)+(q+1)+this.points.length;for(const lr of Lt){const $i=lr*Je;if(ge[$i+2]<=q)continue;ge[$i+2]=q;const si=ge[$i+5];Ft+=ge[$i]*si,Oi+=ge[$i+1]*si,ge[$i+4]=ar,te&&(Nt||(Nt=this._map(ge,Ze,!0),wr=this.clusterProps.length,this.clusterProps.push(Nt)),te(Nt,this._map(ge,$i)))}ge[Ze+4]=ar,Re.push(Ft/Xt,Oi/Xt,1/0,ar,-1,Xt),te&&Re.push(wr)}else{for(let Nt=0;Nt<Je;Nt++)Re.push(ge[Ze+Nt]);if(Xt>1)for(const Nt of Lt){const Ft=Nt*Je;if(!(ge[Ft+2]<=q)){ge[Ft+2]=q;for(let Oi=0;Oi<Je;Oi++)Re.push(ge[Ft+Oi])}}}}return Re}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,q,Q){if(N[q+5]>1){const me=this.clusterProps[N[q+6]];return Q?Object.assign({},me):me}const fe=this.points[N[q+3]].properties,te=this.options.map(fe);return Q&&te===fe?Object.assign({},te):te}}function Io(ye,N,q){return{type:"Feature",id:ye[N+3],properties:_r(ye,N,q),geometry:{type:"Point",coordinates:[(Q=ye[N],360*(Q-.5)),Fa(ye[N+1])]}};var Q}function _r(ye,N,q){const Q=ye[N+5],fe=Q>=1e4?`${Math.round(Q/1e3)}
7k`:Q>=1e3?Math.round(Q/100)/10+"k":Q,te=ye[N+6],me=te===-1?{}:Object.assign({},q[te]);return Object.assign(me,{cluster:!0,cluster_id:ye[N+3],point_count:Q,point_count_abbreviated:fe})}function Oa(ye){return ye/360+.5}function As(ye){const N=Math.sin(ye*Math.PI/180),q=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return q<0?0:q>1?1:q}function Fa(ye){const N=(180-360*ye)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function ca(ye,N,q,Q){let fe=Q;const te=N+(q-N>>1);let me,Ie=q-N;const ge=ye[N],Re=ye[N+1],Je=ye[q],Ze=ye[q+1];for(let xt=N+3;xt<q;xt+=3){const Pt=Rl(ye[xt],ye[xt+1],ge,Re,Je,Ze);if(Pt>fe)me=xt,fe=Pt;else if(Pt===fe){const Lt=Math.abs(xt-te);Lt<Ie&&(me=xt,Ie=Lt)}}fe>Q&&(me-N>3&&ca(ye,N,me,Q),ye[me+2]=fe,q-me>3&&ca(ye,me,q,Q))}function Rl(ye,N,q,Q,fe,te){let me=fe-q,Ie=te-Q;if(me!==0||Ie!==0){const ge=((ye-q)*me+(N-Q)*Ie)/(me*me+Ie*Ie);ge>1?(q=fe,Q=te):ge>0&&(q+=me*ge,Q+=Ie*ge)}return me=ye-q,Ie=N-Q,me*me+Ie*Ie}function kn(ye,N,q,Q){const fe={id:ye??null,type:N,geometry:q,tags:Q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")An(fe,q);else if(N==="Polygon")An(fe,q[0]);else if(N==="MultiLineString")for(const te of q)An(fe,te);else if(N==="MultiPolygon")for(const te of q)An(fe,te[0]);return fe}function An(ye,N){for(let q=0;q<N.length;q+=3)ye.minX=Math.min(ye.minX,N[q]),ye.minY=Math.min(ye.minY,N[q+1]),ye.maxX=Math.max(ye.maxX,N[q]),ye.maxY=Math.max(ye.maxY,N[q+1])}function Qo(ye,N,q,Q){if(!N.geometry)return;const fe=N.geometry.coordinates;if(fe&&fe.length===0)return;const te=N.geometry.type,me=Math.pow(q.tolerance/((1<<q.maxZoom)*q.extent),2);let Ie=[],ge=N.id;if(q.promoteId?ge=N.properties[q.promoteId]:q.generateId&&(ge=Q||0),te==="Point")es(fe,Ie);else if(te==="MultiPoint")for(const Re of fe)es(Re,Ie);else if(te==="LineString")Ms(fe,Ie,me,!1);else if(te==="MultiLineString"){if(q.lineMetrics){for(const Re of fe)Ie=[],Ms(Re,Ie,me,!1),ye.push(kn(ge,"LineString",Ie,N.properties));return}ua(fe,Ie,me,!1)}else if(te==="Polygon")ua(fe,Ie,me,!0);else{if(te!=="MultiPolygon"){if(te==="GeometryCollection"){for(const Re of N.geometry.geometries)Qo(ye,{id:ge,geometry:Re,properties:N.properties},q,Q);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Re of fe){const Je=[];ua(Re,Je,me,!0),Ie.push(Je)}}ye.push(kn(ge,te,Ie,N.properties))}function es(ye,N){N.push(dn(ye[0]),ka(ye[1]),0)}function Ms(ye,N,q,Q){let fe,te,me=0;for(let ge=0;ge<ye.length;ge++){const Re=dn(ye[ge][0]),Je=ka(ye[ge][1]);N.push(Re,Je,0),ge>0&&(me+=Q?(fe*Je-Re*te)/2:Math.sqrt(Math.pow(Re-fe,2)+Math.pow(Je-te,2))),fe=Re,te=Je}const Ie=N.length-3;N[2]=1,ca(N,0,Ie,q),N[Ie+2]=1,N.size=Math.abs(me),N.start=0,N.end=N.size}function ua(ye,N,q,Q){for(let fe=0;fe<ye.length;fe++){const te=[];Ms(ye[fe],te,q,Q),N.push(te)}}function dn(ye){return ye/360+.5}function ka(ye){const N=Math.sin(ye*Math.PI/180),q=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return q<0?0:q>1?1:q}function Yn(ye,N,q,Q,fe,te,me,Ie){if(Q/=N,te>=(q/=N)&&me<Q)return ye;if(me<q||te>=Q)return null;const ge=[];for(const Re of ye){const Je=Re.geometry;let Ze=Re.type;const xt=fe===0?Re.minX:Re.minY,Pt=fe===0?Re.maxX:Re.maxY;if(xt>=q&&Pt<Q){ge.push(Re);continue}if(Pt<q||xt>=Q)continue;let Lt=[];if(Ze==="Point"||Ze==="MultiPoint")Ll(Je,Lt,q,Q,fe);else if(Ze==="LineString")ts(Je,Lt,q,Q,fe,!1,Ie.lineMetrics);else if(Ze==="MultiLineString")is(Je,Lt,q,Q,fe,!1);else if(Ze==="Polygon")is(Je,Lt,q,Q,fe,!0);else if(Ze==="MultiPolygon")for(const Gt of Je){const Xt=[];is(Gt,Xt,q,Q,fe,!0),Xt.length&&Lt.push(Xt)}if(Lt.length){if(Ie.lineMetrics&&Ze==="LineString"){for(const Gt of Lt)ge.push(kn(Re.id,Ze,Gt,Re.tags));continue}Ze!=="LineString"&&Ze!=="MultiLineString"||(Lt.length===1?(Ze="LineString",Lt=Lt[0]):Ze="MultiLineString"),Ze!=="Point"&&Ze!=="MultiPoint"||(Ze=Lt.length===3?"Point":"MultiPoint"),ge.push(kn(Re.id,Ze,Lt,Re.tags))}}return ge.length?ge:null}function Ll(ye,N,q,Q,fe){for(let te=0;te<ye.length;te+=3){const me=ye[te+fe];me>=q&&me<=Q&&rs(N,ye[te],ye[te+1],ye[te+2])}}function ts(ye,N,q,Q,fe,te,me){let Ie=Jr(ye);const ge=fe===0?Cs:ns;let Re,Je,Ze=ye.start;for(let Xt=0;Xt<ye.length-3;Xt+=3){const Nt=ye[Xt],Ft=ye[Xt+1],Oi=ye[Xt+2],wr=ye[Xt+3],ar=ye[Xt+4],lr=fe===0?Nt:Ft,$i=fe===0?wr:ar;let si=!1;me&&(Re=Math.sqrt(Math.pow(Nt-wr,2)+Math.pow(Ft-ar,2))),lr<q?$i>q&&(Je=ge(Ie,Nt,Ft,wr,ar,q),me&&(Ie.start=Ze+Re*Je)):lr>Q?$i<Q&&(Je=ge(Ie,Nt,Ft,wr,ar,Q),me&&(Ie.start=Ze+Re*Je)):rs(Ie,Nt,Ft,Oi),$i<q&&lr>=q&&(Je=ge(Ie,Nt,Ft,wr,ar,q),si=!0),$i>Q&&lr<=Q&&(Je=ge(Ie,Nt,Ft,wr,ar,Q),si=!0),!te&&si&&(me&&(Ie.end=Ze+Re*Je),N.push(Ie),Ie=Jr(ye)),me&&(Ze+=Re)}let xt=ye.length-3;const Pt=ye[xt],Lt=ye[xt+1],Gt=fe===0?Pt:Lt;Gt>=q&&Gt<=Q&&rs(Ie,Pt,Lt,ye[xt+2]),xt=Ie.length-3,te&&xt>=3&&(Ie[xt]!==Ie[0]||Ie[xt+1]!==Ie[1])&&rs(Ie,Ie[0],Ie[1],Ie[2]),Ie.length&&N.push(Ie)}function Jr(ye){const N=[];return N.size=ye.size,N.start=ye.start,N.end=ye.end,N}function is(ye,N,q,Q,fe,te){for(const me of ye)ts(me,N,q,Q,fe,te,!1)}
vendor: 6,404 bytes, line 7
7function rs(ye,N,q,Q){ye.push(N,q,Q)}function Cs(ye,N,q,Q,fe,te){const me=(te-N)/(Q-N);return rs(ye,te,q+(fe-q)*me,1),me}function ns(ye,N,q,Q,fe,te){const me=(te-q)/(fe-q);return rs(ye,N+(Q-N)*me,te,1),me}function Ps(ye,N){const q=[];for(let Q=0;Q<ye.length;Q++){const fe=ye[Q],te=fe.type;let me;if(te==="Point"||te==="MultiPoint"||te==="LineString")me=Rs(fe.geometry,N);else if(te==="MultiLineString"||te==="Polygon"){me=[];for(const Ie of fe.geometry)me.push(Rs(Ie,N))}else if(te==="MultiPolygon"){me=[];for(const Ie of fe.geometry){const ge=[];for(const Re of Ie)ge.push(Rs(Re,N));me.push(ge)}}q.push(kn(fe.id,te,me,fe.tags))}return q}function Rs(ye,N){const q=[];q.size=ye.size,ye.start!==void 0&&(q.start=ye.start,q.end=ye.end);for(let Q=0;Q<ye.length;Q+=3)q.push(ye[Q]+N,ye[Q+1],ye[Q+2]);return q}function Ba(ye,N){if(ye.transformed)return ye;const q=1<<ye.z,Q=ye.x,fe=ye.y;for(const te of ye.features){const me=te.geometry,Ie=te.type;if(te.geometry=[],Ie===1)for(let ge=0;ge<me.length;ge+=2)te.geometry.push(qi(me[ge],me[ge+1],N,q,Q,fe));else for(let ge=0;ge<me.length;ge++){const Re=[];for(let Je=0;Je<me[ge].length;Je+=2)Re.push(qi(me[ge][Je],me[ge][Je+1],N,q,Q,fe));te.geometry.push(Re)}}return ye.transformed=!0,ye}function qi(ye,N,q,Q,fe,te){return[Math.round(q*(ye*Q-fe)),Math.round(q*(N*Q-te))]}function Wr(ye,N,q,Q,fe){const te=N===fe.maxZoom?0:fe.tolerance/((1<<N)*fe.extent),me={features:[],numPoints:0,numSimplified:0,numFeatures:ye.length,source:null,x:q,y:Q,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Ie of ye)zc(me,Ie,te,fe);return me}function zc(ye,N,q,Q){const fe=N.geometry,te=N.type,me=[];if(ye.minX=Math.min(ye.minX,N.minX),ye.minY=Math.min(ye.minY,N.minY),ye.maxX=Math.max(ye.maxX,N.maxX),ye.maxY=Math.max(ye.maxY,N.maxY),te==="Point"||te==="MultiPoint")for(let Ie=0;Ie<fe.length;Ie+=3)me.push(fe[Ie],fe[Ie+1]),ye.numPoints++,ye.numSimplified++;else if(te==="LineString")Na(me,fe,ye,q,!1,!1);else if(te==="MultiLineString"||te==="Polygon")for(let Ie=0;Ie<fe.length;Ie++)Na(me,fe[Ie],ye,q,te==="Polygon",Ie===0);else if(te==="MultiPolygon")for(let Ie=0;Ie<fe.length;Ie++){const ge=fe[Ie];for(let Re=0;Re<ge.length;Re++)Na(me,ge[Re],ye,q,!0,Re===0)}if(me.length){let Ie=N.tags||null;if(te==="LineString"&&Q.lineMetrics){Ie={};for(const Re in N.tags)Ie[Re]=N.tags[Re];Ie.mapbox_clip_start=fe.start/fe.size,Ie.mapbox_clip_end=fe.end/fe.size}const ge={geometry:me,type:te==="Polygon"||te==="MultiPolygon"?3:te==="LineString"||te==="MultiLineString"?2:1,tags:Ie};N.id!==null&&(ge.id=N.id),ye.features.push(ge)}}function Na(ye,N,q,Q,fe,te){const me=Q*Q;if(Q>0&&N.size<(fe?me:Q))return void(q.numPoints+=N.length/3);const Ie=[];for(let ge=0;ge<N.length;ge+=3)(Q===0||N[ge+2]>me)&&(q.numSimplified++,Ie.push(N[ge],N[ge+1])),q.numPoints++;fe&&(function(ge,Re){let Je=0;for(let Ze=0,xt=ge.length,Pt=xt-2;Ze<xt;Pt=Ze,Ze+=2)Je+=(ge[Ze]-ge[Pt])*(ge[Ze+1]+ge[Pt+1]);if(Je>0===Re)for(let Ze=0,xt=ge.length;Ze<xt/2;Ze+=2){const Pt=ge[Ze],Lt=ge[Ze+1];ge[Ze]=ge[xt-2-Ze],ge[Ze+1]=ge[xt-1-Ze],ge[xt-2-Ze]=Pt,ge[xt-1-Ze]=Lt}})(Ie,te),ye.push(Ie)}const Kn={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class oh{constructor(N,q){const Q=(q=this.options=(function(te,me){for(const Ie in me)te[Ie]=me[Ie];return te})(Object.create(Kn),q)).debug;if(Q&&console.time("preprocess data"),q.maxZoom<0||q.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(q.promoteId&&q.generateId)throw new Error("promoteId and generateId cannot be used together.");let fe=(function(te,me){const Ie=[];if(te.type==="FeatureCollection")for(let ge=0;ge<te.features.length;ge++)Qo(Ie,te.features[ge],me,ge);else Qo(Ie,te.type==="Feature"?te:{geometry:te},me);return Ie})(N,q);this.tiles={},this.tileCoords=[],Q&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",q.indexMaxZoom,q.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),fe=(function(te,me){const Ie=me.buffer/me.extent;let ge=te;const Re=Yn(te,1,-1-Ie,Ie,0,-1,2,me),Je=Yn(te,1,1-Ie,2+Ie,0,-1,2,me);return(Re||Je)&&(ge=Yn(te,1,-Ie,1+Ie,0,-1,2,me)||[],Re&&(ge=Ps(Re,1).concat(ge)),Je&&(ge=ge.concat(Ps(Je,-1)))),ge})(fe,q),fe.length&&this.splitTile(fe,0,0,0),Q&&(fe.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(N,q,Q,fe,te,me,Ie){const ge=[N,q,Q,fe],Re=this.options,Je=Re.debug;for(;ge.length;){fe=ge.pop(),Q=ge.pop(),q=ge.pop(),N=ge.pop();const Ze=1<<q,xt=Va(q,Q,fe);let Pt=this.tiles[xt];if(!Pt&&(Je>1&&console.time("creation"),Pt=this.tiles[xt]=Wr(N,q,Q,fe,Re),this.tileCoords.push({z:q,x:Q,y:fe}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",q,Q,fe,Pt.numFeatures,Pt.numPoints,Pt.numSimplified),console.timeEnd("creation"));const si=`z${q}`;this.stats[si]=(this.stats[si]||0)+1,this.total++}if(Pt.source=N,te==null){if(q===Re.indexMaxZoom||Pt.numPoints<=Re.indexMaxPoints)continue}else{if(q===Re.maxZoom||q===te)continue;if(te!=null){const si=te-q;if(Q!==me>>si||fe!==Ie>>si)continue}}if(Pt.source=null,N.length===0)continue;Je>1&&console.time("clipping");const Lt=.5*Re.buffer/Re.extent,Gt=.5-Lt,Xt=.5+Lt,Nt=1+Lt;let Ft=null,Oi=null,wr=null,ar=null,lr=Yn(N,Ze,Q-Lt,Q+Xt,0,Pt.minX,Pt.maxX,Re),$i=Yn(N,Ze,Q+Gt,Q+Nt,0,Pt.minX,Pt.maxX,Re);N=null,lr&&(Ft=Yn(lr,Ze,fe-Lt,fe+Xt,1,Pt.minY,Pt.maxY,Re),Oi=Yn(lr,Ze,fe+Gt,fe+Nt,1,Pt.minY,Pt.maxY,Re),lr=null),$i&&(wr=Yn($i,Ze,fe-Lt,fe+Xt,1,Pt.minY,Pt.maxY,Re),ar=Yn($i,Ze,fe+Gt,fe+Nt,1,Pt.minY,Pt.maxY,Re),$i=null),Je>1&&console.timeEnd("clipping"),ge.push(Ft||[],q+1,2*Q,2*fe),ge.push(Oi||[],q+1,2*Q,2*fe+1),ge.push(wr||[],q+1,2*Q+1,2*fe),ge.push(ar||[],q+1,2*Q+1,2*fe+1)}}getTile(N,q,Q){N=+N,q=+q,Q=+Q;const fe=this.options,{extent:te,debug:me}=fe;if(N<0||N>24)return null;const Ie=1<<N,ge=Va(N,q=q+Ie&Ie-1,Q);if(this.tiles[ge])return Ba(this.tiles[ge],te);me>1&&console.log("drilling down to z%d-%d-%d",N,q,Q);let Re,Je=N,Ze=q,xt=Q;for(;!Re&&Je>0;)Je--,Ze>>=1,xt>>=1,Re=this.tiles[Va(Je,Ze,xt)];return Re&&Re.source?(me>1&&(console.log("found parent tile z%d-%d-%d",Je,Ze,xt),console.time("drilling down")),this.splitTile(Re.source,Je,Ze,xt,N,q,Q),me>1&&console.timeEnd("drilling down"),this.tiles[ge]?Ba(this.tiles[ge],te):null):null}}
7function Va(ye,N,q){return 32*((1<<ye)*q+N)+ye}function Ke(ye,N){const q=ye.tileID.canonical;if(!this._geoJSONIndex)return void N(null,null);const Q=this._geoJSONIndex.getTile(q.z,q.x,q.y);if(!Q)return void N(null,null);const fe=Re=>Re.tags&&"3d_elevation_id"in Re.tags&&"source"in Re.tags&&Re.tags.source==="elevation",te=Q.features.filter(Re=>fe(Re));let me={_geojsonTileLayer:Q.features};te.length>0&&(me={_geojsonTileLayer:Q.features.filter(Re=>!fe(Re)),hd_road_elevation:te});const Ie=new rn(me),ge=(function(Re){const Je=new s.bt;for(const Ze of Object.keys(Re))Je.writeMessage(3,Jo,{name:Ze,features:Re[Ze]});return Je.finish()})(me).buffer;N(null,{vectorTile:Ie,rawData:ge})}class os extends Mt{constructor(N,q,Q,fe,te,me,Ie){super(N,q,Q,fe,te,Ke,Ie),me&&(this.loadGeoJSON=me),this._dynamicIndex=new Li}loadData(N,q){const Q=N&&N.request,fe=Q&&Q.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(N,(te,me)=>{if(te||!me)return q(te);if(typeof me!="object")return q(new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`));{try{if(N.filter){const ge=s.U(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ge.result==="error")throw new Error(ge.value.map(Re=>`${Re.key}: ${Re.message}`).join(", "));me.features=me.features.filter(Re=>ge.value.evaluate({zoom:0},Re))}N.dynamic?(me.type==="Feature"&&(me={type:"FeatureCollection",features:[me]}),N.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(me.features,this.loaded),N.cluster&&(me.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=N.cluster?new la((function({superclusterOptions:ge,clusterProperties:Re}){if(!Re||!ge)return ge;const Je={},Ze={},xt={accumulated:null,zoom:0},Pt={properties:null},Lt=Object.keys(Re);for(const Gt of Lt){const[Xt,Nt]=Re[Gt],Ft=s.U(Nt),Oi=s.U(typeof Xt=="string"?[Xt,["accumulated"],["get",Gt]]:Xt);Je[Gt]=Ft.value,Ze[Gt]=Oi.value}return ge.map=Gt=>{Pt.properties=Gt;const Xt={};for(const Nt of Lt)Xt[Nt]=Je[Nt].evaluate(xt,Pt);return Xt},ge.reduce=(Gt,Xt)=>{Pt.properties=Xt;for(const Nt of Lt)xt.accumulated=Gt[Nt],Gt[Nt]=Ze[Nt].evaluate(xt,Pt)},ge})(N)).load(me.features):N.dynamic?this._dynamicIndex:(function(ge,Re){return new oh(ge,Re)})(me,N.geojsonVtOptions)}catch(ge){return q(ge)}const Ie={};if(fe){const ge=we(Q);ge&&(Ie.resourceTiming={},Ie.resourceTiming[N.source]=JSON.parse(JSON.stringify(ge)))}q(null,Ie)}})}reloadTile(N,q){const Q=this.loaded;return Q&&Q[N.uid]?N.partial?q(null,void 0):super.reloadTile(N,q):this.loadTile(N,q)}loadGeoJSON(N,q){if(N.request)s.m(N.request,q);else{if(typeof N.data!="string")return q(new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return q(null,JSON.parse(N.data))}catch{return q(new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(N,q){try{q(null,this._geoJSONIndex.getClusterExpansionZoom(N.clusterId))}catch(Q){q(Q)}}getClusterChildren(N,q){try{q(null,this._geoJSONIndex.getChildren(N.
7clusterId))}catch(Q){q(Q)}}getClusterLeaves(N,q){try{q(null,this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset))}catch(Q){q(Q)}}}class sh{constructor(N,q,Q){this.tileID=new s.aQ(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.tileZoom=N.tileZoom,this.uid=N.uid,this.zoom=N.zoom,this.canonical=N.tileID.canonical,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=N.projection,this.brightness=q,this.worldview=Q}parse(N,q,Q,fe){this.status="parsing";const te=new s.aQ(Q.tileID.overscaledZ,Q.tileID.wrap,Q.tileID.canonical.z,Q.tileID.canonical.x,Q.tileID.canonical.y),me=[],Ie=q.familiesBySource[Q.source],ge=new s.fn(te,Q.promoteId);ge.bucketLayerIDs=[],ge.is3DTile=!0,s.fC(N).then(Re=>{if(!Re)return fe(new Error("Could not parse tile"));const Je=Re.json.extensionsUsed&&Re.json.extensionsUsed.includes("MAPBOX_mesh_features")||Re.json.asset.extras&&Re.json.asset.extras.MAPBOX_mesh_features,Ze=Re.json.extensionsUsed&&Re.json.extensionsUsed.includes("EXT_meshopt_compression"),xt=new s.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const Pt in Ie)for(const Lt of Ie[Pt]){const Gt=Lt[0];ge.bucketLayerIDs.push(Lt.map(Ft=>s.B(Ft.id,Ft.scope))),Gt.recalculate(xt,[]);const Xt=s.fD(Re,1/s.d7(Q.tileID.canonical)),Nt=new s.fE(Lt,Xt,te,Je,Ze,this.brightness,ge,this.worldview);Je||(Nt.needsUpload=!0),me.push(Nt),Nt.evaluate(Gt)}this.status="done",fe(null,{buckets:me,featureIndex:ge,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Re=>fe(new Error(Re.message)))}}class Dl{constructor(N,q,Q,fe,te,me,Ie,ge){this.actor=N,this.layerIndex=q,this.availableImages=Q,this.availableModels=fe,this.brightness=Ie,this.loading={},this.loaded={},this.worldview=ge}loadTile(N,q){const Q=N.uid,fe=this.loading[Q]=new sh(N,this.brightness,this.worldview);s.bu(N.request,(te,me)=>{const Ie=!this.loading[Q];return delete this.loading[Q],Ie||te?(fe.status="done",Ie||(this.loaded[Q]=fe),q(te)):me&&me.byteLength!==0?void fe.parse(me,this.layerIndex,N,(ge,Re)=>{fe.status="done",this.loaded=this.loaded||{},this.loaded[Q]=fe,ge||!Re?q(ge):q(null,Re)}):(fe.status="done",this.loaded[Q]=fe,q())})}reloadTile(N,q){const Q=this.loaded,fe=N.uid;if(Q&&Q[fe]){const te=Q[fe];te.projection=N.projection,te.brightness=N.brightness;const me=(Ie,ge)=>{te.reloadCallback&&(delete te.reloadCallback,this.loadTile(N,q)),q(Ie,ge)};te.status==="parsing"?te.reloadCallback=me:te.status==="done"&&this.loadTile(N,q)}}abortTile(N,q){const Q=N.uid;this.loading[Q]&&delete this.loading[Q],q()}removeTile(N,q){const Q=this.loaded,fe=N.uid;Q&&Q[fe]&&delete Q[fe],q()}}class ci{constructor(N){this.self=N,this.actor=new s.fG(N,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new s.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=s.cm({name:"mercator"}),this.workerSourceTypes={vector:Mt,geojson:os,"raster-dem":li,"raster-array":Vi,"batched-model":Dl},this.workerSources={},this.self.registerWorkerSource=(q,Q)=>{if(this.workerSourceTypes[q])throw new Error(`Worker source with name "${q}" already registered.`);this.workerSourceTypes[q]=Q},this.self.registerRTLTextPlugin=q=>{if(s.fH.isParsed())throw new Error("RTL text plugin already registered.");s.fH.setState({pluginStatus:s.fI.parsed,pluginURL:s.fH.getPluginURL()}),s.fH.applyArabicShaping=q.applyArabicShaping,s.fH.processBidirectionalText=q.processBidirectionalText,s.fH.processStyledBidirectionalText=q.processStyledBidirectionalText;for(const Q of this.rtlPluginParsingListeners)Q(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(N,q,Q){delete this.layerIndexes[N],delete this.availableImages[N],delete this.availableModels[N],delete this.workerSources[N],Q()}checkIfReady(N,q,Q){Q()}setReferrer(N,q){this.referrer=q}spriteLoaded(N,q){this.isSpriteLoaded[N]||(this.isSpriteLoaded[N]={});const{scope:Q,isLoaded:fe}=q;if(this.isSpriteLoaded[N][Q]=fe,this.workerSources[N]&&this.workerSources[N][Q])for(const te in this.workerSources[N][Q]){const me=this.workerSources[N][Q][te];for(const Ie in me){const ge=me[Ie];ge instanceof Mt&&(ge.isSpriteLoaded=fe,ge.fire(new s.z("isSpriteLoaded")))}}}setImages(N,q,Q){this.availableImages[N]||(this.availableImages[N]={});const{scope:fe,images:te}=q;if(this.availableImages[N][fe]=te,this.workerSources[N]&&this.workerSources[N][fe]){for(const me in this.workerSources[N][fe]){const Ie=this.workerSources[N][fe][me];for(const ge in Ie)Ie[ge].availableImages=te}Q()}else Q()}setModels(N,{scope:q,models:Q},fe){if(this.availableModels[N]||(this.availableModels[N]={}),this.availableModels[N][q]=Q,this.workerSources[N]&&this.workerSources[N][q]){for(const te in this.workerSources[N][q]){const me=this.workerSources[N][q][te];for(const Ie in me)me[Ie].availableModels=Q}
7fe()}else fe()}setProjection(N,q){this.projections[N]=s.cm(q)}setBrightness(N,q,Q){this.brightness=q,Q()}setWorldview(N,q,Q){this.worldview=q,Q()}setLayers(N,q,Q){this.getLayerIndex(N,q.scope).replace(q.layers,q.options),Q()}updateLayers(N,q,Q){this.getLayerIndex(N,q.scope).update(q.layers,q.removedIds,q.options),Q()}loadTile(N,q,Q){q.projection=this.projections[N]||this.defaultProjection,this.getWorkerSource(N,q.type,q.source,q.scope).loadTile(q,Q)}decodeRasterArray(N,q,Q){this.getWorkerSource(N,q.type,q.source,q.scope).decodeRasterArray(q,Q)}reloadTile(N,q,Q){q.projection=this.projections[N]||this.defaultProjection,this.getWorkerSource(N,q.type,q.source,q.scope).reloadTile(q,Q)}abortTile(N,q,Q){this.getWorkerSource(N,q.type,q.source,q.scope).abortTile(q,Q)}removeTile(N,q,Q){this.getWorkerSource(N,q.type,q.source,q.scope).removeTile(q,Q)}removeSource(N,q,Q){if(!(this.workerSources[N]&&this.workerSources[N][q.scope]&&this.workerSources[N][q.scope][q.type]&&this.workerSources[N][q.scope][q.type][q.source]))return;const fe=this.workerSources[N][q.scope][q.type][q.source];delete this.workerSources[N][q.scope][q.type][q.source],fe.removeSource!==void 0?fe.removeSource(q,Q):Q()}loadWorkerSource(N,q,Q){try{this.self.importScripts(q.url),Q()}catch(fe){Q(fe)}}syncRTLPluginState(N,q,Q){if(s.fH.isParsed())Q(null,!0);else if(s.fH.isParsing())this.rtlPluginParsingListeners.push(Q);else try{s.fH.setState(q);const fe=s.fH.getPluginURL();!s.fH.isLoaded()||s.fH.isParsed()||s.fH.isParsing()||fe==null||(s.fH.setState({pluginStatus:s.fI.parsing,pluginURL:s.fH.getPluginURL()}),this.self.importScripts(fe),s.fH.isParsed()?Q(null,!0):this.rtlPluginParsingListeners.push(Q))}catch(fe){Q(fe)}}setDracoUrl(N,q){this.dracoUrl=q}getAvailableImages(N,q){this.availableImages[N]||(this.availableImages[N]={});let Q=this.availableImages[N][q];return Q||(Q=[]),Q}getAvailableModels(N,q){this.availableModels[N]||(this.availableModels[N]={});let Q=this.availableModels[N][q];return Q||(Q={}),Q}getLayerIndex(N,q){this.layerIndexes[N]||(this.layerIndexes[N]={});let Q=this.layerIndexes[N][q];return Q||(Q=this.layerIndexes[N][q]=new ke,Q.scope=q),Q}getWorkerSource(N,q,Q,fe){const te=this.workerSources;return te[N]||(te[N]={}),te[N][fe]||(te[N][fe]={}),te[N][fe][q]||(te[N][fe][q]={}),this.isSpriteLoaded[N]||(this.isSpriteLoaded[N]={}),te[N][fe][q][Q]||(te[N][fe][q][Q]=new this.workerSourceTypes[q]({send:(me,Ie,ge,Re,Je,Ze)=>this.actor.send(me,Ie,ge,N,Je,Ze),scheduler:this.actor.scheduler},this.getLayerIndex(N,fe),this.getAvailableImages(N,fe),this.getAvailableModels(N,fe),this.isSpriteLoaded[N][fe],void 0,this.brightness,this.worldview)),te[N][fe][q][Q]}rasterizeImagesWorker(N,q,Q){const fe=new Map;for(const[te,{image:me,imageVariant:Ie}]of q.tasks.entries()){const ge=this.imageRasterizer.rasterize(Ie,me,q.scope,N);fe.set(te,ge)}Q(void 0,fe)}removeRasterizedImages(N,q,Q){this.imageRasterizer.removeImagesFromCacheByIds(q.imageIds,q.scope,N),Q()}enforceCacheSizeLimit(N,q){s.fJ(q)}getWorkerPerformanceMetrics(N,q,Q){Q(void 0,void 0)}}return s.fF(self)&&(self.worker=new ci(self)),ci}),ae(["./shared"],function(s){var we="3.18.1";const Pe={create:"create",load:"load",fullLoad:"fullLoad"},rt={mark(l){performance.mark(l)},measure(l,t,o){performance.measure(l,t,o)}};function ot(l){const t=l.name.split("?")[0];return s.a(t)&&t.includes("mapbox-gl.js")?"javascript":s.a(t)&&t.includes("mapbox-gl.css")?"css":s.b(t)?"fontRange":s.c(t)?"sprite":s.i(t)?"style":s.d(t)?"tilejson":"other"}var ke,dt={},Be=(function(){if(ke)return dt;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":(function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,m,y=new Blob([""],{type:"text/javascript"}),x=URL.createObjectURL(y);try{m=new Worker(x),p=!0}catch{p=!1}return m&&m.terminate(),URL.revokeObjectURL(x),p})()?(function(){var p=document.createElement("canvas");p.width=p.height=1;var m=p.getContext("2d");if(!m)return!1;var y=m.getImageData(0,0,1,1);return y&&y.width===p.width})()?(o[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(o[d]=(function(p){var m,y=(function(x){var T=document.createElement("canvas"),E=Object.create(l.webGLContextAttributes);return E.failIfMajorPerformanceCaveat=x,T.getContext("webgl2",E)})(p);if(!y)return!1;try{m=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!m||y.isContextLost())&&(y.shaderSource(m,"void main() {}"),y.compileShader(m),y.getShaderParameter(m,y.COMPILE_STATUS)===!0)})(d)),o[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}ke=1,dt.supported=l,dt.notSupportedReason=t;var o={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},dt})();function Xe(l,t,o){const c=document.createElement(l);return t!=null&&(c.className=t),o&&o.appendChild(c),c}function pe(l,t,o){const c=document.createElementNS("http://www.w3.org/2000/svg",l);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return o&&o.appendChild(c),c}const Ye=typeof document<"u"?document.documentElement&&document.documentElement.style:null,at=Ye&&Ye.userSelect!==void 0?"userSelect":"WebkitUserSelect";let gt;function Qe(){Ye&&at&&(gt=Ye[at],Ye[at]="none")}function He(){Ye&&at&&(Ye[at]=gt)}function yt(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",yt,!0)}function Tt(){window.addEventListener("click",yt,!0),window.setTimeout(()=>{window.removeEventListener("click",yt,!0)},0)}function Mt(l,t){const o=l.getBoundingClientRect();return Vi(l,o,t)}function li(l,t){const o=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(Vi(l,o,t[d]));return c}function ri(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function Vi(l,t,o){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new s.P((o.clientX-t.left)*c,(o.clientY-t.top)*c)}const xi="01",Wt="NO_ACCESS_TOKEN";class _o{constructor(t,o,c){this._transformRequestFn=t,this._customAccessToken=o,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=(function(){let o="";for(let c=0;c<10;c++)o+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",xi,o].join(""),tokenExpiresAt:Date.now()+432e5}})();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,o){return this._transformRequestFn&&this._transformRequestFn(t,o)||{url:t}}normalizeStyleURL(t,o){if(!s.h(t))return t;const c=Ci(t);return c.params.push(`sdk=js-${we}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeGlyphsURL(t,o){if(!s.h(t))return t;const c=Ci(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeModelURL(t,o){if(!s.h(t))return t;const c=Ci(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeSourceURL(t,o,c,d){if(!s.h(t))return t;const p=Ci(t);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),c&&p.params.push(`language=${c}`),d&&p.params.push(`worldview=${d}`),this._makeAPIURL(p,this._customAccessToken||o)}normalizeIconsetURL(t,o){const c=Ci(t);return s.h(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||o)):Li(c)}normalizeSpriteURL(t,o,c,d){const p=Ci(t);return s.h(t)?(p.path=`/styles/v1${p.path}/sprite${o}${c}`,this._makeAPIURL(p,this._customAccessToken||d)):(p.path+=`${o}${c}`,Li(p))}normalizeTileURL(t,o,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!s.h(t))return t;const d=Ci(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${o||c&&d.authority!=="raster"&&c===512?"@2x":""}${s.k.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${s.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${s.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${s.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${s.e.TILE_URL_VERSION}${d.path}`);const p=this._customAccessToken||(function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null})(d.params)||s.e.ACCESS_TOKEN;return s.e.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,p)}canonicalizeTileURL(t,o){const c=Ci(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${s.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${s.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${s.e.TILE_URL_VERSION}/`,"")}`;let p=c.params;return o&&(p=p.filter(m=>!m.match(/^access_token=/))),p.length&&(d+=`?${p.join("&")}`),d}canonicalizeTileset(t,o){const c=!!o&&s.h(o),d=[];for(const p of t.tiles||[])s.j(p)?d.push(this.canonicalizeTileURL(p,c)):d.push(p);return d}_makeAPIURL(t,o){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=Ci(s.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const p=t.params.indexOf("secure");p>=0&&t.params.splice(p,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!s.e.REQUIRE_ACCESS_TOKEN)return Li(t);if(o=o||s.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!o)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);
7if(o[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(p=>p.indexOf("access_token")===-1),t.params.push(`access_token=${o||""}`),Li(t)}}const rn=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Ci(l){const t=l.match(rn);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Li(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const sr="mapbox.eventData";function go(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(s.l(t[1]))}catch{return null}}class Wn{constructor(t){this.type=t,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const o=go(s.e.ACCESS_TOKEN);let c="";return c=o&&o.u?s.f(o.u):s.e.ACCESS_TOKEN||"",t?`${sr}.${t}:${c}`:`${sr}:${c}`}fetchEventData(){const t=s.s("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp");if(t)try{const p=localStorage.getItem(o);p&&(this.eventData=JSON.parse(p));const m=localStorage.getItem(c);m&&(this.anonId=m);const y=localStorage.getItem(d);y&&(this.anonIdTimestamp=Number(y));const x=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<x)&&this.refreshUUID()}catch{s.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=s.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const t=s.s("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp"),p=this.anonId,m=this.anonIdTimestamp;if(t&&p)try{localStorage.setItem(c,p),Object.keys(this.eventData).length>=1&&localStorage.setItem(o,JSON.stringify(this.eventData)),m&&localStorage.setItem(d,m.toString())}catch{s.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,o,c,d){if(!s.e.EVENTS_URL)return;const p=Ci(s.e.EVENTS_URL);p.params.push(`access_token=${d||s.e.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},y=o?Object.assign(m,o):m,x={url:Li(p),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=s.p(x,T=>{this.pendingRequest=null,c(T),this.saveEventData(),this.processRequests(d)})}queueRequest(t,o){this.queue.push(t),this.processRequests(o)}}class Xn extends Wn{constructor(t){super("metrics"),t&&(this.data=t)}postMetricsEvent(t){if(!s.e.EVENTS_URL||!t&&!s.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),s.v(this.anonId)||this.refreshUUID();const o=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:o},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:o,payload:c}=this.queue.shift();this.postEvent(o,c,()=>{},t)}}const hn=new class extends Wn{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){s.e.EVENTS_URL&&s.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(o=>s.h(o)||s.j(o))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=go(s.e.ACCESS_TOKEN),o=t?t.u:s.e.ACCESS_TOKEN;let c=o!==this.eventData.tokenU;s.v(this.anonId)||(this.refreshUUID(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const p=new Date(this.eventData.lastSuccess),m=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||p.getDate()!==m.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:we,skuId:xi,"enabled.telemetry":!1,userId:this.anonId},p=>{p||(this.eventData.lastSuccess=d,this.eventData.tokenU=o)},l):this.processRequests()}},Ui=hn.postTurnstileEvent.bind(hn),In=new class extends Wn{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,o,c){this.skuToken=t,this.errorCb=c,s.e.EVENTS_URL&&(o||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},o):this.errorCb(new Error(Wt)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:o}=this.queue.shift();t&&this.success[t]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),s.v(this.anonId)||this.refreshUUID(),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:we,skuId:xi,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},za=In.postMapLoadEvent.bind(In),Jo=new class extends Wn{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=s.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:o,style:c,importedStyles:d}=t;if(!s.e.EVENTS_URL||!l&&!s.e.ACCESS_TOKEN)return;const p=this.getMapInstanceId(o),m={mapInstanceId:p,eventId:this.getEventId(p),style:c};d.length&&(m.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:m},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:o}=this.queue.shift();this.postEvent(t,o,()=>{},l)}},br=Jo.postStyleLoadEvent.bind(Jo),nn=new Xn({attributes:[{name:"maps/js/layer
7-animations/style-with-appearances"}]}),Ii=nn.postMetricsEvent.bind(nn),tr=new Xn({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Kr=tr.postMetricsEvent.bind(tr),aa=new class extends Wn{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){s.e.EVENTS_URL&&(l||s.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:o}=this.queue.shift(),c=(function(d){const p=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),y=(function(P){const F={};if(P){for(const z in P)if(z!=="other")for(const B of P[z]){const j=`${z}ResolveRangeMin`,Z=`${z}ResolveRangeMax`,H=`${z}RequestCount`,$=`${z}RequestCachedCount`;F[j]=Math.min(F[j]||1/0,B.startTime),F[Z]=Math.max(F[Z]||-1/0,B.responseEnd);const le=ne=>{F[ne]===void 0&&(F[ne]=0),++F[ne]};B.transferSize!==void 0&&B.transferSize===0&&le($),le(H)}}return F})((function(P,F){const z={};if(P)for(const B of P){const j=F(B);z[j]===void 0&&(z[j]=[]),z[j].push(B)}return z})(p,ot)),x=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,E=T?T.effectiveType:void 0,C={counters:[],metadata:[],attributes:[]},M=(P,F,z)=>{z!=null&&P.push({name:F,value:z.toString()})};for(const P in y)M(C.counters,P,y[P]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(M(C.counters,"interactionRangeMin",d.interactionRange[0]),M(C.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const P of Object.values(Pe)){const F=m.find(z=>z.name===P);F&&M(C.counters,P,F.startTime)}return M(C.counters,"visibilityHidden",d.visibilityHidden),M(C.attributes,"style",(function(P){if(P)for(const F of P){const z=F.name.split("?")[0];if(s.i(z)){const B=z.split("/").slice(-2);if(B.length===2)return`mapbox://styles/${B[0]}/${B[1]}`}}})(p)),M(C.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),M(C.attributes,"fogEnabled",d.fogEnabled?"true":"false"),M(C.attributes,"projection",d.projection),M(C.attributes,"zoom",d.zoom),M(C.metadata,"devicePixelRatio",x),M(C.metadata,"connectionEffectiveType",E),M(C.metadata,"navigatorUserAgent",navigator.userAgent),M(C.metadata,"screenWidth",window.screen.width),M(C.metadata,"screenHeight",window.screen.height),M(C.metadata,"windowWidth",window.innerWidth),M(C.metadata,"windowHeight",window.innerHeight),M(C.metadata,"mapWidth",d.width/x),M(C.metadata,"mapHeight",d.height/x),M(C.metadata,"webglRenderer",d.renderer),M(C.metadata,"webglVendor",d.vendor),M(C.metadata,"sdkVersion",we),M(C.metadata,"sdkIdentifier","mapbox-gl-js"),C})(o);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},l)}},pr=aa.postPerformanceEvent.bind(aa),Ss=new class extends Wn{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,o,c){if(!s.e.API_URL||!s.e.SESSION_PATH)return;const d=Ci(s.e.API_URL+s.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||s.e.ACCESS_TOKEN||""}`);const p={url:Li(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=s.g(p,m=>{this.pendingRequest=null,o(m),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,o,c){this.skuToken=t,this.errorCb=c,s.e.SESSION_PATH&&s.e.API_URL&&(o||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},o):this.errorCb(new Error(Wt)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:o}=this.queue.shift();t&&this.success[t]||this.getSession(o,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},Is=Ss.getSessionAPI.bind(Ss),la=new Set;function Io(l,t){t?la.add(l):la.delete(l)}class _r{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,o){this._updatedSourceCaches[t]=o,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const o=t.scope;this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._updatedLayers[o].add(t.id),this.setDirty()}removeLayer(t){const o=t.scope;this._removedLayers[o]=this._removedLayers[o]||{},this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._removedLayers[o][t.id]=t,this._updatedLayers[o].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const o in this._updatedLayers)t[o]=t[o]||{},t[o].updatedIds=Array.from(this._updatedLayers[o].values());for(const o in this._removedLayers)t[o]=t[o]||{},t[o].removedIds=Object.keys(this._removedLayers[o]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,o){this._updatedImages[o]=this._updatedImages[o]||new Set,this._updatedImages[o].add(s.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function Oa(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class As extends s.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&s.r()&&(this.imageRasterizerDispatcher=new s.D(s.t(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new s.q({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const o=this.atlasTexture.get(t);o&&(o.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,o){this.imageProviders.has(o)||this.imageProviders.set(o,new Map),this.imageProviders.get(o).set(t.id,t)}removeImageProvider(t,o){this.imageProviders.has(o)&&this.imageProviders.get(o).delete(t)}getPendingImageProviders(){const t=[];for(const o of this.imageProviders.values())for(const c of o.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new s.x),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,o){if(this.loaded.get(o)!==t&&(this.loaded.set(o,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,o,d);this.requestors=[]}}hasImage(t,o){return!!this.getImage(t,o)}getImage(t,o){return this.images.get(o).get(t.toString())}
7addImage(t,o,c){this._validate(t,c)&&this.images.get(o).set(t.toString(),c)}_validate(t,o){let c=!0;return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(o.content,o)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,o){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||o<d[1])return!1;c=d[1]}return!0}_validateContent(t,o){return t?t.length!==4||!o.usvg&&(t[0]<0||o.data.width<t[0]||t[1]<0||o.data.height<t[1]||t[2]<0||o.data.width<t[2]||t[3]<0||o.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,o,c){const d=this.images.get(o).get(t.toString());c.version=d.version+1,this.images.get(o).set(t.toString(),c),this.updatedImages.get(o).add(t),this.removeFromImageRasterizerCache(t,o)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,o){this.spriteFormat!=="raster"&&(s.r()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:o}):this.imageRasterizer.removeImagesFromCacheByIds([t],o))}removeImage(t,o){const c=this.images.get(o),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(o).delete(t.toString()),this.removeFromImageRasterizerCache(t,o),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(o=>s.I.from(o))}getImages(t,o,c){const d=[],p=[],m=this.imageProviders.get(o);for(const E of t){if(!E.iconsetId){d.push(E);continue}const C=m.get(E.iconsetId);C&&(this.getImage(E,o)?p.push(E):C.addPendingRequest(E))}if(d.length===0)return void this._notify(p,o,c);let y=!0;const x=!!this.loaded.get(o),T=this.images.get(o);if(!x)for(const E of d)T.has(E.toString())||(y=!1);x||y?this._notify(d,o,c):this.requestors.push({ids:d,scope:o,callback:c})}rasterizeImages(t,o){const c=new Map,{tasks:d,scope:p}=t;for(const[m,y]of d.entries()){const x=this.getImage(y.id,p);x&&c.set(m,{image:x,imageVariant:y})}this._rasterizeImages(p,c,o)}_rasterizeImages(t,o,c){if(s.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:o,scope:t},c);else{const d=new Map;for(const[p,{image:m,imageVariant:y}]of o.entries())d.set(p,this.imageRasterizer.rasterize(y,m,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,o,c){const d=this.images.get(o),p=new Map;for(const m of t){if(!d.get(m.toString())){if(m.iconsetId)continue;this.fire(new s.z("styleimagemissing",{id:m.name}))}const y=d.get(m.toString());if(!y){s.w(`Image "${m.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const x={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(x,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),p.set(s.I.toString(m),x)}c(null,p)}getPixelSize(t){const{width:o,height:c}=this.atlasImage.get(t);return{width:o,height:c}}getPattern(t,o,c){const d=t.toString(),p=this.patterns.get(o),m=p.get(d),y=this.getImage(t,o);if(!y)return null;if(m){if(m.position.version===y.version)return m.position;m.position.version=y.version}else{if(y.usvg&&!y.data){const x=this.getPatternInFlightId(d,o);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const T=new s.A(t).scaleSelf(s.o.devicePixelRatio),E=new Map([[T.toString(),{image:y,imageVariant:T}]]);return this._rasterizeImages(o,E,(C,M)=>this.storePatternImage(T,o,y,c,M)),null}this.storePattern(t,o,y)}return this._updatePatternAtlas(o,c),p.get(d).position}getPatternInFlightId(t,o){return s.B(t,o)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,o,c,d,p){const m=t.toString(),y=p?p.get(m):void 0;y&&(c.data=y,this.storePattern(t.id,o,c),this._updatePatternAtlas(o,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),o)))}storePattern(t,o,c){const d={w:c.data.width+2*s.C,h:c.data.height+2*s.C,x:0,y:0},p=new s.F(d,c,s.C);this.patterns.get(o).set(t.toString(),{bin:d,position:p})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,o){const c=t.gl;let d=this.atlasTexture.get(o);d?this.dirty&&(d.update(this.atlasImage.get(o)),this.dirty=!1):(d=new s.T(t,this.atlasImage.get(o),c.RGBA8),this.atlasTexture.set(o,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,o){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:T})=>T),{w:p,h:m}=s.G(d),y=this.atlasImage.get(t);y.resize({width:p||1,height:m||1});const x=this.images.get(t);for(const[T,{bin:E,position:C}]of c.entries()){let M=C.padding;const P=E.x+M,F=E.y+M,z=x.get(T).data,B=z.width,j=z.height;M=M>1?M-1:M,s.q.copy(z,y,{x:0,y:0},{x:P,y:F},{width:B,height:j},o),s.q.copy(z,y,{x:0,y:j-M},{x:P,y:F-M},{width:B,height:M},o),s.q.copy(z,y,{x:0,y:0},{x:P,y:F+j},{width:B,height:M},o),s.q.copy(z,y,{x:B-M,y:0},{x:P-M,y:F},{width:M,height:j},o),s.q.copy(z,y,{x:0,y:0},{x:P+B,y:F},{width:M,height:j},o),s.q.copy(z,y,{x:B-M,y:j-M},{x:P-M,y:F-M},{width:M,height:M},o),s.q.copy(z,y,{x:0,y:j-M},{x:P+B,y:F-M},{width:M,height:M},o),s.q.copy(z,y,{x:0,y:0},{x:P+B,y:F+j},{width:M,height:M},o),s.q.copy(z,y,{x:B-M,y:0},{x:P-M,y:F+j},{width:M,height:M},o)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
7dispatchRenderCallbacks(t,o){const c=this.images.get(o);for(const d of t){if(this.callbackDispatchedThisFrame.get(o).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(o).add(d.toString());const p=c.get(d.toString());Oa(p)&&this.updateImage(d,o,p)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Fa(l){const t=l.value,o=l.valueSpec,c=l.style,d=l.styleSpec,p=l.key,m=l.arrayElementValidator||qi;if(!Array.isArray(t))return[new s.V(p,t,`array expected, ${s.K(t)} found`)];if(o.length&&t.length!==o.length)return[new s.V(p,t,`array length ${o.length} expected, length ${t.length} found`)];if(o["min-length"]&&t.length<o["min-length"])return[new s.V(p,t,`array length at least ${o["min-length"]} expected, length ${t.length} found`)];let y={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};d.$version<7&&(y.function=o.function),s.H(o.value)&&(y=o.value);let x=[];for(let T=0;T<t.length;T++)x=x.concat(m({array:t,arrayIndex:T,value:t[T],valueSpec:y,style:c,styleSpec:d,key:`${p}[${T}]`},!0));return x}function ca(l){const t=l.key,o=l.value,c=l.valueSpec;if(!s.L(o))return[new s.V(t,o,`number expected, ${s.K(o)} found`)];if(o!=o)return[new s.V(t,o,"number expected, NaN found")];if("minimum"in c){let d=c.minimum;if(Array.isArray(c.minimum)&&(d=c.minimum[l.arrayIndex]),o<d)return[new s.V(t,o,`${o} is less than the minimum value ${d}`)]}if("maximum"in c){let d=c.maximum;if(Array.isArray(c.maximum)&&(d=c.maximum[l.arrayIndex]),o>d)return[new s.V(t,o,`${o} is greater than the maximum value ${d}`)]}return[]}function Rl(l){const t=l.key,o=l.value;if(!s.H(o))return[new s.V(t,o,`object expected, ${s.K(o)} found`)];const c=l.valueSpec,d=s.J(o.type);let p,m,y,x={};const T=d!=="categorical"&&o.property===void 0,E=!T,C=(function(z){const B=z.stops;return Array.isArray(B)&&Array.isArray(B[0])&&s.H(B[0][0])})(o),M=Wr({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(z){if(d==="identity")return[new s.V(z.key,z.value,'identity function may not have a "stops" property')];let B=[];const j=z.value;return B=B.concat(Fa({key:z.key,value:j,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:P})),Array.isArray(j)&&j.length===0&&B.push(new s.V(z.key,j,"array must have at least one stop")),B},default:function(z){return qi({key:z.key,value:z.value,valueSpec:c,style:z.style,styleSpec:z.styleSpec})}}});return d==="identity"&&T&&M.push(new s.V(l.key,l.value,'missing required property "property"')),d==="identity"||o.stops||M.push(new s.V(l.key,l.value,'missing required property "stops"')),d==="exponential"&&c.expression&&!s.M(c)&&M.push(new s.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(E&&!s.N(c)?M.push(new s.V(l.key,l.value,"property functions not supported")):T&&!s.O(c)&&M.push(new s.V(l.key,l.value,"zoom functions not supported"))),d!=="categorical"&&!C||o.property!==void 0||M.push(new s.V(l.key,l.value,'"property" property is required')),M;function P(z){let B=[];const j=z.value,Z=z.key;if(!Array.isArray(j))return[new s.V(Z,j,`array expected, ${s.K(j)} found`)];if(j.length!==2)return[new s.V(Z,j,`array length 2 expected, length ${j.length} found`)];if(C){if(!s.H(j[0]))return[new s.V(Z,j,`object expected, ${s.K(j[0])} found`)];const H=j[0];if(H.zoom===void 0)return[new s.V(Z,j,"object stop key must have zoom")];if(H.value===void 0)return[new s.V(Z,j,"object stop key must have value")];const $=s.J(H.zoom);if(typeof $!="number")return[new s.V(Z,H.zoom,"stop zoom values must be numbers")];if(y&&y>$)return[new s.V(Z,H.zoom,"stop zoom values must appear in ascending order")];$!==y&&(y=$,m=void 0,x={}),B=B.concat(Wr({key:`${Z}[0]`,value:j[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:ca,value:F}}))}else B=B.concat(F({key:`${Z}[0]`,value:j[0],style:z.style,styleSpec:z.styleSpec},j));return s.Q(s.S(j[1]))?B.concat([new s.V(`${Z}[1]`,j[1],"expressions are not allowed in function stops.")]):B.concat(qi({ke
7y:`${Z}[1]`,value:j[1],valueSpec:c,style:z.style,styleSpec:z.styleSpec}))}function F(z,B){const j=s.K(z.value),Z=s.J(z.value),H=z.value!==null?z.value:B;if(p){if(j!==p)return[new s.V(z.key,H,`${j} stop domain type must match previous stop domain type ${p}`)]}else p=j;if(j!=="number"&&j!=="string"&&j!=="boolean"&&typeof Z!="number"&&typeof Z!="string"&&typeof Z!="boolean")return[new s.V(z.key,H,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&d!=="categorical"){let $=`number expected, ${j} found`;return s.N(c)&&d===void 0&&($+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(z.key,H,$)]}return d!=="categorical"||j!=="number"||typeof Z=="number"&&isFinite(Z)&&Math.floor(Z)===Z?d!=="categorical"&&j==="number"&&typeof Z=="number"&&typeof m=="number"&&m!==void 0&&Z<m?[new s.V(z.key,H,"stop domain values must appear in ascending order")]:(m=Z,d==="categorical"&&Z in x?[new s.V(z.key,H,"stop domain values must be unique")]:(x[Z]=!0,[])):[new s.V(z.key,H,`integer expected, found ${String(Z)}`)]}}function kn(l){const t=(l.expressionContext==="property"?s.W:s.U)(s.S(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new s.V(`${l.key}${c.key}`,l.value,c.message));const o=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!o.outputDefined())return[new s.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!s.Z(o))return[new s.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return An(o,l);if(l.expressionContext==="appearance")return Qo(o,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!s.X(o,["zoom","feature-state"]))return[new s.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!s.Y(o))return[new s.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function An(l,t){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)o.delete(d);if(o.size===0)return[];const c=[];return l instanceof s._&&o.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(d=>{c.push(...An(d,t))}),c)}function Qo(l,t){const o=new Set;if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)o.add(d);if(o.size===0)return[];const c=[];return l instanceof s._&&!o.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] is not an allowed parameter`)]:(l.eachChild(d=>{c.push(...Qo(d,t))}),c)}function es(l){const t=l.key,o=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(s.J(o))===-1&&d.push(new s.V(t,o,`expected one of [${c.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(c.values).indexOf(s.J(o))===-1&&d.push(new s.V(t,o,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(o)} found`)),d}function Ms(l){return s.a2(s.S(l.value))?kn(Object.assign({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):ua(l)}function ua(l){const t=l.value,o=l.key;if(!Array.isArray(t))return[new s.V(o,t,`array expected, ${s.K(t)} found`)];if(t.length<1)return[new s.V(o,t,"filter array must have at least 1 element")];const c=l.styleSpec;let d=es({key:`${o}[0]`,value:t[0],valueSpec:c.filter_operator});const p=()=>{t.length>=2&&(s.a0(t[1])||d.push(new s.V(`${o}[1]`,t[1],`string expected, ${s.K(t[1])} found`)));for(let m=2;m<t.length;m++)s.J(t[1])==="$type"?d=d.concat(es({key:`${o}[${m}]`,value:t[m],valueSpec:c.geometry_type})):s.a0(t[m])||s.L(t[m])||s.$(t[m])||d.push(new s.V(`${o}[${m}]`,t[m],`string, number, or boolean expected, ${s.K(t[m])} found.`))};
7switch(s.J(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&s.J(t[1])==="$type"&&d.push(new s.V(o,t,`"$type" cannot be use with operator "${t[0]}"`)),t.length!==3&&d.push(new s.V(o,t,`filter array for operator "${t[0]}" must have 3 elements`)),p();break;case"==":case"!=":t.length!==3&&d.push(new s.V(o,t,`filter array for operator "${t[0]}" must have 3 elements`)),p();break;case"in":case"!in":p();break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)d=d.concat(ua({key:`${o}[${m}]`,value:t[m],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":t.length!==2?d.push(new s.V(o,t,`filter array for "${t[0]}" operator must have 2 elements`)):s.a0(t[1])||d.push(new s.V(`${o}[1]`,t[1],`string expected, ${s.K(t[1])} found`))}return d}function dn(l,t){const o=l.key,c=l.style,d=l.layer,p=l.styleSpec,m=l.value,y=l.objectKey,x=p[`${t}_${l.layerType}`];if(!x)return[];const T=y.match(/^(.*)-use-theme$/);if(T&&x[T[1]])return s.Q(s.S(m))?[].concat(qi({key:o,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y})):qi({key:o,value:m,valueSpec:{type:"string"},style:c,styleSpec:p});const E=y.match(/^(.*)-transition$/);if(t==="paint"&&E&&x[E[1]]&&x[E[1]].transition)return qi({key:o,value:m,valueSpec:p.transition,style:c,styleSpec:p});const C=l.valueSpec||x[y];if(!C)return[new s.a3(o,m,`unknown property "${y}"`)];let M;if(s.a0(m)&&s.N(C)&&!C.tokens&&(M=/^{([^}]+)}$/.exec(m))){const F=`\`{ "type": "identity", "property": ${M?JSON.stringify(M[1]):'"_"'} }\``;return[new s.V(o,m,`"${y}" does not support interpolation syntax 8Use an identity property function instead: ${F}.`)]}const P=[];if(l.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||P.push(new s.V(o,m,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&s.a4(s.S(m))&&s.J(m.type)==="identity"&&P.push(new s.V(o,m,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&s.N(C)&&(s.a5(C)||s.O(C))){const F=s.W(s.S(m),C).value,z="expression"in F&&F.expression||"_styleExpression"in F&&F._styleExpression&&F._styleExpression.expression;z&&!s.X(z,["measure-light"])&&(y==="model-emissive-strength"&&s.Y(z)&&s.Z(z)||P.push(new s.V(o,m,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return P.concat(qi({key:l.key,value:m,valueSpec:C,style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y}))}function ka(l){return dn(l,"paint")}function Yn(l){return dn(l,"layout")}function Ll(l){let t=[];const o=l.value,c=l.key,d=l.style,p=l.styleSpec;if(!s.H(o))return[new s.V(c,o,"object expected")];o.type||o.ref||t.push(new s.V(c,o,'either "type" or "ref" is required'));let m=s.J(o.type);const y=s.J(o.ref);if(o.id){const x=s.J(o.id);for(let T=0;T<l.arrayIndex;T++){const E=d.layers[T];s.J(E.id)===x&&t.push(new s.V(c,o.id,`duplicate layer id "${x}", previously used at line ${E.id.__line__}`))}}if("ref"in o){let x;["type","source","source-layer","filter","layout"].forEach(T=>{T in o&&t.push(new s.V(c,o[T],`"${T}" is prohibited for ref layers`))}),d.layers.forEach(T=>{s.J(T.id)===y&&(x=T)}),x?x.ref?t.push(new s.V(c,o.ref,"ref cannot reference another ref layer")):m=s.J(x.type):typeof y=="string"&&t.push(new s.V(c,o.ref,`ref layer "${y}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(o.source)if(s.a0(o.source)){const x=d.sources&&d.sources[o.source],T=x&&s.J(x.type);x?T==="vector"&&m==="raster"?t.push(new s.V(c,o.source,`layer "${o.id}" requires a raster source`)):T==="raster"&&m!=="raster"?t.push(new s.V(c,o.source,`layer "${o.id}" requires a vector source`)):T!=="vector"||o["source-layer"]?T==="raster-dem"&&m!=="hillshade"?t.push(new s.V(c,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&o.paint&&(o.paint["line-gradient"]||o.paint["line-trim-offset"])&&T==="geojson"&&!x.lineMetrics?t.push(new s.V(c,o,`layer "${o.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&T!=="raster-array"&&t.push(new s.V(c,o.source,`layer "${o.id}" requires a 'raster-array' source.`)):t.push(new s.V(c,o.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new s.V(c,o,`layer "${o.id}" must specify a "source-layer"`)):t.push(new s.V(c,o.source,`source "${o.source}" not found`))}else t.push(new s.V(`${c}.source`,o.source,'"source" must be a string'));else t.push(new s.V(c,o,'missing required property "source"'));return t=t.concat(Wr({key:c,value:o,valueSpec:p.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>
8qi({key:`${c}.type`,value:o.type,valueSpec:p.layer.type,style:l.style,styleSpec:l.styleSpec,object:o,objectKey:"type"}),filter:x=>Ms(Object.assign({layerType:m},x)),layout:x=>Wr({layer:o,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>Yn(Object.assign({layerType:m},T))}}),paint:x=>Wr({layer:o,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>ka(Object.assign({layerType:m,layer:o},T))}}),appearances(x){const T=Fa({key:x.key,value:x.value,valueSpec:x.valueSpec,style:x.style,styleSpec:x.styleSpec,arrayElementValidator:M=>(function(P){const{key:F,layer:z,layerType:B}=P,j=s.J(P.value),Z=s.J(j.name),H=s.J(j.condition),$=Wr({key:F,value:j,valueSpec:P.styleSpec.appearance,style:P.style,styleSpec:P.styleSpec,objectElementValidators:{condition:le=>(function(ne){const se=[];return se.push(...kn({key:ne.key,value:ne.object.condition,valueSpec:s.a6.appearance.condition,expressionContext:"appearance"})),se})(Object.assign({layer:z,layerType:B},le)),properties:le=>(function(ne){const se=[],{styleSpec:ee,layer:J,layerType:ue}=ne,_e=ee[`paint_${ue}`],xe=ee[`layout_${ue}`],Ae=ne.object[ne.objectKey];for(const Ee in Ae){const Fe=Ee in _e?"paint":Ee in xe?"layout":void 0;
8if(!Fe){se.push(new s.V(ne.key,Ee,`unknown property "${Ee}" for layer type "${ue}"`));continue}const $e=Object.assign({},ne,{key:`${ne.key}.${Ee}`,object:Ae,objectKey:Ee,layer:J,layerType:ue,value:Ae[Ee],valueSpec:Fe==="paint"?_e[Ee]:xe[Ee]});se.push(...dn($e,Fe))}return se})(Object.assign({layer:z,layerType:B},le))}});return Z!=="hidden"&&H===void 0&&$.push(new s.V(P.key,"name",'Appearance with name different than "hidden" must have a condition')),$})(Object.assign({layerType:m,layer:o},M))}),E=Array.isArray(x.value)?x.value:[],C=new Set;return E.forEach((M,P)=>{const F=s.J(M.name);if(F)if(C.has(F)){const z=s.J(o.id);T.push(new s.V(x.key,F,`Duplicated appearance name "${F}" for layer "${z}"`))}else C.add(F)}),T}}})),t}function ts({key:l,value:t}){return s.a0(t)?[]:[new s.V(l,t,`string expected, ${s.K(t)} found`)]}const Jr={promoteId:function l({key:t,value:o}){if(s.a0(o))return ts({key:t,value:o});if(Array.isArray(o)){const d=[],p=s.S(o),m=s.U(p);return m.result==="error"&&m.value.forEach(y=>{d.push(new s.V(`${t}${y.key}`,null,`${y.message}`))}),s.X(m.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||d.push(new s.V(`${t}`,null,"promoteId expression should be only feature dependent")),d}if(!s.H(o))return[new s.V(t,o,`string, expression or object expected, "${s.K(o)}" found`)];const c=[];for(const d in o)c.push(...l({key:`${t}.${d}`,value:o[d]}));return c}};function is(l){const t=l.value,o=l.key,c=l.styleSpec,d=l.style;if(!s.H(t))return[new s.V(o,t,`object expected, ${s.K(t)} found`)];if(!("type"in t))return[new s.V(o,t,'"type" is required')];const p=s.J(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&("url"in t||"tiles"in t||m.push(new s.a3(o,t,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat(Wr({key:o,value:t,valueSpec:c[`source_${p.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:Jr})),m;case"geojson":if(m=Wr({key:o,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:Jr}),"cluster"in t&&"clusterProperties"in t){if(!s.H(t.clusterProperties))return[new s.V(`${o}.clusterProperties`,t,`object expected, ${s.K(t)} found`)];for(const y in t.clusterProperties){const x=t.clusterProperties[y];if(!Array.isArray(x))return[new s.V(`${o}.clusterProperties.${y}`,x,"array expected")];const[T,E]=x,C=typeof T=="string"?[T,["accumulated"],["get",y]]:T;m.push(...kn({key:`${o}.${y}.map`,value:E,expressionContext:"cluster-map"})),m.push(...kn({key:`${o}.${y}.reduce`,value:C,expressionContext:"cluster-reduce"}))}}return m;case"video":return Wr({key:o,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return Wr({key:o,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new s.V(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return es({key:`${o}.type`,value:t.type,valueSpec:{values:rs(c)}})}}function rs(l){return l.source.reduce((t,o)=>{const c=l[o];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values||{}))),t},[])}function Cs(l){const t=l.value,o=l.styleSpec,c=o.light,d=l.style;if(t===void 0)return[];if(!s.H(t))return[new s.V("light",t,`object expected, ${s.K(t)} found`)];let p=[];for(const m in t){const y=m.match(/^(.*)-transition$/),x=m.match(/^(.*)-use-theme$/);p=p.concat(x&&c[x[1]]?qi({key:m,value:t[m],valueSpec:{type:"string"},style:d,styleSpec:o}):y&&c[y[1]]&&c[y[1]].transition?qi({key:m,value:t[m],valueSpec:o.transition,style:d,styleSpec:o}):c[m]?qi({key:m,value:t[m],valueSpec:c[m],style:d,styleSpec:o}):[new s.V(m,t[m],`unknown property "${m}"`)])}return p}function ns(l){const t=l.value;if(!t)return[];const o=l.key;if(!s.H(t))return[new s.V(o,t,`object expected, ${s.K(t)} found`)];let c=[];const d=l.styleSpec,p=d["light-3d"],m=l.style,y=l.style.lights;for(const E of["type","id"])if(!(E in t))return c=c.concat([new s.V(o,t,`missing property "${E}"`)]),c;if(!s.a0(t.type))return c=c.concat([new s.V(`${o}.type`,t.type,"string expected")]),c;if(y)for(let E=0;E<l.arrayIndex;E++){const C=s.J(t.type),M=y[E];s.J(M.type)===C&&c.push(new s.V(o,t.id,`duplicate light type "${t.type}", previously defined at line ${M.id.__line__}`))}const x=`properties_light_${t.type}`;if(!(x in d))return c=c.concat([new s.V(`${o}.type`,t,`Invalid light type ${t.type}`)]),c;const T=d[x];for(const E in t)if(E==="properties"){const C=t[E];if(!s.H(C))return c=c.concat([new s.V("properties",C,`object expected, ${s.K(C)} found`)]),c;for(const M in C){const P=M.match(/^(.*)-transition$/),F=M.match(/^(.*)-use-theme$/);c=c.concat(F&&T[F[1]]?qi({key:E,value:C[M],valueSpec:{type:"string"},style:m,styleSpec:d}):P&&T[P[1]]&&T[P[1]].transition?qi({key:E,value:t[E],valueSpec:d.transition,style:m,styleSpec:d}):T[M]?qi({key:M,value:C[M],valueSpec:T[M],style:m,styleSpec:d}):[new s.a3(l.key,C[M],`unknown property "${M}"`)])}}else c=c.concat(p[E]?qi({key:E,value:t[E],valueSpec:p[E],style:m,styleSpec:d}):[new s.a3(E,t[E],`unknown property "${E}"`)]);return c}function Ps(l){const t=l.value,o=l.key,c=l.style,d=l.styleSpec,p=d.terrain;if(t==null)return[];if(!s.H(t))return[new s.V("terrain",t,`object expected, ${s.K(t)} found`)];let m=[];for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);m=m.concat(T&&p[T[1]]?qi({key:y,value:t[y],valueSpec:{type:"string"},style:c,styleSpec:d}):x&&p[x[1]]&&p[x[1]].transition?qi({key:y,value:t[y],valueSpec:d.transition,style:c,styleSpec:d}):p[y]?qi({key:y,value:t[y],valueSpec:p[y],style:c,styleSpec:d}):[new s.a3(y,t[y],`unknown property "${y}"`)])}if(t.source)if(s.a0(t.source)){const y=c.sources&&c.sources[t.source],x=y&&s.J(y.type);y?x!=="raster-dem"&&m.push(new s.V(`${o}.source`,t.source,`terrain cannot be used with a source of type ${x}, it only be used with a "raster-dem" source type`)):m.push(new s.V(`${o}.source`,t.source,`source "${t.source}" not found`))}else m.push(new s.V(`${o}.source`,t.source,"source must be a string"));else m.push(new s.V(o,t,'terrain is missing required property "source"'));return m}function Rs(l){const t=l.value,o=l.style,c=l.styleSpec,d=c.fog;if(t===void 0)return[];if(!s.H(t))return[new s.V("fog",t,`object expected, ${s.K(t)} found`)];let p=[];for(const m in t){const y=m.match(/^(.*)-transition$/),x=m.match(/^(.*)-use-theme$/);p=p.concat(x&&d[x[1]]?qi({key:m,value:t[m],valueSpec:{type:"string"},style:o,styleSpec:c}):y&&d[y[1]]&&d[y[1]].transition?qi({key:m,value:t[m],valueSpec:c.transition,style:o,styleSpec:c}):d[m]?qi({key:m,value:t[m],valueSpec:d[m],style:o,styleSpec:c}):[new s.a3(m,t[m],`unknown property "${m}"`)])}return p}const Ba={"*":()=>[],array:Fa,boolean:function(l){const t=l.value,o=l.key;return s.$(t)?[]:[new s.V(o,t,`boolean expected, ${s.K(t)} found`)]},number:ca,color:function({key:l,value:t}){return s.a0(t)?s.a1.parseCSSColor(t)===null?[new s.V(l,t,`color expected, "${t}" found`)]:[]:[new s.V(l,t,`color expected, ${s.K(t)} found`)]},enum:es,filter:Ms,function:Rl,layer:Ll,object:Wr,source:is,model:s.a7,light:Cs,"light-3d":ns,terrain:Ps,fog:Rs,string:ts,formatted:function(l){return ts(l).length===0?[]:kn(l)},resolvedImage:function(l){return ts(l).length===0?[]:kn(l)},projection:function(l){const t=l.value,o=l.styleSpec,c=o.projection,d=l.style;if(s.H(t)){let p=[];
8for(const m in t)p=p.concat(qi({key:m,value:t[m],valueSpec:c[m],style:d,styleSpec:o}));return p}return s.a0(t)?[]:[new s.V("projection",t,`object or string expected, ${s.K(t)} found`)]},import:function(l){const t=l.key,{value:o,styleSpec:c}=l;if(!s.H(o))return[new s.V(t,o,"import must be an object")];const{data:d,...p}=o;Object.defineProperty(p,"__line__",{value:o.__line__,enumerable:!1});let m=Wr(Object.assign({},l,{value:p,valueSpec:c.import}));return s.J(p.id)===""&&m.push(new s.V(`${l.key}.id`,p,"import id can't be an empty string")),d&&(m=m.concat(Na(d,c,{key:`${l.key}.data`}))),m},iconset:function(l){const t=l.value,o=l.key,c=l.styleSpec,d=l.style;if(!s.H(t))return[new s.V(o,t,"object expected")];if(!t.type)return[new s.V(o,t,'"type" is required')];const p=s.J(t.type);let m=[];if(m=m.concat(Wr({key:o,value:t,valueSpec:c[`iconset_${p}`],style:d,styleSpec:c})),(function(y,x){return!(y!=="source"||!x.source)})(p,t)){const y=d.sources&&d.sources[t.source],x=y&&s.J(y.type);y?x!=="raster-array"&&m.push(new s.V(o,t.source,`iconset cannot be used with a source of type ${String(x)}, it only be used with a "raster-array" source type`)):m.push(new s.V(o,t.source,`source "${t.source}" not found`))}return m}};function qi(l,t=!1){const o=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression){if(s.a4(s.J(o)))return Rl(l);if(s.Q(s.S(o)))return kn(l)}if(c.type&&Ba[c.type]){const p=Ba[c.type](l);return t===!0&&p.length>0&&Array.isArray(l.value)?kn(l):p}return Wr(Object.assign({},l,{valueSpec:c.type?d[c.type]:c}))}function Wr(l){const t=l.key,o=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},p=l.style,m=l.styleSpec;if(!s.H(o))return[new s.V(t,o,`object expected, ${s.K(o)} found`)];let y=[];for(const x in o){const T=x.split(".")[0];let E;d[T]?E=d[T]:c[T]?E=qi:d["*"]?E=d["*"]:c["*"]&&(E=qi),E?y=y.concat(E({key:(t&&`${t}.`)+x,value:o[x],valueSpec:c[T]||c["*"],style:p,styleSpec:m,object:o,objectKey:x},o)):y.push(new s.a3(t,o[x],`unknown property "${x}"`))}for(const x in c){if(d[x])continue;const T=c[x];T.required&&T.default===void 0&&o[x]===void 0&&y.push(new s.V(t,o,`missing required property "${x}"`))}return y}function zc({key:l,value:t}){const o=ts({key:l,value:t});if(o.length)return o;const c=t;return c.indexOf("{fontstack}")===-1&&o.push(new s.V(l,t,'"glyphs" url must include a "{fontstack}" token')),c.indexOf("{range}")===-1&&o.push(new s.V(l,t,'"glyphs" url must include a "{range}" token')),o}function Na(l,t=s.a6,o={}){return Wr({key:o.key||"",value:l,valueSpec:Object.assign(t.$root,{"*":{type:"*"}}),styleSpec:t,style:l,objectElementValidators:{glyphs:zc}})}function Kn(l,t=s.a6){return te(Na(l,t))}const oh=l=>te(is(l)),Va=l=>te(Cs(l)),Ke=l=>te(ns(l)),os=l=>te(Ps(l)),sh=l=>te(Rs(l)),Dl=l=>te((function(t){const o=t.value,c=t.style,d=t.styleSpec,p=d.snow;if(o===void 0)return[];if(!s.H(o))return[new s.V("snow",o,`object expected, ${s.K(o)} found`)];let m=[];for(const y in o){const x=y.match(/^(.*)-transition$/);m=m.concat(x&&p[x[1]]&&p[x[1]].transition?qi({key:y,value:o[y],valueSpec:d.transition,style:c,styleSpec:d}):p[y]?qi({key:y,value:o[y],valueSpec:p[y],style:c,styleSpec:d}):[new s.a3(y,o[y],`unknown property "${y}"`)])}return m})(l)),ci=l=>te((function(t){const o=t.value,c=t.style,d=t.styleSpec,p=d.rain;if(o===void 0)return[];if(!s.H(o))return[new s.V("rain",o,`object expected, ${s.K(o)} found`)];let m=[];for(const y in o){const x=y.match(/^(.*)-transition$/);m=m.concat(x&&p[x[1]]&&p[x[1]].transition?qi({key:y,value:o[y],valueSpec:d.transition,style:c,styleSpec:d}):p[y]?qi({key:y,value:o[y],valueSpec:p[y],style:c,styleSpec:d}):[new s.a3(y,o[y],`unknown property "${y}"`)])}return m})(l)),ye=l=>te(Ll(l)),N=l=>te(Ms(l)),q=l=>te(ka(l)),Q=l=>te(Yn(l)),fe=l=>te(s.a7(l));function te(l){return l.slice().sort((t,o)=>t.line&&o.line?t.line-o.line:0)}function me(l,t){let o=!1;if(t&&t.length)for(const c of t)c instanceof s.a3?s.w(c.message):(l.fire(new s.y(new Error(c.message))),o=!0);return o}const Ie=s.a6.light;let ge;class Re extends s.E{constructor(t,o="flat"){super(),this._transitionable=new s.a8(ge||(ge=new s.a9({anchor:new s.aa(Ie.anchor),position:new s.ab(Ie.position),color:new s.aa(Ie.color),intensity:new s.aa(Ie.intensity)}))),this.setLight(t,o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,o,c={}
8){this._validate(Va,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=o)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,c){return(!c||c.validate!==!1)&&me(this,t.call(Kn,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}}const Je=s.a6.terrain;let Ze=class extends s.E{constructor(l,t,o,c,d){super(),this.scope=o,this._transitionable=new s.a8(new s.a9({source:new s.aa(Je.source),exaggeration:new s.aa(Je.exaggeration)}),o,c),this._transitionable.setTransitionOrValue(l,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=d}get(){return this._transitionable.serialize()}set(l,t){this._transitionable.setTransitionOrValue(l,t)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new s.ac(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let o=-1,c=-1,d=1;for(const p of t.zoomStops)d=t.evaluate(new s.ac(p,{worldview:this.worldview})),d>.01?(o=p,c=-1):c=p;return d<.01&&o>0&&c>o?[o,c]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof s.ad}};const xt=.05;function Pt(l,t,o,c){const d=s.ah(45,65,o),[p,m]=Lt(l,c);let y=1-Math.min(1,Math.exp((t-p)/(m-p)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function Lt(l,t){const o=.5/Math.tan(.5*t);return[l.range[0]+o,l.range[1]+o]}function Gt(l,t,o,c,d){const p=s.af([],[t,o,c],d.mercatorFogMatrix);return Pt(l,s.ag(p),d.pitch,d._fov)}function Xt(l,t,o,c,d,p,m){const y=[[o,c,0],[d,c,0],[d,p,0],[o,p,0]];let x=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const E of y){const C=s.af([],E,t),M=s.ag(C);x=Math.min(x,M),T=Math.max(T,M)}return[Pt(l,x,m.pitch,m._fov),Pt(l,T,m.pitch,m._fov)]}const Nt=s.a6.fog;class Ft extends s.E{constructor(t,o,c,d){super();const p=new s.a9({range:new s.aa(Nt.range),color:new s.aa(Nt.color),"color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new s.aa(Nt["high-color"]),"high-color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new s.aa(Nt["space-color"]),"space-color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new s.aa(Nt["horizon-blend"]),"star-intensity":new s.aa(Nt["star-intensity"]),"vertical-range":new s.aa(Nt["vertical-range"])});this._transitionable=new s.a8(p,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=o,this.properties=new s.ai(p),this.scope=c}get state(){const t=this._transform,o=t.projection.name==="globe",c=s.aj(t.zoom),d=this.properties.get("range"),p=[.5,3];return{range:o?[s.ak(p[0],d[0],c),s.ak(p[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,o,c={}){if(this._validate(sh,t,c))return;const d=Object.assign({},t);for(const p of Object.keys(Nt))d[p]===void 0&&(d[p]=Nt[p].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,o)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const o=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.ah(45,65,t))*o.a}getOpacityAtLatLng(t,o){return this._transform.projection.supportsFog?(function(c,d,p){const m=s.ae.fromLngLat(d),y=p.elevation?p.elevation.getAtPointOrZero(m):0;return Gt(c,m.x,m.y,y,p)})(this.state,t,o):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const o=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Xt(this.state,o,0,0,s.al,s.al,this._transform)}getOpacityForBounds(t,o,c,d,p){return this._transform.projection.supportsFog?Xt(this.state,t,o,c,d,p,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?Lt(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const o=[4,5,6,7];for(const c of o){const d=t.points[c];let p;if(d[2]>=0)p=d;else{const m=t.points[c-4];p=s.am(m,d,m[2]/(m[2]-d[2]))}if(Gt(this.state,p[0],p[1],0,this._transform)>=xt)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,c){return(!c||c.validate!==!1)&&me(this,t.call(Kn,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}}let Oi,wr,ar,lr=class extends s.E{constructor(l,t,o,c){super();const d=Oi||(Oi=new s.a9({density:new s.aa(s.a6.snow.density),intensity:new s.aa(s.a6.snow.intensity),color:new s.aa(s.a6.snow.color),opacity:new s.aa(s.a6.snow.opacity),vignette:new s.aa(s.a6.snow.vignette),"vignette-color":new s.aa(s.a6.snow["vignette-color"]),"center-thinning":new s.aa(s.a6.snow["center-thinning"]),direction:new s.aa(s.a6.snow.direction),"flake-size":new s.aa(s.a6.snow["flake-size"])}));this._transitionable=new s.a8(d,o,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ai(d),this.scope=o}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),o=this.properties.get("direction"),c=s.an(o[0]),d=-Math.max(s.an(o[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=m,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.ao(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,t,o={}
8){if(this._validate(Dl,l,o))return;const c=Object.assign({},l),d=s.a6.snow;for(const p of Object.keys(d))c[p]===void 0&&(c[p]=d[p].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,o){return(!o||o.validate!==!1)&&me(this,l.call(Kn,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}},$i=class extends s.E{constructor(l,t,o,c){super();const d=wr||(wr=new s.a9({density:new s.aa(s.a6.rain.density),intensity:new s.aa(s.a6.rain.intensity),color:new s.aa(s.a6.rain.color),opacity:new s.aa(s.a6.rain.opacity),vignette:new s.aa(s.a6.rain.vignette),"vignette-color":new s.aa(s.a6.rain["vignette-color"]),"center-thinning":new s.aa(s.a6.rain["center-thinning"]),direction:new s.aa(s.a6.rain.direction),"droplet-size":new s.aa(s.a6.rain["droplet-size"]),"distortion-strength":new s.aa(s.a6.rain["distortion-strength"])}));this._transitionable=new s.a8(d,o,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ai(d),this.scope=o}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),o=this.properties.get("direction"),c=s.an(o[0]),d=-Math.max(s.an(o[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette-color");return m.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.ao(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:m}}get(){return this._transitionable.serialize()}set(l,t,o={}){if(this._validate(ci,l,o))return;const c=Object.assign({},l),d=s.a6.rain;for(const p of Object.keys(d))c[p]===void 0&&(c[p]=d[p].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,o){return(!o||o.validate!==!1)&&me(this,l.call(Kn,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}};class si extends s.E{constructor(t,o,c,d){super(),this.scope=c,this._options=t,this.properties=new s.ai(o),this._transitionable=new s.a8(o,c,new Map(d)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,o){this._options=t,this._transitionable.setTransitionOrValue(t.properties,o)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}const Yi=()=>ar||(ar=new s.a9({color:new s.aa(s.a6.properties_light_ambient.color),"color-use-theme":new s.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.aa(s.a6.properties_light_ambient.intensity)}));let Pi;const Ri=()=>Pi||(Pi=new s.a9({direction:new s.ap(s.a6.properties_light_directional.direction),color:new s.aa(s.a6.properties_light_directional.color),"color-use-theme":new s.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.aa(s.a6.properties_light_directional.intensity),"cast-shadows":new s.aa(s.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new s.aa(s.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new s.aa(s.a6.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new s.aa(s.a6.properties_light_directional["shadow-draw-before-layer"])}));class or{constructor(t,o,c){this.screenBounds=t,this.cameraPoint=c.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=o,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,c)}static createFromScreenPoints(t,o){let c,d;if(t instanceof s.P||typeof t[0]=="number"){const p=s.P.convert(t);c=[p],d=o.isPointAboveHorizon(p)}else{const p=s.P.convert(t[0]),m=s.P.convert(t[1]),y=p.add(m)._div(2);c=[p,m],d=s.aq(p,m).every(x=>o.isPointAboveHorizon(x))&&o.isPointAboveHorizon(y)}return new or(c,d,o)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return s.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const o=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.aq(o,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>o.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=o.x&&(d[3]=this.cameraPoint)),s.ar(d,t)}bufferedCameraGeometryGlobe(t){const o=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.aq(o,c,t),p=this.cameraPoint.clone();switch(3*((p.y>o.y)+(p.y>
8c.y))+((p.x>o.x)+(p.x>c.x))){case 0:d[0]=p,d[4]=p.clone();break;case 1:d.splice(1,0,p);break;case 2:d[1]=p;break;case 3:d.splice(4,0,p);break;case 5:d.splice(2,0,p);break;case 6:d[3]=p;break;case 7:d.splice(3,0,p);break;case 8:d[2]=p}return d}containsTile(t,o,c,d=0){const p=Math.max(t.queryPadding,t.evaluateQueryRenderedFeaturePadding())/o._pixelsPerMercatorPixel+1,m=c?this._bufferedCameraMercator(p,o):this._bufferedScreenMercator(p,o);let y=t.tileID.wrap+(m.unwrapped?d:0);const x=m.polygon.map(B=>s.as(t.tileTransform,B,y));if(!s.at(x,0,0,s.al,s.al))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(B=>s.au(t.tileTransform,B,y)),E=T.map(B=>new s.P(B[0],B[1])),C=o.getFreeCameraOptions().position||new s.ae(0,0,0),M=s.au(t.tileTransform,C,y),P=T.map(B=>{const j=s.av(B,B,M);return s.aw(j,j),new s.ax(M,j)}),F=s.ay(t,1,o.zoom)*o._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:E,tilespaceRays:P,bufferedTilespaceGeometry:x,bufferedTilespaceBounds:(z=s.az(x),z.min.x=s.aA(z.min.x,0,s.al),z.min.y=s.aA(z.min.y,0,s.al),z.max.x=s.aA(z.max.x,0,s.al),z.max.y=s.aA(z.max.y,0,s.al),z),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:F};var z}_bufferedScreenMercator(t,o){const c=Ir(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),o):{polygon:this.bufferedScreenGeometry(t).map(p=>o.pointCoordinate3D(p)),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,o){const c=Ir(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),o):{polygon:this.bufferedCameraGeometry(t).map(p=>o.pointCoordinate3D(p)),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,o){const c=(function(p,m){const y=s.aB([],m.pixelMatrix,m.globeMatrix),x=[0,-s.aD,0,1],T=[0,s.aD,0,1],E=[0,0,0,1];s.aC(x,x,y),s.aC(T,T,y),s.aC(E,E,y);const C=new s.P(x[0]/x[3],x[1]/x[3]),M=new s.P(T[0]/T[3],T[1]/T[3]),P=s.aE(p,C)&&x[3]<E[3],F=s.aE(p,M)&&T[3]<E[3];if(!P&&!F)return null;const z=(function(se,ee,J){for(let ue=1;ue<se.length;ue++){const _e=Ur(ee.pointCoordinate3D(se[ue-1]).x),xe=Ur(ee.pointCoordinate3D(se[ue]).x);if(J<0){if(_e<xe)return{idx:ue,t:-_e/(xe-1-_e)}}else if(xe<_e)return{idx:ue,t:(1-_e)/(xe+1-_e)}}return null})(p,m,P?-1:1);if(!z)return null;const{idx:B,t:j}=z;let Z=B>1?Xr(p.slice(0,B),m):[],H=B<p.length?Xr(p.slice(B),m):[];Z=Z.map(se=>new s.P(Ur(se.x),se.y)),H=H.map(se=>new s.P(Ur(se.x),se.y));const $=[...Z];$.length===0&&$.push(H[H.length-1]);const le=s.ak($[$.length-1].y,(H.length===0?Z[0]:H[0]).y,j);let ne;return ne=P?[new s.P(0,le),new s.P(0,0),new s.P(1,0),new s.P(1,le)]:[new s.P(1,le),new s.P(1,1),new s.P(0,1),new s.P(0,le)],$.push(...ne),H.length===0?$.push(Z[0]):$.push(...H),{polygon:$.map(se=>new s.ae(se.x,se.y)),unwrapped:!1}})(t,o);if(c)return c;const d=(function(p,m){let y=!1,x=-1/0,T=0;for(let C=0;C<p.length-1;C++)p[C].x>x&&(x=p[C].x,T=C);for(let C=0;C<p.length-1;C++){const M=(T+C)%(p.length-1),P=p[M],F=p[M+1];Math.abs(P.x-F.x)>.5&&(P.x<F.x?(P.x+=1,M===0&&(p[p.length-1].x+=1)):(F.x+=1,M+1===p.length-1&&(p[0].x+=1)),y=!0)}const E=s.aF(m.center.lng);return y&&E<Math.abs(E-1)&&p.forEach(C=>{C.x-=1}),{polygon:p,unwrapped:y}})(Xr(t,o).map(p=>new s.P(Ur(p.x),p.y)),o);return{polygon:d.polygon.map(p=>new s.ae(p.x,p.y)),unwrapped:d.unwrapped}}}function Xr(l,t){return s.aG(l,o=>{const c=t.pointCoordinate3D(o);o.x=c.x,o.y=c.y},1/256)}function Ur(l){return l<0?1+l%1:l%1}function Ir(l){return 100*l|0}function Ls(l,t,o,c,d){const p=function(y,x){if(y)return d(y);if(x){if(l.url&&x.tiles&&l.tiles&&delete l.tiles,x.variants){if(!Array.isArray(x.variants))return d(new Error("variants must be an array"));for(const E of x.variants){if(E==null||typeof E!="object"||E.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(E.capabilities))return d(new Error("capabilities must be an array"));if(E.capabilities.length===1&&E.capabilities[0]==="meshopt"){x=Object.assign(x,E);break}}}const T=s.aH(Object.assign({},x,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);T.tiles=t.canonicalizeTileset(T,l.url),d(null,T)}},m=(function(y,x,T){if(!y)return null;if(!x&&!T)return y;T=T||y.worldview_default;const E=Object.values(y.language||{});if(E.length===0)return null;const C=Object.values(y.worldview||{});if(C.length===0)return null;const M=E.every(F=>F===x),P=C.every(F=>F===T);return M&&P?y:x in(y.language_options||{})||T in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null})(l.data,o,c);return m?s.o.frame(()=>p(null,m)):l.url?s.m(t.transformRequest(t.normalizeSourceURL(l.url,null,o,c),s.R.Source),p):s.o.frame(()=>{const{data:y,...x}=l;p(null,x)})}function on(l,t){const o=Math.pow(2,t.z),c=Math.floor(s.aF(l.getWest())*o),d=Math.floor(s.aJ(l.getNorth())*o),p=Math.ceil(s.aF(l.getEast())*o),m=Math.ceil(s.aJ(l.getSouth())*o);return t.x>=c&&t.x<p&&t.y>=d&&t.y<m}class Bn{constructor(t,o,c){this.bounds=t?s.aI.convert(this.validateBounds(t)):null,this.minzoom=o||0,this.maxzoom=c||24}
8validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const o of t)this.extraBounds.push(s.aI.convert(this.validateBounds(o)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!on(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const o of this.extraBounds)if(on(o,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const o=new Bn(t.bounds,t.minzoom,t.maxzoom);return o.addExtraBounds(t.extra_bounds),o}}class yo extends s.E{constructor(t,o,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,s.aH(o,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},o),this._collectResourceTiming=!!o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new s.aK}load(t){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const o=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=Ls(this._options,this.map._requestManager,o,c,(d,p)=>{if(this._tileJSONRequest=null,this._loaded=!0,d)o&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${o}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new s.y(d));else if(p){if(Object.assign(this,p),this.hasWorldviews=!!p.worldview_options,p.worldview_default&&(this.worldviewDefault=p.worldview_default),p.vector_layers){this.vectorLayers=p.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const m of p.vector_layers)this.vectorLayerIds.push(m.id),p.worldview&&p.worldview[m.source]&&this.localizableLayerIds.add(m.id)}this.tileBounds=Bn.fromTileJSON(p),Ui(p.tiles,this.map._requestManager._customAccessToken),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(t,o){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),p=this.map._requestManager.transformRequest(d,s.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,y=m?{image:m.image.clone()}:null,x={request:p,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:s.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.getIndoorTileOptions(this.id,this.scope)};if(this.hasWorldviews&&s.h(c)&&(x.localizableLayerIds=this.localizableLayerIds),x.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=o:t.request=t.actor.send("reloadTile",x,T.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",x,T.bind(this),void 0,!0);else{const E=s.aL.call({deduped:this._deduped},x,(C,M)=>{if(C||!M)T.call(this,C);else{const P=s.aM(M.responseHeaders);x.data={rawData:M.rawData.slice(0),expires:P.expires,cacheControl:P.cacheControl},t.actor&&t.actor.send("loadTile",x,T.bind(this),void 0,!0)}},!0);t.request={cancel:E}}function T(E,C){return delete t.request,t.aborted?o(null):E&&E instanceof s.aN&&E.status!==404?o(E):(C&&C.resourceTiming&&(t.resourceTiming=C.resourceTiming),this.map._refreshExpiredTiles&&C&&t.setExpiryData(C),t.loadVectorData(C,this.map.painter),s.aO(this.dispatcher),o(null,C),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(t,o){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Ao extends s.E{constructor(t,o,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},o),Object.assign(this,s.aH(o,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const o=this.map.getWorldview();this._tileJSONRequest=Ls(this._options,this.map._requestManager,null,o,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new s.y(c)):d&&(Object.assign(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map(p=>p.id)),this.tileBounds=Bn.fromTileJSON(d),Ui(d.tiles),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,o){const c=s.o.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=s.n(this.map._requestManager.transformRequest(d,s.R.Tile),(p,m,y)=>{if(delete t.request,t.aborted)return t.state="unloaded",o(null);if(p)return t.state="errored",o(p);if(!m)return o(null);const x=s.aM(y);this.map._refreshExpiredTiles&&t.setExpiryData(x),t.setTexture(m,this.map.painter),t.state="loaded",s.aO(this.dispatcher),o(null)})}abortTile(t,o){t.request&&(t.request.cancel(),delete t.request),o&&o()}unloadTile(t,o){t.texture&&t.texture instanceof s.T?(t.destroy(!1),t.texture&&t.texture instanceof s.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),o&&o()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Nn([l,t],o,c,{scaled:d=!0}={}){const{tileSize:p,buffer:m}=c,{x:y,y:x,z:T}=o;if(!isFinite(y)||!isFinite(x)||!isFinite(T))throw new Error("Invalid MRT header");const E=2**T,C=E*s.aF(l),M=E*s.aJ(t);return(function([P,F],z,{scaled:B=!0}={}){if(!z)throw new Error("bandView is undefined");const{data:j,tileSize:Z,buffer:H,offset:$,scale:le,dimension:ne}=z;if(P<-H||P>Z+H||F<-H||F>Z+H)throw new Error(`Point (${P}, ${F}) out of bounds for tileSize=${Z}, buffer=${H}`);const se=(F+H)*(Z+2*H)+(P+H);if(new Uint32Array(j.buffer)[se]===4294967295)return null;let ee=[];ee=B?[]:new z.data.constructor(ne);for(let J=0;J<ne;J++)ee[J]=Math.round(1e12*(j[ne*se+J]*le+$))/1e12;return ee})([Math.min(Math.max(-m,Math.floor((C-y)*p)),p-1+m),Math.min(Math.max(-m,Math.floor((M-x)*p)),p-1+m)],c,{scaled:d})}class fn extends Ao{constructor(t,o,c,d){super(t,o,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},o)}triggerRepaint(t){const o=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);o&&o.enabled&&c&&o._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,o){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,s.R.Tile),p={request:d,uid:t.uid,tileID:t.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const m=(y,x,T)=>{if(delete t.request,t.aborted)return t.state="unloaded",o(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",o(y));if(this.map._refreshExpiredTiles&&x){const E=s.aM(T);t.setExpiryData(E)}if(this.partial&&t.state!=="expired")t.state="empty";else if(!this.partial){if(!x)return o(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=x}o(null)};t.request=this.partial?t.fetchHeader(void 0,m.bind(this)):t.actor.send("loadTile",p,m.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,o){const c=t.texturePerLayer;if(t.flushAllQueues(),c.size){t.destroy(!1);for(const d of c.values())this.map.painter.saveTileTexture(d)}else t.destroy()}prepareTile(t,o,c,d){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBandForRender(o,c,d,(p,m)=>{if(p)return t.state="errored",this.fire(new s.y(p)),void this.triggerRepaint(t);m&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(c,m,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const o=this.rasterLayers.find(({id:p})=>p===t),c=o&&o.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,o,c){if(!t)return;const d=o.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let p=null;o instanceof s.aR?p=o.paint.get("raster-array-band"):o instanceof s.aS&&(p=o.paint.get("raster-particle-array-band"));const m=p||this.getInitialBand(d);if(m==null)return;if(!t.textureDescriptorPerLayer.get(o.id))return void this.prepareTile(t,d,o.id,m);if(t.updateNeeded(o.id,m)&&!c)return;const y=t.textureDescriptorPerLayer.get(o.id);return Object.assign({},y,{texture:t.texturePerLayer.get(o.id)})}getImages(t,o){const c=new Map;for(const d of t)for(const p of o){const[m,y]=p.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(y)||!x.hasDataForBand(y))continue;const{bytes:T,tileSize:E,buffer:C}=x.getBandView(y),M=E+2*C,P={data:new s.q({width:M,height:M},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(p,P)}return c}queryRasterArrayValueByBandId(t,o,c){const d=o._mrt;return new Promise(p=>{const m={},y=new Set;for(const[x,T]of Object.entries(d.layers)){if(c.layerName&&x!==c.layerName)continue;const E={};m[x]=E;for(const{bands:C}of T.dataIndex)for(const M of C)c.bands&&!c.bands.includes(M)||(y.add(s.B(x,M)),o.fetchBand(x,null,M,P=>{s.o.frame(()=>{E[M]=P?null:Nn([t.lng,t.lat],d,T.getBandView(M)),y.delete(s.B(x,M)),y.size===0&&p(m)})},!1))}y.size===0&&p(m)})}_loadTileForQuery(t,o){if(this._loadTileLoaded[t.uid])return void o(null,t._mrt);if(this._loadTilePending[t.uid])return void this._loadTilePending[t.uid].push(o);this._loadTilePending[t.uid]=[o];const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,s.R.Tile);t.actor.send("loadTile",{request:d,uid:t.uid,tileID:t.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:!1},(p,m,y)=>{if(p)return this._loadTilePending[t.uid].forEach(x=>x(p,null)),void delete this._loadTilePending[t.uid];if(!m)return this._loadTilePending[t.uid].forEach(x=>x(null,null)),void delete this._loadTilePending[t.uid];if(this.map._refreshExpiredTiles&&m){const x=s.aM(y);t.setExpiryData(x)}t._mrt=m,t._isHeaderLoaded=!0,t.state="loaded",this._loadTilePending[t.uid].forEach(x=>x(null,m)),this._loadTileLoaded[t.uid]=!0,delete this._loadTilePending[t.uid]},void 0,!0)}queryRasterArrayValueByAllBands(t,o,c){return new Promise((d,p)=>{this._loadTileForQuery(o,(m,y)=>{m?p(m):d(y?this.queryRasterArrayValueByBandId(t,o,c):null)})})}queryRasterArrayValue(t,o){const c=s.aT.convert(t),d=this.findLoadedParent(c);return d&&d._mrt?o.bands||!this.partial?this.queryRasterArrayValueByBandId(c,d,o):this.queryRasterArrayValueByAllBands(c,d,o):Promise.resolve(null)}findLoadedParent(t){const o=s.ae.fromLngLat(t,this.map.transform.tileSize),c=this.maxzoom+1,d=1<<c,p=Math.floor(o.x),m=Math.floor((o.x-p)*d),y=Math.floor(o.y*d),x=this.map.style.getSourceCache(this.id),T=new s.aQ(c,p,c,m,y);return x.findLoadedParent(T,this.minzoom)}}const ss={vector:yo,raster:Ao,"raster-dem":class extends Ao{constructor(l,t,o,c){super(l,t,o,c),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const o=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,p){d&&(l.state="errored",t(d)),p&&(l.dem=p,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=s.n(this.map._requestManager.transformRequest(o,s.R.Tile),function(d,p,m){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(p){const y=s.aM(m);this.map._refreshExpiredTiles&&l.setExpiryData(y);const x=ImageBitmap&&p instanceof ImageBitmap&&s.r(),T=1-(p.width-s.aP(p.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const E=x?p:s.o.getImageData(p,T),C={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
8ype,scope:this.scope,rawImageData:E,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",C,c.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(l){const t=l.canonical,o=Math.pow(2,t.z),c=(t.x-1+o)%o,d=t.x===0?l.wrap-1:l.wrap,p=(t.x+1+o)%o,m=t.x+1===o?l.wrap+1:l.wrap,y={};return y[new s.aQ(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,m,t.z,p,t.y).key]={backfilled:!1},t.y>0&&(y[new s.aQ(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,m,t.z,p,t.y-1).key]={backfilled:!1}),t.y+1<o&&(y[new s.aQ(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,m,t.z,p,t.y+1).key]={backfilled:!1}),y}},"raster-array":fn,geojson:class extends s.E{constructor(l,t,o,c){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(c),this._data=t.data,this._options=Object.assign({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=s.al/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:s.al,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:s.al,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new s.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new s.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const o of this._data.features)t.set(o.id,o);for(const o of l.features)t.set(o.id,o);this._data.features=[...t.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterLeaves(l,t,o,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:o},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new s.z("dataloading",{dataType:"source"})),this._loaded=!1;const t=Object.assign({append:l},this.workerOptions);t.scope=this.scope;const o=this._data;typeof o=="string"?(t.request=this.map._requestManager.transformRequest(s.o.resolveURL(o),s.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(o),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new s.y(c));else{const p={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(p.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new s.z("data",p)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=s.B(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const o=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}
8:null,p=this._partialReload,m={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:s.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:p,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};l.request=this.actor.send(o,m,(y,x)=>p&&!x?(l.state="loaded",t(null)):(delete l.request,l.destroy(!1),l.aborted?t(null):y?t(y):(l.loadVectorData(x,this.map.painter,o==="reloadTile"),t(null))),void 0,o==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,t){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
8,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.aU{constructor(l,t,o,c){super(l,t,o,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,s.R.Source).url);s.aV(this.urls,(t,o)=>{this._loaded=!0,t?this.fire(new s.y(t)):o&&(this.video=o,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new s.y(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.aU,model:s.aX,"batched-model":class extends s.E{constructor(l,t,o,c){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=o,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,o=this.map.getWorldview();this._tileJSONRequest=Ls(this._options,this.map._requestManager,t,o,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),o&&o.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new s.y(c))):d&&(Object.assign(this,d),d.bounds&&(this.tileBounds=new Bn(d.bounds,this.minzoom,this.maxzoom)),Ui(d.tiles,this.map._requestManager._customAccessToken),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const o=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(o,s.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:s.o.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const p=Object.values(l.buckets);for(const m of p)m.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",c,d.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(p,m){return l.aborted?t(null):p&&p.status!==404?t(p):(this.map._refreshExpiredTiles&&m&&l.setExpiryData(m),l.loadModelData(m,this.map.painter),l.state="loaded",void t(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends s.aU{constructor(l,t,o,c){super(l,t,o,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(p=>typeof p!="number"))||this.fire(new s.y(new s.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.y(new s.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new s.y(new s.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new s.y(new s.V(`sources.${l}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new s.y(new s.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.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 s.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof s.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends s.E{constructor(l,t,o,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=o,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Bn(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,s.aH(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:o,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:o,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:o,y:c,z:d}=l.tileID.canonical,p=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:o,y:c,z:d},{signal:p.signal})).then(function(m){return delete l.request,l.aborted?(l.state="unloaded",t(null)):m===void 0?(l.state="errored",t(null)):m===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null)):(function(y){return y instanceof ImageData||y instanceof HTMLCanvasElement||y instanceof ImageBitmap||y instanceof HTMLImageElement})(m)?(this.loadTileData(l,m),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch(m=>{m.name!=="AbortError"&&(l.state="errored",t(m))}),l.request.cancel=()=>p.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof s.T?(l.destroy(!1),l.texture&&l.texture instanceof s.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:o,y:c,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:o,y:c,z:d})}t&&t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}
vendor: 18,667 bytes, line 8
8).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=s.B(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}}},ha=function(l,t,o,c){const d=new ss[t.type](l,t,o,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return s.aY(["load","abort","unload","serialize","prepare"],d),d};function Jn(l,t,o=""){return`${o}:${t.id||""}:${t.layer.id}:${(function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:p}=c;return`featureset:${d}${p?`:import:${p}`:""}`}})(l.target)}`}function zl(l,t,o,c=""){if(l.uniqueFeatureID){const d=Jn(l,t,c);if(o.has(d))return!0;o.add(d)}return!1}function Ol(l,t,o,c,d=!1,p=void 0){const m=t.sourceCache.transform,y=t.sourceCache.tilesIn(l,t.has3DLayers,d);y.sort(ah);const x=[];for(const T of y){const E=T.tile.queryRenderedFeatures(t,T,o,c,m,d,p);Object.keys(E).length&&x.push({wrappedTileID:T.tile.tileID.wrapped().key,queryResults:E})}for(const T in t.layers){const E=t.layers[T];if(E.styleLayer){const C=E.styleLayer.queryRenderedFeatures(l,t.sourceCache,c);Object.keys(C).length&&x.push({wrappedTileID:0,queryResults:C})}}return x.length===0?{}:(function(T){const E={},C={};for(const M of T){const P=M.queryResults,F=M.wrappedTileID,z=C[F]=C[F]||{};for(const B in P){const j=P[B],Z=z[B]=z[B]||{},H=E[B]=E[B]||[];for(const $ of j)Z[$.featureIndex]||(Z[$.featureIndex]=!0,H.push($))}}return E})(x)}function Sf(l,t,o,c,d,p){const m={},y=c.queryRenderedSymbols(l),x=[];for(const T of Object.keys(y).map(Number))x.push(d[T]);x.sort(ah);for(const T of x){const E=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,t,o,p);for(const C in E){const M=m[C]=m[C]||[],P=E[C];P.sort((F,z)=>{const B=T.featureSortOrder;if(B){const j=B.indexOf(F.featureIndex);return B.indexOf(z.featureIndex)-j}return z.featureIndex-F.featureIndex});for(const F of P)M.push(F)}}return m}function If(l,t){const o=l.getRenderableIds().map(p=>l.getTileByID(p)),c=[],d={};for(let p=0;p<o.length;p++){const m=o[p],y=m.tileID.canonical.key;d[y]||(d[y]=!0,m.querySourceFeatures(c,t))}return c}function ah(l,t){const o=l.tileID,c=t.tileID;return o.overscaledZ-c.overscaledZ||o.canonical.y-c.canonical.y||o.wrap-c.wrap||o.canonical.x-c.canonical.x}function lh(l,t){const o={};if(!t)return o;for(const c of l){const d=c.layerIds.map(p=>t.getLayer(p)).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map(p=>d.filter(m=>m.id===p)[0]));for(const p of d)o[p.fqid]=c}}return o}const jr=32,Qn=33,as=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,o=0,c=0,d=0,p=0,m=0,y=0;for(1&t?d=p=m=jr:o=c=y=jr;(t>>=1)>1;){const T=o+d>>1,E=c+p>>1;1&t?(d=o,p=c,o=m,c=y):(o=d,c=p,d=m,p=y),m=T,y=E}const x=4*l;as[x+0]=o,as[x+1]=c,as[x+2]=d,as[x+3]=p}const eo=new Uint16Array(2178),Oo=new Uint8Array(1089),Ua=new Uint16Array(1089);function ja(l){return l===0?-.03125:l===32?.03125:0}const da={type:2,extent:s.al,loadGeometry:()=>[[new s.P(0,0),new s.P(s.al+1,0),new s.P(s.al+1,s.al+1),new s.P(0,s.al+1),new s.P(0,0)]]};class Ds{constructor(t,o,c,d,p,m){this.tileID=t,this.uid=s.b2(),this.uses=0,this.tileSize=o,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=p,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection),this.worldview=m,this._hasAppearances=null}registerFadeDuration(t){const o=t+this.timeAdded;o<s.o.now()||this.fadeEndTime&&o<this.fadeEndTime||(this.fadeEndTime=o)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=s.aZ(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,o,c){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=lh(t.buckets,o.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b4){if(this.hasSymbolBuckets=!0,!c)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b4&&p.hasRTLText){this.hasRTLText=!0,s.b5();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],m=o.style.getOwnLayer(d);if(!m)continue;const y=m.queryRadius(p);this.queryPadding=Math.max(this.queryPadding,y)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new s.b3}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,o,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,lh(t.buckets,o.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t,o){for(const p in this.buckets){const m=this.buckets[p];if(m.uploadPending()){let y={},x=[],T={zoom:0,pitch:0,brightness:0,worldview:""};if(o){if(o.style){x=o.style.listImages();const E=m.layers[0],C=E.sourceLayer||"_geojsonTileLayer",M=o.style.getLayerSourceCache(E);M&&(y=M._state.getState(C,void 0))}T={zoom:o.transform.zoom||0,pitch:o.transform.pitch||0,brightness:o.style.getBrightness()||0,worldview:o.worldview||""}}m.upload(t,this.tileID.canonical,y,x,T)}}const c=t.gl,d=this.imageAtlas;d&&!d.uploaded&&(this.imageAtlasTexture=new s.T(t,d.image,c.RGBA8,{useMipmap:!!d.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new s.T(t,this.glyphAtlasImage,c.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new s.T(t,this.lineAtlas.image,c.R8),this.lineAtlas.uploaded=!0)}prepare(t,o,c){if(this.imageAtlas&&this.imageAtlasTexture&&o){const p=o.style.getLut(c);this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c,p)}if(!o||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=o.style.getBrightness();this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(o)),(this._lastUpdatedBrightness||d||this._hasAppearances)&&(!this._hasAppearances&&this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(o,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}evaluateQueryRenderedFeaturePadding(){let t=0;for(const o in this.buckets){const c=this.buckets[o];c.evaluateQueryRenderedFeaturePadding&&(t=Math.max(t,c.evaluateQueryRenderedFeaturePadding()))}return t}queryRenderedFeatures(t,o,c,d,p,m,y){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const x=this.evaluateQueryRenderedFeaturePadding(),T=(function(E,C){const M=s.bq([],[.5*E.width,.5*-E.height,1]);return s.br(M,M,[1,-1,0]),s.aB(M,M,E.calculateProjMatrix(C.toUnwrapped())),Float32Array.from(M)})(p,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:o,pixelPosMatrix:T,transform:d,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:x,scope:y})}querySourceFeatures(t,o){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),p=o?o.sourceLayer:"",m=d._geojsonTileLayer||d[p];if(!m)return;const y=s.b6(o&&o.filter),{z:x,x:T,y:E}=this.tileID.canonical,C={z:x,x:T,y:E};for(let M=0;M<m.length;M++){const P=m.feature(M);if(y.needGeometry){const B=s.b7(P,!0);if(!y.filter(new s.ac(this.tileID.overscaledZ,{worldview:this.worldview}),B,this.tileID.canonical))continue}else if(!y.filter(new s.ac(this.tileID.overscaledZ,{worldview:this.worldview}),P))continue;const F=c.getId(P,p),z=new s.b8(P,x,T,E,F);z.tile=C,t.push(z)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const o=this.expirationTime;if(t.cacheControl){const c=s.b9(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(o)if(this.expirationTime<o)d=!0;else{const p=this.expirationTime-o;p?this.expirationTime=c+Math.max(p,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}hasAppearances(t){for(const o in this.buckets)if(t.style.hasLayer(o)&&this.buckets[o].layers.some(c=>c.appearances&&c.appearances.length>0))return!0;return!1}updateBuckets(t,o){if(!this.latestFeatureIndex||!t.style)return;const c=t.style.listImages(),d=t.style.getBrightness();for(const p in this.buckets){if(!t.style.hasLayer(p))continue;const m=this.buckets[p],y=m.layers[0],x=y.sourceLayer||"_geojsonTileLayer",T=t.style.getLayerSourceCache(y);let E={};T&&(E=T._state.getState(x,void 0));const C=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},M=Object.keys(E).length>0&&!o;m.hasAppearances=m.layers.some(z=>z.appearances&&z.appearances.length>0);const P=M?m.stateDependentLayers:m.layers;if(M&&m.stateDependentLayers.length!==0||o){const z=this.latestFeatureIndex.loadVTLayers();m.update(E,z[x],c,C,P,o,d)}if(M&&m.stateDependentLayers.length!==0||o||m.hasAppearances){const z={zoom:t.transform.zoom,pitch:t.transform.pitch,brightness:t.style.getBrightness()||0,worldview:t.worldview};m.updateAppearances(this.tileID.canonical,E,c,z,t.imageManager)}(m instanceof s.ba||m instanceof s.bb)&&t._terrain&&t._terrain.enabled&&T&&m.uploadPending()&&t._terrain._clearRenderCacheForTile(T.id,this.tileID);const F=t&&t.style&&t.style.getOwnLayer(p);F&&(this.queryPadding=Math.max(this.queryPadding,F.queryRadius(m)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<s.o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=s.o.now()+t}setTexture(t,o){const c=o.context,d=c.gl;this.texture=this.texture||o.getTileTexture(t.width),this.texture&&this.texture instanceof s.T?this.texture.update(t):(this.texture=new s.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}setDependencies(t,o){const c={};for(const d of o)c[d]=!0;this.dependencies[t]=c}hasDependency(t,o){for(const c of t){const d=this.dependencies[c];if(d){for(const p of o)if(d[p])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,o){if(!o||o.name==="mercator"||this._tileDebugBuffer)return;const c=s.bc(da,this.tileID.canonical,this.tileTransform)[0],d=new s.bd,p=new s.be;for(let m=0;m<c.length;m++){const{x:y,y:x}=c[m];d.emplaceBack(y,x),p.emplaceBack(m)}p.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(p),this._tileDebugBuffer=t.createVertexBuffer(d,s.bf.members),this._tileDebugSegments=s.bg.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(t,o){if(this._tileBoundsBuffer||!o||o.name==="mercator")return;const c=s.bc(da,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const m=(function(y,x){const T=s.aZ(y,x),E=Math.pow(2,y.z);for(let B=0;B<Qn;B++)for(let j=0;j<Qn;j++){const Z=s.a_((y.x+(j+ja(j))/jr)/E),H=s.a$((y.y+(B+ja(B))/jr)/E),$=x.project(Z,H),le=B*Qn+j;eo[2*le+0]=Math.round(($.x*T.scale-T.x)*s.al),eo[2*le+1]=Math.round(($.y*T.scale-T.y)*s.al)}Oo.fill(0),Ua.fill(0);for(let B=2045;B>=0;B--){const j=4*B,Z=as[j+0],H=as[j+1],$=as[j+2],le=as[j+3],ne=Z+$>>1,se=H+le>>1,ee=ne+se-H,J=se+Z-ne,ue=H*Qn+Z,_e=le*Qn+$,xe=se*Qn+ne,Ae=Math.hypot((eo[2*ue+0]+eo[2*_e+0])/2-eo[2*xe+0],(eo[2*ue+1]+eo[2*_e+1])/2-eo[2*xe+1])>=16;Oo[xe]=Oo[xe]||(Ae?1:0),B<1022&&(Oo[xe]=Oo[xe]||Oo[(H+J>>1)*Qn+(Z+ee>>1)]||Oo[(le+J>>1)*Qn+($+ee>>1)])}const C=new s.b1,M=new s.b0;let P=0;function F(B,j){const Z=j*Qn+B;return Ua[Z]===0&&(C.emplaceBack(eo[2*Z+0],eo[2*Z+1],B*s.al/jr,j*s.al/jr),Ua[Z]=++P),Ua[Z]-1}function z(B,j,Z,H,$,le){const ne=B+Z>>1,se=j+H>>1;if(Math.abs(B-$)+Math.abs(j-le)>1&&Oo[se*Qn+ne])z($,le,B,j,ne,se),z(Z,H,$,le,ne,se);else{const ee=F(B,j),J=F(Z,H),ue=F($,le);M.emplaceBack(ee,J,ue)}}return z(0,0,jr,jr,jr,0),z(jr,jr,0,0,0,jr),{vertices:C,indices:M}})(this.tileID.canonical,o);d=m.vertices,p=m.indices}else{d=new s.b1,p=new s.b0;for(const{x:y,y:x}of c)d.emplaceBack(y,x,0,0);const m=s.bh(d.int16.subarray(0,4*d.length),void 0,4);for(let y=0;y<m.length;y+=3)p.emplaceBack(m[y],m[y+1],m[y+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,s.bi.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(p),this._tileBoundsSegments=s.bg.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugBuffers(t,o){const c=o.projection;if(!c||c.name!=="globe"||o.freezeTileCoverage)return;const d=this.tileID.canonical,p=s.bj(d,o),m=s.bk(p),y=s.aj(o.zoom);let x;y>0&&(x=s.bl(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,o,m,x,y),this._makeGlobeTileDebugTextBuffer(t,d,o,m,x,y)}_globePoint(t,o,c,d,p,m,y){let x=s.bm(t,o,c);if(m){const T=1<<c.z,E=s.aF(d.center.lng),C=s.aJ(d.center.lat),M=(c.x+.5)/T-E;let P=0;M>.5?P=-1:M<-.5&&(P=1);let F=(t/s.al+c.x)/T+P,z=(o/s.al+c.y)/T;F=(F-E)*d._pixelsPerMercatorPixel+E,z=(z-C)*d._pixelsPerMercatorPixel+C;const B=[F*d.worldSize,z*d.worldSize,0];s.af(B,B,m),x=s.bn(x,B,y)}return s.af(x,x,p)}_makeGlobeTileDebugBorderBuffer(t,o,c,d,p,m){const y=new s.bd,x=new s.be,T=new s.bo,E=(M,P,F,z,B)=>{const j=(F-M)/(B-1),Z=(z-P)/(B-1),H=y.length;for(let $=0;$<B;$++){const le=M+$*j,ne=P+$*Z;y.emplaceBack(le,ne);const se=this._globePoint(le,ne,o,c,d,p,m);T.emplaceBack(se[0],se[1],se[2]),x.emplaceBack(H+$)}},C=s.al;E(0,0,C,0,16),E(C,0,C,C,16),E(C,C,0,C,16),E(0,C,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(x),this._tileDebugBuffer=t.createVertexBuffer(y,s.bf.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(T,s.bp.members),this._tileDebugSegments=s.bg.simpleSegment(0,0,y.length,x.length)}_makeGlobeTileDebugTextBuffer(t,o,c,d,p,m){const y=s.al/4,x=new s.bd,T=new s.b0,E=new s.bo,C=25;T.reserve(32),x.reserve(C),E.reserve(C);const M=(P,F)=>C*P+F;for(let P=0;P<C;P++){const F=P*y;for(let z=0;z<C;z++){const B=z*y;x.emplaceBack(B,F);const j=this._globePoint(B,F,o,c,d,p,m);E.emplaceBack(j[0],j[1],j[2])}}for(let P=0;P<4;P++)for(let F=0;F<4;F++){const z=M(P,F),B=M(P,F+1),j=M(P+1,F),Z=M(P+1,F+1);T.emplaceBack(z,B,j),T.emplaceBack(j,B,Z)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(T),this._tileDebugTextBuffer=t.createVertexBuffer(x,s.bf.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(E,s.bp.members),this._tileDebugTextSegments=s.bg.simpleSegment(0,0,C,32)}destroy(t=!0){for(const o in this.buckets)this.buckets[o].destroy(t);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),t&&this.texture&&this.texture instanceof s.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof s.T&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}s.bs.setPbf(s.bt);class Oc extends Ds{constructor(t,o,c,d,p){super(t,o,c,d,p),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
8getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,o,c){const d=c.context,p=d.gl;let m=this.texturePerLayer.get(t)||c.getTileTexture(o.width);m&&m instanceof s.T?m.update(o,{premultiply:!1}):m=new s.T(d,o,p.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,m)}flushQueues(t){const o=this._workQueuePerLayer.get(t)||[],c=this._fetchQueuePerLayer.get(t)||[];for(;o.length;)o.pop()();for(;c.length;)c.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const o=this._workQueuePerLayer.get(t)||[];for(;o.length;)o.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const o=this._fetchQueuePerLayer.get(t)||[];for(;o.length;)o.pop()()}}fetchHeader(t=16384,o){const c=this._mrt=new s.bs(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=s.bu(d,(p,m,y)=>{if(p)o(p);else try{const x=c.getHeaderLength(m);if(x>t)return void(this.request=this.fetchHeader(x,o));c.parseHeader(m),this._isHeaderLoaded=!0;let T=0;for(const E of Object.values(c.layers))T=Math.max(T,E.dataIndex[E.dataIndex.length-1].lastByte);m.byteLength>=T&&(this.entireBuffer=m),o(null,this.entireBuffer||m,y)}catch(x){o(x)}}),this.request}fetchBandForRender(t,o,c,d){this.fetchBand(t,o,c,p=>{if(p)return void d(p);this.updateTextureDescriptor(t,o,c);const m=this.textureDescriptorPerLayer.get(o);d(null,m?m.img:null)})}fetchBand(t,o,c,d,p=!0){const m=this._mrt;if(!this._isHeaderLoaded||!m)return void d(new Error("Tile header is not ready"));const y=this.actor;if(!y)return void d(new Error("Can't fetch tile band without an actor"));let x;const T=s.B(String(c),s.B(this.tileID.key,t));let E=this._taskQueue.get(T);E?E.add(d):(E=new Set,E.add(d),this._taskQueue.set(T,E));const C=(z,B)=>{x.complete(z,B),z?d(z):(E.forEach(j=>j(null,B)),this._taskQueue.delete(T))},M=(z,B)=>{if(z)return d(z);const j=y.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:B,task:x},C,void 0,!0);if(o!==null){const Z=this._workQueuePerLayer.get(o)||[];Z.push(()=>{j&&j.cancel(),x.cancel()}),this._workQueuePerLayer.has(o)||this._workQueuePerLayer.set(o,Z)}};let P;try{P=m.getLayer(t)}catch(z){if(this.state==="reloading")return;throw z}if(!P)return void d(new Error(`Unknown sourceLayer "${t}"`));if(P.hasDataForBand(c))return E.forEach(z=>z(null,null)),void this._taskQueue.delete(T);const F=P.getDataRange([c]);if(x=m.createDecodingTask(F),!x||x.tasks.length)if(o!==null&&this.flushQueues(o),this.entireBuffer)M(null,this.entireBuffer.slice(F.firstByte,F.lastByte+1));else{const z=Object.assign({},this.requestParams,{headers:{Range:`bytes=${F.firstByte}-${F.lastByte}`}}),B=s.bu(z,M);if(o!==null){const j=this._fetchQueuePerLayer.get(o)||[];j.push(()=>{B.cancel(),x.cancel()}),this._fetchQueuePerLayer.has(o)||this._fetchQueuePerLayer.set(o,j)}}}updateNeeded(t,o){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==o||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(t,o,c){if(!this._mrt)return;const d=this._mrt.getLayer(t);if(!d||!d.hasBand(c)||!d.hasDataForBand(c))return;const{bytes:p,tileSize:m,buffer:y,offset:x,scale:T}=d.getBandView(c),E=m+2*y,C=new s.q({width:E,height:E},p),M=this.texturePerLayer.get(o);M&&M instanceof s.T&&M.update(C,{premultiply:!1}),this.textureDescriptorPerLayer.set(o,{layer:t,band:c,img:C,buffer:y,offset:x,tileSize:m,format:d.pixelFormat,mix:[T,256*T,65536*T,16777216*T]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const o of this.texturePerLayer.values())o&&o instanceof s.T&&o.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class Af{constructor(t,o){this.max=t,this.onRemove=o,this.reset()}reset(){for(const t in this.data)for(const o of this.data[t])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(t,o,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const p={value:o,timeout:void 0};if(c!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},c)),this.data[d].push(p),this.order.push(d),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const o=this.data[t].shift();return o.timeout&&clearTimeout(o.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),o.value}getByKey(t){const o=this.data[t];return o?o[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,o){if(!this.has(t))return this;const c=t.wrapped().key,d=o===void 0?0:this.data[c].indexOf(o),p=this.data[c][d];return this.data[c].splice(d,1),p.timeout&&clearTimeout(p.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(p.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(t){const o=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||o.push(d);for(const c of o)this.remove(c.value.tileID,c)}}class Mf{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,o,c){const d=String(o);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},Object.assign(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==d&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const p in this.state[t][d])c[p]||(this.deletedStates[t][d][p]=null)}else for(const p in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][p]===null&&delete this.deletedStates[t][d][p]}removeFeatureState(t,o,c){if(this.deletedStates[t]===null)return;const d=String(o);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&o!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(o!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(c in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][c]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,o){const c=this.state[t]||{},d=this.stateChanges[t]||{},p=this.deletedStates[t];if(p===null)return{};if(o!==void 0){const y=String(o),x=Object.assign({},c[y],d[y]);if(p){const T=p[o];if(T===null)return{};for(const E in T)delete x[E]}return x}const m=Object.assign({},c,d);if(p)for(const y in p)delete m[y];return m}
8initializeTileState(t,o){t.refreshFeatureState(o)}coalesceChanges(t,o){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const p={};for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]={}),Object.assign(this.state[d][m],this.stateChanges[d][m]),p[m]=this.state[d][m];c[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const p={};if(this.deletedStates[d]===null)for(const m in this.state[d])p[m]={},this.state[d][m]={};else for(const m in this.deletedStates[d]){if(this.deletedStates[d][m]===null)this.state[d][m]={};else if(this.state[d][m])for(const y of Object.keys(this.deletedStates[d][m]))delete this.state[d][m][y];p[m]=this.state[d][m]}c[d]=c[d]||{},Object.assign(c[d],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(o)}}class Mn extends s.E{constructor(t,o,c){super(),this.id=t,this._onlySymbols=c,o.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new Af(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Mf,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,o){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,o)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const c=this._tiles[o];c.upload(t,this.map?this.map.painter:void 0),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Fl).map(t=>t.key)}getRenderableIds(t,o){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,o)&&c.push(this._tiles[d]);return t?c.sort((d,p)=>{const m=d.tileID,y=p.tileID,x=new s.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new s.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-y.overscaledZ||T.y-x.y||T.x-x.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(Fl).map(d=>d.key)}hasRenderableParent(t){const o=this.findLoadedParent(t,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(t,o,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(o||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,o){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=o),this._loadTile(c,this._tileLoaded.bind(this,c,t,o)))}_tileLoaded(t,o,c,d,p){if(d){if(t.state="errored",d.status!==404)this._source.fire(new s.y(d,{tile:t}));else{if(this._source.fire(new s.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const y=this.map.painter.terrain;this.update(this.transform,y.getScaledDemTileSize(),!0),y.resetTileLookupCache(this.id
vendor: 13,591 bytes, line 8
8)}else this.update(this.transform)}return}t.timeAdded=s.o.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(o,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null);let m=new Map;p&&p.responseHeaders&&(m=p.responseHeaders),this._source.fire(new s.z("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id,responseHeaders:m}))}_backfillDEM(t){const o=this.getRenderableIds();for(let d=0;d<o.length;d++){const p=o[d];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);c(t,m),c(m,t)}}function c(d,p){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let m=p.tileID.canonical.x-d.tileID.canonical.x;const y=p.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),T=p.tileID.key;m===0&&y===0||Math.abs(y)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,m,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,o,c,d){for(const p in this._tiles){let m=this._tiles[p];if(d[p]||!m.hasData()||m.tileID.overscaledZ<=o||m.tileID.overscaledZ>c)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>o+1;){const T=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[T.key],m&&m.hasData()&&(y=T)}let x=y;for(;x.overscaledZ>o;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[y.key]=y;break}}}findLoadedParent(t,o){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=o?c:null}for(let c=t.overscaledZ-1;c>=o;c--){const d=t.scaledTo(c),p=this._getLoadedTile(d);if(p)return p}}_getLoadedTile(t){const o=this._tiles[t.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,o){o=o||this._source.tileSize;const c=Math.ceil(t.width/o)+1,d=Math.ceil(t.height/o)+1,p=Math.floor(c*d*5),m=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,p):p,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(y)}handleWrapJump(t){const o=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,o){const c={};for(const d in this._tiles){const p=this._tiles[d];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+o),c[p.tileID.key]=p}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,o,c,d,p){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const m=this._source.type==="batched-model";let y,x=this._source.maxzoom;const T=this.map&&this.map.painter?this.map.painter._terrain:null;if(T&&T.sourceCache===this&&T.attenuationRange()){const M=T.attenuationRange()[0],P=Math.floor(M)-Math.log2(T.getDemUpscale());x>P&&(x=P)}if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(M=>new s.aQ(M.canonical.z,M.wrap,M.canonical.z,M.canonical.x,M.canonical.y));else if(this.tileCoverLift!==0){const M=t.clone();M.tileCoverLift=this.tileCoverLift,y=M.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.minzoom<=1&&t.projection.name==="globe"&&(y.push(new s.aQ(1,0,1,0,0)),y.push(new s.aQ(1,0,1,1,0)),y.push(new s.aQ(1,0,1,0,1)),y.push(new s.aQ(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.hasTile){const M=this._source.hasTile.bind(this._source);y=y.filter(P=>M(P))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!kl(this._source.type)){const M=t.coveringZoomLevel({tileSize:o||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),P=Math.min(M,this._source.maxzoom);if(m){const F=t.extendTileCover(y,P);for(const z of F)y.push(z)}else if(p){const F=t.extendTileCoverToNearPlane(y,this.transform.getFrustum(P),P);for(const z of F)y.push(z)}else if(this.castsShadows&&d){const F=t.extendTileCover(y,P,d,16);for(const z of F)this._shadowCasterTiles[z.key]=!0,y.push(z)}}const E=this._updateRetainedTiles(y);if(kl(this._source.type)&&y.length!==0){const M={},P={},F=Object.keys(E);for(const B of F){const j=E[B],Z=this._tiles[B];if(!Z||Z.fadeEndTime&&Z.fadeEndTime<=s.o.now())continue;const H=this.findLoadedParent(j,Math.max(j.overscaledZ-Mn.maxOverzooming,this._source.minzoom));H&&(this._addTile(H.tileID),M[H.tileID.key]=H.tileID),P[B]=j}const z=y[y.length-1].overscaledZ;for(const B in this._tiles){const j=this._tiles[B];if(E[B]||!j.hasData())continue;let Z=j.tileID;for(;Z.overscaledZ>z;){Z=Z.scaledTo(Z.overscaledZ-1);const H=this._tiles[Z.key];if(H&&H.hasData()&&P[Z.key]){E[B]=j.tileID;break}}}for(const B in M)E[B]||(this._coveredTiles[B]=!0,E[B]=M[B])}for(const M in E)this._tiles[M].clearFadeHold();const C=s.bv(this._tiles,E);for(const M of C){const P=this._tiles[M];P.hasSymbolBuckets&&!P.holdingForFade()?P.setHoldDuration(this.map._fadeDuration):P.hasSymbolBuckets&&!P.symbolFadeFinished()||this._removeTile(+M)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const o={};if(t.length===0)return o;const c={},d=t.reduce((T,E)=>Math.min(T,E.overscaledZ),1/0),p=t[0].overscaledZ,m=Math.max(p-Mn.maxOverzooming,this._source.minzoom),y=Math.max(p+Mn.maxUnderzooming,this._source.minzoom),x={};for(const T of t){const E=this._addTile(T);o[T.key]=T,E.hasData()||d<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,d,y,o);for(const T of t){let E=this._tiles[T.key];if(E.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const M=T.children(this._source.maxzoom)[0],P=this.getTile(M);if(P&&P.hasData()){o[M.key]=M;continue}}else{const M=T.children(this._source.maxzoom);if(o[M[0].key]&&o[M[1].key]&&o[M[2].key]&&o[M[3].key])continue}let C=E.wasRequested();for(let M=T.overscaledZ-1;M>=m;--M){const P=T.scaledTo(M);if(c[P.key]||(c[P.key]=!0,E=this.getTile(P),!E&&C&&(E=this._addTile(P)),E&&(o[P.key]=P,C=E.wasRequested(),E.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const o=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}o.push(d.key);const p=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(p),c)break;d=p}for(const p of o)this._loadedParentTiles[p]=c}}_addTile(t){let o=this._tiles[t.key];if(o)return o.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),o;o=this._cache.getAndRemove(t),o&&(this._setTileReloadTimer(t.key,o),o.tileID=t,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,o)));const c=!!o;if(!c){const d=this.map?this.map.painter:null,p=this._source.tileSize*t.overscaleFactor();o=this._source.type==="raster-array"?new Oc(t,p,this.transform.tileZoom,d,this._isRaster):new Ds(t,p,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(o,this._tileLoaded.bind(this,o,t.key,o.state))}return o.uses++,this._tiles[t.key]=o,c||this._source.fire(new s.z("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(t,o){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=o.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const o=this._tiles[t];o&&(o.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),o.uses>0||(o.hasData()&&o.state!=="reloading"||o.state==="empty"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);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(t,o,c){const d=[],p=this.transform;if(!p)return d;const m=p.projection.name==="globe",y=s.aF(p.center.lng);for(const x in this._tiles){const T=this._tiles[x];if(c&&T.clearQueryDebugViz(),T.holdingForFade())continue;let E;if(m){const C=T.tileID.canonical;if(C.z===0){const M=[Math.abs(s.aA(y,...ls(C,-1))-y),Math.abs(s.aA(y,...ls(C,1))-y)];E=[0,2*M.indexOf(Math.min(...M))-1]}else{const M=[Math.abs(s.aA(y,...ls(C,-1))-y),Math.abs(s.aA(y,...ls(C,0))-y),Math.abs(s.aA(y,...ls(C,1))-y)];E=[M.indexOf(Math.min(...M))-1]}}else E=[0];for(const C of E){const M=t.containsTile(T,p,o,C);M&&d.push(M)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,o){const c=this.getRenderableIds(t,o).map(p=>this._tiles[p].tileID),d=this.transform.projection.name==="globe";for(const p of c)p.projMatrix=this.transform.calculateProjMatrix(p.toUnwrapped()),p.expandedProjMatrix=d?this.transform.calculateProjMatrix(p.toUnwrapped(),!1,!0):p.projMatrix;return c}sortCoordinatesByDistance(t){const o=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),p={};for(const m of o){const y=1/(1<<m.canonical.z);p[m.key]=((m.canonical.x+.5)*y+m.wrap-c[0])*d[0]+((m.canonical.y+.5)*y-c[1])*d[1]-c[2]*d[2]}return o.sort((m,y)=>p[m.key]-p[y.key]),o}hasTransition(){if(this._source.hasTransition())return!0;if(kl(this._source.type))for(const t in this._tiles){const o=this._tiles[t];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=s.o.now())return!0}return!1}setFeatureState(t,o,c){this._state.updateState(t=t||"_geojsonTileLayer",o,c)}removeFeatureState(t,o,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",o,c)}getFeatureState(t,o){return this._state.getState(t=t||"_geojsonTileLayer",o)}setDependencies(t,o,c){const d=this._tiles[t];d&&d.setDependencies(o,c)}reloadTilesForDependencies(t,o){for(const c in this._tiles)this._tiles[c].hasDependency(t,o)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,o))}_preloadTiles(t,o){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(t,o))};return void this._source.on("data",x)}const c=new Map,d=Array.isArray(t)?t:[t],p=this.map.painter.terrain,m=this.usedForTerrain&&p?p.getScaledDemTileSize():this._source.tileSize;for(const x of d){const T=x.coveringTiles({tileSize:m,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const E of T)c.set(E.key,E);this.usedForTerrain&&x.updateElevation(!1)}const y=Array.from(c.values());s.bw(y,(x,T)=>{const E=new Ds(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(E,C=>{this._source.type==="raster-dem"&&E.dem&&this._backfillDEM(E),T(C,E)})},o)}}function Fl(l,t){const o=Math.abs(2*l.wrap)-+(l.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||c-o||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function kl(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function ls(l,t){const o=1<<l.z;return[l.x/o+t,(l.x+1)/o+t]}Mn.maxOverzooming=10,Mn.maxUnderzooming=3;class Bl{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,o=!1;for(const c in this.style._mergedLayers){const d=this.style._mergedLayers[c];if(d.type==="fill-extrusion"||d.type==="building")this.layers.push({layer:d,visible:t,visibilityChanged:o});else if(d.type==="model"){const p=this.style.getLayerSource(d);p&&p.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:o})}}}onNewFrame(t){this.layersGotHidden=!1;for(const o of this.layers){const c=o.layer;let d=!1;c.type==="fill-extrusion"?d=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="building"?d=!c.isHidden(t)&&c.paint.get("building-opacity")>0:c.type==="model"&&(d=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&o.visible,o.visible=d}}updateZOffset(t,o){this.currentBuildingBuckets=[];for(const d of this.layers){const p=d.layer,m=this.style.getLayerSourceCache(p);let y=1;p.type==="fill-extrusion"?y=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0:p.type==="building"&&(y=d.visible?p.paint.get("building-vertical-scale"):0);let x=m?m.getTile(o):null;if(!x&&m)for(const T in m._tiles){const E=m._tiles[T];
8if(o.canonical.isChildOf(E.tileID.canonical)){x=E;break}}this.currentBuildingBuckets.push({bucket:x?x.getBucket(p):null,tileID:x?x.tileID:o,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const p=t.symbolInstances.get(d),m=p.zOffset,y=this._getHeightAtTileOffset(o,p.tileAnchorX,p.tileAnchorY);p.zOffset=y!==Number.NEGATIVE_INFINITY?y:m,c||m===p.zOffset||(c=!0),t.hasAnyZOffset||p.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,o,c,d){let p=o,m=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,x=1/(1<<t.canonical.z-y.z);p=(o+t.canonical.x*s.al)*x-y.x*s.al|0,m=(c+t.canonical.y*s.al)*x-y.y*s.al|0}return{tileX:p,tileY:m}}_getHeightAtTileOffset(t,o,c){let d,p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m].layer;if(y.type!=="fill-extrusion"&&y.type!=="building")continue;const{bucket:x,tileID:T,verticalScale:E}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:C,tileY:M}=this._mapCoordToOverlappingTile(t,o,c,T),P=x.getHeightAtTileCoord(C,M);P&&P.height!==void 0&&(P.hidden?d=P.height:p=Math.max(P.height*E,p||0))}if(p!==void 0)return p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:x,tileID:T}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:E,tileY:C}=this._mapCoordToOverlappingTile(t,o,c,T),M=x.getHeightAtTileCoord(E,C);if(M&&!M.hidden)return M.height===void 0&&d!==void 0?Math.min(M.maxHeight,d)*M.verticalScale:M.height?M.height*M.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function u_(l,t){const o={};for(const c in l)c!=="ref"&&(o[c]=l[c]);return s.bx.forEach(c=>{c in t&&(o[c]=t[c])}),o}function ch(l){l=l.slice();const t=Object.create(null);for(let o=0;o<l.length;o++)t[l[o].id]=l[o];for(let o=0;o<l.length;o++)"ref"in l[o]&&(l[o]=u_(l[o],t[l[o].ref]));return l}const di={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function Ga(l,t,o){o.push({command:di.addSource,args:[l,t[l]]})}function Fc(l,t,o){t.push({command:di.removeSource,args:[l]}),o[l]=!0}function Cf(l,t,o,c){Fc(l,o,c),Ga(l,t,o)}function Pf(l,t,o){let c;for(c in l[o])if(l[o].hasOwnProperty(c)&&c!=="data"&&!s.by(l[o][c],t[o][c]))return!1;for(c in t[o])if(t[o].hasOwnProperty(c)&&c!=="data"&&!s.by(l[o][c],t[o][c]))return!1;return!0}function Nl(l,t,o,c,d,p){let m;for(m in t=t||{},l=l||{})l.hasOwnProperty(m)&&(s.by(l[m],t[m])||o.push({command:p,args:[c,m,t[m],d]}));for(m in t)t.hasOwnProperty(m)&&!l.hasOwnProperty(m)&&(s.by(l[m],t[m])||o.push({command:p,args:[c,m,t[m],d]}))}function zs(l){return l.id}function Vl(l,t){return l[t.id]=t,l}function kc(l,t,o){const c=t.createTileMatrix(l,l.worldSize,o.toUnwrapped());return s.aB(new Float32Array(16),l.projMatrix,c)}function h_(l,t,o){if(t.projection.name===o.projection.name)return l.projMatrix;const c=o.clone();return c.setProjection(t.projection),kc(c,t.getProjection(),l)}function qa(l,t,o){return t.name===o.projection.name?l.projMatrix:kc(o,t,l)}class cs{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=s.aA(t,0,1);let o=1,c=this._distances[o];const d=t*this.paddedLength+this.padding;
vendor: 4,286 bytes, line 8
8for(;c<d&&o<this._distances.length;)c=this._distances[++o];const p=o-1,m=this._distances[p],y=c-m,x=y>0?(d-m)/y:0;return this.points[p].mult(1-x).add(this.points[o].mult(x))}}class Ul{constructor(t,o,c){const d=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(o/c);for(let m=0;m<this.xCellCount*this.yCellCount;m++)d.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=o,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,o,c,d,p){this._forEachCell(o,c,d,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(p)}insertCircle(t,o,c,d){this._forEachCell(o-d,c-d,o+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(o),this.circles.push(c),this.circles.push(d)}_insertBoxCell(t,o,c,d,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,o,c,d,p,m){this.circleCells[p].push(m)}_query(t,o,c,d,p,m){if(c<0||t>this.width||d<0||o>this.height)return!p&&[];const y=[];if(t<=0&&o<=0&&this.width<=c&&this.height<=d){if(p)return!0;for(let x=0;x<this.boxKeys.length;x++)y.push({key:this.boxKeys[x],x1:this.bboxes[4*x],y1:this.bboxes[4*x+1],x2:this.bboxes[4*x+2],y2:this.bboxes[4*x+3]});for(let x=0;x<this.circleKeys.length;x++){const T=this.circles[3*x],E=this.circles[3*x+1],C=this.circles[3*x+2];y.push({key:this.circleKeys[x],x1:T-C,y1:E-C,x2:T+C,y2:E+C})}return m?y.filter(m):y}return this._forEachCell(t,o,c,d,this._queryCell,y,{hitTest:p,seenUids:{box:{},circle:{}}},m),p?y.length>0:y}_queryCircle(t,o,c,d,p){const m=t-c,y=t+c,x=o-c,T=o+c;if(y<0||m>this.width||T<0||x>this.height)return!d&&[];const E=[];return this._forEachCell(m,x,y,T,this._queryCellCircle,E,{hitTest:d,circle:{x:t,y:o,radius:c},seenUids:{box:{},circle:{}}},p),d?E.length>0:E}query(t,o,c,d,p){return this._query(t,o,c,d,!1,p)}hitTest(t,o,c,d,p){return this._query(t,o,c,d,!0,p)}hitTestCircle(t,o,c,d){return this._queryCircle(t,o,c,!0,d)}_queryCell(t,o,c,d,p,m,y,x){const T=y.seenUids,E=this.boxCells[p];if(E!==null){const M=this.bboxes;for(const P of E)if(!T.box[P]){T.box[P]=!0;const F=4*P;if(t<=M[F+2]&&o<=M[F+3]&&c>=M[F+0]&&d>=M[F+1]&&(!x||x(this.boxKeys[P]))){if(y.hitTest)return m.push(!0),!0;m.push({key:this.boxKeys[P],x1:M[F],y1:M[F+1],x2:M[F+2],y2:M[F+3]})}}}const C=this.circleCells[p];if(C!==null){const M=this.circles;for(const P of C)if(!T.circle[P]){T.circle[P]=!0;const F=3*P;if(this._circleAndRectCollide(M[F],M[F+1],M[F+2],t,o,c,d)&&(!x||x(this.circleKeys[P]))){if(y.hitTest)return m.push(!0),!0;{const z=M[F],B=M[F+1],j=M[F+2];m.push({key:this.circleKeys[P],x1:z-j,y1:B-j,x2:z+j,y2:B+j})}}}}}_queryCellCircle(t,o,c,d,p,m,y,x){const T=y.circle,E=y.seenUids,C=this.boxCells[p];if(C!==null){const P=this.bboxes;for(const F of C)if(!E.box[F]){E.box[F]=!0;const z=4*F;if(this._circleAndRectCollide(T.x,T.y,T.radius,P[z+0],P[z+1],P[z+2],P[z+3])&&(!x||x(this.boxKeys[F])))return m.push(!0),!0}}const M=this.circleCells[p];if(M!==null){const P=this.circles;for(const F of M)if(!E.circle[F]){E.circle[F]=!0;const z=3*F;if(this._circlesCollide(P[z],P[z+1],P[z+2],T.x,T.y,T.radius)&&(!x||x(this.circleKeys[F])))return m.push(!0),!0}}}_forEachCell(t,o,c,d,p,m,y,x){const T=this._convertToXCellCoord(t),E=this._convertToYCellCoord(o),C=this._convertToXCellCoord(c),M=this._convertToYCellCoord(d);for(let P=T;P<=C;P++)for(let F=E;F<=M;F++)if(p.call(this,t,o,c,d,this.xCellCount*F+P,m,y,x))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,o,c,d,p,m){const y=d-t,x=p-o,T=c+m;return T*T>y*y+x*x}_circleAndRectCollide(t,o,c,d,p,m,y){const x=(m-d)/2,T=Math.abs(t-(d+x));if(T>x+c)return!1;const E=(y-p)/2,C=Math.abs(o-(p+E));if(C>E+c)return!1;if(T<=x||C<=E)return!0;const M=T-x,P=C-E;return M*M+P*P<=c*c}}const Rf=Math.tan(85*Math.PI/180);function fa(l,t,o,c,d,p,m){const y=s.bC();if(o)if(p.name==="globe"){const x=s.bD(d,t);s.aB(y,y,x)}else{const x=s.bE([],m);y[0]=x[0],y[1]=x[1],y[4]=x[2],y[5]=x[3],c||s.bB(y,y,d.angle)}
8else s.aB(y,d.labelPlaneMatrix,l);return y}function us(l,t,o,c,d,p,m){const y=fa(l,t,o,c,d,p,m);return p.name==="globe"&&o||(y[2]=y[6]=y[10]=y[14]=0),y}function Cn(l,t,o,c,d,p,m){if(o){if(p.name==="globe"){const y=fa(l,t,o,c,d,p,m);return s.bl(y,y),s.aB(y,l,y),y}{const y=s.bz(l),x=s.bA([]);return x[0]=m[0],x[1]=m[1],x[4]=m[2],x[5]=m[3],s.aB(y,y,x),c||s.bB(y,y,-d.angle),y}}return d.glCoordMatrix}function xo(l,t,o,c){const d=[l,t,o,1];o?s.aC(d,d,c):Nc(d,d,c);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function Bc(l,t){return Math.min(.5+l/t*.5,1.5)}function Lf(l,t){const o=l[0]/l[3],c=l[1]/l[3];return o>=-t[0]&&o<=t[0]&&c>=-t[1]&&c<=t[1]}function vi(l,t,o,c,d,p,m,y,x,T,E=1){const C=o.transform,M=c?l.textSizeData:l.iconSizeData,P=s.bK(M,o.transform.zoom,E),F=C.projection.name==="globe",z=[256/o.width*2+1,256/o.height*2+1],B=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;B.clear();let j=null;F&&(j=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const Z=l.lineVertexArray,H=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,$=o.transform.width/o.transform.height;let le,ne=!1;for(let se=0;se<H.length;se++){const ee=H.get(se),{numGlyphs:J,writingMode:ue}=ee;if(ue!==s.bL.vertical||ne||le===s.bL.horizontal||(ne=!0),le=ue,(ee.hidden||ue===s.bL.vertical)&&!ne){pn(J,B);continue}ne=!1;const _e=new s.P(ee.tileAnchorX,ee.tileAnchorY),xe=l.elevationType==="road",Ae=!!C.elevation||xe;let{x:Ee,y:Fe,z:$e}=C.projection.projectTilePoint(_e.x,_e.y,T.canonical),Te=null;if(Ae){const bt=xe?l.getElevationFeatureForText(se):null;Te={getElevation:x,elevation:C.elevation,elevationFeature:bt};const[Ct,Ot,Ht]=x(_e,C.elevation,bt);Ee+=Ct,Fe+=Ot,$e+=Ht}const he=[Ee,Fe,$e,1];if(s.aC(he,he,t),!Lf(he,z)){pn(J,B);continue}const ze=he[3],Me=Bc(o.transform.getCameraToCenterDistance(C.projection),ze),We=s.bM(M,P,ee),et=m?We/Me:We*Me,ut=xo(Ee,Fe,$e,d);if(ut[3]<=0){pn(J,B);continue}let tt={};const nt=s.an(l.layers[0].layout.get("text-max-angle")),Et=Math.cos(nt),wt=m?null:Te,pt=zf(ee,et,!1,y,t,d,p,l.glyphOffsetArray,Z,B,j,ut,_e,tt,$,wt,C.projection,T,m,Et);ne=pt.useVertical,wt&&pt.needsFlipping&&(tt={}),(pt.notEnoughRoom||ne||pt.needsFlipping&&zf(ee,et,!0,y,t,d,p,l.glyphOffsetArray,Z,B,j,ut,_e,tt,$,wt,C.projection,T,m,Et).notEnoughRoom)&&pn(J,B)}c?(l.text.dynamicLayoutVertexBuffer.updateData(B),j&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(j)):(l.icon.dynamicLayoutVertexBuffer.updateData(B),j&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(j))}function uh(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B){const{lineStartIndex:j,glyphStartIndex:Z,segment:H}=y,$=Z+y.numGlyphs,le=j+y.lineLength,ne=t.getoffsetX(Z),se=t.getoffsetX($-1),ee=pa(l*ne,o,c,d,p,m,H,j,le,x,T,E,C,M,!0,P,F,z,B);if(!ee)return null;const J=pa(l*se,o,c,d,p,m,H,j,le,x,T,E,C,M,!0,P,F,z,B);return J?{first:ee,last:J}:null}function Df(l,t,o,c){return l===s.bL.horizontal&&Math.abs(c)>Math.abs(o)?{useVertical:!0}:l===s.bL.vertical?c>0?{needsFlipping:!0}:null:t!==0&&(function(d,p){return d===0||Math.abs(p/d)>Rf})(o,c)?t===1?{needsFlipping:!0}:null:o<0?{needsFlipping:!0}:null}function zf(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B,j,Z,H){const $=t/24,le=l.lineOffsetX*$,ne=l.lineOffsetY*$,{lineStartIndex:se,glyphStartIndex:ee,numGlyphs:J,segment:ue,writingMode:_e,flipState:xe}=l,Ae=se+l.lineLength,Ee=Fe=>{if(E){const[ze,Me,We]=Fe.up,et=T.length;s.bN(E,et+0,ze,Me,We),s.bN(E,et+1,ze,Me,We),s.bN(E,et+2,ze,Me,We),s.bN(E,et+3,ze,Me,We)}const[$e,Te,he]=Fe.point;s.bO(T,$e,Te,he,Fe.angle)};if(J>1){const Fe=uh($,y,le,ne,o,C,M,l,x,p,P,z,!1,B,j,Z,H);if(!Fe)return{notEnoughRoom:!0};if(c&&!o){let[$e,Te,he]=Fe.first.point,[ze,Me,We]=Fe.last.point;[$e,Te]=xo($e,Te,he,m),[ze,Me]=xo(ze,Me,We,m);const et=Df(_e,xe,(ze-$e)*F,Me-Te);if(l.flipState=et&&et.needsFlipping?1:2,et)return et}Ee(Fe.first);for(let $e=ee+1;$e<ee+J-1;$e++){const Te=pa($*y.getoffsetX($e),le,ne,o,C,M,ue,se,Ae,x,p,P,z,!1,!1,B,j,Z,H);if(!Te)return T.length-=4*($e-ee),{notEnoughRoom:!0};Ee(Te)}Ee(Fe.last)}else{if(c&&!o){const $e=xo(M.x,M.y,0,d),Te=se+ue+1,he=new s.P(x.getx(Te),x.gety(Te)),ze=xo(he.x,he.y,0,d),Me=ze[3]>0?ze:hh(M,he,$e,1,d,void 0,B,j.canonical),We=Df(_e,xe,(Me[0]-$e[0])*F,Me[1]-$e[1]);if(l.flipState=We&&We.needsFlipping?1:2,We)return We}const Fe=pa($*y.getoffsetX(ee),le,ne,o,C,M,ue,se,Ae,x,p,P,z,!1,!1,B,j,Z,H);if(!Fe)return{notEnoughRoom:!0};Ee(Fe)}return{}}function Dt(l,t,o,c,d){const{x:p,y:m,z:y}=c.projectTilePoint(l.x,l.y,t);if(!d)return xo(p,m,y,o);const[x,T,E]=d.getElevation(l,d.elevation,d.elevationFeature);return xo(p+x,m+T,y+E,o)}
8function hh(l,t,o,c,d,p,m,y){const x=Dt(l.sub(t)._unit()._add(l),y,d,m,p);return s.av(x,o,x),s.aw(x,x),s.bH(x,o,x,c)}function pa(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B,j,Z){const H=c?l-t:l+t;let $=H>0?1:-1,le=0;c&&($*=-1,le=Math.PI),$<0&&(le+=Math.PI);let ne=y+m+($>0?0:1)|0,se=d,ee=d,J=0,ue=0;const _e=Math.abs(H),xe=[],Ae=[];let Ee=p,Fe=Ee,$e=s.bF([]);const Te=()=>hh(Fe,Ee,ee,_e-J+1,E,M,z,B.canonical);for(;J+ue<=_e;){if(ne+=$,ne<y||ne>=x)return null;if(ee=se,Fe=Ee,xe.push(ee),P&&Ae.push(Fe),Ee=new s.P(T.getx(ne),T.gety(ne)),se=C[ne],!se){const wt=Dt(Ee,B.canonical,E,z,M);se=wt[3]>0?C[ne]=wt:Te()}J+=ue;const nt=s.av([],se,ee),Et=s.bG(ee,se);if(o&&Et>0&&ue>0&&s.bJ($e,nt)/(ue*Et)<Z)return null;ue=Et,$e=nt}F&&M&&(C[ne]&&(se=Te(),ue=s.bG(ee,se),$e=s.av([],se,ee)),C[ne]=se);const he=(_e-J)/ue,ze=Ee.sub(Fe)._mult(he)._add(Fe),Me=s.bH([],ee,$e,he);let We=[0,0,1],et=$e[0],ut=$e[1];if(j&&(We=z.upVector(B.canonical,ze.x,ze.y),We[0]!==0||We[1]!==0||We[2]!==1)){const nt=[We[2],0,-We[0]],Et=s.bI([],We,nt);s.aw(nt,nt),s.aw(Et,Et),et=s.bJ($e,nt),ut=s.bJ($e,Et)}if(o){const nt=s.bI([],We,$e);s.aw(nt,nt),s.bH(Me,Me,nt,o*$)}const tt=le+Math.atan2(ut,et);return xe.push(Me),P&&Ae.push(ze),{point:Me,angle:tt,path:xe,tilePath:Ae,up:We}}function pn(l,t){const o=t.length,c=o+4*l;t.resize(c),t.float32.fill(-1/0,4*o,4*c)}function Nc(l,t,o){const c=t[0],d=t[1];return l[0]=o[0]*c+o[4]*d+o[12],l[1]=o[1]*c+o[5]*d+o[13],l[3]=o[3]*c+o[7]*d+o[15],l}const Pn=100;class At{constructor(t,o,c=new Ul(t.width+200,t.height+200,25),d=new Ul(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=d,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Pn,this.screenBottomBoundary=t.height+Pn,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=o}placeCollisionBox(t,o,c,d,p,m,y,x,T,E,C){let M=c.projectedAnchorX,P=c.projectedAnchorY,F=c.projectedAnchorZ;const z=c.tileAnchorX,B=c.tileAnchorY,j=c.elevation,Z=c.tileID,H=t.getProjection();if(j&&Z){const[Ae,Ee,Fe]=H.upVector(Z.canonical,c.tileAnchorX,c.tileAnchorY),$e=H.upVectorScale(Z.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;M+=Ae*j*$e,P+=Ee*j*$e,F+=Fe*j*$e}const $=t.projection.name==="globe",le=t.projection.name==="globe"?s.aj(this.transform.zoom):0;if(Z&&$&&le<1&&!m){const Ae=1<<Z.canonical.z,Ee=s.bP(z,B);s.bQ(Ee,Ee,1/s.al),s.bR(Ee,Ee,s.bP(Z.canonical.x,Z.canonical.y)),s.bQ(Ee,Ee,1/Ae),s.bS(Ee,Ee,s.bP(d[0],d[1])),Ee[0]=s.bT(Ee[0],-.5,.5),s.bQ(Ee,Ee,s.al);
vendor: 9,729 bytes, line 8
8const Fe=s.bU(Ee[0],Ee[1],s.al/(2*Math.PI),1);s.aC(Fe,Fe,p),M=s.ak(M,Fe[0],le),P=s.ak(P,Fe[1],le),F=s.ak(F,Fe[2],le)}const ne=this.projectAndGetPerspectiveRatio(E,M,P,F,c.tileID,H.name==="globe"||!!j||this.transform.pitch>0,H),se=T*ne.perspectiveRatio,ee=(c.x1*o+y.x-c.padding)*se+ne.point.x,J=(c.y1*o+y.y-c.padding)*se+ne.point.y,ue=(c.x2*o+y.x+c.padding)*se+ne.point.x,_e=(c.y2*o+y.y+c.padding)*se+ne.point.y,xe=ne.perspectiveRatio<=.55||ne.occluded;return!this.isInsideGrid(ee,J,ue,_e)||!x&&this.grid.hitTest(ee,J,ue,_e,C)||xe?{box:[],offscreen:!1,occluded:ne.occluded}:{box:[ee,J,ue,_e],offscreen:this.isOffscreen(ee,J,ue,_e),occluded:!1}}placeCollisionCircles(t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B){const j=[],Z=this.transform.elevation,H=t.getProjection(),$=t.elevationType==="road",le=!!Z||$,ne=s.bV.getAtTileOffsetFunc(B,this.transform.center.lat,this.transform.worldSize,H),se=new s.P(c.tileAnchorX,c.tileAnchorY),ee=new s.P(c.tileAnchorX,c.tileAnchorY);let{x:J,y:ue,z:_e}=H.projectTilePoint(ee.x,ee.y,B.canonical),xe=null;if(le){const Et=$?t.getElevationFeatureForText(d):null;xe={getElevation:ne,elevation:Z,elevationFeature:Et};const[wt,pt,bt]=ne(se,Z,Et);J+=wt,ue+=pt,_e+=bt}const Ae=H.name==="globe",Ee=this.projectAndGetPerspectiveRatio(x,J,ue,_e,B,Ae||!!Z||this.transform.pitch>0,H),{perspectiveRatio:Fe}=Ee,$e=(M?y/Fe:y*Fe)/s.bY,Te=xo(J,ue,_e,T),he=c.lineOffsetX*$e,ze=c.lineOffsetY*$e,Me=s.an(t.layers[0].layout.get("text-max-angle")),We=Math.cos(Me),et=Ee.signedDistanceFromCamera>0?uh($e,m,he,ze,$&&c.flipState===1,Te,ee,c,p,T,{},le&&!M?xe:null,M&&le,H,B,M,We):null;let ut=!1,tt=!1,nt=!0;if(et&&!Ee.occluded){const Et=.5*F*Fe+z,wt=new s.P(-100,-100),pt=new s.P(this.screenRightBoundary,this.screenBottomBoundary),bt=new cs,{first:Ct,last:Ot}=et,Ht=Ct.path.length;let ti=[];for(let jt=Ht-1;jt>=1;jt--)ti.push(Ct.path[jt]);for(let jt=1;jt<Ot.path.length;jt++)ti.push(Ot.path[jt]);const Vt=2.5*Et;E&&(ti=ti.map(([jt,Ti,bi],Si)=>(le&&!Ae&&(bi=ne(Si<Ht-1?Ct.tilePath[Ht-1-Si]:Ot.tilePath[Si-Ht+2],Z,xe.elevationFeature)[2]),xo(jt,Ti,bi,E))),ti.some(jt=>jt[3]<=0)&&(ti=[]));let ui=[];if(ti.length>0){let jt=1/0,Ti=-1/0,bi=1/0,Si=-1/0;for(const ii of ti)jt=Math.min(jt,ii[0]),bi=Math.min(bi,ii[1]),Ti=Math.max(Ti,ii[0]),Si=Math.max(Si,ii[1]);Ti>=wt.x&&jt<=pt.x&&Si>=wt.y&&bi<=pt.y&&(ui=[ti.map(ii=>new s.P(ii[0],ii[1]))],(jt<wt.x||Ti>pt.x||bi<wt.y||Si>pt.y)&&(ui=s.bW(ui,wt.x,wt.y,pt.x,pt.y)))}for(const jt of ui){bt.reset(jt,.25*Et);let Ti=0;Ti=bt.length<=.5*Et?1:Math.ceil(bt.paddedLength/Vt)+1;for(let bi=0;bi<Ti;bi++){const Si=bi/Math.max(Ti-1,1),ii=bt.lerp(Si),qt=ii.x+Pn,mi=ii.y+Pn;j.push(qt,mi,Et,0);const Zi=qt-Et,Wi=mi-Et,_i=qt+Et,Qt=mi+Et;if(nt=nt&&this.isOffscreen(Zi,Wi,_i,Qt),tt=tt||this.isInsideGrid(Zi,Wi,_i,Qt),!o&&this.grid.hitTestCircle(qt,mi,Et,P)&&(ut=!0,!C))return{circles:[],offscreen:!1,collisionDetected:ut,occluded:!1}}}}return{circles:!C&&ut||!tt?[]:j,offscreen:nt,collisionDetected:ut,occluded:Ee.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let c=1/0,d=1/0,p=-1/0,m=-1/0;for(const E of t){const C=new s.P(E.x+Pn,E.y+Pn);c=Math.min(c,C.x),d=Math.min(d,C.y),p=Math.max(p,C.x),m=Math.max(m,C.y),o.push(C)}const y=this.grid.query(c,d,p,m).concat(this.ignoredGrid.query(c,d,p,m)),x={},T={};for(const E of y){const C=E.key;if(x[C.bucketInstanceId]===void 0&&(x[C.bucketInstanceId]={}),x[C.bucketInstanceId][C.featureIndex])continue;const M=[new s.P(E.x1,E.y1),new s.P(E.x2,E.y1),new s.P(E.x2,E.y2),new s.P(E.x1,E.y2)];s.bX(o,M)&&(x[C.bucketInstanceId][C.featureIndex]=!0,T[C.bucketInstanceId]===void 0&&(T[C.bucketInstanceId]=[]),T[C.bucketInstanceId].push(C.featureIndex))}return T}insertCollisionBox(t,o,c,d,p){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:p},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,c,d,p){const m=o?this.ignoredGrid:this.grid,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:p};for(let x=0;x<t.length;x+=4)m.insertCircle(y,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,o,c,d,p,m,y){const x=[o,c,d,1];let T=!1;d||this.transform.pitch>0?(s.aC(x,x,t),this.fogState&&p&&y.name!=="globe"&&(T=(function(M,P,F,z,B,j){const Z=j.calculateFogTileMatrix(B),H=[P,F,z];return s.af(H,H,Z),Pt(M,s.ag(H),j.pitch,j._fov)})(this.fogState,o,c,d,p.toUnwrapped(),this.transform)>.9)):Nc(x,x,t);const E=x[3];return{point:new s.P((x[0]/E+1)/2*this.transform.width+Pn,(-x[1]/E+1)/2*this.transform.height+Pn),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/E*.5,1.5),signedDistanceFromCamera:E,occluded:m&&x[2]>E||T}}isOffscreen(t,o,c,d){return c<Pn||t>=this.screenRightBoundary||d<Pn||o>this.screenBottomBoundary}isInsideGrid(t,o,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const t=s.bA([]);return s.br(t,t,[-100,-100,0]),t}}class yi{constructor(t,o,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class fi{constructor(t,o,c,d,p,m=!1){this.text=new yi(t?t.text:null,o,c,p),this.icon=new yi(t?t.icon:null,o,d,p),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class mn{constructor(t,o,c,d=!1){this.text=t,this.icon=o,this.skipFade=c,this.clipped=d}}class $a{constructor(){this.invProjMatrix=s.bC(),this.viewportMatrix=s.bC(),this.circles=[]}}class wi{constructor(t,o,c,d,p){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=p}}class Vc{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:c=>c.collisionGroupID===o}}return this.collisionGroups[t]}}function Ha(l,t,o,c,d){const{horizontalAlign:p,verticalAlign:m}=s.c1(l),y=-(p-.5)*t,x=-(m-.5)*o,T=s.c2(l,c);return new s.P(y+T[0]*d,x+T[1]*d)}function ma(l,t,o,c,d){const p=new s.P(l,t);return o&&p._rotate(c?d:-d),p}class sn{constructor(t,o,c,d,p,m){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new At(this.transform,p),this.buildingIndex=m,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Vc(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(t,o,c,d,p=1){const m=c.getBucket(o),y=c.latestFeatureIndex;if(!m||!y||o.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,T=m.layers[0].paint,E=c.collisionBoxArray,C=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),M=c.tileSize/s.al,P=c.tileID.toUnwrapped();this.transform.setProjection(m.projection);const F=(z=c.tileID,B=m.getProjection(),j=this.transform,B.name===this.projection?j.calculateProjMatrix(z.toUnwrapped()):kc(j,B,z));var z,B,j;const Z=x.get("text-pitch-alignment")==="map",H=x.get("text-rotation-alignment")==="map";o.compileFilter(o.options);const $=o.dynamicFilter(),le=o.dynamicFilterNeedsFeature(),ne=this.transform.calculatePixelsToTileUnitsMatrix(c),se=us(F,c.tileID.canonical,Z,H,this.transform,m.getProjection(),ne);let ee=null;const J=m.getProjection().createInversionMatrix(this.transform,c.tileID.canonical);if(Z){const he=Cn(F,c.tileID.canonical,Z,H,this.transform,m.getProjection(),ne);ee=s.aB([],this.transform.labelPlaneMatrix,he)}let ue=null;$&&c.latestFeatureIndex&&(ue={unwrappedTileID:P,dynamicFilter:$,dynamicFilterNeedsFeature:le}),this.retainedQueryData[m.bucketInstanceId]=new wi(m.bucketInstanceId,y,m.sourceLayerIndex,m.index,c.tileID);const[_e,xe]=m.layers[0].layout.get("text-size-scale-range"),Ae=s.aA(p,_e,xe),[Ee,Fe]=x.get("icon-size-scale-range"),$e=s.aA(p,Ee,Fe),Te={bucket:m,layout:x,paint:T,posMatrix:F,invMatrix:J,mercatorCenter:[s.aF(this.transform.center.lng),s.aJ(this.transform.center.lat)],textLabelPlaneMatrix:se,labelToScreenMatrix:ee,clippingData:ue,scale:C,textPixelRatio:M,holdingForFade:c.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:s.bK(m.textSizeData,this.transform.zoom,Ae),partiallyEvaluatedIconSize:s.bK(m.iconSizeData,this.transform.zoom,$e),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const he of m.sortKeyRanges){const{sortKey:ze,symbolInstanceStart:Me,symbolInstanceEnd:We}=he;t.push({sortKey:ze,symbolInstanceStart:Me,symbolInstanceEnd:We,parameters:Te})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:Te})}attemptAnchorPlacement(t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B,j,Z,H,$,le){const{textOffset0:ne,textOffset1:se,crossTileID:ee}=z,J=[ne,se],ue=Ha(t,m,y,J,x),_e=this.collisionIndex.placeCollisionBox(j,x,o,c,d,p,ma(ue.x,ue.y,T,E,this.transform.angle),F,C,M,P.predicate);if(H){const xe=j.getSymbolInstanceIconSize(le,this.transform.zoom,z.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(j,xe,H,c,d,p,ma(ue.x,ue.y,T,E,this.transform.angle),F,C,M,P.predicate).box.length===0)return}if(_e.box.length>0){let xe;return this.prevPlacement&&this.prevPlacement.variableOffsets[ee]&&this.prevPlacement.placements[ee]&&this.prevPlacement.placements[ee].text&&(xe=this.prevPlacement.variableOffsets[ee].anchor),this.variableOffsets[ee]={textOffset:J,width:m,height:y,anchor:t,textScale:x,prevAnchor:xe},this.markUsedJustification(j,t,z,Z),j.allowVerticalPlacement&&(this.markUsedOrientation(j,Z,z),this.placedOrientations[ee]=Z),{shift:ue,placedGlyphBoxes:_e}}}placeLayerBucketPart(t,o,c,d,p=1){const{bucket:m,layout:y,paint:x,posMatrix:T,textLabelPlaneMatr
8ix:E,labelToScreenMatrix:C,clippingData:M,textPixelRatio:P,mercatorCenter:F,invMatrix:z,holdingForFade:B,collisionBoxArray:j,partiallyEvaluatedTextSize:Z,partiallyEvaluatedIconSize:H,collisionGroup:$,latestFeatureIndex:le}=t.parameters,ne=y.get("text-optional"),se=y.get("icon-optional"),ee=y.get("text-allow-overlap"),J=y.get("icon-allow-overlap"),ue=y.get("text-rotation-alignment")==="map",_e=y.get("icon-rotation-alignment")==="map",xe=y.get("text-pitch-alignment")==="map",Ae=x.get("symbol-z-offset"),Ee=y.get("symbol-elevation-reference")==="sea",Fe=y.get("symbol-placement"),[$e,Te]=y.get("text-size-scale-range"),[he,ze]=y.get("icon-size-scale-range"),Me=s.aA(p,$e,Te),We=s.aA(p,he,ze),et=y.get("text-variable-anchor"),ut=ue&&Fe!=="point",tt=_e&&Fe!=="point",nt=et&&m.hasTextData(),Et=m.hasIconTextFit()&&nt&&m.hasIconData();this.transform.setProjection(m.projection);const wt=nt||ut,pt=tt||Et;let bt=ee&&(J||!m.hasIconData()||se),Ct=J&&(ee||!m.hasTextData()||ne);const Ot=!Ae.isConstant();!m.collisionArrays&&j&&m.deserializeCollisionBoxes(j),c&&d&&m.updateCollisionDebugBuffers(this.transform.zoom,j,Me,We);const Ht=(Vt,ui,jt)=>{const{crossTileID:Ti,numVerticalGlyphVertices:bi}=Vt;let Si=null;if(M&&M.dynamicFilterNeedsFeature||Ot){const Ki=this.retainedQueryData[m.bucketInstanceId];Si=le.loadFeature({featureIndex:Vt.featureIndex,bucketIndex:Ki.bucketIndex,sourceLayerIndex:Ki.sourceLayerIndex,layoutVertexArrayOffset:0});const fr=Si.properties?Si.properties.worldview:null;if(m.localizable&&m.worldview&&typeof fr=="string")if(fr==="all")Si.properties.$localized=!0;else{if(!fr.split(",").includes(m.worldview))return;Si.properties.$localized=!0,Si.properties.worldview=m.worldview}}if(M&&!(0,M.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:m.worldview},Si,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new s.P(Vt.tileAnchorX,Vt.tileAnchorY),this.transform.calculateDistanceTileData(M.unwrappedTileID)))return this.placements[Ti]=new mn(!1,!1,!1,!0),void o.add(Ti);const ii=Ae.evaluate(Si,{});if(o.has(Ti))return;if(B)return void(this.placements[Ti]=new mn(!1,!1,!1));let qt=!1,mi=!1,Zi=!0,Wi=!1,_i=!1,Qt=null,$t={box:null,offscreen:null,occluded:null},Di={box:null},rr=null,Fi=null,Ni=null,xn=0,On=0,Fr=0;jt.textFeatureIndex?xn=jt.textFeatureIndex:Vt.useRuntimeCollisionCircles&&(xn=Vt.featureIndex),jt.verticalTextFeatureIndex&&(On=jt.verticalTextFeatureIndex);const gi=m.elevationFeatures?m.elevationFeatures[Vt.elevationFeatureIndex]:void 0,Un=Ki=>{Ki.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const fr=this.transform.elevation;Ki.elevation=Ee?ii:ii+s.bV.getAtTileOffset(Ki.tileID,new s.P(Ki.tileAnchorX,Ki.tileAnchorY),fr,gi),Ki.elevation+=Vt.zOffset},Yr=jt.textBox;if(Yr){Un(Yr);const Ki=ki=>{let yr=s.bL.horizontal;if(m.allowVerticalPlacement&&!ki&&this.prevPlacement){const Qr=this.prevPlacement.placedOrientations[Ti];Qr&&(this.placedOrientations[Ti]=Qr,yr=Qr,this.markUsedOrientation(m,yr,Vt))}return yr},fr=(ki,yr)=>{if(m.allowVerticalPlacement&&bi>0&&jt.verticalTextBox){for(const Qr of m.writingModes)if(Qr===s.bL.vertical?($t=yr(),Di=$t):$t=ki(),$t&&$t.box&&$t.box.length)break}
vendor: 20,423 bytes, line 8
8else $t=ki()};if(et){let ki=et;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ti]){const cr=this.prevPlacement.variableOffsets[Ti];ki.indexOf(cr.anchor)>0&&(ki=ki.filter(jn=>jn!==cr.anchor),ki.unshift(cr.anchor))}const yr=(cr,jn,bc)=>{const qo=m.getSymbolInstanceTextSize(Z,Vt,this.transform.zoom,ui),_l=(cr.x2-cr.x1)*qo+2*cr.padding,gl=(cr.y2-cr.y1)*qo+2*cr.padding,Gn=Vt.hasIconTextFit&&!J?jn:null;Gn&&Un(Gn);let $o={box:[],offscreen:!1,occluded:!1};const Ho=ee?2*ki.length:ki.length;for(let so=0;so<Ho;++so){const gs=this.attemptAnchorPlacement(ki[so%ki.length],cr,F,z,wt,_l,gl,qo,ue,xe,P,T,$,so>=ki.length,Vt,ui,m,bc,Gn,Z,H);if(gs&&($o=gs.placedGlyphBoxes,$o&&$o.box&&$o.box.length)){qt=!0,Qt=gs.shift;break}}return $o};fr(()=>yr(Yr,jt.iconBox,s.bL.horizontal),()=>{const cr=jt.verticalTextBox;return cr&&Un(cr),m.allowVerticalPlacement&&!($t&&$t.box&&$t.box.length)&&bi>0&&cr?yr(cr,jt.verticalIconBox,s.bL.vertical):{box:null,offscreen:null,occluded:null}}),$t&&(qt=$t.box,Zi=$t.offscreen,Wi=$t.occluded);const Qr=Ki(!(!$t||!$t.box));if(!qt&&this.prevPlacement){const cr=this.prevPlacement.variableOffsets[Ti];cr&&(this.variableOffsets[Ti]=cr,this.markUsedJustification(m,cr.anchor,Vt,Qr))}}else{const ki=(yr,Qr)=>{const cr=m.getSymbolInstanceTextSize(Z,Vt,this.transform.zoom,ui),jn=this.collisionIndex.placeCollisionBox(m,cr,yr,F,z,wt,new s.P(0,0),ee,P,T,$.predicate);return jn&&jn.box&&jn.box.length&&(this.markUsedOrientation(m,Qr,Vt),this.placedOrientations[Ti]=Qr),jn};fr(()=>ki(Yr,s.bL.horizontal),()=>{const yr=jt.verticalTextBox;return m.allowVerticalPlacement&&bi>0&&yr?(Un(yr),ki(yr,s.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Ki(!!($t&&$t.box&&$t.box.length))}}if(rr=$t,qt=rr&&rr.box&&rr.box.length>0,Zi=rr&&rr.offscreen,Wi=rr&&rr.occluded,Vt.useRuntimeCollisionCircles){const Ki=Vt.centerJustifiedTextSymbolIndex>=0?Vt.centerJustifiedTextSymbolIndex:Vt.verticalPlacedTextSymbolIndex,fr=m.text.placedSymbolArray.get(Ki),ki=s.bM(m.textSizeData,Z,fr),yr=y.get("text-padding");Fi=this.collisionIndex.placeCollisionCircles(m,ee,fr,Ki,m.lineVertexArray,m.glyphOffsetArray,ki,T,E,C,c,xe,$.predicate,Vt.collisionCircleDiameter*ki/s.bY,yr,this.retainedQueryData[m.bucketInstanceId].tileID),qt=ee||Fi.circles.length>0&&!Fi.collisionDetected,Zi=Zi&&Fi.offscreen,Wi=Fi.occluded}if(jt.iconFeatureIndex&&(Fr=jt.iconFeatureIndex),jt.iconBox){const Ki=fr=>{Un(fr);const ki=Vt.hasIconTextFit&&Qt?ma(Qt.x,Qt.y,ue,xe,this.transform.angle):new s.P(0,0),yr=m.getSymbolInstanceIconSize(H,this.transform.zoom,Vt.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,yr,fr,F,z,pt,ki,J,P,T,$.predicate)};Di&&Di.box&&Di.box.length&&jt.verticalIconBox?(Ni=Ki(jt.verticalIconBox),mi=Ni.box.length>0):(Ni=Ki(jt.iconBox),mi=Ni.box.length>0),Zi=Zi&&Ni.offscreen,_i=Ni.occluded}const vn=ne||Vt.numHorizontalGlyphVertices===0&&bi===0,To=se||Vt.numIconVertices===0;if(vn||To?To?vn||(mi=mi&&qt):qt=mi&&qt:mi=qt=mi&&qt,qt&&rr&&rr.box&&this.collisionIndex.insertCollisionBox(rr.box,y.get("text-ignore-placement"),m.bucketInstanceId,Di&&Di.box&&On?On:xn,$.ID),mi&&Ni&&this.collisionIndex.insertCollisionBox(Ni.box,y.get("icon-ignore-placement"),m.bucketInstanceId,Fr,$.ID),Fi&&(qt&&this.collisionIndex.insertCollisionCircles(Fi.circles,y.get("text-ignore-placement"),m.bucketInstanceId,xn,$.ID),c)){const Ki=m.bucketInstanceId;let fr=this.collisionCircleArrays[Ki];fr===void 0&&(fr=this.collisionCircleArrays[Ki]=new $a);for(let ki=0;ki<Fi.circles.length;ki+=4)fr.circles.push(Fi.circles[ki+0]),fr.circles.push(Fi.circles[ki+1]),fr.circles.push(Fi.circles[ki+2]),fr.circles.push(Fi.collisionDetected?1:0)}const bn=m.projection.name!=="globe";bt=bt&&(bn||!Wi),Ct=Ct&&(bn||!_i),this.placements[Ti]=new mn(qt||bt,mi||Ct,Zi||m.justReloaded),o.add(Ti)},ti=this.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(m,ti),m.elevationType==="road"&&m.updateRoadElevation(ti.canonical),m.updateZOffset(),m.sortFeaturesByY){const Vt=m.getSortedSymbolIndexes(this.transform.angle);for(let ui=Vt.length-1;ui>=0;--ui){const jt=Vt[ui];Ht(m.symbolInstances.get(jt),jt,m.collisionArrays[jt])}m.hasAnyZOffset&&s.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const Vt=m.getSortedIndexesByZOffset();for(let ui=0;ui<Vt.length;++ui){const jt=Vt[ui];Ht(m.symbolInstances.get(jt),jt,m.collisionArrays[jt])}}else for(let Vt=t.symbolInstanceStart;Vt<t.symbolInstanceEnd;Vt++)Ht(m.symbolInstances.get(Vt),Vt,m.collisionArrays[Vt]);if(c&&m.bucketInstanceId in this.collisionCircleArrays){const Vt=this.collisionCircleArrays[m.bucketInstanceId];s.bl(Vt.invProjMatrix,T),Vt.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(t,o,c,d){const{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,crossTileID:T}=c,E=s.c3(o),C=d===s.bL.vertical?x:E==="left"?p:E==="center"?m:E==="right"?y:-1;p>=0&&(t.text.placedSymbolArray.get(p).crossTileID=C>=0&&p!==C?0:T),m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=C>=0&&m!==C?0:T),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=C>=0&&y!==C?0:T),x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=C>=0&&x!==C?0:T)}markUsedOrientation(t,o,c){const d=o===s.bL.horizontal||o===s.bL.horizontalOnly?o:0,p=o===s.bL.vertical?o:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:T}=c,E=t.text.placedSymbolArray;m>=0&&(E.get(m).placedOrientation=d),y>=0&&(E.get(y).placedOrientation=d),x>=0&&(E.get(x).placedOrientation=d),T>=0&&(E.get(T).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let c=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const d=o?o.symbolFadeChange(t):1,p=o?o.opacities:{},m=o?o.variableOffsets:{},y=o?o.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],E=p[x];E?(this.opacities[x]=new fi(E,d,T.text,T.icon,null,T.clipped),c=c||T.text!==E.text.placed||T.icon!==E.icon.placed):(this.opacities[x]=new fi(null,d,T.text,T.icon,T.skipFade,T.clipped),c=c||T.text||T.icon)}for(const x in p){const T=p[x];if(!this.opacities[x]){const E=new fi(T,d,!1,!1);E.isHidden()||(this.opacities[x]=E,c=c||T.text.placed||T.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in y)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=y[x]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o,c,d){d&&(this.lastReplacementSourceUpdateTime=d.updateTime);const p=new Set;for(const m of o){const y=m.getBucket(t);y&&m.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,p,m,m.collisionBoxArray,c,d,m.tileID,t.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,m.tileID),y.elevationType==="road"&&y.updateRoadElevation(m.tileID.canonical),y.updateZOffset())}}updateBucketOpacities(t,o,c,d,p,m,y,x){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const T=t.layers[0].layout,E=t.layers[0].paint,C=!!t.layers[0].dynamicFilter(),M=new fi(null,0,!1,!1,!0),P=T.get("text-allow-overlap"),F=T.get("icon-allow-overlap"),z=T.get("text-variable-anchor"),B=T.get("text-rotation-alignment")==="map",j=T.get("text-pitch-alignment")==="map",Z=E.get("symbol-z-offset"),H=T.get("symbol-elevation-reference")==="sea",$=!Z.isConstant(),le=new fi(null,0,P&&(F||!t.hasIconData()||T.get("icon-optional")),F&&(P||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const ne=(ee,J,ue)=>{for(let _e=0;_e<J/4;_e++)ee.opacityVertexArray.emplaceBack(ue)};let se=0;m&&t.updateReplacement(y,m);for(let ee=0;ee<t.symbolInstances.length;ee++){const J=t.symbolInstances.get(ee),{numHorizontalGlyphVertices:ue,numVerticalGlyphVertices:_e,crossTileID:xe,numIconVertices:Ae,tileAnchorX:Ee,tileAnchorY:Fe}=J;let $e=null;const Te=this.retainedQueryData[t.bucketInstanceId];$&&J&&Te&&($e=c.latestFeatureIndex.loadFeature({featureIndex:J.featureIndex,bucketIndex:Te.bucketIndex,sourceLayerIndex:Te.sourceLayerIndex,layoutVertexArrayOffset:0}));const he=Z.evaluate($e,{}),ze=o.has(xe);let Me=this.opacities[xe];ze?Me=M:Me||(Me=le,this.opacities[xe]=Me),o.add(xe);const We=ue>0||_e>0,et=Ae>0,ut=this.placedOrientations[xe],tt=ut===s.bL.vertical,nt=ut===s.bL.horizontal||ut===s.bL.horizontalOnly;!We&&!et||Me.isHidden()||se++;let Et=!1;if((We||et)&&m)for(const wt of t.activeReplacements){if(s.bZ(wt,p,s.b_.Symbol,x)||wt.min.x>Ee||Ee>wt.max.x||wt.min.y>Fe||Fe>wt.max.y)continue;const pt=s.b$(Ee,Fe,y.canonical,wt.footprintTileId.canonical);if(Et=s.c0(pt,wt.footprint),Et)break}if(We){const wt=Et?Rn:an(Me.text);ne(t.text,ue,tt?Rn:wt),ne(t.text,_e,nt?Rn:wt);const pt=Me.text.isHidden(),{leftJustifiedTextSymbolIndex:bt,centerJustifiedTextSymbolIndex:Ct,rightJustifiedTextSymbolIndex:Ot,verticalPlacedTextSymbolIndex:Ht}=J,ti=t.text.placedSymbolArray,Vt=pt||tt?1:0;bt>=0&&(ti.get(bt).hidden=Vt),Ct>=0&&(ti.get(Ct).hidden=Vt),Ot>=0&&(ti.get(Ot).hidden=Vt),Ht>=0&&(ti.get(Ht).hidden=pt||nt?1:0);const ui=this.variableOffsets[xe];ui&&this.markUsedJustification(t,ui.anchor,J,ut);const jt=this.placedOrientations[xe];jt&&(this.markUsedJustification(t,"left",J,jt),this.markUsedOrientation(t,jt,J))}if(et){const wt=Et?Rn:an(Me.icon),{placedIconSymbolIndex:pt,verticalPlacedIconSymbolIndex:bt}=J,Ct=t.icon.placedSymbolArray,Ot=Me.icon.isHidden()?1:0;pt>=0&&(ne(t.icon,Ae,tt?Rn:wt),Ct.get(pt).hidden=Ot),bt>=0&&(ne(t.icon,J.numVerticalIconVertices,nt?Rn:wt),Ct.get(bt).hidden=Ot)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const wt=t.collisionArrays[ee];if(wt){let pt=new s.P(0,0),bt=!0;if(wt.textBox||wt.verticalTextBox){if(z){const Ot=this.variableOffsets[xe];Ot?(pt=Ha(Ot.anchor,Ot.width,Ot.height,Ot.textOffset,Ot.textScale),B&&pt._rotate(j?this.transform.angle:-this.transform.angle)):bt=!1}C&&(bt=!Me.clipped),wt.textBox&&mr(t.textCollisionBox.collisionVertexArray,Me.text.placed,!bt||tt,he,H,pt.x,pt.y),wt.verticalTextBox&&mr(t.textCollisionBox.collisionVertexArray,Me.text.placed,!bt||nt,he,H,pt.x,pt.y)}const Ct=bt&&!!(!nt&&wt.verticalIconBox);wt.iconBox&&mr(t.iconCollisionBox.collisionVertexArray,Me.icon.placed,Ct,he,H,J.hasIconTextFit?pt.x:0,J.hasIconTextFit?pt.y:0),wt.verticalIconBox&&mr(t.iconCollisionBox.collisionVertexArray,Me.icon.placed,!Ct,he,H,J.hasIconTextFit?pt.x:0,J.hasIconTextFit?pt.y:0)}}}if(t.fullyClipped=se===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const ee=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=ee.invProjMatrix,t.placementViewportMatrix=ee.viewportMatrix,t.collisionCircleArray=ee.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,o){const c=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*c>t}isStale(){return this.stale}setStale(){this.stale=!0}}function mr(l,t,o,c,d,p,m){l.emplaceBack(t?1:0,o?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,o?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,o?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,o?1:0,p||0,m||0,c,d?1:0)}const d_=Math.pow(2,25),jl=Math.pow(2,24),dh=Math.pow(2,17),Gl=Math.pow(2,16),Uc=Math.pow(2,9),fh=Math.pow(2,8),jc=Math.pow(2,1);function an(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,o=Math.floor(127*l.opacity);return o*d_+t*jl+o*dh+t*Gl+o*Uc+t*fh+o*jc+t}const Rn=0;class Ln{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,o,c,d,p,m){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(o.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((x,T)=>x.sortKey-T.sortKey));this._currentPartIndex<y.length;){const x=y[this._currentPartIndex];if(o.placeLayerBucketPart(x,this._seenCrossTileIDs,c,x.symbolInstanceStart===0,m),this._currentPartIndex++,p())return!0}return!1}}class ph{startNewPlacement(t,o,c,d,p,m,y,x){return this.placement=new sn(t,d,p,m,y,x),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=c,this._fadeDuration=d,this._done=!1,this._inProgressLayer=null,this}requestFullPlacement(){this._forceFullPlacement=!0}isFullPlacementRequested(){return this._forceFullPlacement}setStale(){this.placement&&(this.placement.stale=!0)}isStale(){return!!this.placement&&this.placement.stale}isDone(){return this._done}continuePlacement(t,o,c,d,p){const m=s.o.now(),y=()=>{const x=s.o.now()-m;return!this.isFullPlacementRequested()&&this._fadeDuration!==0&&x>2};for(;this._currentPlacementIndex>=0;){const x=o[t[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&x.visibility!=="none"&&(!x.minzoom||x.minzoom<=T)&&(!x.maxzoom||x.maxzoom>T)){const E=x,C=E.layout.get("symbol-z-elevate"),M=E.layout.get("symbol-sort-key").constantOr(1)!==void 0,P=E.layout.get("symbol-z-order"),F=P==="viewport-y"||P==="auto"&&!(P!=="viewport-y"&&M),z=E.layout.get("text-allow-overlap")||E.layout.get("icon-allow-overlap")||E.layout.get("text-ignore-placement")||E.layout.get("icon-ignore-placement"),B=F&&z,j=this._inProgressLayer=this._inProgressLayer||new Ln(E),Z=s.B(x.source,x.scope);if(j.continuePlacement(C||B?d[Z]:c[Z],this.placement,this._showCollisionBoxes,x,y,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Os=512/s.al/2;class Dr{constructor(t,o,c){this.tileID=t,this.bucketInstanceId=c,this.index=new s.c4(o.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*s.al,p=t.canonical.y*s.al;for(let m=0;m<o.length;m++){const{key:y,crossTileID:x,tileAnchorX:T,tileAnchorY:E}=o.get(m),C=Math.floor((d+T)*Os),M=Math.floor((p+E)*Os);this.index.add(C,M),this.keys.push(y),this.crossTileIDs.push(x)}this.index.finish()}findMatches(t,o,c){const d=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z),p=Os/Math.pow(2,o.canonical.z-this.tileID.canonical.z),m=o.canonical.x*s.al,y=o.canonical.y*s.al;for(let x=0;x<t.length;x++){const T=t.get(x);if(T.crossTileID)continue;const{key:E,tileAnchorX:C,tileAnchorY:M}=T,P=Math.floor((m+C)*p),F=Math.floor((y+M)*p),z=this.index.range(P-d,F-d,P+d,F+d).sort((B,j)=>B-j);for(const B of z){const j=this.crossTileIDs[B];if(this.keys[B]===E&&!c.has(j)){c.add(j),T.crossTileID=j;break}}}}}class Fo{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class hs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const o=Math.round((t-this.lng)/360);if(o!==0)for(const c in this.indexes){const d=this.indexes[c],p={};for(const m in d){const y=d[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+o),p[y.tileID.key]=y}this.indexes[c]=p}this.lng=t}addBucket(t,o,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<o.symbolInstances.length;p++)o.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const y in m){const x=m[y];x.tileID.isChildOf(t)&&x.findMatches(o.symbolInstances,t,d)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(o.symbolInstances,t,d)}}for(let p=0;p<o.symbolInstances.length;p++){const m=o.symbolInstances.get(p);m.crossTileID||(m.crossTileID=c.generate(),d.add(m.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Dr(t,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(t,o){for(const c of o.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let o=!1;for(const c in this.indexes){const d=this.indexes[c];for(const p in d)t[d[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[p]),delete d[p],o=!0)}return o}}class Ar{constructor(){this.layerIndexes={},this.crossTileIDs=new Fo,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,o,c,d){let p=this.layerIndexes[t.fqid];p===void 0&&(p=this.layerIndexes[t.fqid]=new hs);let m=!1;const y={};d.name!=="globe"&&p.handleWrapJump(c);for(const x of o){const T=x.getBucket(t);T&&t.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(x.tileID,T,this.crossTileIDs)&&(m=!0),y[T.bucketInstanceId]=!0)}return p.removeStaleBuckets(y)&&(m=!0),m}pruneUnusedLayers(t){const o={};t.forEach(c=>{o[c]=!0});for(const c in this.layerIndexes)o[c]||delete this.layerIndexes[c]}}const Fs=771;class Ut{constructor(t,o,c,d){this.blendFunction=t,this.blendColor=o.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}Ut.Replace=[1,0,1,0],Ut.disabled=new Ut(Ut.Replace,s.ao.transparent,[!1,!1,!1,!1]),Ut.unblended=new Ut(Ut.Replace,s.ao.transparent,[!0,!0,!0,!0]),Ut.alphaBlended=new Ut([1,Fs,1,Fs],s.ao.transparent,[!0,!0,!0,!0]),Ut.alphaBlendedNonPremultiplied=new Ut([770,Fs,770,Fs],s.ao.transparent,[!0,!0,!0,!0]),Ut.multiply=new Ut([774,0,774,0],s.ao.transparent,[!0,!0,!0,!0]),Ut.additive=new Ut([1,1,1,1],s.ao.transparent,[!0,!0,!0,!0]);class It{constructor(t,o,c){this.func=t,this.mask=o,this.range=c}}It.ReadOnly=!1,It.ReadWrite=!0,It.disabled=new It(519,It.ReadOnly,[0,1]);const Za=7680;class kt{constructor(t,o,c,d,p,m){this.test=t,this.ref=o,this.mask=c,this.fail=d,this.depthFail=p,this.pass=m}}kt.disabled=new kt({func:519,mask:0},0,0,Za,Za,Za);const Gc=1029,ql=2305;class zt{constructor(t,o,c){this.enable=t,this.mode=o,this.frontFace=c}}function mh(l,t){const o=s.ca(l,3);s.cc(l,t),s.cg(l,3,o)}function _h(l,t){const o=s.c7([]);return s.c8(o,o,-t),s.c9(o,o,-l),o}function ko(l,t){const o=[l[0],l[1],0],c=[t[0],t[1],0];if(s.ag(o)>=1e-15){const m=s.aw([],o);s.c5(c,m,s.bJ(c,m)),t[0]=c[0],t[1]=c[1]}const d=s.bI([],t,l);if(s.c6(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return _h(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),p)}zt.disabled=new zt(!1,Gc,ql),zt.backCCW=new zt(!0,Gc,ql),zt.backCW=new zt(!0,Gc,2304),zt.frontCW=new zt(!0,1028,2304),zt.frontCCW=new zt(!0,1028,ql);class Of{constructor(t,o){this.position=t,this.orientation=o}get position(){return this._position}set position(t){if(t){const o=t instanceof s.ae?t:new s.ae(t[0],t[1],t[2]);
8this._renderWorldCopies&&(o.x=s.bT(o.x,0,1)),this._position=o}else this._position=null}lookAtPoint(t,o,c){if(this.orientation=null,!this.position)return;const d=this.position,p=c||(this._elevation?this._elevation.getAtPointOrZero(s.ae.fromLngLat(t)):0),m=s.ae.fromLngLat(t,p),y=[m.x-d.x,m.y-d.y,m.z-d.z];o||(o=[0,0,1]),o[2]=Math.abs(o[2]),this.orientation=ko(y,o)}setPitchBearing(t,o){this.orientation=_h(s.an(t),s.an(-o))}}class Wa{constructor(t,o){this._transform=s.bA([]),this.orientation=o,this.position=t}get mercatorPosition(){const t=this.position;return new s.ae(t[0],t[1],t[2])}get position(){const t=s.ca(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var o;t&&s.cg(this._transform,3,[(o=t)[0],o[1],o[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||s.c7([]),t&&mh(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),o=this.right();return{bearing:Math.atan2(-o[1],o[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,o){this._orientation=_h(t,o),mh(this._transform,this._orientation)}forward(){const t=s.ca(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=s.ca(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=s.ca(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,o){const c=new Float64Array(16);return s.bl(c,this.getWorldToCamera(t,o)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,o,c){const d=this.position;s.c5(d,d,-t);const p=new Float64Array(16);return s.bq(p,[c,c,c]),s.br(p,p,d),p[10]*=o,p}getWorldToCamera(t,o){const c=new Float64Array(16),d=new Float64Array(4),p=this.position;return s.cb(d,this._orientation),s.c5(p,p,-t),s.cc(c,d),s.br(c,c,p),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=o,c[9]*=o,c[10]*=o,c[11]*=o,c}getCameraToClipPerspective(t,o,c,d){const p=new Float64Array(16);return s.cd(p,t,o,c,d),p}getCameraToClipOrthographic(t,o,c,d,p,m){const y=new Float64Array(16);return s.ce(y,t,o,c,d,p,m),y}getDistanceToElevation(t,o=!1){const c=t===0?0:s.cf(t,o?s.a$(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new Wa([...this.position],[...this.orientation])}}const Dn=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t});class gh{constructor(t=0,o=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=c,this.right=d}interpolate(t,o,c){return o.top!=null&&t.top!=null&&(this.top=s.ak(t.top,o.top,c)),o.bottom!=null&&t.bottom!=null&&(this.bottom=s.ak(t.bottom,o.bottom,c)),o.left!=null&&t.left!=null&&(this.left=s.ak(t.left,o.left,c)),o.right!=null&&t.right!=null&&(this.right=s.ak(t.right,o.right,c)),this}getCenter(t,o){const c=s.aA((this.left+t-this.right)/2,0,t),d=s.aA((this.top+o-this.bottom)/2,0,o);return new s.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new gh(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Bo=15;class qc{constructor(t,o,c,d,p,m,y){this.tileSize=512,this._renderWorldCopies=p===void 0||p,this._minZoom=t||0,this._maxZoom=o||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(m),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new s.aT(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 gh,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Wa,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new qc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
vendor: 1,249 bytes, line 8
8xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Bo}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,o=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
8xaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(o),this._calcMatrices()}getProjection(){return s.aH(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const o=this.projection?this.getProjection():void 0;this.projection=s.cm(this.projectionOptions);const c=this.getProjection(),d=!s.by(o,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.cm({name:"mercator"});const o=t!==this.projection.name;return o&&this._calcMatrices(),o}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.cf(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.bT(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const o=-t*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=s.cn(),s.co(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const o=s.aA(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=s.an(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._setZoom(o),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,o=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!o||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;o||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const t=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(t)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,o=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,p=0;for(let m=0;m<o.length;m++){const y=new s.P(o[m][0]*this.width,c+o[m][1]*(this.height-c)),x=t.pointCoordinate(y);if(!x)continue;const T=1/Math.hypot(x[0]-this._camera.position[0],x[1]-this._camera.position[1]);d+=x[3]*T,p+=T}return p===0?NaN:d/p}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,o=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*o,d=this._mercatorZfromZoom(t),p=this._mercatorZfromZoom(this._maxZoom),m=Math.max(d-c,p);this._setZoom(this._zoomFromMercatorZ(m))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}equals(t){const o=this.elevation,c=t.elevation,d=o!=null!=(c!=null)||o&&c&&o.exaggeration()!==c.exaggeration();return this.width===t.width&&this.height===t.height&&this.center.lng===t.center.lng&&this.center.lat===t.center.lat&&this.zoom===t.zoom&&this.bearing===t.bearing&&this.pitch===t.pitch&&this.fov===t.fov&&this.projection.name===t.projection.name&&this._edgeInsets.equals(t.padding)&&!d}computeZoomRelativeTo(t){const o=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[o.x,o.y,o.z]:[t.x,t.y,t.z];const d=s.ag(s.av([],this._camera.position,c));return s.aA(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let o=!1;if(t.orientation&&!s.cp(t.orientation,this._camera.orientation)&&(o=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];s.cq(c,this._camera.position)||(this._setCameraPosition(c),o=!0)}o&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,o=new Of;return o.position=new s.ae(t[0],t[1],t[2]),o.orientation=this._camera.orientation,o._elevation=this.elevation,o._renderWorldCopies=this.renderWorldCopies,o}_setCameraOrientation(t){if(!s.cr(t))return!1;s.cs(t,t);const o=s.ct([],[0,0,-1],t),c=s.ct([],[0,-1,0],t);if(c[2]<0)return!1;const d=ko(o,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const o=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=s.aA(t[2],d/c,d/o),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,c){this._unmodified=!1,this._edgeInsets.interpolate(t,o,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const o=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(t){const o=[new s.cu(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new s.P(0,0)),d=this.pointCoordinate(new s.P(this.width,0)),p=this.pointCoordinate(new s.P(this.width,this.height)),m=this.pointCoordinate(new s.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,p.x,m.x)),x=Math.floor(Math.max(c.x,d.x,p.x,m.x)),T=1;for(let E=y-T;E<=x+T;E++)E!==0&&o.push(new s.cu(E,t))}return o}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,o,c,d){let p=[];const m=c!=null,y=!m;if(y&&this.zoom<o||m&&c[0]===0&&c[1]===0)return p;const x=new Set,T=(C,M,P,F,z)=>{const B=s.cY(M,C,P,F,z);x.has(B)||(p.push(new s.aQ(C,M,P,F,z)),x.add(B))};for(let C=0;C<t.length;C++){const M=t[C];if(y&&M.canonical.z!==o||m&&d!==void 0&&d>M.canonical.z)continue;const P=M.canonical,F=M.overscaledZ,z=M.wrap,B=1<<P.z,j=P.x+1<B,Z=P.x>0,H=P.y+1<B,$=P.y>0,le=M.wrap-(Z?0:1),ne=M.wrap+(j?0:1),se=Z?P.x-1:B-1,ee=j?P.x+1:0;if(m)c[0]<0?(T(F,ne,P.z,ee,P.y),c[1]<0&&H&&(T(F,z,P.z,P.x,P.y+1),T(F,ne,P.z,ee,P.y+1)),c[1]>0&&$&&(T(F,z,P.z,P.x,P.y-1),T(F,ne,P.z,ee,P.y-1))):c[0]>
vendor: 12,490 bytes, line 8
80?(T(F,le,P.z,se,P.y),c[1]<0&&H&&(T(F,z,P.z,P.x,P.y+1),T(F,le,P.z,se,P.y+1)),c[1]>0&&$&&(T(F,z,P.z,P.x,P.y-1),T(F,le,P.z,se,P.y-1))):c[1]<0&&H?T(F,z,P.z,P.x,P.y+1):$&&T(F,z,P.z,P.x,P.y-1);else{const J=M.visibleQuadrants;1&J&&(T(F,le,P.z,se,P.y),$&&(T(F,z,P.z,P.x,P.y-1),T(F,le,P.z,se,P.y-1))),2&J&&(T(F,ne,P.z,ee,P.y),$&&(T(F,z,P.z,P.x,P.y-1),T(F,ne,P.z,ee,P.y-1))),4&J&&(T(F,le,P.z,se,P.y),H&&(T(F,z,P.z,P.x,P.y+1),T(F,le,P.z,se,P.y+1))),8&J&&(T(F,ne,P.z,ee,P.y),H&&(T(F,z,P.z,P.x,P.y+1),T(F,ne,P.z,ee,P.y+1)))}}const E=[];for(const C of p)p.some(M=>C.isChildOf(M))||E.push(C);if(p=E.filter(C=>!t.some(M=>!!(C.overscaledZ<o&&M.isChildOf(C))||C.equals(M)||C.isChildOf(M))),y){const C=1<<o,M=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),P=[C*M.x,C*M.y],F=4,z=F*F;p=p.filter(B=>{const j=B.canonical.x+.5-P[0],Z=B.canonical.y+.5-P[1];return j*j+Z*Z<z})}return p}extendTileCoverToNearPlane(t,o,c){const d=[],p=new Set;for(const Z of t)p.add(Z.key);const m=(Z,H,$,le,ne)=>{const se=s.cY(H,Z,$,le,ne);p.has(se)||(d.push(new s.aQ(Z,H,$,le,ne)),p.add(se))},y=t.reduce((Z,H)=>Math.max(Z,H.overscaledZ),c),x=1<<c,T=[new s.P(0,0),new s.P(s.al,0),new s.P(s.al,s.al),new s.P(0,s.al)],E=new s.P(0,0),C=new s.P(0,0),M=(Z,H)=>{const $=Math.floor(Z[0]),le=Math.floor(Z[1]),ne=(Z[0]-$)*s.al,se=(Z[1]-le)*s.al,ee=Math.floor(H[0]),J=Math.floor(H[1]),ue=(H[0]-ee)*s.al,_e=(H[1]-J)*s.al;for(let xe=-1;xe<=1;xe++){const Ae=$+xe;if(!(Ae<0||Ae>=x)){E.x=ne-xe*s.al,C.x=ue-(Ae-ee)*s.al;for(let Ee=-1;Ee<=1;Ee++){const Fe=le+Ee;E.y=se-Ee*s.al,C.y=_e-(Fe-J)*s.al,s.cZ(E,C,T)&&m(y,0,c,Ae,Fe)}}}},P=o.points,F=P[s.cv],z=P[s.cw],B=this._projectToGround(F,P[s.cx]),j=this._projectToGround(z,P[s.cy]);return M(F,B),M(z,j),d}_projectToGround(t,o){return s.cz(s.cA(),t,o,t[2]/(t[2]-o[2]))}coveringTiles(t){let o=this.coveringZoomLevel(t);const c=o,d=this.elevation&&this.elevation.exaggeration(),p=d&&!t.isTerrainDEM,m=this.projection.name==="mercator";if(t.minzoom!==void 0&&o<t.minzoom)return[];t.maxzoom!==void 0&&o>t.maxzoom&&(o=t.maxzoom);const y=this.locationCoordinate(this.center),x=this.center.lat,T=1<<o,E=[T*y.x,T*y.y,0],C=this.projection.name==="globe",M=!C,P=s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o,M),F=C?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=T*s.cf(1,this.center.lat),B=this._camera.position[2]/s.cf(1,this.center.lat),j=[T*F.x,T*F.y,B*(M?1:z)],Z=C||d,H=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),$=this.isLODDisabled(!0)?o:0;let le;if(this._elevation&&t.isTerrainDEM)le=1e4*this._elevation.exaggeration();else if(this._elevation){const he=this._elevation.getMinMaxForVisibleTiles();le=he?he.max:this._centerAltitude}else le=this._centerAltitude;const ne=t.isTerrainDEM?-le:this._elevation?this._elevation.getMinElevationBelowMSL():0,se=this.projection.isReprojectedInTileSpace?s.cC(this):1,ee=he=>{const Me=new s.ae(he.x+25e-6,he.y,he.z),We=new s.ae(he.x,he.y+25e-6,he.z),et=he.toLngLat(),ut=Me.toLngLat(),tt=We.toLngLat(),nt=this.locationCoordinate(et),Et=this.locationCoordinate(ut),wt=this.locationCoordinate(tt),pt=Math.hypot(Et.x-nt.x,Et.y-nt.y),bt=Math.hypot(wt.x-nt.x,wt.y-nt.y);return Math.sqrt(pt*bt)*se/25e-6},J=he=>{const ze=le,Me=ne;return{aabb:s.cF(this,T,0,0,0,he,Me,ze,this.projection),zoom:0,x:0,y:0,minZ:Me,maxZ:ze,wrap:he,fullyVisible:!1}},ue=[];let _e=[];const xe=o,Ae=t.reparseOverscaled?c:o,Ee=(B-this._centerAltitude)*z,Fe=he=>{if(!this._elevation||!he.tileID||!m)return;const ze=this._elevation.getMinMaxForTile(he.tileID),Me=he.aabb;ze?(Me.min[2]=ze.min,Me.max[2]=ze.max,Me.center[2]=(Me.min[2]+Me.max[2])/2):(he.shouldSplit=Te(he),he.shouldSplit||(Me.min[2]=Me.max[2]=Me.center[2]=this._centerAltitude))},$e=(he,ze)=>{if(.707*ze<he)return 1;const Me=ze/he;return Me/(1.4144271570014144+(Math.pow(1.1,Me-1.4144271570014144+1)-1)/(1.1-1)-1)},Te=he=>{if(he.zoom<$)return!0;if(he.zoom===xe)return!1;if(he.shouldSplit!=null)return he.shouldSplit;const ze=he.aabb.distanceX(j),Me=he.aabb.distanceY(j);let We=Ee,et=1;if(C){We=he.aabb.distanceZ(j);const bt=Math.pow(2,he.zoom),Ct=s.a$((he.y+1)/bt),Ot=s.a$(he.y/bt),Ht=Math.min(Math.max(x,Ct),Ot),ti=s.d1(Ht)/s.d1(x);if(et=Ht===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,ti/this._mercatorScaleRatio),this.zoom<=s.c_&&he.zoom===xe-1&&ti>=.9)return!0}else if(p&&(We=he.aabb.distanceZ(j)*z),this.projection.isReprojectedInTileSpace&&c<=5){const bt=Math.pow(2,he.zoom),Ct=ee(new s.ae((he.x+.5)/bt,(he.y+.5)/bt));et=Ct>.85?1:Ct}if(!m&&!C){const bt=Math.sqrt(ze*ze+Me*Me+We*We);let Ct=(1<<xe-he.zoom)*H*et;return Ct*=$e(Math.max(We,Ee),bt),bt<Ct}let ut=Number.MAX_VALUE,tt=0;const nt=he.aabb.getCorners(),Et=[];for(const bt of nt){s.av(Et,bt,j),C||(p?Et[2]*=z:Et[2]=Ee);const Ct=s.bJ(Et,this._camera.forward());Ct<ut&&(ut=Ct,tt=Math.abs(Et[2]))}let wt=(1<<xe-he.zoom)*H*et;if(wt*=$e(Math.max(tt,Ee),ut),ut<wt)return!0;const pt=he.aabb.closestPoint(E);return pt[0]===E[0]&&pt[1]===E[1]};if(this.renderWorldCopies)for(let he=1;he<=3;he++)ue.push(J(-he)),ue.push(J(he));for(ue.push(J(0));ue.length>0;){const he=ue.pop(),ze=he.x,Me=he.y;let We=he.fullyVisible;const et=()=>this.projection.name==="globe"&&(he.y===0||he.y===(1<<he.zoom)-1);if(!We){let ut=Z?he.aabb.intersects(P):he.aabb.intersectsFlat(P);if(ut===0&&et()){const tt=new s.cD(he.zoom,ze,Me);ut=s.cE(this,T,tt,!0).intersects(P)}if(ut===0)continue;We=ut===2}if(he.zoom===xe||!Te(he)){const ut=he.zoom===xe?Ae:he.zoom;if(t.minzoom&&t.minzoom>ut)continue;let tt=0;if(!We){let pt=Z?he.aabb.intersectsPrecise(P):he.aabb.intersectsPreciseFlat(P);if(pt===0&&et()){const bt=new s.cD(he.zoom,ze,Me);pt=s.cE(this,T,bt,!0).intersectsPrecise(P)}if(pt===0)continue;if(t.calculateQuadrantVisibility)if(P.containsPoint(he.aabb.center))tt=15;else for(let bt=0;bt<4;bt++)he.aabb.quadrant(bt).intersects(P)!==0&&(tt|=1<<bt)}const nt=E[0]-(.5+ze+(he.wrap<<he.zoom))*(1<<o-he.zoom),Et=E[1]-.5-Me,wt=he.tileID?he.tileID:new s.aQ(ut,he.wrap,he.zoom,ze,Me);t.calculateQuadrantVisibility&&(wt.visibleQuadrants=tt),_e.push({tileID:wt,distanceSq:nt*nt+Et*Et});continue}for(let ut=0;ut<4;ut++){const tt=(ze<<1)+ut%2,nt=(Me<<1)+(ut>>1),Et={aabb:m?he.aabb.quadrant(ut):s.cF(this,T,he.zoom+1,tt,nt,he.wrap,he.minZ,he.maxZ,this.projection),zoom:he.zoom+1,x:tt,y:nt,wrap:he.wrap,fullyVisible:We,tileID:void 0,shouldSplit:void 0,minZ:he.minZ,maxZ:he.maxZ};p&&!C&&(Et.tileID=new s.aQ(he.zoom+1===xe?Ae:he.zoom+1,he.wrap,he.zoom+1,tt,nt),Fe(Et)),ue.push(Et)}}if(this.fogCullDistSq){const he=this.fogCullDistSq,ze=this.horizonLineFromTop();_e=_e.filter(Me=>{const We=[0,0,0,1],et=[s.al,s.al,0,1],ut=this.calculateFogTileMatrix(Me.tileID.toUnwrapped());s.aC(We,We,ut),s.aC(et,et,ut);const tt=s.cG([],We,et),nt=s.cH([],We,et),Et=s.c$(tt,nt);if(Et===0)return!0;let wt=!1;const pt=this._elevation;if(pt&&Et>he&&ze!==0){const bt=this.calculateProjMatrix(Me.tileID.toUnwrapped());let Ct;t.isTerrainDEM||(Ct=pt.getMinMaxForTile(Me.tileID)),Ct||(Ct={min:ne,max:le});const Ot=s.cI(this.rotation),Ht=[Ot[0]*s.al,Ot[1]*s.al,Ct.max];s.af(Ht,Ht,bt),wt=(1-Ht[1])*this.height*.5<ze}return Et<he||wt})}return _e.sort((he,ze)=>he.distanceSq-ze.distanceSq).map(he=>he.tileID)}resize(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log2(t)}project(t){const o=s.aA(t.lat,-s.cJ,s.cJ),c=this.projection.project(t.lng,o);return new s.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,o){let c,d;const p=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(o.x-p.x)/y,d=(o.y-p.y)/y}else{const y=this.pointCoordinate(o),x=this.pointCoordinate(p);c=y.x-x.x,d=y.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new s.ae(m.x-c,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,o){return this.projection.locationPoint(this,t,o)}locationPoint3D(t,o){return this.projection.locationPoint(this,t,o,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,o){return this.coordinateLocation(this.pointCoordinate3D(t,o))}locationCoordinate(t,o){const c=o?s.cf(o,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new s.ae(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,o){const c=o??this._centerAltitude,d=[t.x,t.y,0,1],p=[t.x,t.y,1,1];s.aC(d,d,this.pixelMatrixInverse),s.aC(p,p,this.pixelMatrixInverse);const m=p[3];s.cK(d,d,1/d[3]),s.cK(p,p,1/m);const y=d[2],x=p[2];return{p0:d,p1:p,t:y===x?0:(c-y)/(x-y)}}screenPointToMercatorRay(t){const o=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return s.aC(o,o,this.pixelMatrixInverse),s.aC(c,c,this.pixelMatrixInverse),s.cK(o,o,1/o[3]),s.cK(c,c,1/c[3]),o[2]=s.cf(o[2],this._center.lat)*this.worldSize,c[2]=s.cf(c[2],this._center.lat)*this.worldSize,s.cK(o,o,1/this.worldSize),s.cK(c,c,1/this.worldSize),new s.ax([o[0],o[1],o[2]],s.aw([],s.av([],c,o)))}rayIntersectionCoordinate(t){const{p0:o,p1:c,t:d}=t,p=s.cf(o[2],this._center.lat),m=s.cf(c[2],this._center.lat);return new s.ae(s.ak(o[0],c[0],d)/this.worldSize,s.ak(o[1],c[1],d)/this.worldSize,s.ak(p,m,d))}pointCoordinate(t,o=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,o)}pointCoordinate3D(t,o){if(!this.elevation)return this.pointCoordinate(t,o);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new s.ae(c[0],c[1],c[2]);let d=0,p=this.horizonLineFromTop();if(t.y>p)return this.pointCoordinate(t,o);const m=.02*p,y=t.clone();for(let x=0;x<10&&p-d>m;x++){y.y=s.ak(d,p,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(p=y.y,c=T):d=y.y}return c?new s.ae(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=s.cL)return!this.isPointAboveHorizon(t);const o=this.pointCoordinate(t);return o.y>=0&&o.y<=1}_coordinatePoint(t,o){const c=o&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return s.aC(d,d,this.pixelMatrix),d[3]>0?new s.P(d[0]/d[3],d[1]/d[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:o}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new s.P(o,t)),m=this.pointLocation3D(new s.P(d,t)),y=this.pointLocation3D(new s.P(d,c)),x=this.pointLocation3D(new s.P(o,c));let T=Math.min(p.lng,m.lng,y.lng,x.lng),E=Math.max(p.lng,m.lng,y.lng,x.lng),C=Math.min(p.lat,m.lat,y.lat,x.lat),M=Math.max(p.lat,m.lat,y.lat,x.lat);const P=Math.pow(2,-this.zoom)/16*270,F=this.projection.name==="globe"?1:4,z=(B,j,Z,H,$)=>{const le=(B+Z)/2,ne=(j+H)/2,se=new s.P(le,ne),{lng:ee,lat:J}=this.pointLocation3D(se),ue=Math.max(0,T-ee,C-J,ee-E,J-M);T=Math.min(T,ee),E=Math.max(E,ee),C=Math.min(C,J),M=Math.max(M,J),($<F||ue>P)&&(z(B,j,le,ne,$+1),z(le,ne,Z,H,$+1))};if(z(o,t,d,t,1),z(d,t,d,c,1),z(d,c,o,c,1),z(o,c,o,t,1),this.projection.name==="globe"){const[B,j]=s.cM(this);B?(M=90,E=180,T=-180):j&&(C=-90,E=180,T=-180)}return new s.aI(new s.aT(T,C),new s.aT(E,M))}_getBoundsRectangular(t,o){const{top:c,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,y=new s.P(d,c),x=new s.P(m,c),T=new s.P(m,p),E=new s.P(d,p);let C=this.pointCoordinate(y,t),M=this.pointCoordinate(x,t);const P=this.pointCoordinate(T,o),F=this.pointCoordinate(E,o),z=(B,j)=>(j.y-B.y)/(j.x-B.x);return C.y>1&&M.y>=0?C=new s.ae((1-F.y)/z(F,C)+F.x,1):C.y<0&&M.y<=1&&(C=new s.ae(-F.y/z(F,C)+F.x,0)),M.y>1&&C.y>=0?M=new s.ae((1-P.y)/z(P,M)+P.x,1):M.y<0&&C.y<=1&&(M=new s.ae(-P.y/z(P,M)+P.x,0)),new s.aI().extend(this.coordinateLocation(C)).extend(this.coordinateLocation(M)).extend(this.coordinateLocation(F)).extend(this.coordinateLocation(P))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const o=t.visibleDemTiles.reduce((c,d)=>
8{if(d.dem){const p=d.dem.tree;c.min=Math.min(c.min,p.minimums[0]),c.max=Math.max(c.max,p.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(o.min*t.exaggeration(),o.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const o=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-o*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-s.cJ,this.maxLat=s.cJ,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=s.aF(this.minLng)*this.tileSize,this.worldMaxX=s.aF(this.maxLng)*this.tileSize,this.worldMinY=s.aJ(this.maxLat)*this.tileSize,this.worldMaxY=s.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,o){return this.projection.createTileMatrix(this,o,t)}calculateDistanceTileData(t){const o=t.key,c=this._distanceTileDataCache;if(c[o])return c[o];const d=t.canonical,p=1/this.height,m=this.cameraWorldSize,y=m/this.zoomScale(d.z),x=(d.x+Math.pow(2,d.z)*t.wrap)*y,T=d.y*y,E=this.point;E.x*=m/this.worldSize,E.y*=m/this.worldSize;const C=this.angle,M=Math.sin(-C),P=-Math.cos(-C);return c[o]={bearing:[M,P],center:[(E.x-x)*p,(E.y-T)*p],scale:y/s.al*p},c[o]}calculateFogTileMatrix(t){const o=t.key,c=this._fogTileMatrixCache;if(c[o])return c[o];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return s.aB(d,this.worldToFogMatrix,d),c[o]=new Float32Array(d),c[o]}calculateProjMatrix(t,o=!1,c=!1){const d=t.key;let p;if(p=c?this._expandedProjMatrixCache:o?this._alignedProjMatrixCache:this._projMatrixCache,p[d])return p[d];const m=this.calculatePosMatrix(t,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:o?this.alignedProjMatrix:this.projMatrix,s.aB(m,y,m),p[d]=new Float32Array(m),p[d]}calculatePixelsToTileUnitsMatrix(t){const o=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[o])return c[o];const d=s.cN(t,this);return c[o]=d,c[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,o=s.bq([],[t,t,t]);return s.aB(o,o,this.globeMatrix),o}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const o=s.cf(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(o),d=this._camera.forward(),p=s.cf(1,this._center.lat);c[2]/=p,d[2]/=p,s.aw(d,d);const m=t.raycast(c,d,t.exaggeration());if(m){const y=s.bH([],c,d,m),x=new s.ae(y[0],y[1],s.cf(y[2],s.a$(y[1]))),T=(x.z+s.ag([x.x-c[0],x.y-c[1],x.z-c[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=x.toAltitude(),this._center=this.coordinateLocation(x),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const o=this._elevation,c=s.cf(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),p=o.getAtPointOrZero(new s.ae(...d)),m=this.pixelsPerMeter/this.worldSize*p,y=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=y)if(x<0||t){const T=this.locationCoordinate(this._center,this._centerAltitude),E=[d[0],d[1],T.z-d[2]],C=s.ag(E);E[2]-=(y-x)/this._pixelsPerMercatorPixel;const M=s.ag(E);if(M===0)return;s.c5(E,E,C/M*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-E[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const M=this.center;return M.lat=s.aA(M.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(M.lng=s.aA(M.lng,this.minLng,this.maxLng)),this.center=M,void(this._constraining=!1)}const o=this._unmodified,{x:c,y:d}=this.point;let p=0,m=c,y=d;const x=this.width/2,T=this.height/2,E=this.worldMinY*this.scale,C=this.worldMaxY*this.scale;if(d-T<E&&(y=E+T),d+T>C&&(y=C-T),C-E<this.height&&(p=Math.max(p,this.height/(C-E)),y=(C+E)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const M=this.worldMinX*this.scale,P=this.worldMaxX*this.scale,F=this.worldSize/2-(M+P)/2;m=(c+F+this.worldSize)%this.worldSize-F,m-x<M&&(m=M+x),m+x>P&&(m=P-x),P-M<this.width&&(p=Math.max(p,this.width/(P-M)),m=(P+M)/2)}m===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new s.P(m,y))),p&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(p)),this._constrainCamera(),this._unmodified=o,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
8_calcMatrices(){if(!this.height)return;const t=this.centerOffset,o=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=s.cf(1,this.center.lat)/s.cf(1,s.d2));const d=s.cO(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const p=this.projection.zAxisUnit==="meters"?c:1,m=this._camera.getWorldToCamera(this.worldSize,p);let y;const x=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(x[8]=2*-t.x/this.width,x[9]=2*t.y/this.height,this.isOrthographic){let J=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ue=J*this.aspect,_e=-ue,xe=-J;ue-=t.x,_e-=t.x,J+=t.y,xe+=t.y,y=this._camera.getCameraToClipOrthographic(_e,ue,xe,J,this._nearZ,this._farZ),((Ae,Ee,Fe,$e)=>{for(let Te=0;Te<16;Te++)Ae[Te]=s.ak(Ee[Te],Fe[Te],$e)})(y,y,x,s.d0(this.pitch>=Bo?1:this.pitch/Bo))}else y=x;const T=s.cP([],x,m);let E=s.cP([],y,m);if(this.projection.isReprojectedInTileSpace){const J=this.locationCoordinate(this.center),ue=s.bA([]);s.br(ue,ue,[J.x*this.worldSize,J.y*this.worldSize,0]),s.aB(ue,ue,s.cQ(this)),s.br(ue,ue,[-J.x*this.worldSize,-J.y*this.worldSize,0]),s.aB(E,E,ue),s.aB(T,T,ue),this.inverseAdjustmentMatrix=s.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.cS([],E,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=E,this.invProjMatrix=s.bl(new Float64Array(16),this.projMatrix),o){const J=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);J[8]=2*-t.x/this.width,J[9]=2*t.y/this.height,this.expandedFarZProjMatrix=s.cP([],J,m)}else this.expandedFarZProjMatrix=this.projMatrix;const C=s.bl([],y);this.frustumCorners=s.cT.fromInvProjectionMatrix(C,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!o);const M=new Float32Array(16);s.bA(M),s.cS(M,M,[1,-1,1]),s.cU(M,M,this._pitch),s.bB(M,M,this.angle);const P=s.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.bz(P);const F=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;P[8]=2*-t.x/this.width,P[9]=2*(t.y+F)/this.height,this.skyboxMatrix=s.aB(M,P,M);const z=this.point,B=z.x,j=z.y,Z=this.width%2/2,H=this.height%2/2,$=Math.cos(this.angle),le=Math.sin(this.angle),ne=B-Math.round(B)+$*Z+le*H,se=j-Math.round(j)+$*H+le*Z,ee=new Float64Array(E);if(s.br(ee,ee,[ne>.5?ne-1:ne,se>.5?se-1:se,0]),this.alignedProjMatrix=ee,E=s.bC(),s.cS(E,E,[this.width/2,-this.height/2,1]),s.br(E,E,[1,-1,0]),this.labelPlaneMatrix=E,E=s.bC(),s.cS(E,E,[1,-1,1]),s.br(E,E,[-1,-1,0]),s.cS(E,E,[2/this.width,2/this.height,1]),this.glCoordMatrix=E,this.pixelMatrix=s.aB(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},E=s.bl(new Float64Array(16),this.pixelMatrix),!E)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=E,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.cV(this);const J=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.af(J,J,m),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=E;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,o=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,p=[t,t,o];s.c5(p,p,d),s.c5(c,c,-1),s.cW(c,c,p);const m=s.bC();s.br(m,m,c),s.cS(m,m,p),this.mercatorFogMatrix=m,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,o,d)}_computeCameraPosition(t){const o=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,p=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*o-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*p,d.y/this.worldSize-c[1]*p,t/this.worldSize*this._centerAltitude-c[2]*p]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const o=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let p=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(p=Math.min((o-c)/d,1)),this._camera.position=s.bH([],this._camera.position,t,p),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,o=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),p=s.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.an(this._maxPitch)),y=Math.max((t[2]-p)/Math.cos(c),m),x=this._zoomFromMercatorZ(y);s.bH(t,t,o,y),this._pitch=s.aA(c,s.an(this.minPitch),s.an(this.maxPitch)),this.angle=s.bT(d,-Math.PI,Math.PI),this._setZoom(s.aA(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s.ae(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}
8zoomFromMercatorZAdjusted(t){let o=0,c=s.cL,d=0,p=1/0;for(;c-o>1e-6&&c>o;){const m=o+.5*(c-o),y=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,y),T=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),E=Math.abs(m-T);E<p&&(p=E,d=m),m<T?o=m:c=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(s.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,o){const c=Math.min(t.x,o.x),d=Math.max(t.x,o.x),p=Math.min(t.y,o.y),m=Math.max(t.y,o.y);if(p<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const y=[new s.P(c,p),new s.P(d,m),new s.P(c,m),new s.P(d,p)],x=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const E of y){const C=this.pointRayIntersection(E);if(C.t<0)return!0;const M=this.rayIntersectionCoordinate(C);if(M.x<x||M.y<0||M.x>T||M.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(t,o){const c=s.ag(s.av([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+o;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=(function([o,c,d],p){const m=[o,c,d,1];s.aC(m,m,p);const y=m[3]=Math.max(m[3],1e-6);return m[0]/=y,m[1]/=y,m[2]/=y,m})([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,t))}}getCameraToCenterDistance(t,o=this.zoom,c=this.worldSize){const d=s.cO(t,o,this.width,this.height,1024),p=t.pixelSpaceConversion(this.center.lat,c,d);let m=.5/Math.tan(.5*this._fov)*this.height*p;return this.isOrthographic&&(m=s.ak(1,m,s.d0(this.pitch>=Bo?1:this.pitch/Bo))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.aB(t,t,this.globeMatrix),t}getFrustum(t){return s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const vo=(l,t)=>{if(t>0&&l.terrain&&s.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const o=l.transform,c=Math.max(Math.abs(o._zoom-(l.minCutoffZoom-1)),1),d=o.isLODDisabled(!1)?s.ah(60,45,o.pitch):s.ah(30,15,o.pitch),p=o._farZ-o._nearZ,m=t*o.height,y=((1-(x=d))*o.cameraToCenterDistance+x*(o._farZ+m))*c;var x;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[o._nearZ,o._farZ,(y-o._nearZ)/p,(y-m-o._nearZ)/p]}}},ks=2048;class f_{constructor(t,o){this.aabb=t,this.lastCascade=o}}class $l{add(t,o){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],o.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],o.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],o.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],o.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],o.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],o.max[2])):this.receivers[t.key]=new f_(o,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,o,c){const d=s.d9.fromPoints(t.points);let p=0;for(const m in this.receivers){const y=this.receivers[m];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const x=y.aabb.getCorners();for(let T=0;T<c.length;T++){let E=!0;for(const C of x){const M=[C[0]*o,C[1]*o,C[2]];if(s.af(M,M,c[T].matrix),M[0]<-1||M[0]>1||M[1]<-1||M[1]>1){E=!1;break}}if(y.lastCascade=T,p=Math.max(p,T),E)break}}return p+1}}class Hl{constructor(t){this.painter=t,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new $l,this._depthMode=new It(t.context.gl.LEQUAL,It.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,o){const c=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!o||!o.properties)return;const d=o.properties.get("shadow-intensity"),p=o.properties.get("shadow-draw-before-layer");if(!o.shadowsEnabled()||d<=0)return;let m=-1,y=0;for(const j of c.style.order){const Z=c.style._mergedLayers[j];Z.hasShadowPass()&&!Z.isHidden(t.zoom)&&(m=y),p&&p===j&&(this._drawShadowAfterLayer=y>0?y-1:0),y+=1}if(this._enabled=m>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=m);const x=c.context,T=ks,E=ks;
8if(this._cascades.length===0||ks!==this._cascades[0].texture.size[0]){this._cascades=[];for(let j=0;j<2;++j){const Z=c._shadowMapDebug,H=x.gl,$=x.createFramebuffer(T,E,Z?1:0,"texture"),le=new s.T(x,{width:T,height:E,data:null},H.DEPTH_COMPONENT16);if($.depthAttachment.set(le.texture),Z){const ne=new s.T(x,{width:T,height:E,data:null},H.RGBA8);$.colorAttachment0.set(ne.texture)}this._cascades.push({framebuffer:$,texture:le,matrix:[],far:0,boundingSphereRadius:0,frustum:new s.cB,scale:0})}}this.shadowDirection=Ff(o);let C=0;if(t.elevation){const j=t.elevation,Z=[1e4,-1e4];j.visibleDemTiles.filter(H=>H.dem).forEach(H=>{const $=H.dem.tree;Z[0]=Math.min(Z[0],$.minimums[0]),Z[1]=Math.max(Z[1],$.maximums[0])}),Z[0]!==1e4&&(C=(Z[1]-Z[0])*j.exaggeration())}const M=1.5*t.cameraToCenterDistance,P=3*M,F=new Float64Array(16);for(let j=0;j<this._cascades.length;++j){const Z=this._cascades[j];let H=t.height/50,$=1;j===0?$=M:(H=M,$=P);const[le,ne]=kf(t,this.shadowDirection,H,$,ks,C);Z.scale=t.scale,Z.matrix=le,Z.boundingSphereRadius=ne,s.bl(F,Z.matrix),Z.frustum=s.cB.fromInvProjectionMatrix(F,1,0,!0),Z.far=$}const z=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[z].far,this._cascades[z].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=ks,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const B=c.transform.elevation;for(const j of this._groundShadowTiles){let Z={min:0,max:0};if(B){const H=B.getMinMaxForTile(j);H&&(Z=H)}this.addShadowReceiver(j.toUnwrapped(),Z.min,Z.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,o){if(!this.enabled)return;const c=this.painter,d=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),d.viewport.set([0,0,ks,ks]);for(let p=0;p<this._numCascadesToRender;++p){c.currentShadowCascade=p,d.bindFramebuffer.set(this._cascades[p].framebuffer.framebuffer),d.clear({color:s.ao.white,depth:1});for(const m of t.order){const y=t._mergedLayers[m];if(!y.hasShadowPass()||y.isHidden(c.transform.zoom))continue;const x=t.getLayerSourceCache(y),T=x?o[x.id]:void 0;(y.type==="model"||T&&T.length)&&c.renderLayer(c,x,y,T)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,o=t.style,c=t.context,d=c.gl,p=o.directionalLight,m=o.ambientLight;if(!p||!m)return;const y=[],x=vo(t,t.longestCutoffRange);x.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=bo(o,p,m),E=new It(d.LEQUAL,It.ReadOnly,t.depthRangeFor3D),C=new kt({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const M of this._groundShadowTiles){const P=M.toUnwrapped(),F=t.isTileAffectedByFog(M),z=t.getOrCreateProgram("groundShadow",{defines:y,overrideFog:F});this.setupShadows(P,z),t.uploadCommonUniforms(c,z,P,null,x);const B=Dn(t.transform.calculateProjMatrix(P),T);z.draw(t,d.TRIANGLES,E,C,Ut.multiply,zt.disabled,B,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Ut.unblended:Ut.disabled}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(t){const o=this.painter.transform,c=o.calculatePosMatrix(t,o.worldSize);return s.aB(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}calculateShadowPassMatrixFromMatrix(t){const o=s.bz(t);return s.aB(o,this._cascades[this.painter.currentShadowCascade].matrix,t),o}setupShadows(t,o,c){if(!this.enabled)return;const d=this.painter.transform,p=this.painter.context,m=p.gl,y=this._uniformValues,x=new Float64Array(16),T=d.calculatePosMatrix(t,d.worldSize);for(let E=0;E<this._cascades.length;E++)s.aB(x,this._cascades[E].matrix,T),y[E===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(x),p.activeTexture.set(m.TEXTURE0+11+E),this._cascades[E].texture.bindExtraParam(m.LINEAR,m.LINEAR,m.CLAMP_TO_EDGE,m.CLAMP_TO_EDGE,m.GREATER);if(this.useNormalOffset=!!c,this.useNormalOffset){const E=s.d7(t.canonical),C=2/d.tileSize*s.al/ks,M=C*this._cascades[0].boundingSphereRadius,P=C*this._cascades[this._cascades.length-1].boundingSphereRadius,F=(c==="vector-tile"?1:3)*(function(z){const B=s.aA((z-22)/-22,0,1
8);return .125*(1-B)+4*B})(d.zoom);y.u_shadow_normal_offset=[E,M*F,P*F],y.u_shadow_bias=[1e-4,.0012,.012]}else y.u_shadow_bias=[36e-5,.0012,.012];o.setShadowUniformValues(p,y)}setupShadowsFromMatrix(t,o,c=!1){if(!this.enabled)return;const d=this.painter.context,p=d.gl,m=this._uniformValues,y=new Float64Array(16);for(let x=0;x<2;x++)s.aB(y,this._cascades[x].matrix,t),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(p.TEXTURE0+11+x),this._cascades[x].texture.bindExtraParam(p.LINEAR,p.LINEAR,p.CLAMP_TO_EDGE,p.CLAMP_TO_EDGE,p.GREATER);this.useNormalOffset=c,c?(m.u_shadow_normal_offset=[1,3,3],m.u_shadow_bias=[6e-5,.0012,.012]):m.u_shadow_bias=[36e-5,.0012,.012],o.setShadowUniformValues(d,m)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,o,c,d){if(d[2]>=0)return{};const p=(function(x,T,E){const C=E/(1<<x.canonical.z);return new s.d9([x.canonical.x*C+x.wrap*E,x.canonical.y*C+x.wrap*E,0],[(x.canonical.x+1)*C+x.wrap*E,(x.canonical.y+1)*C+x.wrap*E,T])})(t,o,c).getCorners(),m=o/-d[2];d[0]<0?(s.d8(p[0],p[0],[d[0]*m,0,0]),s.d8(p[3],p[3],[d[0]*m,0,0])):d[0]>0&&(s.d8(p[1],p[1],[d[0]*m,0,0]),s.d8(p[2],p[2],[d[0]*m,0,0])),d[1]<0?(s.d8(p[0],p[0],[0,d[1]*m,0]),s.d8(p[1],p[1],[0,d[1]*m,0])):d[1]>0&&(s.d8(p[2],p[2],[0,d[1]*m,0]),s.d8(p[3],p[3],[0,d[1]*m,0]));const y={};return y.vertices=p,y.planes=[$c(p[1],p[0],p[4]),$c(p[2],p[1],p[5]),$c(p[3],p[2],p[6]),$c(p[0],p[3],p[7])],y}addShadowReceiver(t,o,c){this._receivers.add(t,s.d9.fromTileIdAndHeight(t,o,c))}getMaxCascadeForTile(t){const o=this._receivers.get(t);return o&&o.lastCascade?o.lastCascade:0}}function $c(l,t,o){const c=s.av([],o,t),d=s.av([],l,t),p=s.bI([],c,d),m=s.ag(p);return m===0?[0,0,1,0]:(s.c5(p,p,1/m),[p[0],p[1],p[2],-s.bJ(p,t)])}function Ff(l){const t=l.properties.get("direction"),o=s.d4(t.x,t.y,t.z);o[2]=s.aA(o[2],0,75);const c=s.d6([o[0],o[1],o[2]]);return s.d5(c.x,c.y,c.z)}function bo(l,t,o){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=[m.x,m.y,m.z],x=o.properties.get("color-use-theme")==="none",T=o.properties.get("color"),E=o.properties.get("intensity"),C=Math.max(s.bJ([0,0,1],y),0),M=[0,0,0];s.c5(M,T.toPremultipliedRenderColor(x?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),E);const P=[0,0,0];return s.c5(P,d.toPremultipliedRenderColor(c?null:l.getLut(o.scope)).toArray01Linear().slice(0,3),C*p),s.db([M[0]>0?M[0]/(M[0]+P[0]):0,M[1]>0?M[1]/(M[1]+P[1]):0,M[2]>0?M[2]/(M[2]+P[2]):0])}function kf(l,t,o,c,d,p){const m=l.zoom,y=l.scale,x=l.worldSize,T=1/x,E=l.aspect,C=Math.sqrt(1+E*E)*Math.tan(.5*l.fovX),M=C*C,P=c-o,F=c+o;let z,B;M>P/F?(z=c,B=c*C):(z=.5*F*(1+M),B=.5*Math.sqrt(P*P+2*(c*c+o*o)*M+F*F*M*M));const j=l.projection.pixelsPerMeter(l.center.lat,x),Z=l._camera.getCameraToWorldMercator(),H=[0,0,-z*T];s.af(H,H,Z);let $=B*T;const le=function(We){return We[0]/=y,We[1]/=y,We[2]=s.cf(We[2],l._center.lat),We},ne=l._edgeInsets;if(!(ne.left===0&&ne.top===0&&ne.right===0&&ne.bottom===0||ne.left===ne.right&&ne.top===ne.bottom)){const We=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?j:1),et=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,o,c);et[8]=2*-l.centerOffset.x/l.width,et[9]=2*l.centerOffset.y/l.height;const ut=new Float64Array(16);s.cP(ut,et,We);const tt=new Float64Array(16);s.bl(tt,ut);const nt=s.cB.fromInvProjectionMatrix(tt,x,m,!0);for(const Et of nt.points){const wt=le(Et);$=Math.max($,s.c6(s.da([],H,wt)))}}$*=d/(d-1);const se=Math.acos(t[2]),ee=Math.atan2(-t[0],-t[1]),J=new Wa;J.position=H,J.setPitchBearing(se,ee);const ue=J.getWorldToCamera(x,j),_e=$*x,xe=Math.min(l._mercatorZfromZoom(17)*x*-2,-2*_e),Ae=J.getCameraToClipOrthographic(-_e,_e,-_e,_e,xe,(_e+p*j)/t[2]),Ee=new Float64Array(16);s.aB(Ee,Ae,ue);const Fe=s.d5(Math.floor(1e6*H[0])/1e6*x,Math.floor(1e6*H[1])/1e6*x,0),$e=.5*d,Te=[0,0,0];s.af(Te,Fe,Ee),s.c5(Te,Te,$e);const he=[Math.floor(Te[0]),Math.floor(Te[1]),Math.floor(Te[2])],ze=[0,0,0];s.av(ze,Te,he),s.c5(ze,ze,-1/$e);const Me=new Float64Array(16);return s.bA(Me),s.br(Me,Me,ze),s.aB(Ee,Me,Ee),[Ee,_e]}class Hc extends s.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,o){return s.dc(this.requestManager.transformRequest(o,s.R.Model).url).then(c=>{if(!c)return;const d=s.dd(c),p=new s.de(t,o,void 0,void 0,d);return p.computeBoundsAndApplyParent(),p}).catch(c=>{if(c&&c.status===404)return null;this.fire(new s.y(new Error(`Could not load model ${t} from ${o}: ${c.message}`)))})}load(t,o,c={forceReload:!1}){this.models[o]||(this.models[o]={});const d=Object.keys(t),p=[],m=[];for(const y of d){const x=t[y];this.hasURLBeenRequested(x)&&!c.forceReload||(this.modelByURL[x]={modelId:y,scope:o},p.push(this.loadModel(y,x)),m.push(y)),this.models[o][y]||(this.models[o][y]={model:null,numReferences:1})}this.numModelsLoading[o]=(this.numModelsLoading[o]||0)+m.length,Promise.allSettled(p).then(y=>{for(let x=0;x<y.length;x++){const{status:T}=y[x];if(T==="rejected")continue;const{value:E}=y[x];this.models[o][m[x]]||(this.models[o][m[x]]={model:null,numReferences:1}),this.models[o][m[x]].model=E}this.numModelsLoading[o]-=m.length,this.fire(new s.z("data",{dataType:"style"}))}).catch(y=>{this.fire(new s.y(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,o,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,o):this.getModelByURL(this.modelUris[o][t]))}getModel(t,o){return this.models[o]||(this.models[o]={}),this.models[o][t]?this.models[o][t].model:void 0}getModelByURL(t){if(!t)return null;const o=this.modelByURL[t];return o?this.models[o.scope][o.modelId].model:null}hasModelBeenAdded(t,o){return this.models[o]&&this.models[o][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,o,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(o);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===d)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:p,modelId:m}=this.modelByURL[d];this.models[p][m].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const c=this.modelUris[o];for(const d in t)c[d]=this.requestManager.normalizeModelURL(t[d])}
8reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const c={};for(const d of t)this.hasModel(d,o,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[o][d].numReferences++:this.modelUris[o][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[o][d]:!this.hasURLBeenRequested(d)&&s.df(d,!1)&&(this.modelUris[o][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[o][d]);this.load(c,o)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,o,c=!1,d=!1){if(this.models[o]&&this.models[o][t]&&(this.models[o][t].numReferences--,this.models[o][t].numReferences===0||d)){const p=this.modelUris[o][t];c||delete this.modelUris[o][t],delete this.modelByURL[p];const m=this.models[o][t].model;if(!m)return;delete this.models[o][t],m.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const o of Object.keys(this.models[t])){const c=this.models[t][o].model;delete this.models[t][o],c&&c.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,o){this.models[o]||(this.models[o]={});for(const c in this.models[o])this.models[o][c].model&&this.models[o][c].model.upload(t.context)}}const Zl=s.a6.colorTheme,Bs=new s.a9({data:new s.aa(Zl.data)});function p_(l){if(!l.metadata||!l.metadata.content_area)return;const t=s.o.devicePixelRatio,{left:o,top:c,width:d,height:p}=l.metadata.content_area,m=o*t,y=c*t;return[m,y,m+d*t,y+p*t]}function Bf(l){if(l)return l.map(([t,o])=>[t*s.o.devicePixelRatio,o*s.o.devicePixelRatio])}class m_{constructor(t,o,c){this.id=t,this.scope=o,this.sourceCache=c,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const o=this.sourceCache.getVisibleCoordinates();if(o.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof fn))return t;const d=o.map(m=>this.sourceCache.getTile(m)),p=c.getImages(d,Array.from(this.pendingRequests));for(const[m,y]of p)t.set(s.I.from({name:m,iconsetId:this.id}),y),this.pendingRequests.delete(m);for(const m of this.pendingRequests)this.missingRequests.add(m);return this.pendingRequests.clear(),t}}class yh{constructor(){s.aY(["_onIndoorUpdate"],this)}onAdd(t){return this._map=t,this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.style&&this._map.style.indoorManager.on("selector-update",o=>this._onIndoorUpdate(o)),this._container}_createButton(t,o){const c=Xe("button",t,this._container);return c.type="button",c.addEventListener("click",o),c}_createSeparator(){return Xe("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(t,o){this._map&&(t.setAttribute("aria-label",o),t.textContent=o)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.style&&(this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(t){if(!t||!t.floors)return this._model=t,void(this._container.style.display="none");const o=this._model;this._model=t,this._container.style.display="inline-block",this._container.style.borderRadius="8px",o&&Array.from(this._container.children).forEach(c=>c.remove()),t.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(t.floors,t.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const t=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const o=this._map;this._model&&o&&o._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});Xe("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&t.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(t),this._createSeparator()}_updateBuildingsButtonState(){const t=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");t&&this._model&&(this._model.activeFloorsVisible?t.classList.remove("mapboxgl-ctrl-level-button-selected"):t.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(t,o){for(let c=0;c<t.length;c++){const d=t[c],p=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(d.id)}),m=(d.name||"").trim(),y=d.zIndex.toString(),x=m?Array.from(m).slice(0,3).join(""):y;this._setButtonTitle(p,x),this._model&&d.id===this._model.selectedFloorId&&o&&p.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(p),c<t.length-1&&this._createSeparator()}}}class __ extends s.E{constructor(t){super(),this._style=t,this._buildings={}
8,this._indoorControl=null,this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},s.aY(["_updateUI"],this),this._style.on("style.load",()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",this._updateUI),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI),this._updateUI())})}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null,this._removeIndoorControl()}selectFloor(t){t===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=t,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(t){this._activeFloorsVisible=t,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(t){for(const[o,c]of Object.entries(t.buildings))if(this._buildings[o])for(const d of c.floorIds)this._buildings[o].floors[d]||(this._buildings[o].floors[d]=c.floors[d]);else this._buildings[o]=c;for(const o of t.activeFloors)this._activeFloors.add(o);this._updateIndoorSelector()}getIndoorTileOptions(t,o){const c=this._style.getIndoorSourceLayers(t,o);return c&&this._indoorState?{sourceLayers:c,indoorState:this._indoorState}:null}_addIndoorControl(){this._indoorControl||(this._indoorControl=new yh,this._style.map.addControl(this._indoorControl,"right"))}_removeIndoorControl(){this._indoorControl&&(this._indoorControl.onRemove(),this._indoorControl=null)}_updateUI(){const t=this._style.map.transform,o=(function(c,d,p,m){let y=null,x=Number.MAX_SAFE_INTEGER;if(m<16)return null;for(const[T,E]of Object.entries(c)){const C=E.center;if(C){const M=d.distanceTo(s.aT.convert(C));M<x&&p.contains(C)&&(x=M,y=T)}}return y})(this._buildings,t.center,t.getBounds(),t.zoom);o!==this._closestBuildingId&&(this._closestBuildingId=o,this._updateIndoorSelector())}_updateIndoorSelector(){const t=this._buildings,o=this._closestBuildingId,c=o&&t?t[o]:void 0;if(!c)return this._removeIndoorControl(),void this.fire(new s.z("selector-update",{selectedFloorId:null,activeFloorsVisible:this._activeFloorsVisible,floors:[]}));this._addIndoorControl();let d=null;for(const m of c.floorIds)if(this._activeFloors&&this._activeFloors.has(m)){d=m;break}const p=Array.from(c.floorIds).map(m=>({id:m,name:c.floors[m].name,zIndex:c.floors[m].zIndex})).sort((m,y)=>y.zIndex-m.zIndex).filter((m,y,x)=>y===0||m.zIndex!==x[y-1].zIndex);this.fire(new s.z("selector-update",{selectedFloorId:d,activeFloorsVisible:this._activeFloorsVisible,floors:p}))}_updateActiveFloors(){const t=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:t,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}const ds=(l,t)=>me(l,t&&t.filter(o=>o.identifier!=="source.canvas")),Nf=s.aH(di,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),Vf=s.aH(di,["setCenter","setZoom","setBearing","setPitch"]),Zc=new Set(["background","sky","slot","custom"]),xh={version:8,layers:[],sources:{}},Ns={duration:300,delay:0};class Vn extends s.E{constructor(t,o={}){super(),this.map=t,this.scope=o.scope||"",this.globalId=null,this.fragments=[],this.importDepth=o.importDepth||0,this.importsCache=o.importsCache||new Map,this.resolvedImports=o.resolvedImports||new Set,this.transition=Object.assign({},Ns),this._buildingIndex=new Bl(this),this.crossTileSymbolIndex=new Ar,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=o.styleChanges||new _r,this._hasDataDrivenEmissive=!1,this.indoorManager=new __(this),this.dispatcher=o.dispatcher?o.dispatcher:new s.D(s.dh(),this),o.imageManager?this.imageManager=o.imageManager:(this.imageManager=new As(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=o.glyphManager?o.glyphManager:new s.di(t._requestManager,o.localFontFamily?s.dj.all:o.localIdeographFontFamily?s.dj.ideographs:s.dj.none,o.localFontFamily||o.localIdeographFontFamily),o.modelManager?this.modelManager=o.modelManager:(this.modelManager=new Hc(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={}
8,this._order=[],this._markersNeedUpdate=!1,this.options=o.configOptions?o.configOptions:new Map,this._configDependentLayers=o.configDependentLayers?o.configDependentLayers:new Set,this._indoorDependentLayers=o.indoorDependentLayers?o.indoorDependentLayers:new Set,this._config=o.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:o.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=o.initialConfig,this.dispatcher.broadcast("setReferrer",s.dk());const c=this;this._rtlTextPluginCallback=Vn.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(p,m)=>{if(s.dl(p),m&&m.every(y=>y))for(const y in c._sourceCaches){const x=c._sourceCaches[y],T=x.getSource().type;T!=="vector"&&T!=="geojson"||x.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const p=this.getOwnSource(d.sourceId);if(p&&p.vectorLayerIds)for(const m in this._layers){const y=this._layers[m];y.source===p.id&&this._validateLayer(y)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(s.h(t))return t;const o=s.dm(t);if(!o.startsWith("http"))try{return new URL(o,location.href).toString()}catch{return o}return o}return`json://${s.dn(JSON.stringify(t))}`}_diffStyle(t,o,c){this.globalId=this._getGlobalId(t);const d=(p,m)=>{try{m(null,this.setState(p,c))}catch(y){m(y,!1)}};if(typeof t=="string"){const p=this.map._requestManager.normalizeStyleURL(t),m=this.map._requestManager.transformRequest(p,s.R.Style);s.m(m,(y,x)=>{y?this.fire(new s.y(y)):x&&d(x,o)})}else typeof t=="object"&&d(t,o)}loadURL(t,o={}){this.fire(new s.z("dataloading",{dataType:"style"}));const c=typeof o.validate=="boolean"?o.validate:!s.h(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,o.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const p=this.map._requestManager.transformRequest(t,s.R.Style);this._request=s.m(p,(m,y)=>{if(this._request=null,m)this.fire(new s.y(m));else if(y)return this.importsCache.set(t,y),this._load(y,c)})}loadJSON(t,o={}){this.fire(new s.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=s.o.frame(()=>{this._request=null,this._load(t,o.validate!==!1)})}loadEmpty(){this.fire(new s.z("dataloading",{dataType:"style"})),this._load(xh,!1)}_loadImports(t,o,c){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of t){const m=this._createFragmentStyle(p),y=new Promise(E=>{m.once("style.import.load",E),m.once("error",E)}).then(()=>this.mergeAll());if(d.push(y),this.resolvedImports.has(p.url)){m.loadEmpty();continue}const x=p.data||this.importsCache.get(p.url);x?(m.loadJSON(x,{validate:o}),this._isInternalStyle(x)&&(m.globalId=null)):p.url?m.loadURL(p.url,{validate:o}):m.loadEmpty();const T={style:m,id:p.id,config:p.config};if(c){const E=this.fragments.findIndex(({id:C})=>C===c);this.fragments=this.fragments.slice(0,E).concat(T).concat(this.fragments.slice(E))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(t=this,o=new Set){for(const c of t.fragments)c.style.globalId&&o.add(c.style.globalId),this.getImportGlobalIds(c.style,o);return[...o.values()]}_createFragmentStyle(t){const o=this.scope?s.B(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[o];(t.config||d)&&(c=Object.assign({},t.config,d));const p=new Vn(this.map,{scope:o,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return p.setEventedParent(this.map,{style:p}),p}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indo
8orDependentLayers),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(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,o){if(this._isInternalStyle(t)){const p=Object.assign({},xh,{imports:[{id:"basemap",data:t,url:""}]},t.center?{center:t.center}:{},t.bearing?{bearing:t.bearing}:{},t.pitch?{pitch:t.pitch}:{},t.zoom?{zoom:t.zoom}:{},t.light?{light:t.light}:{});return this._importedAsBasemap=!0,void this._load(p,o)}if(this.updateConfig(this._config,t.schema),o&&ds(this,Kn(t)))return;this._loaded=!0,this.stylesheet=s.dp(t);const c=()=>{for(const x in t.sources)this.addSource(x,t.sources[x],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const x in t.iconsets)this.addIconset(x,t.iconsets[x]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const p=ch(this.stylesheet.layers);if(this._order=p.map(x=>x.id),this.stylesheet.light&&s.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const x=this.stylesheet.lights[0];this.light=new Re(x.properties,x.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Re(this.stylesheet.light)),this._layers={};for(const x of p){const T=s.du(x,this.scope,this._styleColorTheme.lut,this.options);T.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(T.fqid),T.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(T.fqid),this._hasAppearances=this._hasAppearances||T.getAppearances().length!==0,T.setEventedParent(this,{layer:{id:T.id}}),this._layers[T.id]=T;const E=this.getOwnLayerSourceCache(T),C=!!this.directionalLight&&this.directionalLight.shadowsEnabled();E&&T.canCastShadows()&&C&&(E.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const m=this.stylesheet.terrain;m&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(m,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.z("data",{dataType:"style"}));const y=this.isRootStyle();t.imports?this._loadImports(t.imports,o).then(()=>{this._reloadImports(),this.fire(new s.z(y?"style.load":"style.import.load"))}).catch(x=>{this.fire(new s.y(new Error("Failed to load imports",x))),this.fire(new s.z(y?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.z(y?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const d=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(d){const p=this._evaluateColorThemeData(d);this._loadColorTheme(p).then(()=>{c()}).catch(m=>{s.w(`Couldn't load color theme from the stylesheet: ${m}`),c()})}else this._styleColorTheme.lut=null,c()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(t=>t.style.hasAppearances())}mergeAll(){let t,o,c,d,p,m,y,x,T,E;const C={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(M=>{if(M.stylesheet){if(M.light!=null&&(t=M.light),M.stylesheet.lights)for(const P of M.stylesheet.lights)P.type==="ambient"&&M.ambientLight!=null&&(o=M.ambientLight),P.type==="directional"&&M.directionalLight!=null&&(c=M.directionalLight);d=this._prioritizeTerrain(d,M.terrain,M.stylesheet.terrain),M.stylesheet.fog&&M.fog!=null&&(p=M.fog),M.stylesheet.snow&&M.snow!=null&&(m=M.snow),M.stylesheet.rain&&M.rain!=null&&(y=M.rain),M.stylesheet.camera!=null&&(E=M.stylesheet.camera),M.stylesheet.projection!=null&&(x=M.stylesheet.projection),M.stylesheet.transition!=null&&(T=M.stylesheet.transition),C[M.scope]=M._styleColorTheme}}),this.light=t,this.ambientLight=o,this.directionalLight=c,this.fog=p,this.snow=m,this.rain=y,this._styleColorThemeForScope=C,d===null?delete this.terrain:this.terrain=d,this.camera=E||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition=Object.assign({},Ns,T),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(t){const o=c=>
8{for(const d of c.fragments)o(d.style);t(c)};o(this)}_prioritizeTerrain(t,o,c){const d=t&&t.drapeRenderMode===0;return c===null?o&&o.drapeRenderMode===0?o:d?t:null:o!=null&&(!t||d||o&&o.drapeRenderMode===1)?o:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(o=>{t=this._prioritizeTerrain(t,o.terrain,o.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(o=>{o.stylesheet.projection!=null&&(t=o.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},o={},c={};this.forEachFragmentStyle(d=>{for(const p in d._sourceCaches){const m=s.B(p,d.scope);t[m]=d._sourceCaches[p]}for(const p in d._otherSourceCaches){const m=s.B(p,d.scope);o[m]=d._otherSourceCaches[p]}for(const p in d._symbolSourceCaches){const m=s.B(p,d.scope);c[m]=d._symbolSourceCaches[p]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=o,this._mergedSymbolSourceCaches=c}mergeIndoor(){this.forEachFragmentStyle(t=>{if(t.stylesheet&&t.stylesheet.indoor)for(const o of Object.values(t.stylesheet.indoor)){const c=o,d=s.B(c.sourceId,t.scope);this._mergedIndoor[d]=new Set(c.sourceLayers||[])}})}mergeLayers(){const t={},o=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(m=>{for(const y of m._order){const x=m._layers[y];if(x.type==="slot"){const T=s.dq(y);if(t[T])continue;t[T]=[]}x.slot&&t[x.slot]?t[x.slot].push(x):o.push(x)}}),this._mergedOrder=[];let d=-1;const p=(m=[])=>{for(const y of m)if(y.type==="slot"){const x=s.dq(y.id);t[x]&&p(t[x]),this._mergedSlots.push(x)}else{const x=s.B(y.id,y.scope);this._mergedOrder.push(x),c[x]=y,y.is3D(!!this.terrain)&&(this._has3DLayers=!0,d=this._mergedOrder.length-1),y.type==="circle"&&(this._hasCircleLayers=!0),y.type==="symbol"&&(this._hasSymbolLayers=!0),y.type==="clip"&&(this._clipLayerPresent=!0)}};if(p(o),this._has3DLayers){const m={};for(let y=0;y<this._mergedOrder.length;++y){const x=this._mergedOrder[y];m[x]=y===d?1:y<d?c[x].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((y,x)=>m[y]-m[x])}this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?(function(o,c,d){const p=Object.assign({},c);for(const y of Object.keys(Zl))p[y]===void 0&&(p[y]=Zl[y].default);const m=new s.a8(Bs,o,new Map(d));return m.setTransitionOrValue(p,d),m.untransitioned().possiblyEvaluate(new s.ac(0,{worldview:void 0}))})(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const o=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const p="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let m=t;m.startsWith(p)||(m=p+m);const y=s.I.from("mapbox-reserved-lut"),x=new Image;x.src=m,x.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},x.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==o)return void c();this._styleColorTheme.lutLoading=!1;const{width:T,height:E,data:C}=s.o.getImageData(x);if(E>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==E*E)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new s.q({width:T,height:E},C),pixelRatio:1,sdf:!1,usvg:!1,version:0});const M=this.imageManager.getImage(y,this.scope);M?(this._styleColorTheme.lut={image:M.data,data:t},c()):d(new Error("Missing LUT image."))}})}getLut(t){const o=this._styleColorThemeForScope[t];return o?o.lut:null}setProjection(t){t?this.stylesheet.projection=t: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(t){this._spriteRequest=(function(o,c,d){let p,m,y;const x=s.o.devicePixelRatio>1?"@2x":"";let T=s.m(c.transformRequest(c.normalizeSpriteURL(o,x,".json"),s.R.SpriteJSON),(M,P)=>{T=null,y||(y=M,p=P,C())}),E=s.n(c.transformRequest(c.normalizeSpriteURL(o,x,".png"),s.R.SpriteImage),(M,P)=>{E=null,y||(y=M,m=P,C())});function C(){if(y)d(y);else if(p&&m){const M=s.o.getImageData(m),P={};for(const F in p){const{width:z,height:B,x:j,y:Z,sdf:H,pixelRatio:$,stretchX:le,stretchY:ne,content:se}=p[F],ee=new s.q({width:z,height:B});s.q.copy(M,ee,{x:j,y:Z},{x:0,y:0},{width:z,height:B},null),P[F]={data:ee,pixelRatio:$!==void 0?$:1,sdf:H!==void 0&&H,stretchX:le,stretchY:ne,content:se,usvg:!1,version:0}}d(null,P)}}return{cancel(){T&&(T.cancel(),T=null),E&&(E.cancel(),E=null)}}})(t,this.map._requestManager,(o,c)=>{if(this._spriteRequest=null,o)this.fire(new s.y(o));else if(c){const d=new Map;for(const p in c)d.set(s.I.from(p),c[p]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.z("data",{dataType:"style"}))})}
8addIconset(t,o){if(o.type==="sprite")return void this._loadSprite(o.url);const c=this.getOwnSourceCache(o.source);if(!c)return void this.fire(new s.y(new Error(`Source "${o.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=c.getSource();if(d.type!=="raster-array")return void this.fire(new s.y(new Error(`Source "${o.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const p=new m_(t,this.scope,c);this.imageManager.addImageProvider(p,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!s.h(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const o=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(p,m)=>{if(this._spriteRequest=null,p)o?this._loadSprite(t):this.fire(new s.y(p));else if(m){const y=new Map;for(const x in m)y.set(s.I.from(x),m[x]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.z("data",{dataType:"style"}))},s.bu((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),s.R.Iconset),(p,m)=>{if(p)return void d(p);const y={},x=s.dg(new s.bt(m));for(const T of x.icons){const E={version:1,pixelRatio:s.o.devicePixelRatio,content:p_(T),stretchX:T.metadata?Bf(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?Bf(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=E}d(null,y)}))}_validateLayer(t){const o=this.getOwnSource(t.source);if(!o)return;const c=t.sourceLayer;c&&(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(c)===-1)&&this.fire(new s.y(new Error(`Source layer "${c}" does not exist on source "${o.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,o)=>{const c=this.fragments[o];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const o in this._sourceCaches){const c=this._sourceCaches[o].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const o=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&o.push(d.serialize())}return o}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const t in this._mergedLayers){const o=this._mergedLayers[t];if(o._transitionablePaint&&o._transitionablePaint._values){const c=o._transitionablePaint._values["line-emissive-strength"];if(c&&c.value&&c.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const o=this.getOwnLayer(t);if(o)return o;this.fire(new s.y(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const o=this.getOwnSource(t);if(o)return o;this.fire(new s.y(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,o){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const p=t.getProgramIds();if(p)for(const m of p){const y=t.getDefaultProgramParams(m,o.zoom,this._styleColorTheme.lut);y&&(c.style=this,this.fog&&(c._fogVisible=!0,y.overrideFog=!0,c.getOrCreateProgram(m,y)),c._fogVisible=!1,y.overrideFog=!1,c.getOrCreateProgram(m,y),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(y.overrideRtt=!0,c.getOrCreateProgram(m,y)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const o=this.calculateLightsBrightness();t.brightness=o||0,o!==this._brightness&&(this._brightness=o,this.dispatcher.broadcast("setBrightness",o)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const y=this._changes.getLayerUpdatesByScope();for(const x in y){const{updatedIds:T,removedIds:E}=y[x];(T||E)&&(this._updateWorkerLayers(x,T,E),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const p={};for(const y in this._mergedSourceCaches){const x=this._mergedSourceCaches[y];p[y]=x.used,x.used=!1,x.tileCoverLift=0}for(const y of this._mergedOrder){const x=this._mergedLayers[y];if(x.visibility!=="none"&&x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)){const T=this.getLayerSourceCache(x);
8T&&(T.used=!0,T.tileCoverLift=Math.max(T.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(x,t)}):this.precompilePrograms(x,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&d&&this.mergeLayers();const m=this.imageManager.getPendingImageProviders();for(const y of m)y.sourceCache.used=!0;for(const y in p){const x=this._mergedSourceCaches[y];p[y]!==x.used&&x.getSource().fire(new s.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new s.z("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const o of t){const c=o.resolvePendingRequests(),d=this.getFragmentStyle(o.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const o in this._mergedSourceCaches){const c=this._mergedSourceCaches[o].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[o].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const o in t)this._changes.resetUpdatedImages(o)}_updateWorkerLayers(t,o,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:o?d._serializeLayers(o):[],scope:t,removedIds:c||[],options:d.options})}setState(t,o){if(this._checkLoaded(),ds(this,Kn(t)))return!1;(t=s.dp(t)).layers=ch(t.layers);const c=(function(m,y){if(!m)return[{command:di.setStyle,args:[y]}];let x=[];try{if(!s.by(m.version,y.version))return[{command:di.setStyle,args:[y]}];if(s.by(m.center,y.center)||x.push({command:di.setCenter,args:[y.center]}),s.by(m.zoom,y.zoom)||x.push({command:di.setZoom,args:[y.zoom]}),s.by(m.bearing,y.bearing)||x.push({command:di.setBearing,args:[y.bearing]}),s.by(m.pitch,y.pitch)||x.push({command:di.setPitch,args:[y.pitch]}),s.by(m.sprite,y.sprite)||x.push({command:di.setSprite,args:[y.sprite]}),s.by(m.glyphs,y.glyphs)||x.push({command:di.setGlyphs,args:[y.glyphs]}),s.by(m.imports,y.imports)||(function(P=[],F=[],z){F=F||[];const B=(P=P||[]).map(zs),j=F.map(zs),Z=P.reduce(Vl,{}),H=F.reduce(Vl,{}),$=B.slice();let le,ne,se,ee;for(le=0,ne=0;le<B.length;le++)se=B[le],H.hasOwnProperty(se)?ne++:(z.push({command:di.removeImport,args:[se]}),$.splice($.indexOf(se,ne),1));for(le=0,ne=0;le<j.length;le++)se=j[j.length-1-le],$[$.length-1-le]!==se&&(Z.hasOwnProperty(se)?(z.push({command:di.removeImport,args:[se]}),$.splice($.lastIndexOf(se,$.length-ne),1)):ne++,ee=$[$.length-le],z.push({command:di.addImport,args:[H[se],ee]}),$.splice($.length-le,0,se));for(const J of F){const ue=Z[J.id];ue&&(delete ue.data,s.by(ue,J)||z.push({command:di.updateImport,args:[J.id,J]}))}})(m.imports,y.imports,x),s.by(m.transition,y.transition)||x.push({command:di.setTransition,args:[y.transition]}),s.by(m.light,y.light)||x.push({command:di.setLight,args:[y.light]}),s.by(m.fog,y.fog)||x.push({command:di.setFog,args:[y.fog]}),s.by(m.snow,y.snow)||x.push({command:di.setSnow,args:[y.snow]}),s.by(m.rain,y.rain)||x.push({command:di.setRain,args:[y.rain]}),s.by(m.projection,y.projection)||x.push({command:di.setProjection,args:[y.projection]}),s.by(m.lights,y.lights)||x.push({command:di.setLights,args:[y.lights]}),s.by(m.camera,y.camera)||x.push({command:di.setCamera,args:[y.camera]}),s.by(m.iconsets,y.iconsets)||(function(P,F,z){let B;for(B in F=F||{},P=P||{})P.hasOwnProperty(B)&&(F.hasOwnProperty(B)||z.push({command:di.removeIconset,args:[B]}));for(B in F){if(!F.hasOwnProperty(B))continue;const j=F[B];P.hasOwnProperty(B)?s.by(P[B],j)||(z.push({command:di.removeIconset,args:[B]}),z.push({command:di.addIconset,args:[B,j]})):z.push({command:di.addIconset,args:[B,j]})}})(m.iconsets,y.iconsets,x),!s.by(m["color-theme"],y["color-theme"]))return[{command:di.setStyle,args:[y]}];const T={},E=[];(function(P,F,z,B){let j;for(j in F=F||{},P=P||{})P.hasOwnProperty(j)&&(F.hasOwnProperty(j)||Fc(j,z,B));for(j in F){if(!F.hasOwnProperty(j))continue;const Z=F[j];P.hasOwnProperty(j)?s.by(P[j],Z)||(P[j].type==="geojson"&&Z.type==="geojson"&&Pf(P,F,j)?z.push({command:di.setGeoJSONSourceData,args:[j,Z.data]}):Cf(j,F,z,B)):Ga(j,F,z)}})(m.sources,y.sources,E,T);const C=[];
8m.layers&&m.layers.forEach(P=>{P.source&&T[P.source]?x.push({command:di.removeLayer,args:[P.id]}):C.push(P)});let M=m.terrain;M&&T[M.source]&&(x.push({command:di.setTerrain,args:[void 0]}),M=void 0),x=x.concat(E),s.by(M,y.terrain)||x.push({command:di.setTerrain,args:[y.terrain]}),(function(P,F,z){F=F||[];const B=(P=P||[]).map(zs),j=F.map(zs),Z=P.reduce(Vl,{}),H=F.reduce(Vl,{}),$=B.slice(),le=Object.create(null);let ne,se,ee,J,ue,_e,xe;for(ne=0,se=0;ne<B.length;ne++)ee=B[ne],H.hasOwnProperty(ee)?se++:(z.push({command:di.removeLayer,args:[ee]}),$.splice($.indexOf(ee,se),1));for(ne=0,se=0;ne<j.length;ne++)ee=j[j.length-1-ne],$[$.length-1-ne]!==ee&&(Z.hasOwnProperty(ee)?(z.push({command:di.removeLayer,args:[ee]}),$.splice($.lastIndexOf(ee,$.length-se),1)):se++,_e=$[$.length-ne],z.push({command:di.addLayer,args:[H[ee],_e]}),$.splice($.length-ne,0,ee),le[ee]=!0);for(ne=0;ne<j.length;ne++)if(ee=j[ne],J=Z[ee],ue=H[ee],!le[ee]&&!s.by(J,ue))if(s.by(J.source,ue.source)&&s.by(J["source-layer"],ue["source-layer"])&&s.by(J.type,ue.type)){for(xe in Nl(J.layout,ue.layout,z,ee,null,di.setLayoutProperty),Nl(J.paint,ue.paint,z,ee,null,di.setPaintProperty),s.by(J.slot,ue.slot)||z.push({command:di.setSlot,args:[ee,ue.slot]}),s.by(J.filter,ue.filter)||z.push({command:di.setFilter,args:[ee,ue.filter]}),s.by(J.minzoom,ue.minzoom)&&s.by(J.maxzoom,ue.maxzoom)||z.push({command:di.setLayerZoomRange,args:[ee,ue.minzoom,ue.maxzoom]}),J)J.hasOwnProperty(xe)&&xe!=="layout"&&xe!=="paint"&&xe!=="filter"&&xe!=="metadata"&&xe!=="minzoom"&&xe!=="maxzoom"&&xe!=="slot"&&(xe.indexOf("paint.")===0?Nl(J[xe],ue[xe],z,ee,xe.slice(6),di.setPaintProperty):s.by(J[xe],ue[xe])||z.push({command:di.setLayerProperty,args:[ee,xe,ue[xe]]}));for(xe in ue)ue.hasOwnProperty(xe)&&!J.hasOwnProperty(xe)&&xe!=="layout"&&xe!=="paint"&&xe!=="filter"&&xe!=="metadata"&&xe!=="minzoom"&&xe!=="maxzoom"&&xe!=="slot"&&(xe.indexOf("paint.")===0?Nl(J[xe],ue[xe],z,ee,xe.slice(6),di.setPaintProperty):s.by(J[xe],ue[xe])||z.push({command:di.setLayerProperty,args:[ee,xe,ue[xe]]}))}else z.push({command:di.removeLayer,args:[ee]}),_e=$[$.lastIndexOf(ee)+1],z.push({command:di.addLayer,args:[ue,_e]})})(C,y.layers,x)}catch(T){console.warn("Unable to compute style diff:",T),x=[{command:di.setStyle,args:[y]}]}return x})(this.serialize(),t).filter(m=>!(m.command in Vf));if(c.length===0)return!1;const d=c.filter(m=>!(m.command in Nf));if(d.length>0)throw new Error(`Unimplemented: ${d.map(m=>m.command).join(", ")}.`);const p=[];return c.forEach(m=>{p.push(this[m.command](...m.args))}),o&&Promise.all(p).then(o).catch(o),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(t.size===0)return this;for(const[o,c]of t.entries()){if(this.getImage(o))return this.fire(new s.y(new Error(`An image with the name "${o.name}" already exists.`)));this.imageManager.addImage(o,this.scope,c),this._changes.updateImage(o,this.scope)}return this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this}addImage(t,o){return this.getImage(t)?this.fire(new s.y(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,o),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this)}updateImage(t,o,c=!1){this.imageManager.updateImage(t,this.scope,o),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this):this.fire(new s.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(t){return this.modelManager.addModelURLs(t,this.getActualScope()),this._updateWorkerModels(),this.fire(new s.z("data",{dataType:"style"})),this}addModel(t,o,c={}
vendor: 5,397 bytes, line 8
8){return this._checkLoaded(),this._validate(fe,`models.${t}`,o,null,c)||(this.modelManager.addModel(t,o,this.getActualScope()),this.fire(new s.z("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.getActualScope())}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.getActualScope(),!1,!0),this.fire(new s.z("data",{dataType:"style"})),this):this.fire(new s.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(t,o,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(oh,`sources.${t}`,o,null,c))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const d=ha(t,o,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const p=m=>{const y=(m?"symbol:":"other:")+d.id,x=s.B(y,this.scope),T=this._sourceCaches[y]=new Mn(x,d,m);(m?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.onAdd(this.map)};p(!1),o.type!=="vector"&&o.type!=="geojson"||p(!0),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const o=this.getOwnSource(t);if(!o)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===t)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([p,m])=>m.type==="source"&&m.source===t);if(d)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const p=s.dq(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new s.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),o.setEventedParent(null),o.onRemove&&o.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,o){this._checkLoaded(),this.getOwnSource(t).setData(o),this._changes.setDirty()}getOwnSource(t){const o=this.getOwnSourceCache(t);return o&&o.getSource()}getOwnSources(){const t=[];for(const o in this._otherSourceCaches){const c=this.getOwnSourceCache(o);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const o in t){const c=t[o]._tiles;for(const d in c){const p=c[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const o=this._getTransitionParameters();for(const p of t){if(this._validate(Ke,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(o)}else this.ambientLight=new si(p,Yi(),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(o)}else this.directionalLight=new si(p,Ri(),this.scope,this.options)}}const c=Object.assign(o,{worldview:this.map.getWorldview()}),d=new s.ac(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,o=this.ambientLight;if(!t||!o)return;const c=M=>.2126*(M[0]<=.03928?M[0]/12.92:Math.pow((M[0]+.055)/1.055,2.4))+.7152*(M[1]<=.03928?M[1]/12.92:Math.pow((M[1]+.055)/1.055,2.4))+.0722*(M[2]<=.03928?M[2]/12.92:Math.pow((M[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=1-s.d4(m.x,m.y,m.z)[2]/90,x=c(d)*p*y,T=o.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),E=o.properties.get("intensity"),C=c(T)*E;return Number(((x+C)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(s.dr(t)){const o=s.ds(t),c=this.fragments.find(({id:p})=>p===o);if(!c)return;const d=s.dq(t);return c.style.getFragmentStyle(d)}{const o=this.fragments.find(({id:c})=>c===t);return o?o.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const o={},c=(d,p="")=>`${d}::${p}`;this._featuresetSelectors={};for(const d in t){const p=this._featuresetSelectors[d]=[];
8for(const m of t[d].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){s.w(`Layer is undefined for selector: ${m.layer}`);continue}const T=c(x.source,x.sourceLayer);if(T in o&&o[T]!==m.featureNamespace){s.w(`"featureNamespace ${m.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}o[T]=m.featureNamespace}let y;if(m.properties)for(const x in m.properties){const T=s.U(m.properties[x]);T.result==="success"&&(y=y||{},y[x]=T.value)}p.push({layerId:m.layer,namespace:m.featureNamespace,properties:y,uniqueFeatureID:m._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const o=this.getFragmentStyle(t);if(!o||!o.stylesheet.featuresets)return[];const c=[];for(const d in o.stylesheet.featuresets)c.push({featuresetId:d,importId:o.scope?o.scope:void 0});return c}getFeaturesetLayers(t,o){const c=this.getFragmentStyle(o),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new s.y(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const p=[];for(const m of d[t].selectors){const y=c.getOwnLayer(m.layer);y&&p.push(y)}return p}getConfigProperty(t,o){const c=this.getFragmentStyle(t);if(!c)return null;const d=s.B(o,c.scope),p=c.options.get(d),m=p?p.value||p.default:null;return m?m.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(t,o){const c=s.B(t,o);return this._mergedIndoor[c]}setIndoorData(t,o){this.indoorManager.setIndoorData(o)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(t,o,c){const d=this.getFragmentStyle(t);if(!d)return;const p=d.stylesheet.schema;if(!p||!p[o])return;const m=s.U(c);if(m.result!=="success")return void ds(this,m.value);const y=m.value.expression,x=s.B(o,d.scope),T=d.options.get(x);if(!T)return;let E;const{minValue:C,maxValue:M,stepValue:P,type:F,values:z}=p[o],B=s.U(p[o].default);B.result==="success"&&(E=B.value.expression),E?(this.options.set(x,Object.assign({},T,{value:y,default:E,minValue:C,maxValue:M,stepValue:P,type:F,values:z})),this.updateConfigDependencies(o)):this.fire(new s.y(new Error(`No schema defined for the config option "${o}" in the "${t}" fragment.`)))}getConfig(t){const o=this.getFragmentStyle(t);if(!o)return null;const c=o.stylesheet.schema;if(!c)return null;const d={};for(const p in c){const m=s.B(p,o.scope),y=o.options.get(m),x=y?y.value||y.default:null;d[p]=x?x.serialize():null}return d}setConfig(t,o){const c=this.getFragmentStyle(t);c&&(c.updateConfig(o,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const o=this.getFragmentStyle(t);return o?o.stylesheet.schema:null}setSchema(t,o){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=o,c.updateConfig(c._config,o),this.updateConfigDependencies())}updateConfig(t,o){if(this._config=t,t||o)if(o)for(const c in o){let d,p;const m=s.U(o[c].default);if(m.result==="success"&&(d=m.value.expression),t&&t[c]!==void 0){const M=s.U(t[c]);M.result==="success"&&(p=M.value.expression)}const{minValue:y,maxValue:x,stepValue:T,type:E,values:C}=o[c];if(d){const M=s.B(c,this.scope);this.options.set(M,{default:d,value:p,minValue:y,maxValue:x,stepValue:T,type:E,values:C})}else this.fire(new s.y(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new s.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(t,o=()=>!0){for(const c of t){const d=this.getLayer(c);d&&o(d)&&(d.possiblyEvaluateVisibility(),this._updateLayer(d),this._changes.setDirty())}}updateConfigDependencies(t){this._updateLayers(this._configDependentLayers,o=>!t||o.expressionDependencies.configDependencies.has(t)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(o=>{const c=o._styleColorTheme.colorThemeOverride?o._styleColorTheme.colorThemeOverride:o._styleColorTheme.colorTheme;if(c){const d=o._evaluateColorThemeData(c);(!o._styleColorTheme.lut&&d!==""||o._styleColorTheme.lut&&d!==o._styleColorTheme.lut.data)&&o.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,o,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new s.y(new Error(`Layer with i
8d "${d}" already exists on this map`)));let p;if(t.type==="custom"){if(ds(this,s.dt(t)))return;p=s.du(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=s.dp(t),t=Object.assign(t,{source:d})),this._validate(ye,`layers.${d}`,t,{arrayIndex:-1},c))return;p=s.du(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}})}const m=s.B(p.source,p.scope);p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(m),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(m);let y=this._order.length;if(o){const C=this._order.indexOf(o);if(C===-1)return void this.fire(new s.y(new Error(`Layer with id "${o}" does not exist on this map.`)));p.slot&&p.slot!==this._layers[o].slot?s.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):y=C}this._order.splice(y,0,d),this._handleLayerOrderChange(),this._layers[d]=p;const x=this.getOwnLayerSourceCache(p),T=!!this.directionalLight&&this.directionalLight.shadowsEnabled();x&&p.canCastShadows()&&T&&(x.castsShadows=!0);const E=this._changes.getRemovedLayer(p);if(E&&p.source&&x&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const C=s.B(p.source,p.scope);E.type!==p.type?this._changes.updateSourceCache(C,"clear"):(this._changes.updateSourceCache(C,"reload"),x.pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map),p.scope=this.scope,this.mergeLayers()}moveLayer(t,o){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===o)return;const d=this._order.indexOf(t);this._order.splice(d,1);let p=this._order.length;if(o){const m=this._order.indexOf(o);
8if(m===-1)return void this.fire(new s.y(new Error(`Layer with id "${o}" does not exist on this map.`)));c.slot&&c.slot!==this._layers[o].slot?s.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):p=m}this._order.splice(p,0,t),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(t){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;o.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(o.fqid),this._indoorDependentLayers.delete(o.fqid),this._changes.removeLayer(o);const d=this.getOwnLayerSourceCache(o);if(d&&d.castsShadows){let p=!1;for(const m in this._layers)if(this._layers[m].source===o.source&&this._layers[m].canCastShadows()){p=!0;break}d.castsShadows=p}o.onRemove&&o.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const o in this._layers)if(this._layers[o].type===t)return!0;return!1}setLayerZoomRange(t,o,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===o&&d.maxzoom===c||(o!=null&&(d.minzoom=o),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,o){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==o&&(c.slot=o,this._updateLayer(c))}setFilter(t,o,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!s.by(d.filter,o))return o==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(N,`layers.${d.id}.filter`,o,{layerType:d.type},c)||(d.filter=s.dp(o),this._updateLayer(d)))}getFilter(t){const o=this._checkLayer(t);if(o)return s.dp(o.filter)}setLayoutProperty(t,o,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!s.by(p.getLayoutProperty(o),c)){if(c!=null&&(!d||d.validate!==!1)&&ds(p,Q.call(Kn,{key:`layers.${t}.layout.${o}`,layerType:p.type,objectKey:o,value:c,styleSpec:s.a6,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(o,c),p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(p.fqid),this._updateLayer(p)}}setLayerProperty(t,o,c,d={}){this._checkLoaded();const p=this._checkLayer(t);p&&(o==="appearances"?(p.setAppearances(c),this._changes.setDirty()):p.isPaintProperty(o)?this.setPaintProperty(t,o,c,d):this.setLayoutProperty(t,o,c,d))}getLayoutProperty(t,o){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(o)}setPaintProperty(t,o,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(!p||s.by(p.getPaintProperty(o),c)||c!=null&&(!d||d.validate!==!1)&&ds(p,q.call(Kn,{key:`layers.${t}.paint.${o}`,layerType:p.type,objectKey:o,value:c,styleSpec:s.a6})))return;const m=p.setPaintProperty(o,c);p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(p.fqid),m&&this._updateLayer(p),this._changes.updatePaintProperties(p)}getPaintProperty(t,o){const c=this._checkLayer(t);if(c)return c.getPaintProperty(o)}setFeatureState(t,o){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,E=this.getFragmentStyle(T),C=E.getFeaturesetLayers(x);for(const{source:M,sourceLayer:P}of C)E.setFeatureState({id:t.id,source:M,sourceLayer:P},o)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.setFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},o)}return}const c=t.source,d=t.sourceLayer,p=this._checkSource(c);if(!p)return;const m=p.type;if(m==="geojson"&&d)return void this.fire(new s.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new s.y(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.setFeatureState(d,t.id,o)}removeFeatureState(t,o){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,E=this.getFragmentStyle(T),C=E.getFeaturesetLayers(x);for(const{source:M,sourceLayer:P}of C)E.removeFeatureState({id:t.id,source:M,sourceLayer:P},o)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.removeFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},o)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const p=d.type,m=p==="vector"?t.sourceLayer:void 0;if(p==="vector"&&!m)return void this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(o&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new s.y(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.removeFeatureState(m,t.id,o)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let p;if("featuresetId"in t.target){const{featuresetId:m,importId:y}=t.target,x=this.getFragmentStyle(y),T=x.getFeaturesetLayers(m);for(const{source:E,sourceLayer:C}of T){const M=x.getFeatureState({id:t.id,source:E,sourceLayer:C});if(M&&!p)p=M;else if(!s.by(p,M))return void this.fire(new s.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:m}=t.target,y=this.getLayer(m);p=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.sourceLayer})}return p}const o=t.source,c=t.sourceLayer,d=this._checkSource(o);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new s.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(o)[0].getFeatureState(c,t.id);this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),o=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return s.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:o,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const o of Object.values(this._mergedLayers))t(o)&&this._updateLayer(o)}_updateLayer(t){this._changes.updateLayer(t);const o=this.getLayerSourceCache(t),c=s.B(t.source,t.scope),d=this._changes.getUpd
vendor: 4,235 bytes, line 8
8atedSourceCaches();t.source&&!d[c]&&o&&o.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),o.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const o=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},p=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(o(x)){d[x]=y;for(const T of t){const E=T[x];if(E)for(const C of E)p.push(C)}}}p.sort((y,x)=>x.intersectionZ-y.intersectionZ);const m=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(o(x))for(let T=p.length-1;T>=0;T--){const E=p[T].feature;if(E.layer&&d[E.layer.id]<y)break;m.push(E),p.pop()}else for(const T of t){const E=T[x];if(E)for(const C of E)m.push(C.feature)}}return m}queryRasterValue(t,o,c){const d=this.getOwnSource(t);return d?d.type!=="raster-array"?(this.fire(new s.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):d.queryRasterArrayValue(o,c):(this.fire(new s.y(new Error(`Source with id "${t}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(t,o,c){let d;o&&!Array.isArray(o)&&o.filter&&(this._validate(N,"queryRenderedFeatures.filter",o.filter,null,o),d=s.b6(o.filter));const p={},m=E=>{if(Zc.has(E.type))return;const C=this.getOwnLayerSourceCache(E),M=p[C.id]=p[C.id]||{sourceCache:C,layers:{},has3DLayers:!1};E.is3D(!!this.terrain)&&(M.has3DLayers=!0),M.layers[E.fqid]=M.layers[E.fqid]||{styleLayer:E,targets:[]},M.layers[E.fqid].targets.push({filter:d})};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new s.y(new Error("parameters.layers must be an Array."))),[];for(const E of o.layers){const C=this._layers[E];if(!C)return this.fire(new s.y(new Error(`The layer '${E}' does not exist in the map's style and cannot be queried for features.`))),[];m(C)}}else for(const E in this._layers)m(this._layers[E]);const y=this._queryRenderedFeatures(t,p,c),x=this._flattenAndSortRenderedFeatures(y),T=[];for(const E of x)s.dw(E.layer.id)===this.scope&&T.push(E);return T}queryRenderedFeatureset(t,o,c){let d;o&&!Array.isArray(o)&&o.filter&&(this._validate(N,"queryRenderedFeatures.filter",o.filter,null,o),d=s.b6(o.filter));const p="mock",m=[];if(o&&o.target)m.push(Object.assign({},o,{targetId:p,filter:d}));else{const E=this.getFeaturesetDescriptors();for(const C of E)m.push({targetId:p,filter:d,target:C});for(const{style:C}of this.fragments){const M=C.getFeaturesetDescriptors();for(const P of M)m.push({targetId:p,filter:d,target:P})}}const y=this.queryRenderedTargets(t,m,c),x=[],T=new Set;for(const E of y)for(const C of E.variants[p])zl(C,E,T)||x.push(new s.dx(E,C));return x}queryRenderedTargets(t,o,c){const d={},p=(y,x,T,E)=>{const C=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(C.layers[y.fqid]=C.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(C.has3DLayers=!0),!E)return T.uniqueFeatureID=!1,void C.layers[y.fqid].targets.push(T);C.layers[y.fqid].targets.push(Object.assign({},T,{namespace:E.namespace,properties:E.properties,uniqueFeatureID:E.uniqueFeatureID}))};for(const y of o)if("featuresetId"in y.target){const{featuresetId:x,importId:T}=y.target,E=this.getFragmentStyle(T);if(!E||!E._featuresetSelectors)continue;const C=E._featuresetSelectors[x];if(!C){this.fire(new s.y(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const M of C){const P=E.getOwnLayer(M.layerId);P&&!Zc.has(P.type)&&p(P,E.getOwnLayerSourceCache(P),y,M)}}else if("layerId"in y.target){const{layerId:x}=y.target,T=this.getLayer(x);if(!T||Zc.has(T.type))continue;p(T,this.getLayerSourceCache(T),y)}const m=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,o,c){const d=[],p=!!this.map._showQueryGeometry,m=or.createFromScreenPoints(t,c);for(const y in o){const x=Ol(m,o[y],this._availableImages,c,p,this.getActualScope());Object.keys(x).length&&d.push(x)}if(this.placement)for(const y in o){if(!o[y].sourceCache._onlySymbols)continue;const x=Sf(m.screenGeometry,o[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(x).length&&d.push(x)}return d}querySourceFeatures(t,o){const c=o&&o.filter;
8c&&this._validate(N,"querySourceFeatures.filter",c,null,o);let d=[];const p=this.getOwnSourceCaches(t);for(const m of p)d=d.concat(If(m,o));return d}addSourceType(t,o,c){return Vn.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(Vn.setSourceType(t,o),o.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:o.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,o,c={}){this._checkLoaded();const d=this.light.getLight();let p=!1;for(const y in t)if(!s.by(t[y],d[y])){p=!0;break}if(!p)return;const m=this._getTransitionParameters();this.light.setLight(t,o,c),this.light.updateTransitions(m)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=s.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,o=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),o===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=!("source"in t)||t.source==null;if(o===1){if(this.disableElevatedTerrain)return;if("source"in c&&typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=s.dp(c),c=Object.assign(c,{source:y})}const p=Object.assign({},c),m={};if(this.terrain&&d){p.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(m.style=y.serialize())}if(this._validate(os,"terrain",p,m))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&o!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,o),this.fire(new s.z("data",{dataType:"style"}))}else{const p=this.terrain,m=p.get();for(const y of Object.keys(s.a6.terrain))!c.hasOwnProperty(y)&&s.a6.terrain[y].default&&(c[y]=s.a6.terrain[y].default);for(const y in t)if(!s.by(t[y],m[y])){p.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});p.updateTransitions(x),this.fire(new s.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const o=this.fog=new Ft(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_createSnow(t){const o=this.snow=new lr(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_createRain(t){const o=this.rain=new $i(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const o=this.fog;if(!s.by(o.get(),t)){o.set(t,this.options),this.stylesheet.fog=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const o=this.snow;if(!s.by(o.get(),t)){o.set(t,this.options),this.stylesheet.snow=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const o=this.rain;if(!s.by(o.get(),t)){o.set(t,this.options),this.stylesheet.rain=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createRain(t);
8this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!o)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(o);this._loadColorTheme(c).then(()=>{this.fire(new s.z("colorthemeset")),t()}).catch(d=>{s.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&s.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,o){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=o,c._reloadColorTheme())}_getTransitionParameters(t){return{now:s.o.now(),transition:Object.assign(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],o=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):o.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...o)}_createTerrain(t,o){const c=this.terrain=new Ze(t,o,this.scope,this.options,this.map.getWorldview());o===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});c.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="fill-extrusion"&&this._updateLayer(o)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="symbol"&&this._updateLayer(o)}}_validate(t,o,c,d,p={}){if(p&&p.validate===!1)return!1;const m=Object.assign({},this.serialize());return ds(this,t.call(Kn,Object.assign({key:o,style:m,value:c,styleSpec:s.a6},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const o=this.getSourceCaches(t);for(const c of o)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const o=this._mergedLayers[t];o._clear&&o._clear()}}reloadSource(t){const o=this.getSourceCaches(t);for(const c of o)c.resume(),c.reload()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let o;this.directionalLight&&(o=Ff(this.directionalLight));const c=new Set,d=new Set;for(const p in this._mergedLayers){const m=this._mergedLayers[p];
vendor: 5,434 bytes, line 8
8m.type==="building"&&c.add(m.source),m.hasElevation()&&!d.has(m.source)&&d.add(m.source)}for(const p in this._mergedSourceCaches){const m=this._mergedSourceCaches[p],y=d.has(m._source.id);c.has(m._source.id)&&(m._source.reparseOverscaled=!1),m.update(t,void 0,void 0,o,y)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const o=this._sourceCaches[t];o.resume(),o.reload()}}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new s.z("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new ph),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(t,o,c,d,p){this.pauseablePlacement||(this.pauseablePlacement=new ph);let m=!1,y=!1;const x={},T={};for(const z of this._mergedOrder){const B=this._mergedLayers[z];if(B.type!=="symbol")continue;const j=s.B(B.source,B.scope);let Z=x[j];if(!Z){const $=this.getLayerSourceCache(B);if(!$)continue;const le=$.getRenderableIds(!0).map(ne=>$.getTileByID(ne));T[j]=le.slice(),Z=x[j]=le.sort((ne,se)=>se.tileID.overscaledZ-ne.tileID.overscaledZ||(ne.tileID.isLessThan(se.tileID)?-1:1))}const H=this.crossTileSymbolIndex.addLayer(B,Z,t.center.lng,t.projection);m=m||H}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const E=!!(this.placement&&!t.equals(this.placement.transform)),C=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!p||this.placement.lastReplacementSourceUpdateTime!==p.updateTime)),M=E||C||m,P=(M||this.pauseablePlacement.isStale())&&c===0,F=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.o.now(),t.zoom)&&c!==0;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||P||F)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(t,this._mergedOrder,o,c,d,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null,this._buildingIndex)),this.pauseablePlacement.isDone()?M&&c!==0&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,x,T,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.o.now()),y=!0),m&&this.pauseablePlacement.setStale()),y||m){this._buildingIndex.onNewFrame(t.zoom);for(let z=0;z<this._mergedOrder.length;z++){const B=this._mergedLayers[this._mergedOrder[z]];if(B.type!=="symbol"||B.visibility==="none")continue;const j=this.isLayerClipped(B);this.placement.updateLayerOpacities(B,x[s.B(B.source,B.scope)],z,j?p:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(s.o.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,o){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:p})=>p===t.id)!==-1)return void this.fire(new s.y(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!o)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:p})=>p===o);return d===-1&&this.fire(new s.y(new Error(`Import with id "${o}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,o)}updateImport(t,o){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof o=="string"?(this.setImportUrl(t,o),this):(o.url&&o.url!==c[d].url&&this.setImportUrl(t,o.url),s.by(o.config,c[d].config)||this.setImportConfig(t,o.config,o.data.schema),s.by(o.data,c[d].data)||this.setImportData(t,o.data),this)}moveImport(t,o){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const p=this.getImportIndex(o);if(p===-1)return this;const m=c[d],y=this.fragments[d];return c=c.filter(({id:x})=>x!==t),this.fragments=this.fragments.filter(({id:x})=>x!==t),this.stylesheet.imports=c.slice(0,p).concat(m).concat(c.slice(p)),this.fragments=this.fragments.slice(0,p).concat(y).concat(this.fragments.slice(p)),this.mergeLayers(),this}setImportUrl(t,o){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=o;const p=this.fragments[d];return p.style=this._createFragmentStyle(c[d]),p.style.on("style.import.load",()=>this.mergeAll()),p.style.loadURL(o),this}setImportData(t,o){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:o?(this.fragments[c].style.setState(o),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,o,c){this._checkLoaded();const d=this.getImportIndex(t),p=this.stylesheet.imports||[];if(d===-1)return this;o?p[d].config=o:delete p[d].config;const m=this.fragments[d];c&&m.style.stylesheet&&(m.style.stylesheet.schema=c);const y=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=o,m.style.updateConfig(o,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const o=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(o.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const o=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);return o===-1&&this.fire(new s.y(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),o}
8getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const o in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[o];c&&t.push(c.getSource())}return t}getSource(t,o){const c=this.getSourceCache(t,o);return c&&c.getSource()}getLayerSource(t){const o=this.getLayerSourceCache(t);return o&&o.getSource()}getSourceCache(t,o){const c=s.B(t,o);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const o=s.B(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[o]:this._mergedOtherSourceCaches[o]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const o=[];return this._mergedOtherSourceCaches[t]&&o.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&o.push(this._mergedSymbolSourceCaches[t]),o}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const o in t){const c=t[o];c==="reload"?this.reloadSource(o):c==="clear"&&this.clearSource(o)}}updateLayers(t){const o=this._changes.getUpdatedPaintProperties();for(const c of o){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t)}getImages(t,o,c){this.imageManager.getImages(o.images,o.scope,c),this._updateTilesForChangedImages();const d=m=>{if(m){const y=o.images.map(x=>s.I.toString(x));m.setDependencies(o.tileID.key,o.type,y)}},p=s.B(o.source,o.scope);d(this._mergedOtherSourceCaches[p]),d(this._mergedSymbolSourceCaches[p]),o.images.some(m=>m.iconsetId)&&this.fire(new s.z("data",{dataType:"style"}))}rasterizeImages(t,o,c){this.imageManager.rasterizeImages(o,c)}getGlyphs(t,o,c){this.glyphManager.getGlyphs(o.stacks,c)}getResource(t,o,c){return s.dz(o,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const o=[];return this._otherSourceCaches[t]&&o.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&o.push(this._symbolSourceCaches[t]),o}_isSourceCacheLoaded(t){const o=this.getOwnSourceCaches(t);return o.length===0?(this.fire(new s.y(new Error(`There is no source with ID '${t}'`))),!1):o.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,o){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const c=t.type==="fill-extrusion"&&(t.sourceLayer==="building"||t.sourceLayer==="procedural_buildings"),d=t.type==="building";if(t.is3D(!!this.terrain)){if(c||d||o&&o.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Vn.getSourceType=function(l){return ss[l]},Vn.setSourceType=function(l,t){ss[l]=t},Vn.registerForPluginStateChange=s.dA;var vh=` 9#define EPSILON 0.0000001 10#define PI 3.141592653589793 11#ifdef RENDER_CUTOFF 12float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} 13#endif`,bh=` 14#ifdef DUAL_SOURCE_BLENDING 15layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1; 16#else 17layout(location=0) out vec4 glFragColor; 18#endif 19#ifdef USE_MRT1 20layout(location=1) out vec4 out_Target1; 21#endif 22highp float unpack_depth(highp vec4 rgba_depth) 23{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} 24#ifdef INDICATOR_CUTOUT 25uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 26#endif 27vec4 applyCutout(vec4 color,float height) { 28#ifdef INDICATOR_CUTOUT 29float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
29float 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); 30#else 31return color; 32#endif 33} 34#ifdef DEBUG_WIREFRAME 35#define HANDLE_WIREFRAME_DEBUG \\ 36glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 37gl_FragDepth=gl_FragCoord.z-0.0001; 38#else 39#define HANDLE_WIREFRAME_DEBUG 40#endif 41#ifdef RENDER_CUTOFF 42uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 43#endif 44vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,Xa=` 45#define EXTENT 8192.0 46#define RAD_TO_DEG 180.0/PI 47#define DEG_TO_RAD PI/180.0 48#define GLOBE_RADIUS EXTENT/PI/2.0 49float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 50#ifdef PROJECTION_GLOBE_VIEW 51vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 52#ifndef PROJECTED_POS_ON_VIEWPORT 53float 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; 54#else 55return vec3(0.0); 56#endif 57}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);} 58#endif 59vec2 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( 60unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 61);}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);} 62#ifdef RENDER_CUTOFF 63uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 64#endif 65const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) 66{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} 67#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer 68#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib 69#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib 70#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib 71#define DECLARE_MATERIAL_TABLE_INFO 72#endif`,Ya="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
72void 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;}",wh=` 73#define ELEVATION_SCALE 7.0 74#define ELEVATION_OFFSET 450.0 75#ifdef PROJECTION_GLOBE_VIEW 76uniform 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( 77mix(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;} 78#else 79vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 80#endif 81#ifdef TERRAIN 82uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { 83#ifdef TERRAIN_DEM_FLOAT_FORMAT 84vec2 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; 85#else 86float 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); 87#endif 88}float prevElevation(vec2 apos) { 89#ifdef TERRAIN_DEM_FLOAT_FORMAT 90vec2 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; 91#else 92float 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); 93#endif 94} 95#ifdef TERRAIN_VERTEX_MORPHING 96float elevation(vec2 apos) { 97#ifdef ZERO_EXAGGERATION 98return 0.0; 99#endif 100float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 101#else 102float elevation(vec2 apos) { 103#ifdef ZERO_EXAGGERATION 104return 0.0; 105#endif 106return currentElevation(apos);} 107#endif 108vec4 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);} 109#else 110float elevation(vec2 pos) { return 0.0; } 111#endif 112#ifdef DEPTH_OCCLUSION 113uniform 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; 114#ifdef DEPTH_D24 115float 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);} 116#else 117highp float unpack_depth_rgba(vec4 rgba_depth) 118{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;} 119#endif 120bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 121#ifdef CLIP_ZERO_TO_ONE 122coord.z=-1.0+2.0*coord.z; 123#endif 124#ifdef DEPTH_D24 125float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 126#else 127float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 128#endif 129return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
129size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 130#ifdef DEPTH_D24 131highp vec4 depth=vec4( 132texture(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 133);depth=unpack_depth4(depth); 134#else 135highp vec4 depth=vec4( 136unpack_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)) 137); 138#endif 139return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; 140#ifdef CLIP_ZERO_TO_ONE 141coord.z=-1.0+2.0*coord.z; 142#endif 143int 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) { 144#ifdef DEPTH_D24 145highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 146#else 147highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 148#endif 149res+=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; 150#ifdef CLIP_ZERO_TO_ONE 151coord.z=-1.0+2.0*coord.z; 152#endif 153highp 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));} 154#else 155bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 156#endif`,Wc=`#ifdef FOG 157uniform 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);} 158#endif`,to=`#ifdef FOG 159uniform 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; 160#ifdef FLIP_Y 161uv.y=1.0-uv.y; 162#endif 163highp vec3 ray_dir=mix( 164mix(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;}
164vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} 165#endif`,Wl=`#ifdef RASTER_ARRAY 166uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) 167);}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) 168);}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);} 169#endif`,lt=`#ifdef RASTER_ARRAY 170uniform 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;} 171#endif 172uniform 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;}`,Th=`#ifdef RENDER_SHADOWS 173uniform 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];} 174#endif`,Eh=`#ifdef RENDER_SHADOWS 175precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
175p float bias) { 176#ifdef CLIP_ZERO_TO_ONE 177highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias); 178#else 179highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias); 180#endif 181return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w; 182#ifdef SHADOWS_SINGLE_CASCADE 183vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias); 184#else 185light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0); 186#endif 187}highp float calculate_shadow_bias(float NDotL) { 188#ifdef NORMAL_OFFSET 189return 0.5*u_shadow_bias.x; 190#else 191return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 192#endif 193}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy) 194{highp vec2 biasUV=vec2( 195pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} 196#endif`;const Xl=/#include\s+"([^"]+)"/g,No=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,Sh=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,_a=new Set(["ifdef","ifndef","elif","if","defined"]),ga=new Set;Us(vh,ga),Us(Xa,ga),Us(bh,ga);const Vs={"_prelude_fog.vertex.glsl":Wc,"_prelude_terrain.vertex.glsl":wh,"_prelude_shadow.vertex.glsl":Th,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer 197#define MATERIAL_TABLE_DEBUG 0 198uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; 199#if MATERIAL_TABLE_DEBUG 200vec4 colorDebug; 201#endif 202};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}
202float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { 203if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; 204}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { 205iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; 206#if MATERIAL_TABLE_DEBUG 207const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; 208#endif 209uint offset=0u; 210#if MATERIAL_TABLE_DEBUG 211bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} 212#endif 213offset++; 214#if MATERIAL_TABLE_DEBUG 215uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} 216#endif 217offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); 218#if MATERIAL_TABLE_DEBUG 219if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} 220#endif 221uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); 222#if MATERIAL_TABLE_DEBUG 223if(keepFinding) 224{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} 225#endif 226offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; 227#if MATERIAL_TABLE_DEBUG 228if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} 229#endif 230info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) 231{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} 232#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) 233#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) 234#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) 235#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); 236#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; 237#endif`,"_prelude_fog.fragment.glsl":to,"_prelude_shadow.fragment.glsl":Eh,"_prelude_lighting.glsl":` 238#ifdef LIGHTING_3D_MODE 239uniform 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
239));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);} 240#endif`,"_prelude_raster_array.glsl":Wl,"_prelude_raster_particle.glsl":lt},Xc={};ni("",wh),ni(to,Wc),ni(Eh,Th),ni(Wl,""),ni(lt,"");const Uf=ni(bh,Xa),Yc=vh,g_=[` 241#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) 242#extension GL_EXT_blend_func_extended : require 243#endif`,"precision mediump float;",Yc,Uf.fragmentSource].join(` 244`),jf=["precision highp float;",Yc,Uf.vertexSource].join(` 245`);var Ih={background:ni(`#include "_prelude_fog.fragment.glsl" 246#include "_prelude_lighting.glsl" 247uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength; 248#ifdef LIGHTING_3D_MODE 249in vec4 v_color; 250#endif 251void main() {vec4 out_color; 252#ifdef LIGHTING_3D_MODE 253out_color=v_color; 254#else 255out_color=u_color; 256#endif 257#ifdef FOG 258out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 259#endif 260glFragColor=out_color*u_opacity; 261#ifdef USE_MRT1 262out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 263#endif 264#ifdef OVERDRAW_INSPECTOR 265glFragColor=vec4(1.0); 266#endif 267HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 268#include "_prelude_lighting.glsl" 269in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength; 270#ifdef LIGHTING_3D_MODE 271uniform mediump vec4 u_color;out vec4 v_color; 272#endif 273void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 274#ifdef LIGHTING_3D_MODE 275v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 276#endif 277#ifdef FOG 278v_fog_pos=fog_position(a_pos); 279#endif 280}`),backgroundPattern:ni(`#include "_prelude_fog.fragment.glsl" 281#include "_prelude_lighting.glsl" 282uniform 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); 283#ifdef LIGHTING_3D_MODE 284out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 285#endif 286#ifdef FOG 287out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 288#endif 289glFragColor=out_color*u_opacity; 290#ifdef USE_MRT1 291out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 292#endif 293#ifdef OVERDRAW_INSPECTOR 294glFragColor=vec4(1.0); 295#endif 296HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 297uniform 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); 298#ifdef FOG 299v_fog_pos=fog_position(a_pos); 300#endif 301}`),building:ni(`#include "_prelude_fog.fragment.glsl" 302#include "_prelude_shadow.fragment.glsl" 303#include "_prelude_lighting.glsl" 304const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos; 305#ifdef BUILDING_FAUX_FACADE 306in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity; 307#endif 308#ifdef RENDER_SHADOWS 309in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 310#endif 311#ifdef FLOOD_LIGHT
312in highp float v_flood_radius;in float v_has_flood_light; 313#endif 314uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));} 315#ifdef BUILDING_FAUX_FACADE 316float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y; 317#if 0 318if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0; 319#else 320if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao; 321#endif 322return out_color;} 323#endif 324vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a; 325#ifdef BUILDING_FAUX_FACADE 326if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);} 327#endif 328vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; 329#ifdef RENDER_SHADOWS 330#ifdef RENDER_CUTOFF 331shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} 332#else 333shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 334#endif 335#else 336shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir); 337#endif 338color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); 339#ifdef FLOOD_LIGHT
340float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance); 341#endif 342color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); 343#ifdef FOG 344color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); 345#endif 346color*=u_opacity; 347#ifdef INDICATOR_CUTOUT 348color=applyCutout(color,v_pos.z); 349#endif 350#ifdef FEATURE_CUTOUT 351color=apply_feature_cutout(color,gl_FragCoord); 352#endif 353glFragColor=color; 354#ifdef DEBUG_SHOW_NORMALS 355color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; 356#endif 357#ifdef OVERDRAW_INSPECTOR 358glFragColor=vec4(1.0); 359#endif 360HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 361#include "_prelude_shadow.vertex.glsl" 362in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos; 363#ifdef BUILDING_FAUX_FACADE 364out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive; 365#endif 366#ifdef RENDER_SHADOWS 367uniform 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; 368#endif 369#ifdef FLOOD_LIGHT 370out highp float v_flood_radius;out float v_has_flood_light; 371#endif 372const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 373#ifdef BUILDING_FAUX_FACADE 374mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);} 375#endif 376#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 377#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive 378void main() { 379#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 380#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive 381#ifdef FLOOD_LIGHT 382v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius); 383#endif 384vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0; 385#ifdef BUILDING_FAUX_FACADE 386v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;} 387#endif 388v_pos=a_pos_3f; 389#ifdef RENDER_CUTOFF 390vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity; 391#endif 392#ifdef RENDER_SHADOWS 393vec3 shadow_pos=v_pos; 394#ifdef NORMAL_OFFSET 395vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); 396#endif 397v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0); 398#endif 399#ifdef FOG 400v_fog_pos=fog_position(v_pos); 401#endif 402gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:ni(`in vec4 v_color_emissive; 403#pragma mapbox: define-attribute highp vec4 bloom_attenuation 404#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 405float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; 406#ifdef HAS_ATTRIBUTE_a_bloom_attenuation 407float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));
407opacity*=saturate(1.0-distance*distance); 408#endif 409#ifdef RENDER_CUTOFF 410opacity*=v_cutoff_opacity; 411#endif 412glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; 413#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 414#pragma mapbox: define-attribute highp vec4 bloom_attenuation 415out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 416#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 417#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 418#ifdef HAS_ATTRIBUTE_a_part_color_emissive 419vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive); 420#else 421v_color_emissive=vec4(1.0); 422#endif 423gl_Position=u_matrix*vec4(a_pos_3f,1.0); 424#ifdef RENDER_CUTOFF 425v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 426#endif 427}`),buildingDepth:ni(`in highp float v_depth;void main() { 428#ifndef DEPTH_TEXTURE 429glFragColor=pack_depth(v_depth); 430#endif 431}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:ni(`#include "_prelude_fog.fragment.glsl" 432#include "_prelude_lighting.glsl" 433in vec3 v_data;in float v_visibility; 434#pragma mapbox: define highp vec4 color 435#pragma mapbox: define mediump float radius 436#pragma mapbox: define lowp float blur 437#pragma mapbox: define lowp float opacity 438#pragma mapbox: define highp vec4 stroke_color 439#pragma mapbox: define mediump float stroke_width 440#pragma mapbox: define lowp float stroke_opacity 441uniform float u_emissive_strength;void main() { 442#pragma mapbox: initialize highp vec4 color 443#pragma mapbox: initialize mediump float radius 444#pragma mapbox: initialize lowp float blur 445#pragma mapbox: initialize lowp float opacity 446#pragma mapbox: initialize highp vec4 stroke_color 447#pragma mapbox: initialize mediump float stroke_width 448#pragma mapbox: initialize lowp float stroke_opacity 449vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 450smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 451smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 452antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 453);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 454#ifdef LIGHTING_3D_MODE 455out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 456#endif 457#ifdef FOG 458out_color=fog_apply_premultiplied(out_color,v_fog_pos); 459#endif 460glFragColor=out_color*(v_visibility*opacity_t); 461#ifdef OVERDRAW_INSPECTOR 462glFragColor=vec4(1.0); 463#endif 464}`,`#include "_prelude_fog.vertex.glsl" 465#include "_prelude_terrain.vertex.glsl" 466#define NUM_VISIBILITY_RINGS 2 467#define INV_SQRT2 0.70710678 468#define ELEVATION_BIAS 0.0001 469#define NUM_SAMPLES_PER_RING 16 470uniform 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; 471#ifdef PROJECTION_GLOBE_VIEW 472in 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; 473#endif 474#ifdef ELEVATED_ROADS 475in float a_circle_z_offset; 476#endif 477out vec3 v_data;out float v_visibility; 478#pragma mapbox: define highp vec4 color 479#pragma mapbox: define mediump float radius 480#pragma mapbox: define lowp float blur 481#pragma mapbox: define lowp float opacity 482#pragma mapbox: define highp vec4 stroke_color 483#pragma mapbox: define mediump float stroke_width 484#pragma mapbox: define lowp float stroke_opacity 485vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
485iew_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) { 486#if defined(TERRAIN) 487return elevation(pos)+ELEVATION_BIAS; 488#else 489return 0.0; 490#endif 491}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); 492#ifdef PITCH_WITH_MAP 493#ifdef PROJECTION_GLOBE_VIEW 494return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 495#else 496return u_matrix*( world_center+vec4(sample_offset,0,0) ); 497#endif 498#else 499return projected_center+vec4(sample_offset,0,0); 500#endif 501}float get_sample_step() { 502#ifdef PITCH_WITH_MAP 503return 2.0*PI/float(NUM_SAMPLES_PER_RING); 504#else 505return PI/float(NUM_SAMPLES_PER_RING); 506#endif 507}void main() { 508#pragma mapbox: initialize highp vec4 color 509#pragma mapbox: initialize mediump float radius 510#pragma mapbox: initialize lowp float blur 511#pragma mapbox: initialize lowp float opacity 512#pragma mapbox: initialize highp vec4 stroke_color 513#pragma mapbox: initialize mediump float stroke_width 514#pragma mapbox: initialize lowp float stroke_opacity 515vec2 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; 516#ifdef PROJECTION_GLOBE_VIEW 517vec3 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); 518#else 519surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); 520#endif 521#ifdef ELEVATED_ROADS 522world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 523#endif 524vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 525#ifdef PITCH_WITH_MAP 526#ifdef SCALE_WITH_MAP 527view_scale=1.0; 528#else 529view_scale=projected_center.w/u_camera_to_center_distance; 530#endif 531#else 532#ifdef SCALE_WITH_MAP 533view_scale=u_camera_to_center_distance; 534#else 535view_scale=projected_center.w; 536#endif 537#endif 538gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 539#ifdef TERRAIN 540float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 541#ifdef PITCH_WITH_MAP 542float 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; 543#else 544occlusion_world_center=world_center;occlusion_projected_center=projected_center; 545#endif 546for(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); 547#else 548visibility=1.0; 549#endif 550#ifdef PROJECTION_GLOBE_VIEW 551visibility=1.0; 552#endif 553v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 554#ifdef FOG 555v_fog_pos=fog_position(world_center.xyz); 556#endif 557}`),clippingMask:ni("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:ni(`#include "_prelude_fog.fragment.glsl" 558uniform highp float u_intensity;in vec2 v_extrude; 559#pragma mapbox: define highp float weight 560#define GAUSS_COEF 0.3989422804014327 561void main() { 562#pragma mapbox: initialize highp float weight 563float 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); 564#ifdef FOG 565if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 566#endif 567#ifdef OVERDRAW_INSPECTOR 568glFragColor=vec4(1.0); 569#endif 570HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 571#include "_prelude_fog.vertex.glsl" 572uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; 573#ifdef PROJECTION_GLOBE_VIEW 574in 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; 575#endif 576out vec2 v_extrude; 577#pragma mapbox: define highp float weight 578#pragma mapbox: define mediump float radius 579const highp float ZERO=1.0/255.0/16.0; 580#define GAUSS_COEF 0.3989422804014327 581void main() { 582#pragma mapbox: initialize highp float weight 583#pragma mapbox: initialize mediump float radius 584vec2 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; 585#ifdef PROJECTION_GLOBE_VIEW 586vec3 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); 587#else 588pos=vec3(tilePos+extrude,elevation(tilePos)); 589#endif 590gl_Position=u_matrix*vec4(pos,1); 591#ifdef FOG 592v_fog_pos=fog_position(pos); 593#endif 594}`),heatmapTexture:ni(`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; 595#ifdef OVERDRAW_INSPECTOR 596glFragColor=vec4(0.0); 597#endif 598HANDLE_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:ni("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" 599in 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; 600#ifdef PROJECTION_GLOBE_VIEW 601uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; 602#endif 603out 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));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation); 604#ifdef PROJECTION_GLOBE_VIEW 605#ifndef PROJECTED_POS_ON_VIEWPORT 606vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition); 607#endif 608#endif 609vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 6100.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:ni("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( 611mix(-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( 6120.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:ni("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" 613in vec2 a_pos; 614#ifdef PROJECTION_GLOBE_VIEW 615in vec3 a_pos_3; 616#endif 617out 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; 618#ifdef PROJECTION_GLOBE_VIEW
619gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 620#else 621gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 622#endif 623}`),elevatedStructuresDepth:ni(`void main() { 624#ifndef DEPTH_TEXTURE 625glFragColor=vec4(0.); 626#endif 627}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:ni(`#ifdef DEPTH_RECONSTRUCTION 628in float v_height; 629#endif 630void main() { 631#ifdef DEPTH_RECONSTRUCTION 632if (v_height >=0.0) 633discard; 634#else 635#ifdef FEATURE_CUTOUT 636apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord); 637#endif 638#endif 639glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; 640#ifdef DEPTH_RECONSTRUCTION 641out float v_height; 642#endif 643void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 644#ifdef DEPTH_RECONSTRUCTION 645if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 646#endif 647gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:ni(`#include "_prelude_fog.fragment.glsl" 648#include "_prelude_lighting.glsl" 649#include "_prelude_shadow.fragment.glsl" 650in vec3 v_normal;in float v_height; 651#ifdef RENDER_SHADOWS 652in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 653#endif 654vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
654vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) 655{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength; 656#pragma mapbox: define highp vec4 structure_color 657void main() { 658#pragma mapbox: initialize highp vec4 structure_color 659vec3 color=structure_color.xyz; 660#ifdef LIGHTING_3D_MODE 661vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz); 662#ifdef RENDER_SHADOWS 663float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor); 664#else 665color=apply_lighting(color,transformed_normal); 666#endif 667color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} 668#endif 669#ifdef FOG 670color=fog_apply(color,v_fog_pos); 671#endif 672vec4 out_color=vec4(color,1.0); 673#ifdef INDICATOR_CUTOUT 674out_color=applyCutout(out_color,v_height); 675#endif 676#ifdef FEATURE_CUTOUT 677out_color=apply_feature_cutout(out_color,gl_FragCoord); 678#endif 679glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 680#include "_prelude_shadow.vertex.glsl" 681in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; 682#ifdef RENDER_SHADOWS 683uniform 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; 684#endif 685#pragma mapbox: define highp vec4 structure_color 686void main() { 687#pragma mapbox: initialize highp vec4 structure_color 688v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1); 689#ifdef RENDER_SHADOWS 690vec3 shd_pos0=pos;vec3 shd_pos1=pos; 691#ifdef NORMAL_OFFSET 692vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 693#endif 694v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 695#endif 696#ifdef FOG 697v_fog_pos=fog_position(a_pos); 698#endif 699}`),fill:ni(`#include "_prelude_fog.fragment.glsl" 700#include "_prelude_lighting.glsl" 701#include "_prelude_shadow.fragment.glsl" 702#pragma mapbox: define highp vec4 color 703#pragma mapbox: define lowp float opacity 704uniform float u_emissive_strength; 705#ifdef RENDER_SHADOWS 706uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 707#endif 708#ifdef ELEVATED_ROADS 709in highp float v_road_z_offset; 710#endif 711#ifdef INDICATOR_CUTOUT 712in highp float v_z_offset; 713#endif 714void main() { 715#pragma mapbox: initialize highp vec4 color 716#pragma mapbox: initialize lowp float opacity 717vec4 out_color=color; 718#ifdef LIGHTING_3D_MODE 719out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 720#ifdef RENDER_SHADOWS 721float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 722#endif 723#endif 724#ifdef FOG 725out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 726#endif 727out_color*=opacity; 728#ifdef INDICATOR_CUTOUT 729if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 730#endif 731#ifdef FEATURE_CUTOUT 732out_color=apply_feature_cutout(out_color,gl_FragCoord); 733#endif 734glFragColor=out_color; 735#ifdef USE_MRT1 736out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 737#endif 738#ifdef OVERDRAW_INSPECTOR 739glFragColor=vec4(1.0); 740#endif 741HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 742#include "_prelude_shadow.vertex.glsl" 743in vec2 a_pos; 744#ifdef ELEVATED_ROADS 745in float a_road_z_offset;out highp float v_road_z_offset; 746#endif 747#ifdef RENDER_SHADOWS 748uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 749#endif 750#ifdef INDICATOR_CUTOUT 751out highp float v_z_offset; 752#endif 753uniform mat4 u_matrix; 754#pragma mapbox: define highp vec4 color 755#pragma mapbox: define lowp float opacity 756#pragma mapbox: define highp float z_offset 757void main() { 758#pragma mapbox: initialize highp vec4 color 759#pragma mapbox: initialize lowp float opacity 760#pragma mapbox: initialize highp float z_offset 761#ifdef ELEVATED_ROADS 762z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 763#endif 764float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 765#ifdef RENDER_SHADOWS 766vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 767#ifdef NORMAL_OFFSET 768vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 769#endif 770v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 771#endif 772#ifdef FOG 773v_fog_pos=fog_position(a_pos); 774#endif 775#ifdef INDICATOR_CUTOUT 776v_z_offset=z_offset; 777#endif 778}`),fillOutline:ni(`#include "_prelude_fog.fragment.glsl" 779#include "_prelude_lighting.glsl" 780#include "_prelude_shadow.fragment.glsl" 781in highp vec2 v_pos;uniform float u_emissive_strength; 782#ifdef RENDER_SHADOWS 783uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 784#endif 785#pragma mapbox: define highp vec4 outline_color 786#pragma mapbox: define lowp float opacity 787void main() { 788#pragma mapbox: initialize highp vec4 outline_color 789#pragma mapbox: initialize lowp float opacity 790float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 791#ifdef LIGHTING_3D_MODE 792out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 793#ifdef RENDER_SHADOWS 794float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 795#endif 796#endif 797#ifdef FOG 798out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 799#endif 800#ifdef FEATURE_CUTOUT 801out_color=apply_feature_cutout(out_color,gl_FragCoord); 802#endif 803glFragColor=out_color*(alpha*opacity); 804#ifdef USE_MRT1 805out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 806#endif 807#ifdef OVERDRAW_INSPECTOR 808glFragColor=vec4(1.0); 809#endif 810HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 811#include "_prelude_shadow.vertex.glsl" 812in vec2 a_pos; 813#ifdef ELEVATED_ROADS 814in float a_road_z_offset; 815#endif 816#ifdef RENDER_SHADOWS 817uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 818#endif 819uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 820#pragma mapbox: define highp vec4 outline_color 821#pragma mapbox: define lowp float opacity 822#pragma mapbox: define highp float z_offset 823void main() { 824#pragma mapbox: initialize highp vec4 outline_color 825#pragma mapbox: initialize lowp float opacity 826#pragma mapbox: initialize highp float z_offset 827#ifdef ELEVATED_ROADS 828z_offset+=a_road_z_offset; 829#endif 830float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 831#ifdef FLIP_Y 832v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 833#else 834v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 835#endif 836#ifdef RENDER_SHADOWS 837vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 838#ifdef NORMAL_OFFSET 839vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 840#endif 841v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 842#endif 843#ifdef FOG 844v_fog_pos=fog_position(a_pos); 845#endif 846}`),fillOutlinePattern:ni(`#include "_prelude_fog.fragment.glsl" 847#include "_prelude_lighting.glsl" 848#include "_prelude_shadow.fragment.glsl" 849uniform vec2 u_texsize;uniform sampler2D u_image; 850#ifdef FILL_PATTERN_TRANSITION 851uniform float u_pattern_transition; 852#endif 853uniform float u_emissive_strength; 854#ifdef APPLY_LUT_ON_GPU 855uniform highp sampler3D u_lutTexture; 856#endif 857#ifdef RENDER_SHADOWS 858uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 859#endif 860in highp vec2 v_pos;in highp vec2 v_pos_world; 861#pragma mapbox: define lowp float opacity 862#pragma mapbox: define lowp vec4 pattern 863#ifdef FILL_PATTERN_TRANSITION 864#pragma mapbox: define mediump vec4 pattern_b 865#endif 866void main() { 867#pragma mapbox: initialize lowp float opacity 868#pragma mapbox: initialize mediump vec4 pattern 869#ifdef FILL_PATTERN_TRANSITION 870#pragma mapbox: initialize mediump vec4 pattern_b 871#endif 872vec2 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); 873#ifdef APPLY_LUT_ON_GPU 874out_color=applyLUT(u_lutTexture,out_color); 875#endif 876#ifdef FILL_PATTERN_TRANSITION 877vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 878#endif 879#ifdef LIGHTING_3D_MODE 880out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 881#ifdef RENDER_SHADOWS 882float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 883#endif 884#endif 885#ifdef FEATURE_CUTOUT 886out_color=apply_feature_cutout(out_color,gl_FragCoord); 887#endif 888#ifdef FOG 889out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 890#endif 891glFragColor=out_color*(alpha*opacity); 892#ifdef USE_MRT1 893out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 894#endif 895#ifdef OVERDRAW_INSPECTOR 896glFragColor=vec4(1.0); 897#endif 898HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 899#include "_prelude_shadow.vertex.glsl" 900uniform 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; 901#ifdef ELEVATED_ROADS 902in float a_road_z_offset; 903#endif 904#ifdef RENDER_SHADOWS 905uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 906#endif 907out highp vec2 v_pos;out highp vec2 v_pos_world; 908#pragma mapbox: define lowp float opacity 909#pragma mapbox: define lowp vec4 pattern 910#ifdef FILL_PATTERN_TRANSITION 911#pragma mapbox: define mediump vec4 pattern_b 912#endif 913#pragma mapbox: define lowp float pixel_ratio 914#pragma mapbox: define highp float z_offset 915void main() { 916#pragma mapbox: initialize lowp float opacity 917#pragma mapbox: initialize mediump vec4 pattern 918#ifdef FILL_PATTERN_TRANSITION 919#pragma mapbox: initialize mediump vec4 pattern_b 920#endif 921#pragma mapbox: initialize lowp float pixel_ratio 922#pragma mapbox: initialize highp float z_offset 923vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; 924#ifdef ELEVATED_ROADS 925z_offset+=a_road_z_offset; 926#endif 927float 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); 928#ifdef FLIP_Y 929v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 930#else 931v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 932#endif 933#ifdef RENDER_SHADOWS 934vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 935#ifdef NORMAL_OFFSET 936vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 937#endif 938v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 939#endif 940#ifdef FOG 941v_fog_pos=fog_position(a_pos); 942#endif 943}`),fillPattern:ni(`#include "_prelude_fog.fragment.glsl" 944#include "_prelude_lighting.glsl" 945#include "_prelude_shadow.fragment.glsl" 946uniform vec2 u_texsize;uniform sampler2D u_image; 947#ifdef FILL_PATTERN_TRANSITION 948uniform float u_pattern_transition; 949#endif 950in highp vec2 v_pos;uniform float u_emissive_strength; 951#ifdef RENDER_SHADOWS 952uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 953#endif 954#ifdef ELEVATED_ROADS 955in highp float v_road_z_offset; 956#endif 957#ifdef APPLY_LUT_ON_GPU 958uniform highp sampler3D u_lutTexture; 959#endif 960#pragma mapbox: define lowp float opacity 961#pragma mapbox: define lowp vec4 pattern 962#ifdef FILL_PATTERN_TRANSITION 963#pragma mapbox: define mediump vec4 pattern_b 964#endif 965void main() { 966#pragma mapbox: initialize lowp float opacity 967#pragma mapbox: initialize mediump vec4 pattern 968#ifdef FILL_PATTERN_TRANSITION 969#pragma mapbox: initialize mediump vec4 pattern_b 970#endif 971vec2 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); 972#ifdef APPLY_LUT_ON_GPU 973out_color=applyLUT(u_lutTexture,out_color); 974#endif 975#ifdef FILL_PATTERN_TRANSITION 976vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 977#endif 978#ifdef LIGHTING_3D_MODE 979out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 980#ifdef RENDER_SHADOWS 981float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 982#ifdef ELEVATED_ROADS 983out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 984#else 985out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 986#endif 987#endif 988#endif 989#ifdef FEATURE_CUTOUT 990out_color=apply_feature_cutout(out_color,gl_FragCoord); 991#endif 992#ifdef FOG 993out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 994#endif 995glFragColor=out_color*opacity; 996#ifdef USE_MRT1 997out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 998#endif 999#ifdef OVERDRAW_INSPECTOR 1000glFragColor=vec4(1.0); 1001#endif 1002HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1003#include "_prelude_shadow.vertex.glsl" 1004uniform 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; 1005#ifdef ELEVATED_ROADS 1006in float a_road_z_offset;out highp float v_road_z_offset; 1007#endif 1008#ifdef RENDER_SHADOWS 1009uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1010#endif 1011out highp vec2 v_pos; 1012#pragma mapbox: define lowp float opacity 1013#pragma mapbox: define lowp vec4 pattern 1014#ifdef FILL_PATTERN_TRANSITION 1015#pragma mapbox: define mediump vec4 pattern_b 1016#endif 1017#pragma mapbox: define lowp float pixel_ratio 1018#pragma mapbox: define highp float z_offset 1019void main() { 1020#pragma mapbox: initialize lowp float opacity 1021#pragma mapbox: initialize mediump vec4 pattern 1022#pragma mapbox: initialize lowp float pixel_ratio 1023#pragma mapbox: initialize highp float z_offset 1024#ifdef FILL_PATTERN_TRANSITION 1025#pragma mapbox: initialize mediump vec4 pattern_b 1026#endif 1027vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 1028#ifdef ELEVATED_ROADS 1029z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 1030#endif 1031float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pa
1031ttern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); 1032#ifdef RENDER_SHADOWS 1033vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 1034#ifdef NORMAL_OFFSET 1035vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 1036#endif 1037v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1038#endif 1039#ifdef FOG 1040v_fog_pos=fog_position(a_pos); 1041#endif 1042}`),fillExtrusion:ni(`#include "_prelude_fog.fragment.glsl" 1043#include "_prelude_shadow.fragment.glsl" 1044#include "_prelude_lighting.glsl" 1045in vec4 v_color;in vec4 v_flat; 1046#ifdef RENDER_SHADOWS 1047in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 1048#endif 1049uniform lowp float u_opacity; 1050#ifdef FAUX_AO 1051uniform lowp vec2 u_ao;in vec2 v_ao; 1052#endif 1053#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1054in vec4 v_roof_color; 1055#endif 1056#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1057in highp vec3 v_normal; 1058#endif 1059uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 1060#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 1061in float v_flood_radius;in float v_has_floodlight; 1062#endif 1063in float v_height; 1064#pragma mapbox: define highp float emissive_strength 1065void main() { 1066#pragma mapbox: initialize highp float emissive_strength 1067#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1068vec3 normal=normalize(v_normal); 1069#endif 1070float z;vec4 color=v_color; 1071#ifdef ZERO_ROOF_RADIUS 1072z=float(normal.z > 0.00001); 1073#ifdef LIGHTING_3D_MODE 1074normal=mix(normal,vec3(0.0,0.0,1.0),z); 1075#else 1076color=mix(v_color,v_roof_color,z); 1077#endif 1078#endif 1079float h=max(0.0,v_height);float ao_shade=1.0; 1080#ifdef FAUX_AO 1081float 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; 1082#ifdef ZERO_ROOF_RADIUS 1083concave*=(1.0-z); 1084#endif 1085float 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); 1086#ifdef LIGHTING_3D_MODE 1087#ifdef FLOOD_LIGHT 1088color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 1089#else 1090color.rgb*=ao_shade; 1091#endif 1092#else 1093color.rgb*=ao_shade; 1094#endif 1095#endif 1096#ifdef LIGHTING_3D_MODE 1097float flood_radiance=0.0; 1098#ifdef FLOOD_LIGHT 1099flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 1100#endif 1101#ifdef RENDER_SHADOWS 1102#ifdef FLOOD_LIGHT 1103float 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); 1104#else 1105float shadowed_lighting_factor; 1106#ifdef RENDER_CUTOFF 1107shadowed_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;} 1108#else 1109shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 1110#endif 1111color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 1112#endif 1113#else 1114color.rgb=apply_lighting(color.rgb,normal); 1115#ifdef FLOOD_LIGHT 1116color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 1117#endif 1118#endif 1119color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 1120#endif 1121#ifdef FOG 1122color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 1123#endif 1124#ifdef INDICATOR_CUTOUT 1125color=applyCutout(color,h); 1126#endif 1127#ifdef FEATURE_CUTOUT 1128color=apply_feature_cutout(color,gl_FragCoord); 1129#endif 1130glFragColor=color; 1131#ifdef OVERDRAW_INSPECTOR 1132glFragColor=vec4(1.0); 1133#endif 1134HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1135#include "_prelude_terrain.vertex.glsl" 1136#include "_prelude_shadow.vertex.glsl" 1137#include "_prelude_lighting.glsl" 1138#include "_prelude_material_table.vertex.glsl" 1139uniform 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; 1140#ifdef RENDER_WALL_MODE 1141in vec3 a_join_normal_inside; 1142#endif 1143#ifdef PROJECTION_GLOBE_VIEW 1144in 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; 1145#endif 1146#ifdef TERRAIN
1147uniform int u_height_type;uniform int u_base_type; 1148#endif 1149uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; 1150#ifdef RENDER_SHADOWS 1151uniform 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; 1152#endif 1153#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1154out vec4 v_roof_color; 1155#endif 1156#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1157out highp vec3 v_normal; 1158#endif 1159#ifdef FAUX_AO 1160uniform lowp vec2 u_ao;out vec2 v_ao; 1161#endif 1162#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 1163out float v_flood_radius;out float v_has_floodlight; 1164#endif 1165out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 1166#pragma mapbox: define highp float base 1167#pragma mapbox: define highp float height 1168#pragma mapbox: define highp vec4 color 1169#pragma mapbox: define highp float flood_light_wall_radius 1170#pragma mapbox: define highp float line_width 1171#pragma mapbox: define highp float emissive_strength 1172void main() {DECLARE_MATERIAL_TABLE_INFO 1173#pragma mapbox: initialize highp float base 1174#pragma mapbox: initialize highp float height 1175#pragma mapbox: initialize highp vec4 color 1176#pragma mapbox: initialize highp float flood_light_wall_radius 1177#pragma mapbox: initialize highp float line_width 1178#pragma mapbox: initialize highp float emissive_strength 1179base*=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)); 1180#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1181v_normal=normal; 1182#endif 1183base=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); 1184#if defined(HAS_CENTROID) || defined(TERRAIN) 1185centroid_pos=a_centroid_pos; 1186#endif 1187float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 1188#ifdef TERRAIN 1189bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 1190#else 1191h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); 1192#endif 1193#ifdef PROJECTION_GLOBE_VIEW 1194float 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); 1195#endif 1196float cutoff=1.0;vec3 scaled_pos=pos; 1197#ifdef RENDER_CUTOFF 1198vec3 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); 1199#ifdef CLIP_ZERO_TO_ONE 1200cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); 1201#else 1202cutoff=cutoff_opacity(u_cutoff_params,ground.z); 1203#endif 1204if (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); 1205#endif 1206float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 1207#ifdef RENDER_WALL_MODE 1208vec2 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; 1209#endif 1210gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 1211#ifdef RENDER_SHADOWS 1212vec3 shd_pos0=pos;vec3 shd_pos1=pos; 1213#ifdef NORMAL_OFFSET 1214vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 1215#endif 1216v_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); 1217#endif 1218float NdotL=0.0;float colorvalue=0.0; 1219#ifndef LIGHTING_3D_MODE 1220colorvalue=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*=( 1221(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1222#endif 1223#ifdef FAUX_AO
1224float 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; 1225#ifdef TERRAIN 1226top_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); 1227#endif 1228v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1229#ifdef PROJECTION_GLOBE_VIEW 1230top_height+=u_height_lift; 1231#endif 1232gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1233#endif 1234#ifdef LIGHTING_3D_MODE 1235#ifdef FLOOD_LIGHT 1236float 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; 1237#endif 1238v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); 1239#else 1240v_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; 1241#endif 1242#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1243float 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; 1244#endif 1245#ifdef FOG 1246v_fog_pos=fog_position(pos); 1247#endif 1248}`),fillExtrusionDepth:ni(`in highp float v_depth;void main() { 1249#ifndef DEPTH_TEXTURE 1250glFragColor=pack_depth(v_depth); 1251#endif 1252}`,`#include "_prelude_terrain.vertex.glsl" 1253#include "_prelude_material_table.vertex.glsl" 1254uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 1255#ifdef TERRAIN 1256uniform int u_height_type;uniform int u_base_type; 1257#endif 1258in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1259#ifdef RENDER_WALL_MODE 1260in vec3 a_join_normal_inside; 1261#endif 1262#pragma mapbox: define highp float base 1263#pragma mapbox: define highp float height 1264#pragma mapbox: define highp float line_width 1265#pragma mapbox: define highp vec4 color 1266out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO 1267#pragma mapbox: initialize highp float base 1268#pragma mapbox: initialize highp float height 1269#pragma mapbox: initialize highp float line_width 1270#pragma mapbox: initialize highp vec4 color 1271base*=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); 1272#if defined(HAS_CENTROID) || defined(TERRAIN) 1273centroid_pos=a_centroid_pos; 1274#endif 1275vec3 pos; 1276#ifdef TERRAIN 1277bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 1278#else 1279pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 1280#endif 1281#ifdef RENDER_WALL_MODE 1282vec2 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; 1283#endif 1284float 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:ni(`#include "_prelude_fog.fragment.glsl" 1285#include "_prelude_lighting.glsl" 1286uniform vec2 u_texsize;uniform sampler2D u_image; 1287#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1288uniform float u_pattern_transition; 1289#endif 1290#ifdef FAUX_AO 1291uniform lowp vec2 u_ao;in vec3 v_ao; 1292#endif 1293#ifdef LIGHTING_3D_MODE 1294in vec3 v_normal; 1295#endif 1296#ifdef APPLY_LUT_ON_GPU 1297uniform highp sampler3D u_lutTexture; 1298#endif 1299in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 1300#pragma mapbox: define highp float base 1301#pragma mapbox: define highp float height 1302#pragma mapbox: define mediump vec4 pattern 1303#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1304#pragma mapbox: define mediump vec4 pattern_b 1305#endif 1306#pragma mapbox: define highp float pixel_ratio 1307void main() { 1308#pragma mapbox: initialize highp float base 1309#pragma mapbox: initialize highp float height 1310#pragma mapbox: initialize mediump vec4 pattern 1311#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1312#pragma mapbox: initialize mediump vec4 pattern_b 1313#endif 1314#pragma mapbox: initialize highp float pixel_ratio 1315vec2 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); 1316#ifdef APPLY_LUT_ON_GPU 1317out_color=applyLUT(u_lutTexture,out_color); 1318#endif 1319#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1320vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 1321#endif 1322#ifdef LIGHTING_3D_MODE 1323out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 1324#else 1325out_color=out_color*v_lighting; 1326#endif 1327#ifdef FAUX_AO 1328float 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
1328),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; 1329#endif 1330#ifdef FOG 1331out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1332#endif 1333#ifdef INDICATOR_CUTOUT 1334out_color=applyCutout(out_color,height); 1335#endif 1336glFragColor=out_color; 1337#ifdef OVERDRAW_INSPECTOR 1338glFragColor=vec4(1.0); 1339#endif 1340HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1341#include "_prelude_terrain.vertex.glsl" 1342#include "_prelude_lighting.glsl" 1343#include "_prelude_material_table.vertex.glsl" 1344uniform 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; 1345#ifdef RENDER_WALL_MODE 1346in vec3 a_join_normal_inside; 1347#endif 1348#ifdef PROJECTION_GLOBE_VIEW 1349in 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; 1350#endif 1351#ifdef TERRAIN 1352uniform int u_height_type;uniform int u_base_type; 1353#endif 1354out highp vec2 v_pos;out vec4 v_lighting; 1355#ifdef FAUX_AO 1356uniform lowp vec2 u_ao;out vec3 v_ao; 1357#endif 1358#ifdef LIGHTING_3D_MODE 1359out vec3 v_normal; 1360#endif 1361#pragma mapbox: define highp float base 1362#pragma mapbox: define highp float height 1363#pragma mapbox: define highp vec4 color 1364#pragma mapbox: define mediump vec4 pattern 1365#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1366#pragma mapbox: define mediump vec4 pattern_b 1367#endif 1368#pragma mapbox: define highp float pixel_ratio 1369#pragma mapbox: define highp float line_width 1370void main() {DECLARE_MATERIAL_TABLE_INFO 1371#pragma mapbox: initialize highp float base 1372#pragma mapbox: initialize highp float height 1373#pragma mapbox: initialize highp vec4 color 1374#pragma mapbox: initialize mediump vec4 pattern 1375#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1376#pragma mapbox: initialize mediump vec4 pattern_b 1377#endif 1378#pragma mapbox: initialize highp float pixel_ratio 1379#pragma mapbox: initialize highp float line_width 1380vec2 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); 1381#if defined(HAS_CENTROID) || defined(TERRAIN) 1382centroid_pos=a_centroid_pos; 1383#endif 1384float ele=0.0;float h=z;vec3 p;float c_ele; 1385#ifdef TERRAIN 1386bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); 1387#else 1388p=vec3(pos_nx.xy,z); 1389#endif 1390#ifdef PROJECTION_GLOBE_VIEW 1391float 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); 1392#endif 1393#ifdef RENDER_WALL_MODE 1394vec2 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; 1395#endif 1396float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 1397? pos_nx.xy 1398: 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; 1399#ifdef LIGHTING_3D_MODE 1400NdotL=calculate_NdotL(normal); 1401#else 1402NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 1403#endif 1404if (normal.y !=0.0) {float r=0.84; 1405#ifndef LIGHTING_3D_MODE 1406r=mix(0.7,0.98,1.0-u_lightintensity); 1407#endif 1408NdotL*=( 1409(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1410#ifdef FAUX_AO
1411float 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; 1412#ifdef TERRAIN 1413top_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); 1414#endif 1415v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1416#ifdef PROJECTION_GLOBE_VIEW 1417top_height+=u_height_lift; 1418#endif 1419gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1420#endif 1421#ifdef LIGHTING_3D_MODE 1422v_normal=normal; 1423#else 1424v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 1425#endif 1426#ifdef FOG 1427v_fog_pos=fog_position(p); 1428#endif 1429}`),groundShadow:ni(`#include "_prelude_shadow.fragment.glsl" 1430precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1431#ifdef FOG 1432in float v_fog_opacity; 1433#endif 1434void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); 1435#ifdef RENDER_CUTOFF 1436shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 1437#endif 1438#ifdef FOG 1439shadow=mix(shadow,vec3(1.0),v_fog_opacity); 1440#endif 1441#ifdef INDICATOR_CUTOUT 1442shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 1443#endif 1444glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 1445uniform 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; 1446#ifdef FOG 1447out float v_fog_opacity; 1448#endif 1449void 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); 1450#ifdef FOG 1451v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); 1452#endif 1453}`),fillExtrusionGroundEffect:ni(`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; 1454#ifdef SDF_SUBPASS 1455in 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);} 1456#ifdef FOG 1457in highp float v_fog; 1458#endif 1459#endif 1460void main() { 1461#ifdef CLEAR_SUBPASS 1462vec4 color=vec4(1.0); 1463#ifdef CLEAR_FROM_TEXTURE 1464color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 1465#endif 1466glFragColor=color; 1467#else 1468#ifdef SDF_SUBPASS 1469highp 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; 1470#ifdef FOG 1471fog=v_fog; 1472#endif 1473#ifdef RENDER_CUTOFF 1474fog*=v_cutoff_opacity; 1475#endif 1476glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 1477#else 1478#ifdef USE_MRT1 1479out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0); 1480#else 1481vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 1482#ifdef OVERDRAW_INSPECTOR 1483color=vec4(1.0); 1484#endif 1485glFragColor=color; 1486#endif 1487#endif 1488HANDLE_WIREFRAME_DEBUG; 1489#endif 1490}`,`#include "_prelude_fog.vertex.glsl" 1491in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; 1492#ifdef SDF_SUBPASS 1493out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 1494#ifdef FOG 1495out highp float v_fog; 1496#endif 1497#endif 1498uniform 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;
1499#pragma mapbox: define highp float flood_light_ground_radius 1500const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { 1501#pragma mapbox: initialize highp float flood_light_ground_radius 1502vec2 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; 1503#ifdef SDF_SUBPASS 1504v_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); 1505#ifdef FOG 1506v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 1507#endif 1508#endif 1509float hidden_by_landmark=0.0; 1510#ifdef HAS_CENTROID 1511hidden_by_landmark=a_hidden_by_landmark; 1512#endif 1513float 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)); 1514#ifdef RENDER_CUTOFF 1515v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 1516#endif 1517}`),hillshadePrepare:ni(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( 1518(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 1519)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 1520deriv.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:ni(`#include "_prelude_fog.fragment.glsl" 1521#include "_prelude_lighting.glsl" 1522uniform 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; 1523#ifdef LIGHTING_3D_MODE 1524glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 1525#endif 1526#ifdef FOG 1527glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 1528#endif 1529#ifdef USE_MRT1 1530out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1531#endif 1532#ifdef OVERDRAW_INSPECTOR 1533glFragColor=vec4(1.0); 1534#endif 1535HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1536uniform 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; 1537#ifdef FOG 1538v_fog_pos=fog_position(a_pos); 1539#endif 1540}`),line:ni(`#include "_prelude_fog.fragment.glsl" 1541#include "_prelude_lighting.glsl" 1542#include "_prelude_shadow.fragment.glsl" 1543uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1543uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; 1544#ifdef ELEVATED_ROADS 1545in highp float v_road_z_offset; 1546#endif 1547#ifdef VARIABLE_LINE_WIDTH 1548in float stub_side; 1549#endif 1550#ifdef RENDER_LINE_DASH 1551uniform sampler2D u_dash_image;in vec2 v_tex; 1552#endif 1553#ifdef RENDER_LINE_GRADIENT 1554uniform sampler2D u_gradient_image; 1555#endif 1556#ifdef INDICATOR_CUTOUT 1557in highp float v_z_offset; 1558#endif 1559#ifdef RENDER_SHADOWS 1560uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1561#endif 1562float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} 1563#pragma mapbox: define highp vec4 color 1564#pragma mapbox: define lowp float floorwidth 1565#pragma mapbox: define lowp vec4 dash 1566#pragma mapbox: define lowp float blur 1567#pragma mapbox: define lowp float opacity 1568#pragma mapbox: define mediump float side_z_offset 1569#pragma mapbox: define lowp float border_width 1570#pragma mapbox: define lowp vec4 border_color 1571#pragma mapbox: define lowp float emissive_strength 1572float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 1573#pragma mapbox: initialize highp vec4 color 1574#pragma mapbox: initialize lowp float floorwidth 1575#pragma mapbox: initialize lowp vec4 dash 1576#pragma mapbox: initialize lowp float blur 1577#pragma mapbox: initialize lowp float opacity 1578#pragma mapbox: initialize mediump float side_z_offset 1579#pragma mapbox: initialize lowp float border_width 1580#pragma mapbox: initialize lowp vec4 border_color 1581#pragma mapbox: initialize lowp float emissive_strength 1582float dist=length(v_normal)*v_width2.s; 1583#ifdef VARIABLE_LINE_WIDTH 1584blur=mix(blur,0.0,stub_side); 1585#endif 1586float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0); 1587#ifdef VARIABLE_LINE_WIDTH 1588alpha=mix(alpha,1.0,stub_side); 1589#endif 1590alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha; 1591#ifdef RENDER_LINE_DASH 1592float sdfdist=texture(u_dash_image,v_tex).r;
1592float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); 1593#endif 1594highp vec4 out_color; 1595#ifdef RENDER_LINE_GRADIENT 1596out_color=texture(u_gradient_image,v_uv.xy); 1597#else 1598out_color=color; 1599#endif 1600float trim_alpha=1.0; 1601#ifdef RENDER_LINE_TRIM_OFFSET 1602highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0; 1603#ifdef RENDER_LINE_GRADIENT 1604gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress); 1605#endif 1606highp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;} 1607#endif 1608if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 1609#ifdef RENDER_LINE_BORDER 1610#ifndef VARIABLE_LINE_WIDTH 1611float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}} 1612#endif 1613#endif 1614#ifdef LIGHTING_3D_MODE 1615out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1616#ifdef RENDER_SHADOWS 1617float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1618#ifdef ELEVATED_ROADS 1619out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1620#else 1621out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1622#endif 1623#endif 1624#endif 1625#ifdef FOG 1626out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1627#endif 1628out_color*=(alpha*opacity); 1629#ifdef INDICATOR_CUTOUT 1630out_color=applyCutout(out_color,v_z_offset); 1631#endif 1632#ifdef FEATURE_CUTOUT 1633out_color=apply_feature_cutout(out_color,gl_FragCoord); 1634#endif 1635glFragColor=out_color; 1636#ifdef DUAL_SOURCE_BLENDING 1637glFragColorSrc1=vec4(vec3(0.0),emissive_strength); 1638#else 1639#ifdef USE_MRT1 1640out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1641#endif 1642#endif 1643#ifdef OVERDRAW_INSPECTOR 1644glFragColor=vec4(1.0); 1645#endif 1646HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1647#include "_prelude_shadow.vertex.glsl" 1648#include "_prelude_terrain.vertex.glsl" 1649#define EXTRUDE_SCALE 0.015873016 1650in vec2 a_pos_normal;in vec4 a_data; 1651#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) 1652in vec3 a_z_offset_width; 1653#endif 1654#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1655in highp vec3 a_packed; 1656#endif 1657#ifdef RENDER_LINE_DASH 1658in float a_linesofar; 1659#endif 1660uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale; 1661#ifdef ELEVATED 1662uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1663#ifdef ELEVATION_REFERENCE_SEA 1664return 0.0; 1665#else 1666return elevation(apos); 1667#endif 1668} 1669#endif 1670out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; 1671#ifdef ELEVATED_ROADS 1672out highp float v_road_z_offset; 1673#endif 1674#ifdef VARIABLE_LINE_WIDTH 1675out float stub_side; 1676#endif 1677#ifdef RENDER_LINE_DASH 1678uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 1679#endif 1680#ifdef RENDER_LINE_GRADIENT 1681uniform float u_image_height; 1682#endif 1683#ifdef INDICATOR_CUTOUT 1684out highp float v_z_offset; 1685#endif 1686#ifdef RENDER_SHADOWS 1687uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1688#endif 1689#pragma mapbox: define highp vec4 color 1690#pragma mapbox: define lowp float floorwidth 1691#pragma mapbox: define lowp vec4 dash 1692#pragma mapbox: define lowp float blur 1693#pragma mapbox: define lowp float opacity 1694#pragma mapbox: define mediump float gapwidth 1695#pragma mapbox: define lowp float offset 1696#pragma mapbox: define mediump float width 1697#pragma mapbox: define mediump float side_z_offset 1698#pragma mapbox: define lowp float border_width 1699#pragma mapbox: define lowp vec4 border_color 1700#pragma mapbox: define lowp float emissive_strength 1701void main() { 1702#pragma mapbox: initialize highp vec4 color 1703#pragma mapbox: initialize lowp float floorwidth 1704#pragma mapbox: initialize lowp vec4 dash 1705#pragma mapbox: initialize lowp float blur 1706#pragma mapbox: initialize lowp float opacity 1707#pragma mapbox: initialize mediump float gapwidth 1708#pragma mapbox: initialize lowp float offset 1709#pragma mapbox: initialize mediump float width 1710#pragma mapbox: initialize mediump float side_z_offset 1711#pragma mapbox: initialize lowp float border_width 1712#pragma mapbox: initialize lowp vec4 border_color 1713#pragma mapbox: initialize lowp float emissive_strength 1714float a_z_offset; 1715#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1716a_z_offset=a_z_offset_width.x; 1717#endif 1718float 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;offset=-1.0*offset*u_width_scale;gapwidth=gapwidth/2.0;float halfwidth; 1719#ifdef VARIABLE_LINE_WIDTH 1720bool left=normal.y==1.0;float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=(u_width_scale*(left ? left_width : right_width))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal;offset=border_width >
1720 0.0 ? (left_width+right_width)*u_width_scale*0.5 : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING; 1721#else 1722halfwidth=(u_width_scale*width)/2.0; 1723#endif 1724float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1725#ifdef ELEVATED_ROADS 1726v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; 1727#else 1728#ifdef ELEVATED 1729vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1730#ifdef CROSS_SLOPE_VERTICAL 1731float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); 1732#else 1733#ifdef CROSS_SLOPE_HORIZONTAL 1734float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; 1735#else 1736float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; 1737#endif 1738#endif 1739gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); 1740#else 1741gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1742#endif 1743#endif 1744#ifdef ELEVATED_ROADS 1745#ifdef RENDER_SHADOWS 1746vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1747#ifdef NORMAL_OFFSET 1748vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 1749#endif 1750v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1751#endif 1752#endif 1753#ifndef RENDER_TO_TEXTURE 1754float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); 1755#else 1756v_gamma_scale=1.0; 1757#endif 1758#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1759highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; 1760#ifdef RENDER_LINE_GRADIENT 1761highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress); 1762#else 1763v_uv=vec3(a_uv_x,0.0,line_progress); 1764#endif 1765#endif 1766#ifdef RENDER_LINE_DASH 1767float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y); 1768#endif 1769v_width2=vec2(outset,inset); 1770#ifdef FOG 1771v_fog_pos=fog_position(pos); 1772#endif 1773#ifdef INDICATOR_CUTOUT 1774v_z_offset=a_z_offset; 1775#endif 1776}`),linePattern:ni(`#include "_prelude_fog.fragment.glsl" 1777#include "_prelude_lighting.glsl" 1778#include "_prelude_shadow.fragment.glsl" 1779uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
1779uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image; 1780#ifdef APPLY_LUT_ON_GPU 1781uniform highp sampler3D u_lutTexture; 1782#endif 1783#ifdef LINE_PATTERN_TRANSITION 1784uniform float u_pattern_transition; 1785#endif 1786in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 1787#ifdef RENDER_LINE_TRIM_OFFSET 1788in highp vec3 v_uv; 1789#endif 1790#ifdef ELEVATED_ROADS 1791in highp float v_road_z_offset; 1792#endif 1793#ifdef LINE_JOIN_NONE 1794in vec2 v_pattern_data; 1795#endif 1796#ifdef INDICATOR_CUTOUT 1797in highp float v_z_offset; 1798#endif 1799#ifdef RENDER_SHADOWS 1800uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1801#endif 1802#pragma mapbox: define mediump vec4 pattern 1803#ifdef LINE_PATTERN_TRANSITION 1804#pragma mapbox: define mediump vec4 pattern_b 1805#endif 1806#pragma mapbox: define mediump float pixel_ratio 1807#pragma mapbox: define mediump float blur 1808#pragma mapbox: define mediump float opacity 1809#pragma mapbox: define lowp float emissive_strength 1810void main() { 1811#pragma mapbox: initialize mediump vec4 pattern 1812#ifdef LINE_PATTERN_TRANSITION 1813#pragma mapbox: initialize mediump vec4 pattern_b 1814#endif 1815#pragma mapbox: initialize mediump float pixel_ratio 1816#pragma mapbox: initialize mediump float blur 1817#pragma mapbox: initialize mediump float opacity 1818#pragma mapbox: initialize lowp float emissive_strength 1819vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); 1820#ifdef APPLY_LUT_ON_GPU 1821color=applyLUT(u_lutTexture,color); 1822#endif 1823#ifdef LINE_PATTERN_TRANSITION 1824vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 1825#endif 1826#ifdef RENDER_LINE_TRIM_OFFSET 1827highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);} 1828#endif 1829#ifdef LINE_JOIN_NONE 1830highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} 1831#endif 1832#ifdef LIGHTING_3D_MODE 1833color=apply_lighting_with_emission_ground(color,emissive_strength); 1834#ifdef RENDER_SHADOWS 1835float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1836#ifdef ELEVATED_ROADS 1837color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1838#else 1839color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1840#endif 1841#endif 1842#endif 1843#ifdef FOG 1844color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1845#endif 1846color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 1847#ifdef INDICATOR_CUTOUT 1848color=applyCutout(color,v_z_offset); 1849#endif 1850glFragColor=color; 1851#ifdef DUAL_SOURCE_BLENDING 1852glFragColorSrc1=vec4(vec3(0.0),emissive_strength); 1853#else 1854#ifdef USE_MRT1 1855out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1856#endif 1857#endif 1858#ifdef OVERDRAW_INSPECTOR 1859glFragColor=vec4(1.0); 1860#endif 1861HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1862#include "_prelude_shadow.vertex.glsl" 1863#include "_prelude_terrain.vertex.glsl" 1864#define scale 0.015873016 1865in vec2 a_pos_normal;in vec4 a_data; 1866#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1867in vec3 a_z_offset_width; 1868#endif 1869#ifdef RENDER_LINE_TRIM_OFFSET 1870in highp vec3 a_packed; 1871#endif 1872in highp float a_linesofar; 1873#ifdef LINE_JOIN_NONE 1874in highp vec3 a_pattern_data;out vec2 v_pattern_data; 1875#endif 1876#ifdef INDICATOR_CUTOUT 1877out highp float v_z_offset; 1878#endif 1879uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale; 1880#ifdef ELEVATED 1881uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1882#ifdef ELEVATION_REFERENCE_SEA 1883return 0.0; 1884#else 1885return elevation(apos); 1886#endif 1887} 1888#endif 1889out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 1890#ifdef RENDER_LINE_TRIM_OFFSET 1891out highp vec3 v_uv; 1892#endif 1893#ifdef ELEVATED_ROADS 1894out highp float v_road_z_offset; 1895#endif 1896#ifdef RENDER_SHADOWS 1897uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1898#endif 1899#pragma mapbox: define mediump float blur 1900#pragma mapbox: define mediump float opacity 1901#pragma mapbox: define mediump float offset 1902#pragma mapbox: define mediump float gapwidth 1903#pragma mapbox: define mediump float width 1904#pragma mapbox: define mediump float floorwidth 1905#pragma mapbox: define mediump vec4 pattern 1906#ifdef LINE_PATTERN_TRANSITION 1907#pragma mapbox: define mediump vec4 pattern_b 1908#endif 1909#pragma mapbox: define mediump float pixel_ratio 1910#pragma mapbox: define lowp float emissive_strength 1911void main() { 1912#pragma mapbox: initialize mediump float blur 1913#pragma mapbox: initialize mediump float opacity 1914#pragma mapbox: initialize mediump float offset 1915#pragma mapbox: initialize mediump float gapwidth 1916#pragma mapbox: initialize mediump float width 1917#pragma mapbox: initialize mediump float floorwidth 1918#pragma mapbox: initialize mediump vec4 pattern 1919#ifdef LINE_PATTERN_TRANSITION 1920#pragma mapbox: initialize mediump vec4 pattern_b 1921#endif 1922#pragma mapbox: initialize mediump float pixel_ratio 1923#pragma mapbox: initialize lowp float emissive_strength 1924float a_z_offset; 1925#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1926a_z_offset=a_z_offset_width.x; 1927#endif 1928float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1928vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1929#ifdef ELEVATED_ROADS 1930v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; 1931#else 1932#ifdef ELEVATED 1933vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1934#ifdef CROSS_SLOPE_VERTICAL 1935float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); 1936#else 1937#ifdef CROSS_SLOPE_HORIZONTAL 1938float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; 1939#else 1940float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; 1941#endif 1942#endif 1943gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); 1944#else 1945gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1946#endif 1947#endif 1948#ifdef ELEVATED_ROADS 1949#ifdef RENDER_SHADOWS 1950vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1951#ifdef NORMAL_OFFSET 1952vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 1953#endif 1954v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1955#endif 1956#endif 1957#ifndef RENDER_TO_TEXTURE 1958float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); 1959#else 1960v_gamma_scale=1.0; 1961#endif 1962#ifdef RENDER_LINE_TRIM_OFFSET 1963highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 1964#endif 1965v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 1966#ifdef LINE_JOIN_NONE 1967v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); 1968#endif 1969#ifdef FOG 1970v_fog_pos=fog_position(pos); 1971#endif 1972#ifdef INDICATOR_CUTOUT 1973v_z_offset=a_z_offset; 1974#endif 1975}`),raster:ni(`#include "_prelude_fog.fragment.glsl" 1976#include "_prelude_lighting.glsl" 1977#include "_prelude_raster_array.glsl" 1978uniform 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; 1979#ifdef PROJECTION_GLOBE_VIEW 1980in float v_split_fade; 1981#endif 1982uniform 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; 1983#ifndef RASTER_ARRAY 1984uniform highp sampler2D u_image0;uniform sampler2D u_image1; 1985#endif 1986#ifdef RASTER_COLOR 1987uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 1988#endif 1989void main() {vec4 color0,color1,color;vec2 value; 1990#ifdef RASTER_COLOR 1991#ifdef RASTER_ARRAY 1992#ifdef RASTER_ARRAY_LINEAR 1993value=mix( 1994raTexture2D_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 1995); 1996#else 1997value=mix( 1998raTexture2D_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 1999); 2000#endif 2001if (value.y > 0.0) value.x/=value.y; 2002#else 2003color=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); 2004#endif 2005color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 2006#else 2007color0=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); 2008#endif 2009color.a*=u_opacity; 2010#ifdef GLOBE_POLES 2011color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 2012#endif 2013vec3 rgb=color.rgb;rgb=vec3( 2014dot(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); 2015#ifdef LIGHTING_3D_MODE 2016out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 2017#endif 2018#ifdef FOG 2019highp 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)); 2020#endif 2021glFragColor=vec4(out_color*color.a,color.a); 2022#ifdef PROJECTION_GLOBE_VIEW 2023glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 2024#endif 2025#ifdef RENDER_CUTOFF 2026glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 2027#endif 2028#ifdef OVERDRAW_INSPECTOR 2029glFragColor=vec4(1.0); 2030#endif 2031#ifdef USE_MRT1 2032out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 2033#endif 2034HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2035uniform 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; 2036#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 2037#ifdef GLOBE_POLES 2038in vec3 a_globe_pos;in vec2 a_uv; 2039#else 2040in vec2 a_pos;in vec2 a_texture_pos; 2041#endif 2042out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 2043#ifdef PROJECTION_GLOBE_VIEW 2044out float v_split_fade; 2045#endif 2046void main() {vec2 uv; 2047#ifdef GLOBE_POLES 2048vec3 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; 2049#ifdef FOG 2050v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 2051#endif 2052#else 2053float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; 2054#ifdef PROJECTION_GLOBE_VIEW 2055vec3 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]); 2056v_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];
2056if (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; 2057#ifdef FOG 2058v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2059#endif 2060#else 2061gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 2062#ifdef FOG 2063v_fog_pos=fog_position(a_pos); 2064#endif 2065#endif 2066#endif 2067v_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; 2068#ifdef RENDER_CUTOFF 2069v_depth=gl_Position.z; 2070#endif 2071}`),rasterParticle:ni(`#include "_prelude_fog.fragment.glsl" 2072#include "_prelude_lighting.glsl" 2073uniform 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; 2074#ifdef LIGHTING_3D_MODE 2075out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; 2076#endif 2077#ifdef FOG 2078highp 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)); 2079#endif 2080glFragColor=vec4(out_color*color.a,color.a); 2081#ifdef OVERDRAW_INSPECTOR 2082glFragColor=vec4(1.0); 2083#endif 2084HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2085uniform 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; 2086#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 2087in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 2088#ifdef PROJECTION_GLOBE_VIEW 2089vec3 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; 2090#ifdef FOG 2091v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2092#endif 2093#else 2094uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 2095#ifdef FOG 2096v_fog_pos=fog_position(a_pos); 2097#endif 2098#endif 2099v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:ni("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" 2100in 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( 2101mod(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:ni("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:ni(`#include "_prelude_raster_particle.glsl" 2102uniform 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;
2102vec2 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( 2103linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 2104);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:ni(`#include "_prelude_lighting.glsl" 2105#include "_prelude_shadow.fragment.glsl" 2106#define SDF_PX 8.0 2107#define SDF 1.0 2108#define ICON 0.0 2109uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor; 2110#ifdef ICON_TRANSITION 2111uniform float u_icon_transition; 2112#endif 2113#ifdef COLOR_ADJUSTMENT 2114uniform mat4 u_color_adj_mat; 2115#endif 2116#ifdef INDICATOR_CUTOUT 2117in highp float v_z_offset; 2118#else 2119#ifdef RENDER_SHADOWS 2120in highp float v_z_offset; 2121#endif 2122#endif 2123in vec2 v_tex_a; 2124#ifdef ICON_TRANSITION 2125in vec2 v_tex_b; 2126#endif 2127in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 2128#ifdef RENDER_TEXT_AND_SYMBOL 2129in float is_sdf;in vec2 v_tex_a_icon; 2130#endif 2131#ifdef RENDER_SHADOWS 2132uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 2133#endif 2134#ifdef APPLY_LUT_ON_GPU 2135uniform highp sampler3D u_lutTexture; 2136#endif 2137#pragma mapbox: define highp vec4 fill_color 2138#pragma mapbox: define highp vec4 halo_color 2139#pragma mapbox: define lowp float opacity 2140#pragma mapbox: define lowp float halo_width 2141#pragma mapbox: define lowp float halo_blur 2142#pragma mapbox: define lowp float emissive_strength 2143void main() { 2144#pragma mapbox: initialize highp vec4 fill_color 2145#pragma mapbox: initialize highp vec4 halo_color 2146#pragma mapbox: initialize lowp float opacity 2147#pragma mapbox: initialize lowp float halo_width 2148#pragma mapbox: initialize lowp float halo_blur 2149#pragma mapbox: initialize lowp float emissive_strength 2150vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 2151#ifdef RENDER_TEXT_AND_SYMBOL 2152if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; 2153#ifdef OVERDRAW_INSPECTOR 2154glFragColor=vec4(1.0); 2155#endif 2156return;} 2157#endif 2158#ifdef RENDER_SDF 2159float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha; 2160#else 2161#ifdef ICON_TRANSITION 2162vec4 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); 2163#else 2164out_color=texture(u_texture,v_tex_a); 2165#endif 2166#ifdef APPLY_LUT_ON_GPU 2167out_color=applyLUT(u_lutTexture,out_color); 2168#endif 2169#ifdef COLOR_ADJUSTMENT 2170out_color=u_color_adj_mat*out_color; 2171#endif 2172#endif 2173out_color*=opacity*fade_opacity; 2174#ifdef LIGHTING_3D_MODE 2175out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 2176#ifdef RENDER_SHADOWS 2177float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 2178#ifdef TERRAIN 2179out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 2180#else 2181out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 2182#endif 2183#endif 2184#endif 2185#ifdef INDICATOR_CUTOUT 2186out_color=applyCutout(out_color,v_z_offset); 2187#endif 2188#ifdef FEATURE_CUTOUT 2189out_color=apply_feature_cutout(out_color,gl_FragCoord); 2190#endif 2191glFragColor=out_color; 2192#ifdef OVERDRAW_INSPECTOR 2193glFragColor=vec4(1.0); 2194#endif 2195HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 2196#include "_prelude_shadow.vertex.glsl" 2197#define USING_APPEARANCE 1.0 2198in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 2199#ifdef Z_OFFSET 2200in float a_auto_z_offset; 2201#endif 2202#ifdef PROJECTION_GLOBE_VIEW 2203in vec3 a_globe_anchor;in vec3 a_globe_normal; 2204#endif 2205#ifdef ICON_TRANSITION 2206in vec2 a_texb; 2207#endif 2208#ifdef OCCLUSION_QUERIES 2209in float a_occlusion_query_opacity; 2210#endif 2211#ifdef ELEVATED_ROADS 2212in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; 2213#endif 2214#ifdef INDICATOR_CUTOUT 2215out highp float v_z_offset; 2216#else 2217#ifdef RENDER_SHADOWS 2218out highp float v_z_offset; 2219#endif 2220#endif 2221uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; 2222#ifdef PROJECTION_GLOBE_VIEW 2223uniform 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; 2224#endif 2225out vec2 v_tex_a; 2226#ifdef ICON_TRANSITION 2227out vec2 v_tex_b; 2228#endif 2229out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 2230#ifdef RENDER_TEXT_AND_SYMBOL 2231out float is_sdf;out vec2 v_tex_a_icon; 2232#endif 2233#ifdef RENDER_SHADOWS 2234uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 2235#endif 2236#pragma mapbox: define highp vec4 fill_color 2237#pragma mapbox: define highp vec4 halo_color 2238#pragma mapbox: define lowp float opacity 2239#pragma mapbox: define lowp float halo_width 2240#pragma mapbox: define lowp float halo_blur 2241#pragma mapbox: define lowp float emissive_strength 2242#pragma mapbox: define lowp float occlusion_opacity 2243#pragma mapbox: define lowp float z_offset 2244void main() { 2245#pragma mapbox: initialize highp vec4 fill_color 2246#pragma mapbox: initialize highp vec4 halo_color 2247#pragma mapbox: initialize lowp float opacity 2248#pragma mapbox: initialize lowp float halo_width 2249#pragma mapbox: initialize lowp float halo_blur 2250#pragma mapbox: initialize lowp float emissive_strength 2251#pragma mapbox: initialize lowp float occlusion_opacity 2252#pragma mapbox: initialize lowp float z_offset 2253vec2 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);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;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 (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); 2254#ifdef Z_OFFSET 2255e+=a_auto_z_offset; 2256#endif 2257vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 2258#ifdef PROJECTION_GLOBE_VIEW 2259mercator_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; 2260#else 2261world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 2262#endif 2263vec4 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 ? 2264camera_to_anchor_distance/u_camera_to_center_distance : 2265u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 22660.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; 2267#ifdef PROJECTION_GLOBE_VIEW 2268vec3 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; 2269#else 2270offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 2271#endif 2272vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 2273#ifdef PROJECTION_GLOBE_VIEW 2274#ifdef PROJECTED_POS_ON_VIEWPORT 2275projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 2276#else 2277vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 2278#endif 2279#else 2280projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 2281#endif 2282highp 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); 2283#ifdef TERRAIN 2284#ifdef PITCH_WITH_MAP_TERRAIN 2285vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 2286#endif 2287#endif 2288#ifdef Z_OFFSET 2289z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; 2290#else 2291z+=u_pitch_with_map ? z_offset : 0.0; 2292#endif 2293float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change)); 2294#ifdef DEPTH_OCCLUSION 2295float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 2296#endif 2297#ifdef OCCLUSION_QUERIES 2298float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 2299#endif 2300#ifdef Z_TEST_OCCLUSION 2301out_fade_opacity*=occlusion_opacity; 2302#endif 2303float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; 2304#ifdef PROJECTION_GLOBE_VIEW 2305vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; 2306#else 2307#ifdef ELEVATED_ROADS 2308vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; 2309#else 2310pos=vec3(projected_pos.xy/projected_pos.w+offset,z); 2311#endif 2312#endif 2313gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize; 2314#ifdef RENDER_TEXT_AND_SYMBOL 2315is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 2316#endif 2317#ifdef ICON_TRANSITION 2318v_tex_b=a_texb/u_texsize; 2319#endif 2320#ifdef RENDER_SHADOWS 2321vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; 2322#ifdef NORMAL_OFFSET 2323vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 2324#endif 2325v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 2326#endif 2327#ifdef INDICATOR_CUTOUT 2328v_z_offset=e; 2329#else 2330#ifdef RENDER_SHADOWS 2331v_z_offset=e; 2332#endif 2333#endif 2334}`),terrainRaster:ni(`#include "_prelude_fog.fragment.glsl" 2335#include "_prelude_shadow.fragment.glsl" 2336#include "_prelude_lighting.glsl" 2337uniform sampler2D u_image0; 2338#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2339uniform sampler2D u_image1;uniform float u_emissive_texture_available; 2340#endif 2341in vec2 v_pos0; 2342#ifdef FOG 2343in float v_fog_opacity; 2344#endif 2345#ifdef RENDER_SHADOWS 2346in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 2347#endif 2348uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 2349#ifdef LIGHTING_3D_MODE 2350const vec3 normal=vec3(0.0,0.0,1.0); 2351#ifdef RENDER_SHADOWS 2352float cutoffOpacity=1.0; 2353#ifdef RENDER_CUTOFF 2354cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 2355#endif 2356#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2357float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; 2358#else 2359float 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)); 2360#endif 2361#else 2362float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 2363#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2364float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0; 2365#endif 2366#endif 2367#else 2368color=image_color; 2369#endif 2370#ifdef FOG 2371#ifdef ZERO_EXAGGERATION 2372color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2373#else 2374color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 2375#endif 2376#endif 2377glFragColor=color; 2378#ifdef OVERDRAW_INSPECTOR 2379glFragColor=vec4(1.0); 2380#endif 2381HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2382#include "_prelude_terrain.vertex.glsl" 2383uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; 2384#ifdef FOG 2385out float v_fog_opacity; 2386#endif 2387#ifdef RENDER_SHADOWS 2388uniform 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; 2389#endif 2390void 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); 2391#ifdef FOG 2392#ifdef ZERO_EXAGGERATION 2393v_fog_pos=fog_position(decodedPos); 2394#else 2395v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 2396#endif 2397#endif 2398#ifdef RENDER_SHADOWS 2399vec3 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.); 2400#endif 2401}`),terrainDepth:ni("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 2402uniform 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:ni(`#include "_prelude_fog.fragment.glsl" 2403in 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( 2404cos_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
2404nd-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; 2405#ifdef FOG 2406sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 2407#endif 2408sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 2409#ifdef OVERDRAW_INSPECTOR 2410glFragColor=vec4(1.0); 2411#endif 2412}`,Ya),skyboxGradient:ni(`#include "_prelude_fog.fragment.glsl" 2413in 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)); 2414#ifdef FOG 2415color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 2416#endif 2417color*=u_opacity;glFragColor=color; 2418#ifdef OVERDRAW_INSPECTOR 2419glFragColor=vec4(1.0); 2420#endif 2421}`,Ya),skyboxCapture:ni
vendor: 3,792 bytes, lines 2421-2432
2421(` 2422in 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; 2423#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 2424#define BETA_M vec3(21e-6,21e-6,21e-6) 2425#define MIE_G 0.76 2426#define DENSITY_HEIGHT_SCALE_R 8000.0 2427#define DENSITY_HEIGHT_SCALE_M 1200.0 2428#define PLANET_RADIUS 6360e3 2429#define ATMOSPHERE_RADIUS 6420e3 2430#define SAMPLE_STEPS 10 2431#define DENSITY_STEPS 4 2432float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2432Raster:ni(`#include "_prelude_fog.fragment.glsl" 2433#include "_prelude_lighting.glsl" 2434uniform sampler2D u_image0; 2435#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2436uniform sampler2D u_image1;uniform float u_emissive_texture_available; 2437#endif 2438uniform float u_far_z_cutoff;in vec2 v_pos0; 2439#ifndef FOG 2440uniform 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; 2441#endif 2442void main() {vec4 color; 2443#ifdef CUSTOM_ANTIALIASING 2444highp vec2 uv=gl_FragCoord.xy/u_viewport; 2445#ifdef FLIP_Y 2446uv.y=1.0-uv.y; 2447#endif 2448highp vec3 ray_dir=mix( 2449mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); 2450#ifdef LIGHTING_3D_MODE 2451#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2452float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); 2453#else 2454raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 2455#endif 2456#else 2457color=vec4(raster.rgb*antialias,raster.a*antialias); 2458#endif 2459#else 2460color=texture(u_image0,v_pos0); 2461#ifdef LIGHTING_3D_MODE 2462#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2463float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0; 2464#else 2465color=apply_lighting_ground(color); 2466#endif 2467#endif 2468#endif 2469#ifdef FOG 2470color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2471#endif 2472color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 2473#ifdef OVERDRAW_INSPECTOR 2474glFragColor=vec4(1.0); 2475#endif 2476HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2477#include "_prelude_terrain.vertex.glsl" 2478uniform 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; 2479#ifdef GLOBE_POLES 2480in vec3 a_globe_pos;in vec2 a_uv; 2481#else 2482in vec2 a_pos; 2483#endif 2484out vec2 v_pos0;void main() { 2485#ifdef GLOBE_POLES 2486vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 2487#else 2488float 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); 2489#endif 2490v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 2491#ifdef GLOBE_POLES 2492vec3 up_vector=globe_derived_up_vector; 2493#else 2494vec3 up_vector=elevationVector(tile_pos); 2495#endif 2496float height=elevation(tile_pos);globe_pos+=up_vector*height; 2497#ifndef GLOBE_POLES 2498globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 2499#endif 2500#ifdef GLOBE_POLES 2501vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 2502#else 2503vec4 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); 2504#endif 2505gl_Position=u_proj_matrix*interpolated_pos; 2506#ifdef FOG 2507v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2508#endif 2509}`),globeAtmosphere:ni(`#include "_prelude_fog.fragment.glsl" 2510uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; 2511#ifdef PROJECTION_GLOBE_VIEW 2512globe_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) { 2513#ifdef ALPHA_PASS 2514glFragColor=vec4(0,0,0,0);return; 2515#else 2516#ifdef NATIVE 2517glFragColor=vec4(1,1,1,1); 2518#else 2519glFragColor=vec4(0,0,0,1); 2520#endif 2521return; 2522#endif 2523} 2524#endif 2525highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 25260.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 2527#ifdef PROJECTION_GLOBE_VIEW 2528highp 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 ? 2529PI-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); 2530#else 2531horizon_angle=horizon_angle_mercator; 2532#endif 2533horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2533vec3 color_stop_2=u_space_color.rgb; 2534#ifdef ALPHA_PASS 2535float 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); 2536#else 2537vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t); 2538#endif 2539}`,`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( 2540mix(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( 2541mix(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:ni(`#include "_prelude_fog.fragment.glsl" 2542#include "_prelude_shadow.fragment.glsl" 2543#include "_prelude_lighting.glsl" 2544uniform float u_opacity; 2545#ifdef DITHERED_DISCARD 2546uniform float u_dithered_discard_threshold; 2547#endif 2548uniform 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; 2549#ifdef RENDER_SHADOWS 2550in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 2551#endif 2552#ifdef OCCLUSION_TEXTURE_TRANSFORM 2553uniform vec4 u_occlusionTextureTransform; 2554#endif 2555#pragma mapbox: define-attribute highp vec3 normal_3f 2556#pragma mapbox: define-attribute highp vec3 color_3f 2557#pragma mapbox: define-attribute highp vec4 color_4f 2558#pragma mapbox: define-attribute highp vec2 uv_2f 2559#pragma mapbox: initialize-attribute highp vec3 normal_3f 2560#pragma mapbox: initialize-attribute highp vec3 color_3f 2561#pragma mapbox: initialize-attribute highp vec4 color_4f 2562#pragma mapbox: initialize-attribute highp vec2 uv_2f 2563#ifdef HAS_ATTRIBUTE_a_pbr 2564in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 2565#endif 2566#ifdef HAS_TEXTURE_u_baseColorTexture 2567uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 2568#endif 2569#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 2570uniform sampler2D u_metallicRoughnessTexture; 2571#endif 2572#ifdef HAS_TEXTURE_u_occlusionTexture 2573uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 2574#endif 2575#ifdef HAS_TEXTURE_u_normalTexture 2576uniform sampler2D u_normalTexture; 2577#endif 2578#ifdef HAS_TEXTURE_u_emissionTexture 2579uniform sampler2D u_emissionTexture; 2580#endif 2581#ifdef APPLY_LUT_ON_GPU 2582uniform highp sampler3D u_lutTexture; 2583#endif 2584#ifdef TERRAIN_FRAGMENT_OCCLUSION 2585in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 2586#ifdef DEPTH_D24 2587highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 2588#else 2589highp float unpack_depth_rgba(highp vec4 rgba_depth) 2590{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;} 2591#endif 2592bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 2593#ifdef FLIP_Y 2594coord.y=1.0-coord.y; 2595#endif 2596#ifdef DEPTH_D24 2597highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 2598#else 2599highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 2600#endif 2601return v_depth > depth+0.0005;} 2602#endif 2603#define saturate(_x) clamp(_x,0.,1.) 2604vec3 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) 2605{ 2606#ifdef LIGHTING_3D_MODE 2607vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 2608#ifdef RENDER_SHADOWS 2609lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2610#else 2611lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 2612#endif 2613return apply_lighting(albedo,transformed_normal,lighting_factor); 2614#else 2615vec3 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
2615Color),vec3(1.0));return c3; 2616#endif 2617}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 2618#ifdef HAS_ATTRIBUTE_a_color_3f 2619albedo*=vec4(color_3f,1.0); 2620#endif 2621#ifdef HAS_ATTRIBUTE_a_pbr 2622#else 2623#ifdef HAS_ATTRIBUTE_a_color_4f 2624albedo*=color_4f; 2625#endif 2626#endif 2627#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 2628vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 2629#ifdef UNPREMULT_TEXTURE_IN_SHADER 2630if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; 2631#endif 2632if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 2633#endif 2634vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 2635#ifdef APPLY_LUT_ON_GPU 2636color=applyLUT(u_lutTexture,color); 2637#endif 2638return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 2639#ifdef HAS_TEXTURE_u_normalTexture 2640highp 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; 2641#ifdef FLIP_Y 2642T=-T;B=-B; 2643#endif 2644highp 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; 2645#else 2646return mat3(1.0); 2647#endif 2648}highp vec3 getNormal(){highp vec3 n; 2649#ifdef HAS_ATTRIBUTE_a_normal_3f 2650n=normalize(normal_3f); 2651#else 2652highp 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)); 2653#ifdef FLIP_Y 2654n=normalize(cross(fdx,fdy)); 2655#else 2656n=normalize(cross(fdx,fdy))*-1.0; 2657#endif 2658#endif 2659#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2660vec3 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); 2661#endif 2662return 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; 2663#ifdef HAS_ATTRIBUTE_a_pbr 2664mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 2665#endif 2666#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2667vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 2668#endif 2669const 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) 2670{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) 2671{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 2672{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) 2673{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) 2674{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) 2675{ 2676#ifdef LIGHTING_3D_MODE 2677return mat.diffuseColor; 2678#else 2679return mat.diffuseColor/PI; 2680#endif 2681}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 2682{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) 2683{vec3 env_light=vec3(0.65,0.65,0.65); 2684#ifdef LIGHTING_3D_MODE 2685float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 2686#endif 2687vec3 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) 2688{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; 2689#ifdef RENDER_SHADOWS 2690lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2691#else 2692lighting_factor=NdotL; 2693#endif 2694vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2694Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 2695#if !defined(LIGHTING_3D_MODE) 2696const 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); 2697#endif 2698color*=intensityFactor;return color;}void main() { 2699#ifdef TERRAIN_FRAGMENT_OCCLUSION 2700if (isOccluded()) {discard;} 2701#endif 2702vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 2703#ifdef LIGHTING_3D_MODE 2704lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 2705#endif 2706vec4 finalColor; 2707#ifdef DIFFUSE_SHADED 2708vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 2709#ifdef HAS_TEXTURE_u_occlusionTexture 2710float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 2711#endif 2712finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 2713#else 2714Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 2715#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2716#ifdef OCCLUSION_TEXTURE_TRANSFORM 2717vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 2718#else 2719vec2 uv=uv_2f; 2720#endif 2721ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 2722#endif 2723vec4 emissive=u_emissiveFactor; 2724#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2725emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 2726#endif 2727#ifdef APPLY_LUT_ON_GPU 2728float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 2729#endif 2730color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 2731#ifdef HAS_ATTRIBUTE_a_pbr 2732float 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; 2733#ifdef APPLY_LUT_ON_GPU 2734color_mix=applyLUT(u_lutTexture,color_mix); 2735#endif 2736color=mix(color,color_mix,min(1.0,resEmission)); 2737#ifdef HAS_ATTRIBUTE_a_color_4f 2738float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2738y));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); 2739#endif 2740#endif 2741vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 2742#endif 2743#ifdef DITHERED_DISCARD 2744if (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}} 2745#endif 2746#ifdef FOG 2747finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 2748#endif 2749#ifdef RENDER_CUTOFF 2750finalColor*=v_cutoff_opacity; 2751#endif 2752#ifdef INDICATOR_CUTOUT 2753finalColor=applyCutout(finalColor,v_position_height.w); 2754#endif 2755#ifdef FEATURE_CUTOUT 2756finalColor=apply_feature_cutout(finalColor,gl_FragCoord); 2757#endif 2758glFragColor=finalColor; 2759#ifdef OVERDRAW_INSPECTOR 2760glFragColor=vec4(1.0); 2761#endif 2762HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2763#include "_prelude_shadow.vertex.glsl" 2764in vec3 a_pos_3f; 2765#pragma mapbox: define-attribute highp vec3 normal_3f 2766#pragma mapbox: define-attribute highp vec2 uv_2f 2767#pragma mapbox: define-attribute highp vec3 color_3f 2768#pragma mapbox: define-attribute highp vec4 color_4f 2769#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr 2770#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 2771uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 2772#ifdef INSTANCED_ARRAYS 2773in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2774#else 2775uniform highp mat4 u_normal_matrix; 2776#endif 2777#ifdef RENDER_SHADOWS 2778uniform 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; 2779#endif 2780out vec4 v_position_height;out lowp vec4 v_color_mix; 2781#ifdef TERRAIN_FRAGMENT_OCCLUSION 2782out highp float v_depth; 2783#endif 2784#ifdef HAS_ATTRIBUTE_a_pbr 2785out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 2786#endif 2787vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 2788#pragma mapbox: initialize-attribute highp vec3 normal_3f 2789#pragma mapbox: initialize-attribute highp vec2 uv_2f 2790#pragma mapbox: initialize-attribute highp vec3 color_3f 2791#pragma mapbox: initialize-attribute highp vec4 color_4f 2792#pragma mapbox: initialize-attribute-custom highp vec4 pbr 2793#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 2794highp mat4 normal_matrix; 2795#ifdef INSTANCED_ARRAYS 2796normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2797#else 2798normal_matrix=u_normal_matrix; 2799#endif 2800vec3 local_pos;mat3 rs; 2801#ifdef MODEL_POSITION_ON_GPU 2802vec3 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; 2803#else 2804local_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); 2805#endif 2806v_position_height.w=a_pos_3f.z; 2807#ifdef HAS_ATTRIBUTE_a_pbr 2808vec4 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; 2809#endif 2810#ifdef FOG 2811v_fog_pos=fog_position(local_pos); 2812#endif 2813#ifdef RENDER_CUTOFF 2814v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2815#endif 2816#ifdef TERRAIN_FRAGMENT_OCCLUSION 2817v_depth=gl_Position.z/gl_Position.w; 2818#ifdef CLIP_ZERO_TO_ONE 2819v_depth=-1.0+2.0*v_depth; 2820#endif 2821#endif 2822#ifdef HAS_ATTRIBUTE_a_normal_3f 2823#ifdef MODEL_POSITION_ON_GPU 2824float 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); 2825#else
2826normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 2827#endif 2828#endif 2829#ifdef HAS_ATTRIBUTE_a_pbr 2830#ifdef HAS_ATTRIBUTE_a_color_4f 2831v_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); 2832#endif 2833#endif 2834#ifdef RENDER_SHADOWS 2835vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 2836#ifdef NORMAL_OFFSET 2837#ifdef HAS_ATTRIBUTE_a_normal_3f 2838#ifdef MODEL_POSITION_ON_GPU 2839vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2840#else 2841vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2842#endif 2843#endif 2844#endif 2845v_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; 2846#endif 2847}`),modelDepth:ni(`in highp float v_depth;void main() { 2848#ifndef DEPTH_TEXTURE 2849glFragColor=pack_depth(v_depth); 2850#endif 2851}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; 2852#ifdef MODEL_POSITION_ON_GPU 2853#ifdef INSTANCED_ARRAYS 2854in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2855#else 2856uniform highp mat4 u_instance; 2857#endif 2858uniform highp mat4 u_node_matrix; 2859#endif 2860void main() { 2861#ifdef MODEL_POSITION_ON_GPU 2862highp mat4 instance; 2863#ifdef INSTANCED_ARRAYS 2864instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2865#else 2866instance=u_instance; 2867#endif 2868vec3 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;
2868rs[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); 2869#else 2870gl_Position=u_matrix*vec4(a_pos_3f,1); 2871#endif 2872v_depth=gl_Position.z/gl_Position.w;}`),stars:ni(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2873{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;}`,` 2874in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:ni("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",` 2875in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 2876uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 2877uniform float u_horizontalOscillationRate; 2878uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ 2879localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:ni("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",` 2880in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 2881uniform float u_velocity; 2882uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
2882pos*=halfBoxSize; 2883pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+ 2884localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:ni("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:ni("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" 2885in 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; 2886#ifdef TERRAIN 2887float e=elevation(world_pos.xy);world_pos.z+=e; 2888#endif 2889vec4 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 Us(l,t){const o=l.split(` 2890`);for(let c of o){if(c=c.trimStart(),c[0]!=="#"||!c.includes("if")||c.startsWith("#endif"))continue;const d=c.match(Sh);if(d)for(const p of d)_a.has(p)||t.add(p)}}function ni(l,t){const o=new Set,c=[],d=[];l=l.replace(Xl,(m,y)=>(d.push(y),"")),t=t.replace(Xl,(m,y)=>(c.push(y),""));let p=new Set(ga);Us(l,p),Us(t,p);for(const m of[...c,...d])Xc[m]||(Xc[m]=new Set,Us(Vs[m],Xc[m])),p=new Set([...p,...Xc[m]]);return{fragmentSource:l=l.replace(No,(m,y,x,T,E)=>(o.add(E),y==="define"?` 2891#ifndef HAS_UNIFORM_u_${E} 2892in ${x} ${T} ${E}; 2893#else 2894uniform ${x} ${T} u_${E}; 2895#endif 2896`:y==="initialize"?` 2897#ifdef HAS_UNIFORM_u_${E} 2898 ${x} ${T} ${E} = u_${E}; 2899#endif 2900`:y==="define-attribute"?` 2901#ifdef HAS_ATTRIBUTE_a_${E} 2902 in ${x}
2902 ${T} ${E}; 2903#endif 2904`:y==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(No,(m,y,x,T,E)=>{const C=`MATERIAL_ATTRIBUTE_OFFSET_${E}`,M=T==="float"?"vec2":T,P=`GET_ATTRIBUTE_${M}(a_${E}, materialInfo, ${C})`,F=E.match(/color/)?"color":M;return y==="define-attribute-vertex-shader-only"?` 2905#ifdef HAS_ATTRIBUTE_a_${E} 2906in ${x} ${T} a_${E}; 2907#endif 2908`:o.has(E)?y==="define"?` 2909#ifndef HAS_UNIFORM_u_${E} 2910uniform lowp float u_${E}_t; 2911 #if !defined(${C}) 2912 in ${x} ${M} a_${E}; 2913 #endif 2914out ${x} ${T} ${E}; 2915#else 2916uniform ${x} ${T} u_${E}; 2917#endif 2918`:y==="initialize"?F==="vec4"?` 2919#ifndef HAS_UNIFORM_u_${E} 2920 ${E} = a_${E}; 2921#else 2922 ${x} ${T} ${E} = u_${E}; 2923#endif 2924`:` 2925#if !defined(HAS_UNIFORM_u_${E}) 2926 #ifdef ${C} 2927 ${E} = unpack_mix_${F}(${P}, u_${E}_t); 2928 #else 2929 ${E} = unpack_mix_${F}(a_${E}, u_${E}_t); 2930 #endif 2931#else 2932 ${x} ${T} ${E} = u_${E}; 2933#endif 2934`:y==="define-attribute"?` 2935#ifdef HAS_ATTRIBUTE_a_${E} 2936 in ${x} ${T} a_${E}; 2937 out ${x} ${T} ${E}; 2938#endif 2939`:y==="initialize-attribute"?` 2940#ifdef HAS_ATTRIBUTE_a_${E} 2941 ${E} = a_${E}; 2942#endif 2943`:void 0:y==="define"?` 2944#ifndef HAS_UNIFORM_u_${E} 2945uniform lowp float u_${E}_t; 2946 #if !defined(${C}) 2947 in ${x} ${M} a_${E}; 2948 #endif 2949#else 2950uniform ${x} ${T} u_${E}; 2951#endif 2952`:y==="define-instanced"?F==="mat4"?` 2953#ifdef INSTANCED_ARRAYS 2954in vec4 a_${E}0; 2955in vec4 a_${E}1; 2956in vec4 a_${E}2; 2957in vec4 a_${E}3; 2958#else 2959uniform ${x} ${T} u_${E}; 2960#endif 2961`:` 2962#ifdef INSTANCED_ARRAYS 2963in ${x} ${M} a_${E}; 2964#else 2965uniform ${x} ${T} u_${E}; 2966#endif 2967`:y==="initialize-attribute-custom"?` 2968#ifdef HAS_ATTRIBUTE_a_${E} 2969 ${x} ${T} ${E} = a_${E}; 2970#endif 2971`:F==="vec4"?` 2972#ifndef HAS_UNIFORM_u_${E} 2973 #ifdef ${C} 2974 ${x} ${T} ${E} = ${P}; 2975 #else 2976 ${x} ${T} ${E} = a_${E}; 2977 #endif 2978#else 2979 ${x} ${T} ${E} = u_${E}; 2980#endif 2981`:` 2982#ifndef HAS_UNIFORM_u_${E} 2983 #ifdef ${C} 2984 ${x} ${T} ${E} = unpack_mix_${F}(${P}, u_${E}_t); 2985 #else 2986 ${x} ${T} ${E} = unpack_mix_${F}(a_${E}, u_${E}_t); 2987 #endif 2988#else 2989 ${x} ${T} ${E} = u_${E}; 2990#endif 2991`}),usedDefines:p,vertexIncludes:c,fragmentIncludes:d}}class y_{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,o,c,d,p,m,y,x){this.context=t;let T=this.boundPaintVertexBuffers.length!==d.length;for(let C=0;!T&&C<d.length;C++)this.boundPaintVertexBuffers[C]!==d[C]&&(T=!0);let E=this.boundDynamicVertexBuffers.length!==y.length;for(let C=0;!E&&C<y.length;C++)this.boundDynamicVertexBuffers[C]!==y[C]&&(E=!0);if(!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==c||T||E||this.boundIndexBuffer!==p||this.boundVertexOffset!==m)this.freshBind(o,c,d,p,m,y,x);else{t.bindVertexArrayOES.set(this.vao);for(const C of y)C&&(C.bind(),x&&C.instanceCount&&C.setVertexAttribDivisor(t.gl,o,x));p&&p.dynamicDraw&&p.bind()}}freshBind(t,o,c,d,p,m,y){const x=this.context,T=x.gl;this.vao&&this.destroy(),this.vao=x.gl.createVertexArray(),x.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=m,o.enableAttributes(T,t),o.bind(),o.setVertexAttribPointers(T,t,p);for(const E of c)E.enableAttributes(T,t),E.bind(),E.setVertexAttribPointers(T,t,p);for(const E of m)E&&(E.enableAttributes(T,t),E.bind(),E.setVertexAttribPointers(T,t,p),y&&E.instanceCount&&E.setVertexAttribDivisor(T,t,y));d&&d.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function x_(l,t){const o=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new s.ae(0,c/o).toLngLat().lat,new s.ae(0,(c+1)/o).toLngLat().lat]}function v_(l,t,o,c,d,p,m){const y=l.context,x=y.gl,T=o.hillshadeFBO;if(!T)return;l.prepareDrawTile();const E=l.isTileAffectedByFog(t),C=[];l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&C.push("USE_MRT1");const M=l.getOrCreateProgram("hillshade",{overrideFog:E,defines:C});y.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,T.colorAttachment0.get());const P=((j,Z,H,$)=>{const le=H.paint.get("hillshade-shadow-color"),ne=H.paint.get("hillshade-shadow-color-use-theme").
vendor: 41,261 bytes, lines 2991-2992
2991constantOr("default")==="none",se=H.paint.get("hillshade-highlight-color"),ee=H.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",J=H.paint.get("hillshade-accent-color"),ue=H.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",_e=H.paint.get("hillshade-emissive-strength");let xe=s.an(H.paint.get("hillshade-illumination-direction"));if(H.paint.get("hillshade-illumination-anchor")==="viewport")xe-=j.transform.angle;else if(j.style&&j.style.enable3dLights()&&j.style.directionalLight){const Ee=j.style.directionalLight.properties.get("direction"),Fe=s.d4(Ee.x,Ee.y,Ee.z);xe=s.an(Fe[1])}const Ae=!j.options.moving;return{u_matrix:$||j.transform.calculateProjMatrix(Z.tileID.toUnwrapped(),Ae),u_image:0,u_latrange:x_(0,Z.tileID),u_light:[H.paint.get("hillshade-exaggeration"),xe],u_shadow:le.toPremultipliedRenderColor(ne?null:H.lut),u_highlight:se.toPremultipliedRenderColor(ee?null:H.lut),u_emissive_strength:_e,u_accent:J.toPremultipliedRenderColor(ue?null:H.lut)}})(l,o,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(y,M,t.toUnwrapped());const{tileBoundsBuffer:F,tileBoundsIndexBuffer:z,tileBoundsSegments:B}=l.getTileBoundsBuffers(o);M.draw(l,x.TRIANGLES,d,p,m,zt.disabled,P,c.id,F,z,B)}function Ah(l,t,o){if(!t.needsDEMTextureUpload)return;const c=l.context,d=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(o.stride);const p=o.getPixels();t.demTexture?t.demTexture.update(p,{premultiply:!1}):t.demTexture=new s.T(c,p,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function b_(l,t,o){const c=l.context,d=c.gl;if(!t.dem)return;const p=t.dem;if(c.activeTexture.set(d.TEXTURE1),Ah(l,t,p),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=p.dim;c.activeTexture.set(d.TEXTURE0);let y=t.hillshadeFBO;if(!y){const M=new s.T(c,{width:m,height:m,data:null},d.RGBA8);M.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=t.hillshadeFBO=c.createFramebuffer(m,m,1,"renderbuffer"),y.colorAttachment0.set(M.texture)}c.bindFramebuffer.set(y.framebuffer),c.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:T,tileBoundsSegments:E}=l.getMercatorTileBoundsBuffers(),C=[];l.linearFloatFilteringSupported()&&C.push("TERRAIN_DEM_FLOAT_FORMAT"),l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&C.push("USE_MRT1"),l.getOrCreateProgram("hillshadePrepare",{defines:C}).draw(l,d.TRIANGLES,It.disabled,kt.disabled,Ut.unblended,zt.disabled,((M,P)=>{const F=P.stride,z=s.bC();return s.ce(z,0,s.al,-s.al,0,0,1),s.br(z,z,[0,-s.al,0]),{u_matrix:z,u_image:1,u_dimension:[F,F],u_zoom:M.overscaledZ}})(t.tileID,p),o.id,x,T,E),t.needsHillshadePrepare=!1}class ji{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class w_ extends ji{getDefault(){return s.ao.transparent.toNonPremultipliedRenderColor(null)}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Gf extends ji{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Mh extends ji{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Kc extends ji{getDefault(){return[!0,!0,!0,!0]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ch extends ji{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class ya extends ji{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ka extends ji{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const o=this.current;(t.func!==o.func||t.ref!==o.ref||t.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Yl extends ji{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Ja extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=t,this.dirty=!1}}class qf extends ji{getDefault(){return[0,1]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ph extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=t,this.dirty=!1}}class $f extends ji{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Qa extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.BLEND):o.disable(o.BLEND),this.current=t,this.dirty=!1}}class Jc extends ji{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Qc extends ji{getDefault(){return s.ao.transparent.toNonPremultipliedRenderColor(null)}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Rh extends ji{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class eu extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=t,this.dirty=!1}}class Kl extends ji{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Hf extends ji{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Zf=class extends ji{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class Wf extends ji{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class el extends ji{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Xf extends ji{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class T_ extends ji{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class E_ extends ji{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class S_ extends ji{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Lh extends ji{getDefault(){return null}set(t){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Dh extends ji{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class zh extends ji{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Oh extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Yf extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class tu extends ji{constructor(t,o){super(t),this.context=t,this.parent=o}getDefault(){return null}}class iu extends tu{constructor(t,o,c=0){super(t,o),this.attachmentPoint=t.gl.COLOR_ATTACHMENT0+c}setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachmentPoint,o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class tl extends tu{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,this.attachment(),o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Jl extends tu{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachment(),o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Kf extends tl{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const io=(l,t,o,c)=>({u_matrix:l,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:o,u_emissive_texture_available:c}),ru=(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:o,u_zoom_transition:d,u_merc_center:p,u_image0:0,u_image1:1,u_frustum_tl:m,u_frustum_tr:y,u_frustum_br:x,u_frustum_bl:T,u_globe_pos:E,u_globe_radius:C,u_viewport:M,u_grid_matrix:B?Float32Array.from(B):new Float32Array(9),u_skirt_height:P,u_far_z_cutoff:F,u_emissive_texture_available:z});function Ql(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const fs=new class{constructor(){this.operations={}}newMorphing(l,t,o,c,d){if(l in this.operations){const p=this.operations[l];p.to.tileID.key!==o.tileID.key&&(p.queued=o)}else this.operations[l]={startTime:c,phase:0,duration:d,from:t,to:o,queued:null}}getMorphValuesForProxy(l){if(!(l in this.operations))return null;const t=this.operations[l];return{from:t.from,to:t.to,phase:t.phase}}update(l){for(const t in this.operations){const o=this.operations[t];for(o.phase=(l-o.startTime)/o.duration;o.phase>=1||!this._validOp(o);)if(!this._nextOp(o,l)){delete this.operations[t];break}}}_nextOp(l,t){return!!l.queued&&(l.from=l.to,l.to=l.queued,l.queued=null,l.phase=0,l.startTime=t,!0)}_validOp(l){return l.from.hasData()&&l.to.hasData()}},nu={0:null,1:"TERRAIN_VERTEX_MORPHING"};function ou(l,t,o){if(t===0)return 0;const c=t<1&&o===514?.25/t:1;return 6*Math.pow(1.5,22-l)*Math.max(t,1)*c}function Fh(l,t){const o=1<<l.z;return!t&&(l.x===0||l.x===o-1)||l.y===0||l.y===o-1}function il(l,t){if(!l.style||!l.style.enable3dLights())return;const o=l.context,c=o.gl;o.activeTexture.set(c.TEXTURE1),t?t.bind(c.LINEAR,c.CLAMP_TO_EDGE):l.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE)}const ec=l=>({u_matrix:l});function tc(l,t,o,c,d){if(d>0){const p=s.o.now(),m=(p-l.timeAdded)/d,y=t?(p-t.timeAdded)/d:-1,x=o.getSource(),T=c.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),E=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),C=E&&l.refreshedUponExpiration?1:s.aA(E?m:1-y,0,1);return t?{opacity:1,mix:1-C,isFading:m<1}:{opacity:C,mix:0,isFading:m<1}}return{opacity:1,mix:0,isFading:!1}}class su extends Mn{constructor(t){const o=ha("mock-dem",{type:"raster-dem",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("mock-dem",o,!1),o.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,o){t.state="loaded",o(null)}}class kh extends Mn{constructor(t){const o=ha("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("proxy",o,!1),o.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,o,c){if(t.freezeTileCoverage)return;this.transform=t;const d=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((p,m)=>{if(p[m.key]="",!this._tiles[m.key]){const y=new Ds(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[m.key]=y}return p},{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(t){const o=this.proxyCachedFBO[t];if(o!==void 0){const c=Object.values(o);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Bh extends s.aQ{constructor(t,o,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=o,this.projMatrix=c}}class Nh extends s.bV{constructor(t,o){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,p]=(function(){const x=new s.bd,T=new s.b0,E=131;x.reserve(17161),T.reserve(33800);const C=s.al/128,M=s.al+C/2,P=M+C;for(let z=-C;z<P;z+=C)for(let B=-C;B<P;B+=C){const j=B<0||B>M||z<0||z>M?24575:0,Z=s.aA(Math.round(B),0,s.al),H=s.aA(Math.round(z),0,s.al);x.emplaceBack(Z+j,H)}const F=(z,B)=>{const j=B*E+z;T.emplaceBack(j+1,j,j+E),T.emplaceBack(j+E,j+E+1,j+1)};for(let z=1;z<129;z++)for(let B=1;B<129;B++)F(B,z);return[0,129].forEach(z=>{for(let B=0;B<130;B++)F(B,z),F(z,B)}),[x,T,32768]})(),m=t.context;this.gridBuffer=m.createVertexBuffer(c,s.bf.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=s.bg.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=s.bg.simpleSegment(0,0,c.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new kh(o.map),this.orthoMatrix=s.bC(),s.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.al,0,s.al,0,1);const y=m.gl;this._overlapStencilMode=new kt({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=o,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new su(o.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,o,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,p=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.o.now();const y=t.terrain&&t.terrain.scope,x=d.get("source"),T=p?this._mockSourceCache:t.getSourceCache(x,y);if(!T)return void s.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=T,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=m?this.calculateExaggeration(o):d.get("exaggeration"),!o.projection.requiresDraping&&m&&this._exaggeration===0)return void this._disable();this.enabled=!0;const E=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 2992This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const C=this.getScaledDemTileSize();this.sourceCache.update(o,C,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,E(),this._initializing=!0),E(),o.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(o),this._emptyDEMTextureDirty=!0,this._previousZoom=o.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const o=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const d=o!=null?c-o:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const p=t.zoom,m=this._style.terrain;if(!this._previousUpdateTimestamp)return m.getExaggeration(p);let y=p-this._previousZoom;const x=this._previousUpdateTimestamp;let T=p;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(p-T)>.5&&(y=.5*(p-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const E=m.getExaggeration(T),C=E===m.getExaggeration(Math.max(0,T-.1));if(C&&Math.abs(E-this._exaggeration)<.01)return E;let M=Math.min(.1,.00375*(this._updateTimestamp-x));return(C||E<.1||Math.abs(y)<1e-4)&&(M=Math.min(.2,4*M)),s.ak(this._exaggeration,E,M)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.dataType==="source"&&t.coord?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const o=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(s.ae.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=o.getIds().map(x=>{const T=o.getTileByID(x).tileID;return T.projMatrix=c.calculateProjMatrix(T.toUnwrapped()),T});(function(x,T){const E=T.transform.pointCoordinate(T.transform.getCameraPoint()),C=new s.P(E.x,E.y);x.sort((M,P)=>{if(P.overscaledZ-M.overscaledZ)return P.overscaledZ-M.overscaledZ;const F=new s.P(M.canonical.x+(1<<M.canonical.z)*M.wrap,M.canonical.y),z=new s.P(P.canonical.x+(1<<P.canonical.z)*P.wrap,P.canonical.y),B=C.mult(1<<M.canonical.z);return B.x-=.5,B.y-=.5,B.distSqr(F)-B.distSqr(z)})})(d,this.painter);const p=this.proxyToSource||{};this.proxyToSource={},d.forEach(x=>{this.proxyToSource[x.key]={}}),this.terrainTileForTile={};const m=this._style._mergedSourceCaches;for(const x in m){const T=m[x];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,t[x],p),T.usedForTerrain))continue;const E=t[x];T.getSource().reparseOverscaled&&this._assignTerrainTiles(E)}this.proxiedCoords[o.id]=d.map(x=>new Bh(x,x.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const T=this.terrainTileForTile[x.key];if(!T)continue;const E=T.tileID.key;E in y||(this._visibleDemTiles.push(T),y[E]=E)}}_assignTerrainTiles(t){this._initializing||t.forEach(o=>{if(this.terrainTileForTile[o.key])return;const c=this._findTileCoveringTileID(o,this.sourceCache);c&&(this.terrainTileForTile[o.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,o=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(o.TEXTURE1),Ah(this.painter,d,p))}}_prepareDemTileUniforms(t,o,c,d){if(!o||o.demTexture==null)return!1;const p=t.tileID.canonical,m=Math.pow(2,o.tileID.canonical.z-p.z),y=d||"";return c[`u_dem_tl${y}`]=[p.x*m%1,p.y*m%1],c[`u_dem_scale${y}`]=m,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const o=this._visibleDemTiles.reduce((c,d)=>{if(!d.dem)return c;const p=d.dem.tree.minimums[0];return p>0&&t++,c+p},0);return t?o/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,o=t.gl;t.activeTexture.set(o.TEXTURE2);const c=this._getLoadedAreaMinimum(),d=new s.dL({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let p=this._emptyDEMTexture;return p?p.update(d,{premultiply:!1}):p=this._emptyDEMTexture=new s.T(t,d,o.R32F,{premultiply:!1}),p}setupElevationDraw(t,o,c){const d=this.painter.context,p=d.gl,m={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};m.u_exaggeration=this.exaggeration();let y=null,x=null,T=1;if(c&&c.morphing&&this._useVertexMorphing){const P=c.morphing.srcDemTile,F=c.morphing.dstDemTile;T=c.morphing.phase,P&&F&&(this._prepareDemTileUniforms(t,P,m,"_prev")&&(x=P),this._prepareDemTileUniforms(t,F,m)&&(y=F))}const E=P=>P&&P.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST;let C=null;var M;if(this.enabled?x&&y?(C=y.demTexture,d.activeTexture.set(p.TEXTURE4),x.demTexture.bind(E(x),p.CLAMP_TO_EDGE),m.u_dem_lerp=T):(y=this.terrainTileForTile[t.tileID.key],C=this._prepareDemTileUniforms(t,y,m)?y.demTexture:this.emptyDEMTexture):C=this.emptyDEMTexture,d.activeTexture.set(p.TEXTURE2),C&&(m.u_dem_size=(M=C).size[0]===1?1:M.size[0]-2,C.bind(E(y),p.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,o,m),c&&c.useMeterToDem&&y){const P=(1<<y.tileID.canonical.z)*s.cf(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;m.u_meter_to_dem=P}if(c&&c.labelPlaneMatrixInv&&(m.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),o.setTerrainUniformValues(d,m),this.painter.transform.projection.name==="globe"){const P=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);o.setGlobeUniformValues(d,P)}}globeUniformValues(t,o,c){const d=t.projection;return{u_tile_tl_up:d.upVector(o,0,0),u_tile_tr_up:d.upVector(o,s.al,0),u_tile_br_up:d.upVector(o,s.al,s.al),u_tile_bl_up:d.upVector(o,0,s.al),u_tile_up_scale:c?s.dM(1):d.upVectorScale(o,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const o=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,o.width,o.height]),o.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,(function(d,p,m,y,x){if(d.transform.projection.name==="globe")(function(T,E,C,M,P){const F=T.context,z=F.gl;let B,j;const Z=T.transform,H=s.dE(T,F,Z),$=(Ae,Ee)=>{if(j===Ee)return;const Fe=[nu[Ee],"PROJECTION_GLOBE_VIEW"];H&&Fe.push("CUSTOM_ANTIALIASING");const $e=T.isTileAffectedByFog(Ae);B=T.getOrCreateProgram("globeRaster",{defines:Fe,overrideFog:$e}),j=Ee},le=T.colorModeForRenderPass(),ne=new It(z.LEQUAL,It.ReadWrite,T.depthRangeFor3D);fs.update(P);const se=s.dF(Z),ee=[s.aF(Z.center.lng),s.aJ(Z.center.lat)],J=T.globeSharedBuffers,ue=[Z.width*s.o.devicePixelRatio,Z.height*s.o.devicePixelRatio],_e=Float32Array.from(Z.globeMatrix),xe={useDenormalizedUpVectorScale:!0};{const Ae=T.transform,Ee=ou(Ae.zoom,E.exaggeration(),E.sourceCache._source.tileSize);j=-1;const Fe=z.TRIANGLES;for(const $e of M){const Te=C.getTile($e),he=kt.disabled,ze=E.prevTerrainTileForTile[$e.key],Me=E.terrainTileForTile[$e.key];Ql(ze,Me)&&fs.newMorphing($e.key,ze,Me,P,250),il(T,Te.emissiveTexture),F.activeTexture.set(z.TEXTURE0),Te.texture&&Te.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const We=fs.getMorphValuesForProxy($e.key),et=We?1:0;We&&Object.assign(xe,{morphing:{srcDemTile:We.from,dstDemTile:We.to,phase:s.dD(We.phase)}});const ut=s.dG($e.canonical),tt=s.dH(ut.getCenter().lat),nt=s.dI($e.canonical,ut,tt,Ae.worldSize/Ae._pixelsPerMercatorPixel),Et=s.bk(s.dJ($e.canonical)),wt=T.emissiveMode==="mrt-fallback"?1:0,pt=ru(Ae.expandedFarZProjMatrix,_e,se,Et,s.aj(Ae.zoom),ee,Ae.frustumCorners.TL,Ae.frustumCorners.TR,Ae.frustumCorners.BR,Ae.frustumCorners.BL,Ae.globeCenterInViewSpace,Ae.globeRadius,ue,Ee,Ae._farZ,wt,nt);if($($e,et),B&&(E.setupElevationDraw(Te,B,xe),T.uploadCommonUniforms(F,B,$e.toUnwrapped()),J)){const[bt,Ct,Ot]=J.getGridBuffers(tt,Ee!==0);B.draw(T,Fe,ne,he,le,zt.backCCW,pt,"globe_raster",bt,Ct,Ot)}}}if(J&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const Ae=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];H&&Ae.push("CUSTOM_ANTIALIASING"),B=T.getOrCreateProgram("globeRaster",{defines:Ae});for(const Ee of M){const{x:Fe,y:$e,z:Te}=Ee.canonical,he=$e===0,ze=$e===(1<<Te)-1,[Me,We,et,ut]=J.getPoleBuffers(Te,!1);if(ut&&(he||ze)){const tt=C.getTile(Ee);il(T,tt.emissiveTexture),F.activeTexture.set(z.TEXTURE0),tt.texture&&tt.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);let nt=s.dK(Te,Fe,Z);const Et=s.bk(s.dJ(Ee.canonical)),wt=T.emissiveMode==="mrt-fallback"?1:0,pt=(bt,Ct)=>bt.draw(T,z.TRIANGLES,ne,kt.disabled,le,zt.disabled,ru(Z.expandedFarZProjMatrix,nt,nt,Et,0,ee,Z.frustumCorners.TL,Z.frustumCorners.TR,Z.frustumCorners.BR,Z.frustumCorners.BL,Z.globeCenterInViewSpace,Z.globeRadius,ue,0,Z._farZ,wt),"globe_pole_raster",Ct,et,ut);E.setupElevationDraw(tt,B,xe),T.uploadCommonUniforms(F,B,Ee.toUnwrapped()),he&&T.renderDefaultNorthPole&&pt(B,Me),ze&&T.renderDefaultSouthPole&&(nt=s.cS(s.bC(),nt,[1,-1,1]),pt(B,We))}}}})(d,p,m,y,x);else{const T=d.context,E=T.gl;let C,M;const P=d.shadowRenderer,F=vo(d,d.longestCutoffRange),z=le=>{if(M===le)return;const ne=[];ne.push(nu[le]),F.shouldRenderCutoff&&ne.push("RENDER_CUTOFF"),P&&(ne.push("RENDER_SHADOWS","DEPTH_TEXTURE"),P.useNormalOffset&&ne.push("NORMAL_OFFSET")),C=d.getOrCreateProgram("terrainRaster",{defines:ne}),M=le},B=d.colorModeForRenderPass(),j=new It(E.LEQUAL,It.ReadWrite,d.depthRangeFor3D);fs.update(x);const Z=d.transform,H=ou(Z.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let $=[0,0,0];if(P){const le=d.style.directionalLight,ne=d.style.ambientLight;le&&ne&&($=bo(d.style,le,ne))}{M=-1;const le=E.TRIANGLES,[ne,se]=[p.gridIndexBuffer,p.gridSegments];for(const ee of y){const J=m.getTile(ee),ue=kt.disabled,_e=p.prevTerrainTileForTile[ee.key],xe=p.terrainTileForTile[ee.key];Ql(_e,xe)&&fs.newMorphing(ee.key,_e,xe,x,250),il(d,J.emissiveTexture),T.activeTexture.set(E.TEXTURE0),J.texture&&J.texture.bind(E.LINEAR,E.CLAMP_TO_EDGE);const Ae=fs.getMorphValuesForProxy(ee.key),Ee=Ae?1:0;let Fe;Ae&&(Fe={morphing:{srcDemTile:Ae.from,dstDemTile:Ae.to,phase:s.dD(Ae.phase)}});const $e=d.emissiveMode==="mrt-fallback"?1:0,Te=io(ee.projMatrix,Fh(ee.canonical,Z.renderWorldCopies)?H/10:H,$,$e);if(z(Ee),!C)continue;p.setupElevationDraw(J,C,Fe);const he=ee.toUnwrapped();P&&P.setupShadows(he,C),d.uploadCommonUniforms(T,C,he,null,F),C.draw(d,le,j,ue,B,zt.backCCW,Te,"terrain_raster",p.gridBuffer,ne,se)}}}})(o,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,o.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const o=this.painter,c=this.painter.context,d=this.proxySourceCache,p=this.proxiedCoords[d.id],m=this._drapedRenderBatches.shift(),y=o.style.order,x=[];this._updateFBOs(o.emissiveMode==="mrt-fallback");let T=0;for(const E of p){const C=d.getTileByID(E.proxyTileKey),M=d.proxyCachedFBO[E.key]?d.proxyCachedFBO[E.key][t]:void 0,P=M!==void 0?d.renderCache[M]:this.pool[T++],F=M!==void 0;if(C.texture=P.tex,C.emissiveTexture=P.emissiveTex,F&&!P.dirty){x.push(C.tileID);continue}c.bindFramebuffer.set(P.fb.framebuffer);const z=c.gl;let B;z.drawBuffers(o.emissiveMode==="mrt-fallback"?[z.COLOR_ATTACHMENT0,z.COLOR_ATTACHMENT1]:[z.COLOR_ATTACHMENT0]),this.renderedToTile=!1,P.dirty&&(c.clear({color:s.ao.transparent,stencil:0}),P.dirty=!1);for(let j=m.start;j<=m.end;++j){const Z=o.style._mergedLayers[y[j]];if(Z.isHidden(o.transform.zoom))continue;const H=o.style.getLayerSourceCache(Z),$=H?this.proxyToSource[E.key][H.id]:[E];if(!$)continue;const le=$;c.viewport.set([0,0,P.fb.width,P.fb.height]),B!==(H?H.id:null)&&(this._setupStencil(P,$,Z,H),B=H?H.id:null),o.renderLayer(o,H,Z,le)}if(z.drawBuffers([z.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const j of this._pendingGroundEffectLayers){const Z=o.style._mergedLayers[y[j]];if(Z.isHidden(o.transform.zoom))continue;const H=o.style.getLayerSourceCache(Z),$=H?this.proxyToSource[E.key][H.id]:[E];if(!$)continue;const le=$;c.viewport.set([0,0,P.fb.width,P.fb.height]),B!==(H?H.id:null)&&(this._setupStencil(P,$,Z,H),B=H?H.id:null),o.renderLayer(o,H,Z,le)}this.renderedToTile?(P.dirty=!0,x.push(C.tileID)):F||--T,T===5&&(T=0,this.renderToBackBuffer(x))}return this.renderToBackBuffer(x),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,o.width,o.height]),m.end+1}postRender(){}isLayerOrderingCorrect(t){const o=t.order.length;let c=-1,d=o;for(let p=0;p<o;++p)this._style.isLayerDraped(t._mergedLayers[t.order[p]])?c=Math.max(c,p):d=Math.min(d,p);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(o=>o.dem).forEach(o=>{t=Math.min(t,o.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,o,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(p=>p.dem).map(p=>{const m=p.tileID,y=1<<m.overscaledZ,{x,y:T}=m.canonical,E=x/y,C=(x+1)/y,M=T/y,P=(T+1)/y;return{minx:E,miny:M,maxx:C,maxy:P,t:p.dem.tree.raycastRoot(E,M,C,P,t,o,c),tile:p}});d.sort((p,m)=>(p.t!==null?p.t:Number.MAX_VALUE)-(m.t!==null?m.t:Number.MAX_VALUE));for(const p of d){if(p.t==null)return null;const m=p.tile.dem.tree.raycast(p.minx,p.miny,p.maxx,p.maxy,t,o,c);if(m!=null)return m}return null}_createFBO(){const t=this.painter.context,o=t.gl,c=this.drapeBufferSize;t.activeTexture.set(o.TEXTURE0);const d=new s.T(t,{width:c[0],height:c[1],data:null},o.RGBA8);d.bind(o.LINEAR,o.CLAMP_TO_EDGE);const p=t.createFramebuffer(c[0],c[1],1,null);let m;return p.colorAttachment0.set(d.texture),this._emissiveTexture&&(m=new s.T(t,{width:c[0],height:c[1],data:null},o.R8),m.bind(o.LINEAR,o.CLAMP_TO_EDGE),p.createColorAttachment(t,1),p.colorAttachment1.set(m.texture)),p.depthAttachment=new Kf(t,p.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,p.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):p.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:p,tex:d,emissiveTex:m,dirty:!1}}_updateFBOs(t){if(this._emissiveTexture!==t){for(const o of this.pool)this._updateFBO(o,t);for(const o of this.proxySourceCache.renderCache)this._updateFBO(o,t);this._emissiveTexture=t}}_updateFBO(t,o){const c=t.fb,d=this.painter.context,p=d.gl,m=this.drapeBufferSize;if(o){const y=new s.T(d,{width:m[0],height:m[1],data:null},p.R8);y.bind(p.LINEAR,p.CLAMP_TO_EDGE),t.emissiveTex=y,c.createColorAttachment(d,1),c.colorAttachment1.set(y.texture)}else t.emissiveTex=void 0,c.removeColorAttachment(d,1);t.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const o=this._style._mergedLayers[t],c=o.isHidden(this.painter.transform.zoom);return o.type==="hillshade"||o.type==="custom"?!c&&o.shouldRedrape():!c&&o.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof yo){t=!0;break}if(!t)return;const o={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(!p||o[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="line")continue;const m=d.widthExpression(),y=d.emissiveStrengthExpression();if(m instanceof s.ad||y instanceof s.ad){o[p.id]=!0;for(const x of this.proxyCoords){const T=this.proxyToSource[x.key][p.id];if(T)for(const E of T)this._clearRenderCacheForTile(p.id,E)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof Ao){t=!0;break}if(!t)return;const o={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(!p||o[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const m=d.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const x=this.proxyToSource[y.key][p.id];if(x)for(const T of x){const E=tc(p.getTile(T),p.findLoadedParent(T,0),p,this.painter.transform,m);(E.opacity!==1||E.mix!==0)&&this._clearRenderCacheForTile(p.id,T)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,o=t.length;if(o===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,p=0,m=this._style._mergedLayers[t[p]];for(;!this._style.isLayerDraped(m)&&m.isHidden(this.painter.transform.zoom)&&++p<o;)m=this._style._mergedLayers[t[p]];for(;p<o;++p){const y=this._style._mergedLayers[t[p]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=p):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(c.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:p-1}),c.length!==0){const y=c[c.length-1];this._pendingGroundEffectLayers.every(x=>x>y.end)||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const o=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,o.renderCache.length>o.renderCachePool.length){const m=Object.values(o.proxyCachedFBO);o.proxyCachedFBO={};for(let y=0;y<m.length;++y){const x=Object.values(m[y]);o.renderCachePool.push(...x)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let m=c.length-1;m>=0;m--){const y=c[m];if(o.getTileByID(y.key),o.proxyCachedFBO[y.key]!==void 0){const x=t[y.key],T=this.proxyToSource[y.key];let E=0;for(const C in T){const M=T[C],P=x[C];if(!P||P.length!==M.length||M.some((F,z)=>F!==P[z]||d[C]&&d[C].hasOwnProperty(F.key))){E=-1;break}++E}for(const C in o.proxyCachedFBO[y.key])o.renderCache[o.proxyCachedFBO[y.key][C]].dirty=E<0||E!==Object.values(x).length}}const p=[...this._drapedRenderBatches];p.sort((m,y)=>y.end-y.start-(m.end-m.start));for(const m of p)for(const y of c){if(o.proxyCachedFBO[y.key])continue;let x=o.renderCachePool.pop();x===void 0&&o.renderCache.length<50&&(x=o.renderCache.length,o.renderCache.push(this._createFBO())),x!==void 0&&(o.proxyCachedFBO[y.key]={},o.proxyCachedFBO[y.key][m.start]=x,o.renderCache[x].dirty=!0)}this._tilesDirty={}}_setupStencil(t,o,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const p=this.painter.context,m=p.gl;if(o.length<=1)return void(this._overlapStencilType=!1);let y;if(c.isTileClipped())y=o.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(o[0].overscaledZ>o[o.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:m.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(o,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):kt.disabled}_renderTileClippingMasks(t,o){const c=this.painter,d=this.painter.context,p=d.gl;c._tileClippingMaskIDs={},d.setColorMode(Ut.disabled),d.setDepthMode(It.disabled);const m=c.getOrCreateProgram("clippingMask");for(const y of t){const x=c._tileClippingMaskIDs[y.key]=--o;m.draw(c,p.TRIANGLES,It.disabled,new kt({func:p.ALWAYS,mask:0},x,255,p.KEEP,p.KEEP,p.REPLACE),Ut.disabled,zt.disabled,ec(y.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const o=this.painter.transform;if(t.x<0||t.x>o.width||t.y<0||t.y>o.height)return null;const c=[t.x,t.y,1,1];s.aC(c,c,o.pixelMatrixInverse),s.cK(c,c,1/c[3]),c[0]/=o.worldSize,c[1]/=o.worldSize;const d=o._camera.position,p=s.cf(1,o.center.lat),m=[d[0],d[1],d[2]/p,0],y=s.da([],c.slice(0,3),m);s.aw(y,y);const x=this.raycast(m,y,this._exaggeration);return x!==null&&x?(s.bH(m,m,y,x),m[3]=m[2],m[2]*=p,m):null}_setupProxiedCoordsForOrtho(t,o,c){if(t.getSource()instanceof s.aU)return this._setupProxiedCoordsForImageSource(t,o,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords;for(let x=0;x<p.length;x++){const T=p[x],E=this._findTileCoveringTileID(T,t);if(E){const C=this._createProxiedId(T,E,c[T.key]&&c[T.key][t.id]);d.push(C),this.proxyToSource[T.key][t.id]=[C]}}let m=!1;const y=new Set;for(let x=0;x<o.length;x++){const T=t.getTile(o[x]);if(!T||!T.hasData())continue;const E=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(E&&E.tileID.canonical.z!==T.tileID.canonical.z){const C=this.proxyToSource[E.tileID.key][t.id],M=this._createProxiedId(E.tileID,T,c[E.tileID.key]&&c[E.tileID.key][t.id]);C?C.splice(C.length-1,0,M):this.proxyToSource[E.tileID.key][t.id]=[M];const P=this.proxyToSource[E.tileID.key][t.id];y.has(P)||y.add(P),d.push(M),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m&&this._debugParams.sortTilesHiZFirst)for(const x of y)x.sort((T,E)=>E.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(t,o,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords,m=t.getSource(),y=m.tileID;if(!y)return;const x=new s.P(y.x,y.y)._div(1<<y.z),T=m.coordinates.map(s.ae.fromLngLat).reduce((C,M)=>(C.min.x=Math.min(C.min.x,M.x-x.x),C.min.y=Math.min(C.min.y,M.y-x.y),C.max.x=Math.max(C.max.x,M.x-x.x),C.max.y=Math.max(C.max.y,M.y-x.y),C),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),E=(C,M)=>{const P=C.wrap+C.canonical.x/(1<<C.canonical.z),F=C.canonical.y/(1<<C.canonical.z),z=s.al/(1<<C.canonical.z),B=M.wrap+M.canonical.x/(1<<M.canonical.z),j=M.canonical.y/(1<<M.canonical.z);return P+z<B+T.min.x||P>B+T.max.x||F+z<j+T.min.y||F>j+T.max.y};for(let C=0;C<p.length;C++){const M=p[C];for(let P=0;P<o.length;P++){const F=t.getTile(o[P]);if(!F||!F.hasData()||E(M,F.tileID))continue;const z=this._createProxiedId(M,F,c[M.key]&&c[M.key][t.id]),B=this.proxyToSource[M.key][t.id];B?B.push(z):this.proxyToSource[M.key][t.id]=[z],d.push(z)}}}_createProxiedId(t,o,c){let d=this.orthoMatrix;if(c){const p=c.find(m=>m.key===o.tileID.key);if(p)return p}if(o.tileID.key!==t.key){const p=t.canonical.z-o.tileID.canonical.z;let m,y,x;d=s.bC();const T=o.tileID.wrap-t.wrap<<t.overscaledZ;p>0?(m=s.al>>p,y=m*((o.tileID.canonical.x<<p)-t.canonical.x+T),x=m*((o.tileID.canonical.y<<p)-t.canonical.y)):(m=s.al<<-p,y=s.al*(o.tileID.canonical.x-(t.canonical.x+T<<-p)),x=s.al*(o.tileID.canonical.y-(t.canonical.y<<-p))),s.ce(d,0,m,0,m,0,1),s.br(d,d,[y,x,0])}return new Bh(o.tileID,t.key,d)}_findTileCoveringTileID(t,o){let c=o.getTile(t);if(c&&c.hasData())return c;const d=this._findCoveringTileCache[o.id],p=d[t.key];
2992if(c=p?o.getTileByID(p):null,c&&c.hasData()||p===null)return c;let m=c?c.tileID:t,y=m.overscaledZ;const x=o.getSource().minzoom,T=[];if(!p){const C=o.getSource().maxzoom;if(t.canonical.z>=C){const M=t.canonical.z-C;o.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,o.transform.tileZoom),m=new s.aQ(y,t.wrap,C,t.canonical.x>>M,t.canonical.y>>M)):M!==0&&(y=C,m=new s.aQ(y,t.wrap,C,t.canonical.x>>M,t.canonical.y>>M))}m.key!==t.key&&(T.push(m.key),c=o.getTile(m))}const E=C=>{T.forEach(M=>{d[M]=C}),T.length=0};for(y-=1;y>=x&&(!c||!c.hasData());y--){c&&E(c.tileID.key);const C=m.calculateScaledKey(y);if(c=o.getTileByID(C),c&&c.hasData())break;const M=d[C];if(M===null)break;M===void 0?T.push(C):c=o.getTileByID(M)}return E(c?c.tileID.key:null),c&&c.hasData()?c:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,o){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[o.key]=!0}}function rl(l,t,o){const c=(function(y,x,T){const E=s.bJ(x,y),C=s.bJ(T,[.2126,.7152,.0722]),M=(F,z,B)=>(1-B)*F+B*z,P=M(1-.3*Math.min(C,1),1,Math.min(E+1,1));return M(.92,1,Math.asin(s.aA(x[2],-1,1))/Math.PI+.5)*P})(l,[0,0,1],t),d=[0,0,0];s.c5(d,o.slice(0,3),c);const p=[0,0,0];s.c5(p,t.slice(0,3),l[2]);const m=[0,0,0];return s.d8(m,d,p),s.db(m)}const I_=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],A_=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class Jf{static cacheKey(t,o,c,d){const p=[o];d&&p.push(d.cacheKey);for(const m of c)t.usedDefines.has(m)&&p.push(m);return p.join("/")}constructor(t,o,c,d,p,m){const y=t.gl;this.program=y.createProgram(),this.configuration=d,this.name=o,this.fixedDefines=[...m];const x=`#version 300 es 2993${(d?d.defines():[]).concat(m.map(z=>`#define ${z}`)).join(` 2994`)}`,T=[x,g_];for(const z of c.fragmentIncludes)T.push(Vs[z]);T.push(c.fragmentSource);const E=T.join(` 2995`),C=[x,jf];for(const z of c.vertexIncludes)C.push(Vs[z]);this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&C.push("uniform int u_instanceID;"),C.push(c.vertexSource);let M=C.join(` 2996`);this.forceManualRenderingForInstanceIDShaders&&(M=M.replaceAll("gl_InstanceID","u_instanceID"));const P=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(P,E),y.compileShader(P),y.attachShader(this.program,P);const F=y.createShader(y.VERTEX_SHADER);y.isContextLost()?this.failedToCreate=!0:(y.shaderSource(F,M),y.compileShader(F),y.attachShader(this.program,F),this.attributes={},y.linkProgram(this.program),y.deleteShader(F),y.deleteShader(P),this.fixedUniforms=p(t),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(z=>({u_instanceID:new s.ch(z)}))(t)),(m.includes("TERRAIN")||o.includes("symbol")||o.includes("circle"))&&(this.terrainUniforms=(z=>({u_dem:new s.ch(z),u_dem_prev:new s.ch(z),u_dem_tl:new s.ck(z),u_dem_scale:new s.cj(z),u_dem_tl_prev:new s.ck(z),u_dem_scale_prev:new s.cj(z),u_dem_size:new s.cj(z),u_dem_lerp:new s.cj(z),u_exaggeration:new s.cj(z),u_depth:new s.ch(z),u_depth_size_inv:new s.ck(z),u_depth_range_unpack:new s.ck(z),u_occluder_half_size:new s.cj(z),u_occlusion_depth_offset:new s.cj(z),u_meter_to_dem:new s.cj(z),u_label_plane_matrix_inv:new s.cl(z)}))(t)),m.includes("GLOBE")&&(this.globeUniforms=(z=>({u_tile_tl_up:new s.ci(z),u_tile_tr_up:new s.ci(z),u_tile_br_up:new s.ci(z),u_tile_bl_up:new s.ci(z),u_tile_up_scale:new s.cj(z)}))(t)),m.includes("FOG")&&(this.fogUniforms=(z=>({u_fog_matrix:new s.cl(z),u_fog_range:new s.ck(z),u_fog_color:new s.d3(z),u_fog_horizon_blend:new s.cj(z),u_fog_vertical_limit:new s.ck(z),u_fog_temporal_offset:new s.cj(z),u_frustum_tl:new s.ci(z),u_frustum_tr:new s.ci(z),u_frustum_br:new s.ci(z),u_frustum_bl:new s.ci(z),u_globe_pos:new s.ci(z),u_globe_radius:new s.cj(z),u_globe_transition:new s.cj(z),u_is_globe:new s.ch(z),u_viewport:new s.ck(z)}))(t)),m.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(z=>({u_cutoff_params:new s.d3(z)}))(t)),m.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(z=>({u_lighting_ambient_color:new s.ci(z),u_lighting_directional_dir:new s.ci(z),u_lighting_directional_color:new s.ci(z),u_ground_radiance:new s.ci(z)}))(t)),m.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(z=>({u_light_matrix_0:new s.cl(z),u_light_matrix_1:new s.cl(z),u_fade_range:new s.ck(z),u_shadow_normal_offset:new s.ci(z),u_shadow_intensity:new s.cj(z),u_shadow_texel_size:new s.cj(z),u_shadow_map_resolution:new s.cj(z),u_shadow_direction:new s.ci(z),u_shadow_bias:new s.ci(z),u_shadowmap_0:new s.ch(z),u_shadowmap_1:new s.ch(z)}))(t)))}getAttributeLocation(t,o){let c=this.attributes[o];return c===void 0&&(c=this.attributes[o]=t.getAttribLocation(this.program,o)),c}setTerrainUniformValues(t,o){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d]&&c[d].set(this.program,d,o[d])}}setGlobeUniformValues(t,o){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d]&&c[d].set(this.program,d,o[d])}}setFogUniformValues(t,o){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setCutoffUniformValues(t,o){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setLightsUniformValues(t,o){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setShadowUniformValues(t,o){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}_drawDebugWireframe(t,o,c,d,p,m,y,x,T,E){const C=t.options.wireframe;if(C.terrain===!1&&C.layers2D===!1&&C.layers3D===!1)return;const M=t.context;if(!(!(!C.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!C.layers2D||t._terrain&&t._terrain.renderingToTexture||!I_.includes(this.name))||!(!C.layers3D||!A_.includes(this.name))))return;const P=M.gl,F=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,p,M);if(!F)return;
2996const z=[...this.fixedDefines,"DEBUG_WIREFRAME"],B=t.getOrCreateProgram(this.name,{config:this.configuration,defines:z});M.program.set(B.program);const j=($,le,ne)=>{if(le[$]&&ne[$])for(const se in le[$])ne[$][se]&&ne[$][se].set(ne.program,se,le[$][se].current)};T&&T.setUniforms(B.program,M,B.binderUniforms,y,{zoom:x}),j("fixedUniforms",this,B),j("terrainUniforms",this,B),j("globeUniforms",this,B),j("fogUniforms",this,B),j("lightsUniforms",this,B),j("shadowUniforms",this,B),F.bind(),M.setColorMode(new Ut([P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ZERO,P.ONE],s.ao.transparent,[!0,!0,!0,!1])),M.setDepthMode(new It(o.func===P.LESS?P.LEQUAL:o.func,It.ReadOnly,o.range)),M.setStencilMode(kt.disabled);const Z=3*m.primitiveLength*2,H=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const $=E||1;for(let le=0;le<$;++le)B.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",le),P.drawElements(P.LINES,Z,P.UNSIGNED_SHORT,H)}else E&&E>1?P.drawElementsInstanced(P.LINES,Z,P.UNSIGNED_SHORT,H,E):P.drawElements(P.LINES,Z,P.UNSIGNED_SHORT,H);p.bind(),M.program.set(this.program),M.setDepthMode(o),M.setStencilMode(c),M.setColorMode(d)}checkUniforms(t,o,c){if(this.fixedDefines.includes(o)){for(const d of Object.keys(c))if(!c[d].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${d} not set but required by ${o} being defined`)}}draw(t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B){const j=t.context,Z=j.gl;if(this.failedToCreate)return;j.program.set(this.program),j.setDepthMode(c),j.setStencilMode(d),j.setColorMode(p),j.setCullFace(m);for(const[ee,J]of this.fixedUniformsEntries)J.set(this.program,ee,y[ee]);F&&F.setUniforms(this.program,j,this.binderUniforms,M,{zoom:P});const H={[Z.POINTS]:1,[Z.LINES]:2,[Z.TRIANGLES]:3,[Z.LINE_STRIP]:1}[o];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const $=z||[],le=F?F.getPaintVertexBuffers():[],ne=o===Z.TRIANGLES&&E,se=B&&B>0?1:void 0;for(const ee of C.get()){const J=ee.vaos||(ee.vaos={});if((J[x]||(J[x]=new y_)).bind(j,this,T,le,E,ee.vertexOffset,$,se),this.forceManualRenderingForInstanceIDShaders){const ue=B||1;for(let _e=0;_e<ue;++_e)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",_e),E?Z.drawElements(o,ee.primitiveLength*H,Z.UNSIGNED_SHORT,ee.primitiveOffset*H*2):Z.drawArrays(o,ee.vertexOffset,ee.vertexLength)}else B&&B>1?Z.drawElementsInstanced(o,ee.primitiveLength*H,Z.UNSIGNED_SHORT,ee.primitiveOffset*H*2,B):E?Z.drawElements(o,ee.primitiveLength*H,Z.UNSIGNED_SHORT,ee.primitiveOffset*H*2):Z.drawArrays(o,ee.vertexOffset,ee.vertexLength);ne&&this._drawDebugWireframe(t,c,d,p,E,ee,M,P,F,B)}}}function Qf(l,t,o=0){const c=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,l.transform.tileZoom)/c,p=d*(t.tileID.canonical.x+t.tileID.wrap*c),m=d*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.ay(t,1,l.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m],u_pattern_transition:o}}const au={terrain:0,flat:1},M_=s.bC(),lu=(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B,j)=>{const Z=t.style.light,H=Z.properties.get("position"),$=[H.x,H.y,H.z],le=s.dO();Z.properties.get("anchor")==="viewport"&&(s.dP(le,-t.transform.angle),s.dQ($,$,le));const ne=Z.properties.get("color").toPremultipliedRenderColor(null),se=t.transform,ee={u_matrix:l,u_lightpos:$,u_lightintensity:Z.properties.get("intensity"),u_lightcolor:[ne.r,ne.g,ne.b],u_vertical_gradient:+o,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:M_,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:au[T],u_base_type:au[E],u_ao:d,u_edge_radius:p,u_width_scale:m,u_flood_light_color:F,u_vertical_scale:z,u_flood_light_intensity:B,u_ground_shadow_factor:j};return se.projection.name==="globe"&&(ee.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],ee.u_zoom_transition=C,ee.u_inv_rot_matrix=P,ee.u_merc_center=M,ee.u_up_dir=se.projection.upVector(new s.cD(0,0,0),M[0]*s.al,M[1]*s.al),ee.u_height_lift=x),ee},Vh=(l,t,o,c,d,p)=>({u_matrix:l,u_edge_radius:t,u_width_scale:o,u_vertical_scale:c,u_height_type:au[d],u_base_type:au[p]}),ep=(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B,j)=>{const Z=lu(l,t,o,c,d,p,m,y,T,E,C,M,P,F,z,B,1,[0,0,0]),H={u_height_factor:-Math.pow(2,y.overscaledZ
2996)/x.tileSize/8};return Object.assign(Z,Qf(t,x,j),H)},xa=(l,t,o)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:o}),Uh=(l,t,o,c,d,p=0)=>Object.assign(xa(l,t,d),Qf(o,c,p)),tp=(l,t,o,c)=>({u_matrix:l,u_world:o,u_emissive_strength:t,u_ground_shadow_factor:c}),ip=(l,t,o,c,d,p,m=0)=>Object.assign(Uh(l,t,o,c,p,m),{u_world:d}),jh=(l,t)=>({u_matrix:l,u_depth_bias:t}),js=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),va=(l,t,o,c,d)=>({u_matrix:l,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:o,u_height_scale:c,u_reset_depth:d}),cu=(l,t,o,c,d,p,m,y,x)=>({u_matrix:l,u_normal_matrix:t,u_opacity:o,u_faux_facade_ao_intensity:c,u_camera_pos:d,u_tile_to_meter:p,u_facade_emissive_chance:m,u_flood_light_color:y,u_flood_light_intensity:x}),rp=l=>({u_matrix:l}),Gs=l=>({u_matrix:l}),Gh=(l,t,o,c,d,p,m,y)=>{const x=s.al/p.tileSize;return{u_matrix:l,u_inv_rot_matrix:t,u_camera_to_center_distance:o.getCameraToCenterDistance(y),u_extrude_scale:[o.pixelsToGLUnits[0]/x,o.pixelsToGLUnits[1]/x],u_zoom_transition:c,u_tile_id:m,u_merc_center:d}},uu=(l,t,o,c)=>({u_matrix:l,u_inv_matrix:t,u_camera_to_center_distance:o.getCameraToCenterDistance(c),u_viewport_size:[o.width,o.height]}),qh=(l,t,o=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:o}),np=s.bC(),$h=(l,t,o,c,d,p,m)=>{const y=l.transform,x=y.projection.name==="globe",T=x?s.dR(y.zoom,t.canonical)*y._pixelsPerMercatorPixel:s.ay(o,1,p),E={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:m,u_inv_rot_matrix:np,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(x){E.u_inv_rot_matrix=c,E.u_merc_center=d,E.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],E.u_zoom_transition=s.aj(y.zoom);const C=d[0]*s.al,M=d[1]*s.al;E.u_up_dir=y.projection.upVector(new s.cD(0,0,0),C,M)}return E};function hu(l,[t,o,c,d],[p,m]){if(p===m)return[0,0,0,0];const y=255*(l-1)/(l*(m-p));return[t*y,o*y,c*y,d*y]}function op(l,t,[o,c]){return o===c?0:.5/l+(t-o)*(l-1)/(l*(c-o))}const Hh=(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B,j,Z,H,$)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:o,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:E.mix,u_opacity:E.opacity*C.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:C.paint.get("raster-brightness-min"),u_brightness_high:C.paint.get("raster-brightness-max"),u_saturation_factor:s.dT(C.paint.get("raster-saturation")),u_contrast_factor:s.dS(C.paint.get("raster-contrast")),u_spin_weights:ic(C.paint.get("raster-hue-rotate")),u_perspective_transform:M,u_raster_elevation:P,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x,u_colorization_mix:hu(s.dU,z,j),u_colorization_offset:op(s.dU,B,j),u_color_ramp:F,u_texture_offset:[H/(Z+2*H),Z/(Z+2*H)],u_texture_res:[Z+2*H,Z+2*H],u_emissive_strength:$});function ic(l){l*=Math.PI/180;const t=Math.sin(l),o=Math.cos(l);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}const nl=.05,C_=(l,t,o,c,d,p,m,y,x,T,E,C)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:o,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:E.mix,u_opacity:E.opacity,u_image0:0,u_image1:1,u_raster_elevation:C,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x}),sp=(l,t,o,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_tile_offset:o,u_velocity:c,u_color_ramp:p,u_velocity_res:d,u_max_speed:m,u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[nl,nl]}),P_=(l,t,o,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:o,u_velocity_res:c,u_max_speed:d,u_speed_factor:p,u_reset_rate:m,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[nl,nl]}),du=s.bC(),rc=(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B,j,Z,H,$,le,ne,se)=>{const ee=d.transform,J={u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:ee.getCameraToCenterDistance(Z),u_rotate_symbol:+o,u_aspect_ratio:ee.width/ee.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+T,u_elevation_from_sea:x?1:0,u_pitch_with_map:+c,u_texsize:E,u_texsize_icon:C,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:du,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:du,u_up_vector:[0,-1,0],u_color_adj_mat:le,u_icon_transition:ne||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(Z)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:s.o.devicePixelRatio,u_is_halo:1,u_scale_factor:se||1,u_ground_shadow_factor:H,u_inv_matrix:s.bl(s.bC(),m),u_normal_scale:$,u_lutTexture:10};return Z.name==="globe"&&(J.u_tile_id=[P.canonical.x,P.canonical.y,1<<P.canonical.z],J.u_zoom_transition=F,J.u_inv_rot_matrix=B,J.u_merc_center=z,J.u_camera_forward=ee._camera.forward(),J.u_ecef_origin=s.dV(ee.globeMatrix,P.toUnwrapped()),J.u_tile_matrix=Float32Array.from(ee.globeMatrix),J.u_up_vector=j),J},qs=(l,t,o,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:o,u_color:c}),nc=(l,t,o,c,d,p,m,y,x)=>Object.assign((function(T,E,C,M,P,F){const{width:z,height:B}=M.imageManager.getPixelSize(E),j=Math.pow(2,F.tileID.overscaledZ
2996),Z=F.tileSize*Math.pow(2,M.transform.tileZoom)/j,H=Z*(F.tileID.canonical.x+F.tileID.wrap*j),$=Z*F.tileID.canonical.y;return{u_image:0,u_pattern_tl:C.tl,u_pattern_br:C.br,u_texsize:[z,B],u_pattern_size:C.displaySize,u_pattern_units_to_pixels:P?[M.transform.width,-1*M.transform.height]:[1/s.ay(F,1,M.transform.tileZoom),1/s.ay(F,1,M.transform.tileZoom)],u_pixel_coord_upper:[H>>16,$>>16],u_pixel_coord_lower:[65535&H,65535&$]}})(0,p,m,c,y,x),{u_matrix:l,u_emissive_strength:t,u_opacity:o}),ba=new Float32Array(s.bA([])),fu=(l,t,o,c,d,p,m,y,x,T,E,C,M,P=[0,0,0],F,z,B)=>{const j=d.style.light,Z=j.properties.get("position"),H=[-Z.x,-Z.y,Z.z],$=s.dO();j.properties.get("anchor")==="viewport"&&(s.dP($,-d.transform.angle),s.dQ(H,H,$));const le=E.alphaMode==="MASK",ne=j.properties.get("color").toNonPremultipliedRenderColor(null),se=M.paint.get("model-ambient-occlusion-intensity"),ee=M.paint.get("model-color").constantOr(s.ao.white).toNonPremultipliedRenderColor(null);return ee.a=M.paint.get("model-color-mix-intensity").constantOr(0),B&&(ee.r=B[0],ee.g=B[
vendor: 32,360 bytes, line 2996
29961],ee.b=B[2],ee.a=B[3]),z&&(ee.r=z.color.r,ee.g=z.color.g,ee.b=z.color.b,ee.a=z.colorMix,C=z.emissionStrength,p*=z.opacity),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:o,u_node_matrix:c||ba,u_lightpos:H,u_lightintensity:j.properties.get("intensity"),u_lightcolor:[ne.r,ne.g,ne.b],u_camera_pos:P,u_opacity:p,u_baseTextureIsAlpha:0,u_alphaMask:+le,u_alphaCutoff:E.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:T,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:ee.toArray01(),u_aoIntensity:se,u_emissive_strength:C,u_occlusionTextureTransform:F||[0,0,0,0]}},oc=(l,t=ba,o=ba)=>({u_matrix:l,u_instance:t,u_node_matrix:o}),pu={fillExtrusion:l=>({u_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_vertical_gradient:new s.cj(l),u_opacity:new s.cj(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_ao:new s.ck(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_up_dir:new s.ci(l),u_height_lift:new s.cj(l),u_flood_light_color:new s.ci(l),u_vertical_scale:new s.cj(l),u_flood_light_intensity:new s.cj(l),u_ground_shadow_factor:new s.ci(l)}),fillExtrusionDepth:l=>({u_matrix:new s.cl(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_vertical_scale:new s.cj(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l)}),fillExtrusionPattern:l=>({u_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_vertical_gradient:new s.cj(l),u_height_factor:new s.cj(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_ao:new s.ck(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_up_dir:new s.ci(l),u_height_lift:new s.cj(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_opacity:new s.cj(l),u_pattern_transition:new s.cj(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new s.cl(l),u_opacity:new s.cj(l),u_ao_pass:new s.cj(l),u_meter_to_tile:new s.cj(l),u_ao:new s.ck(l),u_flood_light_intensity:new s.cj(l),u_flood_light_color:new s.ci(l),u_attenuation:new s.cj(l),u_edge_radius:new s.cj(l),u_fb:new s.ch(l),u_fb_size:new s.cj(l),u_dynamic_offset:new s.cj(l)}),fill:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_ground_shadow_factor:new s.ci(l)}),fillPattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_pattern_transition:new s.cj(l)}),fillOutline:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_world:new s.ck(l),u_ground_shadow_factor:new s.ci(l)}),fillOutlinePattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_world:new s.ck(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_pattern_transition:new s.cj(l)}),building:l=>({u_matrix:new s.cl(l),u_normal_matrix:new s.cl(l),u_opacity:new s.cj(l),u_faux_facade_ao_intensity:new s.cj(l),u_camera_pos:new s.ci(l),u_tile_to_meter:new s.cj(l),u_facade_emissive_chance:new s.cj(l),u_flood_light_color:new s.ci(l),u_flood_light_intensity:new s.cj(l)}),buildingBloom:l=>({u_matrix:new s.cl(l)}),buildingDepth:l=>({u_matrix:new s.cl(l)}),elevatedStructuresDepth:l=>({u_matrix:new s.cl(l),u_depth_bias:new s.cj(l)}),elevatedStructures:l=>({u_matrix:new s.cl(l),u_ground_shadow_factor:new s.ci(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new s.cl(l),u_camera_pos:new s.ci(l),u_depth_bias:new s.cj(l),u_height_scale:new s.cj(l),u_reset_depth:new s.cj(l)}),circle:s.dY,collisionBox:l=>({u_matrix:new s.cl(l),u_inv_rot_matrix:new s.cl(l),u_camera_to_center_distance:new s.cj(l),u_extrude_scale:new s.ck(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_tile_id:new s.ci(l)}),collisionCircle:l=>({u_matrix:new s.cl(l),u_inv_matrix:new s.cl(l),u_camera_to_center_distance:new s.cj(l),u_viewport_size:new s.ck(l)}),debug:l=>({u_color:new s.dB(l),u_matrix:new s.cl(l),u_overlay:new s.ch(l),u_overlay_scale:new s.cj(l)}),clippingMask:l=>({u_matrix:new s.cl(l)}),heatmap:l=>({u_extrude_scale:new s.cj(l),u_intensity:new s.cj(l),u_matrix:new s.cl(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_up_dir:new s.ci(l)}),heatmapTexture:l=>({u_image:new s.ch(l),u_color_ramp:new s.ch(l),u_opacity:new s.cj(l)}),hillshade:l=>({u_matrix:new s.cl(l),u_image:new s.ch(l),u_latrange:new s.ck(l),u_light:new s.ck(l),u_shadow:new s.dB(l),u_highlight:new s.dB(l),u_emissive_strength:new s.cj(l),u_accent:new s.dB(l)}),hillshadePrepare:l=>({u_matrix:new s.cl(l),u_image:new s.ch(l),u_dimension:new s.ck(l),u_zoom:new s.cj(l)}),line:s.dX,linePattern:s.dW,raster:l=>({u_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_grid_matrix:new s.dC(l),u_tl_parent:new s.ck(l),u_scale_parent:new s.cj(l),u_fade_t:new s.cj(l),u_opacity:new s.cj(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_brightness_low:new s.cj(l),u_brightness_high:new s.cj(l),u_saturation_factor:new s.cj(l),u_contrast_factor:new s.cj(l),u_spin_weights:new s.ci(l),u_perspective_transform:new s.ck(l),u_raster_elevation:new s.cj(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_cutoff_params:new s.d3(l),u_colorization_mix:new s.d3(l),u_colorization_offset:new s.cj(l),u_color_ramp:new s.ch(l),u_texture_offset:new s.ck(l),u_texture_res:new s.ck(l),u_emissive_strength:new s.cj(l)}),rasterParticle:l=>({u_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_grid_matrix:new s.dC(l),u_tl_parent:new s.ck(l),u_scale_parent:new s.cj(l),u_fade_t:new s.cj(l),u_opacity:new s.cj(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_raster_elevation:new s.cj(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_cutoff_params:new s.d3(l)}),rasterParticleTexture:l=>({u_texture:new s.ch(l),u_opacity:new s.cj(l)}),rasterParticleDraw:l=>({u_particle_texture:new s.ch(l),u_particle_texture_side_len:new s.cj(l),u_tile_offset:new s.ck(l),u_velocity:new s.ch(l),u_color_ramp:new s.ch(l),u_velocity_res:new s.ck(l),u_max_speed:new s.cj(l),u_uv_offset:new s.ck(l),u_data_scale:new s.ck(l),u_data_offset:new s.cj(l),u_particle_pos_scale:new s.cj(l),u_particle_pos_offset:new s.ck(l)}),rasterParticleUpdate:l=>({u_particle_texture:new s.ch(l),u_particle_texture_side_len:new s.cj(l),u_velocity:new s.ch(l),u_velocity_res:new s.ck(l),u_max_speed:new s.cj(l),u_speed_factor:new s.cj(l),u_reset_rate:new s.cj(l),u_rand_seed:new s.cj(l),u_uv_offset:new s.ck(l),u_data_scale:new s.ck(l),u_data_offset:new s.cj(l),u_particle_pos_scale:new s.cj(l),u_particle_pos_offset:new s.ck(l)}),symbol:l=>({u_is_size_zoom_constant:new s.ch(l),u_is_size_feature_constant:new s.ch(l),u_size_t:new s.cj(l),u_size:new s.cj(l),u_camera_to_center_distance:new s.cj(l),u_rotate_symbol:new s.ch(l),u_aspect_ratio:new s.cj(l),u_fade_change:new s.cj(l),u_matrix:new s.cl(l),u_label_plane_matrix:new s.cl(l),u_coord_matrix:new s.cl(l),u_is_text:new s.ch(l),u_elevation_from_sea:new s.ch(l),u_pitch_with_map:new s.ch(l),u_texsize:new s.ck(l),u_texsize_icon:new s.ck(l),u_texture:new s.ch(l),u_texture_icon:new s.ch(l),u_gamma_scale:new s.cj(l),u_device_pixel_ratio:new s.cj(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_camera_forward:new s.ci(l),u_tile_matrix:new s.cl(l),u_up_vector:new s.ci(l),u_ecef_origin:new s.ci(l),u_is_halo:new s.ch(l),u_icon_transition:new s.cj(l),u_color_adj_mat:new s.cl(l),u_scale_factor:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_inv_matrix:new s.cl(l),u_normal_scale:new s.cj(l),u_lutTexture:new s.ch(l)}),background:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_opacity:new s.cj(l),u_color:new s.dB(l)}),backgroundPattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_opacity:new s.cj(l),u_image:new s.ch(l),u_pattern_tl:new s.ck(l),u_pattern_br:new s.ck(l),u_texsize:new s.ck(l),u_pattern_size:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_pattern_units_to_pixels:new s.ck(l)}),terrainRaster:l=>({u_matrix:new s.cl(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_skirt_height:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_emissive_texture_available:new s.cj(l)}),skybox:l=>({u_matrix:new s.cl(l),u_sun_direction:new s.ci(l),u_cubemap:new s.ch(l),u_opacity:new s.cj(l),u_temporal_offset:new s.cj(l)}),skyboxGradient:l=>({u_matrix:new s.cl(l),u_color_ramp:new s.ch(l),u_center_direction:new s.ci(l),u_radius:new s.cj(l),u_opacity:new s.cj(l),u_temporal_offset:new s.cj(l)}),skyboxCapture:l=>({u_matrix_3f:new s.dC(l),u_sun_direction:new s.ci(l),u_sun_intensity:new s.cj(l),u_color_tint_r:new s.d3(l),u_color_tint_m:new s.d3(l),u_luminance:new s.cj(l)}),globeRaster:l=>({u_proj_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_grid_matrix:new s.dC(l),u_skirt_height:new s.cj(l),u_far_z_cutoff:new s.cj(l),u_frustum_tl:new s.ci(l),u_frustum_tr:new s.ci(l),u_frustum_br:new s.ci(l),u_frustum_bl:new s.ci(l),u_globe_pos:new s.ci(l),u_globe_radius:new s.cj(l),u_viewport:new s.ck(l),u_emissive_texture_available:new s.cj(l)}),globeAtmosphere:l=>({u_frustum_tl:new s.ci(l),u_frustum_tr:new s.ci(l),u_frustum_br:new s.ci(l),u_frustum_bl:new s.ci(l),u_horizon:new s.cj(l),u_transition:new s.cj(l),u_fadeout_range:new s.cj(l),u_atmosphere_fog_color:new s.d3(l),u_high_color:new s.d3(l),u_space_color:new s.d3(l),u_temporal_offset:new s.cj(l),u_horizon_angle:new s.cj(l)}),model:l=>({u_matrix:new s.cl(l),u_lighting_matrix:new s.cl(l),u_normal_matrix:new s.cl(l),u_node_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_camera_pos:new s.ci(l),u_opacity:new s.cj(l),u_baseColorFactor:new s.d3(l),u_emissiveFactor:new s.d3(l),u_metallicFactor:new s.cj(l),u_roughnessFactor:new s.cj(l),u_baseTextureIsAlpha:new s.ch(l),u_alphaMask:new s.ch(l),u_alphaCutoff:new s.cj(l),u_baseColorTexture:new s.ch(l),u_metallicRoughnessTexture:new s.ch(l),u_normalTexture:new s.ch(l),u_occlusionTexture:new s.ch(l),u_emissionTexture:new s.ch(l),u_lutTexture:new s.ch(l),u_color_mix:new s.d3(l),u_aoIntensity:new s.cj(l),u_emissive_strength:new s.cj(l),u_occlusionTextureTransform:new s.d3(l)}),modelDepth:l=>({u_matrix:new s.cl(l),u_instance:new s.cl(l),u_node_matrix:new s.cl(l)}),groundShadow:l=>({u_matrix:new s.cl(l),u_ground_shadow_factor:new s.ci(l)}),stars:l=>({u_matrix:new s.cl(l),u_up:new s.ci(l),u_right:new s.ci(l),u_intensity_multiplier:new s.cj(l)}),snowParticle:l=>({u_modelview:new s.cl(l),u_projection:new s.cl(l),u_time:new s.cj(l),u_cam_pos:new s.ci(l),u_velocityConeAperture:new s.cj(l),u_velocity:new s.cj(l),u_horizontalOscillationRadius:new s.cj(l),u_horizontalOscillationRate:new s.cj(l),u_boxSize:new s.cj(l),u_billboardSize:new s.cj(l),u_simpleShapeParameters:new s.ck(l),u_screenSize:new s.ck(l),u_thinningCenterPos:new s.ck(l),u_thinningShape:new s.ci(l),u_thinningAffectedRatio:new s.cj(l),u_thinningParticleOffset:new s.cj(l),u_particleColor:new s.d3(l),u_direction:new s.ci(l)}),rainParticle:l=>({u_modelview:new s.cl(l),u_projection:new s.cl(l),u_time:new s.cj(l),u_cam_pos:new s.ci(l),u_texScreen:new s.ch(l),u_velocityConeAperture:new s.cj(l),u_velocity:new s.cj(l),u_boxSize:new s.cj(l),u_rainDropletSize:new s.ck(l),u_distortionStrength:new s.cj(l),u_rainDirection:new s.ci(l),u_color:new s.d3(l),u_screenSize:new s.ck(l),u_thinningCenterPos:new s.ck(l),u_thinningShape:new s.ci(l),u_thinningAffectedRatio:new s.cj(l),u_thinningParticleOffset:new s.cj(l),u_shapeDirectionalPower:new s.cj(l),u_shapeNormalPower:new s.cj(l),u_mode:new s.cj(l)}),vignette:l=>({u_vignetteShape:new s.ci(l),u_vignetteColor:new s.d3(l)}),occlusion:l=>({u_matrix:new s.cl(l),u_anchorPos:new s.ci(l),u_screenSizePx:new s.ck(l),u_occluderSizePx:new s.ck(l),u_color:new s.d3(l)})};class Vo{constructor(t,o,c,d){this.id=Vo.uniqueIdxCounter,Vo.uniqueIdxCounter++,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||d||o.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=Vo.uniqueIdxCounter,Vo.uniqueIdxCounter++;const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Vo.uniqueIdxCounter=0;const ap={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class R_{constructor(t,o,c,d,p,m){this.length=o.length,this.attributes=c,this.itemSize=o.bytesPerElement,this.dynamicDraw=d,this.instanceCount=m,this.context=t;const y=t.gl;this.buffer=y.createBuffer(),t.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||p||o.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,o){for(let c=0;c<this.attributes.length;c++){const d=o.getAttributeLocation(t,this.attributes[c].name);d!==-1&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,o,c){for(let d=0;d<this.attributes.length;d++){const p=this.attributes[d],m=o.getAttributeLocation(t,p.name);m!==-1&&t.vertexAttribPointer(m,p.components,t[ap[p.type]],!1,this.itemSize,p.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,o,c){for(let d=0;d<this.attributes.length;d++){const p=o.getAttributeLocation(t,this.attributes[d].name);p!==-1&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(p,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class wa{constructor(t,o,c,d,p){this.context=t,this.width=o,this.height=c;const m=this.framebuffer=t.gl.createFramebuffer();d>0&&(this.colorAttachment0=new iu(t,m,0)),d>1&&(this.colorAttachment1=new iu(t,m,1)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new tl(t,m):new Jl(t,m))}createColorAttachment(t,o){o===0?this.colorAttachment0=new iu(t,this.framebuffer,0):o===1&&(this.colorAttachment1=new iu(t,this.framebuffer,1))}removeColorAttachment(t,o){const c=this.context.gl;let d;o===0?(d=this.colorAttachment0.get(),this.colorAttachment0=void 0):o===1&&(d=this.colorAttachment1.get(),this.colorAttachment1=void 0),d&&c.deleteTexture(d)}destroy(){const t=this.context.gl;if(this.colorAttachment0){const o=this.colorAttachment0.get();o&&t.deleteTexture(o)}if(this.colorAttachment1){const o=this.colorAttachment1.get();o&&t.deleteTexture(o)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}else{const o=this.depthAttachment.get();o&&t.deleteTexture(o)}t.deleteFramebuffer(this.framebuffer)}}class mu{constructor(t,o){this.gl=t,this.clearColor=new w_(this),this.clearDepth=new Gf(this),this.clearStencil=new Mh(this),this.colorMask=new Kc(this),this.depthMask=new Ch(this),this.stencilMask=new ya(this),this.stencilFunc=new Ka(this),this.stencilOp=new Yl(this),this.stencilTest=new Ja(this),this.depthRange=new qf(this),this.depthTest=new Ph(this),this.depthFunc=new $f(this),this.blend=new Qa(this),this.blendFunc=new Jc(this),this.blendColor=new Qc(this),this.blendEquation=new Rh(this),this.cullFace=new eu(this),this.cullFaceSide=new Kl(this),this.frontFace=new Hf(this),this.program=new Zf(this),this.activeTexture=new Wf(this),this.viewport=new el(this),this.bindFramebuffer=new Xf(this),this.bindRenderbuffer=new T_(this),this.bindTexture=new E_(this),this.bindVertexBuffer=new S_(this),this.bindElementBuffer=new Lh(this),this.bindVertexArrayOES=new Dh(this),this.pixelStoreUnpack=new zh(this),this.pixelStoreUnpackPremultiplyAlpha=new Oh(this),this.pixelStoreUnpackFlipY=new Yf(this),this.options=o?Object.assign({},o):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=o&&!!o.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=t.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,o,c){return new Vo(this,t,o,c)}createVertexBuffer(t,o,c,d,p){return new R_(this,t,o,c,d,p)}createRenderbuffer(t,o,c){const d=this.gl,p=d.createRenderbuffer();return this.bindRenderbuffer.set(p),d.renderbufferStorage(d.RENDERBUFFER,t,o,c),this.bindRenderbuffer.set(null),p}createFramebuffer(t,o,c,d){return new wa(this,t,o,c,d)}clear({color:t,depth:o,stencil:c,colorMask:d}){const p=this.gl;let m=0;t&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),o!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),c!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),p.clear(m)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){s.by(t.blendFunction,Ut.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let vt;function Zh(l,t,o,c,d,p,m){const y=l.context,x=y.gl,T=l.transform,E=[s.aF(T.center.lng),s.aJ(T.center.lat)],C=o.layout.get("symbol-placement"),M=o.layout.get("text-variable-anchor"),P=o.layout.get("icon-rotation-alignment")==="map",F=o.layout.get("text-rotation-alignment")==="map",z=C!=="point",B=[];let j=0,Z=0;for(let ee=0;ee<c.length;ee++){const J=c[ee],ue=t.getTile(J),_e=ue.getBucket(o);if(!_e)continue;const xe=_e.getProjection().createInversionMatrix(T,J.canonical),Ae=[],Ee=h_(J,_e,T),Fe=!m&&P&&z,$e=m&&F&&z,Te=M&&_e.hasTextData(),he=_e.hasIconTextFit()&&Te&&_e.hasIconData(),ze=Fe||$e||m&&Te||he,Me=_e.projection.name==="globe",We=Me?s.aj(T.zoom):0;Me&&(Ae.push("PROJECTION_GLOBE_VIEW"),ze&&Ae.push("PROJECTED_POS_ON_VIEWPORT"));const et=l.getOrCreateProgram("collisionBox",{defines:Ae});let ut=Ee;d[0]===0&&d[1]===0||(ut=l.translatePosMatrix(Ee,ue,d,p));const tt=m?_e.textCollisionBox:_e.iconCollisionBox,nt=_e.collisionCircleArray;if(nt.length>0){const wt=s.bC(),pt=ut;s.cP(wt,_e.placementInvProjMatrix,T.glCoordMatrix),s.cP(wt,wt,_e.placementViewportMatrix),B.push({circleArray:nt,circleOffset:Z,transform:pt,invTransform:wt,projection:_e.getProjection()}),j+=nt.length/4,Z=j}if(!tt)continue;l.terrain&&l.terrain.setupElevationDraw(ue,et);const Et=Me?[J.canonical.x,J.canonical.y,1<<J.canonical.z]:[0,0,0];et.draw(l,x.LINES,It.disabled,kt.disabled,l.colorModeForRenderPass(),zt.disabled,Gh(ut,xe,T,We,E,ue,Et,_e.getProjection()),o.id,tt.layoutVertexBuffer,tt.indexBuffer,tt.segments,null,T.zoom,null,[tt.collisionVertexBuffer,tt.collisionVertexBufferExt])}if(!m||!B.length)return;const H=l.getOrCreateProgram("collisionCircle"),$=new s.dZ;$.resize(4*j),$._trim();let le=0;for(const ee of B)for(let J=0;J<ee.circleArray.length/4;J++){const ue=4*J,_e=ee.circleArray[ue+0],xe=ee.circleArray[ue+1],Ae=ee.circleArray[ue+2],Ee=ee.circleArray[ue+3];$.emplace(le++,_e,xe,Ae,Ee,0),$.emplace(le++,_e,xe,Ae,Ee,1),$.emplace(le++,_e,xe,Ae,Ee,2),$.emplace(le++,_e,xe,Ae,Ee,3)}(!vt||vt.length<2*j)&&(vt=(function(ee){const J=2*ee,ue=new s.b0;ue.resize(J),ue._trim();for(let _e=0;_e<J;_e++){const xe=6*_e;ue.uint16[xe+0]=4*_e+0,ue.uint16[xe+1]=4*_e+1,ue.uint16[xe+2]=4*_e+2,ue.uint16[xe+3]=4*_e+2,ue.uint16[xe+4]=4*_e+3,ue.uint16[xe+5]=4*_e+0}return ue})(j));const ne=y.createIndexBuffer(vt,!0),se=y.createVertexBuffer($,s.d_.members,!0);for(const ee of B){const J=uu(ee.transform,ee.invTransform,T,ee.projection);H.draw(l,x.TRIANGLES,It.disabled,kt.disabled,l.colorModeForRenderPass(),zt.disabled,J,o.id,se,ne,s.bg.simpleSegment(0,2*ee.circleOffset,ee.circleArray.length,ee.circleArray.length/2),null,T.zoom)}se.destroy(),ne.destroy()}const Mo=s.bC();function ps(l){const t=l._camera.getWorldToCamera(l.worldSize,1),o=s.aB([],t,l.globeMatrix);s.bl(o,o);const c=[0,0,0],d=[0,1,0,0];return s.aC(d,d,o),c[0]=d[0],c[1]=d[1],c[2]=d[2],s.aw(c,c),c}function lp({width:l,height:t,anchor:o,textOffset:c,textScale:d},p){const{horizontalAlign:m,verticalAlign:y}=s.c1(o),x=-(m-.5)*l,T=-(y-.5)*t,E=s.c2(o,c);return new s.P((x/d+E[0])*p,(T/d+E[1])*p)}function cp(l,t,o,c,d,p,m,y,x,T){const E=l.text.placedSymbolArray,C=l.text.dynamicLayoutVertexArray,M=l.icon.dynamicLayoutVertexArray,P={},F=l.getProjection(),z=qa(m,F,d),B=d.elevation,j=F.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;C.clear();for(let Z=0;Z<E.length;Z++){const H=E.get(Z),{tileAnchorX:$,tileAnchorY:le,numGlyphs:ne}=H,se=H.hidden||!H.crossTileID||l.allowVerticalPlacement&&!H.placedOrientation?null:c[H.crossTileID];if(se){let ee=0,J=0,ue=0;const _e=l.elevationType==="road";if(B||_e){const Me=_e?l.getElevationFeatureForText(Z):null,We=s.bV.getAtTileOffset(m,new s.P($,le),B,Me),[et,ut,tt]=F.upVector(m.canonical,$,le);ee=We*et*j,J=We*ut*j,ue=We*tt*j}let[xe,Ae,Ee,Fe]=xo(H.projectedAnchorX+ee,H.projectedAnchorY+J,H.projectedAnchorZ+ue,o?z:p);const $e=Bc(d.getCameraToCenterDistance(F),Fe);let Te=s.bM(l.textSizeData,x,H)*$e/s.bY;o&&(Te*=l.tilePixelRatio/y);const he=lp(se,Te);o?({x:xe,y:Ae,z:Ee}=F.projectTilePoint($+he.x,le+he.y,m.canonical),[xe,Ae,Ee]=xo(xe+ee,Ae+J,Ee+ue,p)):(t&&he._rotate(-d.angle),xe+=he.x,Ae+=he.y,Ee=0);const ze=l.allowVerticalPlacement&&H.placedOrientation===s.bL.vertical?Math.PI/2:0;for(let Me=0;Me<ne;Me++)s.bO(C,xe,Ae,Ee,ze);T&&H.associatedIconIndex>=0&&(P[H.associatedIconIndex]={x:xe,y:Ae,z:Ee,angle:ze})}else pn(ne,C)}if(T){M.clear();const Z=l.icon.placedSymbolArray;for(let H=0;H<Z.length;H++){const $=Z.get(H),{numGlyphs:le}=$,ne=P[H];if($.hidden||!ne)pn(le,M);else{const{x:se,y:ee,z:J,angle:ue}=ne;for(let _e=0;_e<le;_e++)s.bO(M,se,ee,J,ue)}}l.icon.dynamicLayoutVertexBuffer.updateData(M)}l.text.dynamicLayoutVertexBuffer.updateData(C)}function _u(l,t,o,c,d,p,m={}){const y=o.paint.get("icon-translate"),x=o.paint.get("text-translate"),T=o.paint.get("icon-translate-anchor"),E=o.paint.get("text-translate-anchor"),C=o.layout.get("icon-rotation-alignment"),M=o.layout.get("text-rotation-alignment"),P=o.layout.get("icon-pitch-alignment"),F=o.layout.get("text-pitch-alignment"),z=o.layout.get("icon-keep-upright"),B=o.layout.get("text-keep-upright"),j=o.paint.get("icon-color-saturation"),Z=o.paint.get("icon-color-contrast"),H=o.paint.get("icon-color-brightness-min"),$=o.paint.get("icon-color-brightness-max"),le=o.layout.get("symbol-elevation-reference")==="sea",ne=o.layout.get("icon-image-use-theme")==="none",se=l.context,ee=se.gl,J=l.transform,ue=C==="map",_e=M==="map",xe=P==="map",Ae=F==="map",Ee=o.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Fe=!1;const $e=l.depthModeForSublayer(0,It.ReadOnly),Te=new It(l.context.gl.LEQUAL,It.ReadOnly,l.depthRangeFor3D),he=[s.aF(J.center.lng),s.aJ(J.center.lat)],ze=o.layout.get("text-variable-anchor"),Me=J.projection.name==="globe",We=[],et=[0,-1,0];for(const ut of c){const tt=t.getTile(ut),nt=tt.getBucket(o);if(!nt||nt.projection.name==="mercator"&&Me||nt.fullyClipped)continue;const Et=nt.projection.name==="globe",wt=Et?s.aj(J.zoom):0,pt=qa(ut,nt.getProjection(),J),bt=J.calculatePixelsToTileUnitsMatrix(tt),Ct=ze&&nt.hasTextData(),Ot=nt.hasIconTextFit()&&Ct&&nt.hasIconData(),Ht=nt.getProjection().createInversionMatrix(J,ut.canonical),ti=(1<<tt.tileID.canonical.z)*s.al/l.transform.worldSize,Vt=_i=>{let Qt=[0,0,0];if(_i){const $t=l.style.directionalLight,Di=l.style.ambientLight;$t&&Di&&(Qt=bo(l.style,$t,Di))}return Qt},ui=_i=>{J.depthOcclusionForSymbolsAndCircles&&(o.hasOcclusionOpacityProperties||l.terrain)&&(_i.push("DEPTH_D24"),_i.push("DEPTH_OCCLUSION"))},jt=_i=>{o.lut&&!ne&&(o.lut.texture||(o.lut.texture=new s.d$(l.context,o.lut.image,[o.lut.image.height,o.lut.image.height,o.lut.image.height],se.gl.RGBA8)),se.activeTexture.set(se.gl.TEXTURE0+10),o.lut.texture&&o.lut.texture.bind(se.gl.LINEAR,se.gl.CLAMP_TO_EDGE),_i.push("APPLY_LUT_ON_GPU"))},Ti=()=>{const _i=ue&&o.layout.get("symbol-placement")!=="point",Qt=[];ui(Qt),jt(Qt);const $t=_i||Ot,Di=nt.elevationType==="road",rr=l.shadowRenderer,Fi=Di&&xe&&!!rr&&rr.enabled,Ni=Vt(Fi),xn=Di&&xe&&!l.terrain?Te:$e,On=o.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&xe&&Qt.push("PITCH_WITH_MAP_TERRAIN"),Et&&(Qt.push("PROJECTION_GLOBE_VIEW"),$t&&Qt.push("PROJECTED_POS_ON_VIEWPORT")),On>0&&nt.hasAnySecondaryIcon&&Qt.push("ICON_TRANSITION"),!nt.icon.zOffsetVertexBuffer||Di&&l.terrain||Qt.push("Z_OFFSET"),j===0&&Z===0&&H===0&&$===1||Qt.push("COLOR_ADJUSTMENT"),nt.sdfIcons&&Qt.push("RENDER_SDF"),Fi&&Qt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Di&&xe&&!l.terrain&&nt.icon.orientationVertexBuffer&&Qt.push("ELEVATED_ROADS");const Fr=nt.icon.programConfigurations.get(o.id),gi=l.getOrCreateProgram("symbol",{config:Fr,defines:Qt}),Un=tt.imageAtlasTexture?tt.imageAtlasTexture.size:[0,0],Yr=nt.iconSizeData,vn=s.bK(Yr,J.zoom),To=xe||!J.isOrthographic,bn=fa(pt,tt.tileID.canonical,xe,ue,J,nt.getProjection(),bt),Ki=Cn(pt,tt.tileID.canonical,xe,ue,J,nt.getProjection(),bt),fr=l.translatePosMatrix(Ki,tt,y,T,!0),ki=l.translatePosMatrix(pt,tt,y,T),yr=$t?Mo:bn,Qr=ue&&!xe&&!_i;let cr=et;!Me&&!J.mercatorFromTransition||ue||(cr=ps(J));const jn=Et?cr:et,bc=o.getColorAdjustmentMatrix(j,Z,H,$),qo=rc(Yr.kind,vn,Qr,xe,l,ki,yr,fr,le,!1,Un,[0,0],0,ut,wt,he,Ht,jn,nt.getProjection(),Ni,ti,bc,On,null),_l=tt.imageAtlasTexture?tt.imageAtlasTexture:null,gl=o.layout.get("icon-size").constantOr(0)!==1||nt.iconsNeedLinear,Gn=nt.sdfIcons||l.options.rotating||l.options.zooming||gl||To?ee.LINEAR:ee.NEAREST,$o=nt.sdfIcons&&o.paint.get("icon-halo-width").constantOr(1)!==0,Ho=l.terrain&&xe&&_i?s.bl(s.bC(),bn):Mo;if(_i&&nt.icon){const so=s.bV.getAtTileOffsetFunc(ut,J.center.lat,J.worldSize,nt.getProjection()),gs=us(pt,tt.tileID.canonical,xe,ue,J,nt.getProjection(),bt),Aa=o.layout.get("icon-size-scale-range"),Pu=s.aA(l.scaleFactor,Aa[0],Aa[1]);vi(nt,pt,l,!1,gs,Ki,xe,z,so,ut,Pu)}return{program:gi,buffers:nt.icon,uniformValues:qo,atlasTexture:_l,atlasTextureIcon:null,atlasInterpolation:Gn,atlasInterpolationIcon:null,isSDF:nt.sdfIcons,hasHalo:$o,depthMode:xn,tile:tt,renderWithShadows:Fi,labelPlaneMatrixInv:Ho}},bi=()=>{const _i=_e&&o.layout.get("symbol-placement")!=="point",Qt=[],$t=_i||ze||Ot,Di=nt.elevationType==="road",rr=l.shadowRenderer,Fi=Di&&Ae&&!!rr&&rr.enabled,Ni=Vt(Fi),xn=Di&&Ae&&!l.terrain?Te:$e;l.terrainRenderModeElevated()&&Ae&&Qt.push("PITCH_WITH_MAP_TERRAIN"),Et&&(Qt.push("PROJECTION_GLOBE_VIEW"),$t&&Qt.push("PROJECTED_POS_ON_VIEWPORT")),!nt.text.zOffsetVertexBuffer||Di&&l.terrain||Qt.push("Z_OFFSET"),nt.iconsInText&&Qt.push("RENDER_TEXT_AND_SYMBOL"),Qt.push("RENDER_SDF"),Fi&&Qt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Di&&Ae&&!l.terrain&&nt.text.orientationVertexBuffer&&Qt.push("ELEVATED_ROADS"),ui(Qt);const On=nt.text.programConfigurations.get(o.id),Fr=l.getOrCreateProgram("symbol",{config:On,defines:Qt});let gi,Un=[0,0],Yr=null;const vn=nt.textSizeData;nt.iconsInText&&(Un=tt.imageAtlasTexture?tt.imageAtlasTexture.size:[0,0],Yr=tt.imageAtlasTexture?tt.imageAtlasTexture:null,gi=Ae||!J.isOrthographic||l.options.rotating||l.options.zooming||vn.kind==="composite"||vn.kind==="camera"?ee.LINEAR:ee.NEAREST);const To=tt.glyphAtlasTexture?tt.glyphAtlasTexture.size:[0,0],bn=o.layout.get("text-size-scale-range"),Ki=s.aA(l.scaleFactor,bn[0],bn[1]),fr=s.bK(vn,J.zoom,Ki),ki=fa(pt,tt.tileID.canonical,Ae,_e,J,nt.getProjection(),bt),yr=Cn(pt,tt.tileID.canonical,Ae,_e,J,nt.getProjection(),bt),Qr=l.translatePosMatrix(yr,tt,x,E,!0),cr=l.translatePosMatrix(pt,tt,x,E),jn=$t?Mo:ki,bc=_e&&!Ae&&!_i;let qo=et;!Me&&!J.mercatorFromTransition||_e||(qo=ps(J));const _l=rc(vn.kind,fr,bc,Ae,l,cr,jn,Qr,le,!0,To,Un,0,ut,wt,he,Ht,Et?qo:et,nt.getProjection(),Ni,ti,null,null,Ki),gl=tt.glyphAtlasTexture?tt.glyphAtlasTexture:null,Gn=ee.LINEAR,$o=o.paint.get("text-halo-width").constantOr(1)!==0,Ho=l.terrain&&Ae&&_i?s.bl(s.bC(),ki):Mo;if(_i&&nt.text){const so=s.bV.getAtTileOffsetFunc(ut,J.center.lat,J.worldSize,nt.getProjection()),gs=us(pt,tt.tileID.canonical,Ae,_e,J,nt.getProjection(),bt);vi(nt,pt,l,!0,gs,yr,Ae,B,so,ut,Ki)}return{program:Fr,buffers:nt.text,uniformValues:_l,atlasTexture:gl,atlasTextureIcon:Yr,atlasInterpolation:Gn,atlasInterpolationIcon:gi,isSDF:!0,hasHalo:$o,depthMode:xn,tile:tt,renderWithShadows:Fi,labelPlaneMatr
2996ixInv:Ho}},Si=nt.icon.segments.get().length,ii=nt.text.segments.get().length,qt=Si&&!m.onlyText?Ti():null,mi=ii&&!m.onlyIcons?bi():null,Zi=o.paint.get("icon-opacity").constantOr(1),Wi=o.paint.get("text-opacity").constantOr(1);if(Ee&&nt.canOverlap){Fe=!0;const _i=Zi&&!m.onlyText?nt.icon.segments.get():[],Qt=Wi&&!m.onlyIcons?nt.text.segments.get():[];for(const $t of _i)We.push({segments:new s.bg([$t]),sortKey:$t.sortKey,state:qt});for(const $t of Qt)We.push({segments:new s.bg([$t]),sortKey:$t.sortKey,state:mi})}else m.onlyText||We.push({segments:Zi?nt.icon.segments:new s.bg([]),sortKey:0,state:qt}),m.onlyIcons||We.push({segments:Wi?nt.text.segments:new s.bg([]),sortKey:0,state:mi})}Fe&&We.sort((ut,tt)=>ut.sortKey-tt.sortKey);for(const ut of We){const tt=ut.state;if(tt)if(l.terrain?l.terrain.setupElevationDraw(tt.tile,tt.program,{useDepthForOcclusion:J.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:tt.labelPlaneMatrixInv}):l.setupDepthForOcclusion(J.depthOcclusionForSymbolsAndCircles,tt.program),se.activeTexture.set(ee.TEXTURE0),tt.atlasTexture&&tt.atlasTexture.bind(tt.atlasInterpolation,ee.CLAMP_TO_EDGE,!0),tt.atlasTextureIcon&&(se.activeTexture.set(ee.TEXTURE1),tt.atlasTextureIcon&&tt.atlasTextureIcon.bind(tt.atlasInterpolationIcon,ee.CLAMP_TO_EDGE,!0)),tt.renderWithShadows&&l.shadowRenderer.setupShadows(tt.tile.tileID.toUnwrapped(),tt.program,"vector-tile"),l.uploadCommonLightUniforms(l.context,tt.program),tt.hasHalo){const nt=tt.uniformValues;nt.u_is_halo=1,gu(tt.buffers,ut.segments,o,l,tt.program,tt.depthMode,d,p,nt,2),nt.u_is_halo=0}else{if(tt.isSDF){const nt=tt.uniformValues;tt.hasHalo&&(nt.u_is_halo=1,gu(tt.buffers,ut.segments,o,l,tt.program,tt.depthMode,d,p,nt,1)),nt.u_is_halo=0}gu(tt.buffers,ut.segments,o,l,tt.program,tt.depthMode,d,p,tt.uniformValues,1)}}}function gu(l,t,o,c,d,p,m,y,x,T){const E=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,p,m,y,zt.disabled,x,o.id,l.layoutVertexBuffer,l.indexBuffer,t,o.paint,c.transform.zoom,l.programConfigurations.get(o.id),E,T)}function Wh(l,t){const o=1<<l.canonical.z,c=(t.x*o-l.canonical.x-l.wrap*o)*s.al,d=(t.y*o-l.canonical.y)*s.al,p=s.e8(t.z,t.y);return s.d5(c,d,p)}function Xh(l,t,o,c,d){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const p=l.context.gl,m=new It(l.context.gl.LEQUAL,It.ReadWrite,l.depthRangeFor3D),y=new It(l.context.gl.GREATER,It.ReadWrite,l.depthRangeFor3D),x=(function(P){let F=.01;return P.isOrthographic&&(F=s.ak(1e-4,F,s.d0(P.pitch>=Bo?1:P.pitch/Bo))),2*F})(l.transform),T=l.transform.getFreeCameraOptions().position,E="elevatedStructuresDepthReconstruct",C=l.getOrCreateProgram(E,{defines:["DEPTH_RECONSTRUCTION"]}),M=l.getOrCreateProgram(E);for(const P of c){const F=t.getTile(P),z=F.getBucket(o);if(!z)continue;const B=z.elevatedStructures;if(!B)continue;const j=z.elevationBufferData.heightRange,Z=Wh(P.toUnwrapped(),T),H=l.translatePosMatrix(P.projMatrix,F,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));let $,le,ne,se;if(d==="initialize"){if(!j||j.min>=1||B.depthSegments.segments[0].primitiveLength===0)continue;$=va(H,Z,x,1,0),le=m,ne=B.depthSegments,se=C}else if(d==="reset"){if(!j||j.min>=0||B.maskSegments.segments[0].primitiveLength===0)continue;$=va(H,Z,0,0,1),le=y,ne=B.maskSegments,se=C}else if(d==="geometry"){if(B.depthSegments.segments[0].primitiveLength===0)continue;$=va(H,Z,x,1,0),le=m,ne=B.depthSegments,se=M}se.draw(l,p.TRIANGLES,le,kt.disabled,Ut.disabled,zt.disabled,$,o.id,B.vertexBuffer,B.indexBuffer,ne,o.paint,l.transform.zoom)}}function ol(l,t,o,c){const{painter:d,sourceCache:p,layer:m,coords:y,colorMode:x,elevationType:T,terrainEnabled:E,pass:C}=l,M=d.context.gl,P=m.paint.get("fill-pattern"),F=m.paint.get("fill-pattern-cross-fade"),z=P.constantOr(null);let B=T;T!=="road"||t&&!E||(B="none");const j=B==="road",Z=l.painter.shadowRenderer,H=j&&!!Z&&Z.enabled,$=new It(d.context.gl.LEQUAL,It.ReadOnly,d.depthRangeFor3D);let le=[0,0,0];if(H){const J=d.style.directionalLight,ue=d.style.ambientLight;J&&ue&&(le=bo(d.style,J,ue))}const ne=P&&P.constantOr(1),se=d.terrain&&d.terrain.renderingToTexture,ee=(J,ue)=>{let _e,xe,Ae,Ee,Fe;ue?(_e=ne&&!m.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Ae=
vendor: 7,362 bytes, line 2996
2996M.LINES):(_e=ne?"fillPattern":"fill",Ae=M.TRIANGLES);for(const $e of y){const Te=p.getTile($e);if(ne&&!Te.patternsLoaded())continue;const he=Te.getBucket(m);if(!he)continue;const ze=t?he.elevationBufferData:he.bufferData;if(ze.isEmpty())continue;d.prepareDrawTile();const Me=ze.programConfigurations.get(m.id),We=d.isTileAffectedByFog($e),et=[],ut=[];j&&(et.push("ELEVATED_ROADS"),ut.push(ze.elevatedLayoutVertexBuffer)),H&&et.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),se&&o&&et.push("USE_MRT1"),ne&&(d.context.activeTexture.set(M.TEXTURE0),Te.imageAtlasTexture&&Te.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),Me.updatePaintBuffers());let tt=!1;if(z&&Te.imageAtlas){const bt=Te.imageAtlas,Ct=s.e3.from(z),Ot=Ct.getPrimary().scaleSelf(s.o.devicePixelRatio).toString(),Ht=Ct.getSecondary(),ti=bt.patternPositions.get(Ot),Vt=Ht?bt.patternPositions.get(Ht.scaleSelf(s.o.devicePixelRatio).toString()):null;tt=!!ti&&!!Vt,ti&&Me.setConstantPatternPositions(ti,Vt)}F>0&&(tt||Me.getPatternTransitionVertexBuffer("fill-pattern"))&&et.push("FILL_PATTERN_TRANSITION");const nt=d.getOrCreateProgram(_e,{config:Me,overrideFog:We,defines:et}),Et=d.translatePosMatrix($e.projMatrix,Te,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));H&&Z.setupShadows(Te.tileID.toUnwrapped(),nt,"vector-tile");const wt=m.paint.get("fill-emissive-strength");if(ue){Ee=ze.lineIndexBuffer,Fe=ze.lineSegments;const bt=d.terrain&&d.terrain.renderingToTexture?d.terrain.drapeBufferSize:[M.drawingBufferWidth,M.drawingBufferHeight];xe=_e==="fillOutlinePattern"&&ne?ip(Et,wt,d,Te,bt,le,F):tp(Et,wt,bt,le)}else Ee=ze.indexBuffer,Fe=ze.triangleSegments,xe=ne?Uh(Et,wt,d,Te,le,F):xa(Et,wt,le);d.uploadCommonUniforms(d.context,nt,$e.toUnwrapped());let pt=J;(T==="road"&&!E||T==="offset")&&(pt=$),nt.draw(d,Ae,pt,c||d.stencilModeForClipping($e),x,zt.disabled,xe,m.id,ze.layoutVertexBuffer,Ee,Fe,m.paint,d.transform.zoom,Me,ut)}};d.renderPass===C&&ee(d.depthModeForSublayer(1,d.renderPass==="opaque"?It.ReadWrite:It.ReadOnly),!1),B==="none"&&d.renderPass==="translucent"&&m.paint.get("fill-antialias")&&ee(d.depthModeForSublayer(m.getPaintProperty("fill-outline-color")?2:0,It.ReadOnly),!0)}function sl(l,t,o,c,d,p,m,y){o.resetLayerRenderingStats(l);const x=l.context,T=x.gl,E=l.transform,C=o.paint.get("fill-extrusion-pattern"),M=o.paint.get("fill-extrusion-pattern-cross-fade"),P=C.constantOr(null),F=C.constantOr(1),z=o.paint.get("fill-extrusion-opacity"),B=l.style.enable3dLights(),j=o.paint.get(B&&!F?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),Z=[o.paint.get("fill-extrusion-ambient-occlusion-intensity"),j],H=o.layout.get("fill-extrusion-edge-radius"),$=H>0&&!o.paint.get("fill-extrusion-rounded-roof"),le=$?0:H,ne=E.projection.name==="globe"?s.eb():0,se=E.projection.name==="globe",ee=se?s.aj(E.zoom):0,J=[s.aF(E.center.lng),s.aJ(E.center.lat)],ue=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",_e=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ue?null:o.lut).toArray01().slice(0,3),xe=o.paint.get("fill-extrusion-flood-light-intensity"),Ae=o.paint.get("fill-extrusion-vertical-scale"),Ee=o.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Fe=o.paint.get("fill-extrusion-height-alignment"),$e=o.paint.get("fill-extrusion-base-alignment"),Te=vo(l,o.paint.get("fill-extrusion-cutoff-fade-range")),he=[];let ze;se&&he.push("PROJECTION_GLOBE_VIEW"),Z[0]>0&&he.push("FAUX_AO"),$&&he.push("ZERO_ROOF_RADIUS"),y&&he.push("HAS_CENTROID"),xe>0&&he.push("FLOOD_LIGHT"),Te.shouldRenderCutoff&&he.push("RENDER_CUTOFF"),Ee&&he.push("RENDER_WALL_MODE");const Me=l.renderPass==="shadow",We=l.shadowRenderer,et=Me&&!!We,ut=Me?zt.disabled:zt.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let tt=[0,0,0];if(We){const wt=l.style.directionalLight,pt=l.style.ambientLight;wt&&pt&&(tt=bo(l.style,wt,pt)),Me||(he.push("RENDER_SHADOWS","DEPTH_TEXTURE"),We.useNormalOffset&&he.push("NORMAL_OFFSET")),ze=he.concat(["SHADOWS_SINGLE_CASCADE"])}const nt=et?"fillExtrusionDepth":F?"fillExtrusionPattern":"fillExtrusion",Et=o.getLayerRenderingStats();for(const wt of c){const pt=t.getTile(wt),bt=pt.getBucket(o);if(!bt||bt.projection.name!==E.projection.name)continue;let Ct=!1;We&&(Ct=We.getMaxCascadeForTile(wt.toUnwrapped())===0);const Ot=l.isTileAffectedByFog(wt),Ht=bt.programConfigurations.get(o.id);let ti=!1;if(P&&pt.imageAtlas){const ii=pt.imageAtlas,qt=s.e3.from(P),mi=qt.getPrimary().scaleSelf(s.o.devicePixelRatio).toString(),Zi=qt.getSecondary(),Wi=ii.patternPositions.get(mi),_i=Zi?ii.patternPositions.get(Zi.scaleSelf(s.o.devicePixelRatio).toString()):null;ti=!!Wi&&!!_i,Wi&&Ht.setConstantPatternPositions(Wi,_i)}M>0&&(ti||Ht.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&he.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Vt=l.getOrCreateProgram(nt,{config:Ht,defines:Ct?ze:he,overrideFog:Ot});if(l.terrain&&l.terrain.setupElevationDraw(pt,Vt,{useMeterToDem:!0}),!bt.centroidVertexBuffer){const ii=Vt.getAttributeLocation(T,"a_centroid_pos");ii!==-1&&T.vertexAttrib2f(ii,0,0)}!Me&&We&&We.setupShadows(pt.tileID.toUnwrapped(),Vt,"vector-tile"),F&&(l.context.activeTexture.set(T.TEXTURE0),pt.imageAtlasTexture&&pt.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Ht.updatePaintBuffers());const ui=o.paint.get("fill-extrusion-vertical-gradient"),jt=1/bt.tileToMeter;let Ti;if(Me&&We){if(Yh(pt.tileID,bt.maxHeight,l))continue;const ii=We.calculateShadowPassMatrixFromTile(pt.tileID.toUnwrapped());Ti=Vh(ii,le,jt,Ae,Fe,$e)}else{const ii=l.translatePosMatrix(wt.expandedProjMatrix,pt,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),qt=E.projection.createInversionMatrix(E,wt.canonical);Ti=F?ep(ii,l,ui,z,Z,le,jt,wt,pt,ne,Fe,$e,ee,J,qt,_e,Ae,M):lu(ii,l,ui,z,Z,le,jt,wt,ne,Fe,$e,ee,J,qt,_e,Ae,xe,tt)}l.uploadCommonUniforms(x,Vt,wt.toUnwrapped(),null,Te);let bi=bt.segments;if(E.projection.name==="mercator"&&!Me&&(bi=bt.getVisibleSegments(pt.tileID,l.terrain,l.transform.getFrustum(0)),!bi.get().length))continue;if(Et)if(Me)for(const ii of bi.get())Et.numRenderedVerticesInShadowPass+=ii.primitiveLength;else for(const ii of bi.get())Et.numRenderedVerticesInTransparentPass+=ii.primitiveLength;const Si=[];(l.terrain||y)&&Si.push(bt.centroidVertexBuffer),se&&Si.push(bt.layoutVertexExtBuffer),Ee&&Si.push(bt.wallVertexBuffer),Vt.draw(l,x.gl.TRIANGLES,d,p,m,ut,Ti,o.id,bt.layoutVertexBuffer,bt.indexBuffer,bi,o.paint,l.transform.zoom,Ht,Si)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}class sc{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Uo(l,t,o,c,d,p,m,y,x,T,E,C,M,P,F,z,B,j,Z,H){const $=t.context,le=$.gl,ne=t.transform,se=t.transform.zoom,ee=[],J=l.translate,ue=l.translateAnchor,_e=l.edgeRadius,xe=vo(t,l.cutoffFadeRange);E==="clear"?(ee.push("CLEAR_SUBPASS"),H&&(ee.push("CLEAR_FROM_TEXTURE"),$.activeTexture.set(le.TEXTURE0),H.bind(le.LINEAR,le.CLAMP_TO_EDGE))):E==="sdf"?ee.push("SDF_SUBPASS"):E==="emissive"&&(ee.push("USE_MRT1"),$.activeTexture.set(le.TEXTURE0),H.bind(le.LINEAR,le.CLAMP_TO_EDGE)),j&&ee.push("HAS_CENTROID"),xe.shouldRenderCutoff&&ee.push("RENDER_CUTOFF");const Ae=(Ee,Fe,$e,Te,he)=>{let ze=ee;Fe.groundRadiusBuffer!=null&&(ze=ee.concat("HAS_ATTRIBUTE_a_flood_light_ground_radiu
2996s"));const Me=Fe.programConfigurations.get(c.id),We=t.isTileAffectedByFog(Ee),et=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:Me,defines:ze,overrideFog:We}),ut=((nt,Et,wt,pt,bt,Ct,Ot,Ht,ti,Vt,ui)=>({u_matrix:Et,u_opacity:wt,u_ao_pass:pt?1:0,u_meter_to_tile:bt,u_ao:Ct,u_flood_light_intensity:Ot,u_flood_light_color:Ht,u_attenuation:ti,u_edge_radius:Vt,u_fb:0,u_fb_size:ui,u_dynamic_offset:1}))(0,Te,C,T,he,[M,P*he],F,z,B,se>=17?0:_e*he,H?H.size[0]:0),tt=[];j&&tt.push(Fe.hiddenByLandmarkVertexBuffer),Fe.groundRadiusBuffer!=null&&tt.push(Fe.groundRadiusBuffer),t.uploadCommonUniforms($,et,Ee.toUnwrapped(),null,xe),et.draw(t,$.gl.TRIANGLES,p,m,y,x,ut,c.id,Fe.vertexBuffer,Fe.indexBuffer,$e,c.paint,se,Me,tt)};for(const Ee of d){const Fe=o.getTile(Ee),$e=Fe.getBucket(c);if(!$e||$e.projection.name!==ne.projection.name||!$e.groundEffect||$e.groundEffect&&!$e.groundEffect.hasData())continue;const Te=$e.groundEffect,he=1/$e.tileToMeter;{const ze=t.translatePosMatrix(Ee.projMatrix,Fe,J,ue),Me=Te.getDefaultSegment();Ae(Ee,Te,Me,ze,he)}if(Z)for(let ze=0;ze<4;ze++){const Me=s.e9[ze](Ee),We=o.getTile(Me);if(!We)continue;const et=We.getBucket(c);if(!et||et.projection.name!==ne.projection.name||!et.groundEffect||et.groundEffect&&!et.groundEffect.hasData())continue;const ut=et.groundEffect;let tt,nt;ze===0?(tt=[-s.al,0,0],nt=1):ze===1?(tt=[s.al,0,0],nt=0):ze===2?(tt=[0,-s.al,0],nt=3):(tt=[0,s.al,0],nt=2);const Et=ut.regionSegments[nt];if(!Et)continue;const wt=new Float32Array(16);s.br(wt,Ee.projMatrix,tt),Ae(Ee,ut,Et,t.translatePosMatrix(wt,Fe,J,ue),he)}}}function up(l,t,o,c,d,p,m){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const y=p?p.findDEMTileFor(o):null;if(!(y&&y.dem||m))return;p&&y&&y.dem&&c.selfDEMTileTimestamp!==y.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=y.dem._timestamp);const x=(B,j)=>{(B.flags|j.flags)&s.ec?(B.flags|=s.ec,j.flags|=s.ec):(B.flags&=~s.ec,j.flags&=~s.ec)},T=B=>new s.P(Math.ceil((B+s.ed)*s.ee),0),E=B=>{const j=t.getSource().minzoom,Z=$=>{const le=t.getTileByID($);if(le&&le.hasData())return le.getBucket(d)},H=[0,-1,1];for(const $ of H){if(B.overscaledZ+$<j)continue;const le=Z(B.calculateScaledKey(B.overscaledZ+$));if(le)return le}},C=[0,0,0],M=(B,j)=>(C[0]=Math.min(B.min.y,j.min.y),C[1]=Math.max(B.max.y,j.max.y),C[2]=s.al-j.min.x>B.max.x?j.min.x-s.al:B.max.x,C),P=(B,j)=>(C[0]=Math.min(B.min.x,j.min.x),C[1]=Math.max(B.max.x,j.max.x),C[2]=s.al-j.min.y>B.max.y?j.min.y-s.al:B.max.y,C),F=[(B,j)=>M(B,j),(B,j)=>M(j,B),(B,j)=>P(B,j),(B,j)=>P(j,B)],z=(B,j,Z,H,$,le,ne)=>{if(!p)return 0;const se=[[le?Z:B,le?B:Z,0],[le?Z:j,le?j:Z,0]],ee=ne<0?s.al+ne:ne,J=[le?ee:(B+j)/2,le?(B+j)/2:ee,0];return Z===0&&ne<0||Z!==0&&ne>0?p.getForTilePoints($,[J],!0,H):se.push(J),p.getForTilePoints(o,se,!0,y),Math.max(se[0][2],se[1][2],J[2])/p.exaggeration()};for(let B=0;B<4;B++){const j=c.borderFeatureIndices[B];if(j.length===0)continue;const Z=s.e9[B](o),H=E(Z);if(!(H&&H instanceof s.ea))continue;const $=p?p.findDEMTileFor(Z):null;if(!($&&$.dem||m)||(p&&$&&$.dem&&c.borderDEMTileTimestamp[B]!==$.dem._timestamp&&(c.borderDoneWithNeighborZ[B]=-1,c.borderDEMTileTimestamp[B]=$.dem._timestamp),c.borderDoneWithNeighborZ[B]===H.canonical.z))continue;H.centroidVertexArray.length===0&&H.createCentroidsBuffer();const le=(B<2?1:5)-B,ne=H.borderDoneWithNeighborZ[le]!==c.canonical.z,se=H.borderFeatureIndices[le];let ee=0;if(c.canonical.z!==H.canonical.z){for(const J of j)c.showCentroid(c.featuresOnBorder[J]);if(ne)for(const J of se)H.showCentroid(H.featuresOnBorder[J]);c.borderDoneWithNeighborZ[B]=H.canonical.z,H.borderDoneWithNeighborZ[le]=c.canonical.z}for(const J of j){const ue=c.featuresOnBorder[J],_e=c.centroidData[ue.centroidDataIndex],xe=ue.borders[B];let Ae;for(;ee<se.length;){Ae=H.featuresOnBorder[se[ee]];const Ee=Ae.borders[le];if(Ee[1]>xe[0]+3||Ee[0]>xe[0]-3)break;H.showCentroid(Ae),ee++}if(Ae&&ee<se.length){const Ee=ee;let Fe=0;for(;!(Ae.borders[le][0]>xe[1]-3)&&(Fe++,++ee!==se.length);)Ae=H.featuresOnBorder[se[ee]];Ae=H.featuresOnBorder[se[Ee]];let $e=!1;if(Fe>=1){const ze=Ae.borders[le];Math.abs(xe[0]-ze[0])<3&&Math.abs(xe[1]-ze[1])<3&&(Fe=1,$e=!0,ee=Ee+1)}else if(Fe===0){c.showCentroid(ue);continue}const Te=H.centroidData[Ae.centroidDataIndex];m&&$e&&x(_e,Te);const he=ue.intersectsCount()>1||Ae.intersectsCount()>1;
2996if(Fe>1)ee=Ee,_e.centroidXY=Te.centroidXY=new s.P(0,0);else if($&&$.dem&&!he){const ze=F[B](_e,Te),Me=B%2?s.al-1:0,We=z(ze[0],Math.min(s.al-1,ze[1]),Me,$,Z,B<2,ze[2]);_e.centroidXY=Te.centroidXY=T(We)}else he?_e.centroidXY=Te.centroidXY=new s.P(0,0):(_e.centroidXY=c.encodeBorderCentroid(ue),Te.centroidXY=H.encodeBorderCentroid(Ae));c.writeCentroidToBuffer(_e),H.writeCentroidToBuffer(Te)}else c.showCentroid(ue)}c.borderDoneWithNeighborZ[B]=H.canonical.z,H.borderDoneWithNeighborZ[le]=c.canonical.z}(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const hp=[1,0,0],dp=[0,1,0],fp=[0,0,1];function Yh(l,t,o){const c=o.transform,d=o.shadowRenderer;if(!d)return!0;const p=l.toUnwrapped(),m=c.tileSize*d._cascades[o.currentShadowCascade].scale;let y=t;if(c.elevation){const z=c.elevation.getMinMaxForTile(l);z&&(y+=z.max)}const x=[...d.shadowDirection];x[2]=-x[2];const T=d.computeSimplifiedTileShadowVolume(p,y,m,x);if(!T)return!1;const E=[hp,dp,fp,x,[x[0],0,x[2]],[0,x[1],x[2]]],C=c.projection.name==="globe",M=c.scaleZoom(m),P=s.cB.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,M,!C),F=d.getCurrentCascadeFrustum();return P.intersectsPrecise(T.vertices,T.planes,E)===0||F.intersectsPrecise(T.vertices,T.planes,E)===0}function al(l){const{painter:t,source:o,layer:c,coords:d}=l;let p=l.defines;const m=t.context,y=t.renderPass==="shadow",x=t.renderPass==="light-beam",T=t.shadowRenderer,E=s.ef(t.transform.center.lat,t.transform.zoom),C=vo(t,c.paint.get("building-cutoff-fade-range"));C.shouldRenderCutoff&&(p=p.concat("RENDER_CUTOFF")),l.floodLightIntensity>0&&(p=p.concat("FLOOD_LIGHT"));for(const M of d){const P=o.getTile(M),F=P.getBucket(c);if(!F)continue;T&&T.getMaxCascadeForTile(M.toUnwrapped())===0&&(p=p.concat("SHADOWS_SINGLE_CASCADE"));const z=F.programConfigurations.get(c.id);let B,j,Z,H=t.translatePosMatrix(M.expandedProjMatrix,P,[0,0],"map");if(H=s.cS(s.bC(),H,[1,1,l.verticalScale]),y&&T){if(Yh(P.tileID,F.maxHeight*E,t))continue;let le=T.calculateShadowPassMatrixFromTile(P.tileID.toUnwrapped());le=s.cS(s.bC(),le,[1,1,l.verticalScale]),Z=Gs(le),B=j=t.getOrCreateProgram("buildingDepth",{config:z,defines:p,overrideFog:!1})}else if(x)B=j=t.getOrCreateProgram("buildingBloom",{config:z,defines:p,overrideFog:!1}),Z=rp(H);else{const le=t.transform.calculatePosMatrix(M.toUnwrapped(),t.transform.worldSize);s.cS(le,le,[1,1,l.verticalScale]);const ne=s.bC();s.cS(ne,le,[1,-1,1/E]),s.bl(ne,ne),s.eg(ne,ne);const se=t.transform.getFreeCameraOptions().position,ee=1<<M.canonical.z;if(Z=cu(H,ne,l.opacity,l.facadeAOIntensity,[((se.x-M.wrap)*ee-M.canonical.x)*s.al,(se.y*ee-M.canonical.y)*s.al,se.z*ee*s.al],F.tileToMeter,l.facadeEmissiveChance,l.floodLightColor,l.floodLightIntensity),j=t.getOrCreateProgram("building",{config:z,defines:p,overrideFog:!1}),l.depthOnly===!0)B=j;else{const J=p.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);B=t.getOrCreateProgram("building",{config:z,defines:J,overrideFog:!1})}T&&(T.setupShadowsFromMatrix(le,j,!0),B!==j&&T.setupShadowsFromMatrix(le,B,!0))}const $=(le,ne)=>{if(x){const se=le.entranceBloom;ne.draw(t,m.gl.TRIANGLES,l.depthMode,kt.disabled,l.blendMode,zt.disabled,Z,c.id,se.layoutVertexBuffer,se.indexBuffer,se.segmentsBucket,c.paint,t.transform.zoom,z,[se.layoutAttenuationBuffer,se.layoutColorBuffer])}else{const se=le.segmentsBucket;let ee=[le.layoutNormalBuffer,le.layoutCentroidBuffer,le.layoutColorBuffer,le.layoutFloodLightDataBuffer];le.layoutFacadePaintBuffer&&(ee=ee.concat([le.layoutFacadeDataBuffer,le.layoutFacadeVerticalRangeBuffer,le.layoutFacadePaintBuffer])),ne.draw(t,m.gl.TRIANGLES,l.depthMode,kt.disabled,l.blendMode,y?zt.disabled:zt.backCW,Z,c.id,le.layoutVertexBuffer,le.indexBuffer,se,c.paint,t.transform.zoom,z,ee)}};t.uploadCommonUniforms(m,j,M.toUnwrapped(),null,C),F.buildingWithoutFacade&&$(F.buildingWithoutFacade,j),F.buildingWithFacade&&(B!==j&&t.uploadCommonUniforms(m,B,M.toUnwrapped(),null,C),$(F.buildingWithFacade,B))}}function yu(l,t,o,c,d,p,m,y,x,T,E,C,M){const P=l.context.gl,F=l.depthModeForSublayer(1,It.ReadOnly,P.LEQUAL,!0),z=.1*(1-(B=E))+3*B;var B;const j=l._showOverdrawInspector,Z=C,H=new sc;j||Uo(H,l,t,o,c,F,new kt({func:P.ALWAYS,mask:255},255,255,P.KEEP,P.KEEP,P.REPLACE),new Ut([P.ONE,P.ONE,P.ONE,P.ONE],s.ao.transparent,[!1,!1,!1,!0],P.MIN),zt.disabled,d,"sdf",p,m,y,x,T,z,Z,!1);{const $=j?kt.disabled:new kt({func:P.EQUAL,mask:255},255,255,P.KEEP,P.DECR,P.DECR),le=j?l.colorModeForRenderPass():new Ut([P.ONE_MINUS_DST_ALPHA,P.DST_ALPHA,P.ONE,P.ONE],s.ao.transparent,[!0,!0,!0,!0]);Uo(H,l,t,o,c,F,$,le,zt.disabled,d,"color",p,m,y,x,T,z,Z,!1)}}function Kh(l){return[l[0]*s.eh,l[1]*s.eh,l[2]*s.eh,0]}function xu(l,t,o,c,d,p,m,y,x){const T=c.getSource(),E=o.globeSharedBuffers;if(!E)return;let C,M,P;if(t&&(C=c.getTile(t)),T instanceof s.aU?(M=T.texture,P=s.dK(0,0,o.transform)):C&&t&&(M=C.texture,P=s.dK(t.canonical.z,t.canonical.x,o.transform)),!M||!P)return;l||(P=s.cS(s.bC(),P,[1,-1,1]));
vendor: 13,969 bytes, line 2996
2996const F=o.context,z=F.gl,B=d.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,j=o.colorModeForDrapableLayerRenderPass(p),Z=m.defines;Z.push("GLOBE_POLES");const H=new It(z.LEQUAL,It.ReadWrite,o.depthRangeFor3D),$=Float32Array.from(o.transform.expandedFarZProjMatrix),le=Float32Array.from(s.bk(s.dJ(new s.cD(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),F.activeTexture.set(z.TEXTURE0),M.bind(B,z.CLAMP_TO_EDGE),F.activeTexture.set(z.TEXTURE1),M.bind(B,z.CLAMP_TO_EDGE),"useMipmap"in M&&F.extTextureFilterAnisotropic&&o.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,F.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,F.extTextureFilterAnisotropicMax);const[ne,se,ee,J]=t?E.getPoleBuffers(t.canonical.z,!1):E.getPoleBuffers(0,!0),ue=d.paint.get("raster-elevation");let _e;l?(_e=ne,o.renderDefaultNorthPole=ue!==0):(_e=se,o.renderDefaultSouthPole=ue!==0);const xe=Kh(m.mix),Ae=((Fe,$e,Te,he,ze,Me,We,et,ut,tt,nt,Et,wt)=>Hh(Fe,$e,Te,new Float32Array(16),new Float32Array(9),[0,0],he,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Me,[0,0],et,2,tt,nt,Et,1,0,wt))($,le,P,s.aj(o.transform.zoom),0,d,0,ue,0,xe,m.offset,m.range,p),Ee=o.getOrCreateProgram("raster",{defines:Z});o.uploadCommonUniforms(F,Ee,null),Ee.draw(o,z.TRIANGLES,H,x,j,y,Ae,d.id,_e,ee,J)}function pp(l){if(l.isOrthographic)return[0,0,0,0];const t=l._nearZ,o=l.projection.farthestPixelDistance(l),c=o-t,d=.2*l.height,p=t+d;return[t,o,(p-d-t)/c,(p-t)/c]}function mp(l,t,o,c){if(l)return t instanceof fn&&l instanceof Oc?t.getTextureDescriptor(l,o,!0):{texture:l.texture,mix:Kh(c.mix),offset:c.offset,buffer:0,tileSize:1}}var Jh=s.ei([{name:"a_index",type:"Int16",components:1}]);class _p{constructor(t,o,c,d){const p={width:c[0],height:c[1],data:null},m=t.gl;this.targetColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(o,d),this.lastInvalidatedAt=0}updateParticleTexture(t,o){if(this.particleTextureDimension===o.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const c=this.context.gl,d=o.width*o.height;this.particleTexture0=new s.T(this.context,o,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,o,c.RGBA8,{premultiply:!1,useMipmap:!1});const p=new s.ej;p.reserve(d);for(let m=0;m<d;m++)p.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(p,Jh.members,!0),this.particleSegment=s.bg.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=o.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=s.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Qh(l,t,o){if(!l)return null;const c=t.getTextureDescriptor(l,o,!0);if(!c)return null;let{texture:d,mix:p,offset:m,tileSize:y,buffer:x,format:T}=c;if(!d||!T)return null;let E=!1;return T==="uint32"&&(E=!0,p[3]=0,p=hu(s.ek,p,[0,o.paint.get("raster-particle-max-speed")]),m=op(s.ek,m,[0,o.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(y+2*x),y/(y+2*x)],tileSize:y,scalarData:E,scale:p,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function gp(l){const t=l._nearZ,o=l.projection.farthestPixelDistance(l),c=o-t,d=.2*l.height,p=t+d;return[t,o,(p-d-t)/c,(p-t)/c]}const ed=new s.ao(1,0,0,1),td=new s.ao(0,1,0,1),id=new s.ao(0,0,1,1),L_=new s.ao(1,0,1,1),D_=new s.ao(0,1,1,1);function yp(l,t,o,c,d,p){for(let m=0;m<o.length;m++)if(d){const T=new s.ao(c.r*.8,c.g*.8,c.b*.8,1);$s(l,t,o[m],c,-1,-1,p),$s(l,t,o[m],c,-1,1,p),$s(l,t,o[m],c,1,1,p),$s(l,t,o[m],c,1,-1,p),$s(l,t,o[m],T,0,0,p)}else $s(l,t,o[m],c,0,0,p)}function $s(l,t,o,c,d,p,m){const y=l.context,x=l.transform,T=y.gl,E=x.projection.name==="globe",C=E?["PROJECTION_GLOBE_VIEW"]:[];let M=s.bz(o.projMatrix);if(E&&s.aj(x.zoom)>0){const xe=s.bj(o.canonical,x),Ae=s.el(xe);M=s.aB(new Float32Array(16),x.globeMatrix,Ae),s.aB(M,x.projMatrix,M)}const P=s.bC();P[12]+=2*d/(s.o.devicePixelRatio*x.width),P[13]+=2*p/(s.o.devicePixelRatio*x.height),s.aB(M,P,M);const F=l.getOrCreateProgram("debug",{defines:C}),z=t.getTileByID(o.key);l.terrain&&l.terrain.setupElevationDraw(z,F);const B=It.disabled,j=kt.disabled,Z=l.colorModeForRenderPass(),H="$debug";y.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),E?z._makeGlobeTileDebugBuffers(l.context,x):z._makeDebugTileBoundsBuffers(l.context,x.projection);const $=z._tileDebugBuffer||l.debugBuffer,le=z._tileDebugIndexBuffer||l.debugIndexBuffer,ne=z._tileDebugSegments||l.debugSegments;if(F.draw(l,T.LINE_STRIP,B,j,Z,zt.disabled,qh(M,c.toPremultipliedRenderColor(null)),H,$,le,ne,null,null,null,[z._globeTileDebugBorderBuffer]),m){const xe=z.latestRawTileData,Ae=Math.floor((xe&&xe.byteLength||0)/1024);let Ee=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(Ee+=` => ${o.overscaledZ}`),Ee+=` ${z.state}`,Ee+=` ${Ae}kb`,(function(Fe,$e){Fe.initDebugOverlayCanvas();const Te=Fe.debugOverlayCanvas,he=Fe.context.gl,ze=Fe.debugOverlayCanvas.getContext("2d");ze.clearRect(0,0,Te.width,Te.height),ze.shadowColor="white",ze.shadowBlur=2,ze.lineWidth=1.5,ze.strokeStyle="white",ze.textBaseline="top",ze.font="bold 36px Open Sans, sans-serif",ze.fillText($e,5,5),ze.strokeText($e,5,5),Fe.debugOverlayTexture.update(Te),Fe.debugOverlayTexture.bind(he.LINEAR,he.CLAMP_TO_EDGE)})(l,Ee)}const se=t.getTile(o).tileSize,ee=512/Math.min(se,512)*(o.overscaledZ/x.zoom)*.5,J=z._tileDebugTextBuffer||l.debugBuffer,ue=z._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,_e=z._tileDebugTextSegments||l.debugSegments;F.draw(l,T.TRIANGLES,B,j,Ut.alphaBlended,zt.disabled,qh(M,s.ao.transparent.toPremultipliedRenderColor(null),ee),H,J,ue,_e,null,null,null,[z._globeTileDebugTextBuffer])}function xp(l,t,o,c){vu(l,0,t+o/2,l.transform.width,o,c)}function rd(l,t,o,c){vu(l,t-o/2,0,o,l.transform.height,c)}function vu(l,t,o,c,d,p){const m=l.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*s.o.devicePixelRatio,o*s.o.devicePixelRatio,c*s.o.devicePixelRatio,d*s.o.devicePixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}const vp=s.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:z_}=vp;function Hs(l,t,o,c){l.emplaceBack(t,o,c)}class zn{constructor(t){this.vertexArray=new s.em,this.indices=new s.b0,Hs(this.vertexArray,-1,-1,1),Hs(this.vertexArray,1,-1,1),Hs(this.vertexArray,-1,1,1),Hs(this.vertexArray,1,1,1),Hs(this.vertexArray,-1,-1,-1),Hs(this.vertexArray,1,-1,-1),Hs(this.vertexArray,-1,1,-1),Hs(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=t.createVertexBuffer(this.vertexArray,z_),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=s.bg.simpleSegment(0,0,36,12)}}function Zs(l,t,o,c,d,p){const m=l.context.gl,y=t.paint.get("sky-atmosphere-color"),x=t.paint.get("sky-atmosphere-halo-color"),T=t.paint.get("sky-atmosphere-sun-intensity"),E=((C,M,P,F,z)=>({u_matrix_3f:C,u_sun_direction:M,u_sun_intensity:P,u_color_tint_r:[F.r,F.g,F.b,F.a],u_color_tint_m:[z.r,z.g,z.b,z.a],u_luminance:5e-5}))(s.eo(s.dO(),c),d,T,y.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+p,t.skyboxTexture,0),o.draw(l,m.TRIANGLES,It.disabled,kt.disabled,Ut.unblended,zt.frontCW,E,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const _n=s.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ws{constructor(t){const o=new s.ep;o.emplaceBack(-1,1,1,0,0),o.emplaceBack(1,1,1,1,0),o.emplaceBack(1,-1,1,1,1),o.emplaceBack(-1,-1,1,0,1);const c=new s.b0;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(o,_n.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=s.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const bp=s.ei([{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 nd{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class od{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Ut([1,Fs,1,Fs],s.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Ut([1,0,1,0],s.ao.transparent,[!1,!1,!1,!0]),this.params=new nd,this.updateNeeded=!0}update(t){const o=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Ws(o);const c=this.params.sizeRange,d=this.params.intensityRange,p=(function(E){const C=s.eq(30),M=[];for(let P=0;P<E;++P){const F=2*Math.PI*C(),z=Math.acos(1-2*C())-.5*Math.PI;M.push(s.d5(Math.cos(z)*Math.cos(F),Math.cos(z)*Math.sin(F),Math.sin(z)))}return M})(this.params.starsCount),m=s.eq(300),y=new s.er,x=new s.b0;let T=0;for(let E=0;E<p.length;++E){const C=s.c5([],p[E],200),M=Math.max(0,1+.01*c*(1*m()-.5)),P=Math.max(0,1+.01*d*(1*m()-.5));y.emplaceBack(C[0],C[1],C[2],-1,-1,M,P),y.emplaceBack(C[0],C[1],C[2],1,-1,M,P),y.emplaceBack(C[0],C[1],C[2],1,1,M,P),y.emplaceBack(C[0],C[1],C[2],-1,1,M,P),x.emplaceBack(T+0,T+1,T+2),x.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=o.createVertexBuffer(y,bp.members),this.starsIdx=o.createIndexBuffer(x),this.starsSegments=s.bg.simpleSegment(0,0,y.length,x.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,o){const c=t.context,d=c.gl,p=t.transform,m=new It(d.LEQUAL,It.ReadOnly,[0,1]),y=s.aj(p.zoom),x=t.style.getLut(o.scope),T=o.properties.get("color-use-theme")==="none",E=o.properties.get("color").toNonPremultipliedRenderColor(T?null:x),C=o.properties.get("high-color-use-theme")==="none",M=o.properties.get("high-color").toNonPremultipliedRenderColor(C?null:x),P=o.properties.get("space-color-use-theme")==="none",F=o.properties.get("space-color").toNonPremultipliedRenderColor(P?null:x),z=5e-4,B=s.es(o.properties.get("horizon-blend"),0,1,z,.25),j=s.dE(t,c,p)&&B===z?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,Z=t.frameCounter/1e3%1,H=s.ag(p.globeCenterInViewSpace),$=Math.sqrt(Math.pow(H,2)-Math.pow(j,2)),le=Math.acos($/H),ne=se=>{const ee=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];se&&ee.push("ALPHA_PASS");const J=t.getOrCreateProgram("globeAtmosphere",{defines:ee}),ue=((xe,Ae,Ee,Fe,$e,Te,he,ze,Me,We,et,ut)=>({u_frustum_tl:xe,u_frustum_tr:Ae,u_frustum_br:Ee,u_frustum_bl:Fe,u_horizon:$e,u_transition:Te,u_fadeout_range:he,u_atmosphere_fog_color:ze.toArray01(),u_high_color:Me.toArray01(),u_space_color:We.toArray01(),u_temporal_offset:et,u_horizon_angle:ut}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,y,B,E,M,F,Z,le);t.uploadCommonUniforms(c,J);const _e=this.atmosphereBuffer;_e&&J.draw(t,d.TRIANGLES,m,kt.disabled,se?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,zt.backCW,ue,se?"atmosphere_glow_alpha":"atmosphere_glow",_e.vertexBuffer,_e.indexBuffer,_e.segments)};ne(!1),ne(!0)}drawStars(t,o){const c=s.aA(o.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,p=d.gl,m=t.transform,y=t.getOrCreateProgram("stars"),x=s.c7([]);s.c9(x,x,-m._pitch),s.c8(x,x,-m.angle),s.c9(x,x,s.an(m._center.lat)),s.et(x,x,-s.an(m._center.lng));const T=s.cc(new Float32Array(16),x),E=s.aB([],m.starsProjMatrix,T),C=s.eo([],T),M=s.eu([],C),P=[0,1,0];s.dQ(P,P,M),s.c5(P,P,this.params.sizeMultiplier);const F=[1,0,0];s.dQ(F,F,M),s.c5(F,F,this.params.sizeMultiplier);const z=(B=P,j=F,Z=c,{u_matrix:Float32Array.from(E),u_up:B,u_right:j,u_intensity_multiplier:Z});var B,j,Z;t.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(t,p.TRIANGLES,It.disabled,kt.disabled,this.colorModeAlphaBlendedWriteRGB,zt.disabled,z,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class sd{constructor(){this.visibleTiles=[]}updateBorders(t,o){const c=[],d=[],p=t._getRenderableCoordinates(!1,!0);for(const x of p){const T=t.getTile(x);if(!T.hasData())continue;const E=T.getBucket(o);E&&(E.isEmpty()||(c.push(x.key),d.push({bucket:E,tileID:x.canonical})))}let m=c.length!==this.visibleTiles.length;if(!m){c.sort();for(let x=0;x<c.length;x++)if(c[x]!==this.visibleTiles[x]){m=!0;break}}if(!m)return;const y=new Set;this.visibleTiles=c,d.sort((x,T)=>x.tileID.z-T.tileID.z||x.tileID.x-T.tileID.x||x.tileID.y-T.tileID.y);for(const x of d){const T=new Array,E=new Array,C=x.bucket;for(const M of C.featuresOnBorder)y.has(M.featureId)?E.push(M.footprintIndex):(y.add(M.featureId),T.push(M.footprintIndex));C.updateFootprintHiddenFlags(T,s.ev,!1),C.updateFootprintHiddenFlags(E,s.ev,!0)}}}function ad(l,t){const o=[...l],c=t.cameraWorldSizeForFog/t.worldSize,d=s.bA([]);return s.cS(d,d,[c,c,1]),s.aB(o,d,o),s.aB(o,t.worldToFogMatrix,o),o}function Co(l,t,o,c,d){const p=o.material,m=c.context,{baseColorTexture:y,metallicRoughnessTexture:x}=p.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:E,emissionTexture:C}=p;function M(F,z,B){if(F&&(l.push(z),m.activeTexture.set(m.gl.TEXTURE0+B),F.gfxTexture)){const{minFilter:j,magFilter:Z,wrapS:H,wrapT:$}=F.sampler;F.gfxTexture.bindExtraParam(j,Z,H,$)}}
2996M(y,"HAS_TEXTURE_u_baseColorTexture",5),M(x,"HAS_TEXTURE_u_metallicRoughnessTexture",6),M(T,"HAS_TEXTURE_u_normalTexture",7),M(E,"HAS_TEXTURE_u_occlusionTexture",8),M(C,"HAS_TEXTURE_u_emissionTexture",9),d&&(d.texture||(d.texture=new s.d$(c.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+10),d.texture&&d.texture.bind(m.gl.LINEAR,m.gl.CLAMP_TO_EDGE),l.push("APPLY_LUT_ON_GPU")),o.texcoordBuffer&&(l.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(o.texcoordBuffer)),o.colorBuffer&&(l.push(o.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(o.colorBuffer)),o.normalBuffer&&(l.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(o.normalBuffer)),o.pbrBuffer&&(l.push("HAS_ATTRIBUTE_a_pbr"),l.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(o.pbrBuffer)),p.alphaMode!=="OPAQUE"&&p.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),p.defined||l.push("DIFFUSE_SHADED");const P=c.shadowRenderer;P&&(l.push("RENDER_SHADOWS","DEPTH_TEXTURE"),P.useNormalOffset&&l.push("NORMAL_OFFSET"))}function Ai(l,t,o,c,d,p){const m=l.modelOpacity,y=t.context,x=new It(t.context.gl.LEQUAL,l.isLightMesh?It.ReadOnly:It.ReadWrite,t.depthRangeFor3D),T=t.transform,E=l.mesh,C=E.material,M=C.pbrMetallicRoughness,P=t.style.fog;let F;F=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:s.aB([],c.zScaleMatrix,l.nodeModelMatrix),s.aB(F,c.negCameraPosMatrix,F);const z=s.bl([],F);s.eg(z,z);const B=o.paint.get("model-color-use-theme").constantOr("default")==="none",j=o.paint.get("model-emissive-strength").constantOr(0),Z=fu(new Float32Array(l.worldViewProjection),new Float32Array(F),new Float32Array(z),null,t,m,M.baseColorFactor,C.emissiveFactor,M.metallicFactor,M.roughnessFactor,C,j,o,void 0,void 0,l.materialOverride,l.modelColor),H={defines:[]},$=[],le=t.shadowRenderer;le&&(le.useNormalOffset=!1),Co(H.defines,$,E,t,B?null:o.lut);let ne=null;if(P){const J=ad(l.nodeModelMatrix,t.transform);if(ne=new Float32Array(J),T.projection.name!=="globe"){const ue=E.aabb.min,_e=E.aabb.max,[xe,Ae]=P.getOpacityForBounds(J,ue[0],ue[1],_e[0],_e[1]);H.overrideFog=xe>=xt||Ae>=xt}}const se=vo(t,o.paint.get("model-cutoff-fade-range"));se.shouldRenderCutoff&&H.defines.push("RENDER_CUTOFF");const ee=t.getOrCreateProgram("model",H);t.uploadCommonUniforms(y,ee,null,ne,se),t.renderPass!=="shadow"&&le&&le.setupShadowsFromMatrix(l.nodeModelMatrix,ee),ee.draw(t,y.gl.TRIANGLES,x,d,p,E.material.doubleSided?zt.disabled:zt.backCCW,Z,o.id,E.vertexBuffer,E.indexBuffer,E.segments,o.paint,t.transform.zoom,void 0,$)}function ac(l,t){return l.style._importedAsBasemap?"basemap":t.scope}function lc(l,t,o,c,d,p,m,y,x,T){const E=l.transform,C=!!t.isGeometryBloom&&t.isGeometryBloom;if(C&&l.renderPass==="shadow")return;const M=E.projection.name==="globe"?s.eD(o,E):[...o];s.aB(M,M,t.globalMatrix);const P=s.aB([],c,M);if(t.meshes)for(const F of t.meshes){const z=y.get(F.material.name);if(z&&z.opacity<=0)continue;if(F.material.alphaMode!=="BLEND"){m.push({mesh:F,depth:0,modelIndex:d,worldViewProjection:P,nodeModelMatrix:M,isLightMesh:C,materialOverride:z,modelOpacity:x,modelColor:T});continue}const B=s.af([],F.centroid,P);!E.isOrthographic&&B[2]<=0||p.push({mesh:F,depth:B[2],modelIndex:d,worldViewProjection:P,nodeModelMatrix:M,isLightMesh:C,materialOverride:z,modelOpacity:x,modelColor:T})}if(t.children)for(const F of t.children)lc(l,F,o,c,d,p,m,y,x,T)}function ll(l,t,o,c){const d=o.shadowRenderer;if(!d)return;const p=d.getShadowPassDepthMode(),m=d.getShadowPassColorMode(),y=d.calculateShadowPassMatrixFromMatrix(t),x=oc(y);o.getOrCreateProgram("modelDepth",{defines:o._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(o,o.context.gl.TRIANGLES,p,kt.disabled,m,zt.disabled,x,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,o.transform.zoom,void 0,void 0)}function wp(l,t,o,c,d,p){for(const m of d){const y=Object.assign({},c);y.part=m;const x={type:"Unknown",id:t,properties:y},T={orientation:l.paint.get("model-rotation").evaluate(x,o)};p.set(m,T)}}function Tp(l,t,o,c,d,p){for(const m of d){const y=Object.assign({},c);y.part=m;const x={type:"Unknown",id:t,properties:y},T={color:l.paint.get("model-color").evaluate(x,o),colorMix:l.paint.get("model-color-mix-intensity").evaluate(x,o),opacity:l.paint.get("model-opacity").evaluate(x,o),emissionStrength:l.paint.get("model-emissive-strength").evaluate(x,o)};p.set(m,T)}}function ld(l,t,o,c,d){let p=!1;for(const y of c)y.modelOpacity!==1&&(Ai(y,l,t,d[y.modelIndex],kt.disabled,Ut.disabled),p=!0);for(const y of c)Ai(y,l,t,d[y.modelIndex],y.modelOpacity!==1?l.stencilModeFor3D():kt.disabled,l.colorModeForRenderPass());p&&l.resetStencilClippingMasks();const m=Ut.additive;for(const y of o)Ai(y,l,t,d[y.modelIndex],kt.disabled,y.isLightMesh?m:l.colorModeForRenderPass())}function Ta(l,t,o){const c=t.updateZoomBasedPaintProperties(),d=(function(p,m,y){let x,T,E,C=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&C>0){const M=p.terrain,P=M.findDEMTileFor(y);P&&P.dem?x=s.eF.create(M,y,P):C=0}if(C===0&&(m.terrainElevationMin=0,m.terrainElevationMax=0),C===m.validForExaggeration&&(C===0||x&&x._demTile&&x._demTile.tileID===m.validForDEMTile.id&&x._dem._timestamp===m.validForDEMTile.timestamp))return!1;for(const M in m.instancesPerModel){const P=m.instancesPerModel[M];for(let F=0;F<P.instancedDataArray.length;++F){const z=(x?C*x.getElevationAt(0|P.instancedDataArray.float32[16*F],0|P.instancedDataArray.float32[16*F+1],!0,!0):0)+P.instancesEvaluatedElevation[F];P.instancedDataArray.float32[16*F+6]=z,T=T?Math.min(m.terrainElevationMin,z):z,E=E?Math.max(m.terrainElevationMax,z):z}}return m.terrainElevationMin=T||0,m.terrainElevationMax=E||0,m.validForExaggeration=C,m.validForDEMTile=x&&x._demTile?{id:x._demTile.tileID,timestamp:x._dem._timestamp}:{id:void 0,timestamp:0},!0})(l,t,o);(c||d)&&(t.uploaded=!1,t.upload(l.context))}const gn={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new s.d9([0,0,0],[s.al,s.al,0])};function it(l,t){const o=1<<l.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,p=l.canonical.x/o,m=(l.canonical.x+1)/o,y=l.canonical.y/o,x=(l.canonical.y+1)/o;let T=t._centerAltitude;if(d){const P=d.getMinMaxForTile(l);P&&P.max>T&&(T=P.max)}const E=s.aA(c.x,p,m)-c.x,C=s.aA(c.y,y,x)-c.y,M=s.cf(T,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(E*E+C*C+M*M))}function ht(l,t,o,c,d,p,m){const y=l.context,x=l.renderPass==="shadow",T=l.shadowRenderer,E=x&&T?T.getShadowPassDepthMode():new It(y.gl.LEQUAL,It.ReadWrite,l.depthRangeFor3D),C=l.isTileAffectedByFog(p),M=l.transform.projection.name==="globe";if(o.meshes)for(const P of o.meshes){const F=M?[]:["MODEL_POSITION_ON_GPU"],z=[];let B,j,Z;const H=!M&&c.instancedDataArray.length>20;H&&F.push("INSTANCED_ARRAYS");const $=vo(l,t.paint.get("model-cutoff-fade-range"));if($.shouldRenderCutoff&&F.push("RENDER_CUTOFF"),x&&T)B=l.getOrCreateProgram("modelDepth",{defines:F}),j=oc(m.shadowTileMatrix,m.shadowTileMatrix,Float32Array.from(o.globalMatrix)),Z=T.getShadowPassColorMode();
2996else{Co(F,z,P,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),B=l.getOrCreateProgram("model",{defines:F,overrideFog:C});const ne=P.material,se=ne.pbrMetallicRoughness,ee=t.paint.get("model-opacity").constantOr(1),J=t.paint.get("model-emissive-strength").constantOr(0);j=fu(p.expandedProjMatrix,Float32Array.from(o.globalMatrix),new Float32Array(16),null,l,ee,se.baseColorFactor,ne.emissiveFactor,se.metallicFactor,se.roughnessFactor,ne,J,t,d),T&&(m.shadowUniformsInitialized?B.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(p.toUnwrapped(),B,"model-tile"),m.shadowUniformsInitialized=!0)),Z=$.shouldRenderCutoff||ee<1||ne.alphaMode!=="OPAQUE"?Ut.alphaBlended:Ut.unblended}l.uploadCommonUniforms(y,B,p.toUnwrapped(),null,$);const le=P.material.doubleSided?zt.disabled:zt.backCCW;if(H)z.push(c.instancedDataBuffer),B.draw(l,y.gl.TRIANGLES,E,kt.disabled,Z,le,j,t.id,P.vertexBuffer,P.indexBuffer,P.segments,t.paint,l.transform.zoom,void 0,z,c.instancedDataArray.length);else{const ne=x?"u_instance":"u_normal_matrix";for(let se=0;se<c.instancedDataArray.length;++se)j[ne]=new Float32Array(c.instancedDataArray.arrayBuffer,64*se,16),B.draw(l,y.gl.TRIANGLES,E,kt.disabled,Z,le,j,t.id,P.vertexBuffer,P.indexBuffer,P.segments,t.paint,l.transform.zoom,void 0,z)}}if(o.children)for(const P of o.children)ht(l,t,P,c,d,p,m)}const cl=[1,-1,1];function ir(l,t,o,c){if(!o.modelManager)return!0;const d=o.modelManager;if(!o.shadowRenderer)return!0;const p=o.shadowRenderer,m=t.aabb;let y=!0,x=l.maxHeight;if(x===0){let E=0;for(const C in l.instancesPerModel){const M=d.getModel(C,c);M?E=Math.max(E,Math.max(Math.max(M.aabb.max[0],M.aabb.max[1]),M.aabb.max[2])):y=!1}x=l.maxScale*E*1.41+l.maxVerticalOffset,y&&(l.maxHeight=x)}m.max[2]=x,m.min[2]+=l.terrainElevationMin,m.max[2]+=l.terrainElevationMax,s.af(m.min,m.min,t.tileMatrix),s.af(m.max,m.max,t.tileMatrix);const T=m.intersects(p.getCurrentCascadeFrustum());return o.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=T===2),T===0}function be(l,t){const o=l.uniformValues.u_cutoff_params[0],c=l.uniformValues.u_cutoff_params[1],d=l.uniformValues.u_cutoff_params[2],p=l.uniformValues.u_cutoff_params[3];return c===o||p===d?1:s.aA(((t-o)/(c-o)-d)/(p-d),0,1)}function Ep(l,t,o,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();s.aB(d,d,l);const p=s.bU(o.min[0],o.min[1],o.min[2],1);let m=s.aC(s.eG(),p,d),y=m,x=m;p[1]=o.max[1],m=s.aC(s.eG(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[0]=o.max[0],m=s.aC(s.eG(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[1]=o.min[1],m=s.aC(s.eG(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x;const T=s.aA(c[0],0,1),E=100*t.pixelsPerMeter*s.aA(c[1],0,1),C=s.aA(c[2],0,1),M=s.eH(s.eG(),y,x,T),P=Math.tan(.5*t.fovX),F=-M[2]*P;if(E===0)return M[1]<-Math.abs(F)?C:1;const z=(-Math.abs(F)-M[1])/E,B=(Z,H,$)=>(1-$)*Z+$*H,j=s.aA(B(1,C,z),C,1);return B(1,j,s.aA((t.pitch-20)/20,0,1))}class bu{}class cd{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,o,c){{const C=this._storage.get(o.id);if(C)return C.lastUsedFrameIdx=t,C.buf}const d=c.gl,p=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),m=new ArrayBuffer(p),y=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new s.eJ;for(let C=0;C<p/2;C+=3){const M=y[C],P=y[C+1],F=y[C+2];x.emplaceBack(M,P),x.emplaceBack(P,F),x.emplaceBack(F,M)}const T=c.bindVertexArrayOES.current,E=new bu;return E.buf=new Vo(c,x),E.lastUsedFrameIdx=t,this._storage.set(o.id,E),c.bindVertexArrayOES.set(T),E.buf}update(t){for(const[o,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(o))}destroy(){for(const[t,o]of this._storage)o.buf.destroy(),this._storage.delete(t)}}class ud{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Sp=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class hd{constructor(t){this.revealStart=11,this.revealRange=2}}const ul=s.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class O_{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,o){const c=t.getOrCreateProgram("vignette");
2996if(!this.vignetteVx||!this.vignetteIdx){const m=new s.eK,y=new s.b0;m.emplaceBack(-1,-1),m.emplaceBack(1,-1),m.emplaceBack(1,1),m.emplaceBack(-1,1),y.emplaceBack(0,1,2),y.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(m,ul.members),this.vignetteIdx=t.context.createIndexBuffer(y)}const d=s.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const m={u_vignetteShape:(p={vignetteShape:[o.start,o.range,Math.pow(10,o.fadePower)],vignetteColor:[o.color.r,o.color.g,o.color.b,o.color.a*o.strength]}).vignetteShape,u_vignetteColor:p.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,It.disabled,kt.disabled,Ut.alphaBlended,zt.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var p}}class F_{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,o){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),p=c.toLngLat(),m=s.an(p.lng),y=s.an(p.lat),x=t.pixelsPerMeter/o,T=m*s.eM,E=s.eM*Math.log(Math.tan(Math.PI/4+y/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const C=-this._offsetYPrev+E,M=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*x,this._accumulatedOffsetY+=C*x,this._accumulatedElevation+=M*x,this._offsetXPrev=T,this._offsetYPrev=E,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function dd(l,t){return[-(l[0]-Math.floor(l[0]/t)*t),-(l[1]-Math.floor(l[1]/t)*t),-(l[2]-Math.floor(l[2]/t)*t)]}function cc(l){const t=s.eq(1323123451230),o=[];for(let c=0;c<l;++c){const d=2*t()-1,p=2*t()-1,m=2*t()-1;o.push(s.d5(d,p,m))}return o}function jo(l,t,o,c,d){const p=s.aA((d-o)/(c-o),0,1);return(1-p)*l+p*t}class fd{constructor(t){this._movement=new F_,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new O_,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,o){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const d=c.starsProjMatrix,p=s.c7([]);s.c9(p,p,s.an(90)-c._pitch),s.c8(p,p,-c.angle);const m=s.cc(new Float32Array(16),p),y=s.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),x=s.eg([],y),T=s.aB([],x,m),E=Date.now()/1e3;return this._accumulatedTimeFromStart+=(E-this._prevTime)*o,this._prevTime=E,{projectionMatrix:d,modelviewMatrix:T}}}class Ip extends fd{constructor(t){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new hd("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const o=t.context;if(!this.particlesVx){const c=cc(this.particlesCount),d=new s.eN,p=new s.b0;let m=0;const y=s.eq(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],E=[2*y()-1,y(),y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...E),d.emplaceBack(T[0],T[1],T[2],1,-1,...E),d.emplaceBack(T[0],T[1],T[2],1,1,...E),d.emplaceBack(T[0],T[1],T[2],-1,1,...E),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=o.createVertexBuffer(d,Sp.members),this.particlesIdx=o.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const o=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},c=t.transform.zoom;if(o.revealStart>c)return;const d=jo(0,1,o.revealStart,o.revealStart+o.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const p=structuredClone(this._params);let m=[-p.direction.x,p.direction.y,-100];s.aw(m,m);
2996const y=structuredClone(this._vignetteParams);y.strength*=d,p.overrideStyleParameters||(p.intensity=t.style.rain.state.density,p.timeFactor=t.style.rain.state.intensity,p.color=structuredClone(t.style.rain.state.color),m=structuredClone(t.style.rain.state.direction),p.screenThinning.intensity=t.style.rain.state.centerThinning,p.dropletSizeX=t.style.rain.state.dropletSize[0],p.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],p.distortionStrength=100*t.style.rain.state.distortionStrength,y.strength=1,y.color=structuredClone(t.style.rain.state.vignetteColor));const x=this.updateOnRender(t,p.timeFactor),T=t.context,E=T.gl,C=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new s.T(T,{width:t.width,height:t.height,data:null},E.RGBA8)),p.distortionStrength>0&&(T.activeTexture.set(E.TEXTURE0),this.screenTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),E.copyTexSubImage2D(E.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const M=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(T,M),T.activeTexture.set(E.TEXTURE0),this.screenTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE);const P=[p.color.r,p.color.g,p.color.b,p.color.a],F=(z,B)=>{const j=dd(this._movement.getPosition(),z),Z=p.dropletSizeX,H=p.dropletSizeX*p.dropletSizeYScale,$=t.width/2,le=t.height/2,ne=jo(0,p.screenThinning.start,0,1,p.screenThinning.intensity),se=jo(.001,p.screenThinning.range,0,1,p.screenThinning.intensity),ee=jo(0,p.screenThinning.particleOffset,0,1,p.screenThinning.intensity),J=(ue={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:j,velocityConeAperture:p.velocityConeAperture,velocity:p.velocity,boxSize:z,rainDropletSize:[Z,H],distortionStrength:p.distortionStrength,rainDirection:m,color:P,screenSize:[C.width,C.height],thinningCenterPos:[$,le],thinningShape:[ne,se,Math.pow(10,p.screenThinning.fadePower)],thinningAffectedRatio:p.screenThinning.affectedRatio,thinningParticleOffset:ee,shapeDirectionalPower:p.shapeDirPower,shapeNormalPower:p.shapeNormalPower,mode:B?0:1},{u_modelview:Float32Array.from(ue.modelview),u_projection:Float32Array.from(ue.projection),u_time:ue.time,u_cam_pos:ue.camPos,u_texScreen:0,u_velocityConeAperture:ue.velocityConeAperture,u_velocity:ue.velocity,u_boxSize:ue.boxSize,u_rainDropletSize:ue.rainDropletSize,u_distortionStrength:ue.distortionStrength,u_rainDirection:ue.rainDirection,u_color:ue.color,u_screenSize:ue.screenSize,u_thinningCenterPos:ue.thinningCenterPos,u_thinningShape:ue.thinningShape,u_thinningAffectedRatio:ue.thinningAffectedRatio,u_thinningParticleOffset:ue.thinningParticleOffset,u_shapeDirectionalPower:ue.shapeDirectionalPower,u_shapeNormalPower:ue.shapeNormalPower,u_mode:ue.mode});var ue;const _e=Math.round(p.intensity*this.particlesCount),xe=s.bg.simpleSegment(0,0,4*_e,2*_e);M.draw(t,E.TRIANGLES,It.disabled,kt.disabled,Ut.alphaBlended,zt.disabled,J,"rain_particles",this.particlesVx,this.particlesIdx,xe)};p.distortionStrength>0&&F(p.boxSize,!0),F(p.boxSize,!1),this._vignette.draw(t,y)}}const wu=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class uc extends fd{constructor(t){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new hd("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const o=t.context;if(!this.particlesVx){const c=cc(this.particlesCount),d=new s.eO,p=new s.b0;let m=0;const y=s.eq(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],E=y(),C=y(),M=y(),P=[x/c.length,E,C,M],F=[y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...P,...F),d.emplaceBack(T[0],T[1],T[2],1,-1,...P,...F),d.emplaceBack(T[0],T[1],T[2],1,1,...P,...F),d.emplaceBack(T[0],T[1],T[2],-1,1,...P,...F),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m
2996+=4}this.particlesVx=o.createVertexBuffer(d,wu.members),this.particlesIdx=o.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const o=structuredClone(this._params);let c=[-o.direction.x,o.direction.y,-100];s.aw(c,c);const d=structuredClone(this._vignetteParams),p=o.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},m=t.transform.zoom;if(p.revealStart>m)return;const y=jo(0,1,p.revealStart,p.revealStart+p.revealRange,m);d.strength*=y,o.overrideStyleParameters||(o.intensity=t.style.snow.state.density,o.timeFactor=t.style.snow.state.intensity,o.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),o.screenThinning.intensity=t.style.snow.state.centerThinning,o.billboardSize=2.79*t.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(t.style.snow.state.vignetteColor));const x=this.updateOnRender(t,o.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=t.context,E=T.gl,C=t.transform,M=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(T,M),((P,F,z)=>{const B=dd(this._movement.getPosition(),P),j=C.width/2,Z=C.height/2,H=jo(0,z.screenThinning.start,0,1,z.screenThinning.intensity),$=jo(.001,z.screenThinning.range,0,1,z.screenThinning.intensity),le=jo(0,z.screenThinning.particleOffset,0,1,z.screenThinning.intensity),ne=(se={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:B,velocityConeAperture:z.velocityConeAperture,velocity:z.velocity,horizontalOscillationRadius:z.horizontalOscillationRadius,horizontalOscillationRate:z.horizontalOscillationRate,boxSize:P,billboardSize:1*z.billboardSize,simpleShapeParameters:[z.shapeFadeStart,z.shapeFadePower],screenSize:[C.width,C.height],thinningCenterPos:[j,Z],thinningShape:[H,$,Math.pow(10,z.screenThinning.fadePower)],thinningAffectedRatio:z.screenThinning.affectedRatio,thinningParticleOffset:le,color:[z.color.r,z.color.g,z.color.b,z.color.a],direction:c},{u_modelview:Float32Array.from(se.modelview),u_projection:Float32Array.from(se.projection),u_time:se.time,u_cam_pos:se.camPos,u_velocityConeAperture:se.velocityConeAperture,u_velocity:se.velocity,u_horizontalOscillationRadius:se.horizontalOscillationRadius,u_horizontalOscillationRate:se.horizontalOscillationRate,u_boxSize:se.boxSize,u_billboardSize:se.billboardSize,u_simpleShapeParameters:se.simpleShapeParameters,u_screenSize:se.screenSize,u_thinningCenterPos:se.thinningCenterPos,u_thinningShape:se.thinningShape,u_thinningAffectedRatio:se.thinningAffectedRatio,u_thinningParticleOffset:se.thinningParticleOffset,u_particleColor:se.color,u_direction:se.direction});var se;const ee=Math.round(z.intensity*this.particlesCount),J=s.bg.simpleSegment(0,0,4*ee,2*ee);this.particlesVx&&this.particlesIdx&&M.draw(t,E.TRIANGLES,It.disabled,kt.disabled,Ut.alphaBlended,zt.disabled,ne,"snow_particles",this.particlesVx,this.particlesIdx,J)})(o.boxSize,0,o),this._vignette.draw(t,d)}}const Ea={symbol:function(l,t,o,c,d){if(l.renderPass!=="translucent")return;const p=kt.disabled,m=l.colorModeForRenderPass(),y=o.layout.get("text-variable-anchor"),x=o.layout.get("text-size-scale-range"),T=s.aA(l.scaleFactor,x[0],x[1]);y&&(function(M,P,F,z,B,j,Z,H){const $=P.transform,le=B==="map",ne=j==="map";for(const se of M){const ee=z.getTile(se),J=ee.getBucket(F);if(!J||!J.text||!J.text.segments.get().length)continue;const ue=s.bK(J.textSizeData,$.zoom,H),_e=qa(se,J.getProjection(),$),xe=$.calculatePixelsToTileUnitsMatrix(ee),Ae=fa(_e,ee.tileID.canonical,ne,le,$,J.getProjection(),xe),Ee=J.hasIconTextFit()&&J.hasIconData();ue&&cp(J,le,ne,Z,$,Ae,se,Math.pow(2,$.zoom-ee.tileID.overscaledZ),ue,Ee)}})(c,l,o,t,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),d,T);const E=o.paint.get("icon-opacity").constantOr(1)!==0,C=o.paint.get("text-opacity").constantOr(1)!==0;o.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(E||C)?_u(l,t,o,c,p,m):(E&&_u(l,t,o,c,p,m,{onlyIcons:!0}),C&&_u(l,t,o,c,p,m,{onlyText:!0})),t.map.showCollisionBoxes&&(Zh(l,t,o,c,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),Zh(l,t,o,c,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,o,c){if(l.renderPass!=="translucent")return;const d=o.paint.get("circle-opacity"),p=o.paint.get("circle-stroke-width"),m=o.paint.get("circle-stroke-opacity"),y=o.layout.get("
2996circle-sort-key").constantOr(1)!==void 0,x=o.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const T=l.context,E=T.gl,C=l.transform,M=!(!l.terrain||!l.terrain.enabled),P=o.layout.get("circle-elevation-reference"),F=l.depthModeForSublayer(0,It.ReadOnly),z=new It(l.context.gl.LEQUAL,It.ReadOnly,l.depthRangeFor3D),B=P==="none"||M?F:z,j=kt.disabled,Z=l.colorModeForDrapableLayerRenderPass(x),H=C.projection.name==="globe",$=[s.aF(C.center.lng),s.aJ(C.center.lat)],le=[];for(let se=0;se<c.length;se++){const ee=c[se],J=t.getTile(ee),ue=J.getBucket(o);if(!ue||ue.projection.name!==C.projection.name)continue;const _e=ue.programConfigurations.get(o.id),xe=ue.layoutVertexBuffer,Ae=ue.globeExtVertexBuffer,Ee=ue.indexBuffer,Fe=s.e0(o),$e=[Ae],Te=l.isTileAffectedByFog(ee);H&&Fe.push("PROJECTION_GLOBE_VIEW"),Fe.push("DEPTH_D24"),l.terrain&&C.depthOcclusionForSymbolsAndCircles&&Fe.push("DEPTH_OCCLUSION"),ue.hasElevation&&!l.terrain&&(Fe.push("ELEVATED_ROADS"),$e.push(ue.elevatedLayoutVertexBuffer));const he=l.getOrCreateProgram("circle",{config:_e,defines:Fe,overrideFog:Te}),ze=C.projection.createInversionMatrix(C,ee.canonical),Me={programConfiguration:_e,program:he,layoutVertexBuffer:xe,dynamicBuffers:$e,indexBuffer:Ee,uniformValues:s.e1(l,ee,J,ze,$,o),tile:J};if(y){const We=ue.segments.get();for(const et of We)le.push({segments:new s.bg([et]),sortKey:et.sortKey,state:Me})}else le.push({segments:ue.segments,sortKey:0,state:Me})}y&&le.sort((se,ee)=>se.sortKey-ee.sortKey);const ne={useDepthForOcclusion:C.depthOcclusionForSymbolsAndCircles};for(const se of le){const{programConfiguration:ee,program:J,layoutVertexBuffer:ue,dynamicBuffers:_e,indexBuffer:xe,uniformValues:Ae,tile:Ee}=se.state,Fe=se.segments;l.terrain&&l.terrain.setupElevationDraw(Ee,J,ne),l.uploadCommonUniforms(T,J,Ee.tileID.toUnwrapped()),J.draw(l,E.TRIANGLES,B,j,Z,zt.disabled,Ae,o.id,ue,xe,Fe,o.paint,C.zoom,ee,_e)}},heatmap:function(l,t,o,c){if(o.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const d=l.context,p=d.gl,m=kt.disabled,y=new Ut([p.ONE,p.ONE,p.ONE,p.ONE],s.ao.transparent,[!0,!0,!0,!0]);(function(P,F,z,B){const j=P.gl,Z=F.width*B,H=F.height*B;P.activeTexture.set(j.TEXTURE1),P.viewport.set([0,0,Z,H]);let $=z.heatmapFbo;if(!$||$&&($.width!==Z||$.height!==H)){$&&$.destroy();const le=j.createTexture();j.bindTexture(j.TEXTURE_2D,le),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.L
2996INEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR),$=z.heatmapFbo=P.createFramebuffer(Z,H,1,null),(function(ne,se,ee,J,ue,_e){const xe=ne.gl;xe.texImage2D(xe.TEXTURE_2D,0,ne.extRenderToTextureHalfFloat?xe.RGBA16F:xe.RGBA,ue,_e,0,xe.RGBA,ne.extRenderToTextureHalfFloat?xe.HALF_FLOAT:xe.UNSIGNED_BYTE,null),J.colorAttachment0.set(ee)})(P,0,le,$,Z,H)}else j.bindTexture(j.TEXTURE_2D,$.colorAttachment0.get()),P.bindFramebuffer.set($.framebuffer)})(d,l,o,l.transform.projection.name==="globe"?.5:.25),d.clear({color:s.ao.transparent});const x=l.transform,T=x.projection.name==="globe",E=T?["PROJECTION_GLOBE_VIEW"]:[],C=T?zt.frontCCW:zt.disabled,M=[s.aF(x.center.lng),s.aJ(x.center.lat)];for(let P=0;P<c.length;P++){const F=c[P];if(t.hasRenderableParent(F))continue;const z=t.getTile(F),B=z.getBucket(o);if(!B||B.projection.name!==x.projection.name)continue;const j=l.isTileAffectedByFog(F),Z=B.programConfigurations.get(o.id),H=l.getOrCreateProgram("heatmap",{config:Z,defines:E,overrideFog:j}),{zoom:$}=l.transform;l.terrain&&l.terrain.setupElevationDraw(z,H),l.uploadCommonUniforms(d,H,F.toUnwrapped());const le=x.projection.createInversionMatrix(x,F.canonical);H.draw(l,p.TRIANGLES,It.disabled,m,y,C,$h(l,F,z,le,M,$,o.paint.get("heatmap-intensity")),o.id,B.layoutVertexBuffer,B.indexBuffer,B.segments,o.paint,l.transform.zoom,Z,T?[B.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),(function(d,p){const m=d.context,y=m.gl,x=p.heatmapFbo;if(!x)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,x.colorAttachment0.get()),m.activeTexture.set(y.TEXTURE1);let T=p.colorRampTexture;T||(T=p.colorRampTexture=new s.T(m,p.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,It.disabled,kt.disabled,d.colorModeForRenderPass(),zt.disabled,((E,C)=>({u_image:0,u_color_ramp:1,u_opacity:C.paint.get("heatmap-opacity")}))(0,p),p.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,p.paint,d.transform.zoom)})(l,o))},line:function(l,t,o,c){if(l.renderPass!=="translucent")return;const d=o.paint.get("line-opacity"),p=o.paint.get("line-width");if(d.constantOr(1)===0||p.constantOr(1)===0)return;const m=o.paint.get("line-emissive-strength").isConstant(),y=o.paint.get("line-emissive-strength").constantOr(0),x=o.paint.get("line-occlusion-opacity"),T=o.layout.get("line-elevation-reference"),E=o.layout.get("line-width-unit")==="meters",C=T==="sea",M=!(!l.terrain||!l.terrain.enabled),P=l.context,F=P.gl;if(o.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const z=o.layout.get("line-cross-slope"),B=z!==void 0,j=z<1,Z=l.colorModeForDrapableLayerRenderPass(m?y:null),H=l.terrain&&l.terrain.renderingToTexture,$=H?1:s.o.devicePixelRatio,le=o.paint.get("line-dasharray"),ne=le.constantOr(1),se=o.layout.get("line-cap"),ee=le.constantOr(null),J=se.constantOr(null),ue=o.paint.get("line-pattern"),_e=ue.constantOr(1),xe=o.paint.get("line-pattern-cross-fade"),Ae=ue.constantOr(null),Ee=o.paint.get("line-opacity").constantOr(1);let Fe=!_e&&Ee!==1||l.depthOcclusion&&x>0&&x<1;const $e=o.paint.get("line-gradient"),Te=_e?"linePattern":"line",he=s.e2(o);let ze;if(H&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(Fe=!1),x!==0&&l.depthOcclusion){const ut=o.paint._values["line-opacity"];ut&&ut.value&&ut.value.kind==="constant"?ze=ut.value:s.w(`Occlusion opacity for layer ${o.id} is supported only when line-opacity isn't data-driven.`)}p.value.kind!=="constant"&&p.value.isLineProgressConstant===!1&&he.push("VARIABLE_LINE_WIDTH"),H&&(l.emissiveMode!=="dual-source-blending"||m?l.emissiveMode==="mrt-fallback"&&he.push("USE_MRT1"):he.push("DUAL_SOURCE_BLENDING"));const Me=(ut,tt,nt,Et,wt,pt)=>{for(const bt of ut){const Ct=t.getTile(bt);if(_e&&!Ct.patternsLoaded())continue;const Ot=Ct.getBucket(o);if(!Ot||Ot.elevationType!=="none"&&!wt||Ot.elevationType==="none"&&wt)continue;l.prepareDrawTile();const Ht=[...tt],ti=l.shadowRenderer,Vt=Ot.elevationType==="road"&&!!ti&&ti.enabled;let ui=[0,0,0];if(Vt){const $t=l.style.directionalLight,Di=l.style.ambientLight;$t&&Di&&(ui=bo(l.style,$t,Di)),Ht.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const jt=Ot.programConfigurations.get(o.id);let Ti=!1;if(Ae&&Ct.imageAtlas){const $t=s.e3.from(Ae),Di=$t.getPrimary().scaleSelf($).toString(),rr=Ct.imageAtlas.patternPositions.get(Di),Fi=$t.getSecondary(),Ni=Fi?Ct.imageAtlas.patternPositions.get(Fi.scaleSelf($).toString()):null;Ti=!!rr&&!!Ni,rr&&jt.setConstantPatternPositions(rr,Ni)}xe>0&&(Ti||jt.getPatternTransitionVertexBuffer("line-pattern"))&&Ht.push("LINE_PATTERN_TRANSITION");const bi=l.isTileAffectedByFog(bt),Si=l.getOrCreateProgram(Te,{config:jt,defines:Ht,overrideFog:bi});if(!_e&&ee&&J&&Ct.lineAtlas){const $t=Ct.lineAtlas.getDash(ee,J);$t&&jt.setConstantPatternPositions($t)}Vt&&ti.setupShadows(Ct.tileID.toUnwrapped(),Si,"vector-tile");let[ii,qt]=o.paint.get("line-trim-offset");(J==="round"||J==="square")&&ii!==qt&&(ii===0&&(ii-=1),qt===1&&(qt+=1));const mi=H?bt.projMatrix:null,Zi=E?1/Ot.tileToMeter/s.ay(Ct,1,l.transform.zoom):1,Wi=E?1/Ot.tileToMeter/s.ay(Ct,1,Math.floor(l.transform.zoom)):1,_i=_e?s.e4(l,Ct,o,mi,$,Zi,Wi,[ii,qt],ui,xe):s.e5(l,Ct,o,mi,Ot.lineClipsArray.length,$,Zi,Wi,[ii,qt],ui);if($e){const $t=Ot.gradients[o.id];let Di=$t.texture;if(o.gradientVersion!==$t.version){let rr=256;if(o.stepInterpolant){const Fi=t.getSource().maxzoom,Ni=bt.canonical.z===Fi?Math.ceil(1<<l.transform.maxZoom-bt.canonical.z):1;rr=s.aA(s.e6(Ot.maxLineLength/s.al*1024*Ni),256,P.maxTextureSize)}$t.gradient=s.e7({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:rr,image:$t.gradient||void 0,clips:Ot.lineClipsArray}),$t.texture?$t.texture.update($t.gradient):$t.texture=new s.T(P,$t.gradient,F.RGBA8),$t.version=o.gradientVersion,Di=$t.texture}P.activeTexture.set(F.TEXTURE1),Di.bind(o.stepInterpolant?F.NEAREST:F.LINEAR,F.CLAMP_TO_EDGE)}ne&&(P.activeTexture.set(F.TEXTURE0),Ct.lineAtlasTexture&&Ct.lineAtlasTexture.bind(F.LINEAR,F.REPEAT),jt.updatePaintBuffers()),_e&&(P.activeTexture.set(F.TEXTURE0),Ct.imageAtlasTexture&&Ct.imageAtlasTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),jt.updatePaintBuffers()),wt&&!C&&l.terrain.setupElevationDraw(Ct,Si),l.uploadCommonUniforms(P,Si,bt.toUnwrapped());const Qt=$t=>{ze!=null&&(ze.value=Ee*x),Si.draw(l,F.TRIANGLES,nt,$t,Z,zt.disabled,_i,o.id,Ot.layoutVertexBuffer,Ot.indexBuffer,Ot.segments,o.paint,l.transform.zoom,jt,[Ot.layoutVertexBuffer2,Ot.patternVertexBuffer,Ot.zOffsetVertexBuffer]),ze!=null&&(ze.value=Ee)};if(Fe&&!wt){const $t=l.stencilModeForClipping(bt).ref;$t===0&&H&&P.clear({stencil:0});const Di={func:F.EQUAL,mask:255};
2996_i.u_alpha_discard_threshold=.8,Qt(new kt(Di,$t,255,F.KEEP,F.KEEP,F.INVERT)),_i.u_alpha_discard_threshold=0,Qt(new kt(Di,$t,255,F.KEEP,F.KEEP,F.KEEP))}else _i.u_alpha_discard_threshold=Fe&&wt&&pt?.8:0,Qt(wt?Et:l.stencilModeForClipping(bt))}};let We=l.depthModeForSublayer(0,It.ReadOnly);const et=new It(l.depthOcclusion?F.GREATER:F.LEQUAL,It.ReadOnly,l.depthRangeFor3D);if(o.hasNonElevatedBuckets){const ut=!H&&l.terrain;x!==0&&ut?s.w(`Occlusion opacity for layer ${o.id} is supported on terrain only if the layer has line-z-offset enabled.`):ut?s.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${o.id}.`):Me(c,he,We,kt.disabled,!1,!0)}if(o.hasElevatedBuckets){T==="hd-road-markup"?M||(We=et,he.push("ELEVATED_ROADS")):(he.push("ELEVATED"),We=et,B&&he.push(j?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),C&&he.push("ELEVATION_REFERENCE_SEA"));const ut=Fe?l.stencilModeFor3D():kt.disabled;l.forceTerrainMode=!0,Me(c,he,We,ut,!0,!0),Fe&&Me(c,he,We,ut,!0,!1),l.forceTerrainMode=!1}Fe&&(l.resetStencilClippingMasks(),H&&P.clear({stencil:0})),x===0||l.depthOcclusion||H||l.layersWithOcclusionOpacity.push(l.currentLayer)},fill:function(l,t,o,c){const d=o.paint.get("fill-color"),p=o.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=o.paint.get("fill-emissive-strength"),y=l.colorModeForDrapableLayerRenderPass(m),x=o.paint.get("fill-pattern"),T=l.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(s.ao.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";let E="none";o.layout.get("fill-elevation-reference")!=="none"?E="road":o.paint.get("fill-z-offset").constantOr(1)!==0&&(E="offset");const C=!(!l.terrain||!l.terrain.enabled),M={painter:l,sourceCache:t,layer:o,coords:c,colorMode:y,elevationType:E,terrainEnabled:C,pass:T};if(l.renderPass==="shadow")return void(l.shadowRenderer&&E==="road"&&!C&&(function(F){const{painter:z,sourceCache:B,layer:j,coords:Z}=F,H=z.context.gl,$=F.painter.shadowRenderer;for(const le of Z){const ne=B.getTile(le),se=ne.getBucket(j);if(!se)continue;const ee=se.elevatedStructures;if(!ee||!ee.shadowCasterSegments||ee.shadowCasterSegments.segments[0].primitiveLength===0)continue;z.prepareDrawTile();const J=se.bufferData.programConfigurations.get(j.id),ue=z.isTileAffectedByFog(le),_e=z.getOrCreateProgram("elevatedStructuresDepth",{config:J,overrideFog:ue}),xe=$.calculateShadowPassMatrixFromTile(ne.tileID.toUnwrapped());z.uploadCommonUniforms(z.context,_e,le.toUnwrapped());const Ae=jh(xe,0);_e.draw(z,H.TRIANGLES,$.getShadowPassDepthMode(),kt.disabled,$.getShadowPassColorMode(),zt.disabled,Ae,j.id,ee.vertexBuffer,ee.indexBuffer,ee.shadowCasterSegments,j.paint,z.transform.zoom,J)}})(M));const P=l.emissiveMode==="mrt-fallback";if(E!=="offset"){if(ol(M,!1,P),E==="road"){const F=!C&&l.renderPass==="translucent";F&&Xh(l,t,o,c,"geometry"),ol(M,!0,P,kt.disabled),F&&(function(z){const{painter:B,sourceCache:j,layer:Z,coords:H,colorMode:$}=z,le=B.context.gl,ne=z.painter.shadowRenderer,se=!!ne&&ne.enabled,ee=new It(B.context.gl.LEQUAL,It.ReadOnly,B.depthRangeFor3D);let J=[0,0,0];if(se){const _e=B.style.directionalLight,xe=B.style.ambientLight;_e&&xe&&(J=bo(B.style,_e,xe))}const ue=_e=>{for(const xe of H){const Ae=j.getTile(xe),Ee=Ae.getBucket(Z);if(!Ee)continue;const Fe=Ee.elevatedStructures;if(!Fe)continue;let $e,Te;if(_e?($e=Fe.renderableBridgeSegments,Te=Fe.bridgeProgramConfigurations.get(Z.id)):($e=Fe.renderableTunnelSegments,Te=Fe.tunnelProgramConfigurations.get(Z.id)),!$e||$e.segments[0].primitiveLength===0)continue;Te.updatePaintBuffers(),B.prepareDrawTile();const he=B.isTileAffectedByFog(xe),ze=[];se&&ze.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Me=B.getOrCreateProgram("elevatedStructures",{config:Te,overrideFog:he,defines:ze}),We=B.translatePosMatrix(xe.projMatrix,Ae,Z.paint.get("fill-translate"),Z.paint.get("fill-translate-anchor"));se&&ne.setupShadows(Ae.tileID.toUnwrapped(),Me,"vector-tile");const et=js(We,J);B.uploadCommonUniforms(B.context,Me,xe.toUnwrapped()),Me.draw(B,le.TRIANGLES,ee,kt.disabled,$,zt.backCCW,et,Z.id,Fe.vertexBuffer,Fe.indexBuffer,$e,Z.paint,B.transform.zoom,Te,[Fe.vertexBufferNormal])}};ue(!0),ue(!1)})(M)}}else ol(M,!1,P,l.stencilModeFor3D())},"fill-extrusion":function(l,t,o,c){const d=o.paint.get("fill-extrusion-opacity"),p=l.context,m=p.gl,y=l.terrain,x=y&&y.renderingToTexture;if(d===0)return;const T=l.emissiveMode==="mrt-fallback",E=l.conflationActive&&l.style.isLayerClipped(o,t.getSource()),C=l.style.order.indexOf(o.fqid);if(E&&(function(M,P,F,z,B){for(const j of z){const Z=P.getTile(j).getBucket(F);Z&&(Z.updateReplacement(j,M.replacementSource,B),Z.uploadCentroid(M.c
2996ontext))}})(l,t,o,c,C),y||E)for(const M of c){const P=t.getTile(M).getBucket(o);P&&up(l.context,t,M,P,o,y,E)}if(l.renderPass==="shadow"&&l.shadowRenderer){const M=l.shadowRenderer;if(y&&d<.65&&o._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.ad)return;const P=M.getShadowPassDepthMode(),F=M.getShadowPassColorMode();sl(l,t,o,c,P,kt.disabled,F,E)}else if(l.renderPass==="translucent"){const M=!o.paint.get("fill-extrusion-pattern").constantOr(1),P=o.paint.get("fill-extrusion-color").constantOr(s.ao.white);if(!x&&P.a!==0){const F=new It(l.context.gl.LEQUAL,It.ReadWrite,l.depthRangeFor3D);d===1&&M?sl(l,t,o,c,F,kt.disabled,Ut.unblended,E):(sl(l,t,o,c,F,kt.disabled,Ut.disabled,E),sl(l,t,o,c,F,l.stencilModeFor3D(),l.colorModeForRenderPass(),E),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&M&&(!y&&l.transform.projection.name!=="globe"||x)){const F=o.paint.get("fill-extrusion-opacity"),z=o.paint.get("fill-extrusion-ambient-occlusion-intensity"),B=o.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),j=o.paint.get("fill-extrusion-flood-light-intensity"),Z=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",H=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Z?null:o.lut).toArray01().slice(0,3),$=z>0&&B>0,le=j>0,ne=(J,ue,_e)=>(1-_e)*J+_e*ue,se=new sc;se.translate=o.paint.get("fill-extrusion-translate"),se.translateAnchor=o.paint.get("fill-extrusion-translate-anchor"),se.edgeRadius=o.layout.get("fill-extrusion-edge-radius"),se.cutoffFadeRange=o.paint.get("fill-extrusion-cutoff-fade-range");const ee=J=>{const ue=l.depthModeForSublayer(1,It.ReadOnly,m.LEQUAL,!0),_e=o.paint.get(J?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),xe=ne(.1,3,_e),Ae=l._showOverdrawInspector;if(!Ae){const Ee=new kt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Fe=new Ut([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0],m.MIN);Uo(se,l,t,o,c,ue,Ee,Fe,zt.disabled,J,"sdf",F,z,B,j,H,xe,E,!1)}{const Ee=Ae?kt.disabled:new kt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Fe=Ae?l.colorModeForRenderPass():new Ut([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],s.ao.transparent,[!0,!0,!0,!0]);Uo(se,l,t,o,c,ue,Ee,Fe,zt.disabled,J,"color",F,z,B,j,H,xe,E,!1)}};if(x){const J=()=>{const _e=y.drapeBufferSize[0],xe=y.drapeBufferSize[1];let Ae=y.framebufferCopyTexture;return Ae&&(!Ae||Ae.size[0]===_e&&Ae.size[1]===xe)||(Ae&&Ae.destroy(),Ae=y.framebufferCopyTexture=new s.T(p,new s.q({width:_e,height:xe}),m.RGBA8)),Ae.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,_e,xe),Ae},ue=(_e,xe,Ae)=>{const Ee=l.depthModeForSublayer(1,It.ReadOnly,m.LEQUAL,!1),Fe=o.paint.get(_e?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),$e=ne(.1,3,Fe);{const Te=new Ut([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0]);Uo(se,l,t,o,c,Ee,kt.disabled,Te,zt.disabled,_e,"clear",F,z,B,j,H,$e,E,xe)}{const Te=new kt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),he=new Ut([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0],m.MIN);Uo(se,l,t,o,c,Ee,Te,he,zt.disabled,_e,"sdf",F,z,B,j,H,$e,E,xe)}T&&!_e&&(Ae=J());{const Te=_e?m.ZERO:m.ONE_MINUS_DST_ALPHA,he=new kt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),ze=new Ut([Te,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],s.ao.transparent,[!0,!0,!0,!0]);Uo(se,l,t,o,c,Ee,he,ze,zt.disabled,_e,"color",F,z,B,j,H,$e,E,xe)}if(!T||_e){const Te=new Ut([m.ONE,m.ONE,m.ONE,_e?m.ZERO:m.ONE],s.ao.transparent,[!1,!1,!1,!0],_e?m.FUNC_ADD:m.MAX);Uo(se,l,t,o,c,Ee,kt.disabled,Te,zt.disabled,_e,"clear",F,z,B,j,H,$e,E,xe,Ae)}else{m.drawBuffers([m.NONE,m.COLOR_ATTACHMENT1]);const Te=new kt({func:m.EQUAL,mask:255},254,255,m.KEEP,m.DECR,m.DECR),he=new Ut([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!0,!1,!1,!1],m.MAX);Uo(se,l,t,o,c,Ee,Te,he,zt.disabled,_e,"emissive",F,z,B,j,H,$e,E,xe,Ae),m.drawBuffers([m.COLOR_ATTACHMENT0])}};if($||le){let _e;l.prepareDrawTile(),T&&!$||(_e=J()),$&&ue(!0,!1,_e),le&&ue(!1,!0,_e)}}else $&&ee(!0),le&&ee(!1),($||le)&&l.resetStencilClippingMasks()}}},building:function(l,t,o,c){l.currentLayer<l.firstLightBeamLayer&&(l.firstLightBeamLayer=l.currentLayer);const d=o.paint.get("building-ambient-occlusion-ground-intensity"),p=o.paint.get("building-ambient-occlusion-ground-radius"),m=o.paint.get("building-ambient-occlusion-ground-attenuation"),y=o.paint.get("building-opacity");if(y<=0)return;let x=d>0&&p>0,T=!0;const E=o.paint.get("building-vertical-scale");if(E<=0)return;l.shadowRenderer||(T=!1);const C=l.conflationActive&&l.style.isLayerClipped(o,t.getSource()),M=l.style.order.indexOf(o.fqid);if((function(P,F,z,B,j,Z){for(const H of Z){const $=F.getTile(H).getBucket(z);$&&(j&&$.updateReplacement(H,P.replacementSource,B),$.uploadUpdatedIndexBuffer(P.context))}})(l,t,o,M,C,c),(function(P,F,z,B){for(const j of B){const Z=F.getTile(j).getBucket(z);Z&&Z.needsEvaluation()&&Z.uploadUpdatedColorBuffer(P.context)}})(l,t,o,c),o.resetLayerRenderingStats(l),l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0),l.renderPass==="shadow"&&l.shadowRenderer){const P=l.shadowRenderer,F=[],z=P.getShadowPassDepthMode();al({painter:l,source:t,layer:o,coords:c,defines:F,blendMode:P.getShadowPassColorMode(),depthMode:z,opacity:y,verticalScale:E,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(l.renderPass==="translucent"){let P=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];T&&(P=P.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),l.shadowRenderer&&l.shadowRenderer.useNormalOffset&&(P=P.concat("NORMAL_OFFSET"));const F=o.paint.get("building-facade-emissive-chance"),z=o.paint.get("building-ambient-occlusion-intensity"),B=o.paint.get("building-flood-light-intensity"),j=o.paint.get("building-flood-light-color-use-theme").
2996constantOr("default")==="none",Z=o.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(j?null:o.lut).toArray01().slice(0,3),H=o.paint.get("building-flood-light-ground-attenuation"),$=B>0,le=new It(l.context.gl.LEQUAL,It.ReadWrite,l.depthRangeFor3D);y<1&&al({painter:l,source:t,layer:o,coords:c,defines:P,blendMode:Ut.disabled,depthMode:le,opacity:y,verticalScale:E,facadeEmissiveChance:F,facadeAOIntensity:z,floodLightIntensity:B,floodLightColor:Z,depthOnly:!0});const ne=l.colorModeForRenderPass();al({painter:l,source:t,layer:o,coords:c,defines:P,blendMode:ne,depthMode:le,opacity:y,verticalScale:E,facadeEmissiveChance:F,facadeAOIntensity:z,floodLightIntensity:B,floodLightColor:Z}),x&&yu(l,t,o,c,!0,y,d,p,B,Z,m,C),$&&yu(l,t,o,c,!1,y,d,p,B,Z,H,C)}else if(l.renderPass==="light-beam"){const P=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],F=new It(l.context.gl.LEQUAL,It.ReadOnly,l.depthRangeFor3D);al({painter:l,source:t,layer:o,coords:c,defines:P,blendMode:Ut.alphaBlended,depthMode:F,opacity:y,verticalScale:E,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1),l.resetStencilClippingMasks()},hillshade:function(l,t,o,c){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent"||l.style.disableElevatedTerrain)return;const d=l.context,p=l.terrain&&l.terrain.renderingToTexture,[m,y]=l.renderPass!=="translucent"||p?[{},c]:l.stencilConfigForOverlap(c);for(const x of y){const T=t.getTile(x);if(T.needsHillshadePrepare&&l.renderPass==="offscreen")b_(l,T,o);else if(l.renderPass==="translucent"){const E=l.depthModeForSublayer(0,It.ReadOnly),C=o.paint.get("hillshade-emissive-strength"),M=l.colorModeForDrapableLayerRenderPass(C),P=p&&l.terrain?l.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];v_(l,x,T,o,E,P,M)}}d.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,o,c,d,p){if(l.renderPass!=="translucent"||o.paint.get("raster-opacity")===0)return;const m=l.transform.projection.name==="globe",y=o.paint.get("raster-elevation")!==0,x=y&&m;if(l.renderElevatedRasterBackface&&!x)return;const T=l.context,E=T.gl,C=t.getSource(),M=(function(ne,se,ee,J,ue){const _e=se.paint.get("raster-color"),xe=ne.type==="raster-array",Ae=[],Ee=se.paint.get("raster-resampling"),Fe=se.paint.get("raster-color-mix");let $e=se.paint.get("raster-color-range");const Te=[Fe[0],Fe[1],Fe[2],0],he=Fe[3];let ze=Ee==="nearest"?J.NEAREST:J.LINEAR;if(xe&&(Ae.push("RASTER_ARRAY"),_e||Ae.push("RASTER_COLOR"),Ee==="linear"&&Ae.push("RASTER_ARRAY_LINEAR"),ze=J.NEAREST,!$e&&ne.rasterLayers)){const Me=ne.rasterLayers.find(({id:We})=>We===se.sourceLayer);Me&&Me.fields&&Me.fields.range&&($e=Me.fields.range)}if($e=$e||[0,1],_e){Ae.push("RASTER_COLOR"),ee.activeTexture.set(J.TEXTURE2),se.updateColorRamp($e);let Me=se.colorRampTexture;Me||(Me=se.colorRampTexture=new s.T(ee,se.colorRamp,J.RGBA8)),Me.bind(ze,J.CLAMP_TO_EDGE)}return ue&&Ae.push("USE_MRT1"),{mix:Te,range:$e,offset:he,defines:Ae,resampling:ze}})(C,o,T,E,l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback");if(C instanceof s.aU&&!c.length&&!m)return;const P=o.paint.get("raster-emissive-strength"),F=l.colorModeForDrapableLayerRenderPass(P),z=l.terrain&&l.terrain.renderingToTexture,B=!l.options.moving,j=o.paint.get("raster-resampling")==="nearest"?E.NEAREST:E.LINEAR;if(C instanceof s.aU&&!c.length&&(C.onNorthPole||C.onSouthPole)){const ne=y?l.stencilModeFor3D():kt.disabled;return void xu(!!C.onNorthPole,null,l,t,o,P,M,zt.disabled,ne)}if(!c.length)return;const[Z,H]=C instanceof s.aU||z?[{},c]:l.stencilConfigForOverlap(c),$=H[H.length-1].overscaledZ;x&&M.defines.push("PROJECTION_GLOBE_VIEW"),y&&M.defines.push("RENDER_CUTOFF");const le=(ne,se,ee)=>{for(const J of ne){const ue=J.toUnwrapped(),_e=t.getTile(J);if(z&&(!_e||!_e.hasData()))continue;T.activeTexture.set(E.TEXTURE0);const xe=mp(_e,C,o,M);if(!xe||!xe.texture)continue;const{texture:Ae,mix:Ee,offset:Fe,tileSize:$e,buffer:Te}=xe;let he,ze;z?(he=It.disabled,ze=J.projMatrix):y?(he=new It(E.LEQUAL,It.ReadWrite,l.depthRangeFor3D),ze=m?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(ue,B)):(he=l.depthModeForSublayer(J.overscaledZ-$,o.paint.get("raster-opacity")===1?It.ReadWrite:It.ReadOnly,E.LESS),ze=l.transform.calculateProjMatrix(ue,B));const Me=l.terrain&&z?l.terrain.stencilModeForRTTOverlap(J):Z[J.overscaledZ],We=p?0:o.paint.get("raster-fade-duration");_e.registerFadeDuration(We);const et=t.findLoadedParent(J,0),ut=tc(_e,et,t,l.transform,We);let tt,nt;!ut.isFading&&_e.refreshedUponExpiration&&(_e.refreshedUponExpiration=!1),l.terrain&&l.terrain.prepareDrawTile(),T.activeTexture.set(E.TEXTURE0),Ae.bind(j,E.CLAMP_TO_EDGE),T.activeTexture.set(E.TEXTURE1),et?(et.texture&&et.texture.bind(j,E.CLAMP_TO_EDGE),tt=M
2996ath.pow(2,et.tileID.overscaledZ-_e.tileID.overscaledZ),nt=[_e.tileID.canonical.x*tt%1,_e.tileID.canonical.y*tt%1]):Ae.bind(j,E.CLAMP_TO_EDGE),"useMipmap"in Ae&&T.extTextureFilterAnisotropic&&l.transform.pitch>20&&E.texParameterf(E.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const Et=l.transform;let wt;const pt=y?pp(Et):[0,0,0,0];let bt,Ct,Ot,Ht,ti,Vt=0;if(x&&C instanceof s.aU&&C.coordinates.length>3)bt=Float32Array.from(s.bk(s.dJ(new s.cD(0,0,0)))),Ct=Float32Array.from(Et.globeMatrix),Ot=Float32Array.from(s.dF(Et)),Ht=[s.aF(Et.center.lng),s.aJ(Et.center.lat)],wt=C.elevatedGlobePerspectiveTransform,ti=C.elevatedGlobeGridMatrix||new Float32Array(9);else if(x){const bi=s.dG(J.canonical);Vt=s.dH(bi.getCenter().lat),bt=Float32Array.from(s.bk(s.dJ(J.canonical))),Ct=Float32Array.from(Et.globeMatrix),Ot=Float32Array.from(s.dF(Et)),Ht=[s.aF(Et.center.lng),s.aJ(Et.center.lat)],wt=[0,0],ti=Float32Array.from(s.dI(J.canonical,bi,Vt,Et.worldSize/Et._pixelsPerMercatorPixel))}else wt=C instanceof s.aU?C.perspectiveTransform:[0,0],bt=new Float32Array(16),Ct=new Float32Array(9),Ot=new Float32Array(16),Ht=[0,0],ti=new Float32Array(9);const ui=Hh(ze,bt,Ct,Ot,ti,nt||[0,0],s.aj(l.transform.zoom),Ht,pt,tt||1,ut,o,wt,y?o.paint.get("raster-elevation"):0,2,Ee,Fe,M.range,$e,Te,P),jt=l.isTileAffectedByFog(J),Ti=l.getOrCreateProgram("raster",{defines:M.defines,overrideFog:jt});if(l.uploadCommonUniforms(T,Ti,ue),C instanceof s.aU){const bi=C.elevatedGlobeVertexBuffer,Si=C.elevatedGlobeIndexBuffer;if(z||!m)C.boundsBuffer&&C.boundsSegments&&Ti.draw(l,E.TRIANGLES,he,kt.disabled,F,zt.disabled,ui,o.id,C.boundsBuffer,l.quadTriangleIndexBuffer,C.boundsSegments);else if(bi&&Si){const ii=Et.zoom<=s.c_?C.elevatedGlobeSegments:C.getSegmentsForLongitude(Et.center.lng);ii&&Ti.draw(l,E.TRIANGLES,he,kt.disabled,F,se,ui,o.id,bi,Si,ii)}}else if(x){he=new It(E.LEQUAL,It.ReadOnly,l.depthRangeFor3D);const bi=l.globeSharedBuffers;if(bi){const[Si,ii,qt]=bi.getGridBuffers(Vt,!1);Ti.draw(l,E.TRIANGLES,he,ee||Me,l.colorModeForRenderPass(),se,ui,o.id,Si,ii,qt)}}else{const{tileBoundsBuffer:bi,tileBoundsIndexBuffer:Si,tileBoundsSegments:ii}=l.getTileBoundsBuffers(_e);Ti.draw(l,E.TRIANGLES,he,Me,F,zt.disabled,ui,o.id,bi,Si,ii)}}if(!(C instanceof s.aU)&&x)for(const J of ne){const ue=J.canonical.y===(1<<J.canonical.z)-1;J.canonical.y===0&&xu(!0,J,l,t,o,P,M,se,ee||kt.disabled),ue&&xu(!1,J,l,t,o,P,M,se===zt.frontCW?zt.backCW:zt.frontCW,ee||kt.disabled)}};x?le(H,l.renderElevatedRasterBackface?zt.backCW:zt.frontCW,l.stencilModeFor3D()):le(H,zt.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,o,c,d,p){l.renderPass==="offscreen"&&(function(m,y,x,T){if(!T.length)return;const E=m.context,C=E.gl,M=y.getSource();if(!(M instanceof fn))return;const P=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let F=x.particlePositionRGBAImage;if(!F||F.width!==P){const H=(function($){const le=$*$,ne=new Uint8Array(4*le),se=function(J){return J|=0,J=Math.imul(2747636419^J,2654435769),J=Math.imul(J^J>>>16,2654435769),((J=Math.imul(J^J>>>16,2654435769))>>>0)/4294967296},ee=.9090909090909091;for(let J=0;J<le;J++){const ue=ee*(se(2*J+0)+nl),_e=ee*(se(2*J+1)+nl),xe=255*ue%1,Ae=255*_e%1,Ee=xe,Fe=_e-Ae/255,$e=Ae;ne[4*J+0]=255*(ue-xe/255),ne[4*J+1]=255*Ee,ne[4*J+2]=255*Fe,ne[4*J+3]=255*$e}return ne})(P);F=x.particlePositionRGBAImage=new s.q({width:P,height:P},H)}let z=x.particleFramebuffer;z?z.width!==P&&(z.destroy(),z=x.particleFramebuffer=E.createFramebuffer(P,P,1,null)):z=x.particleFramebuffer=E.createFramebuffer(P,P,1,null);const B=[];for(const H of T){const $=y.getTile(H);if(!($ instanceof Oc))continue;const le=Qh($,M,x);if(!le)continue;const ne=[$.tileSize,$.tileSize];let se=x.tileFramebuffer;se||(se=x.tileFramebuffer=E.createFramebuffer(ne[0],ne[1],1,null));let ee=$.rasterParticleState;ee||(ee=$.rasterParticleState=new _p(E,H,ne,F));const J=ee.update(x.lastInvalidatedAt);ee.particleTextureDimension!==P&&ee.updateParticleTexture(H,F);const ue=ee.targetColorTexture;ee.targetColorTexture=ee.backgroundColorTexture,ee.backgroundColorTexture=ue;const _e=ee.particleTexture0;ee.particleTexture0=ee.particleTexture1,ee.particleTexture1=_e,B.push([H,le,ee,J])}if(B.length===0)return;const j=s.o.now(),Z=x.previousDrawTimestamp?.001*(j-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=j,x.hasColorMap()){E.activeTexture.set(C.TEXTURE0+2);let H=x.colorRampTexture;H||(H=x.colorRampTexture=new s.T(E,x.colorRamp,C.RGBA8)),H.bind(C.LINEAR,C.CLAMP_TO_EDGE)}E.bindFramebuffer.set(x.tileFramebuffer.framebuffer),(function(H,$,le){const ne=H.context,se=ne.gl,ee=$.tileFramebuffer;ne.activeTexture.set(se.TEXTURE0);const J={u_texture:0,u_opacity:1.05*(_e=$.paint.get("raster-particle-fade-opacity-factor"))/(_e+.05)},ue=H.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var _e;for(const xe of le){const[,,Ae,Ee]=xe;ee.colorAttachment0.set(Ae.targetColorTexture.texture),ne.viewport.set([0,0,ee.width,ee.height]),ne.clear({color:s.ao.transparent}),Ee&&(Ae.backgroundColorTexture.bind(se.NEAREST,se.CLAMP_TO_EDGE),ue.draw(H,se.TRIANGLES,It.disabled,kt.disabled,Ut.alphaBlended,zt.disabled,J,$.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments))}}
vendor: 4,559 bytes, line 2996
2996)(m,x,B),(function(H,$,le,ne){const se=H.context,ee=se.gl,J=le.tileFramebuffer,ue=H.transform.projection.name==="globe",_e=le.paint.get("raster-particle-max-speed");for(const xe of ne){const[Ae,Ee,Fe]=xe;se.activeTexture.set(ee.TEXTURE0+0),Ee.texture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),J.colorAttachment0.set(Fe.targetColorTexture.texture);const $e=H.getOrCreateProgram("rasterParticleDraw",{defines:Ee.defines,overrideFog:!1});se.activeTexture.set(ee.TEXTURE0+1);const Te=Ee.scalarData?[]:[0,1,2,3].map(Me=>s.e9[Me](Ae));Te.push(Ae);const he=Ae.canonical.x,ze=Ae.canonical.y;for(const Me of Te){const We=$.getTile(ue?Me.wrapped():Me);if(!We)continue;const et=We.rasterParticleState;if(!et)continue;const ut=Me.canonical.x+(1<<Me.canonical.z)*(Me.wrap-Ae.wrap),tt=Me.canonical.y;et.particleTexture0.bind(ee.NEAREST,ee.CLAMP_TO_EDGE);const nt=sp(1,et.particleTexture0.size[0],[ut-he,tt-ze],0,Ee.texture.size,2,_e,Ee.textureOffset,Ee.scale,Ee.offset);$e.draw(H,ee.POINTS,It.disabled,kt.disabled,Ut.alphaBlended,zt.disabled,nt,le.id,et.particleIndexBuffer,void 0,et.particleSegment)}}})(m,y,x,B),E.bindFramebuffer.set(x.particleFramebuffer.framebuffer),(function(H,$,le,ne){const se=H.context,ee=se.gl,J=$.paint.get("raster-particle-max-speed"),ue=ne*$.paint.get("raster-particle-speed-factor")*.15,_e=(function(Ae){return Math.pow(Ae,6)})(.01+1*$.paint.get("raster-particle-reset-rate-factor")),xe=$.particleFramebuffer;se.viewport.set([0,0,xe.width,xe.height]);for(const Ae of le){const[,Ee,Fe]=Ae;se.activeTexture.set(ee.TEXTURE0+0),Ee.texture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE),se.activeTexture.set(ee.TEXTURE0+1);const $e=Fe.particleTexture0;$e.bind(ee.NEAREST,ee.CLAMP_TO_EDGE);const Te=P_(1,$e.size[0],0,Ee.texture.size,J,ue,_e,Ee.textureOffset,Ee.scale,Ee.offset);xe.colorAttachment0.set(Fe.particleTexture1.texture),se.clear({color:s.ao.transparent}),H.getOrCreateProgram("rasterParticleUpdate",{defines:Ee.defines}).draw(H,ee.TRIANGLES,It.disabled,kt.disabled,Ut.unblended,zt.disabled,Te,$.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments)}})(m,x,B,Z)})(l,t,o,c),l.renderPass==="translucent"&&((function(m,y,x,T){const E=m.context,C=E.gl,M=y.getSource().tileSize,P=5*(1-s.ah(s.cL,s.cL+1,m.transform.zoom))*M+x.paint.get("raster-particle-elevation"),F=!m.options.moving,z=m.transform.projection.name==="globe";if(!T.length)return;const[B,j]=m.stencilConfigForOverlap(T),Z=[];z&&Z.push("PROJECTION_GLOBE_VIEW");const H=m.stencilModeFor3D();for(const $ of j){const le=$.toUnwrapped(),ne=y.getTile($);if(!ne.rasterParticleState)continue;const se=ne.rasterParticleState,ee=100;ne.registerFadeDuration(ee);const J=y.findLoadedParent($,0),ue=tc(ne,J,y,m.transform,ee);let _e,xe;m.terrain&&m.terrain.prepareDrawTile(),E.activeTexture.set(C.TEXTURE0),se.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),E.activeTexture.set(C.TEXTURE1),J&&J.rasterParticleState?(J.rasterParticleState.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),_e=Math.pow(2,J.tileID.overscaledZ-ne.tileID.overscaledZ),xe=[ne.tileID.canonical.x*_e%1,ne.tileID.canonical.y*_e%1]):se.targetColorTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE);const Ae=z?Float32Array.from(m.transform.expandedFarZProjMatrix):m.transform.calculateProjMatrix(le,F),Ee=m.transform,Fe=gp(Ee),$e=s.dG($.canonical),Te=s.dH($e.getCenter().lat);let he,ze,Me,We,et;z?(he=Float32Array.from(s.bk(s.dJ($.canonical))),ze=Float32Array.from(Ee.globeMatrix),Me=Float32Array.from(s.dF(Ee)),We=[s.aF(Ee.center.lng),s.aJ(Ee.center.lat)],et=Float32Array.from(s.dI($.canonical,$e,Te,Ee.worldSize/Ee._pixelsPerMercatorPixel))):(he=new Float32Array(16),ze=new Float32Array(9),Me=new Float32Array(16),We=[0,0],et=new Float32Array(9));const ut=C_(Ae,he,ze,Me,et,xe||[0,0],s.aj(m.transform.zoom),We,Fe,_e||1,ue,P),tt=m.isTileAffectedByFog($),nt=m.getOrCreateProgram("rasterParticle",{defines:Z,overrideFog:tt});if(m.uploadCommonUniforms(E,nt,le),z){const Et=new It(C.LEQUAL,It.ReadOnly,m.depthRangeFor3D),wt=0,pt=m.globeSharedBuffers;if(pt){const[bt,Ct,Ot]=pt.getGridBuffers(Te,wt!==0);nt.draw(m,C.TRIANGLES,Et,H,Ut.alphaBlended,m.renderElevatedRasterBackface?zt.frontCCW:zt.backCCW,ut,x.id,bt,Ct,Ot)}}else{const Et=m.depthModeForSublayer(0,It.ReadOnly),wt=B[$.overscaledZ],{tileBoundsBuffer:pt,tileBoundsIndexBuffer:bt,tileBoundsSegments:Ct}=m.getTileBoundsBuffers(ne);nt.draw(m,C.TRIANGLES,Et,wt,Ut.alphaBlended,zt.disabled,ut,x.id,pt,bt,Ct)}}m.resetStencilClippingMasks()})(l,t,o,c),l.style.map.triggerRepaint())},background:function(l,t,o,c){const d=o.paint.get("background-color"),p=o.paint.get("background-color-use-theme").
2996constantOr("default")==="none",m=o.paint.get("background-opacity"),y=o.paint.get("background-emissive-strength"),x=o.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const T=l.context,E=T.gl,C=l.transform,M=C.tileSize,P=o.paint.get("background-pattern");let F;if(P!==void 0&&(P===null||(F=l.imageManager.getPattern(s.I.from(P.toString()),o.scope,l.style.getLut(o.scope)),!F)))return;const z=!P&&d.a===1&&m===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==z)return;const B=kt.disabled,j=l.depthModeForSublayer(0,z==="opaque"?It.ReadWrite:It.ReadOnly),Z=l.colorModeForDrapableLayerRenderPass(y),H=P?"backgroundPattern":"background";let $,le=c;le||($=l.getBackgroundTiles(),le=Object.values($).map(se=>se.tileID)),P&&(T.activeTexture.set(E.TEXTURE0),l.imageManager.bind(l.context,o.scope));const ne=[];if(l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&ne.push("USE_MRT1"),x){const se=l.getOrCreateProgram(H,{overrideFog:!1,overrideRtt:!0,defines:ne}),ee=new Float32Array(s.bA([])),J=new s.aQ(0,0,0,0,0),ue=P?nc(ee,y,m,l,0,o.scope,F,x,{tileID:J,tileSize:M}):qs(ee,y,m,d.toPremultipliedRenderColor(p?null:o.lut));return void se.draw(l,E.TRIANGLES,j,B,Z,zt.disabled,ue,o.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}for(const se of le){const ee=l.isTileAffectedByFog(se),J=l.getOrCreateProgram(H,{overrideFog:ee,defines:ne}),ue=se.toUnwrapped(),_e=c?se.projMatrix:l.transform.calculateProjMatrix(ue);l.prepareDrawTile();const xe=t?t.getTile(se):$?$[se.key]:new Ds(se,M,C.zoom,l),Ae=P?nc(_e,y,m,l,0,o.scope,F,x,{tileID:se,tileSize:M}):qs(_e,y,m,d.toPremultipliedRenderColor(p?null:o.lut));l.uploadCommonUniforms(T,J,ue);const{tileBoundsBuffer:Ee,tileBoundsIndexBuffer:Fe,tileBoundsSegments:$e}=l.getTileBoundsBuffers(xe);J.draw(l,E.TRIANGLES,j,B,Z,zt.disabled,Ae,o.id,Ee,Fe,$e)}},sky:function(l,t,o){const c=l._atmosphere?s.aj(l.transform.zoom):1,d=o.paint.get("sky-opacity")*c;if(d===0)return;const p=l.context,m=o.paint.get("sky-type"),y=new It(p.gl.LEQUAL,It.ReadOnly,[0,1]),x=l.frameCounter/1e3%1;m==="atmosphere"?l.renderPass==="offscreen"?o.needsSkyboxCapture(l)&&((function(T,E){const C=T.context,M=C.gl;let P=E.skyboxFbo;if(!P){P=E.skyboxFbo=C.createFramebuffer(32,32,1,null),E.skyboxGeometry=new zn(C),E.skyboxTexture=C.gl.createTexture(),M.bindTexture(M.TEXTURE_CUBE_MAP,E.skyboxTexture),M.texParameteri(M.TEXTURE_CUBE_MAP,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_CUBE_MAP,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_CUBE_MAP,M.TEXTURE_MIN_FILTER,M.LINEAR),M.texParameteri(M.TEXTURE_CUBE_MAP,M.TEXTURE_MAG_FILTER,M.LINEAR);for(let j=0;j<6;++j)M.texImage2D(M.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,M.RGBA,32,32,0,M.RGBA,M.UNSIGNED_BYTE,null)}C.bindFramebuffer.set(P.framebuffer),C.viewport.set([0,0,32,32]);const F=E.getCenter(T,!0),z=T.getOrCreateProgram("skyboxCapture"),B=new Float64Array(16);s.bA(B),s.en(B,B,.5*-Math.PI),Zs(T,E,z,B,F,0),s.bA(B),s.en(B,B,.5*Math.PI),Zs(T,E,z,B,F,1),s.bA(B),s.cU(B,B,.5*-Math.PI),Zs(T,E,z,B,F,2),s.bA(B),s.cU(B,B,.5*Math.PI),Zs(T,E,z,B,F,3),s.bA(B),Zs(T,E,z,B,F,4),s.bA(B),s.en(B,B,Math.PI),Zs(T,E,z,B,F,5),C.viewport.set([0,0,T.width,T.height])})(l,o),o.markSkyboxValid(l)):l.renderPass==="sky"&&(function(T,E,C,M,P){const F=T.context,z
vendor: 4,903 bytes, line 2996
2996=F.gl,B=T.transform,j=T.getOrCreateProgram("skybox");F.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_CUBE_MAP,E.skyboxTexture);const Z=((H,$,le,ne,se)=>({u_matrix:H,u_sun_direction:$,u_cubemap:0,u_opacity:ne,u_temporal_offset:se}))(B.skyboxMatrix,E.getCenter(T,!1),0,M,P);T.uploadCommonUniforms(F,j),j.draw(T,z.TRIANGLES,C,kt.disabled,T.colorModeForRenderPass(),zt.backCW,Z,"skybox",E.skyboxGeometry.vertexBuffer,E.skyboxGeometry.indexBuffer,E.skyboxGeometry.segment)})(l,o,y,d,x):m==="gradient"&&l.renderPass==="sky"&&(function(T,E,C,M,P){const F=T.context,z=F.gl,B=T.transform,j=T.getOrCreateProgram("skyboxGradient");E.skyboxGeometry||(E.skyboxGeometry=new zn(F)),F.activeTexture.set(z.TEXTURE0);let Z=E.colorRampTexture;Z||(Z=E.colorRampTexture=new s.T(F,E.colorRamp,z.RGBA8)),Z.bind(z.LINEAR,z.CLAMP_TO_EDGE);const H=(($,le,ne,se,ee)=>({u_matrix:$,u_color_ramp:0,u_center_direction:le,u_radius:s.an(ne),u_opacity:se,u_temporal_offset:ee}))(B.skyboxMatrix,E.getCenter(T,!1),E.paint.get("sky-gradient-radius"),M,P);T.uploadCommonUniforms(F,j),j.draw(T,z.TRIANGLES,C,kt.disabled,T.colorModeForRenderPass(),zt.backCW,H,"skyboxGradient",E.skyboxGeometry.vertexBuffer,E.skyboxGeometry.indexBuffer,E.skyboxGeometry.segment)})(l,o,y,d,x)},custom:function(l,t,o,c){const d=l.context,p=o.implementation;if(!l.transform.projection.unsupportedLayers||!l.transform.projection.unsupportedLayers.includes("custom")||l.terrain&&(l.terrain.renderingToTexture||l.renderPass==="offscreen")&&o.isDraped(t)){if(l.renderPass==="offscreen"){const m=p.prerender;if(m){if(l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;m.call(p,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.aj(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else m.call(p,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const y=p.renderToTile;if(y){const x=c[0].canonical,T={x:x.x+c[0].wrap*(p.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(It.disabled),d.setStencilMode(kt.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),y.call(p,d.gl,T),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode(kt.disabled);const m=p.renderingMode==="3d"?new It(l.context.gl.LEQUAL,It.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,It.ReadOnly);if(d.setDepthMode(m),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;p.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.aj(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else p.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else s.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,o,c){if(l.renderPass==="opaque")return;const d=o.paint.get("model-opacity").constantOr(1),p=o.paint.get("model-elevation-reference"),m=p==="ground",y=p==="ground";if(d===0)return;const x=o.paint.get("model-cast-shadows");if(l.renderPass==="shadow"&&(!x||l.terrain&&d<.65&&o._transitionablePaint._values["model-opacity"].value.expression instanceof s.ad))return;const T=l.shadowRenderer,E=o.paint.get("model-receive-shadows");T&&(T.useNormalOffset=!0,E||(T.enabled=!1));const C=()=>{T&&(T.useNormalOffset=!0,E||(T.enabled=!0))},M=t.getSource();if(l.renderPass==="light-beam"&&M.type!=="batched-model")return;if(M.type==="vector"||M.type==="geojson")return(function($,le,ne,se,ee){const J=$.transform,ue=J.projection.name==="globe",_e=J.getFreeCameraOptions().position;if(!$.modelManager)return;const xe=$.modelManager;ne.modelManager=xe;const Ae=$.shadowRenderer;if(!ne._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Ee=ne._unevaluatedLayout._values["model-id"],Fe=Object.assign({},ne.layout.get("model-id").parameters),$e=$.style.order.indexOf(ne.fqid),Te=ne.paint.get("model-opacity").constantOr(1);for(const he of se){const ze=le.getTile(he).getBucket(ne);if(!ze||ze.projection.name!==J.projection.name)continue;const Me=ze.getModelUris();if(Me&&!ze.modelsRequested&&(xe.addModelsFromBucket(Me,ee),ze.modelsRequested=!0),ue)Fe.zoom=he.overscaledZ;else{const pt=it(he,J);Fe.zoom=pt}const We=Ee.possiblyEvaluate(Fe);if(Ta($,ze,he),gn.shadowUniformsInitialized=!1,gn.useSingleShadowCascade=!!Ae&&Ae.getMaxCascadeForTile(he.toUnwrapped())===0,$.renderPass==="shadow"&&Ae){if($.currentShadowCascade===1&&ze.isInsideFirstShadowMapFrustum)continue;const pt=J.calculatePosMatrix(he.toUnwrapped(),J.worldSize);if(gn.tileMatrix.set(pt),gn.shadowTileMatrix=Float32Array.from(Ae.calculateShadowPassMatrixFromMatr
2996ix(pt)),gn.aabb.min=[0,0,0],gn.aabb.max[0]=gn.aabb.max[1]=s.al,gn.aabb.max[2]=0,ir(ze,gn,$,ne.scope))continue}const et=1<<he.canonical.z,ut=[((_e.x-he.wrap)*et-he.canonical.x)*s.al,(_e.y*et-he.canonical.y)*s.al,_e.z*et*s.al];$.conflationActive&&Object.keys(ze.instancesPerModel).length>0&&$.style.isLayerClipped(ne,le.getSource())&&ze.updateReplacement(he,$.replacementSource,$e,ne.scope)&&(ze.uploaded=!1,ze.upload($.context));let tt=0;const nt=new Array,Et=new Array,wt=new Array;for(let pt in ze.instancesPerModel){const bt=ze.instancesPerModel[pt];bt.features.length>0&&!ue&&(pt=We.evaluate(bt.features[0].feature,{}));const Ct=xe.getModel(pt,ee);if(Ct||xe.hasURLBeenRequested(pt)||ze.modelUris.includes(pt)||(ze.modelUris.push(pt),ze.modelsRequested=!1),Ct&&Ct.uploaded)if(ue){const Ot=s.c5([],[_e.x,_e.y,_e.z],$.transform.worldSize);s.ew(Ot,Ot);for(let Ht=0;Ht<bt.instancedDataArray.length;++Ht){const ti=[0,0,0],Vt=[1,1,1],ui=s.ex(),jt=bt.tileCoordinatesForInstance(Ht),Ti=bt.transformForInstance(Ht);s.ey(Vt,Ti),s.ez(ui,Ti),s.eA(ti,ui);const bi=bt.translationForInstance(Ht),Si=new s.aT(0,0);s.eB(ze.canonical,Si,jt.x,jt.y);const ii=s.bC();s.eC(ii,Ct,$.transform,Si,ti,Vt,bi,!0,!1,!1);const qt=bt.colorForInstance(Ht),mi=s.bA([]),Zi=s.ef(Si.lat,$.transform.zoom),Wi=s.bq([],[1,1,1/Zi]);s.br(mi,mi,Ot),wt.push({zScaleMatrix:Wi,negCameraPosMatrix:mi});for(const _i of Ct.nodes)lc($,_i,ii,$.transform.expandedFarZProjMatrix,tt,nt,Et,Ct.materialOverrides,Te,qt);++tt}}else for(const Ot of Ct.nodes)ht($,ne,Ot,bt,ut,he,gn)}if(ue)if($.renderPass==="shadow"){for(const pt of Et)ll(pt.mesh,pt.nodeModelMatrix,$,ne);for(const pt of nt)ll(pt.mesh,pt.nodeModelMatrix,$,ne)}else ld($,ne,nt,Et,wt)}})(l,t,o,c,ac(l,o)),void C();if(!M.loaded())return;if(M.type==="batched-model")return(function($,le,ne,se){ne.resetLayerRenderingStats($);const ee=$.context,J=$.transform,ue=$.style.fog,_e=$.shadowRenderer;if(J.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${J.projection.name} projection is not yet implemented`);const xe=$.transform.getFreeCameraOptions().position,Ae=s.c5([],[xe.x,xe.y,xe.z],$.transform.worldSize),Ee=s.ew([],Ae),Fe=s.bA([]),$e=s.ef(J.center.lat,J.zoom),Te=s.bq([],[1,1,1/$e]);s.br(Fe,Fe,Ee);const he=ne.paint.get("model-opacity").constantOr(1),ze=new It(ee.gl.LEQUAL,It.ReadWrite,$.depthRangeFor3D),Me=new It(ee.gl.LEQUAL,It.ReadOnly,$.depthRangeFor3D),We=new s.d9([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),et=$.renderPass==="shadow",ut=et&&_e?_e.getCurrentCascadeFrustum():J.getFrustum(J.scaleZoom(J.worldSize)),tt=ne.paint.get("model-front-cutoff"),nt=tt[2]<1,Et=vo($,ne.paint.get("model-cutoff-fade-range")),wt=ne.getLayerRenderingStats();(function(pt,bt,Ct,Ot){const Ht=pt.terrain?pt.terrain.exaggeration():0,ti=pt.transform.zoom;for(const Vt of Ot){const ui=bt.getTile(Vt).getBucket(Ct);ui&&(ui.setFilter(Ct.filter),pt.conflationActive&&ui.updateReplacement(Vt,pt.replacementSource),ui.evaluateTransform(pt,Ct),pt.terrain&&Ht>0&&ui.elevationUpdate(pt.terrain,Ht,Vt,Ct.source),ui.needsReEvaluation(pt,ti,Ct)&&ui.evaluate(Ct))}})($,le,ne,se),(function(){let pt,bt,Ct;nt?(pt=se.length-1,bt=-1,Ct=-1):(pt=0,bt=se.length,Ct=1);const Ot=new Float64Array(16),Ht=s.cA(),ti=new s.P(0,0);for(let Vt=pt;Vt!==bt;Vt+=Ct){const ui=se[Vt],jt=le.getTile(ui).getBucket(ne);if(!jt||!jt.uploaded)continue;let Ti=!1;_e&&(Ti=_e.getMaxCascadeForTile(ui.toUnwrapped())===0);const bi=J.calculatePosMatrix(ui.toUnwrapped(),J.worldSize),Si=jt.modelTraits;!et&&nt&&(s.bl(Ot,bi),s.af(Ht,Ae,Ot),ti.x=Ht[0],ti.y=Ht[1]);const ii=[];jt.setFilter(ne.filter);for(const qt of jt.getNodesInfo()){if(qt.hiddenByReplacement||!qt.node.meshes)continue;const mi=qt.node;let Zi=0;$.terrain&&mi.elevation&&(Zi=mi.elevation*$.terrain.exaggeration());const Wi=(()=>{const gi=qt.aabb;return We.min=[...gi.min],We.max=[...gi.max],We.min[2]+=Zi,We.max[2]+=Zi,s.af(We.min,We.min,bi),s.af(We.max,We.max,bi),We})(),_i=qt.evaluatedScale;if(_i[0]<=1&&_i[1]<=1&&_i[2]<=1&&Wi.intersects(ut)===0)continue;if(!et&&nt){const gi=.16666666666666666;qt.cameraCollisionOpacity=Ae[0]>Wi.min[0]&&Ae[0]<Wi.max[0]&&Ae[1]>Wi.min[1]&&Ae[1]<Wi.max[1]&&Ae[2]*$e<Wi.max[2]&&mi.footprint&&s.c0(ti,mi.footprint)?Math.max(qt.cameraCollisionOpacity-gi,0):Math.min(1,qt.cameraCollisionOpacity+gi)}
2996const Qt=[...bi],$t=1/s.d7(ui.canonical),Di=mi.anchor?mi.anchor[0]:0,rr=mi.anchor?mi.anchor[1]:0;s.br(Qt,Qt,[Di*(_i[0]-1)+qt.evaluatedTranslation[0]*$t,rr*(_i[1]-1)+qt.evaluatedTranslation[1]*$t,Zi+qt.evaluatedTranslation[2]]),s.cq(_i,s.eE)||s.cS(Qt,Qt,_i);const Fi=s.aB([],Qt,mi.globalMatrix),Ni=s.aB([],J.expandedFarZProjMatrix,Fi),xn=s.aB([],J.expandedFarZProjMatrix,Qt),On=s.aC([],[Di,rr,Zi,1],Ni)[2];mi.hidden=!1;let Fr=he;et||(nt&&(Fr*=qt.cameraCollisionOpacity,Fr*=Ep(Qt,J,qt.aabb,tt)),Fr*=be(Et,On)),Fr!==0?ii.push({nodeInfo:qt,depth:On,opacity:Fr,wvpForNode:Ni,wvpForTile:xn,nodeModelMatrix:Fi,tileModelMatrix:Qt}):mi.hidden=!0}et||ii.sort((qt,mi)=>!nt||qt.opacity===1&&mi.opacity===1?qt.depth<mi.depth?-1:1:qt.opacity===1?-1:mi.opacity===1?1:qt.depth>mi.depth?-1:1);for(const qt of ii){const mi=qt.nodeInfo,Zi=mi.node;let Wi=s.aB([],Te,qt.tileModelMatrix);s.aB(Wi,Fe,Wi);const _i=s.bl([],Wi);s.eg(_i,_i),s.cS(_i,_i,cl),Wi=s.aB(Wi,Wi,Zi.globalMatrix);const Qt=$.renderPass==="light-beam",$t=ne.paint.get("model-color-use-theme").constantOr("default")==="none",Di=Si&s.eI.HasMapboxMeshFeatures,rr=Di?0:mi.evaluatedRMEA[0][2];for(let Fi=0;Fi<Zi.meshes.length;++Fi){const Ni=Zi.meshes[Fi],xn=Fi===Zi.lightMeshIndex;let On=qt.wvpForNode;if(xn){if(!Qt&&!$.terrain&&$.shadowRenderer){$.currentLayer<$.firstLightBeamLayer&&($.firstLightBeamLayer=$.currentLayer);continue}On=qt.wvpForTile}else if(Qt)continue;const Fr={defines:[]},gi=[];if(!et&&_e&&(_e.useNormalOffset=!!Ni.normalBuffer),Co(Fr.defines,gi,Ni,$,$t?null:ne.lut),Di||Fr.defines.push("DIFFUSE_SHADED"),Ti&&Fr.defines.push("SHADOWS_SINGLE_CASCADE"),wt&&(et?wt.numRenderedVerticesInShadowPass+=Ni.vertexArray.length:wt.numRenderedVerticesInTransparentPass+=Ni.vertexArray.length),et){ll(Ni,qt.nodeModelMatrix,$,ne);continue}let Un=null;if(ue){const fr=ad(qt.nodeModelMatrix,$.transform);if(Un=new Float32Array(fr),J.projection.name!=="globe"){const ki=Ni.aabb.min,yr=Ni.aabb.max,[Qr,cr]=ue.getOpacityForBounds(fr,ki[0],ki[1],yr[0],yr[1]);Fr.overrideFog=Qr>=xt||cr>=xt}}const Yr=Ni.material;let vn;Yr.occlusionTexture&&Yr.occlusionTexture.offsetScale&&(vn=Yr.occlusionTexture.offsetScale,Fr.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const To=$.getOrCreateProgram("model",Fr);!et&&_e&&_e.setupShadowsFromMatrix(qt.tileModelMatrix,To,_e.useNormalOffset),$.uploadCommonUniforms(ee,To,null,Un);const bn=Yr.pbrMetallicRoughness;bn.metallicFactor=.9,bn.roughnessFactor=.5;const Ki=fu(new Float32Array(On),new Float32Array(Wi),new Float32Array(_i),new Float32Array(Zi.globalMatrix),$,qt.opacity,bn.baseColorFactor,Yr.emissiveFactor,bn.metallicFactor,bn.roughnessFactor,Yr,rr,ne,[0,0,0],vn);!xn&&(mi.hasTranslucentParts||qt.opacity<1)&&To.draw($,ee.gl.TRIANGLES,ze,kt.disabled,Ut.disabled,zt.backCCW,Ki,ne.id,Ni.vertexBuffer,Ni.indexBuffer,Ni.segments,ne.paint,$.transform.zoom,void 0,gi),To.draw($,ee.gl.TRIANGLES,xn?Me:ze,kt.disabled,xn||qt.opacity<1||mi.hasTranslucentParts?Ut.alphaBlended:Ut.unblended,zt.backCCW,Ki,ne.id,Ni.vertexBuffer,Ni.indexBuffer,Ni.segments,ne.paint,$.transform.zoom,void 0,gi)}}}})()})(l,t,o,c),void C();if(M.type!=="model")return;const P=M.getModels(),F=[],z=l.transform.getFreeCameraOptions().position,B=s.c5([],[z.x,z.y,z.z],l.transform.worldSize);s.ew(B,B);const j=[],Z=[];let H=0;for(const $ of P){const le=t.getFeatureState("",$.id),ne={type:"Unknown",id:$.id,properties:$.featureProperties},se=o.paint.get("model-rotation").evaluate(ne,le),ee=o.paint.get("model-scale").evaluate(ne,le),J=o.paint.get("model-translation").evaluate(ne,le),ue=o.paint.get("model-opacity").evaluate(ne,le);wp(o,$.id,le,$.featureProperties,$.nodeOverrideNames,$.nodeOverrides),Tp(o,$.id,le,$.featureProperties,$.materialOverrideNames,$.materialOverrides),$.nodeOverrides.size>0&&$.computeBoundsAndApplyParent(),$.computeModelMatrix(l,se,ee,J,y,m,!1);const _e=s.bA([]),xe=s.ef($.position.lat,l.transform.zoom),Ae=s.bq([],[1,1,1/xe]);s.br(_e,_e,B),F.push({zScaleMatrix:Ae,negCameraPosMatrix:_e});for(const Ee of $.nodes)lc(l,Ee,$.matrix,l.transform.expandedFarZProjMatrix,H,j,Z,$.materialOverrides,ue);H++}if(j.sort(($,le)=>le.depth-$.depth),l.renderPass!=="shadow")ld(l,o,j,Z,F),C();else{for(const $ of Z)ll($.mesh,$.nodeModelMatrix,l,o);for(const $ of j)ll($.mesh,$.nodeModelMatrix,l,o);C()}}},pd={line:function(l,t,o){if(l.hasElevatedBuckets=!1,l.hasNonElevatedBuckets=!1,l._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||l._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const c=t.getVisibleCoordinates();for(const d of c){const p=t.getTile(d).getBucket(l);if(p&&(p.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,t,o){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(o.modelManager&&o.modelManager.upload(o,ac(o,l)));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const p of d)p.upload(o.context)},raster:function(l,t,o){const c=t.getSource();if(!(c instanceof fn&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(l.id,p)&&c.prepareTile(y,d,l.id,p)},"raster-particle":function(l,t,o){const c=t.getSource();if(!(c instanceof fn&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(l.id,p)&&c.prepareTile(y,d,l.id,p)}},md={fill:Xh},Ap={fill:function(l,t,o,c){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const d=l.context.gl,p=new It(d.LEQUAL,It.ReadOnly,l.depthRangeFor3D),m=new kt({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),y=l.transform.getFreeCameraOptions().position,x=l.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const T of c){const E=t.getTile(T),C=E.getBucket(o);if(!C)continue;const M=C.elevatedStructures;if(!M||M.depthSegments.segments[0].primitiveLength===0)continue;const P=Wh(T.toUnwrapped(),y),F=l.translatePosMatrix(T.projMatrix,E,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor")),z=va(F,P,0,1,0);x.draw(l,d.TRIANGLES,p,m,Ut.disabled,zt.disabled,z,o.id,M.vertexBuffer,M.indexBuffer,M.depthSegments,o.paint,l.transform.zoom)}}};class Mp{constructor(t,o,c,d,p){this.context=new mu(t,o),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=s.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const m=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const x of m)this._debugParams.enabledLayers[x]=!0;for(const x of m);this.occlusionParams=new ud,this.setup(),this.numSublayers=Mn.maxUnderzooming+Mn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Hl(this),this._wireframeDebugCache=new cd,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const y=new s.q({width:1,height:1},Uint8Array.of(0,0,0,0));
2996this.emptyDepthTexture=new s.T(this.context,y,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.worldview=p,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(t,o){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Nh(this,t));const d=this._terrain;this.transform.elevation=c?d:null,d.update(t,this.transform,o),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const o=t.fog;if(!o||this.transform.projection.name==="globe"||o.getOpacity(this.transform.pitch)<1||o.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,d]=o.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const p=c+.78*(d-c);this.transform.fogCullDistSq=p*p}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new Nh(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,o){if(this.width=t*s.o.devicePixelRatio,this.height=o*s.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,o=new s.bd;o.emplaceBack(0,0),o.emplaceBack(s.al,0),o.emplaceBack(0,s.al),o.emplaceBack(s.al,s.al),this.tileExtentBuffer=t.createVertexBuffer(o,s.bf.members),this.tileExtentSegments=s.bg.simpleSegment(0,0,4,2);const c=new s.bd;c.emplaceBack(0,0),c.emplaceBack(s.al,0),c.emplaceBack(0,s.al),c.emplaceBack(s.al,s.al),this.debugBuffer=t.createVertexBuffer(c,s.bf.members),this.debugSegments=s.bg.simpleSegment(0,0,4,5);const d=new s.bd;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,s.bf.members),this.viewportSegments=s.bg.simpleSegment(0,0,4,2);const p=new s.b1;p.emplaceBack(0,0,0,0),p.emplaceBack(s.al,0,s.al,0),p.emplaceBack(0,s.al,0,s.al),p.emplaceBack(s.al,s.al,s.al,s.al),this.mercatorBoundsBuffer=t.createVertexBuffer(p,s.bi.members),this.mercatorBoundsSegments=s.bg.simpleSegment(0,0,4,2);const m=new s.b0;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const y=new s.be;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new s.T(t,new s.q({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=s.bC();const x=this.context.gl;this.stencilClearMode=new kt({func:x.ALWAYS,mask:0},0,255,x.ZERO,x.ZERO,x.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,It.disabled,this.stencilClearMode,Ut.disabled,zt.disabled,ec(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,o,c){if(!o||this.currentStencilSource===o.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const x of c)if(this._tileClippingMaskIDs[x.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=o.id;const d=this.context,p=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(Ut.disabled),d.setDepthMode(It.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of c){const x=o.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:E,tileBoundsIndexBuffer:C,tileBoundsSegments:M}=this.getTileBoundsBuffers(x);m.draw(this,p.TRIANGLES,It.disabled,new kt({func:p.ALWAYS,mask:0},T,255,p.KEEP,p.KEEP,p.REPLACE),Ut.disabled,zt.disabled,ec(y.projMatrix),"$clipping",E,C,M)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,o=this.context.gl;return new kt({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const o=this.context.gl;return new kt({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(t){const o=this.context.gl,c=t.sort((m,y)=>
2996y.overscaledZ-m.overscaledZ),d=c[c.length-1].overscaledZ,p=c[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y<p;y++)m[y+d]=new kt({func:o.GEQUAL,mask:255},y+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=p,[m,c]}return[{[d]:kt.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ut([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new s.ao(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ut.unblended:Ut.alphaBlended}colorModeForDrapableLayerRenderPass(t){const o=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?t!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new Ut([o.ONE,o.ONE_MINUS_SRC_ALPHA,o.CONSTANT_ALPHA,o.ONE_MINUS_SRC_ALPHA],new s.ao(0,0,0,t??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new Ut([o.ONE,o.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,o.ONE_MINUS_SRC_ALPHA],s.ao.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(t,o,c,d=!1){if(this.depthOcclusion)return new It(this.context.gl.GREATER,It.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return It.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new It(c||this.context.gl.LEQUAL,o,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,o=Math.ceil(this.width),c=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),p=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===o&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),o!==0&&c!==0&&(this.depthFBO=new wa(this.context,o,c,0,"texture"),this.depthTexture=new s.T(this.context,{width:o,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,p),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,o,c,0,0,o,c,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((t,o)=>t+o/this._fpsHistory.length,0))}render(t,o){const c=s.o.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=o;const d=this.style._mergedLayers,p=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(p).filter(Te=>{const he=d[Te];return!(he.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[he.type]});let y=m(),x=!1,T=!1,E=null,C=0,M=!1;for(const Te of y){const he=d[Te];he.visibility!=="none"&&(he.type==="circle"?x=!0:he.type==="building"?(E=he,++C):he.type==="symbol"&&(he.hasOcclusionOpacityProperties?T=!0:x=!0))}this.updateEmissiveMode();let P=y.map(Te=>d[Te]);const F=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(s.o.now()),this.imageManager.beginFrame();for(const Te in F){const he=F[Te];he.used&&(he.prepare(this.context),he.getSource().usedInConflation&&++C)}let z=!1;for(const Te of P)Te.isHidden(this.transform.zoom)||(Te.type==="clip"&&(z=!0),this.prepareLayer(Te));const B={},j={},Z={},H={},$={};for(const Te in F){const he=F[Te];B[Te]=he.getVisibleCoordinates(),j[Te]=B[Te].slice().reverse(),Z[Te]=he.getVisibleCoordinates(!0).reverse(),H[Te]=he.getShadowCasterCoordinates(),$[Te]=he.sortCoordinatesByDistance(B[Te])}const le=Te=>{const he=this.style.getLayerSourceCache(Te);return he&&he.used?he.getSource():null};if(C||z||this._clippingActiveLastFrame){const Te=[],he=[];let ze=0;for(const Me of P)this.isSourceForClippingOrConflation(Me,le(Me))&&(Te.push(Me),he.push(ze)),ze++;
vendor: 9,580 bytes, line 2996
2996if(Te&&(z||Te.length>1)||this._clippingActiveLastFrame){z=!1;const Me=[];for(let We=0;We<Te.length;We++){const et=Te[We],ut=he[We],tt=this.style.getLayerSourceCache(et);if(!tt||!tt.used||!tt.getSource().usedInConflation&&et.type!=="clip"&&et.type!=="building")continue;let nt=s.eQ,Et=s.b_.None;const wt=[];let pt=!0;if(et.type==="building")nt=s.eS;else if(et.type==="clip")if(nt=ut,et.isHidden(this.transform.zoom))pt=!1;else{if(!et.layout){pt=!1;continue}for(const bt of et.layout.get("clip-layer-types"))Et|=bt==="model"?s.b_.Model:bt==="symbol"?s.b_.Symbol:s.b_.FillExtrusion;for(const bt of et.layout.get("clip-layer-scope"))wt.push(bt);z=!0}pt&&Me.push({layer:et.fqid,cache:tt,order:nt,clipMask:Et,clipScope:wt})}this.replacementSource.setSources(Me),M=!0}}this._clippingActiveLastFrame=z,M||this.replacementSource.clear(),this.conflationActive=M,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let Te=0;Te<P.length;Te++){const he=P[Te];if(he.visibility==="none")continue;const ze=he.cutoffRange();if(this.longestCutoffRange=Math.max(ze,this.longestCutoffRange),ze>0){const Me=le(he);Me&&(this.minCutoffZoom=Math.max(Me.minzoom,this.minCutoffZoom)),he.minzoom&&(this.minCutoffZoom=Math.max(he.minzoom,this.minCutoffZoom))}he.is3D(p)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Te),this._lastOcclusionLayer=Te)}const ne=this.style&&this.style.fog;ne?(this._fogVisible=ne.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ne.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(Z),this.opaquePassCutoff=0,y=m(),P=y.map(Te=>d[Te]));const se=this._shadowRenderer;if(se){se.updateShadowParameters(this.transform,this.style.directionalLight);for(const Te in F)for(const he of B[Te]){let ze={min:0,max:0};this.terrain&&(ze=this.terrain.getMinMaxForTile(he)||ze),se.addShadowReceiver(he.toUnwrapped(),ze.min,ze.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new od(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ee=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),J=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ee&&!this._snow&&(this._snow=new uc(this)),!ee&&this._snow&&(this._snow.destroy(),delete this._snow),J&&!this._rain&&(this._rain=new Ip(this)),!J&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),E){this.buildingTileBorderManager||(this.buildingTileBorderManager=new sd);const Te=this.style.getLayerSourceCache(E);this.buildingTileBorderManager.updateBorders(Te,E)}if(!la.has(this.context.gl))return;this.renderPass="offscreen";for(const Te of P){const he=t.getLayerSourceCache(Te);if(!Te.hasOffscreenPass()||Te.isHidden(this.transform.zoom))continue;const ze=he?j[he.id]:void 0;(Te.type==="custom"||Te.type==="raster"||Te.type==="raster-particle"||Te.isSky()||ze&&ze.length)&&this.renderLayer(this,he,Te,ze)}this.depthRangeFor3D=[0,1-(P.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,H)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const ue=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),_e=(()=>{if(o.showOverdrawInspector)return s.ao.black;const Te=this.style.fog;if(Te&&this.transform.projection.supportsFog){const he=this.style.getLut(Te.scope);if(!ue){const ze=Te.properties.get("color-use-theme")==="none",Me=Te.properties.get("color").toNonPremultipliedRenderColor(ze?null:he).toArray01();return new s.ao(...Me)}if(ue){const ze=Te.properties.get("space-color-use-theme")==="none",Me=Te.properties.get("space-color").toNonPremultipliedRenderColor(ze?null:he).toArray01();return new s.ao(...Me)}}return s.ao.transparent})();if(this.context.clear({color:_e,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ue&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=y.length-1;this.currentLayer>=0;this.currentLayer--){const Te=P[this.currentLayer],he=t.getLayerSourceCache(Te);if(Te.isSky())continue;const ze=he?(Te.is3D(p)?$:j)[he.id]:void 0;this._renderTileClippingMasks(Te,he,ze),this.renderLayer(this,he,Te,ze)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ue&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const Te=P[this.currentLayer],he=t.getLayerSourceCache(Te);Te.isSky()&&this.renderLayer(this,he,Te,he?j[he.id]:void 0)}function xe(Te,he){let ze;return he&&(ze=(Te.type==="symbol"?Z:Te.is3D(p)?$:j)[he.id]),ze}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<y.length;){const Te=P[this.currentLayer];if(Te.type==="raster"||Te.type==="raster-particle"){const he=t.getLayerSourceCache(Te);this.renderLayer(this,he,Te,xe(Te,he))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const Ae=se?se.getGroundShadowLayerIndex():-1;let Ee=!1,Fe=-1;for(let Te=0;Te<y.length;++Te){const he=P[Te];he.isHidden(this.transform.zoom)||he.is3D(p)&&(Fe=Te)}T&&Fe===-1&&(x=!0);let $e=!1;for(;this.currentLayer<y.length;){const Te=P[this.currentLayer],he=t.getLayerSourceCache(Te);if(Te.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(Te)){if(Te.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!$e&&Te.is3D(p)&&!p){const ze=this.currentLayer,Me=We=>{for(this.currentLayer=0;this.currentLayer<P.length;this.currentLayer++){const et=P[this.currentLayer];if(md[et.type]){const ut=this.style.getLayerSourceCache(et);md[et.type](this,ut,et,xe(et,ut),We)}}};Me("initialize"),Me("reset"),this.currentLayer=ze,$e=!0}if(x&&!Ee&&this.terrain&&!this.transform.isOrthographic&&(Ee=!0,this.blitDepth()),T&&Fe!==-1&&this.currentLayer===Fe+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(Te,he,he?B[he.id]:void 0),this.renderLayer(this,he,Te,xe(Te,he)),!this.terrain&&se&&this.currentLayer===Ae){{this.clearStencil(),this.resetStencilClippingMasks();const ze=this.currentLayer;for(this.currentLayer=0;this.currentLayer<P.length;this.currentLayer++){const Me=P[this.currentLayer];if(Ap[Me.type]){const We=this.style.getLayerSourceCache(Me);Ap[Me.type](this,We,Me,xe(Me,We))}}this.currentLayer=ze}if(se.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const ze=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=ze;this.currentLayer++){const Me=P[this.currentLayer];if(!Me.hasLightBeamPass())continue;const We=t.getLayerSourceCache(Me);this.renderLayer(this,We,Me,We?j[We.id]:void 0)}this.currentLayer=ze,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const ze=this.currentLayer;this.depthOcclusion=!0;for(const Me of this.layersWithOcclusionOpacity){this.currentLayer=Me;const We=P[this.currentLayer],et=t.getLayerSourceCache(We),ut=et?j[et.id]:void 0;this.terrain||this._renderTileClippingMasks(We,et,et?B[et.id]:void 0),this.renderLayer(this,et,We,ut)}this.depthOcclusion=!1,this.currentLayer=ze,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let Te=null;P.forEach(he=>{const ze=t.getLayerSourceCache(he);ze&&!he.isHidden(this.transform.zoom)&&ze.getVisibleCoordinates().length&&(!Te||Te.getSource().maxzoom<ze.getSource().maxzoom)&&(Te=ze)}),Te&&this.options.showTileBoundaries&&yp(this,Te,Te.getVisibleCoordinates(),s.ao.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&yp(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.ao(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&(function(Te){const he=Te.transform.padding;xp(Te,Te.transform.height-(he.top||0),3,ed),xp(Te,he.bottom||0,3,td),rd(Te,he.left||0,3,id),rd(Te,Te.transform.width-(he.right||0),3,L_);const ze=Te.transform.centerPoint;(function(Me,We,et,ut){vu(Me,We-1,et-10,2,20,ut),vu(Me,We-10,et-1,20,2,ut)})(Te,ze.x,Te.transform.height-ze.y,D_)})(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
2996anvasCopy()),M||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:o}=this.transform.projection,c=!o||!o.includes(t.type);if(pd[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);pd[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,o,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="sky"||c.type==="custom"||c.type==="model"||c.type==="raster"||c.type==="raster-particle"||d&&d.length)&&(this.id=c.id,this.gpuTimingStart(c),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(c.type)&&(!t.terrain||c.type!=="custom")||c.type==="clip"||Ea[c.type](t,o,c,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery,c=this.context.gl;let d=this.gpuTimers[t.id];d||(d=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:c.createQuery()}),d.calls++,c.beginQuery(o.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,o=this.context.gl,c=o.createQuery();this.deferredRenderGpuTimeQueries.push(c),o.beginQuery(t.TIME_ELAPSED_EXT,c)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const o={};for(const c in t){const d=t[c],p=this.context.extTimerQuery,m=p.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;
2996p.deleteQueryEXT(d.query),o[c]=m}return o}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const o=this.context.gl;let c=0;for(const d of t)c+=o.getQueryParameter(d,o.QUERY_RESULT)/1e6,o.deleteQuery(d);return c}translatePosMatrix(t,o,c,d,p){if(!c[0]&&!c[1])return t;const m=p?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(m){const T=Math.sin(m),E=Math.cos(m);c=[c[0]*E-c[1]*T,c[0]*T+c[1]*E]}const y=[p?c[0]:s.ay(o,c[0],this.transform.zoom),p?c[1]:s.ay(o,c[1],this.transform.zoom),0],x=new Float32Array(16);return s.br(x,t,y),x}saveTileTexture(t){if(t.context!==this.context)return;const o=t.size[0],c=this._tileTextures[o];c?c.push(t):this._tileTextures[o]=[t]}getTileTexture(t){const o=this._tileTextures[t];return o&&o.length>0?o.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,o,c){const d=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,p=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(p.push("LIGHTING_3D_MODE"),p.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||p.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||p.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(p.push("TERRAIN"),this.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&p.push("GLOBE"),!this._fogVisible||d||o!==void 0&&!o||p.push("FOG"),d&&p.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&p.push("OVERDRAW_INSPECTOR"),p}getOrCreateProgram(t,o){this.cache=this.cache||{};const c=o&&o.defines||[],d=o&&o.config,p=this.currentGlobalDefines(t,o&&o.overrideFog,o&&o.overrideRtt).concat(c),m=Jf.cacheKey(Ih[t],t,p,d);return this.cache[m]||(this.cache[m]=new Jf(this.context,t,Ih[t],d,pu[t],p)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.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(t,o){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const p=((m,y,x)=>{const T=m.properties.get("direction"),E=m.properties.get("color-use-theme")==="none",C=m.properties.get("color").toNonPremultipliedRenderColor(E?null:x.getLut(m.scope)).toArray01(),M=m.properties.get("intensity"),P=y.properties.get("color-use-theme")==="none",F=y.properties.get("color").toNonPremultipliedRenderColor(P?null:x.getLut(y.scope)).toArray01(),z=y.properties.get("intensity"),B=[T.x,T.y,T.z],j=s.dN(F,z),Z=s.dN(C,M);return{u_lighting_ambient_color:j,u_lighting_directional_dir:B,u_lighting_directional_color:Z,u_ground_radiance:rl(B,Z,j)}})(c,d,this.style);o.setLightsUniformValues(t,p)}}}uploadCommonUniforms(t,o,c,d,p){if(this.uploadCommonLightUniforms(t,o),this.terrain&&this.terrain.renderingToTexture)return;const m=this.style.fog;if(m){const y=m.getOpacity(this.transform.pitch),x=((T,E,C,M,P,F,z,B,j,Z,H,$)=>{const le=T.transform,ne=E.properties.get("color-use-theme")==="none",se=E.properties.get("color").toNonPremultipliedRenderColor(ne?null:T.style.getLut(E.scope)).toArray01();se[3]=M;const ee=T.frameCounter/1e3%1,[J,ue]=E.properties.get("vertical-range");return{u_fog_matrix:C?le.calculateFogTileMatrix(C):$||T.identityMat,u_fog_range:E.getFovAdjustedRange(le._fov),u_fog_color:se,u_fog_horizon_blend:E.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(J,ue),ue],u_fog_temporal_offset:ee,u_frustum_tl:P,u_frustum_tr:F,u_frustum_br:z,u_frustum_bl:B,u_globe_pos:j,u_globe_radius:Z,u_viewport:H,u_globe_transition:s.aj(le.zoom),u_is_globe:+(le.projection.name==="globe")}})(this,m,c,y,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*s.o.devicePixelRatio,this.transform.height*s.o.devicePixelRatio],d);o.setFogUniformValues(t,x)}p&&o.setCutoffUniformValues(t,p.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,o=t.createTexture();return t.bindTexture(t.TEXTURE_2D,o),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),o}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}
vendor: 66,945 bytes, line 2996
2996getBackgroundTiles(){const t=this._backgroundTiles,o=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const d of c)o[d.key]=t[d.key]||new Ds(d,512,this.transform.tileZoom,this,void 0,this.worldview);return o}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,o){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&t.type!=="building"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building"&&t.sourceLayer!=="procedural_buildings")&&(!o||o.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let o=this._cachedTileFogOpacities[t.key];return o||(this._cachedTileFogOpacities[t.key]=o=this.style.fog.getOpacityForTile(t)),o[0]>=xt||o[1]>=xt}setupDepthForOcclusion(t,o,c){const d=this.context,p=d.gl,m=!!c;var y;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(p.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((y=this.depthRangeFor3D)[1]-y[0]),-1-2*y[0]/(y[1]-y[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE0),m||o.setTerrainUniformValues(d,c)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const t=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=t?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function Cp(l,t){let o=!1,c=null;const d=()=>{c=null,o&&(l(),c=setTimeout(d,t),o=!1)};return()=>(o=!0,c||d(),c)}class yn{constructor(t){this._hashName=t&&encodeURIComponent(t),s.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Cp(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const o=Pp(t);if(this._hashName){const c=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map(m=>{const y=m.split("=")[0];return y===c?(d=!0,`${y}=${o}`):m}).filter(m=>m);return d||p.push(`${c}=${o}`),`#${p.join("&")}`}return`#${o}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let o;return t.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(o=c)}),(o&&o[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const o=this._getCurrentHash();if(o.length>=3&&!o.some(c=>isNaN(Number(c)))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(o[3]||0):t.getBearing();return t.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:c,pitch:+(o[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Pp(l,t){const o=l.getCenter(),c=Math.round(100*l.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,d),m=Math.round(o.lng*p)/p,y=Math.round(o.lat*p)/p,x=l.getBearing(),T=l.getPitch();let E=t?`/${m}/${y}/${c}`:`${c}/${y}/${m}`;return(x||T)&&(E+="/"+Math.round(10*x)/10),T&&(E+=`/${Math.round(T)}`),E}const Xs={linearity:.3,easing:s.eT(0,0,.3,1)},k_=Object.assign({deceleration:2500,maxSpeed:1400},Xs),Bi=Object.assign({deceleration:20,maxSpeed:1400},Xs),ei=Object.assign({deceleration:1e3,maxSpeed:360},Xs),Rp=Object.assign({deceleration:1e3,maxSpeed:90},Xs);class Ys{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.o.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,o=s.o.now();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const o={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)o.zoom+=p.zoomDelta||0,o.bearing+=p.bearingDelta||0,o.pitch+=p.pitchDelta||0,p.panDelta&&o.pan._add(p.panDelta),p.around&&(o.around=p.around),p.pinchAround&&(o.pinchAround=p.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(o.pan.mag()){const p=_s(o.pan.mag(),c,Object.assign({},k_,t||{}));d.offset=o.pan.mult(p.amount/o.pan.mag()),d.center=this._map.transform.center,ms(d,p)}if(o.zoom){const p=_s(o.zoom,c,Bi);d.zoom=this._map.transform.zoom+p.amount,ms(d,p)}if(o.bearing){const p=_s(o.bearing,c,ei);d.bearing=this._map.transform.bearing+s.aA(p.amount,-179,179),ms(d,p)}if(o.pitch){const p=_s(o.pitch,c,Rp);d.pitch=this._map.transform.pitch+p.amount,ms(d,p)}if(d.zoom||d.bearing){const p=o.pinchAround===void 0?o.around:o.pinchAround;d.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function ms(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function _s(l,t,o){const{maxSpeed:c,linearity:d,deceleration:p}=o,m=s.aA(l*d/(t/1e3),-c,c),y=Math.abs(m)/(p*d);return{easing:o.easing,duration:1e3*y,amount:m*(y/2)}}class Gr extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,c,d={}){const p=Mt(o.getCanvasContainer(),c),m=o.unproject(p);super(t,Object.assign({point:p,lngLat:m,originalEvent:c},d)),this._defaultPrevented=!1,this.target=o}}class hl extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,c){const d=t==="touchend"?c.changedTouches:c.touches,p=li(o.getCanvasContainer(),d),m=p.map(x=>o.unproject(x)),y=p.reduce((x,T,E,C)=>x.add(T.div(C.length)),new s.P(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:o.unproject(y),originalEvent:c}),this._defaultPrevented=!1}}class _d extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o){super("wheel",{originalEvent:o}),this._defaultPrevented=!1}}class gd{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new _d(this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new Gr(t.type,this._map,t))}mouseup(t){this._map.fire(new Gr(t.type,this._map,t))}preclick(t){const o=new MouseEvent("preclick",t);this._map.fire(new Gr(o.type,this._map,o))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Gr(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Gr(t.type,this._map,t))}mouseover(t){this._map.fire(new Gr(t.type,this._map,t))}mouseout(t){this._map.fire(new Gr(t.type,this._map,t))}touchstart(t){return this._firePreventable(new hl(t.type,this._map,t))}touchmove(t){this._map.fire(new hl(t.type,this._map,t))}touchend(t){this._map.fire(new hl(t.type,this._map,t))}touchcancel(t){this._map.fire(new hl(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yd{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Gr(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Gr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Gr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class wo{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(Qe(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;const c=o,d=this._startPos,p=this._lastPos;if(!d||!p||p.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=Xe("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const m=Math.min(d.x,c.x),y=Math.max(d.x,c.x),x=Math.min(d.y,c.y),T=Math.max(d.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${m}px,${x}px)`,this._box.style.width=y-m+"px",this._box.style.height=T-x+"px")})}mouseupWindow(t,o){if(!this._active)return;const c=this._startPos,d=o;if(c&&t.button===0){if(this.reset(),Tt(),c.x!==d.x||c.y!==d.y)return this._map.fire(new s.z("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),He(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new s.z(t,{originalEvent:o}))}}function Go(l,t){const o={};for(let c=0;c<l.length;c++)o[l[c].identifier]=t[c];return o}class dl{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,o,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=(function(d){const p=new s.P(0,0);for(const m of d)p._add(m);return p.div(d.length)})(o),this.touches=Go(c,o)))}touchmove(t,o,c){if(this.aborted||!this.centroid)return;const d=Go(c,o);for(const p in this.touches){const m=d[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,o,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class fl{constructor(t){this.singleTap=new dl(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,o,c){this.singleTap.touchstart(t,o,c)}touchmove(t,o,c){this.singleTap.touchmove(t,o,c)}touchend(t,o,c){const d=this.singleTap.touchend(t,o,c);if(d){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(d)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class xd{constructor(){this._zoomIn=new fl({numTouches:1,numTaps:2}),this._zoomOut=new fl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,c){this._zoomIn.touchstart(t,o,c),this._zoomOut.touchstart(t,o,c)}touchmove(t,o,c){this._zoomIn.touchmove(t,o,c),this._zoomOut.touchmove(t,o,c)}touchend(t,o,c){const d=this._zoomIn.touchend(t,o,c),p=this._zoomOut.touchend(t,o,c);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(d)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const vd=0,Ks=2,bd={[vd]:1,[Ks]:2},ro={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class hc{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,o){return!1}_move(t,o){return{}}mousedown(t,o){if(this._lastPoint)return;const c=ri(t);this._correctButton(t,c)&&(this._lastPoint=o,this._eventButton=c)}mousemoveWindow(t,o){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&(function(d,p){const m=bd[p];return d.buttons===void 0||(d.buttons&m)!==m})(t,this._eventButton))this.reset();else if(this._moved||!(o.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(c,o)}}mouseupWindow(t){this._lastPoint&&ri(t)===this._eventButton&&(this._moved&&Tt(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Tu extends hc{mousedown(t,o){super.mousedown(t,o),this._lastPoint&&(this._active=!0)}_correctButton(t,o){return o===0&&!t.ctrlKey}_move(t,o){return{around:o,panDelta:o.sub(t)}}}class Eu extends hc{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?ro[t.pitchRotateKey]:void 0}_correctButton(t,o){return this._pitchRotateKey?o===0&&t[this._pitchRotateKey]:o===0&&t.ctrlKey||o===2}_move(t,o){const c=.8*(o.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Su extends hc{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?ro[t.pitchRotateKey]:void 0}_correctButton(t,o){return this._pitchRotateKey?o===0&&t[this._pitchRotateKey]:o===0&&t.ctrlKey||o===2}_move(t,o){const c=-.5*(o.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Mr{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=o.clickTolerance||1,this.reset(),s.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}touchstart(t,o,c){return this._calculateTransform(t,o,c)}touchmove(t,o,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!s.eU())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,o,c)}}touchend(t,o,c){this._calculateTransform(t,o,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,c){c.length>0&&(this._active=!0);const d=Go(c,o),p=new s.P(0,0),m=new s.P(0,0);let y=0;for(const T in d){const E=d[T],C=this._touches[T];C&&(p._add(E),m._add(E.sub(C)),y++,d[T]=E)}if(this._touches=d,y<this._minTouches||!m.mag())return;const x=m.div(y);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:x}}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=Xe("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 dc{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,o,c){return{}}touchstart(t,o,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([o[0],o[1]]))}touchmove(t,o,c){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[p,m]=d,y=pl(c,o,p),x=pl(c,o,m);if(!y||!x)return;const T=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],T,t)}touchend(t,o,c){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,m=pl(c,o,d),y=pl(c,o,p);m&&y||(this._active&&Tt(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function pl(l,t,o){for(let c=0;c<l.length;c++)if(l[c].identifier===o)return t[c]}function Iu(l,t){return Math.log2(l/t)}class Sa extends dc{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,o){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Iu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Iu(this._distance,c),pinchAround:o}}}function Au(l,t){return 180*l.angleWith(t)/Math.PI}class wd extends dc{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,o){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Au(this._vector,c),pinchAround:o}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const o=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const d=Au(t,c);return Math.abs(d)<o}}function fc(l){return Math.abs(l.y)>Math.abs(l.x)}class Ia extends dc{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,fc(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,c){const d=this._lastPoints;if(!d)return;const p=t[0].sub(d[0]),m=t[1].sub(d[1]);return this._map._cooperativeGestures&&!s.eU()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(p,m,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5})}gestureBeginsVertically(t,o,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,p=o.mag()>=2;if(!d&&!p)return;if(!d||!p)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const m=t.y>0==o.y>0;return fc(t)&&fc(o)&&m}}const Td={panStep:100,bearingStep:15,pitchStep:10};class pc{constructor(){const t=Td;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,c=0,d=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:y=>{const x=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:Ed,zoom:o?Math.round(x)+o*(t.shiftKey?2:1):x,bearing:y.getBearing()+c*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:y.getCenter()},{originalEvent:t})}}}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 Ed(l){return l*(2-l)}const mc=4.000244140625,Sd=1/450;class Mu{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._handler=o,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Sd,s.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||s.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=s.o.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,o!==0&&o%mc===0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=o,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const o=Mt(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:o,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const o=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>mc?this._wheelZoomRate:this._defaultZoomRate;let E=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&E!==0&&(E=1/E);const C=o(),M=Math.pow(2,C),P=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):M;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(P*E))),this._type==="wheel"&&(this._startZoom=C,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:o(),d=this._startZoom,p=this._easing;let m,y=!1;if(this._type==="wheel"&&d&&p){const T=Math.min((s.o.now()-this._lastWheelEventTime)/200,1),E=p(T);m=s.ak(d,c,E),T<1?this._frameId||(this._frameId=!0):y=!0}else m=c,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let x=m-o();return x*this._lastDelta<0&&(x=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:x,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=s.eV;if(this._prevEase){const c=this._prevEase,d=(s.o.now()-c.start)/c.duration,p=c.easing(d+.01)-c.easing(d),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);o=s.eT(m,y,.25,1)}return this._prevEase={start:s.o.now(),duration:t,easing:o},o}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Xe("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 Lp{constructor(t,o){this._clickZoom=t,this._tapZoom=o}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Dp{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,o){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zp{constructor(){this._tap=new fl({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,o,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=o[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,o,c))}touchmove(t,o,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=o[0],p=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,o,c)}touchend(t,o,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,o,c)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Op{constructor(t,o,c){this._el=t,this._mousePan=o,this._touchPan=c}enable(t){this._inertiaOptions=t||{},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 Fp{constructor(t,o,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=o,this._mousePitch=c}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 kp{constructor(t,o,c,d){this._el=t,this._touchZoom=o,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const _c=l=>l.zoom||l.drag||l.pitch||l.rotate;class Bp extends s.z{}class Np{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,o){const c=s.av([],o,t);this.radius=s.ag(c[2]<0?s.eX([],c,this.constants):[c[0],c[1],0])}projectRay(t){s.eX(t,t,this.constants),s.aw(t,t),s.eY(t,t,this.constants);const o=s.c5([],t,this.radius);if(o[2]>0){const c=s.c5([],[0,0,1],s.bJ(o,[0,0,1])),d=s.c5([],s.aw([],[o[0],o[1],0]),this.radius),p=s.d8([],o,s.c5([],s.av([],s.d8([],d,c),o),2));o[0]=p[0],o[1]=p[1]}return o}}function gc(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class Vp{constructor(t,o){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ys(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Np,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(o),s.aY(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,m]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,y,m)}}destroy(){for(const[t,o,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(o,d,c)}}_addDefaultHandlers(t){const o=this._map,c=o.getCanvasContainer();this._add("mapEvent",new gd(o,t));const d=o.boxZoom=new wo(o,t);this._add("boxZoom",d);const p=new xd,m=new Dp;o.doubleClickZoom=new Lp(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new zp;this._add("tapDragZoom",y);const x=o.touchPitch=new Ia(o);this._add("touchPitch",x);const T=new Eu(t),E=new Su(t);o.dragRotate=new Fp(t,T,E),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]);const C=new Tu(t),M=new Mr(o,t);o.dragPan=new Op(c,C,M),this._add("mousePan",C),this._add("touchPan",M,["touchZoom","touchRotate"]);const P=new wd,F=new Sa;o.touchZoomRotate=new kp(c,F,P,y),this._add("touchRotate",P,["touchPan","touchZoom"]),this._add("touchZoom",F,["touchPan","touchRotate"]),this._add("blockableMapEvent",new yd(o));const z=o.scrollZoom=new Mu(o,this);this._add("scrollZoom",z,["mousePan"]);const B=o.keyboard=new pc;this._add("keyboard",B);for(const j of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[j]&&o[j].enable(t[j])}_add(t,o,c){this._handlers.push({handlerName:t,handler:o,allowed:c}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!_c(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,o,c){for(const d in t)if(d!==c&&(!o||o.indexOf(d)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const o=[];for(const c of t)this._el.contains(c.target)&&o.push(c);return o}handleEvent(t,o){this._updatingCamera=!0;const c=t.type==="renderFrame",d=c?void 0:t,p={needsRenderFrame:!1},m={},y={},x=t.touches?this._getMapTouches(t.touches):void 0,T=x?li(this._el,x):c?void 0:Mt(this._el,t);for(const{handlerName:M,handler:P,allowed:F}of this._handlers){if(!P.isEnabled())continue;let z;this._blockedByActive(y,F,M)?P.reset():P[o||t.type]&&(z=P[o||t.type](t,T,x),this.mergeHandlerResult(p,m,z,M,d),z&&z.needsRenderFrame&&this._triggerRenderFrame()),(z||P.isActive())&&(y[M]=P)}const E={};for(const M in this._previousActiveHandlers)y[M]||(E[M]=d);this._previousActiveHandlers=y,(Object.keys(E).length||gc(p))&&(this._changes.push([p,m,E]),this._triggerRenderFrame()),(Object.keys(y).length||gc(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:C}=p;C&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],C(this._map))}mergeHandlerResult(t,o,c,d,p){if(!c)return;Object.assign(t,c);const m={handlerName:d,originalEvent:c.originalEvent||p};c.zoomDelta!==void 0&&(o.zoom=m),c.panDelta!==void 0&&(o.drag=m),c.pitchDelta!==void 0&&(o.pitch=m),c.bearingDelta!==void 0&&(o.rotate=m)}_applyChanges(){const t={},o={},c={};for(const[d,p,m]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new s.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),Object.assign(o,p),Object.assign(c,m);this._updateMapTransform(t,o,c),this._changes=[]}_updateMapTransform(t,o,c){const d=this._map,p=d.transform,m=Z=>[Z.x,Z.y,Z.z];if((()=>{const Z=this._eventsInProgress.drag;return Z&&!this._handlersById[Z.handlerName].isActive()})()&&!gc(t)){const Z=p.zoom;p.cameraElevationReference="sea",this._originalZoom!=null&&p._orthographicProjectionAtLowPitch&&p.projection.name!=="globe"&&p.pitch===0?(p.cameraElevationReference="ground",p.zoom=this._originalZoom):(p.recenterOnTerrain(),p.cameraElevationReference="ground"),Z!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!gc(t))return void this._fireEvents(o,c,!0);let{panDelta:y,zoomDelta:x,bearingDelta:T,pitchDelta:E,around:C,aroundCoord:M,pinchAround:P}=t;p._isCameraConstrained&&(x>0&&(x=0),p._isCameraConstrained=!1),P!==void 0&&(C=P),(x||(Z=>o[Z]&&!this._eventsInProgress[Z])("drag"))&&C&&(this._dragOrigin=m(p.pointCoordinate3D(C)),this._originalZoom=p.zoom,this._trackingEllipsoid.setup(p._camera.position,this._dragOrigin)),p.cameraElevationReference="sea",d._stop(!0),C=C||d.transform.centerPoint,T&&(p.bearing+=T),E&&(p.pitch+=E),p._updateCameraState();const F=[0,0,0];if(y)if(p.projection.name==="mercator"){const Z=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(C).dir),H=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(C.sub(y)).dir);F[0]=H[0]-Z[0],F[1]=H[1]-Z[1]}else{const Z=p.pointCoordinate(C);if(p.projection.name==="globe"){y=y.rotate(-p.angle);const H=p._pixelsPerMercatorPixel/p.worldSize;F[0]=-y.x*s.eW(s.a$(Z.y))*H,F[1]=-y.y*s.eW(p.center.lat)*H}else{const H=p.pointCoordinate(C.sub(y));Z&&H&&(F[0]=H.x-Z.x,F[1]=H.y-Z.y)}}const z=p.zoom,B=[0,0,0];if(x){const Z=m(M||p.pointCoordinate3D(C)),H={dir:s.aw([],s.av([],Z,p._camera.position))};if(H.dir[2]<0){const $=p.zoomDeltaToMovement(Z,x);s.c5(B,H.dir,$)}}const j=s.d8(F,F,B);p._translateCameraConstrained(j),x&&Math.abs(p.zoom-z)>1e-4&&p.recenterOnTerrain(),p.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,c,!0)}_fireEvents(t,o,c){const d=_c(this._eventsInProgress),p=_c(t),m={};for(const E in t){const{originalEvent:C}=t[E];this._eventsInProgress[E]||(m[`${E}start`]=C),this._eventsInProgress[E]=t[E]}!d&&p&&this._fireEvent("movestart",p.originalEvent);for(const E in m)this._fireEvent(E,m[E]);p&&this._fireEvent("move",p.originalEvent);for(const E in t){const{originalEvent:C}=t[E];this._fireEvent(E,C)}const y={};let x;for(const E in this._eventsInProgress){const{handlerName:C,originalEvent:M}=this._eventsInProgress[E];this._handlersById[C].isActive()||(delete this._eventsInProgress[E],x=o[C]||M,y[`${E}end`]=x)}for(const E in y)this._fireEvent(E,y[E]);const T=_c(this._eventsInProgress);if(c&&(d||p)&&!T){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=M=>M!==0&&-this._bearingSnap<M&&M<this._bearingSnap;E?(C(E.bearing||this._map.getBearing())&&(E.bearing=0),this._map.easeTo(E,{originalEvent:x})):(this._map.fire(new s.z("moveend",{originalEvent:x})),C(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,o){this._map.fire(new s.z(t,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new Bp("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Id="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Up extends s.E{constructor(t,o){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,this._respectPrefersReducedMotion=o.respectPrefersReducedMotion!==!1,s.aY(["_renderFrameCallback"],this)}getCenter(){return new s.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}panBy(t,o,c){return t=s.P.convert(t).mult(-1),this.panTo(this.transform.center,Object.assign({offset:t},o),c)}panTo(t,o,c){return this.easeTo(Object.assign({center:t},o),c)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,c){return this.easeTo(Object.assign({zoom:t},o),c)}zoomIn(t,o){return this.zoomTo(this.getZoom()+1,t,o),this}zoomOut(t,o){return this.zoomTo(this.getZoom()-1,t,o),this}getBearing(){return this.transform.bearing}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,c){return this.easeTo(Object.assign({bearing:t},o),c)}resetNorth(t,o){return this.rotateTo(0,Object.assign({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,o):this}getPitch(){return this.transform.pitch}setPitch(t,o){return this.jumpTo({pitch:t},o),this}cameraForBounds(t,o){t=s.aI.convert(t);const c=o&&o.bearing||0,d=o&&o.pitch||0,p=t.getNorthWest(),m=t.getSouthEast();return this._cameraForBounds(this.transform,p,m,c,d,o)}_extendPadding(t){const o={top:0,right:0,bottom:0,left:0};return t==null?Object.assign({},o,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:Object.assign({},o,t)}_extendCameraOptions(t){return(t=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,o){const c=o.max[0]-o.min[0],d=o.max[1]-o.min[1];return c/d>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,o,c,d,p,m){const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=s.aT.convert(o),E=s.aT.convert(c),C=.5*(T.lat+E.lat),M=.5*(T.lng+E.lng),P=s.eZ(C,M),F=s.aw([],P),z=s.aw([],s.bI([],F,[0,1,0])),B=s.bI([],z,F),j=[z[0],z[1],z[2],0,B[0],B[1],B[2],0,F[0],F[1],F[2],0,0,0,0,1],Z=[P,s.eZ(T.lat,T.lng),s.eZ(E.lat,T.lng),s.eZ(E.lat,E.lng),s.eZ(T.lat,E.lng),s.eZ(C,T.lng),s.eZ(C,E.lng),s.eZ(T.lat,M),s.eZ(E.lat,M)];let H=s.d9.fromPoints(Z.map(Me=>[s.bJ(z,Me),s.bJ(B,Me),s.bJ(F,Me)]));const $=s.af([],H.center,j);s.e_($)===0&&s.e$($,0,0,1),s.aw($,$),s.c5($,$,s.aD),y.center=s.f0($);const le=y.getWorldToCameraMatrix(),ne=s.bl(new Float64Array(16),le);H=s.d9.applyTransform(H,s.aB([],le,j));const se=this._extendAABB(H,y,x,d);if(!se)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");H=se,s.af($,$,le);const ee=.5*(H.max[2]-H.min[2]),J=this._minimumAABBFrustumDistance(y,H),ue=s.c5([],[0,0,1],ee),_e=s.d8(ue,$,ue),xe=J+(y.pitch===0?0:s.bG($,_e)),Ae=y.globeCenterInViewSpace,Ee=s.av([],$,[Ae[0],Ae[1],Ae[2]]);s.aw(Ee,Ee),s.c5(Ee,Ee,xe);const Fe=s.d8([],$,Ee);s.af(Fe,Fe,ne);const $e=s.eM/s.aD,Te=s.ag(Fe),he=s.cf(Math.max(Te*$e-s.eM,Number.EPSILON),0),ze=Math.min(y.zoomFromMercatorZAdjusted(he),x.maxZoom);return ze>.5*(s.c_+s.cL)?(y.setProjection({name:"mercator"}),y.zoom=ze,this._cameraForBounds(y,o,c,d,p,m)):{center:y.center,zoom:ze,bearing:d,pitch:p}}_extendAABB(t,o,c,d){const p=.5*((c.padding.left||0)+(c.padding.right||0)),m=.5*((c.padding.top||0)+(c.padding.bottom||0)),y=m,x=p,T=p,E=m,C=o.width-(x+T),M=o.height-(y+E),P=s.av([],t.max,t.min),F=Math.min(C/P[0],M/P[1]),z=Math.min(o.scaleZoom(o.scale*F),c.maxZoom);if(isNaN(z))return null;const B=o.scale/o.zoomScale(z),j=new s.d9([t.min[0]-x*B,t.min[1]-E*B,t.min[2]],[t.max[0]+T*B,t.max[1]+y*B,t.max[2]]),Z=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new s.P(c.offset.x,c.offset.y):s.P.convert(c.offset)).rotate(-s.an(d));return j.center[0]-=Z.x*B,j.center[1]+=Z.y*B,j}queryTerrainElevation(t,o){const c=this.transform.elevation;return c?(o=Object.assign({},{exaggerated:!0},o),c.getAtPoint(s.ae.fromLngLat(t),null,o.exaggerated)):null}_cameraForBounds(t,o,c,d,p,m){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,o,c,d,p,m);const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=s.aT.convert(o),E=s.aT.convert(c),C=new s.aT(T.lng,E.lat),M=new s.aT(E.lng,T.lat),P=y.project(T),F=y.project(E),z=this.queryTerrainElevation(T),B=this.queryTerrainElevation(E),j=this.queryTerrainElevation(C),Z=this.queryTerrainElevation(M),H=[[P.x,P.y,Math.min(z||0,B||0,j||0,Z||0)],[F.x,F.y,Math.max(z||0,B||0,j||0,Z||0)]];let $=s.d9.fromPoints(H);const le=y.getWorldToCameraMatrix(),ne=s.bl(new Float64Array(16),le);$=s.d9.applyTransform($,le);const se=this._extendAABB($,y,x,d);if(!se)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");$=se;const ee=.5*s.av([],$.max,$.min)[2],J=this._minimumAABBFrustumDistance(y,$),ue=[0,0,1,0];s.aC(ue,ue,le),s.f1(ue,ue);const _e=s.c5([],ue,J+ee),xe=s.d8([],$.center,_e);s.af($.center,$.center,ne),s.af(xe,xe,ne);const Ae=y.unproject(new s.P($.center[0],$.center[1])),Ee=s.f2(y.projection,Ae),Fe=Math.pow(2,Ee),$e=Math.min(y._zoomFromMercatorZ(xe[2]*y.pixelsPerMeter*Fe/y.worldSize),x.maxZoom);return y.mercatorFromTransition&&$e<.5*(s.c_+s.cL)?(y.setProjection({name:"globe"}),y.zoom=$e,this._cameraForBounds(y,o,c,d,p,m)):{center:Ae,zoom:$e,bearing:d,pitch:p}}fitBounds(t,o,c){const d=this.cameraForBounds(t,o);return this._fitInternal(d,o,c)}fitScreenCoordinates(t,o,c,d,p){const m=s.P.convert(t),y=s.P.convert(o),x=new s.P(Math.min(m.x,y.x),Math.min(m.y,y.y)),T=new s.P(Math.max(m.x,y.x),Math.max(m.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(m,y))return this;const E=this.transform.pointLocation3D(x),C=this.transform.pointLocation3D(T),M=this.transform.pointLocation3D(new s.P(x.x,T.y)),P=this.transform.pointLocation3D(new s.P(T.x,x.y)),F=[Math.min(E.lng,C.lng,M.lng,P.lng),Math.min(E.lat,C.lat,M.lat,P.lat)],z=[Math.max(E.lng,C.lng,M.lng,P.lng),Math.max(E.lat,C.lat,M.lat,P.lat)],B=d&&d.pitch?d.pitch:this.getPitch(),j=this._cameraForBounds(this.transform,F,z,c,B,d);return this._fitInternal(j,d,p)}_fitInternal(t,o,c){return t?(o=Object.assign(t,o)).linear?this.easeTo(o,c):this.flyTo(o,c):this}jumpTo(t,o){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,p=!1,m=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=s.aT.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(p=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(m=!0,c.pitch=+t.pitch);const y=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(y))if(t.retainPadding===!1){const x=c.clone();x.padding=y,c.setLocationAtPoint(c.center,x.centerPoint)}else c.padding=y;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new s.z("movestart",o)).fire(new s.z("move",o)),d&&this.fire(new s.z("zoomstart",o)).fire(new s.z("zoom",o)).fire(new s.z("zoomend",o)),p&&this.fire(new s.z("rotatestart",o)).fire(new s.z("rotate",o)).fire(new s.z("rotateend",o)),m&&this.fire(new s.z("pitchstart",o)).fire(new s.z("pitch",o)).fire(new s.z("pitchend",o)),this.fire(new s.z("moveend",o)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(Id),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,o){const c=this.transform;if(!c.projection.supportsFreeCamera)return s.w(Id),this;this.stop();const d=c.zoom,p=c.pitch,m=c.bearing;c.setFreeCameraOptions(t);const y=d!==c.zoom,x=p!==c.pitch,T=m!==c.bearing;return this.fire(new s.z("movestart",o)).fire(new s.z("move",o)),y&&this.fire(new s.z("zoomstart",o)).fire(new s.z("zoom",o)).fire(new s.z("zoomend",o)),T&&this.fire(new s.z("rotatestart",o)).fire(new s.z("rotate",o)).fire(new s.z("rotateend",o)),x&&this.fire(new s.z("pitchstart",o)).fire(new s.z("pitch",o)).fire(new s.z("pitchend",o)),this.fire(new s.z("moveend",o)),this}easeTo(t,o){this._stop(!1,t.easeId),((t=Object.assign({offset:[0,0],duration:500,easing:s.eV},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?+t.zoom:d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:m,C=this._extendPadding(t.padding),M=s.P.convert(t.offset);let P,F,z;if(c.projection.name==="globe"){const ue=s.ae.fromLngLat(c.center),_e=M.rotate(-c.angle);ue.x+=_e.x/c.worldSize,ue.y+=_e.y/c.worldSize;const xe=ue.toLngLat(),Ae=s.aT.convert(t.center||xe);this._normalizeCenter(Ae),P=c.centerPoint.add(_e),F=new s.P(ue.x,ue.y).mult(c.worldSize),z=new s.P(s.aF(Ae.lng),s.aJ(Ae.lat)).mult(c.worldSize).sub(F)}else{P=c.centerPoint.add(M);const ue=c.pointLocation(P),_e=s.aT.convert(t.center||ue);this._normalizeCenter(_e),F=c.project(ue),z=c.project(_e).sub(F)}const B=c.zoomScale(x-d);let j,Z;t.around&&(j=s.aT.convert(t.around),Z=c.locationPoint(j));const H=this._zooming||x!==d,$=this._rotating||p!==T,le=this._pitching||E!==m,ne=!c.isPaddingEqual(C),se=t.retainPadding===!1?c.clone():c,ee=ue=>_e=>{if(H&&(ue.zoom=s.ak(d,x,_e)),$&&(ue.bearing=s.ak(p,T,_e)),le&&(ue.pitch=s.ak(m,E,_e)),ne&&(se.interpolatePadding(y,C,_e),P=se.centerPoint.add(M)),j)ue.setLocationAtPoint(j,Z);else{const xe=ue.zoomScale(ue.zoom-d),Ae=x>d?Math.min(2,B):Math.max(.5,B),Ee=Math.pow(Ae,1-_e),Fe=ue.unproject(F.add(z.mult(_e*Ee)).mult(xe));ue.setLocationAtPoint(ue.renderWorldCopies?Fe.wrap():Fe,P)}return t.preloadOnly||this._fireMoveEvents(o),ue};if(t.preloadOnly){const ue=this._emulate(ee,t.duration,c);return this._preloadTiles(ue),this}const J={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=H,this._rotating=$,this._pitching=le,this._padding=ne,this._easeId=t.easeId,this._prepareEase(o,t.noMoveStart,J),this._ease(ee(c),ue=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(o,ue)},t),this}_prepareEase(t,o,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),o||c.moving||this.fire(new s.z("movestart",t)),this._zooming&&!c.zooming&&this.fire(new s.z("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new s.z("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new s.z("pitchstart",t))}_fireMoveEvents(t){this.fire(new s.z("move",t)),this._zooming&&this.fire(new s.z("zoom",t)),this._rotating&&this.fire(new s.z("rotate",t)),this._pitching&&this.fire(new s.z("pitch",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new s.z("zoomend",t)),d&&this.fire(new s.z("rotateend",t)),p&&this.fire(new s.z("pitchend",t)),this.fire(new s.z("moveend",t))}flyTo(t,o){if(this._prefersReducedMotion(t)){const Me=s.aH(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Me,o)}this.stop(),t=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:s.eV},t);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?s.aA(+t.zoom,c.minZoom,c.maxZoom):d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:m,C=this._extendPadding(t.padding),M=c.zoomScale(x-d),P=s.P.convert(t.offset);let F=c.centerPoint.add(P);const z=c.pointLocation(F),B=s.aT.convert(t.center||z);this._normalizeCenter(B);const j=c.project(z),Z=c.project(B).sub(j);let H=t.curve;const $=Math.max(c.width,c.height),le=$/M,ne=Z.mag();if("minZoom"in t){const Me=s.aA(Math.min(t.minZoom,d,x),c.minZoom,c.maxZoom),We=$/c.zoomScale(Me-d);H=Math.sqrt(We/ne*2)}const se=H*H;function ee(Me){const We=(le*le-$*$+(Me?-1:1)*se*se*ne*ne)/(2*(Me?le:$)*se*ne);return Math.log(Math.sqrt(We*We+1)-We)}function J(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function ue(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const _e=ee(0);let xe=function(Me){return ue(_e)/ue(_e+H*Me)},Ae=function(Me){return $*((ue(_e)*(J(We=_e+H*Me)/ue(We))-J(_e))/se)/ne;var We},Ee=(ee(1)-_e)/H;if(Math.abs(ne)<1e-6||!isFinite(Ee)){if(Math.abs($-le)<1e-6)return this.easeTo(t,o);const Me=le<$?-1:1;Ee=Math.abs(Math.log(le/$))/H,Ae=function(){return 0},xe=function(We){return Math.exp(Me*H*We)}}t.duration="duration"in t?+t.duration:1e3*Ee/("screenSpeed"in t?+t.screenSpeed/H:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Fe=p!==T,$e=E!==m,Te=!c.isPaddingEqual(C),he=t.retainPadding===!1?c.clone():c,ze=Me=>We=>{const et=We*Ee,ut=1/xe(et);Me.zoom=We===1?x:d+Me.scaleZoom(ut),Fe&&(Me.bearing=s.ak(p,T,We)),$e&&(Me.pitch=s.ak(m,E,We)),Te&&(he.interpolatePadding(y,C,We),F=he.centerPoint.add(P));const tt=We===1?B:Me.unproject(j.add(Z.mult(Ae(et))).mult(ut));return Me.setLocationAtPoint(Me.renderWorldCopies?tt.wrap():tt,F),Me._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(o),Me};if(t.preloadOnly){const Me=this._emulate(ze,t.duration,c);return this._preloadTiles(Me),this}return this._zooming=!0,this._rotating=Fe,this._pitching=$e,this._padding=Te,this._prepareEase(o,!1),this._ease(ze(c),()=>this._afterEase(o),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,o)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,o,c){c.animate===!1||c.duration===0?(t(1),o()):(this._easeStart=s.o.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((s.o.now()-this._easeStart)/this._easeOptions.duration,1),o=this._onEaseFrame;o&&o(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,o){t=s.bT(t,-180,180);const c=Math.abs(t-o);return Math.abs(t-360-o)<c&&(t-=360),Math.abs(t+360-o)<c&&(t+=360),t}_normalizeCenter(t){const o=this.transform;if(o.maxBounds||o.projection.name!=="globe"&&!o.renderWorldCopies)return;const c=t.lng-o.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&s.o.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,o,c){const d=Math.ceil(15*o/1e3),p=[],m=t(c.clone());for(let y=0;y<=d;y++){const x=m(y/d);p.push(x.clone())}return p}_preloadTiles(t,o){}}class jp{constructor(t={}){this.options=t,s.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const o=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Xe("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",c);const d=Xe("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=Xe("div","mapboxgl-ctrl-attrib-inner",this._container),o&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),o===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const o=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.e.ACCESS_TOKEN}];if(t){const c=o.reduce((d,p,m)=>(p.value&&(d+=`${p.key}=${p.value}${m<o.length-1?"&":""}`),d),"?");t.href=`${s.e.FEEDBACK_URL}/${c}#${Pp(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||(t.dataType!=="source"||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility")&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const o=this._map.style._mergedSourceCaches;for(const d in o){const p=o[d];if(p.used){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t.sort((d,p)=>d.length-p.length),t=t.filter((d,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.map(d=>(function(p){const m=new DOMParser().parseFromString(p,"text/html");return Array.from(m.body.querySelectorAll("*")).reverse().forEach(y=>{const x=y.textContent||"";if(y.tagName!=="A")return void y.replaceWith(...y.childNodes);const T=y.getAttribute("href");if(!T||!/^(https?:|mailto:)/i.test(T))return void y.replaceWith(m.createTextNode(x));const E=m.createElement("a");E.href=T,E.textContent=x,E.rel="noopener nofollow";const C=y.getAttribute("class");C&&(E.className=C),y.replaceWith(E)}),m.body.innerHTML})(d)).join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,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 Gp{constructor(){s.aY(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=Xe("div","mapboxgl-ctrl");const o=Xe("a","mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://www.mapbox.com/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const o in t){const c=t[o].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const o=t[0];this._map.getCanvasContainer().offsetWidth<250?o.classList.add("mapboxgl-compact"):o.classList.remove("mapboxgl-compact")}}}class qp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){const o=this._currentlyRunning,c=o?this._queue.concat(o):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const c of o)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Hi{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const o=s.dD((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-o)+this._end*o}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,o,c){this._start=this.getValue(o),this._end=t,this._startTime=o,this._endTime=o+c}}const $p={"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 Hp extends s.z{constructor(t,o,c,d){const{point:p,lngLat:m,originalEvent:y,target:x}=t;super(t.type,{point:p,lngLat:m,originalEvent:y,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=o,this.interaction=c,this.feature=d}}class B_{constructor(t){this.map=t,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,o){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=o.filter;let d=o.type;c&&this.filters.set(t,s.b6(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const p=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,o)):p.size===0&&this.map.on(d,this.handleType),p.size===0&&this.interactionsByType.set(d,p),p.set(t,o),this.typeById.set(t,d)}get(t){const o=this.typeById.get(t);if(!o)return;const c=this.interactionsByType.get(o);return c?c.get(t):void 0}remove(t){const o=this.typeById.get(t);if(!o)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(o);c&&(c.delete(t),o==="mouseenter"||o==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):c.size===0&&this.map.off(o,this.handleType))}queryTargets(t,o){const c=[];for(const[d,p]of o)p.target&&c.push({targetId:d,target:p.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const o=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());o.length&&(t.type="mouseenter",this.handleType(t,o));const c=new Map;for(const[d,{feature:p}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(p.id,p);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const o=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);o.length&&(t.type="mouseleave",this.handleType(t,o)),this.hoveredFeatures.clear()}handleType(t,o){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void s.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),p=!!o;o=o||this.queryTargets(t.point,d);let m=!1;const y=new Set;for(const x of o){for(const[T,E]of d){if(!E.target)continue;const C=x.variants?x.variants[T]:null;if(C){for(const M of C){if(zl(M,x,y,T))continue;const P=new s.dx(x,M),F=Jn(M,x,T);p&&P.id!==void 0&&(P.state=this.map.getFeatureState(P));const z=c?this.prevHoveredFeatures.get(F):null,B=new Hp(t,T,E,P),j=z?z.stop:E.handler(B);if(c&&this.hoveredFeatures.set(F,{feature:x,stop:j}),j!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,T]of d){const{handler:E,target:C}=T;if(!C&&E(new Hp(t,x,T,null))!==!1)break}}}function N_(l,t){if(Array.isArray(l)&&Array.isArray(t)){const o=new Set(l),c=new Set(t);return o.size===c.size&&l.every(d=>c.has(d))}return s.by(l,t)}const yc={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},Zp={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ad{constructor(t,o,c=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new Eu({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new Su({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),s.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchmove",this.touchmove),o.addEventListener("touchend",this.touchend),o.addEventListener("touchcancel",this.reset)}down(t,o){this.mouseRotate.mousedown(t,o),this.mousePitch&&this.mousePitch.mousedown(t,o),Qe()}move(t,o){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,o),p=d&&d.bearingDelta;if(p&&c.setBearing(c.getBearing()+p),this.mousePitch){const m=this.mousePitch.mousemoveWindow(t,o),y=m&&m.pitchDelta;y&&c.setPitch(c.getPitch()+y)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){He(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(Object.assign({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),Mt(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,Mt(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=li(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=li(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function xc(l,t,o){if(l=new s.aT(l.lng,l.lat),t){const c=new s.aT(l.lng-360,l.lat),d=new s.aT(l.lng+360,l.lat),p=360*Math.ceil(Math.abs(l.lng-o.center.lng)/360),m=o.locationPoint3D(l).distSqr(t),y=t.x<0||t.y<0||t.x>o.width||t.y>o.height;o.locationPoint3D(c).distSqr(t)<m&&(y||Math.abs(c.lng-o.center.lng)<p)?l=c:o.locationPoint3D(d).distSqr(t)<m&&(y||Math.abs(d.lng-o.center.lng)<p)&&(l=d)}for(;Math.abs(l.lng-o.center.lng)>180;){const c=o.locationPoint3D(l);if(c.x>=0&&c.y>=0&&c.x<=o.width&&c.y<=o.height)break;l.lng>o.center.lng?l.lng-=360:l.lng+=360}return l}
2996const Po={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%)"},no={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class gr extends s.E{constructor(t,o){super(),(t instanceof HTMLElement||o)&&(t=Object.assign({element:t},o)),s.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:p=1,draggable:m=!1,clickTolerance:y=0,rotation:x=no.rotation,rotationAlignment:T=no.rotationAlignment,pitchAlignment:E=no.pitchAlignment,occludedOpacity:C=no.occludedOpacity,altitude:M=no.altitude}=t||{};this._anchor=c,this._color=d,this._scale=p,this._draggable=m,this._clickTolerance=y,this._rotation=x,this._rotationAlignment=T,this._pitchAlignment=E,this._occludedOpacity=C,this._altitude=M,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=s.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=s.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",z=>{z.preventDefault()}),this._element.addEventListener("mousedown",z=>{z.preventDefault()});const P=this._element.classList;for(const z in Po)P.remove(`mapboxgl-marker-anchor-${z}`);P.add(`mapboxgl-marker-anchor-${this._anchor}`);const F=t&&t.className?t.className.trim().split(/\s+/):[];P.add(...F),this._popup=null}_createDefaultMarker(){const t=Xe("div"),o=pe("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const c=pe("radialGradient",{id:"shadowGradient"},pe("defs",{},o));pe("stop",{offset:"10%","stop-opacity":.4},c),pe("stop",{offset:"100%","stop-opacity":.05},c),pe("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o)}return pe("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),pe("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),pe("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=s.aT.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||no.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){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")),t){if(!("offset"in t.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 7,484 bytes, lines 2996-3001
29960,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const o=t.code,c=t.charCode||t.keyCode;o!=="Space"&&o!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const o=t.originalEvent.target,c=this._element;this._popup&&(o===c||c.contains(o))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,o=this._pos;if(!t||!o)return!1;const c=t.unproject(o,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const p=d.position.toLngLat();return p.distanceTo(c)<.9*p.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const o=this._pos;if(!o||o.x<0||o.x>t.transform.width||o.y<0||o.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(o,this._altitude);let d;t._showingGlobe()&&s.f5(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const o=this._offset.mult(this._scale);this._element.style.transform=` 2997 translate(${t.x}px,${t.y}px) 2998 ${Po[this._anchor]} 2999 ${this._calculateXYTransform()} ${this._calculateZTransform()} 3000 translate(${o.x}px,${o.y}px) 3001 `}_calculateXYTransform(){const t=this._pos,o=this._map,c=this.getPitchAlignment();if(!o||!t||c!=="map")return"";if(!o._showingGlobe()){const x=o.getPitch();return x?`rotateX(${x}deg)`:""}const d=s.cX(s.f6(o.transform,this._lngLat)),p=t.sub(s.f7(o.transform)),m=Math.abs(p.x)+Math.abs(p.y);if(m===0)return"";const y=d/m;return`rotateX(${-p.y*y}deg) rotateY(${p.x*y}deg)`}_calculateZTransform(){const t=this._pos,o=this._map;if(!o||!t)return"";let c=0;const d=this.getRotationAlignment();if(d==="map")if(o._showingGlobe()){const p=o.project(new s.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=o.project(new s.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(p);c=s.cX(Math.atan2(m.y,m.x))-90}else c=-o.getBearing();else if(d==="horizon"){const p=s.ah(4,6,o.getZoom()),m=s.f7(o.transform);m.y+=p*o.transform.height;const y=t.sub(m),x=s.cX(Math.atan2(y.y,y.x));c=(x>90?x-270:x+90)*(1-p)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const o=this._map;o&&(o.transform.renderWorldCopies&&(this._lngLat=xc(this._lngLat,this._pos,o.transform)),this._pos=o.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),o._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(o._showingGlobe()||o.getTerrain()||o.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=s.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const o=this._map;if(!o)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const p=this._clickTolerance||o._clickTolerance;if(t.point.dist(c)<p)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=o.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new s.z("dragstart"))),this.fire(new s.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new s.z("dragend")),this._state="inactive"}_addDragHandler(t){const o=this._map,c=this._pos;o&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",o.on("mousemove",this._onMove),o.on("touchmove",this._onMove),o.once("mouseup",this._onUp),o.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const o=this._map;return o&&(t?(o.on("mousedown",this._addDragHandler),o.on("touchstart",this._addDragHandler)):(o.off("mousedown",this._addDragHandler),o.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||no.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||no.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||no.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||no.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const oo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},vc={maxWidth:100,unit:"metric"},Cu={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},Wp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},V_=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ml(l=new s.P(0,0),t="bottom"){if(typeof l=="number"){const o=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new s.P(0,l);case"top-left":return new s.P(o,o);case"top-right":return new s.P(-o,o);case"bottom":return new s.P(0,-l);case"bottom-left":return new s.P(o,-o);case"bottom-right":return new s.P(-o,-o);case"left":return new s.P(l,0);case"right":return new s.P(-l,0)}return new s.P(0,0)}return l instanceof s.P||Array.isArray(l)?s.P.convert(l):s.P.convert(l[t]||[0,0])}return{version:we,supported:Be.supported,setRTLTextPlugin:s.fb,getRTLTextPluginStatus:s.fa,Map:class extends Up{constructor(l){rt.mark(Pe.create);const t=l;if((l=Object.assign({}
3001,yc,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&s.f3(window)&&(l.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new qc(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies,null,null),l),this._repaint=!!l.repaint,this._interactive=l.interactive,this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=l.crossSourceCollisions,this._collectResourceTiming=l.collectResourceTiming,this._language=this._parseLanguage(l.language),this._worldview=l.worldview,this._renderTaskQueue=new qp,this._domRenderTaskQueue=new qp,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.b2(),this._locale=Object.assign({},$p,l.locale),this._clickTolerance=l.clickTolerance,this._cooperativeGestures=l.cooperativeGestures,this._performanceMetricsCollection=l.performanceMetricsCollection,this._tessellationStep=l.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=l.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Hi(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new _o(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const o=document.getElementById(l.container);if(!o)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=o}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&s.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,s.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Vp(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||s.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),l.hash&&(this._hash=new yn(typeof l.hash=="string"&&l.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch});const o=l.bounds;o&&(this.resize(),this.fitBounds(o,Object.assign({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new jp({customAttribution:l.customAttribution}
vendor: 9,360 bytes, line 3001
3001)),this._logoControl=new Gp,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new s.z(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new s.z(`${o.dataType}dataloading`,o))}),this._interactions=new B_(this)}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new s.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=l.onAdd(this);this._controls.push(l);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(o,c.firstChild):c.appendChild(o),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new s.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new s.z("movestart",l)).fire(new s.z("move",l)),this.fire(new s.z("resize",l)),t&&this.fire(new s.z("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(s.aI.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new s.z("zoomstart")).fire(new s.z("zoom")).fire(new s.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new s.z("zoomstart")).fire(new s.z("zoom")).fire(new s.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new s.z("pitchstart")).fire(new s.z("pitch")).fire(new s.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new s.z("pitchstart")).fire(new s.z("pitch")).fire(new s.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(l){return l==="auto"?navigator.language:Array.isArray(l)?l.length===0?void 0:l.map(t=>t==="auto"?navigator.language:t):l}setLanguage(l){const t=this._parseLanguage(l);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const o of this._controls)o._setLanguage&&o._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){return this.style&&l!==this._worldview?(this._worldview=l,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._useExplicitProjection=!!l,this._prioritizeAndUpdateProjection(l,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const l=this.transform,t=l.projection.name;let o;t==="globe"&&l.zoom>=s.cL?(l.setMercatorFromTransition(),o=!0):t==="mercator"&&l.zoom<s.cL&&(l.setProjection({name:"globe"}),o=!0),o&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;const o=this.transform.mercatorFromTransition;t=l.name==="globe"&&this.transform.zoom>=s.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate();const c=this.transform.getProjection().name==="mercator"&&o!==this.transform.mercatorFromTransition;return(t||c)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(s.aT.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(s.P.convert(l),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(l,t,o){const c=d=>{let p=[];if(Array.isArray(t)){const m=t.filter(y=>this.getLayer(y));p=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else p=this.queryRenderedFeatures(d,{target:t});return p};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:o,targets:t,delegates:{mousemove:m=>{const y=c(m.point);y.length?d||(d=!0,o.call(this,new Gr(l,this,m.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:o,targets:t,delegates:{mousemove:y=>{c(y.point).length?d=!0:d&&(d=!1,o.call(this,new Gr(l,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,o.call(this,new Gr(l,this,y.originalEvent)))}}}}{const d=p=>{const m=c(p.point);m.length&&(p.features=m,o.call(this,p),delete p.features)};return{listener:o,targets:t,delegates:{[l]:d}}}}on(l,t,o){if(typeof t=="function"||o===void 0)return super.on(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(c);for(const d in c.delegates)this.on(d,c.delegates[d]);return this}once(l,t,o){if(typeof t=="function"||o===void 0)return super.once(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,o);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(l,t,o){if(typeof t=="function"||o===void 0)return super.off(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._delegatedListeners?this._delegatedListeners[l]:void 0;return c&&(d=>{for(let p=0;p<d.length;p++){const m=d[p];if(m.listener===o&&N_(m.targets,t)){for(const y in m.delegates)this.off(y,m.delegates[y]);return d.splice(p,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof s.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const p=this.style.queryRenderedFeatures(l,void 0,this.transform),m=this.style.queryRenderedFeatureset(l,void 0,this.transform);return p.concat(m)}let o=!0;if(t.target&&(o=this._isTargetValid(t.target),o&&!t.layers))return this.style.queryRenderedFeatureset(l,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const p of t.layers)if(!this._isValidId(p)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(l,t,this.transform)}let d=[];return c&&(d=d.concat(this.style.queryRenderedFeatures(l,t,this.transform))),o&&(d=d.concat(this.style.queryRenderedFeatureset(l,t,this.transform))),d}querySourceFeatures(l,t){return!l||typeof l=="string"&&!this._isValidId(l)?[]:this.style.querySourceFeatures(l,t)}queryRasterValue(l,t,o){return this._isValidId(l)?this.style.queryRasterValue(l,t,o):Promise.resolve(null)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&s.w(`${t} projection does not support isPointOnSurface, this API may behave unex
3001pectedly.`),this.transform.isPointOnSurface(s.P.convert(l))}addInteraction(l,t){return this._interactions.add(l,t),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,t){return t=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&l&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(l,(o,c)=>{if(o){const d=typeof o=="string"?o:o instanceof Error?o.message:o.error;s.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}else c&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const o=Object.assign({},t);t&&t.config&&(o.initialConfig=t.config,delete o.config),this.style=new Vn(this,o).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Vn(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():(s.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new s.y(new Error("IDs can't be empty."))),!1):!s.dr(l)||(this.fire(new s.y(new Error(`IDs can't contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const t of l)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(l)}addSource(l,t){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,t,o){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,o)}removeSource(l){return this._isValidId(l)?(this.style.removeSource(l),this._updateTerrain(),this._update(!0)):this}getSource(l){return this._isValidId(l)?this.style.getOwnSource(l):null}addImage(l,t,{pixelRatio:o=1,sdf:c=!1,stretchX:d,stretchY:p,content:m}={}){this._lazyInitEmptyStyle();const y=s.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:T,data:E}=s.o.getImageData(t);this.style.addImage(y,{data:new s.q({width:x,height:T},E),pixelRatio:o,stretchX:d,stretchY:p,content:m,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new s.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:x,height:T}=t,E=t;this.style.addImage(y,{data:new s.q({width:x,height:T},new Uint8Array(E.data)),pixelRatio:o,stretchX:d,stretchY:p,content:m,sdf:c,usvg:!1,version:0,userImage:E}),E.onAdd&&E.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const o=s.I.from(l),c=this.style.getImage(o);if(!c)return void this.fire(new s.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?s.o.getImageData(t):t,{width:p,height:m,data:y}=d;if(p===void 0||m===void 0)return void this.fire(new s.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(p!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||m!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new s.y(new Error(`The width and height of the updated image (${p}, ${m}) 3002 must be that same as the previous version of the image 3003 (${c.data.width}, ${c.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let T=!1;c.usvg?(c.data=new s.q({width:p,height:m},new Uint8Array(y)),c.usvg=!1,c.icon=void 0,T=!0):c.data.replace(y,x),this.style.updateImage(o,c,T)}hasImage(l){return l?!!this.style&&!!this.style.getImage(s.I.from(l)):(this.fire(new s.y(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(s.I.from(l))}loadImage(l,t){s.n(this._requestManager.transformRequest(l,s.R.Image),(o,c)=>{t(o,c instanceof HTMLImageElement?s.o.getImageData(c):c)})}
vendor: 26,316 bytes, line 3003
3003listImages(){return this.style.listImages().map(l=>l.name)}addModel(l,t){this._lazyInitEmptyStyle(),this.style.addModel(l,t)}hasModel(l){return l?this.style.hasModel(l):(this.fire(new s.y(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,t){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)):this}getSlot(l){const t=this.getLayer(l);return t&&t.slot||null}setSlot(l,t){return this.style.setSlot(l,t),this.style.mergeLayers(),this._update(!0)}addImport(l,t){return this.style.addImport(l,t).catch(o=>this.fire(new s.y(new Error("Failed to add import",o)))),this}updateImport(l,t){return typeof t!="string"&&t.id!==l?(this.removeImport(l),this.addImport(t)):(this.style.updateImport(l,t),this._update(!0))}removeImport(l){return this.style.removeImport(l),this}moveImport(l,t){return this.style.moveImport(l,t),this._update(!0)}moveLayer(l,t){return this._isValidId(l)?(this.style.moveLayer(l,t),this._update(!0)):this}removeLayer(l){return this._isValidId(l)?(this.style.removeLayer(l),this._update(!0)):this}getLayer(l){if(!this._isValidId(l))return null;const t=this.style.getOwnLayer(l);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(l,t,o){return this._isValidId(l)?(this.style.setLayerZoomRange(l,t,o),this._update(!0)):this}setFilter(l,t,o={}){return this._isValidId(l)?(this.style.setFilter(l,t,o),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,t,o,c={}){return this._isValidId(l)?(this.style.setPaintProperty(l,t,o,c),this._update(!0)):this}getPaintProperty(l,t){return this._isValidId(l)?this.style.getPaintProperty(l,t):null}setLayoutProperty(l,t,o,c={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,t,o,c),this._update(!0)):this}getLayoutProperty(l,t){return this._isValidId(l)?this.style.getLayoutProperty(l,t):null}setLayerProperty(l,t,o,c={}){return this._isValidId(l)?(t==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(l,t,o,c),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,t){return this.style.setSchema(l,t),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,t){return this.style.setConfig(l,t),this._update(!0)}getConfigProperty(l,t){return this.style.getConfigProperty(l,t)}setConfigProperty(l,t,o){return this.style.setConfigProperty(l,t,o),this._update(!0)}getFeaturesetDescriptors(l){return this.style.getFeaturesetDescriptors(l)}setLights(l){if(this._lazyInitEmptyStyle(),l&&l.length===1&&l[0].type==="flat"){const t=l[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(l),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const l=this.style.getLights()||[];return l.length===0&&l.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),l}setLight(l,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:l}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(l){return this._lazyInitEmptyStyle(),this.style.setSnow(l),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(l){return this._lazyInitEmptyStyle(),this.style.setRain(l),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(l){return this._lazyInitEmptyStyle(),this.style.setColorTheme(l),this._update(!0)}setImportColorTheme(l,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(l,t),this._update(!0)}setCamera(l){return this.style.setCamera(l),this._triggerCameraUpdate(l)}_triggerCameraUpdate(l){return this._update(this.transform.setOrthographicProjectionAtLowPitch(l["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.aT.convert(l),this.transform):0}setFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.setFeatureState(l,t),this._update())}removeFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.removeFeatureState(l,t),this._update())}getFeatureState(l){return l.source&&!this._isValidId(l.source)?null:this.style.getFeatureState(l)}_selectIndoorFloor(l){this.style.indoorManager.selectFloor(l)}_setIndoorActiveFloorsVisibility(l){this.style.indoorManager.setActiveFloorsVisibility(l)}getIndoorTileOptions(l,t){return this.style.isIndoorEnabled()?this.style.indoorManager.getIndoorTileOptions(l,t):null}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let o,c,d,p=this._container;for(;p&&(!c||!d);){const m=window.getComputedStyle(p).transform;m&&m!=="none"&&(o=m.match(/matrix.*\((.+)\)/)[1].split(", "),o[0]&&o[0]!=="0"&&o[0]!=="1"&&(c=o[0]),o[3]&&o[3]!=="0"&&o[3]!=="1"&&(d=o[3])),p=p.parentElement}this._containerWidth=c?Math.abs(l/c):l,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=Xe("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=Xe("div","mapboxgl-canvas-container",l);this._canvas=Xe("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const o=this._controlContainer=Xe("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{c[d]=Xe("div",`mapboxgl-ctrl-${d}`,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const o=s.o.devicePixelRatio||1;this._canvas.width=o*Math.ceil(l),this._canvas.height=o*Math.ceil(t),this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_addMarker(l){this._markers.push(l)}_removeMarker(l){const t=this._markers.indexOf(l);t!==-1&&this._markers.splice(t,1)}_addPopup(l){this._popups.push(l)}_removePopup(l){const t=this._popups.indexOf(l);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const l=Object.assign({},Be.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(Io(t,!0),this.painter=new Mp(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",o=>{if(o.dataType==="source"){const c=this.transform.elevation?this.transform.elevation._source():null;c&&o.sourceCacheId===c.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),s.k.testSupport(t)):this.fire(new s.y(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.z("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new s.z("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;this.fire(new s.z("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,c=s.o.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(o.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const x=this.transform.zoom,T=this.transform.pitch,E=s.o.now(),C=new s.ac(x,{now:E,fadeDuration:p,pitch:T,transition:this.style.transition,worldview:this._worldview});this.style.update(C)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let m=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),m=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):m=this._updateAverageElevation(c),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions,this.painter.replacementSource)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:p,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 s.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,rt.mark(Pe.load),this.fire(new s.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const x=s.o.now()-c;d.endQuery(o.TIME_ELAPSED_EXT),setTimeout(()=>{const T=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new s.z("gpu-timing-frame",{cpuTime:x,gpuTime:T}))},50)}if(this.listens("gpu-timing-layer")){const x=this.painter.collectGpuTimers();setTimeout(()=>{const T=this.painter.queryGpuTimers(x);this.fire(new s.z("gpu-timing-layer",{layerTimes:T}))},50)}if(this.listens("gpu-timing-deferred-render")){const x=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const T=this.painter.queryGpuTimeDeferredRender(x);this.fire(new s.z("gpu-timing-deferred-render",{gpuTime:T}))},50)}const y=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(y||this._repaint)this.triggerRepaint();else{const x=this.idle();if(x&&(m=this._updateAverageElevation(c,!0)),m)this.triggerRepaint();else if(this._triggerFrame(!1),x&&(this.fire(new s.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const T=this._calculateSpeedIndex();this.fire(new s.z("speedindexcompleted",{speedIndex:T})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,rt.mark(Pe.fullLoad),this._performanceMetricsCollection&&pr(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(l){for(const t of this._markers)l&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!l||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(l,t=!1){const o=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&o(0);const c=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(c||(t||l-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(l)){const d=this.transform.averageElevation;let p=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=l;const m=Math.abs(d-p);if(m>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(p),o(p);this._averageElevation.easeTo(p,l,300)}else if(m>1e-4)return this._averageElevation.jumpTo(p),o(p)}return!!this._averageElevation.isEasing(l)&&o(this._averageElevation.getValue(l))}_authenticate(){Is(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===Wt||l.status===401)){const t=this.painter.context.gl;Io(t,!1),this._logoControl instanceof Gp&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),za(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&br(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Ii(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Kr(this._requestManager._customAccessToken)}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const o=this.painter.context.gl,c=o.createFramebuffer();function d(p){o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,p,0);const m=new Uint8Array(o.drawingBufferWidth*o.drawingBufferHeight*4);return o.readPixels(0,0,o.drawingBufferWidth,o.drawingBufferHeight,o.RGBA,o.UNSIGNED_BYTE,m),m}return o.bindFramebuffer(o.FRAMEBUFFER,c),this._canvasPixelComparison(d(l),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(l,t,o){let c=o[1]-o[0];const d=l.length/4;for(let p=0;p<t.length;p++){const m=t[p];let y=0;for(let x=0;x<m.length;x+=4)m[x]===l[x]&&m[x+1]===l[x+1]&&m[x+2]===l[x+2]&&m[x+3]===l[x+3]&&(y+=1);c+=(o[p+2]-o[p+1])*(1-y/d)}return c}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),la.delete(this.painter.context.gl),Ss.remove(),In.remove(),this._removed=!0,this.fire(new s.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=s.o.frame(t=>{const o=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,o&&this._render(t)}))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return s.bw(t,(o,c)=>o._preloadTiles(l,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this.style&&l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,l&&this._update())}_setCacheLimits(l,t){s.f4(l,t)}get version(){return we}},NavigationControl:class{constructor(l={}){this.options=Object.assign({},Zp,l),this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(s.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),Xe("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),Xe("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const o=this._map;o&&(this.options.visualizePitch?o.resetNorthPitch({},{originalEvent:t}):o.resetNorth({},{originalEvent:t}))}),this._compassIcon=Xe("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;const t=l.getZoom(),o=t===l.getMaxZoom(),c=t===l.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const l=this._map;if(!l)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(l.transform.pitch*(Math.PI/180)),.5)}) rotateX(${l.transform.pitch}deg) rotateZ(${l.transform.angle*(180/Math.PI)}deg)`:`rotate(${l.transform.angle*(180/Math.PI)}deg)`;l._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),l.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&l.on("pitch",this._rotateCompassArrow),l.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Ad(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(l,t){const o=Xe("button",l,this._container);return o.type="button",o.addEventListener("click",t),o}_setButtonTitle(l,t){if(!this._map)return;const o=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",o),l.firstElementChild&&l.firstElementChild.setAttribute("title",o)}},GeolocateControl:class extends s.E{constructor(l={}){super();const t=navigator.geolocation;this.options=Object.assign({geolocation:t},oo,l),s.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Cp(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(l){const t=(o=!!this.options.geolocation)=>{this._supportsGeolocation=o,l(o)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(o=>t(o.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),o=l.coords;return!!t&&(o.longitude<t.getWest()||o.longitude>t.getEast()||o.latitude<t.getSouth()||o.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new s.z("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
3003RROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.followUserLocation&&(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.z("geolocate",Object.assign({coords:l.coords,timestamp:l.timestamp},l.toJSON?{toJSON:l.toJSON.bind(l)}:{}))),this._finish()}}_updateCamera(l){const t=new s.aT(l.coords.longitude,l.coords.latitude),o=l.coords.accuracy,c=this._map.getBearing(),d=Object.assign({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(o),d,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new s.aT(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,t=s.cf(1,l._center.lat)*l.worldSize,o=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(l){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.z("error",{code:l.code,message:l.message,PERMISSION_DENIED:l.PERMISSION_DENIED,POSITION_UNAVAILABLE:l.POSITION_UNAVAILABLE,TIMEOUT:l.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const l=this.options.positionOptions.timeout;l&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},l))}_clearRequestTimeout(){this._requestTimeoutId!==void 0&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Xe("button","mapboxgl-ctrl-geolocate",this._container),Xe("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
3003se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Xe("div","mapboxgl-user-location"),this._dotElement.appendChild(Xe("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Xe("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new gr({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Xe("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new gr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.showButton||(this._container.style.display="none"),this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new s.z("trackuserlocationend")))})}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.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 s.z("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 s.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this._startRequestTimeout(),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._startRequestTimeout(),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}setFollowUserLocation(l){return this.options.followUserLocation=l??oo.followUserLocation,this.options.trackUserLocation&&this._watchState!=="OFF"&&(this.options.followUserLocation?this._watchState!=="BACKGROUND"&&this._watchState!=="BACKGROUND_ERROR"||(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.z("trackuserlocationstart"))):this._watchState!=="ACTIVE_LOCK"&&this._watchState!=="ACTIVE_E
3003RROR"||(this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this.fire(new s.z("trackuserlocationend")))),this}_addDeviceOrientationListener(){const l=()=>{const t="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(t,this._onDeviceOrientation)};typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:jp,ScaleControl:class{constructor(l={}){this.options=Object.assign({},vc,l),s.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,o=t._containerHeight/2,c=t._containerWidth/2-l/2,d=t.unproject([c,o]),p=t.unproject([c+l,o]),m=d.distanceTo(p);if(this.options.unit==="imperial"){const y=3.2808*m;y>5280?this._setScale(l,y/5280,"mile"):this._setScale(l,y,"foot")}else this.options.unit==="nautical"?this._setScale(l,m/1852,"nautical-mile"):m>=1e3?this._setScale(l,m/1e3,"kilometer"):this._setScale(l,m,"meter")}_setScale(l,t,o){this._map._requestDomTask(()=>{const c=(function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:(function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T})(y),m*y})(t),d=c/t;this._container.innerHTML=o!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:o}).format(c):`${c} ${Cu[o]}`,this._container.style.width=l*d+"px"})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:s.w("Full screen control 'container' must be a DOM element.")),s.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=Xe("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=Xe("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Xe("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",l)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:yh,Popup:class extends s.E{constructor(l){super(),this.options=Object.assign(Object.create(Wp),l),this._altitude=this.options.altitude,s.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new s.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new s.z("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=s.aT.convert(l),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(l){return this._altitude=l,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),o=document.createElement("body");let c;for(o.innerHTML=l;c=o.firstChild,c;
vendor: 4,264 bytes, line 3003
3003)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=Xe("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const o=this._closeButton=Xe("button","mapboxgl-popup-close-button",t);o.type="button",o.setAttribute("aria-label","Close popup"),o.innerHTML='<span aria-hidden="true">×</span>',o.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(l){return this._classList.add(l),this._updateClassList(),this}removeClassName(l){return this._classList.delete(l),this._updateClassList(),this}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){let t;return this._classList.delete(l)?t=!1:(this._classList.add(l),t=!0),this._updateClassList(),t}_onMouseEvent(l){this._update(l.point)}_getAnchor(l){if(this.options.anchor)return this.options.anchor;const t=this._map,o=this._container,c=this._pos;if(!t||!o||!c)return"bottom";const d=o.offsetWidth,p=o.offsetHeight,m=c.x<d/2,y=c.x>t.transform.width-d/2;if(c.y+l<p)return m?"top-left":y?"top-right":"top";if(c.y>t.transform.height-p){if(m)return"bottom-left";if(y)return"bottom-right"}return m?"left":y?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),l.className=t.join(" ")}_update(l){const t=this._map,o=this._content;if(!t||!this._lngLat&&!this._trackPointer||!o)return;let c=this._container;if(c||(c=this._container=Xe("div","mapboxgl-popup",t.getContainer()),this._tip=Xe("div","mapboxgl-popup-tip",c),c.appendChild(o)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=xc(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof s.P?l:t.project(this._lngLat,this._altitude),p=ml(this.options.offset),m=this._anchor=this._getAnchor(p.y),y=ml(this.options.offset,m),x=d.add(y).round();t._requestDomTask(()=>{this._container&&m&&(this._container.style.transform=`${Po[m]} translate(${x.x}px,${x.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=s.f5(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(V_);l&&l.focus()}_onClose(){this.remove()}_setOpacity(l){this._container&&(this._container.style.opacity=`${l}`),this._content&&(this._content.style.pointerEvents=l?"auto":"none")}},Marker:gr,Style:Vn,LngLat:s.aT,LngLatBounds:s.aI,Point:s.P,MercatorCoordinate:s.ae,FreeCameraOptions:Of,Evented:s.E,config:s.e,prewarm:s.f9,clearPrewarmedResources:s.f8,get accessToken(){return s.e.ACCESS_TOKEN},set accessToken(l){s.e.ACCESS_TOKEN=l},get baseApiUrl(){return s.e.API_URL},set baseApiUrl(l){s.e.API_URL=l},get workerCount(){return s.fi.workerCount},set workerCount(l){s.fi.workerCount=l},get maxParallelImageRequests(){return s.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){s.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){s.fh(l)},get workerUrl(){return s.fg.workerUrl},set workerUrl(l){s.fg.workerUrl=l},get workerClass(){return s.fg.workerClass},set workerClass(l){s.fg.workerClass=l},get workerParams(){return s.fg.workerParams},set workerParams(l){s.fg.workerParams=l},get dracoUrl(){return s.ff()},set dracoUrl(l){s.fe(l)},get meshoptUrl(){return s.fd()},set meshoptUrl(l){s.fc(l)},setNow:s.o.setNow,restoreNow:s.o.restoreNow}});var ve=W;return ve}))})(Jm)),Jm.exports}var yy,D1;function nh(){if(D1)return yy;D1=1,yy=L;var S=Object.prototype.hasOwnProperty;function L(){for(var V={},X=0;X<arguments.length;X++){var W=arguments[X];for(var ae in W)S.call(W,ae)&&(V[ae]=W[ae])}return V}return yy}var xy={exports:{}},z1;function s2(){return z1||(z1=1,(function(S,L){(function(){var V={};
3003S.exports=V,V.simpleFilter=function(X,W){return W.filter(function(ae){return V.test(X,ae)})},V.test=function(X,W){return V.match(X,W)!==null},V.match=function(X,W,ae){ae=ae||{};var ve=0,s=[],we=W.length,Pe=0,rt=0,ot=ae.pre||"",ke=ae.post||"",dt=ae.caseSensitive&&W||W.toLowerCase(),Be;X=ae.caseSensitive&&X||X.toLowerCase();for(var Xe=0;Xe<we;Xe++)Be=W[Xe],dt[Xe]===X[ve]?(Be=ot+Be+ke,ve+=1,rt+=1+rt):rt=0,Pe+=rt,s[s.length]=Be;return ve===X.length?(Pe=dt===X?1/0:Pe,{rendered:s.join(""),score:Pe}):null},V.filter=function(X,W,ae){return!W||W.length===0?[]:typeof X!="string"?W:(ae=ae||{},W.reduce(function(ve,s,we,Pe){var rt=s;ae.extract&&(rt=ae.extract(s));var ot=V.match(X,rt,ae);return ot!=null&&(ve[ve.length]={string:ot.rendered,score:ot.score,index:we,original:s}),ve},[]).sort(function(ve,s){var we=s.score-ve.score;return we||ve.index-s.index}))}})()})(xy)),xy.exports}var vy,O1;function a2(){if(O1)return vy;O1=1;var S=function(L){return this.component=L,this.items=[],this.active=0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,L.el.parentNode.insertBefore(this.wrapper,L.el.nextSibling),this};return S.prototype.show=function(){this.element.style.display="block"},S.prototype.hide=function(){this.element.style.display="none"},S.prototype.add=function(L){this.items.push(L)},S.prototype.clear=function(){this.items=[],this.active=0},S.prototype.isEmpty=function(){return!this.items.length},S.prototype.isVisible=function(){return this.element.style.display==="block"},S.prototype.draw=function(){if(this.element.innerHTML="",this.items.length===0){this.hide();return}for(var L=0;L<this.items.length;L++)this.drawItem(this.items[L],this.active===L);this.show()},S.prototype.drawItem=function(L,V){var X=document.createElement("li"),W=document.createElement("a");V&&(X.className+=" active"),W.innerHTML=L.string,X.appendChild(W),this.element.appendChild(X),X.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),X.addEventListener("mouseup",function(){this.handleMouseUp.call(this,L)}.bind(this))},S.prototype.handleMouseUp=function(L){this.selectingListItem=!1,this.component.value(L.original),this.clear(),this.draw()},S.prototype.move=function(L){this.active=L,this.draw()},S.prototype.previous=function(){this.move(this.active===0?this.items.length-1:this.active-1)},S.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},S.prototype.drawError=function(L){var V=document.createElement("li");V.innerHTML=L,this.element.appendChild(V),this.show()},vy=S,vy}var by,F1;function l2(){if(F1)return by;F1=1;var S=nh(),L=s2(),V=a2(),X=function(W,ae,ve){return ve=ve||{},this.options=S({minLength:2,limit:5,filter:!0,hideOnBlur:!0},ve),this.el=W,this.data=ae||[],this.list=new V(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(s){this.handleKeyUp(s.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(s){this.handleKeyDown(s)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(s){this.handlePaste(s)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};return X.prototype.handleKeyUp=function(W){W===40||W===38||W===27||W===13||W===9||this.handleInputChange(this.el.value)},X.prototype.handleKeyDown=function(W){switch(W.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&W.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next();break}},X.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},X.prototype.handlePaste=function(W){if(W.clipboardData)this.handleInputChange(W.clipboardData.getData("Text"));else{var ae=this;setTimeout(function(){ae.handleInputChange(W.target.value)},100)}},X.prototype.handleInputChange=function(W){if(this.query=this.normalize(W),this.list.clear(),this.query.length<this.options.minLength){this.list.draw();return}this.getCandidates(function(ae){for(var ve=0;ve<ae.length&&(this.list.add(ae[ve]),ve!==this.options.limit-1);ve++);this.list.draw()}.bind(this))},X.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},X.prototype.update=function(W){this.data=W,this.handleKeyUp()},X.prototype.clear=function(){this.data=[],this.list.clear()},X.prototype.normalize=function(W){return W=W.toLowerCase(),W},X.prototype.match=function(W,ae){return W.indexOf(ae)>-1},X.prototype.value=function(W){if(this.selected=W,this.el.value=this.getItemV
3003alue(W),document.createEvent){var ae=document.createEvent("HTMLEvents");ae.initEvent("change",!0,!1),this.el.dispatchEvent(ae)}else this.el.fireEvent("onchange")},X.prototype.getCandidates=function(W){var ae={pre:"<strong>",post:"</strong>",extract:function(s){return this.getItemValue(s)}.bind(this)},ve;this.options.filter?(ve=L.filter(this.query,this.data,ae),ve=ve.map(function(s){return{original:s.original,string:this.render(s.original,s.string)}}.bind(this))):ve=this.data.map(function(s){var we=this.render(s);return{original:s,string:we}}.bind(this)),W(ve)},X.prototype.getItemValue=function(W){return W},X.prototype.render=function(W,ae){if(ae)return ae;for(var ve=W.original?this.getItemValue(W.original):this.getItemValue(W),s=this.normalize(ve),we=s.lastIndexOf(this.query);we>-1;){var Pe=we+this.query.length;ve=ve.slice(0,we)+"<strong>"+ve.slice(we,Pe)+"</strong>"+ve.slice(Pe),we=s.slice(0,we).lastIndexOf(this.query)}return ve},X.prototype.renderError=function(W){this.list.drawError(W)},by=X,by}var wy,k1;function c2(){if(k1)return wy;k1=1;var S=l2();return wy=S,typeof window<"u"&&(window.Suggestions=S),wy}var Ty,B1;function u2(){if(B1)return Ty;B1=1;var S="Expected a function",L=NaN,V="[object Symbol]",X=/^\s+|\s+$/g,W=/^[-+]0x[0-9a-f]+$/i,ae=/^0b[01]+$/i,ve=/^0o[0-7]+$/i,s=parseInt,we=typeof Ml=="object"&&Ml&&Ml.Object===Object&&Ml,Pe=typeof self=="object"&&self&&self.Object===Object&&self,rt=we||Pe||Function("return this")(),ot=Object.prototype,ke=ot.toString,dt=Math.max,Be=Math.min,Xe=function(){return rt.Date.now()};function pe(He,yt,Tt){var Mt,li,ri,Vi,xi,Wt,_o=0,rn=!1,Ci=!1,Li=!0;if(typeof He!="function")throw new TypeError(S);yt=Qe(yt)||0,Ye(Tt)&&(rn=!!Tt.leading,Ci="maxWait"in Tt,ri=Ci?dt(Qe(Tt.maxWait)||0,yt):ri,Li="trailing"in Tt?!!Tt.trailing:Li);function sr(br){var nn=Mt,Ii=li;return Mt=li=void 0,_o=br,Vi=He.apply(Ii,nn),Vi}function go(br){return _o=br,xi=setTimeout(hn,yt),rn?sr(br):Vi}function Wn(br){var nn=br-Wt,Ii=br-_o,tr=yt-nn;return Ci?Be(tr,ri-Ii):tr}function Xn(br){var nn=br-Wt,Ii=br-_o;return Wt===void 0||nn>=yt||nn<0||Ci&&Ii>=ri}function hn(){var br=Xe();if(Xn(br))return Ui(br);xi=setTimeout(hn,Wn(br))}function Ui(br){return xi=void 0,Li&&Mt?sr(br):(Mt=li=void 0,Vi)}function In(){xi!==void 0&&clearTimeout(xi),_o=0,Mt=Wt=li=xi=void 0}function za(){return xi===void 0?Vi:Ui(Xe())}function Jo(){var br=Xe(),nn=Xn(br);if(Mt=arguments,li=this,Wt=br,nn){if(xi===void 0)return go(Wt);if(Ci)return xi=setTimeout(hn,yt),sr(Wt)}return xi===void 0&&(xi=setTimeout(hn,yt)),Vi}return Jo.cancel=In,Jo.flush=za,Jo}function Ye(He){var yt=typeof He;return!!He&&(yt=="object"||yt=="function")}function at(He){return!!He&&typeof He=="object"}function gt(He){return typeof He=="symbol"||at(He)&&ke.call(He)==V}function Qe(He){if(typeof He=="number")return He;if(gt(He))return L;if(Ye(He)){var yt=typeof He.valueOf=="function"?He.valueOf():He;He=Ye(yt)?yt+"":yt}if(typeof He!="string")return He===0?He:+He;He=He.replace(X,"");var Tt=ae.test(He);return Tt||ve.test(He)?s(He.slice(2),Tt?2:8):W.test(He)?L:+He}return Ty=pe,Ty}var Wm={exports:{}},N1;function h2(){if(N1)return Wm.exports;N1=1;var S=typeof Reflect=="object"?Reflect:null,L=S&&typeof S.apply=="function"?S.apply:function(He,yt,Tt){return Function.prototype.apply.call(He,yt,Tt)},V;S&&typeof S.ownKeys=="function"?V=S.ownKeys:Object.getOwnPropertySymbols?V=function(He){return Object.getOwnPropertyNames(He).concat(Object.getOwnPropertySymbols(He))}:V=function(He){return Object.getOwnPropertyNames(He)};function X(Qe){console&&console.warn&&console.warn(Qe)}var W=Number.isNaN||function(He){return He!==He};function ae(){ae.init.call(this)}Wm.exports=ae,Wm.exports.once=Ye,ae.EventEmitter=ae,ae.prototype._events=void 0,ae.prototype._eventsCount=0,ae.prototype._maxListeners=void 0;var ve=10;function s(Qe){if(typeof Qe!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof Qe)}Object.defineProperty(ae,"defaultMaxListeners",{enumerable:!0,get:function(){return ve},set:function(Qe){if(typeof Qe!="number"||Qe<0||W(Qe))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+Qe+".");ve=Qe}}),ae.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ae.prototype.setMaxListeners=function(He){if(typeof He!="number"||He<0||W(He))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+He+".");return this._maxListeners=He,this};function we(Qe){return Qe._maxListeners===void 0?ae.defaultMaxListeners:Qe._maxListeners}ae.prototype.getMaxListeners=function(){return we(this)},ae.prototype.emit=function(He){for(var yt=[],Tt=1;Tt<arguments.length;Tt++)yt.push(arguments[Tt]);var Mt=He==="error",li=this._events;if(li!==void 0)Mt=Mt&&li.error===void 0;else if(!Mt)return!1;if(Mt){var ri;if(yt.length>0&&(ri=yt[0]),ri instanceof Error)throw ri;var Vi=new Error("Unhandled error."+(ri?" ("+ri.message+")":""));throw Vi.context=ri,Vi}var xi=li[He];if(xi===void 0)return!1;if(typeof xi=="function")L(xi,this,yt);else for(var Wt=xi.length,_o=Be(xi,Wt),Tt=0;Tt<Wt;++Tt)L(_o[Tt],this,yt);return!0};function Pe(Qe,He,yt,Tt){var Mt,li,ri;if(s(yt),li=Qe._events,li===void 0?(li=Qe._events=Object.create(null),Qe._eventsCount=0):(li.newListener!==void 0&&(Qe.emit("newListener",He,yt.listener?yt.listener:yt),li=Qe._events),ri=li[He]),ri===void 0)ri=li[He]=yt,++Qe._eventsCount;else if(typeof ri=="function"?ri=li[He]=Tt?[yt,ri]:[ri,yt]:Tt?ri.unshift(yt):ri.push(yt),Mt=we(Qe),Mt>0&&ri.length>Mt&&!ri.warned){ri.warned=!0;var Vi=new Error("Possible EventEmitter memory leak detected. "+ri.length+" "+String(He)+" listeners added. Use emitter.setMaxListeners() to increase limit");Vi.name="MaxListenersExceededWarning",Vi.emitter=Qe,Vi.type=He,Vi.count=ri.length,X(Vi)}return Qe}ae.prototype.addListener=function(He,yt){return Pe(this,He,yt,!1)},ae.prototype.on=ae.prototype.addListener,ae.prototype.prependListener=function(He,yt){return Pe(this,He,yt,!0)};function rt(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ot(Qe,He,yt){var Tt={fired:!1,wrapFn:void 0,target:Qe,type:He,listener:yt},Mt=rt.bind(Tt);return Mt.listener=yt,Tt.wrapFn=Mt,Mt}ae.prototype.once=function(He,yt){return s(yt),this.on(He,ot(this,He,yt)),this},ae.prototype.prependOnceListener=function(He,yt){return s(yt),this.prependListener(He,ot(this,He,yt)),this},ae.prototype.removeListener=function(He,yt){var Tt,Mt,li,ri,Vi;if(s(yt),Mt=this._events,Mt===void 0)return this;if(Tt=Mt[He],Tt===void 0)return this;if(Tt===yt||Tt.listener===yt)--this._eventsCount===0?this._events=Object.create(null):(delete Mt[He],Mt.removeListener&&this.emit
3003("removeListener",He,Tt.listener||yt));else if(typeof Tt!="function"){for(li=-1,ri=Tt.length-1;ri>=0;ri--)if(Tt[ri]===yt||Tt[ri].listener===yt){Vi=Tt[ri].listener,li=ri;break}if(li<0)return this;li===0?Tt.shift():Xe(Tt,li),Tt.length===1&&(Mt[He]=Tt[0]),Mt.removeListener!==void 0&&this.emit("removeListener",He,Vi||yt)}return this},ae.prototype.off=ae.prototype.removeListener,ae.prototype.removeAllListeners=function(He){var yt,Tt,Mt;if(Tt=this._events,Tt===void 0)return this;if(Tt.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Tt[He]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete Tt[He]),this;if(arguments.length===0){var li=Object.keys(Tt),ri;for(Mt=0;Mt<li.length;++Mt)ri=li[Mt],ri!=="removeListener"&&this.removeAllListeners(ri);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(yt=Tt[He],typeof yt=="function")this.removeListener(He,yt);else if(yt!==void 0)for(Mt=yt.length-1;Mt>=0;Mt--)this.removeListener(He,yt[Mt]);return this};function ke(Qe,He,yt){var Tt=Qe._events;if(Tt===void 0)return[];var Mt=Tt[He];return Mt===void 0?[]:typeof Mt=="function"?yt?[Mt.listener||Mt]:[Mt]:yt?pe(Mt):Be(Mt,Mt.length)}ae.prototype.listeners=function(He){return ke(this,He,!0)},ae.prototype.rawListeners=function(He){return ke(this,He,!1)},ae.listenerCount=function(Qe,He){return typeof Qe.listenerCount=="function"?Qe.listenerCount(He):dt.call(Qe,He)},ae.prototype.listenerCount=dt;function dt(Qe){var He=this._events;if(He!==void 0){var yt=He[Qe];if(typeof yt=="function")return 1;if(yt!==void 0)return yt.length}return 0}ae.prototype.eventNames=function(){return this._eventsCount>0?V(this._events):[]};function Be(Qe,He){for(var yt=new Array(He),Tt=0;Tt<He;++Tt)yt[Tt]=Qe[Tt];return yt}function Xe(Qe,He){for(;He+1<Qe.length;He++)Qe[He]=Qe[He+1];Qe.pop()}function pe(Qe){for(var He=new Array(Qe.length),yt=0;yt<He.length;++yt)He[yt]=Qe[yt].listener||Qe[yt];return He}function Ye(Qe,He){return new Promise(function(yt,Tt){function Mt(ri){Qe.removeListener(He,li),Tt(ri)}function li(){typeof Qe.removeListener=="function"&&Qe.removeListener("error",Mt),yt([].slice.call(arguments))}gt(Qe,He,li,{once:!0}),He!=="error"&&at(Qe,Mt,{once:!0})})}function at(Qe,He,yt){typeof Qe.on=="function"&>(Qe,"error",He,yt)}function gt(Qe,He,yt,Tt){if(typeof Qe.on=="function")Tt.once?Qe.once(He,yt):Qe.on(He,yt);else if(typeof Qe.addEventListener=="function")Qe.addEventListener(He,function Mt(li){Tt.once&&Qe.removeEventListener(He,Mt),yt(li)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof Qe)}return Wm.exports}var Ey,V1;function d2(){return V1||(V1=1,Ey={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}),Ey}var Sy,U1;function f2(){if(U1)return Sy;U1=1;function S(X){var W=X.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return W?{key:W[1],value:W[2]}:null}function L(X){var W=X.match(/<?([^>]*)>(.*)/);if(!W)return null;var ae=W[1],ve=W[2].split(";"),s=null,we=ve.reduce(function(Pe,rt){var ot=S(rt);return ot?ot.key==="rel"?(s||(s=ot.value),Pe):(Pe[ot.key]=ot.value,Pe):Pe},{});return s?{url:ae,rel:s,params:we}:null}function V(X){return X?X.split(/,\s*</).reduce(function(W,ae){var ve=L(ae);if(!ve)return W;var s=ve.rel.split(/\s+/);return s.forEach(function(we){W[we]||(W[we]={url:ve.url,params:ve.params})}),W},{}):{}}return Sy=V,Sy}var Iy,j1;function p2(){if(j1)return Iy;j1=1;var S=f2();function L(V,X){this.request=V,this.headers=X.headers,this.rawBody=X.body,this.statusCode=X.statusCode;try{this.body=JSON.parse(X.body||"{}")}catch{this.body=X.body}this.links=S(this.headers.link)}return L.prototype.hasNextPage=function(){return!!this.links.next},L.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},Iy=L,Iy}var Ay,G1;function r_(){return G1||(G1=1,Ay={API_ORIGIN:"https://api.mapbox.com",EVENT_PROGRESS_DOWNLOAD:"downloadProgress",EVENT_PROGRESS_UPLOAD:"uploadProgress",EVENT_ERROR:"error",EVENT_RESPONSE:"response",ERROR_HTTP:"HttpError",ERROR_REQUEST_ABORTED:"RequestAbortedError"}),Ay}var My,q1;
3003function m2(){if(q1)return My;q1=1;var S=r_();function L(V){var X=V.type||S.ERROR_HTTP,W;if(V.body)try{W=JSON.parse(V.body)}catch{W=V.body}else W=null;var ae=V.message||null;ae||(typeof W=="string"?ae=W:W&&typeof W.message=="string"?ae=W.message:X===S.ERROR_REQUEST_ABORTED&&(ae="Request aborted")),this.message=ae,this.type=X,this.statusCode=V.statusCode||null,this.request=V.request,this.body=W}return My=L,My}var Cy,$1;function _2(){if($1)return Cy;$1=1;function S(V){var X=V.indexOf(":"),W=V.substring(0,X).trim().toLowerCase(),ae=V.substring(X+1).trim();return{name:W,value:ae}}function L(V){var X={};return V&&V.trim().split(/[\r|\n]+/).forEach(function(W){var ae=S(W);X[ae.name]=ae.value}),X}return Cy=L,Cy}var Py,H1;function g2(){if(H1)return Py;H1=1;var S=p2(),L=m2(),V=r_(),X=_2(),W={};function ae(ot){var ke=W[ot.id];ke&&(ke.abort(),delete W[ot.id])}function ve(ot,ke){return new S(ot,{body:ke.response,headers:X(ke.getAllResponseHeaders()),statusCode:ke.status})}function s(ot){var ke=ot.total,dt=ot.loaded,Be=100*dt/ke;return{total:ke,transferred:dt,percent:Be}}function we(ot,ke){return new Promise(function(dt,Be){ke.onprogress=function(Ye){ot.emitter.emit(V.EVENT_PROGRESS_DOWNLOAD,s(Ye))};var Xe=ot.file;Xe&&(ke.upload.onprogress=function(Ye){ot.emitter.emit(V.EVENT_PROGRESS_UPLOAD,s(Ye))}),ke.onerror=function(Ye){Be(Ye)},ke.onabort=function(){var Ye=new L({request:ot,type:V.ERROR_REQUEST_ABORTED});Be(Ye)},ke.onload=function(){if(delete W[ot.id],ke.status<200||ke.status>=400){var Ye=new L({request:ot,body:ke.response,statusCode:ke.status});Be(Ye);return}dt(ke)};var pe=ot.body;typeof pe=="string"?ke.send(pe):pe?ke.send(JSON.stringify(pe)):Xe?ke.send(Xe):ke.send(),W[ot.id]=ke}).then(function(dt){return ve(ot,dt)})}function Pe(ot,ke){var dt=ot.url(ke),Be=new window.XMLHttpRequest;return Be.open(ot.method,dt),Object.keys(ot.headers).forEach(function(Xe){Be.setRequestHeader(Xe,ot.headers[Xe])}),Be}function rt(ot){return Promise.resolve().then(function(){var ke=Pe(ot,ot.client.accessToken);return we(ot,ke)})}return Py={browserAbort:ae,sendRequestXhr:we,browserSend:rt,createRequestXhr:Pe},Py}var bf={exports:{}};var y2=bf.exports,Z1;function x2(){return Z1||(Z1=1,(function(S,L){(function(V){var X=L,W=S&&S.exports==X&&S,ae=typeof Ml=="object"&&Ml;(ae.global===ae||ae.window===ae)&&(V=ae);var ve=function(Be){this.message=Be};ve.prototype=new Error,ve.prototype.name="InvalidCharacterError";var s=function(Be){throw new ve(Be)},we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pe=/[\t\n\f\r ]/g,rt=function(Be){Be=String(Be).replace(Pe,"");var Xe=Be.length;Xe%4==0&&(Be=Be.replace(/==?$/,""),Xe=Be.length),(Xe%4==1||/[^+a-zA-Z0-9/]/.test(Be))&&s("Invalid character: the string to be decoded is not correctly encoded.");for(var pe=0,Ye,at,gt="",Qe=-1;++Qe<Xe;)at=we.indexOf(Be.charAt(Qe)),Ye=pe%4?Ye*64+at:at,pe++%4&&(gt+=String.fromCharCode(255&Ye>>(-2*pe&6)));return gt},ot=function(Be){Be=String(Be),/[^\0-\xFF]/.test(Be)&&s("The string to be encoded contains characters outside of the Latin1 range.");for(var Xe=Be.length%3,pe="",Ye=-1,at,gt,Qe,He,yt=Be.length-Xe;++Ye<yt;)at=Be.charCodeAt(Ye)<<16,gt=Be.charCodeAt(++Ye)<<8,Qe=Be.charCodeAt(++Ye),He=at+gt+Qe,pe+=we.charAt(He>>18&63)+we.charAt(He>>12&63)+we.charAt(He>>6&63)+we.charAt(He&63);return Xe==2?(at=Be.charCodeAt(Ye)<<8,gt=Be.charCodeAt(++Ye),He=at+gt,pe+=we.charAt(He>>10)+we.charAt(He>>4&63)+we.charAt(He<<2&63)+"="):Xe==1&&(He=Be.charCodeAt(Ye),pe+=we.charAt(He>>2)+we.charAt(He<<4&63)+"=="),pe},ke={encode:ot,decode:rt,version:"0.1.0"};if(X&&!X.nodeType)if(W)W.exports=ke;else for(var dt in ke)ke.hasOwnProperty(dt)&&(X[dt]=ke[dt]);else V.base64=ke})(y2)})(bf,bf.exports)),bf.exports}var Ry,W1;function Rw(){if(W1)return Ry;W1=1;var S=x2(),L={};function V(ae){if(L[ae])return L[ae];var ve=ae.split("."),s=ve[0],we=ve[1];if(!we)throw new Error("Invalid token");var Pe=X(we),rt={usage:s,user:Pe.u};return W(Pe,"a")&&(rt.authorization=Pe.a),W(Pe,"exp")&&(rt.expires=Pe.exp*1e3),W(Pe,"iat")&&(rt.created=Pe.iat*1e3),W(Pe,"scopes")&&(rt.scopes=Pe.scopes),W(Pe,"client")&&(rt.client=Pe.client),W(Pe,"ll")&&(rt.lastLogin=Pe.ll),W(Pe,"iu")&&(rt.impersonator=Pe.iu),L[ae]=rt,rt}function X(ae){try{return JSON.parse(S.decode(ae))}catch{throw new Error("Invalid token")}}function W(ae,ve){return Object.prototype.hasOwnProperty.call(ae,ve)}return Ry=V,Ry}var Ly={exports:{}},X1;function v2(){return X1||(X1=1,(function(S){var L=Object.prototype.hasOwnProperty,V="~";function X(){}Object.create&&(X.prototype=Object.create(null),new X().__proto__||(V=!1));function W(we,Pe,rt){this.fn=we,this.context=Pe,this.once=rt||!1}function ae(we,Pe,rt,ot,ke){if(typeof rt!="function")throw new TypeError("The listener must be a function");var dt=new W(rt,ot||we,ke),Be=V?V+Pe:Pe;return we._events[Be]?we._events[Be].fn?we._events[Be]=[we._events[Be],dt]:we._events[Be].push(dt):(we._events[Be]=dt,we._eventsCount++),we}function ve(we,Pe){--we._eventsCount===0?we._events=new X:delete we._events[Pe]}function s(){this._events=new X,this._eventsCount=0}s.prototype.eventNames=function(){var Pe=[],rt,ot;if(this._eventsCount===0)return Pe;for(ot in rt=this._events)L.call(rt,ot)&&Pe.push(V?ot.slice(1):ot);return Object.getOwnPropertySymbols?Pe.concat(Object.getOwnPropertySymbols(rt)):Pe},s.prototype.listeners=function(Pe){var rt=V?V+Pe:Pe,ot=this._events[rt];if(!ot)return[];if(ot.fn)return[ot.fn];for(var ke=0,dt=ot.length,Be=new Array(dt);ke<dt;ke++)Be[ke]=ot[ke].fn;return Be},s.prototype.listenerCount=function(Pe){var rt=V?V+Pe:Pe,ot=this._events[rt];return ot?ot.fn?1:ot.length:0},s.prototype.emit=function(Pe,rt,ot,ke,dt,Be){var Xe=V?V+Pe:Pe;if(!this._events[Xe])return!1;var pe=this._events[Xe],Ye=arguments.length,at,gt;if(pe.fn){switch(pe.once&&this.removeListener(Pe,pe.fn,void 0,!0),Ye){case 1:return pe.fn.call(pe.context),!0;case 2:return pe.fn.call(pe.context,rt),!0;case 3:return pe.fn.call(pe.context,rt,ot),!0;case 4:return pe.fn.call(pe.context,rt,ot,ke),!0;case 5:return pe.fn.call(pe.context,rt,ot,ke,dt),!0;case 6:return pe.fn.call(pe.context,rt,ot,ke,dt,Be),!0}for(gt=1,at=new Array(Ye-1);gt<Ye;gt++)at[gt-1]=arguments[gt];
3003pe.fn.apply(pe.context,at)}else{var Qe=pe.length,He;for(gt=0;gt<Qe;gt++)switch(pe[gt].once&&this.removeListener(Pe,pe[gt].fn,void 0,!0),Ye){case 1:pe[gt].fn.call(pe[gt].context);break;case 2:pe[gt].fn.call(pe[gt].context,rt);break;case 3:pe[gt].fn.call(pe[gt].context,rt,ot);break;case 4:pe[gt].fn.call(pe[gt].context,rt,ot,ke);break;default:if(!at)for(He=1,at=new Array(Ye-1);He<Ye;He++)at[He-1]=arguments[He];pe[gt].fn.apply(pe[gt].context,at)}}return!0},s.prototype.on=function(Pe,rt,ot){return ae(this,Pe,rt,ot,!1)},s.prototype.once=function(Pe,rt,ot){return ae(this,Pe,rt,ot,!0)},s.prototype.removeListener=function(Pe,rt,ot,ke){var dt=V?V+Pe:Pe;if(!this._events[dt])return this;if(!rt)return ve(this,dt),this;var Be=this._events[dt];if(Be.fn)Be.fn===rt&&(!ke||Be.once)&&(!ot||Be.context===ot)&&ve(this,dt);else{for(var Xe=0,pe=[],Ye=Be.length;Xe<Ye;Xe++)(Be[Xe].fn!==rt||ke&&!Be[Xe].once||ot&&Be[Xe].context!==ot)&&pe.push(Be[Xe]);pe.length?this._events[dt]=pe.length===1?pe[0]:pe:ve(this,dt)}return this},s.prototype.removeAllListeners=function(Pe){var rt;return Pe?(rt=V?V+Pe:Pe,this._events[rt]&&ve(this,rt)):(this._events=new X,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=V,s.EventEmitter=s,S.exports=s})(Ly)),Ly.exports}var Dy,Y1;function b2(){if(Y1)return Dy;Y1=1;function S(ve){return ve.map(encodeURIComponent).join(",")}function L(ve){return Array.isArray(ve)?S(ve):encodeURIComponent(String(ve))}function V(ve,s,we){if(we===!1||we===null)return ve;var Pe=/\?/.test(ve)?"&":"?",rt=encodeURIComponent(s);return we!==void 0&&we!==""&&we!==!0&&(rt+="="+L(we)),""+ve+Pe+rt}function X(ve,s){if(!s)return ve;var we=ve;return Object.keys(s).forEach(function(Pe){var rt=s[Pe];rt!==void 0&&(Array.isArray(rt)&&(rt=rt.filter(function(ot){return ot!=null}).join(",")),we=V(we,Pe,rt))}),we}function W(ve,s){if(!s||ve.slice(0,4)==="http")return ve;var we=ve[0]==="/"?"":"/";return""+s.replace(/\/$/,"")+we+ve}function ae(ve,s){return s?ve.replace(/\/:([a-zA-Z0-9]+)/g,function(we,Pe){var rt=s[Pe];if(rt===void 0)throw new Error("Unspecified route parameter "+Pe);var ot=L(rt);return"/"+ot}):ve}return Dy={appendQueryObject:X,appendQueryParam:V,prependOrigin:W,interpolateRouteParams:ae},Dy}var zy,K1;function w2(){if(K1)return zy;K1=1;var S=Rw(),L=nh(),V=v2(),X=b2(),W=r_(),ae=1;function ve(s,we){if(!s)throw new Error("MapiRequest requires a client");if(!we||!we.path||!we.method)throw new Error("MapiRequest requires an options object with path and method properties");var Pe={};we.body&&(Pe["content-type"]="application/json");var rt=L(Pe,we.headers),ot=Object.keys(rt).reduce(function(ke,dt){return ke[dt.toLowerCase()]=rt[dt],ke},{});this.id=ae++,this._options=we,this.emitter=new V,this.client=s,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=we.path,this.method=we.method,this.origin=we.origin||s.origin,this.query=we.query||{},this.params=we.params||{},this.body=we.body||null,this.file=we.file||null,this.encoding=we.encoding||"utf8",this.sendFileAs=we.sendFileAs||null,this.headers=ot}return ve.prototype.url=function(we){var Pe=X.prependOrigin(this.path,this.origin);Pe=X.appendQueryObject(Pe,this.query);var rt=this.params,ot=we??this.client.accessToken;if(ot){Pe=X.appendQueryParam(Pe,"access_token",ot);var ke=S(ot).user;rt=L({ownerId:ke},rt)}return Pe=X.interpolateRouteParams(Pe,rt),Pe},ve.prototype.send=function(){var we=this;if(we.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return we.sent=!0,we.client.sendRequest(we).then(function(Pe){return we.response=Pe,we.emitter.emit(W.EVENT_RESPONSE,Pe),Pe},function(Pe){throw we.error=Pe,we.emitter.emit(W.EVENT_ERROR,Pe),Pe})},ve.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),!(this.response||this.error||this.aborted)&&(this.aborted=!0,this.client.abortRequest(this))},ve.prototype.eachPage=function(we){var Pe=this;function rt(dt){function Be(){delete Pe._nextPageRequest;var Xe=dt.nextPage();Xe&&(Pe._nextPageRequest=Xe,ke(Xe))}we(null,dt,Be)}function ot(dt){we(dt,null,function(){})}function ke(dt){dt.send().then(rt,ot)}ke(this)},ve.prototype.clone=function(){return this._extend()},ve.prototype._extend=function(we){var Pe=L(this._options,we);return new ve(this.client,Pe)},zy=ve,zy}var Oy,J1;function Lw(){if(J1)return Oy;J1=1;var S=Rw(),L=w2(),V=r_();function X(W){if(!W||!W.accessToken)throw new Error("Cannot create a client without an access token");S(W.accessToken),this.accessToken=W.accessToken,this.origin=W.origin||V.API_ORIGIN}return X.prototype.createRequest=function(ae){return new L(this,ae)},Oy=X,Oy}var Fy,Q1;function Dw(){if(Q1)return Fy;Q1=1;var S=g2(),L=Lw();function V(W){L.call(this,W)}V.prototype=Object.create(L.prototype),V.prototype.constructor=V,V.prototype.sendRequest=S.browserSend,V.prototype.abortRequest=S.browserAbort;function X(W){return new V(W)}return Fy=X,Fy}var ky,ew;
3003function T2(){if(ew)return ky;ew=1;var S=Dw();return ky=S,ky}var By,tw;function E2(){if(tw)return By;tw=1;var S=Object.prototype.toString;return By=function(L){var V;return S.call(L)==="[object Object]"&&(V=Object.getPrototypeOf(L),V===null||V===Object.getPrototypeOf({}))},By}var Ny,iw;function S2(){if(iw)return Ny;iw=1;var S=E2(),L=nh(),V="value",X=` 3004 `,W={};W.assert=function(Be,Xe){return Xe=Xe||{},function(pe){var Ye=ve(Be,pe);if(Ye){var at=s(Ye,Xe);throw Xe.apiName&&(at=Xe.apiName+": "+at),new Error(at)}}},W.shape=function(Xe){var pe=dt(Xe);return function(at){var gt=ve(W.plainObject,at);if(gt)return gt;for(var Qe,He,yt=[],Tt=0;Tt<pe.length;Tt++)Qe=pe[Tt].key,He=pe[Tt].value,gt=ve(He,at[Qe]),gt&&yt.push([Qe].concat(gt));return yt.length<2?yt[0]:function(Mt){yt=yt.map(function(Vi){var xi=Vi[0],Wt=s(Vi,Mt).split(` 3005`).join(X);return"- "+xi+": "+Wt});var li=Mt.path.join("."),ri=li===V?"":" of "+li;return"The following properties"+ri+" have invalid values:"+X+yt.join(X)}}},W.strictShape=function(Xe){var pe=W.shape(Xe);return function(at){var gt=pe(at);if(gt)return gt;var Qe=Object.keys(at).reduce(function(He,yt){return Xe[yt]===void 0&&He.push(yt),He},[]);if(Qe.length!==0)return function(){return"The following keys are invalid: "+Qe.join(", ")}}},W.arrayOf=function(Xe){return ae(Xe)},W.tuple=function(){var Xe=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return ae(Xe)};function ae(Be){var Xe=Array.isArray(Be),pe=function(Ye){return Xe?Be[Ye]:Be};return function(at){var gt=ve(W.plainArray,at);if(gt)return gt;if(Xe&&at.length!==Be.length)return"an array with "+Be.length+" items";for(var Qe=0;Qe<at.length;Qe++)if(gt=ve(pe(Qe),at[Qe]),gt)return[Qe].concat(gt)}}W.required=function(Xe){function pe(Ye){return Ye==null?function(at){return ot(at,ke(at.path)?"cannot be undefined/null.":"is required.")}:Xe.apply(this,arguments)}return pe.__required=!0,pe},W.oneOfType=function(){var Xe=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return function(Ye){var at=Xe.map(function(gt){return ve(gt,Ye)}).filter(Boolean);if(at.length===Xe.length)return at.every(function(gt){return gt.length===1&&typeof gt[0]=="string"})?we(at.map(function(gt){return gt[0]})):at.reduce(function(gt,Qe){return Qe.length>gt.length?Qe:gt})}},W.equal=function(Xe){return function(Ye){if(Ye!==Xe)return JSON.stringify(Xe)}},W.oneOf=function(){var Xe=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments),pe=Xe.map(function(Ye){return W.equal(Ye)});return W.oneOfType.apply(this,pe)},W.range=function(Xe){var pe=Xe[0],Ye=Xe[1];return function(gt){var Qe=ve(W.number,gt);if(Qe||gt<pe||gt>Ye)return"number between "+pe+" & "+Ye+" (inclusive)"}},W.any=function(){},W.boolean=function(Xe){if(typeof Xe!="boolean")return"boolean"},W.number=function(Xe){if(typeof Xe!="number")return"number"},W.plainArray=function(Xe){if(!Array.isArray(Xe))return"array"},W.plainObject=function(Xe){if(!S(Xe))return"object"},W.string=function(Xe){if(typeof Xe!="string")return"string"},W.func=function(Xe){if(typeof Xe!="function")return"function"};function ve(Be,Xe){if(!(Xe==null&&!Be.hasOwnProperty("__required"))){var pe=Be(Xe);if(pe)return Array.isArray(pe)?pe:[pe]}}function s(Be,Xe){var pe=Be.length,Ye=Be[pe-1],at=Be.slice(0,pe-1);return at.length===0&&(at=[V]),Xe=L(Xe,{path:at}),typeof Ye=="function"?Ye(Xe):ot(Xe,Pe(Ye))}function we(Be){return Be.length<2?Be[0]:Be.length===2?Be.join(" or "):Be.slice(0,-1).join(", ")+", or "+Be.slice(-1)}function Pe(Be){return"must be "+rt(Be)+"."}function rt(Be){return/^an? /.test(Be)?Be:/^[aeiou]/i.test(Be)?"an "+Be:/^[a-z]/i.test(Be)?"a "+Be:Be}function ot(Be,Xe){var pe=ke(Be.path),Ye=Be.path.join(".")+" "+Xe,at=pe?"Item at position ":"";return at+Ye}function ke(Be){return typeof Be[Be.length-1]=="number"||typeof Be[0]=="number"}function dt(Be){return Object.keys(Be||{}).map(function(Xe){return{key:Xe,value:Be[Xe]}})}return W.validate=ve,W.processMessage=s,Ny=W,Ny}var Vy,rw;function I2(){if(rw)return Vy;rw=1;var S=nh(),L=S2();function V(ve){if(typeof window<"u")return ve instanceof Ml.Blob||ve instanceof Ml.ArrayBuffer?void 0:"Blob or ArrayBuffer";if(!(typeof ve=="string"||ve.pipe!==void 0))return"Filename or Readable stream"}function X(ve,s){return L.assert(L.strictShape(ve),s)}function W(ve){var s="date";if(typeof ve=="boolean")return s;try{var we=new Date(ve);if(we.getTime&&isNaN(we.getTime()))return s}catch{return s}}function ae(ve){return L.tuple(L.number,L.number)(ve)}return Vy=S(L,{file:V,date:W,coordinates:ae,assertShape:X}),Vy}var Uy,nw;
3005function A2(){if(nw)return Uy;nw=1;function S(L,V){var X=function(W,ae){return V.indexOf(W)!==-1&&ae!==void 0};return typeof V=="function"&&(X=V),Object.keys(L).filter(function(W){return X(W,L[W])}).reduce(function(W,ae){return W[ae]=L[ae],W},{})}return Uy=S,Uy}var jy,ow;function M2(){if(ow)return jy;ow=1;function S(L,V){return Object.keys(L).reduce(function(X,W){return X[W]=V(W,L[W]),X},{})}return jy=S,jy}var Gy,sw;function C2(){if(sw)return Gy;sw=1;var S=M2();function L(V){return S(V,function(X,W){return typeof W=="boolean"?JSON.stringify(W):W})}return Gy=L,Gy}var qy,aw;function P2(){if(aw)return qy;aw=1;var S=Lw(),L=Dw();function V(X){return function(W){var ae;S.prototype.isPrototypeOf(W)?ae=W:ae=L(W);var ve=Object.create(X);return ve.client=ae,ve}}return qy=V,qy}var $y,lw;function R2(){if(lw)return $y;lw=1;var S=nh(),L=I2(),V=A2(),X=C2(),W=P2(),ae={},ve=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];return ae.forwardGeocode=function(s){L.assertShape({query:L.required(L.string),mode:L.oneOf("mapbox.places","mapbox.places-permanent"),countries:L.arrayOf(L.string),proximity:L.oneOf(L.coordinates,"ip"),types:L.arrayOf(L.oneOf(ve)),autocomplete:L.boolean,bbox:L.arrayOf(L.number),limit:L.number,language:L.arrayOf(L.string),routing:L.boolean,fuzzyMatch:L.boolean,worldview:L.string,
3005session_token:L.string})(s),s.mode=s.mode||"mapbox.places";var we=X(S({country:s.countries},V(s,["proximity","types","autocomplete","bbox","limit","language","routing","fuzzyMatch","worldview","session_token"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:V(s,["mode","query"]),query:we})},ae.reverseGeocode=function(s){L.assertShape({query:L.required(L.coordinates),mode:L.oneOf("mapbox.places","mapbox.places-permanent"),countries:L.arrayOf(L.string),types:L.arrayOf(L.oneOf(ve)),bbox:L.arrayOf(L.number),limit:L.number,language:L.arrayOf(L.string),reverseMode:L.oneOf("distance","score"),routing:L.boolean,worldview:L.string,session_token:L.string})(s),s.mode=s.mode||"mapbox.places";var we=X(S({country:s.countries},V(s,["country","types","bbox","limit","language","reverseMode","routing","worldview","session_token"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:V(s,["mode","query"]),query:we})},$y=W(ae),$y}let L2="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",zw=S=>crypto.getRandomValues(new Uint8Array(S)),Ow=(S,L,V)=>{let X=(2<<Math.log(S.length-1)/Math.LN2)-1,W=-~(1.6*X*L/S.length);return(ae=L)=>{let ve="";for(;;){let s=V(W),we=W|0;for(;we--;)if(ve+=S[s[we]&X]||"",ve.length===ae)return ve}}},D2=(S,L=21)=>Ow(S,L,zw),z2=(S=21)=>crypto.getRandomValues(new Uint8Array(S)).reduce((L,V)=>(V&=63,V<36?L+=V.toString(36):V<62?L+=(V-26).toString(36).toUpperCase():V>62?L+="-":L+="_",L),"");const O2=Object.freeze(Object.defineProperty({__proto__:null,customAlphabet:D2,customRandom:Ow,nanoid:z2,random:zw,urlAlphabet:L2},Symbol.toStringTag,{value:"Module"})),F2=n2(O2);var Hy,cw;function k2(){if(cw)return Hy;cw=1;var S=F2.nanoid;function L(V){this.origin=V.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=V.accessToken,this.version="0.3.0",this.pluginSessionID=this.generateSessionID(),this.sessionIncrementer=0,this.userAgent=this.getUserAgent(),this.options=V,this.send=this.send.bind(this),this.countries=V.countries?V.countries.split(","):null,this.types=V.types?V.types.split(","):null,this.bbox=V.bbox?V.bbox:null,this.language=V.language?V.language.split(","):null,this.limit=V.limit?+V.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(V),this.eventQueue=new Array,this.flushInterval=V.flushInterval||1e3,this.maxQueueSize=V.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}return L.prototype={select:function(V,X){var W=this.getEventPayload("search.select",X,{selectedFeature:V});if(W&&!(W.resultIndex===this.lastSentIndex&&W.queryString===this.lastSentInput||W.resultIndex==-1))return this.lastSentIndex=W.resultIndex,this.lastSentInput=W.queryString,this.push(W)},start:function(V){var X=this.getEventPayload("search.start",V);if(X)return this.push(X)},keyevent:function(V,X){if(V.key&&!(V.metaKey||[9,27,37,39,13,38,40].indexOf(V.keyCode)!==-1)){var W=this.getEventPayload("search.keystroke",X,{key:V.key});if(W)return this.push(W)}},send:function(V,X){if(!this.enableEventLogging)return X?X():void 0;var W=this.getRequestOptions(V);this.request(W,function(ae){if(ae)return this.handleError(ae,X);if(X)return X()}.bind(this))},getRequestOptions:function(V){Array.isArray(V)||(V=[V]);var X={method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(V)};return X},getEventPayload:function(V,X,W={}){if(V==="search.select"&&!W.selectedFeature||V==="search.keystroke"&&!W.key)return null;var ae;if(!X.options.proximity)ae=null;else if(typeof X.options.proximity=="object")ae=[X.options.proximity.longitude,X.options.proximity.latitude];else if(X.options.proximity==="ip"){var ve=X._headers?X._headers["ip-proximity"]:null;ve&&typeof ve=="string"?ae=ve.split(",").map(parseFloat):ae=[999,999]}else ae=X.options.proximity;var s=X._map?X._map.getZoom():void 0,we={event:V,version:this.getEventSchemaVersion(V),created:+new Date,sessionIdentifier:this.getSessionId(),country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:X.options.autocomplete,fuzzyMatch:X.options.fuzzyMatch,proximity:ae,limit:X.options.limit,routing:X.options.routing,worldview:X.options.worldview,mapZoom:s,keyboardLocale:this.locale};if(V==="search.select"?we.queryString=X.inputString:V!="search.select"&&X._inputEl?we.queryString=X._inputEl.value:we.queryString=X.inputString,["search.keystroke","search.select"].includes(V)&&(we.path="geocoding/v5/mapbox.places"),V==="search.keystroke"&&W.key)we.lastAction=W.key;else if(V==="search.select"&&W.selectedFeature){var Pe=W.selectedFeature,rt=this.getSelectedIndex(Pe,X);
3005if(we.resultIndex=rt,we.resultPlaceName=Pe.place_name,we.resultId=Pe.id,Pe.properties&&(we.resultMapboxId=Pe.properties.mapbox_id),X._typeahead){var ot=X._typeahead.data;ot&&ot.length>0&&(we.suggestionIds=this.getSuggestionIds(ot),we.suggestionNames=this.getSuggestionNames(ot),we.suggestionTypes=this.getSuggestionTypes(ot),we.suggestionSources=this.getSuggestionSources(ot))}}return this.validatePayload(we)?we:null},request:function(V,X){var W=new XMLHttpRequest;W.onreadystatechange=function(){if(this.readyState==4)return this.status==204?X(null):X(this.statusText)},W.open(V.method,V.host+"/"+V.path,!0);for(var ae in V.headers){var ve=V.headers[ae];W.setRequestHeader(ae,ve)}W.send(V.body)},handleError:function(V,X){if(X)return X(V)},generateSessionID:function(){return S()},getSessionId:function(){return this.pluginSessionID+"."+this.sessionIncrementer},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(V,X){if(X._typeahead){var W=X._typeahead.data,ae=V.id,ve=W.map(function(we){return we.id}),s=ve.indexOf(ae);return s}},getSuggestionIds:function(V){return V.map(function(X){return X.properties?X.properties.mapbox_id||"":X.id||""})},getSuggestionNames:function(V){return V.map(function(X){return X.place_name||""})},getSuggestionTypes:function(V){return V.map(function(X){return X.place_type&&Array.isArray(X.place_type)&&X.place_type[0]||""})},getSuggestionSources:function(V){return V.map(function(X){return X._source||""})},getEventSchemaVersion:function(V){return["search.keystroke","search.select"].includes(V)?"2.2":"2.0"},validatePayload:function(V){if(!V||!V.event)return!1;var X=["event","created","sessionIdentifier","queryString"],W=["event","created","sessionIdentifier","queryString","lastAction"],ae=["event","created","sessionIdentifier","queryString","resultIndex","path","suggestionIds"],ve=V.event;return ve==="search.start"?this.objectHasRequiredProps(V,X):ve==="search.keystroke"?this.objectHasRequiredProps(V,W):ve==="search.select"?this.objectHasRequiredProps(V,ae):!0},objectHasRequiredProps:function(V,X){return X.every(function(W){return W==="queryString"?typeof V[W]=="string"&&V[W].length>0:V[W]!==void 0})},shouldEnableLogging:function(V){return!(V.enableEventLogging===!1||V.origin&&V.origin!=="https://api.mapbox.com")},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(V,X){this.eventQueue.push(V),(this.eventQueue.length>=this.maxQueueSize||X)&&this.flush()},remove:function(){this.flush()}},Hy=L,Hy}var Zy,uw;function B2(){if(uw)return Zy;uw=1;var S={de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"××פש",ja:"ãµã¼ã",lv:"MeklÄt",pt:"Procurar",sr:"ÐÑеÑÑага",zh:"æç´¢",cs:"VyhledávánÃ",hu:"Keresés",ka:"á«áááá",nb:"Søke",sk:"Vyhľadávanie",th:"à¸à¹à¸à¸«à¸²",fi:"Hae",is:"Leita",ko:"ìì",pl:"Szukaj",sl:"Iskanje",fa:"جستجÙ",ru:"ÐоиÑк"};return Zy={placeholder:S},Zy}var Qm={exports:{}},N2=Qm.exports,hw;function V2(){return hw||(hw=1,(function(S){(function(L,V,X){S.exports?S.exports=X():L[V]=X()})(N2,"subtag",function(){var L="",V=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function X(we){return we.match(V)||[]}function W(we){return X(we).filter(function(Pe,rt){return Pe&&rt})}function ae(we){return we=X(we),{language:we[1]||L,extlang:we[2]||L,script:we[3]||L,region:we[4]||L}}function ve(we,Pe,rt){Object.defineProperty(we,Pe,{value:rt,enumerable:!0})}function s(we,Pe,rt){function ot(ke){return X(ke)[we]||L}ve(ot,"pattern",Pe),ve(ae,rt,ot)}return s(1,/^[a-zA-Z]{2,3}$/,"language"),s(2,/^[a-zA-Z]{3}$/,"extlang"),s(3,/^[a-zA-Z]{4}$/,"script"),s(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),ve(ae,"split",W),ae})})(Qm)),Qm.exports}var Wy,dw;function U2(){if(dw)return Wy;dw=1;function S(){}return S.prototype={isSupport:function(){return!!window.navigator.geolocation},getCurrentPosition:function(){const L={enableHighAccuracy:!0};return new Promise(function(V,X){window.navigator.geolocation.getCurrentPosition(V,X,L)})}},Wy=S,Wy}var Xy,fw;function j2(){if(fw)return Xy;fw=1;function S(X,W){const ae=L(X),ve=["address","street","place","country"];var s;if(typeof W=="function")return W(ae);const we=ve.indexOf(W);return we===-1?s=ve:s=ve.slice(we),s.reduce(function(Pe,rt){return ae[rt]?(Pe!==""&&(Pe=Pe+", "),Pe+ae[rt]):Pe},"")}function L(X){const W=X.address||"",ae=X.text||"",ve=X.place_name||"",we={address:ve.split(",")[0],houseNumber:W,street:
3005ae,placeName:ve};return X.context.forEach(function(Pe){const rt=Pe.id.split(".")[0];we[rt]=Pe.text}),we}return Xy={transformFeatureToGeolocationText:S,getAddressInfo:L,REVERSE_GEOCODE_COORD_RGX:/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/},Xy}var Yy,pw;function VA(){if(pw)return Yy;pw=1;var S=c2(),L=u2(),V=nh(),X=h2().EventEmitter,W=d2(),ae=T2(),ve=R2(),s=k2(),we=B2(),Pe=V2(),rt=U2(),ot=j2();const ke={FORWARD:0,LOCAL:1,REVERSE:2};function dt(){var pe=document.createElement("div");return pe.className="mapboxgl-ctrl-geocoder--powered-by",pe.innerHTML='<a href="https://www.mapbox.com/search-service" target="_blank">Powered by Mapbox</a>',pe}function Be(pe){this._eventEmitter=new X,this.options=V({},this.options,pe),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geolocation=new rt}function Xe(pe){return pe?String(pe).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""}return Be.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,flipCoordinates:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,enableGeolocation:!1,addressAccuracy:"street",useBrowserFocus:!1,getItemValue:function(pe){return pe.place_name},render:function(pe){var Ye=Xe(pe.place_name).split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title">'+Ye[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address">'+Ye.splice(1,Ye.length).join(",")+"</div></div>"}},_headers:{},addTo:function(pe){function Ye(at,gt){if(!document.body.contains(gt))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const Qe=at.onAdd();gt.appendChild(Qe)}
3005if(pe._controlContainer)pe.addControl(this);else if(pe instanceof HTMLElement)Ye(this,pe);else if(typeof pe=="string"){const at=document.querySelectorAll(pe);if(at.length===0)throw new Error("Element ",pe,"not found.");if(at.length>1)throw new Error("Geocoder can only be added to a single html element");Ye(this,at[0])}else throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element")},onAdd:function(pe){if(pe&&typeof pe!="string"&&(this._map=pe),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=ve(ae({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new s(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this),this._geolocateUser=this._geolocateUser.bind(this),this._onSuggestionItemFocus=this._onSuggestionItemFocus.bind(this),this._onSuggestionItemKeyDown=this._onSuggestionItemKeydown.bind(this);var Ye=this.container=document.createElement("div");Ye.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var at=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",L(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",function(xi){this.eventManager.keyevent(xi,this)}.bind(this));var gt=document.createElement("div");gt.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var Qe=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');if(this._clearEl.appendChild(Qe),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),gt.appendChild(this._clearEl),gt.appendChild(this._loadingEl),Ye.appendChild(at),Ye.appendChild(this._inputEl),this.options.enableGeolocation&&this.geolocation.isSupport()){this._geolocateEl=document.createElement("button"),this._geolocateEl.setAttribute("aria-label","Geolocate"),this._geolocateEl.addEventListener("click",this._geolocateUser),this._geolocateEl.className="mapboxgl-ctrl-geocoder--button";var He=this.createIcon("geolocate",'<path d="M12.999 3.677L2.042 8.269c-.962.403-.747 1.823.29 1.912l5.032.431.431 5.033c.089 1.037 1.509 1.252 1.912.29l4.592-10.957c.345-.822-.477-1.644-1.299-1.299z" fill="#4264fb"/>');this._geolocateEl.appendChild(He),gt.appendChild(this._geolocateEl),this._showGeolocateButton()}var yt=this._typeahead=new S(this._inputEl,[],{hideOnBlur:!this.options.useBrowserFocus,filter:!1,minLength:this.options.minLength,limit:this.options.limit});Ye.insertBefore(gt,yt.list.wrapper),this.setRenderFunction(this.options.render),yt.getItemV
3005alue=this.options.getItemValue;const Tt=this._typeahead.handleKeyDown.bind(this._typeahead),Mt=this._typeahead.handleKeyUp.bind(this._typeahead);this._typeahead.handleKeyUp,this.options.useBrowserFocus&&(this._typeahead.handleKeyDown=function(xi){if(!(xi.keyCode===9&&!yt.list.isEmpty())){if(xi.keyCode===40){this._typeahead.list.active=0,this._typeahead.list.element.querySelectorAll("li").forEach(function(Wt){Wt.classList.remove("active")}),this._typeahead.list.element.querySelectorAll("li")[0].classList.add("active"),this._typeahead.list.element.querySelectorAll("li")[0].focus();return}else if(xi.keyCode===38){this._typeahead.list.active=yt.list.items.length-1,this._typeahead.list.element.querySelectorAll("li").forEach(function(Wt){Wt.classList.remove("active")}),this._typeahead.list.element.querySelectorAll("li")[this._typeahead.list.active].classList.add("active"),this._typeahead.list.element.querySelectorAll("li")[this._typeahead.list.active].focus();return}Tt(xi)}}.bind(this),this._typeahead.handleKeyUp=function(xi){if(xi&&xi.keyCode===16){xi.preventDefault();return}Mt(xi)});var li=yt.list.draw,ri=this._footerNode=dt(),Vi=this;return yt.list.draw=function(){Vi.options.useBrowserFocus&&yt.list.element.querySelectorAll("li").forEach(function(xi){xi.removeEventListener("focus",Vi._onSuggestionItemFocus),xi.removeEventListener("keydown",Vi._onSuggestionItemKeyDown)}),li.call(this),Vi.options.useBrowserFocus&&yt.list.element.querySelectorAll("li").forEach(function(xi,Wt){Wt===0&&xi.focus(),xi.setAttribute("data-index",Wt),xi.tabIndex=0,xi.addEventListener("focus",this._onSuggestionItemFocus),xi.addEventListener("keydown",this._onSuggestionItemKeyDown)}.bind(Vi)),ri.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),ri.addEventListener("mouseup",function(){this.selectingListItem=!1}.bind(this)),this.element.appendChild(ri)},this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),Ye},_onSuggestionItemKeydown(pe){const Ye=pe.keyCode;if(Ye!==9){if(Ye===13){pe.preventDefault();const at=this._typeahead.list.element.querySelector(".active");if(at){const gt=at.getAttribute("data-index"),Qe=this._typeahead.list.items[gt];Qe&&(this._typeahead.value(Qe.original),this._typeahead.list.hide())}}else if(Ye===38||Ye===40){const at=this._typeahead.list.element.querySelectorAll("li");if(at.length>0){if(Ye===38)if(this._typeahead.list.active>0)pe.preventDefault(),this._typeahead.list.active--;else{this._typeahead.el.focus();return}else if(Ye===40)if(pe.preventDefault(),this._typeahead.list.active<at.length-1)this._typeahead.list.active++;else return;at.forEach(function(Qe){Qe.classList.remove("active")});const gt=at[this._typeahead.list.active];gt&&(gt.classList.add("active"),gt.focus())}}}},_onSuggestionItemFocus(pe){this._typeahead.list.active=pe.target.getAttribute("data-index"),this._typeahead.list.element.querySelectorAll("li").forEach(function(Ye){Ye.classList.remove("active")}),pe.target.classList.add("active")},_geolocateUser:function(){this._hideGeolocateButton(),this._showLoadingIcon(),this.geolocation.getCurrentPosition().then(function(pe){this._hideLoadingIcon();const Ye={geometry:{type:"Point",coordinates:[pe.coords.longitude,pe.coords.latitude]}};this._handleMarker(Ye),this._fly(Ye),this._typeahead.clear(),this._typeahead.selected=!0,this.lastSelected=JSON.stringify(Ye),this._showClearButton(),this.fresh=!1;const at={limit:1,language:[this.options.language],query:Ye.geometry.coordinates,types:["address"]};if(this.options.localGeocoderOnly){const gt=Ye.geometry.coordinates[0]+","+Ye.geometry.coordinates[1];this._setInputValue(gt),this._eventEmitter.emit("result",{result:Ye})}else this.geocoderService.reverseGeocode(at).send().then(function(gt){const Qe=gt.body.features[0];if(Qe){const He=ot.transformFeatureToGeolocationText(Qe,this.options.addressAccuracy);this._setInputValue(He),Qe.user_coordinates=Ye.geometry.coordinates,this._eventEmitter.emit("result",{result:Qe})}else this._eventEmitter.emit("result",{result:{user_coordinates:Ye.geometry.coordinates}})}.bind(this))}.bind(this)).catch(function(pe){pe.code===1?this._renderUserDeniedGeolocationError():this._renderLocationError(),this._hideLoadingIcon(),this._showGeolocateButton(),this._hideAttribution()}.bind(this))},createIcon:function(pe,Ye){var at=document.createElementNS("http://www.w3.org/2000/svg","svg");return at.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+pe),at.setAttribute("viewBox","0 0 18 18"),at.setAttribute("xml:space","preserve"),at.setAttribute("width",18),at.setAttribute("height",18),at.innerHTML=Ye,at},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_setInputValue:function(pe){this._inputEl.value=pe,setTimeout(function(){this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0)}.bind(this),1)},_onPaste:function(pe){var Ye=(pe.clipboardData||window.clipboardData).getData("text");Ye.length>=this.options.minLength&&this._geocode(Ye)},_onKeyDown:function(pe){var Ye=27,at=9;if(pe.keyCode===Ye&&this.options.clearAndBlurOnEsc)return this._clear(pe),this._inputEl.blur();var gt=pe.target&&pe.target.shadowRoot?pe.target.shadowRoot.activeElement:pe.target,Qe=gt?gt.value:"";if(!Qe)return this.fresh=!0,pe.keyCode!==at&&this.clear(pe),this._showGeolocateButton(),this._hideClearButton();this._hideGeolocateButton(),!(pe.metaKey||[at,Ye,37,39,13,38,40].indexOf(pe.keyCode)!==-1)&>.value.length>=this.options.minLength&&this._geocode(gt.value)},_showButton:function(){this._typeahead.selected&&this._showClearButton()},_hideButton:function(){this._typeahead.selected&&this._hideClearButton()},_showClearButton:function(){this._clearEl.style.display="block"},_hideClearButton:function(){this._clearEl.style.display="none"},_showGeolocateButton:function(){this._geolocateEl&&this.geolocation.isSupport()&&(this._geolocateEl.style.display="block")},_hideGeolocateButton:function(){this._geolocateEl&&(this._geolocateEl.style.display="none")},_showLoadingIcon:function(){this._loadingEl.style.display="block"},_hideLoadingIcon:function(){this._loadingEl.style.display="none"},_showAttribution:function(){this._footerNode.style.display="block"},_hideAttribution:function(){this._footerNode.style.display="none"},_onBlur:function(pe){this.options.clearOnBlur&&this._clearOnBlur(pe),this.options.collapsed&&this._collapse()},_onChange:function(){var pe=this._typeahead.selected;pe&&JSON.stringify(pe)!==this.lastSelected&&(this._hideClearButton(),this.options.flyTo&&this._fly(pe),this.options.marker&&this._mapboxgl&&this._handleMarker(pe),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(pe),this._eventEmitter.emit("result",{result:pe}),this.eventManager.select(pe,this))},_fly:function(pe){var Ye;if(pe.properties&&W[pe.properties.short_code])Ye=V({},this.options.flyTo),this._map&&this._map.fitBounds(W[pe.properties.short_code].bbox,Ye);else if(pe.bbox){var at=pe.bbox;Ye=V({},this.options.flyTo),this._map&&this._map.fitBounds([[at[0],at[1]],[at[2],at[3]]],Ye)}else{var gt={zoom:this.options.zoom};Ye=V({},gt,this.options.flyTo),pe.center?Ye.center=pe.center:pe.geometry&&pe.geometry.type&&pe.geometry.type==="Point"&&pe.geometry.coordinates&&(Ye.center=pe.geometry.coordinates),this._map&&this._map.flyTo(Ye)}},_requestType:function(pe,Ye){var at;return pe.localGeocoderOnly?at=ke.LOCAL:pe.reverseGeocode&&ot.REVERSE_GEOCODE_COORD_RGX.test(Ye)?at=ke.REVERSE:at=ke.FORWARD,at},_setupConfig:function(pe,Ye){const at=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"],gt=/[\s,]+/;var Qe=this,He=at.reduce(function(Tt,Mt){if(Qe.options[Mt]===void 0||Qe.options[Mt]===null)return Tt;["countries","types","language"].indexOf(Mt)>-1?Tt[Mt]=Qe.options[Mt].split(gt):Tt[Mt]=Qe.options[Mt];const li=typeof Qe.options[Mt].longitude=="number"&&typeof Qe.options[Mt].latitude=="number";if(Mt==="proximity"&&li){const ri=Qe.options[Mt].longitude,Vi=Qe.options[Mt].latitude;Tt[Mt]=[ri,Vi]}return Tt},{});switch(pe){case ke.REVERSE:{var yt=Ye.split(gt).map(function(Tt){return parseFloat(Tt,10)});Qe.options.flipCoordinates||yt.reverse(),He.types&&He.types[0],He=V(He,{query:yt,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach(function(Tt){Tt in He&&delete He[Tt]})}break;case ke.FORWARD:{const Tt=Ye.trim();/^(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)?$/.test(Tt)&&(Ye=Ye.replace(/,/g," ")),He=V(He,{query:Ye})}break}return He.session_token=this.eventManager.getSessionId(),He},_geocode:function(pe){this.inputString=pe,this._showLoadingIcon(),this._eventEmitter.emit("loading",{query:pe});const Ye=this._requestType(this.options,pe),at=this._setupConfig(Ye,pe);var gt;switch(Ye){case ke.LOCAL:gt=Promise.resolve();break;case ke.FORWARD:gt=this.geocoderService.forwardGeocode(at).send();break;case ke.REVERSE:gt=this.geocoderService.reverseGeocode(at).send();break}var Qe=this.options.localGeocoder?this.options.localGeocoder(pe)||[]:[],He=[],yt=null;return gt.catch(function(Tt){yt=Tt}.bind(this)).then(function(Tt){this._hideLoadingIcon();var Mt={};return Tt?Tt.statusCode=="200"&&(Mt=Tt.body,Mt.request=Tt.request,Mt.headers=Tt.headers,this._headers=Tt.headers):Mt={type:"FeatureCollection",features:[]},Mt.config=at,this.fresh&&(this.eventManager.start(this),this.fresh=!1),Mt.features&&Mt.features.length&&Mt.features.map(function(li){li._source="mapbox"}),Mt.features=Mt.features?Qe.concat(Mt.features):Qe,this.options.externalGeocoder?(He=this.options.externalGeocoder(pe,Mt.features)||Promise.resolve([]),He.then(function(li){return Mt.features=Mt.features?li.concat(Mt.features):li,Mt},function(){return Mt})):Mt}.bind(this)).then(function(Tt){if(yt)throw yt;this.options.filter&&Tt.features.length&&(Tt.features=Tt.features.filter(this.options.filter)),Tt.features.length?(this._showClearButton(),this._hideGeolocateButton(),this._showAttribution(),this._eventEmitter.emit("results",Tt),this._typeahead.update(Tt.features)):(this._hideClearButton(),this._hideAttribution(),this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",Tt))}.bind(this)).catch(function(Tt){this._hideLoadingIcon(),this._hideAttribution(),Qe.length&&this.options.localGeocoder||He.length&&this.options.externalGeocoder?(this._showClearButton(),this._hideGeolocateButton(),this._typeahead.update(Qe)):(this._hideClearButton(),this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:Qe}),this._eventEmitter.emit("error",{error:Tt})}.bind(this)),gt},_clear:function(pe){pe&&pe.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this.eventManager.sessionIncrementer++,this._onChange(),this._hideClearButton(),this._showGeolocateButton(),this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(pe){this._clear(pe),this._inputEl.focus(),this.options.useBrowserFocus&&this._typeahead.list.hide()},_clearOnBlur:function(pe){var Ye=this;pe.relatedTarget&&Ye._clear(pe)},_onQueryResult:function(pe){var Ye=pe.body;if(Ye.features.length){var at=Ye.features[0];this._typeahead.selected=at,this._inputEl.value=at.place_name,this._onChange()}},_updateProximity:function(){if(!(!this._map||!this.options.trackProximity))if(this._map.getZoom()>9){var pe=this._map.getCenter().wrap();this.setProximity({longitude:pe.lng,latitude:pe.lat},!1)}else this.setProximity(null,!1)},_collapse:function(){!this._inputEl.value&&this._inputEl!==document.activeElement&&this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(pe){return this._geocode(pe).then(this._onQueryResult),this},_renderError:function(){var pe="<div class='mapbox-gl-geocoder--error'>There was an error reaching the server</div>";this._renderMessage(pe)},_renderLocationError:function(){var pe="<div class='mapbox-gl-geocoder--error'>A location error has occurred</div>";this._renderMessage(pe)},_renderNoResults:function(){var pe="<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results'>No results found</div>";this._renderMessage(pe)},_renderUserDeniedGeolocationError:function(){var pe="<div class='mapbox-gl-geocoder--error'>Geolocation permission denied</div>";this._renderMessage(pe)},_renderMessage:function(pe){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(pe)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var pe=this.options.language.split(",")[0],Ye=Pe.language(pe),at=we.placeholder[Ye];if(at)return at}return"Search"},setInput:function(pe,Ye){return Ye===void 0&&(Ye=!1),this._inputEl.value=pe,this._typeahead.selected=null,this._typeahead.clear(),pe.length>=this.options.minLength&&(Ye?this._geocode(pe):this._onChange()),this},setProximity:function(pe,Ye=!0){return this.options.proximity=pe,Ye&&(this.options.trackProximity=!1),this},getProximity:function(){return this.options.proximity}
3005,setRenderFunction:function(pe){return pe&&typeof pe=="function"&&(this._typeahead.render=pe),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(pe){var Ye=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=pe||this.options.language||Ye,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(pe){return this.options.zoom=pe,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(pe){return this.options.flyTo=pe,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(pe){return this.options.placeholder=pe||this._getPlaceholderText(),this._inputEl.placeholder=this.options.placeholder,this._inputEl.setAttribute("aria-label",this.options.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(pe){return this.options.bbox=pe,this},getCountries:function(){return this.options.countries},setCountries:function(pe){return this.options.countries=pe,this},getTypes:function(){return this.options.types},setTypes:function(pe){return this.options.types=pe,this},getMinLength:function(){return this.options.minLength},setMinLength:function(pe){return this.options.minLength=pe,this._typeahead&&(this._typeahead.options.minLength=pe),this},getLimit:function(){return this.options.limit},setLimit:function(pe){return this.options.limit=pe,this._typeahead&&(this._typeahead.options.limit=pe),this},getFilter:function(){return this.options.filter},setFilter:function(pe){return this.options.filter=pe,this},setOrigin:function(pe){return this.options.origin=pe,this.geocoderService=ve(ae({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},setAccessToken:function(pe){return this.options.accessToken=pe,this.geocoderService=ve(ae({accessToken:this.options.accessToken,origin:this.options.origin})),this},setAutocomplete:function(pe){return this.options.autocomplete=pe,this},getAutocomplete:function(){return this.options.autocomplete},setFuzzyMatch:function(pe){return this.options.fuzzyMatch=pe,this},getFuzzyMatch:function(){return this.options.fuzzyMatch},setRouting:function(pe){return this.options.routing=pe,this},getRouting:function(){return this.options.routing},setWorldview:function(pe){return this.options.worldview=pe,this},getWorldview:function(){return this.options.worldview},_handleMarker:function(pe){if(this._map){this._removeMarker();var Ye={color:"#4668F2"},at=V({},Ye,this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(at),pe.center?this.mapMarker.setLngLat(pe.center).addTo(this._map):pe.geometry&&pe.geometry.type&&pe.geometry.type==="Point"&&pe.geometry.coordinates&&this.mapMarker.setLngLat(pe.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(pe,Ye){return this._eventEmitter.on(pe,Ye),this},off:function(pe,Ye){return this._eventEmitter.removeListener(pe,Ye),this.eventManager.remove(),this}},Yy=Be,Yy}const Eo={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},Yo={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},Or={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},So={POLYGON:"polygon",LINE:"line_string",POINT:"point"},oi={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},Xi={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"}
3005,po={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},wf={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},Zn={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},Sn={ACTIVE:"true",INACTIVE:"false"},Fw=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],G2=-90,ex=-85,q2=90,tx=85,$2=-270,H2=270,kw=Object.freeze(Object.defineProperty({__proto__:null,LAT_MAX:q2,LAT_MIN:G2,LAT_RENDERED_MAX:tx,LAT_RENDERED_MIN:ex,LNG_MAX:H2,LNG_MIN:$2,activeStates:Sn,classes:Eo,cursors:Or,events:po,geojsonTypes:oi,interactions:Fw,meta:Zn,modes:Xi,sources:Yo,types:So,updateActions:wf},Symbol.toStringTag,{value:"Module"}));function n_(S){return function(L){const V=L.featureTarget;return!V||!V.properties?!1:V.properties.meta===S}}function Bw(S){return!S.originalEvent||!S.originalEvent.shiftKey?!1:S.originalEvent.button===0}function Dc(S){return!S.featureTarget||!S.featureTarget.properties?!1:S.featureTarget.properties.active===Sn.ACTIVE&&S.featureTarget.properties.meta===Zn.FEATURE}function lx(S){return!S.featureTarget||!S.featureTarget.properties?!1:S.featureTarget.properties.active===Sn.INACTIVE&&S.featureTarget.properties.meta===Zn.FEATURE}function o_(S){return S.featureTarget===void 0}function cx(S){return!S.featureTarget||!S.featureTarget.properties?!1:S.featureTarget.properties.meta===Zn.FEATURE}function Tf(S){const L=S.featureTarget;return!L||!L.properties?!1:L.properties.meta===Zn.VERTEX}function t_(S){return S.originalEvent?S.originalEvent.shiftKey===!0:!1}function s_(S){return S.key==="Escape"||S.keyCode===27}function a_(S){return S.key==="Enter"||S.keyCode===13}function ix(S){return S.key==="Backspace"||S.keyCode===8}function rx(S){return S.key==="Delete"||S.keyCode===46}function Nw(S){return S.key==="1"||S.keyCode===49}function Vw(S){return S.key==="2"||S.keyCode===50}function Uw(S){return S.key==="3"||S.keyCode===51}function jw(S){const L=S.key||String.fromCharCode(S.keyCode);return L>="0"&&L<="9"}function Z2(){return!0}const W2=Object.freeze(Object.defineProperty({__proto__:null,isActiveFeature:Dc,isBackspaceKey:ix,isDeleteKey:rx,isDigit1Key:Nw,isDigit2Key:Vw,isDigit3Key:Uw,isDigitKey:jw,isEnterKey:a_,isEscapeKey:s_,isFeature:cx,isInactiveFeature:lx,isOfMetaType:n_,isShiftDown:t_,isShiftMousedown:Bw,isTrue:Z2,isVertex:Tf,noTarget:o_},Symbol.toStringTag,{value:"Module"}));var Xm={},xf={},mw;function X2(){return mw||(mw=1,xf.RADIUS=6378137,xf.FLATTENING=1/298.257223563,xf.POLAR_RADIUS=63567523142e-4),xf}var _w;function Y2(){if(_w)return Xm;_w=1;var S=X2();Xm.geometry=L,Xm.ring=X;function L(ae){var ve=0,s;switch(ae.type){case"Polygon":return V(ae.coordinates);case"MultiPolygon":for(s=0;s<ae.coordinates.length;s++)ve+=V(ae.coordinates[s]);return ve;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(s=0;s<ae.geometries.length;s++)ve+=L(ae.geometries[s]);return ve}}function V(ae){var ve=0;if(ae&&ae.length>0){ve+=Math.abs(X(ae[0]));for(var s=1;s<ae.length;s++)ve-=Math.abs(X(ae[s]))}return ve}function X(ae){var ve,s,we,Pe,rt,ot,ke,dt=0,Be=ae.length;if(Be>2){for(ke=0;ke<Be;ke++)ke===Be-2?(Pe=Be-2,rt=Be-1,ot=0):ke===Be-1?(Pe=Be-1,rt=0,ot=1):(Pe=ke,rt=ke+1,ot=ke+2),ve=ae[Pe],s=ae[rt],we=ae[ot],dt+=(W(we[0])-W(ve[0]))*Math.sin(W(s[1]));dt=dt*S.RADIUS*S.RADIUS/2}return dt}function W(ae){return ae*Math.PI/180}return Xm}var K2=Y2();const J2=ax(K2),gw={Point:0,LineString:1,MultiLineString:1,Polygon:2};function Q2(S,L){const V=gw[S.geometry.type]-gw[L.geometry.type];return V===0&&S.geometry.type===oi.POLYGON?S.area-L.area:V}function Gw(S){return S.map(L=>(L.geometry.type===oi.POLYGON&&(L.area=J2.geometry({type:oi.FEATURE,property:{},geometry:L.geometry})),L)).sort(Q2).map(L=>(delete L.area,L))}function qw(S,L=0){return[[S.point.x-L,S.point.y-L],[S.point.x+L,S.point.y+L]]}function Ko(S){if(this._items={},this._nums={},this._length=S?S.length:0,!!S)for(let L=0,V=S.length;L<V;L++)this.add(S[L]),S[L]!==void 0&&(typeof S[L]=="string"?this._items[S[L]]=L:this._nums[S[L]]=L)}Ko.prototype.add=function(S){return this.has(S)?this:(this._length++,typeof S=="string"?this._items[S]=this._length:this._nums[S]=this._length,this)};Ko.prototype.delete=function(S){return this.has(S)===!1?this:(this._length--,delete this._items[S],delete this._nums[S],this)};
3005Ko.prototype.has=function(S){return typeof S!="string"&&typeof S!="number"?!1:this._items[S]!==void 0||this._nums[S]!==void 0};Ko.prototype.values=function(){const S=[];return Object.keys(this._items).forEach(L=>{S.push({k:L,v:this._items[L]})}),Object.keys(this._nums).forEach(L=>{S.push({k:JSON.parse(L),v:this._nums[L]})}),S.sort((L,V)=>L.v-V.v).map(L=>L.k)};Ko.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const eA=[Zn.FEATURE,Zn.MIDPOINT,Zn.VERTEX],ih={click:tA,touch:iA};function tA(S,L,V){return $w(S,L,V,V.options.clickBuffer)}function iA(S,L,V){return $w(S,L,V,V.options.touchBuffer)}function $w(S,L,V,X){if(V.map===null)return[];const W=S?qw(S,X):L,ae={};V.options.styles&&(ae.layers=V.options.styles.map(Pe=>Pe.id).filter(Pe=>V.map.getLayer(Pe)!=null));const ve=V.map.queryRenderedFeatures(W,ae).filter(Pe=>eA.indexOf(Pe.properties.meta)!==-1),s=new Ko,we=[];return ve.forEach(Pe=>{const rt=Pe.properties.id;s.has(rt)||(s.add(rt),we.push(Pe))}),Gw(we)}function e_(S,L){const V=ih.click(S,null,L),X={mouse:Or.NONE};return V[0]&&(X.mouse=V[0].properties.active===Sn.ACTIVE?Or.MOVE:Or.POINTER,X.feature=V[0].properties.meta),L.events.currentModeName().indexOf("draw")!==-1&&(X.mouse=Or.ADD),L.ui.queueMapClasses(X),L.ui.updateMapClasses(),V[0]}function ux(S,L){const V=S.x-L.x,X=S.y-L.y;return Math.sqrt(V*V+X*X)}const rA=4,nA=12,oA=500;function nx(S,L,V={}){const X=V.fineTolerance!=null?V.fineTolerance:rA,W=V.grossTolerance!=null?V.grossTolerance:nA,ae=V.interval!=null?V.interval:oA;S.point=S.point||L.point,S.time=S.time||L.time;const ve=ux(S.point,L.point);return ve<X||ve<W&&L.time-S.time<ae}const sA=25,aA=250;function ox(S,L,V={}){const X=V.tolerance!=null?V.tolerance:sA,W=V.interval!=null?V.interval:aA;return S.point=S.point||L.point,S.time=S.time||L.time,ux(S.point,L.point)<X&&L.time-S.time<W}const sx=function(S,L){const V={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},X={on(ae,ve,s){if(V[ae]===void 0)throw new Error(`Invalid event type: ${ae}`);V[ae].push({selector:ve,fn:s})},render(ae){L.store.featureChanged(ae)}},W=function(ae,ve){const s=V[ae];let we=s.length;for(;we--;){const Pe=s[we];if(Pe.selector(ve)){Pe.fn.call(X,ve)||L.store.render(),L.ui.updateMapClasses();break}}};return S.start.call(X),{render:S.render,stop(){S.stop&&S.stop()},trash(){S.trash&&(S.trash(),L.store.render())},combineFeatures(){S.combineFeatures&&S.combineFeatures()},uncombineFeatures(){S.uncombineFeatures&&S.uncombineFeatures()},drag(ae){W("drag",ae)},click(ae){W("click",ae)},mousemove(ae){W("mousemove",ae)},mousedown(ae){W("mousedown",ae)},mouseup(ae){W("mouseup",ae)},mouseout(ae){W("mouseout",ae)},keydown(ae){W("keydown",ae)},keyup(ae){W("keyup",ae)},touchstart(ae){W("touchstart",ae)},touchmove(ae){W("touchmove",ae)},touchend(ae){W("touchend",ae)},tap(ae){W("tap",ae)}}};let lA=(S,L=21)=>(V=L)=>{let X="",W=V|0;for(;W-- >0;)X+=S[Math.random()*S.length|0];return X};const cA=lA("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function hx(){return cA()}const mo=function(S,L){this.ctx=S,this.properties=L.properties||{},this.coordinates=L.geometry.coordinates,this.id=L.id||hx(),this.type=L.geometry.type};mo.prototype.changed=function(){this.ctx.store.featureChanged(this.id)};mo.prototype.incomingCoords=function(S){this.setCoordinates(S)};mo.prototype.setCoordinates=function(S){this.coordinates=S,this.changed()};mo.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))};mo.prototype.setProperty=function(S,L){this.properties[S]=L};mo.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:oi.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.t
3005ype}}))};mo.prototype.internal=function(S){const L={id:this.id,meta:Zn.FEATURE,"meta:type":this.type,active:Sn.INACTIVE,mode:S};if(this.ctx.options.userProperties)for(const V in this.properties)L[`user_${V}`]=this.properties[V];return{type:oi.FEATURE,properties:L,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const Pl=function(S,L){mo.call(this,S,L)};Pl.prototype=Object.create(mo.prototype);Pl.prototype.isValid=function(){return typeof this.coordinates[0]=="number"&&typeof this.coordinates[1]=="number"};Pl.prototype.updateCoordinate=function(S,L,V){arguments.length===3?this.coordinates=[L,V]:this.coordinates=[S,L],this.changed()};Pl.prototype.getCoordinate=function(){return this.getCoordinates()};const sa=function(S,L){mo.call(this,S,L)};sa.prototype=Object.create(mo.prototype);sa.prototype.isValid=function(){return this.coordinates.length>1};sa.prototype.addCoordinate=function(S,L,V){this.changed();const X=parseInt(S,10);this.coordinates.splice(X,0,[L,V])};sa.prototype.getCoordinate=function(S){const L=parseInt(S,10);return JSON.parse(JSON.stringify(this.coordinates[L]))};sa.prototype.removeCoordinate=function(S){this.changed(),this.coordinates.splice(parseInt(S,10),1)};
3005sa.prototype.updateCoordinate=function(S,L,V){const X=parseInt(S,10);this.coordinates[X]=[L,V],this.changed()};const zo=function(S,L){mo.call(this,S,L),this.coordinates=this.coordinates.map(V=>V.slice(0,-1))};zo.prototype=Object.create(mo.prototype);zo.prototype.isValid=function(){return this.coordinates.length===0?!1:this.coordinates.every(S=>S.length>2)};zo.prototype.incomingCoords=function(S){this.coordinates=S.map(L=>L.slice(0,-1)),this.changed()};zo.prototype.setCoordinates=function(S){this.coordinates=S,this.changed()};zo.prototype.addCoordinate=function(S,L,V){this.changed();const X=S.split(".").map(ae=>parseInt(ae,10));this.coordinates[X[0]].splice(X[1],0,[L,V])};zo.prototype.removeCoordinate=function(S){this.changed();const L=S.split(".").map(X=>parseInt(X,10)),V=this.coordinates[L[0]];V&&(V.splice(L[1],1),V.length<3&&this.coordinates.splice(L[0],1))};zo.prototype.getCoordinate=function(S){const L=S.split(".").map(X=>parseInt(X,10)),V=this.coordinates[L[0]];return JSON.parse(JSON.stringify(V[L[1]]))};zo.prototype.getCoordinates=function(){return this.coordinates.map(S=>S.concat([S[0]]))};zo.prototype.updateCoordinate=function(S,L,V){this.changed();const X=S.split("."),W=parseInt(X[0],10),ae=parseInt(X[1],10);this.coordinates[W]===void 0&&(this.coordinates[W]=[]),this.coordinates[W][ae]=[L,V]};const uA={MultiPoint:Pl,MultiLineString:sa,MultiPolygon:zo},l_=(S,L,V,X,W)=>{const ae=V.split("."),ve=parseInt(ae[0],10),s=ae[1]?ae.slice(1).join("."):null;return S[ve][L](s,X,W)},fo=function(S,L){if(mo.call(this,S,L),delete this.coordinates,this.model=uA[L.geometry.type],this.model===void 0)throw new TypeError(`${L.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(L.geometry.coordinates)};fo.prototype=Object.create(mo.prototype);fo.prototype._coordinatesToFeatures=function(S){const L=this.model.bind(this);return S.map(V=>new L(this.ctx,{id:hx(),type:oi.FEATURE,properties:{}
3005,geometry:{coordinates:V,type:this.type.replace("Multi","")}}))};fo.prototype.isValid=function(){return this.features.every(S=>S.isValid())};fo.prototype.setCoordinates=function(S){this.features=this._coordinatesToFeatures(S),this.changed()};fo.prototype.getCoordinate=function(S){return l_(this.features,"getCoordinate",S)};fo.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(S=>S.type===oi.POLYGON?S.getCoordinates():S.coordinates)))};fo.prototype.updateCoordinate=function(S,L,V){l_(this.features,"updateCoordinate",S,L,V),this.changed()};fo.prototype.addCoordinate=function(S,L,V){l_(this.features,"addCoordinate",S,L,V),this.changed()};fo.prototype.removeCoordinate=function(S){l_(this.features,"removeCoordinate",S),this.changed()};fo.prototype.getFeatures=function(){return this.features};function zi(S){this.map=S.map,this.drawConfig=JSON.parse(JSON.stringify(S.options||{})),this._ctx=S}zi.prototype.setSelected=function(S){return this._ctx.store.setSelected(S)};zi.prototype.setSelectedCoordinates=function(S){this._ctx.store.setSelectedCoordinates(S),S.reduce((L,V)=>(L[V.feature_id]===void 0&&(L[V.feature_id]=!0,this._ctx.store.get(V.feature_id).changed()),L),{})};zi.prototype.getSelected=function(){return this._ctx.store.getSelected()};zi.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()};zi.prototype.isSelected=function(S){return this._ctx.store.isSelected(S)};zi.prototype.getFeature=function(S){return this._ctx.store.get(S)};zi.prototype.select=function(S){return this._ctx.store.select(S)};zi.prototype.deselect=function(S){return this._ctx.store.deselect(S)};zi.prototype.deleteFeature=function(S,L={}){return this._ctx.store.delete(S,L)};zi.prototype.addFeature=function(S,L={}){return this._ctx.store.add(S,L)};zi.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()};zi.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()};zi.prototype.setActionableState=function(S={}){const L={trash:S.trash||!1,combineFeatures:S.combineFeatures||!1,uncombineFeatures:S.uncombineFeatures||!1};return this._ctx.events.actionable(L)};zi.prototype.changeMode=function(S,L={},V={}){return this._ctx.events.changeMode(S,L,V)};zi.prototype.fire=function(S,L){return this._ctx.events.fire(S,L)};zi.prototype.updateUIClasses=function(S){return this._ctx.ui.queueMapClasses(S)};zi.prototype.activateUIButton=function(S){return this._ctx.ui.setActiveButton(S)};zi.prototype.featuresAt=function(S,L,V="click"){if(V!=="click"&&V!=="touch")throw new Error("invalid buffer type");return ih[V](S,L,this._ctx)};zi.prototype.newFeature=function(S){const L=S.geometry.type;return L===oi.POINT?new Pl(this._ctx,S):L===oi.LINE_STRING?new sa(this._ctx,S):L===oi.POLYGON?new zo(this._ctx,S):new fo(this._ctx,S)};zi.prototype.isInstanceOf=function(S,L){if(S===oi.POINT)return L instanceof Pl;if(S===oi.LINE_STRING)return L instanceof sa;if(S===oi.POLYGON)return L instanceof zo;if(S==="MultiFeature")return L instanceof fo;throw new Error(`Unknown feature class: ${S}`)};zi.prototype.doRender=function(S){return this._ctx.store.featureChanged(S)};zi.prototype.onSetup=function(){};zi.prototype.onDrag=function(){};zi.prototype.onClick=function(){};zi.prototype.onMouseMove=function(){};zi.prototype.onMouseDown=function(){};zi.prototype.onMouseUp=function(){};zi.prototype.onMouseOut=function(){};zi.prototype.onKeyUp=function(){};zi.prototype.onKeyDown=function(){};zi.prototype.onTouchStart=function(){};zi.prototype.onTouchMove=function(){};zi.prototype.onTouchEnd=function(){};zi.prototype.onTap=function(){};zi.prototype.onStop=function(){};zi.prototype.onTrash=function(){};zi.prototype.onCombineFeature=function(){};zi.prototype.onUncombineFeature=function(){};zi.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const Hw={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},hA=Object.keys(Hw);function dA(S){const L=Object.keys(S);return function(V,X={}){let W={};const ae=L.reduce((s,we)=>(s[we]=S[we],s),new zi(V));function ve(s){return we=>ae[s](W,we)}return{start(){W=ae.onSetup(X),hA.forEach(s=>{const we=Hw[s];let Pe=()=>!1;S[we]&&(Pe=()=>!0),this.on(s,Pe,ve(we))})},stop(){ae.onStop(W)},trash(){ae.onTrash(W)},combineFeatures(){ae.onCombineFeatures(W)},uncombineFeatures(){ae.onUncombineFeatures(W)},render(s,we){ae.toDisplayFeatures(W,s,we)}}}}function fA(S){const L=Object.keys(S.options.modes).reduce((ke,dt)=>(ke[dt]=dA(S.options.modes[dt]),ke),{});let V={},X={};const W={};let ae=null,ve=null;W.drag=function(ke,dt){dt({point:ke.point,time:new Date().getTime()})?(S.ui.queueMapClasses({mouse:Or.DRAG}),ve.drag(ke)):ke.originalEvent.stopPropagation()},W.mousedrag=function(ke){W.drag(ke,dt=>!nx(V,dt))},W.touchdrag=function(ke){W.drag(ke,dt=>!ox(X,dt))},W.mousemove=function(ke){if((ke.originalEvent.buttons!==void 0?ke.originalEvent.buttons:ke.originalEvent.which)===1)return W.mousedrag(ke);const Be=e_(ke,S);ke.featureTarget=Be,ve.mousemove(ke)},W.mousedown=function(ke){V={time:new Date().getTime(),point:ke.point};const dt=e_(ke,S);ke.featureTarget=dt,ve.mousedown(ke)},W.mouseup=function(ke){const dt=e_(ke,S);ke.featureTarget=dt,nx(V,{point:ke.point,time:new Date().getTime()})?ve.click(ke):ve.mouseup(ke)},W.mouseout=function(ke){ve.mouseout(ke)},W.touchstart=function(ke){if(!S.options.touchEnabled)return;X={time:new Date().getTime(),point:ke.point};const dt=ih.touch(ke,null,S)[0];ke.featureTarget=dt,ve.touchstart(ke)},W.touchmove=function(ke){if(S.options.touchEnabled)return ve.touchmove(ke),W.touchdrag(ke)},W.touchend=function(ke){if(ke.originalEvent.preventDefault(),!S.options.touchEnabled)return;const dt=ih.touch(ke,null,S)[0];ke.featureTarget=dt,ox(X,{time:new Date().getTime(),point:ke.point})?ve.tap(ke):ve.touchend(ke)};const s=ke=>{const dt=ix(ke),Be=rx(ke),Xe=jw(ke);return!(dt||Be||Xe)};W.keydown=function(ke){(ke.srcElement||ke.target).classList.contains(Eo.CANVAS)&&((ix(ke)||rx(ke))&&S.options.controls.trash?(ke.preventDefault(),ve.trash()):s(ke)?ve.keydown(ke):Nw(ke)&&S.options.controls.point?we(Xi.DRAW_POINT):Vw(ke)&&S.options.controls.line_string?we(Xi.DRAW_LINE_STRING):Uw(ke)&&S.options.controls.polygon&&we(Xi.DRAW_POLYGON))},W.keyup=function(ke){s(ke)&&ve.keyup(ke)},W.zoomend=function(){S.store.changeZoom()},W.data=function(ke){if(ke.dataType==="style"){const{setup:dt,map:Be,options:Xe,store:pe}=S;Xe.styles.some(at=>
3005Be.getLayer(at.id))||(dt.addLayers(),pe.setDirty(),pe.render())}};function we(ke,dt,Be={}){ve.stop();const Xe=L[ke];if(Xe===void 0)throw new Error(`${ke} is not valid`);ae=ke;const pe=Xe(S,dt);ve=sx(pe,S),Be.silent||S.map.fire(po.MODE_CHANGE,{mode:ke}),S.store.setDirty(),S.store.render()}const Pe={trash:!1,combineFeatures:!1,uncombineFeatures:!1};function rt(ke){let dt=!1;Object.keys(ke).forEach(Be=>{if(Pe[Be]===void 0)throw new Error("Invalid action type");Pe[Be]!==ke[Be]&&(dt=!0),Pe[Be]=ke[Be]}),dt&&S.map.fire(po.ACTIONABLE,{actions:Pe})}return{start(){ae=S.options.defaultMode,ve=sx(L[ae](S),S)},changeMode:we,actionable:rt,currentModeName(){return ae},currentModeRender(ke,dt){return ve.render(ke,dt)},fire(ke,dt){S.map&&S.map.fire(ke,dt)},addEventListeners(){S.map.on("mousemove",W.mousemove),S.map.on("mousedown",W.mousedown),S.map.on("mouseup",W.mouseup),S.map.on("data",W.data),S.map.on("touchmove",W.touchmove),S.map.on("touchstart",W.touchstart),S.map.on("touchend",W.touchend),S.container.addEventListener("mouseout",W.mouseout),S.options.keybindings&&(S.container.addEventListener("keydown",W.keydown),S.container.addEventListener("keyup",W.keyup))},removeEventListeners(){S.map.off("mousemove",W.mousemove),S.map.off("mousedown",W.mousedown),S.map.off("mouseup",W.mouseup),S.map.off("data",W.data),S.map.off("touchmove",W.touchmove),S.map.off("touchstart",W.touchstart),S.map.off("touchend",W.touchend),S.container.removeEventListener("mouseout",W.mouseout),S.options.keybindings&&(S.container.removeEventListener("keydown",W.keydown),S.container.removeEventListener("keyup",W.keyup))},trash(ke){ve.trash(ke)},combineFeatures(){ve.combineFeatures()},uncombineFeatures(){ve.uncombineFeatures()},getMode(){return ae}}}function Ef(S){return[].concat(S).filter(L=>L!==void 0)}function pA(){const S=this;if(!(S.ctx.map&&S.ctx.map.getSource(Yo.HOT)!==void 0))return we();const V=S.ctx.events.currentModeName();S.ctx.ui.queueMapClasses({mode:V});let X=[],W=[];S.isDirty?W=S.getAllIds():(X=S.getChangedIds().filter(Pe=>S.get(Pe)!==void 0),W=S.sources.hot.filter(Pe=>Pe.properties.id&&X.indexOf(Pe.properties.id)===-1&&S.get(Pe.properties.id)!==void 0).map(Pe=>Pe.properties.id)),S.sources.hot=[];const ae=S.sources.cold.length;S.sources.cold=S.isDirty?[]:S.sources.cold.filter(Pe=>{const rt=Pe.properties.id||Pe.properties.parent;return X.indexOf(rt)===-1});const ve=ae!==S.sources.cold.length||W.length>0;X.forEach(Pe=>s(Pe,"hot")),W.forEach(Pe=>s(Pe,"cold"));function s(Pe,rt){const ke=S.get(Pe).internal(V);S.ctx.events.currentModeRender(ke,dt=>{dt.properties.mode=V,S.sources[rt].push(dt)})}ve&&S.ctx.map.getSource(Yo.COLD).setData({type:oi.FEATURE_COLLECTION,features:S.sources.cold}),S.ctx.map.getSource(Yo.HOT).setData({type:oi.FEATURE_COLLECTION,features:S.sources.hot}),we();function we(){S.isDirty=!1,S.clearChangedIds()}}function Sr(S){this._features={},this._featureIds=new Ko,this._selectedFeatureIds=new Ko,this._selectedCoordinates=[],this._changedFeatureIds=new Ko,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=S,this.sources={hot:[],cold:[]};let L;this.render=()=>{L||(L=requestAnimationFrame(()=>{L=null,pA.call(this),this._emitSelectionChange&&(this.ctx.events.fire(po.SELECTION_CHANGE,{features:this.getSelected().map(V=>V.toGeoJSON()),points:this.getSelectedCoordinates().map(V=>({type:oi.FEATURE,properties:{},geometry:{type:oi.POINT,coordinates:V.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(po.RENDER,{})}))},this.isDirty=!1}Sr.prototype.createRenderBatch=function(){const S=this.render;let L=0;return this.render=function(){L++},()=>{this.render=S,L>0&&this.render()}};Sr.prototype.setDirty=function(){return this.isDirty=!0,this};Sr.prototype.featureCreated=function(S,L={}){if(this._changedFeatureIds.add(S),(L.silent!=null?L.silent:this.ctx.options.suppressAPIEvents)!==!0){const X=this.get(S);this.ctx.events.fire(po.CREATE,{features:[X.toGeoJSON()]})}return this};Sr.prototype.featureChanged=function(S,L={}){return this._changedFeatureIds.add(S),(L.silent!=null?L.silent:this.ctx.options.suppressAPIEvents)!==!0&&this.ctx.events.fire(po.UPDATE,{action:L.action?L.action:wf.CHANGE_COORDINATES,features:[this.get(S).toGeoJSON()]}),this};Sr.prototype.getChangedIds=function(){return this._changedFeatureIds.values()};Sr.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this};Sr.prototype.getAllIds=function(){return this._featureIds.values()};Sr.prototype.add=function(S,L={}){return this._features[S.id]=S,this._featureIds.add(S.id),this.featureCreated(S.id,{silent:L.silent}),this};Sr.prototype.delete=function(S,L={}){const V=[];
3005return Ef(S).forEach(X=>{this._featureIds.has(X)&&(this._featureIds.delete(X),this._selectedFeatureIds.delete(X),L.silent||V.indexOf(this._features[X])===-1&&V.push(this._features[X].toGeoJSON()),delete this._features[X],this.isDirty=!0)}),V.length&&this.ctx.events.fire(po.DELETE,{features:V}),Zw(this,L),this};Sr.prototype.get=function(S){return this._features[S]};Sr.prototype.getAll=function(){return Object.keys(this._features).map(S=>this._features[S])};Sr.prototype.select=function(S,L={}){return Ef(S).forEach(V=>{this._selectedFeatureIds.has(V)||(this._selectedFeatureIds.add(V),this._changedFeatureIds.add(V),L.silent||(this._emitSelectionChange=!0))}),this};Sr.prototype.deselect=function(S,L={}){return Ef(S).forEach(V=>{this._selectedFeatureIds.has(V)&&(this._selectedFeatureIds.delete(V),this._changedFeatureIds.add(V),L.silent||(this._emitSelectionChange=!0))}),Zw(this,L),this};Sr.prototype.clearSelected=function(S={}){return this.deselect(this._selectedFeatureIds.values(),{silent:S.silent}),this};Sr.prototype.setSelected=function(S,L={}){return S=Ef(S),this.deselect(this._selectedFeatureIds.values().filter(V=>S.indexOf(V)===-1),{silent:L.silent}),this.select(S.filter(V=>!this._selectedFeatureIds.has(V)),{silent:L.silent}),this};Sr.prototype.setSelectedCoordinates=function(S){return this._selectedCoordinates=S,this._emitSelectionChange=!0,this};Sr.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this};Sr.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()};Sr.prototype.getSelected=function(){return this.getSelectedIds().map(S=>this.get(S))};Sr.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(L=>({coordinates:this.get(L.feature_id).getCoordinate(L.coord_path)}))};Sr.prototype.isSelected=function(S){return this._selectedFeatureIds.has(S)};Sr.prototype.setFeatureProperty=function(S,L,V,X={}){this.get(S).setProperty(L,V),this.featureChanged(S,{silent:X.silent,action:wf.CHANGE_PROPERTIES})};function Zw(S,L={}){const V=S._selectedCoordinates.filter(X=>S._selectedFeatureIds.has(X.feature_id));S._selectedCoordinates.length!==V.length&&!L.silent&&(S._emitSelectionChange=!0),S._selectedCoordinates=V}Sr.prototype.storeMapConfig=function(){Fw.forEach(S=>{this.ctx.map[S]&&(this._mapInitialConfig[S]=this.ctx.map[S].isEnabled())})};Sr.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(S=>{this._mapInitialConfig[S]?this.ctx.map[S].enable():this.ctx.map[S].disable()})};Sr.prototype.getInitialConfigValue=function(S){return this._mapInitialConfig[S]!==void 0?this._mapInitialConfig[S]:!0};const mA=["mode","feature","mouse"];function _A(S){const L={};let V=null,X={mode:null,feature:null,mouse:null},W={mode:null,feature:null,mouse:null};function ae(){ve({mode:null,feature:null,mouse:null}),s()}function ve(dt){W=Object.assign(W,dt)}function s(){if(!S.container)return;const dt=[],Be=[];mA.forEach(Xe=>{W[Xe]!==X[Xe]&&(dt.push(`${Xe}-${X[Xe]}`),W[Xe]!==null&&Be.push(`${Xe}-${W[Xe]}`))}),dt.length>0&&S.container.classList.remove(...dt),Be.length>0&&S.container.classList.add(...Be),X=Object.assign(X,W)}function we(dt,Be={}){const Xe=document.createElement("button");return Xe.className=`${Eo.CONTROL_BUTTON} ${Be.className}`,Xe.setAttribute("title",Be.title),Be.container.appendChild(Xe),Xe.addEventListener("click",pe=>{if(pe.preventDefault(),pe.stopPropagation(),pe.target===V){Pe(),Be.onDeactivate();return}rt(dt),Be.onActivate()},!0),Xe}function Pe(){V&&(V.classList.remove(Eo.ACTIVE_BUTTON),V=null)}function rt(dt){Pe();const Be=L[dt];Be&&Be&&dt!=="trash"&&(Be.classList.add(Eo.ACTIVE_BUTTON),V=Be)}function ot(){const dt=S.options.controls,Be=document.createElement("div");return Be.className=`${Eo.CONTROL_GROUP} ${Eo.CONTROL_BASE}`,dt&&(dt[So.POINT]&&(L[So.POINT]=we(So.POINT,{container:Be,className:Eo.CONTROL_BUTTON_POINT,title:`Marker tool ${S.options.keybindings?"(1)":""}`,onActivate:()=>S.events.changeMode(Xi.DRAW_POINT),onDeactivate:()=>S.events.trash()})),dt[So.LINE]&&(L[So.LINE]=we(So.LINE,{container:Be,className:Eo.CONTROL_BUTTON_LINE,title:`LineString tool ${S.options.keybindings?"(2)":""}`,onActivate:()=>S.events.changeMode(Xi.DRAW_LINE_STRING),onDeactivate:()=>S.events.trash()})),dt[So.POLYGON]&&(L[So.POLYGON]=we(So.POLYGON,{container:Be,className:Eo.CONTROL_BUTTON_POLYGON,title:`Polygon tool ${S.options.keybindings?"(3)":""}`,onActivate:()=>S.events.changeMode(Xi.DRAW_POLYGON),onDeactivate:()=>S.events.trash()})),dt.trash&&(L.trash=we("trash",{container:Be,className:Eo.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{S.events.trash()}})),dt.combine_features&&(L.combine_features=we("combineFeatures",{container:Be,className:Eo.CONTROL_BUTTON_COMB
vendor: 4,998 bytes, line 3005
3005INE_FEATURES,title:"Combine",onActivate:()=>{S.events.combineFeatures()}})),dt.uncombine_features&&(L.uncombine_features=we("uncombineFeatures",{container:Be,className:Eo.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{S.events.uncombineFeatures()}}))),Be}function ke(){Object.keys(L).forEach(dt=>{const Be=L[dt];Be.parentNode&&Be.parentNode.removeChild(Be),delete L[dt]})}return{setActiveButton:rt,queueMapClasses:ve,updateMapClasses:s,clearMapClasses:ae,addButtons:ot,removeButtons:ke}}function gA(S){let L=null,V=null;const X={onRemove(){return S.map.off("load",X.connect),clearInterval(V),X.removeLayers(),S.store.restoreMapConfig(),S.ui.removeButtons(),S.events.removeEventListeners(),S.ui.clearMapClasses(),S.boxZoomInitial&&S.map.boxZoom.enable(),S.map=null,S.container=null,S.store=null,L&&L.parentNode&&L.parentNode.removeChild(L),L=null,this},connect(){S.map.off("load",X.connect),clearInterval(V),X.addLayers(),S.store.storeMapConfig(),S.events.addEventListeners()},onAdd(W){if(S.map=W,S.events=fA(S),S.ui=_A(S),S.container=W.getContainer(),S.store=new Sr(S),L=S.ui.addButtons(),S.options.boxSelect){S.boxZoomInitial=W.boxZoom.isEnabled(),W.boxZoom.disable();const ae=W.dragPan.isEnabled();W.dragPan.disable(),W.dragPan.enable(),ae||W.dragPan.disable()}return W.loaded()?X.connect():(W.on("load",X.connect),V=setInterval(()=>{W.loaded()&&X.connect()},16)),S.events.start(),L},addLayers(){S.map.addSource(Yo.COLD,{data:{type:oi.FEATURE_COLLECTION,features:[]},type:"geojson"}),S.map.addSource(Yo.HOT,{data:{type:oi.FEATURE_COLLECTION,features:[]},type:"geojson"}),S.options.styles.forEach(W=>{S.map.addLayer(W)}),S.store.setDirty(!0),S.store.render()},removeLayers(){S.options.styles.forEach(W=>{S.map.getLayer(W.id)&&S.map.removeLayer(W.id)}),S.map.getSource(Yo.COLD)&&S.map.removeSource(Yo.COLD),S.map.getSource(Yo.HOT)&&S.map.removeSource(Yo.HOT)}};return S.setup=X,X}const Ky="#3bb2d0",vf="#fbb03b",yw="#fff",Ww=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],vf,Ky],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],vf,Ky],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":yw}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],vf,Ky]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":yw}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":vf}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":vf}}];function Cl(S,L){this.x=S,this.y=L}Cl.prototype={clone(){return new Cl(this.x,this.y)},add(S){return this.clone()._add(S)},sub(S){return this.clone()._sub(S)},multByPoint(S){return this.clone()._multByPoint(S)},divByPoint(S){return this.clone()._divByPoint(S)},mult(S){return this.clone()._mult(S)},div(S){return this.clone()._div(S)},rotate(S){return this.clone()._rotate(S)},rotateAround(S,L){return this.clone()._rotateAround(S,L)},matMult(S){return this.clone()._matMult(S)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(S){return this.x===S.x&&this.y===S.y},dist(S){return Math.sqrt(this.distSqr(S))},distSqr(S){const L=S.x-this.x,V=S.y-this.y;return L*L+V*V},angle(){return Math.atan2(this.y,this.x)},angleTo(S){return Math.atan2(this.y-S.y,this.x-S.x)},angleWith(S){return this.angleWithSep(S.x,S.y)},angleWithSep(S,L){return Math.atan2(this.x*L-this.y*S,this.x*S+this.y*L)},_matMult(S){const L=S[0]*this.x+S[1]*this.y,V=S[2]*this.x+S[3]*this.y;return this.x=L,this.y=V,this},_add(S){return this.x+=S.x,this.y+=S.y,this},_sub(S){return this.x-=S.x,this.y-=S.y,this},_mult(S){return this.x*=S,this.y*=S,this},_div(S){return this.x/=S,this.y/=S,this},_multByPoint(S){return this.x*=S.x,this.y*=S.y,this},_divByPoint(S){return this.x/=S.x,this.y/=S.y,this},_unit(){return this._div(this.mag()),this},_perp(){const S=this.y;return this.y=this.x,this.x=-S,this},_rotate(S){const L=Math.cos(S),V=Math.sin(S),X=L*this.x-V*this.y,W=V*this.x+L*this.y;return this.x=X,this.y=W,this}
3005,_rotateAround(S,L){const V=Math.cos(S),X=Math.sin(S),W=L.x+V*(this.x-L.x)-X*(this.y-L.y),ae=L.y+X*(this.x-L.x)+V*(this.y-L.y);return this.x=W,this.y=ae,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Cl};Cl.convert=function(S){if(S instanceof Cl)return S;if(Array.isArray(S))return new Cl(+S[0],+S[1]);if(S.x!==void 0&&S.y!==void 0)return new Cl(+S.x,+S.y);throw new Error("Expected [x, y] or {x, y} point format")};function dx(S,L){const V=L.getBoundingClientRect();return new Cl(S.clientX-V.left-(L.clientLeft||0),S.clientY-V.top-(L.clientTop||0))}function rh(S,L,V,X){return{type:oi.FEATURE,properties:{meta:Zn.VERTEX,parent:S,coord_path:V,active:X?Sn.ACTIVE:Sn.INACTIVE},geometry:{type:oi.POINT,coordinates:L}}}function yA(S){return!isNaN(S)&&S!==null&&!Array.isArray(S)}function Xw(S,L,V){if(S!==null)for(var X,W,ae,ve,s,we,Pe,rt=0,ot=0,ke,dt=S.type,Be=dt==="FeatureCollection",Xe=dt==="Feature",pe=Be?S.features.length:1,Ye=0;Ye<pe;Ye++){Pe=Be?S.features[Ye].geometry:Xe?S.geometry:S,ke=Pe?Pe.type==="GeometryCollection":!1,s=ke?Pe.geometries.length:1;for(var at=0;at<s;at++){var gt=0,Qe=0;if(ve=ke?Pe.geometries[at]:Pe,ve!==null){we=ve.coordinates;var He=ve.type;switch(rt=0,He){case null:break;case"Point":if(L(we,ot,Ye,gt,Qe)===!1)return!1;ot++,gt++;break;case"LineString":case"MultiPoint":for(X=0;X<we.length;X++){if(L(we[X],ot,Ye,gt,Qe)===!1)return!1;ot++,He==="MultiPoint"&>++}He==="LineString"&>++;break;case"Polygon":case"MultiLineString":for(X=0;X<we.length;X++){for(W=0;W<we[X].length-rt;W++){if(L(we[X][W],ot,Ye,gt,Qe)===!1)return!1;ot++}He==="MultiLineString"&>++,He==="Polygon"&&Qe++}He==="Polygon"&>++;break;case"MultiPolygon":for(X=0;X<we.length;X++){for(Qe=0,W=0;W<we[X].length;W++){for(ae=0;ae<we[X][W].length-rt;ae++){if(L(we[X][W][ae],ot,Ye,gt,Qe)===!1)return!1;ot++}Qe++}gt++}break;case"GeometryCollection":for(X=0;X<ve.geometries.length;X++)if(Xw(ve.geometries[X],L)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function xA(S){if(!S)throw new Error("geojson is required");switch(S.type){case"Feature":return Yw(S);case"FeatureCollection":return vA(S);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return fx(S);default:throw new Error("unknown GeoJSON type")}}function Yw(S){const L={type:"Feature"};return Object.keys(S).forEach(V=>{switch(V){case"type":case"properties":case"geometry":return;default:L[V]=S[V]}}),L.properties=Kw(S.properties),S.geometry==null?L.geometry=null:L.geometry=fx(S.geometry),L}function Kw(S){const L={};return S&&Object.keys(S).forEach(V=>{const X=S[V];typeof X=="object"?X===null?L[V]=null:Array.isArray(X)?L[V]=X.map(W=>W):L[V]=Kw(X):L[V]=X}),L}function vA(S){const L={type:"FeatureCollection"};return Object.keys(S).forEach(V=>{switch(V){case"type":case"features":return;default:L[V]=S[V]}}),L.features=S.features.map(V=>Yw(V)),L}function fx(S){const L={type:S.type};return S.bbox&&(L.bbox=S.bbox),S.type==="GeometryCollection"?(L.geometries=S.geometries.map(V=>fx(V)),L):(L.coordinates=Jw(S.coordinates),L)}function Jw(S){const L=S;return typeof L[0]!="object"?L.slice():L.map(V=>Jw(V))}function xw(S,L={}){return Qw(S,"mercator",L)}function bA(S,L={}){return Qw(S,"wgs84",L)}function Qw(S,L,V={}){V=V||{};var X=V.mutate;if(!S)throw new Error("geojson is required");return Array.isArray(S)&&yA(S[0])?S=L==="mercator"?vw(S):bw(S):(X!==!0&&(S=xA(S)),Xw(S,function(W){var ae=L==="mercator"?vw(W):bw(W);W[0]=ae[0],W[1]=ae[1]})),S}function vw(S){var L=Math.PI/180,V=6378137,X=20037508342789244e-9,W=Math.abs(S[0])<=180?S[0]:S[0]-wA(S[0])*360,ae=[V*W*L,V*Math.log(Math.tan(Math.PI*.25+.5*S[1]*L))];return ae[0]>X&&(ae[0]=X),ae[0]<-X&&(ae[0]=-X),ae[1]>X&&(ae[1]=X),ae[1]<-X&&(ae[1]=-X),ae}function bw(S){var L=180/Math.PI,V=6378137;
3005return[S[0]*L/V,(Math.PI*.5-2*Math.atan(Math.exp(-S[1]/V)))*L]}function wA(S){return S<0?-1:S>0?1:0}function eT(S,L,V){const X=L.geometry.coordinates,W=V.geometry.coordinates;if(X[1]>tx||X[1]<ex||W[1]>tx||W[1]<ex)return null;const ae=xw(X),ve=xw(W),s=ot=>Number(ot.toFixed(8)),we=(ot,ke)=>(ot+ke)/2,Pe=bA([we(ae[0],ve[0]),we(ae[1],ve[1])]),rt=[s(Pe[0]),s(Pe[1])];return{type:oi.FEATURE,properties:{meta:Zn.MIDPOINT,parent:S,lng:rt[0],lat:rt[1],coord_path:V.properties.coord_path},geometry:{type:oi.POINT,coordinates:rt}}}function c_(S,L={},V=null){const{type:X,coordinates:W}=S.geometry,ae=S.properties&&S.properties.id;let ve=[];X===oi.POINT?ve.push(rh(ae,W,V,we(V))):X===oi.POLYGON?W.forEach((rt,ot)=>{s(rt,V!==null?`${V}.${ot}`:String(ot))}):X===oi.LINE_STRING?s(W,V):X.indexOf(oi.MULTI_PREFIX)===0&&Pe();function s(rt,ot){let ke="",dt=null;rt.forEach((Be,Xe)=>{const pe=ot!=null?`${ot}.${Xe}`:String(Xe),Ye=rh(ae,Be,pe,we(pe));if(L.midpoints&&dt){const gt=eT(ae,dt,Ye);gt&&ve.push(gt)}dt=Ye;const at=JSON.stringify(Be);ke!==at&&ve.push(Ye),Xe===0&&(ke=at)})}function we(rt){return L.selectedPaths?L.selectedPaths.indexOf(rt)!==-1:!1}function Pe(){const rt=X.replace(oi.MULTI_PREFIX,"");W.forEach((ot,ke)=>{const dt={type:oi.FEATURE,properties:S.properties,geometry:{type:rt,coordinates:ot}};ve=ve.concat(c_(dt,L,ke))})}return ve}const ws={enable(S){setTimeout(()=>{!S.map||!S.map.doubleClickZoom||!S._ctx||!S._ctx.store||!S._ctx.store.getInitialConfigValue||S._ctx.store.getInitialConfigValue("doubleClickZoom")&&S.map.doubleClickZoom.enable()},0)},disable(S){setTimeout(()=>{!S.map||!S.map.doubleClickZoom||S.map.doubleClickZoom.disable()},0)}},{LAT_MIN:Ym,LAT_MAX:Km,LAT_RENDERED_MIN:ww,LAT_RENDERED_MAX:Tw,LNG_MIN:Ew,LNG_MAX:Sw}=kw;function TA(S){const L={Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[S.geometry.type],V=[S.geometry.coordinates].flat(L),X=V.map(s=>s[0]),W=V.map(s=>s[1]),ae=s=>Math.min.apply(null,s),ve=s=>Math.max.apply(null,s);return[ae(X),ae(W),ve(X),ve(W)]}function px(S,L){let V=Ym,X=Km,W=Ym,ae=Km,ve=Sw,s=Ew;S.forEach(Pe=>{const rt=TA(Pe),ot=rt[1],ke=rt[3],dt=rt[0],Be=rt[2];ot>V&&(V=ot),ke<X&&(X=ke),ke>W&&(W=ke),ot<ae&&(ae=ot),dt<ve&&(ve=dt),Be>s&&(s=Be)});const we=L;return V+we.lat>Tw&&(we.lat=Tw-V),W+we.lat>Km&&(we.lat=Km-W),X+we.lat<ww&&(we.lat=ww-X),ae+we.lat<Ym&&(we.lat=Ym-ae),ve+we.lng<=Ew&&(we.lng+=Math.ceil(Math.abs(we.lng)/360)*360),s+we.lng>=Sw&&(we.lng-=Math.ceil(Math.abs(we.lng)/360)*360),we}function mx(S,L){const V=px(S.map(X=>X.toGeoJSON()),L);S.forEach(X=>{const W=X.getCoordinates(),ae=Pe=>{const rt={lng:Pe[0]+V.lng,lat:Pe[1]+V.lat};return[rt.lng,rt.lat]},ve=Pe=>Pe.map(rt=>ae(rt)),s=Pe=>Pe.map(rt=>ve(rt));let we;X.type===oi.POINT?we=ae(W):X.type===oi.LINE_STRING||X.type===oi.MULTI_POINT?we=W.map(ae):X.type===oi.POLYGON||X.type===oi.MULTI_LINE_STRING?we=W.map(ve):X.type===oi.MULTI_POLYGON&&(we=W.map(s)),X.incomingCoords(we)})}const xr={};xr.onSetup=function(S){const L={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:S.featureIds||[]};return this.setSelected(L.initiallySelectedFeatureIds.filter(V=>this.getFeature(V)!==void 0)),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),L};xr.fireUpdate=function(){this.fire(po.UPDATE,{action:wf.MOVE,features:this.getSelected().map(S=>S.toGeoJSON())})};xr.fireActionable=function(){const S=this.getSelected(),L=S.filter(ae=>this.isInstanceOf("MultiFeature",ae));let V=!1;if(S.length>1){V=!0;const ae=S[0].type.replace("Multi","");S.forEach(ve=>{ve.type.replace("Multi","")!==ae&&(V=!1)})}const X=L.length>0,W=S.length>0;this.setActionableState({combineFeatures:V,uncombineFeatures:X,trash:W})};xr.getUniqueIds=function(S){return S.length?S.map(V=>V.properties.id).filter(V=>V!==void 0).reduce((V,X)=>(V.add(X),V),new Ko).values():[]};xr.stopExtendedInteractions=function(S){S.boxSelectElement&&(S.boxSelectElement.parentNode&&S.boxSelectElement.parentNode.removeChild(S.boxSelectElement),S.boxSelectElement=null),(S.canDragMove||S.canBoxSelect)&&S.initialDragPanState===!0&&this.map.dragPan.enable(),S.boxSelecting=!1,S.canBoxSelect=!1,S.dragMoving=!1,S.canDragMove=!1};xr.onStop=function(){ws.enable(this)};xr.onMouseMove=function(S,L){return cx(L)&&S.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(S),!0};xr.onMouseOut=function(S){return S.dragMoving?this.fireUpdate():!0};xr.onTap=xr.onClick=function(S,L){if(o_(L))return this.clickAnywhere(S,L);if(n_(Zn.VERTEX)(L))return this.clickOnVertex(S,L);if(cx(L))return this.clickOnFeature(S,L)};xr.clickAnywhere=function(S){const L=this.getSelectedIds();
3005L.length&&(this.clearSelectedFeatures(),L.forEach(V=>this.doRender(V))),ws.enable(this),this.stopExtendedInteractions(S)};xr.clickOnVertex=function(S,L){this.changeMode(Xi.DIRECT_SELECT,{featureId:L.featureTarget.properties.parent,coordPath:L.featureTarget.properties.coord_path,startPos:L.lngLat}),this.updateUIClasses({mouse:Or.MOVE})};xr.startOnActiveFeature=function(S,L){this.stopExtendedInteractions(S),this.map.dragPan.disable(),this.doRender(L.featureTarget.properties.id),S.canDragMove=!0,S.dragMoveLocation=L.lngLat};xr.clickOnFeature=function(S,L){ws.disable(this),this.stopExtendedInteractions(S);const V=t_(L),X=this.getSelectedIds(),W=L.featureTarget.properties.id,ae=this.isSelected(W);if(!V&&ae&&this.getFeature(W).type!==oi.POINT)return this.changeMode(Xi.DIRECT_SELECT,{featureId:W});ae&&V?(this.deselect(W),this.updateUIClasses({mouse:Or.POINTER}),X.length===1&&ws.enable(this)):!ae&&V?(this.select(W),this.updateUIClasses({mouse:Or.MOVE})):!ae&&!V&&(X.forEach(ve=>this.doRender(ve)),this.setSelected(W),this.updateUIClasses({mouse:Or.MOVE})),this.doRender(W)};xr.onMouseDown=function(S,L){if(S.initialDragPanState=this.map.dragPan.isEnabled(),Dc(L))return this.startOnActiveFeature
3005(S,L);if(this.drawConfig.boxSelect&&Bw(L))return this.startBoxSelect(S,L)};xr.startBoxSelect=function(S,L){this.stopExtendedInteractions(S),this.map.dragPan.disable(),S.boxSelectStartLocation=dx(L.originalEvent,this.map.getContainer()),S.canBoxSelect=!0};xr.onTouchStart=function(S,L){if(Dc(L))return this.startOnActiveFeature(S,L)};xr.onDrag=function(S,L){if(S.canDragMove)return this.dragMove(S,L);if(this.drawConfig.boxSelect&&S.canBoxSelect)return this.whileBoxSelect(S,L)};xr.whileBoxSelect=function(S,L){S.boxSelecting=!0,this.updateUIClasses({mouse:Or.ADD}),S.boxSelectElement||(S.boxSelectElement=document.createElement("div"),S.boxSelectElement.classList.add(Eo.BOX_SELECT),this.map.getContainer().appendChild(S.boxSelectElement));const V=dx(L.originalEvent,this.map.getContainer()),X=Math.min(S.boxSelectStartLocation.x,V.x),W=Math.max(S.boxSelectStartLocation.x,V.x),ae=Math.min(S.boxSelectStartLocation.y,V.y),ve=Math.max(S.boxSelectStartLocation.y,V.y),s=`translate(${X}px, ${ae}px)`;S.boxSelectElement.style.transform=s,S.boxSelectElement.style.WebkitTransform=s,S.boxSelectElement.style.width=`${W-X}px`,S.boxSelectElement.style.height=`${ve-ae}px`};xr.dragMove=function(S,L){S.dragMoving=!0,L.originalEvent.stopPropagation();const V={lng:L.lngLat.lng-S.dragMoveLocation.lng,lat:L.lngLat.lat-S.dragMoveLocation.lat};mx(this.getSelected(),V),S.dragMoveLocation=L.lngLat};xr.onTouchEnd=xr.onMouseUp=function(S,L){if(S.dragMoving)this.fireUpdate();else if(S.boxSelecting){const V=[S.boxSelectStartLocation,dx(L.originalEvent,this.map.getContainer())],X=this.featuresAt(null,V,"click"),W=this.getUniqueIds(X).filter(ae=>!this.isSelected(ae));W.length&&(this.select(W),W.forEach(ae=>this.doRender(ae)),this.updateUIClasses({mouse:Or.MOVE}))}this.stopExtendedInteractions(S)};xr.toDisplayFeatures=function(S,L,V){L.properties.active=this.isSelected(L.properties.id)?Sn.ACTIVE:Sn.INACTIVE,V(L),this.fireActionable(),!(L.properties.active!==Sn.ACTIVE||L.geometry.type===oi.POINT)&&c_(L).forEach(V)};xr.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()};xr.onCombineFeatures=function(){const S=this.getSelected();if(S.length===0||S.length<2)return;const L=[],V=[],X=S[0].type.replace("Multi","");for(let W=0;W<S.length;W++){const ae=S[W];if(ae.type.replace("Multi","")!==X)return;
3005ae.type.includes("Multi")?ae.getCoordinates().forEach(ve=>{L.push(ve)}):L.push(ae.getCoordinates()),V.push(ae.toGeoJSON())}if(V.length>1){const W=this.newFeature({type:oi.FEATURE,properties:V[0].properties,geometry:{type:`Multi${X}`,coordinates:L}});this.addFeature(W),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([W.id]),this.fire(po.COMBINE_FEATURES,{createdFeatures:[W.toGeoJSON()],deletedFeatures:V})}this.fireActionable()};xr.onUncombineFeatures=function(){const S=this.getSelected();if(S.length===0)return;const L=[],V=[];for(let X=0;X<S.length;X++){const W=S[X];this.isInstanceOf("MultiFeature",W)&&(W.getFeatures().forEach(ae=>{this.addFeature(ae),ae.properties=W.properties,L.push(ae.toGeoJSON()),this.select([ae.id])}),this.deleteFeature(W.id,{silent:!0}),V.push(W.toGeoJSON()))}L.length>1&&this.fire(po.UNCOMBINE_FEATURES,{createdFeatures:L,deletedFeatures:V}),this.fireActionable()};const tT=n_(Zn.VERTEX),iT=n_(Zn.MIDPOINT),vr={};vr.fireUpdate=function(){this.fire(po.UPDATE,{action:wf.CHANGE_COORDINATES,features:this.getSelected().map(S=>S.toGeoJSON())})};vr.fireActionable=function(S){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:S.selectedCoordPaths.length>0})};vr.startDragging=function(S,L){S.initialDragPanState==null&&(S.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),S.canDragMove=!0,S.dragMoveLocation=L.lngLat};vr.stopDragging=function(S){S.canDragMove&&S.initialDragPanState===!0&&this.map.dragPan.enable(),S.initialDragPanState=null,S.dragMoving=!1,S.canDragMove=!1,S.dragMoveLocation=null};vr.onVertex=function(S,L){this.startDragging(S,L);const V=L.featureTarget.properties,X=S.selectedCoordPaths.indexOf(V.coord_path);!t_(L)&&X===-1?S.selectedCoordPaths=[V.coord_path]:t_(L)&&X===-1&&S.selectedCoordPaths.push(V.coord_path);const W=this.pathsToCoordinates(S.featureId,S.selectedCoordPaths);this.setSelectedCoordinates(W)};vr.onMidpoint=function(S,L){this.startDragging(S,L);const V=L.featureTarget.properties;S.feature.addCoordinate(V.coord_path,V.lng,V.lat),this.fireUpdate(),S.selectedCoordPaths=[V.coord_path]};vr.pathsToCoordinates=function(S,L){return L.map(V=>({feature_id:S,coord_path:V}))};vr.onFeature=function(S,L){S.selectedCoordPaths.length===0?this.startDragging(S,L):this.stopDragging(S)};vr.dragFeature=function(S,L,V){mx(this.getSelected(),V),S.dragMoveLocation=L.lngLat};vr.dragVertex=function(S,L,V){const X=S.selectedCoordPaths.map(ve=>S.feature.getCoordinate(ve)),W=X.map(ve=>({type:oi.FEATURE,properties:{},geometry:{type:oi.POINT,coordinates:ve}})),ae=px(W,V);for(let ve=0;ve<X.length;ve++){const s=X[ve];S.feature.updateCoordinate(S.selectedCoordPaths[ve],s[0]+ae.lng,s[1]+ae.lat)}};vr.clickNoTarget=function(){this.changeMode(Xi.SIMPLE_SELECT)};vr.clickInactive=function(){this.changeMode(Xi.SIMPLE_SELECT)};vr.clickActiveFeature=function(S){S.selectedCoordPaths=[],this.clearSelectedCoordinates(),S.feature.changed()};vr.onSetup=function(S){const L=S.featureId,V=this.getFeature(L);if(!V)throw new Error("You must provide a featureId to enter direct_select mode");if(V.type===oi.POINT)throw new TypeError("direct_select mode doesn't handle point features");const X={featureId:L,feature:V,dragMoveLocation:S.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:S.coordPath?[S.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(L,X.selectedCoordPaths)),this.setSelected(L),ws.disable(this),this.setActionableState({trash:!0}),X};vr.onStop=function(){ws.enable(this),this.clearSelectedCoordinates()};vr.toDisplayFeatures=function(S,L,V){S.featureId===L.properties.id?(L.properties.active=Sn.ACTIVE,V(L),c_(L,{map:this.map,midpoints:!0,selectedPaths:S.selectedCoordPaths}).forEach(V)):(L.properties.active=Sn.INACTIVE,V(L)),this.fireActionable(S)};vr.onTrash=function(S){S.selectedCoordPaths.sort((L,V)=>V.localeCompare(L,"en",{numeric:!0})).forEach(L=>S.feature.removeCoordinate(L)),this.fireUpdate(),S.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(S),S.feature.isValid()===!1&&(this.deleteFeature([S.featureId]),this.changeMode(Xi.SIMPLE_SELECT,{}))};vr.onMouseMove=function(S,L){const V=Dc(L),X=tT(L),W=iT(L),ae=S.selectedCoordPaths.length===0;return V&&ae?this.updateUIClasses({mouse:Or.MOVE}):X&&!ae?this.updateUIClasses({mouse:Or.MOVE}):this.updateUIClasses({mouse:Or.NONE}),(X||V||W)&&S.dragMoving&&this.fireUpdate(),this.stopDragging(S),!0};vr.onMouseOut=function(S){return S.dragMoving&&this.fireUpdate(),!0};vr.onTouchStart=vr.onMouseDown=function(S,L){if(tT(L))return this.onVertex(S,L);if(Dc(L))return this.onFeature(S,L);if(iT(L))return this.onMidpoint(S,L)};vr.onDrag=function(S,L){if(S.canDragMove!==!0)return;S.dragMoving=!0,L.originalEvent.stopPropagation();const V={lng:L.lngLat.lng-S.dragMoveLocation.lng,lat:L.lngLat.lat-S.dragMoveLocation.lat};S.selectedCoordPaths.length>
30050?this.dragVertex(S,L,V):this.dragFeature(S,L,V),S.dragMoveLocation=L.lngLat};vr.onClick=function(S,L){if(o_(L))return this.clickNoTarget(S,L);if(Dc(L))return this.clickActiveFeature(S,L);if(lx(L))return this.clickInactive(S,L);this.stopDragging(S)};vr.onTap=function(S,L){if(o_(L))return this.clickNoTarget(S,L);if(Dc(L))return this.clickActiveFeature(S,L);if(lx(L))return this.clickInactive(S,L)};vr.onTouchEnd=vr.onMouseUp=function(S){S.dragMoving&&this.fireUpdate(),this.stopDragging(S)};const oa={};oa.onSetup=function(){const S=this.newFeature({type:oi.FEATURE,properties:{},geometry:{type:oi.POINT,coordinates:[]}});return this.addFeature(S),this.clearSelectedFeatures(),this.updateUIClasses({mouse:Or.ADD}),this.activateUIButton(So.POINT),this.setActionableState({trash:!0}),{point:S}};oa.stopDrawingAndRemove=function(S){this.deleteFeature([S.point.id],{silent:!0}),this.changeMode(Xi.SIMPLE_SELECT)};oa.onTap=oa.onClick=function(S,L){this.updateUIClasses({mouse:Or.MOVE}),S.point.updateCoordinate("",L.lngLat.lng,L.lngLat.lat),this.fire(po.CREATE,{features:[S.point.toGeoJSON()]}),this.changeMode(Xi.SIMPLE_SELECT,{featureIds:[S.point.id]})};oa.onStop=function(S){this.activateUIButton(),S.point.getCoordinate().length||this.deleteFeature([S.point.id],{silent:!0})};oa.toDisplayFeatures=function(S,L,V){const X=L.properties.id===S.point.id;if(L.properties.active=X?Sn.ACTIVE:Sn.INACTIVE,!X)return V(L)};oa.onTrash=oa.stopDrawingAndRemove;oa.onKeyUp=function(S,L){if(s_(L)||a_(L))return this.stopDrawingAndRemove(S,L)};function i_(S,L){return S.lngLat?S.lngLat.lng===L[0]&&S.lngLat.lat===L[1]:!1}const Ts={};Ts.onSetup=function(){const S=this.newFeature({type:oi.FEATURE,properties:{},geometry:{type:oi.POLYGON,coordinates:[[]]}});return this.addFeature(S),this.clearSelectedFeatures(),ws.disable(this),this.updateUIClasses({mouse:Or.ADD}),this.activateUIButton(So.POLYGON),this.setActionableState({trash:!0}),{polygon:S,currentVertexPosition:0}};Ts.clickAnywhere=function(S,L){if(S.currentVertexPosition>0&&i_(L,S.polygon.coordinates[0][S.currentVertexPosition-1]))return this.changeMode(Xi.SIMPLE_SELECT,{featureIds:[S.polygon.id]});this.updateUIClasses({mouse:Or.ADD}),S.polygon.updateCoordinate(`0.${S.currentVertexPosition}`,L.lngLat.lng,L.lngLat.lat),S.currentVertexPosition++,S.polygon.updateCoordinate(`0.${S.currentVertexPosition}`,L.lngLat.lng,L.lngLat.lat)};Ts.clickOnVertex=function(S){return this.changeMode(Xi.SIMPLE_SELECT,{featureIds:[S.polygon.id]})};Ts.onMouseMove=function(S,L){S.polygon.updateCoordinate(`0.${S.currentVertexPosition}`,L.lngLat.lng,L.lngLat.lat),Tf(L)&&this.updateUIClasses({mouse:Or.POINTER})};Ts.onTap=Ts.onClick=function(S,L){return Tf(L)?this.clickOnVertex(S,L):this.clickAnywhere(S,L)};Ts.onKeyUp=function(S,L){s_(L)?(this.deleteFeature([S.polygon.id],{silent:!0}),this.changeMode(Xi.SIMPLE_SELECT)):a_(L)&&this.changeMode(Xi.SIMPLE_SELECT,{featureIds:[S.polygon.id]})};Ts.onStop=function(S){this.updateUIClasses({mouse:Or.NONE}),ws.enable(this),this.activateUIButton(),this.getFeature(S.polygon.id)!==void 0&&(S.polygon.removeCoordinate(`0.${S.currentVertexPosition}`),S.polygon.isValid()?this.fire(po.CREATE,{features:[S.polygon.toGeoJSON()]}):(this.deleteFeature([S.polygon.id],{silent:!0}),this.changeMode(Xi.SIMPLE_SELECT,{},{silent:!0})))};Ts.toDisplayFeatures=function(S,L,V){const X=L.properties.id===S.polygon.id;if(L.properties.active=X?Sn.ACTIVE:Sn.INACTIVE,!X)return V(L);if(L.geometry.coordinates.length===0)return;const W=L.geometry.coordinates[0].length;if(!(W<3)){if(L.properties.meta=Zn.FEATURE,V(rh(S.polygon.id,L.geometry.coordinates[0][0],"0.0",!1)),W>3){const ae=L.geometry.coordinates[0].length-3;V(rh(S.polygon.id,L.geometry.coordinates[0][ae],`0.${ae}`,!1))}if(W<=4){const ae=[[L.geometry.coordinates[0][0][0],L.geometry.coordinates[0][0][1]],[L.geometry.coordinates[0][1][0],L.geometry.coordinates[0][1][1]]];if(V({type:oi.FEATURE,properties:L.properties,geometry:{coordinates:ae,type:oi.LINE_STRING}}),W===3)return}return V(L)}};Ts.onTrash=function(S){this.deleteFeature([S.polygon.id],{silent:!0}),this.changeMode(Xi.SIMPLE_SELECT)};const Es={};Es.onSetup=function(S){S=S||{};const L=S.featureId;let V,X,W="forward";if(L){if(V=this.getFeature(L),!V)throw new Error("Could not find a feature with the provided featureId");let ae=S.from;if(ae&&ae.type==="Feature"&&ae.geometry&&ae.geometry.type==="Point"&&(ae=ae.geometry),ae&&ae.type==="Point"&&ae.coordinates&&ae.coordinates.length===2&&(ae=ae.coordinates),!ae||!Array.isArray(ae))throw new Error("Please use the `from` property to indicate which point to continue the line from");const ve=V.coordinates.length-1;if(V.coordinates[ve][0]===ae[0]&&V.coordinates[ve][1]===ae[1])X=ve+1,V.addCoordinate(X,...V.coordinates[ve]);else if(V.coordinates[0][0]===ae[0]&&V.coordinates[0][1]===ae[1])W="backwards",X=0,V.addCoordinate(X,...V.coordinates[0]);else throw new Error("`from` should match the point at either the start or the end of the provided LineString")}else V=this.newFeature({type:oi.FEATURE,properties:{},geometry:{type:oi.LINE_STRING,coordinates:[]}}),X=0,this.addFeature(V);return this.clearSelectedFeatures(),ws.disable(this),this.updateUIClasses({mouse:Or.ADD}),this.activateUIButton(So.LINE),this.setActionableState({trash:!0}),{line:V,currentVertexPosition:X,direction:W}};Es.clickAnywhere=function(S,L){if(S.currentVertexPosition>0&&i_(L,S.line.coordinates[S.currentVertexPosition-1])||S.direction==="backwards"&&i_(L,S.line.coordinates[S.currentVertexPosition+1]))return this.changeMode(Xi.SIMPLE_SELECT,{featureIds:[S.line.id]});this.updateUIClasses({mouse:Or.ADD}),S.line.updateCoordinate(S.currentVertexPosition,L.lngLat.lng,L.lngLat.lat),S.direction==="forward"?(S.currentVertexPosition++,S.line.updateCoordinate(S.currentVertexPosition,L.lngLat.lng,L.lngLat.lat)):S.line.addCoordinate(0,L.lngLat.lng,L.lngLat.lat)};Es.clickOnVertex=function(S){return this.changeMode(Xi.SIMPLE_SELECT,{featureIds:[S.line.id]})};Es.onMouseMove=function(S,L){S.line.updateCoordinate(S.currentVertexPosition,L.lngLat.lng,L.lngLat.lat),Tf(L)&&this.updateUIClasses({mouse:Or.POINTER})};Es.onTap=Es.onClick=function(S,L){if(Tf(L))return this.clickOnVertex(S,L);this.clickAnywhere(S,L)};Es.onKeyUp=function(S,L){a_(L)?this.changeMode(Xi.SIMPLE_SELECT,{featureIds:[S.line.id]}
3005):s_(L)&&(this.deleteFeature([S.line.id],{silent:!0}),this.changeMode(Xi.SIMPLE_SELECT))};Es.onStop=function(S){ws.enable(this),this.activateUIButton(),this.getFeature(S.line.id)!==void 0&&(S.line.removeCoordinate(`${S.currentVertexPosition}`),S.line.isValid()?this.fire(po.CREATE,{features:[S.line.toGeoJSON()]}):(this.deleteFeature([S.line.id],{silent:!0}),this.changeMode(Xi.SIMPLE_SELECT,{},{silent:!0})))};Es.onTrash=function(S){this.deleteFeature([S.line.id],{silent:!0}),this.changeMode(Xi.SIMPLE_SELECT)};Es.toDisplayFeatures=function(S,L,V){const X=L.properties.id===S.line.id;if(L.properties.active=X?Sn.ACTIVE:Sn.INACTIVE,!X)return V(L);L.geometry.coordinates.length<2||(L.properties.meta=Zn.FEATURE,V(rh(S.line.id,L.geometry.coordinates[S.direction==="forward"?L.geometry.coordinates.length-2:1],`${S.direction==="forward"?L.geometry.coordinates.length-2:1}`,!1)),V(L))};const rT={simple_select:xr,direct_select:vr,draw_point:oa,draw_polygon:Ts,draw_line_string:Es},EA={defaultMode:Xi.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:Ww,modes:rT,controls:{},userProperties:!1,suppressAPIEvents:!0},SA={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},IA={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function Iw(S,L){return S.map(V=>V.source?V:Object.assign({},V,{id:`${V.id}.${L}`,source:L==="hot"?Yo.HOT:Yo.COLD}))}function AA(S={}){let L=Object.assign({},S);return S.controls||(L.controls={}),S.displayControlsDefault===!1?L.controls=Object.assign({},IA,S.controls):L.controls=Object.assign({},SA,S.controls),L=Object.assign({},EA,L),L.styles=Iw(L.styles,"cold").concat(Iw(L.styles,"hot")),L}var Jy,Aw;function MA(){return Aw||(Aw=1,Jy=function S(L,V){if(L===V)return!0;if(L&&V&&typeof L=="object"&&typeof V=="object"){if(L.constructor!==V.constructor)return!1;var X,W,ae;if(Array.isArray(L)){if(X=L.length,X!=V.length)return!1;for(W=X;W--!==0;)if(!S(L[W],V[W]))return!1;return!0}if(L.constructor===RegExp)return L.source===V.source&&L.flags===V.flags;if(L.valueOf!==Object.prototype.valueOf)return L.valueOf()===V.valueOf();if(L.toString!==Object.prototype.toString)return L.toString()===V.toString();if(ae=Object.keys(L),X=ae.length,X!==Object.keys(V).length)return!1;for(W=X;W--!==0;)if(!Object.prototype.hasOwnProperty.call(V,ae[W]))return!1;for(W=X;W--!==0;){var ve=ae[W];if(!S(L[ve],V[ve]))return!1}return!0}return L!==L&&V!==V}),Jy}var CA=MA();const Mw=ax(CA);var Qy,Cw;function PA(){if(Cw)return Qy;Cw=1,Qy=L;var S={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};function L(V){if(!V||!V.type)return null;var X=S[V.type];if(!X)return null;if(X==="geometry")return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:V}]};if(X==="feature")return{type:"FeatureCollection",features:[V]};if(X==="featurecollection")return V}return Qy}var RA=PA();const LA=ax(RA);function nT(S,L){return S.length!==L.length?!1:JSON.stringify(S.map(V=>V).sort())===JSON.stringify(L.map(V=>V).sort())}const DA={Polygon:zo,LineString:sa,Point:Pl,MultiPolygon:fo,MultiLineString:fo,MultiPoint:fo};function zA(S,L){L.modes=Xi;const V=S.options.suppressAPIEvents!==void 0?!!S.options.suppressAPIEvents:!0;return L.getFeatureIdsAt=function(X){return ih.click({point:X},null,S).map(ae=>ae.properties.id)},L.getSelectedIds=function(){return S.store.getSelectedIds()},L.getSelected=function(){return{type:oi.FEATURE_COLLECTION,features:S.store.getSelectedIds().map(X=>S.store.get(X)).map(X=>X.toGeoJSON())}},L.getSelectedPoints=function(){return{type:oi.FEATURE_COLLECTION,features:S.store.getSelectedCoordinates().map(X=>({type:oi.FEATURE,properties:{},geometry:{type:oi.POINT,coordinates:X.coordinates}}))}},L.set=function(X){if(X.type===void 0||X.type!==oi.FEATURE_COLLECTION||!Array.isArray(X.features))throw new Error("Invalid FeatureCollection");const W=S.store.createRenderBatch();let ae=S.store.getAllIds().slice();const ve=L.add(X),s=new Ko(ve);return ae=ae.filter(we=>!s.has(we)),ae.length&&L.delete(ae),W(),ve},L.add=function(X){const ae=JSON.parse(JSON.stringify(LA(X))).features.map(ve=>{if(ve.id=ve.id||hx(),ve.geometry===null)throw new Error("Invalid geometry: null");if(S.store.get(ve.id)===void 0||S.store.get(ve.id).type!==ve.geometry.type){const s=DA[ve.geometry.type];if(s===void 0)throw new Error(`Invalid geometry type: ${ve.geometry.type}.`);const we=new s(S,ve);S.store.add(we,{silent:V})}else{const s=S.store.get(ve.id),we=s.properties;s.properties=ve.properties,Mw(we,ve.properties)||S.store.featureChanged(s.id,{silent:V}),Mw(s.getCoordinates(),ve.geometry.coordinates)||s.incomingCoords(ve.geometry.coordinates)}return ve.id});return S.store.render(),ae},L.get=function(X){const W=S.store.get(X);if(W)return W.toGeoJSON()},L.getAll=function(){return{type:oi.FEATURE_COLLECTION,features:S.store.getAll().map(X=>X.toGeoJSON())}},L.delete=function(X){return S.store.delete(X,{silent:V}),L.getMode()===Xi.DIRECT_SELECT&&!S.store.getSelectedIds().length?S.events.changeMode(Xi.SIMPLE_SELECT,void 0,{silent:V}):S.store.render(),L},L.deleteAll=function(){return S.store.delete(S.store.getAllIds(),{silent:V}),L.getMode()===Xi.DIRECT_SELECT?S.events.changeMode(Xi.SIMPLE_SELECT,void 0,{silent:V}):S.store.render(),L},L.changeMode=function(X,W={}){return X===Xi.SIMPLE_SELECT&&L.getMode()===Xi.SIMPLE_SELECT?(nT(W.featureIds||[],S.store.getSelectedIds())||
3005(S.store.setSelected(W.featureIds,{silent:V}),S.store.render()),L):(X===Xi.DIRECT_SELECT&&L.getMode()===Xi.DIRECT_SELECT&&W.featureId===S.store.getSelectedIds()[0]||S.events.changeMode(X,W,{silent:V}),L)},L.getMode=function(){return S.events.getMode()},L.trash=function(){return S.events.trash({silent:V}),L},L.combineFeatures=function(){return S.events.combineFeatures({silent:V}),L},L.uncombineFeatures=function(){return S.events.uncombineFeatures({silent:V}),L},L.setFeatureProperty=function(X,W,ae){return S.store.setFeatureProperty(X,W,ae,{silent:V}),L},L}const OA=Object.freeze(Object.defineProperty({__proto__:null,CommonSelectors:W2,ModeHandler:sx,StringSet:Ko,constrainFeatureMovement:px,createMidPoint:eT,createSupplementaryPoints:c_,createVertex:rh,doubleClickZoom:ws,euclideanDistance:ux,featuresAt:ih,getFeatureAtAndSetCursors:e_,isClick:nx,isEventAtCoordinates:i_,isTap:ox,mapEventToBoundingBox:qw,moveFeatures:mx,sortFeatures:Gw,stringSetsAreEqual:nT,theme:Ww,toDenseArray:Ef},Symbol.toStringTag,{value:"Module"})),FA=function(S,L){S=AA(S);const V={options:S};L=zA(V,L),V.api=L;const X=gA(V);return L.onAdd=X.onAdd,L.onRemove=X.onRemove,L.types=So,L.options=S,L};function _x(S){FA(S,this)}_x.modes=rT;_x.constants=kw;_x.lib=OA;export{_x as M,VA as a,NA as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.