vendor: 6,422 bytes, line 1
1import{g as Mb}from"./index-BFmQHhrD.js";function Cb(hh,dp){for(var lo=0;lo<dp.length;lo++){const os=dp[lo];if(typeof os!="string"&&!Array.isArray(os)){for(const co in os)if(co!=="default"&&!(co in hh)){const Oa=Object.getOwnPropertyDescriptor(os,co);Oa&&Object.defineProperty(hh,co,Oa.get?Oa:{enumerable:!0,get:()=>os[co]})}}}return Object.freeze(Object.defineProperty(hh,Symbol.toStringTag,{value:"Module"}))}var up={exports:{}},Pb=up.exports,Kx;function zb(){return Kx||(Kx=1,(function(hh,dp){(function(lo,os){hh.exports=os()})(Pb,(function(){var lo,os,co;function Oa(o,Gr){if(!lo)lo=Gr;else if(!os)os=Gr;else{var $i="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 = {}; ("+lo+")(sharedChunk); ("+os+")(sharedChunk); self.onerror = null;",as={};lo(as),co=Gr(as),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(co.workerUrl=window.URL.createObjectURL(new Blob([$i],{type:"text/javascript"})))}}Oa(["exports"],(function(o){var Gr=1e-6,$i=typeof Float32Array<"u"?Float32Array:Array;function as(r,e){var i=e[0],s=e[1],a=e[2],h=e[3],u=i*h-a*s;return u?(r[0]=h*(u=1/u),r[1]=-s*u,r[2]=-a*u,r[3]=i*u,r):null}function jl(){var r=new $i(9);return $i!=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 ho(r,e){var i=e[0],s=e[1],a=e[2],h=e[3],u=e[4],p=e[5],_=e[6],g=e[7],v=e[8];return r[0]=u*v-p*g,r[1]=a*g-s*v,r[2]=s*p-a*u,r[3]=p*_-h*v,r[4]=i*v-a*_,r[5]=a*h-i*p,r[6]=h*g-u*_,r[7]=s*_-i*g,r[8]=i*u-s*h,r}function Kn(r,e,i){var s=e[0],a=e[1],h=e[2],u=e[3],p=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=i[0],I=i[1],A=i[2],P=i[3],R=i[4],O=i[5],U=i[6],V=i[7],G=i[8];return r[0]=w*s+I*u+A*g,r[1]=w*a+I*p+A*v,r[2]=w*h+I*_+A*b,r[3]=P*s+R*u+O*g,r[4]=P*a+R*p+O*v,r[5]=P*h+R*_+O*b,r[6]=U*s+V*u+G*g,r[7]=U*a+V*p+G*v,r[8]=U*h+V*_+G*b,r}function uo(){var r=new $i(16);return $i!=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 Bt(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 Jr(r,e){var i=e[0],s=e[1],a=e[2],h=e[3],u=e[4],p=e[5],_=e[6],g=e[7],v=e[8],b=e[9],w=e[10],I=e[11],A=e[12],P=e[13],R=e[14],O=e[15],U=i*p-s*u,V=i*_-a*u,G=i*g-h*u,re=s*_-a*p,Q=s*g-h*p,te=a*g-h*_,ae=v*P-b*A,ce=v*R-w*A,Ee=v*O-I*A,de=b*R-w*P,Ae=b*O-I*P,je=w*O-I*R,Ce=U*je-V*Ae+G*de+re*Ee-Q*ce+te*ae;return Ce?(r[0]=(p*je-_*Ae+g*de)*(Ce=1/Ce),r[1]=(a*Ae-s*je-h*de)*Ce,r[2]=(P*te-R*Q+O*re)*Ce,r[3]=(w*Q-b*te-I*re)*Ce,r[4]=(_*Ee-u*je-g*ce)*Ce,r[5]=(i*je-a*Ee+h*ce)*Ce,r[6]=(R*G-A*te-O*V)*Ce,r[7]=(v*te-w*G+I*V)*Ce,r[8]=(u*Ae-p*Ee+g*ae)*Ce,r[9]=(s*Ee-i*Ae-h*ae)*Ce,r[10]=(A*Q-P*G+O*U)*Ce,r[11]=(b*G-v*Q-I*U)*Ce,r[12]=(p*ce-u*de-_*ae)*Ce,r[13]=(i*de-s*ce+a*ae)*Ce,r[14]=(P*V-A*re-R*U)*Ce,r[15]=(v*re-b*V+w*U)*Ce,r):null}function Gi(r,e,i){var s=e[0],a=e[1],h=e[2],u=e[3],p=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],I=e[10],A=e[11],P=e[12],R=e[13],O=e[14],U=e[15],V=i[0],G=i[1],re=i[2],Q=i[3];return r[0]=V*s+G*p+re*b+Q*P,r[1]=V*a+G*_+re*w+Q*R,r[2]=V*h+G*g+re*I+Q*O,r[3]=V*u+G*v+re*A+Q*U,r[4]=(V=i[4])*s+(G=i[5])*p+(re=i[6])*b+(Q=i[7])*P,r[5]=V*a+G*_+re*w+Q*R,r[6]=V*h+G*g+re*I+Q*O,r[7]=V*u+G*v+re*A+Q*U,r[8]=(V=i[8])*s+(G=i[9])*p+(re=i[10])*b+(Q=i[11])*P,r[9]=V*a+G*_+re*w+Q*R,r[10]=V*h+G*g+re*I+Q*O,r[11]=V*u+G*v+re*A+Q*U,r[12]=(V=i[12])*s+(G=i[13])*p+(re=i[14])*b+(Q=i[15])*P,r[13]=V*a+G*_+re*w+Q*R,r[14]=V*h+G*g+re*I+Q*O,r[15]=V*u+G*v+re*A+Q*U,r}function qr(r,e,i){var s,a,h,u,p,_,g,v,b,w,I,A,P=i[0],R=i[1],O=i[2];return e===r?(r[12]=e[0]*P+e[4]*R+e[8]*O+e[12],r[13]=e[1]*P+e[5]*R+e[9]*O+e[13],r[14]=e[2]*P+e[6]*R+e[10]*O+e[14],r[15]=e[3]*P+e[7]*R+e[11]*O+e[15]):(a=e[1],h=e[2],u=e[3],p=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],I=e[10],A=e[11],r[0]=s=e[0],r[1]=a,r[2]=h,r[3]=u,r[4]=p,r[5]=_,r[6]=g,r[7]=v,r[8]=b,r[9]=w,r[10]=I,r[11]=A,r[12]=s*P+p*R+b*O+e[12],r[13]=a*P+_*R+w*O+e[13],r[14]=h*P+g*R+I*O+e[14],r[15]=u*P+v*R+A*O+e[15]),r}function Fr(r,e,i){var s=i[0],a=i[1],h=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*h,r[9]=e[9]*h,r[10]=e[10]*h,r[11]=e[11]*h,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function As(r,e,i){var s=Math.sin(i),a=Math.cos(i),h=e[4],u=e[5],p=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]=h*a+g*s,r[5]=u*a+v*s,r[6]=p*a+b*s,r[7]=_*a+w*s,r[8]=g*a-h*s,r[9]=v*a-u*s,r[10]=b*a-p*s,r[11]=w*a-_*s,r}function ls(r,e,i){var s=Math.sin(i),a=Math.cos(i),h=e[0],u=e[1],p=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]=h*a-g*s,r[1]=u*a-v*s,r[2]=p*a-b*s,r[3]=_*a-w*s,r[8]=h*s+g*a,r[9]=u*s+v*a,r[10]=p*s+b*a,r[11]=_*s+w*a,r}function Ms(r,e,i){var s=Math.sin(i),a=Math.cos(i),h=e[0],u=e[1],p=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]=h*a+g*s,r[1]=u*a+v*s,r[2]=p*a+b*s,r[3]=_*a+w*s,r[4]=g*a-h*s,r[5]=v*a-u*s,r[6]=b*a-p*s,r[7]=w*a-_*s,r}function ko(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 qn(r,e,i){var s,a,h,u=i[0],p=i[1],_=i[2],g=Math.hypot(u,p,_);return g<Gr?null:(u*=g=1/g,p*=g,_*=g,s=Math.sin(e),a=Math.cos(e),r[0]=u*u*(h=1-a)+a,r[1]=p*u*h+_*s,r[2]=_*u*h-p*s,r[3]=0,r[4]=u*p*h-_*s,r[5]=p*p*h+a,r[6]=_*p*h+u*s,r[7]=0,r[8]=u*_*h+p*s,r[9]=p*_*h-u*s,r[10]=_*_*h+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function Cs(r,e){var i=e[0],s=e[1],a=e[2],h=e[3],u=i+i,p=s+s,_=a+a,g=i*u,v=s*u,b=s*p,w=a*u,I=a*p,A=a*_,P=h*u,R=h*p,O=h*_;return r[0]=1-b-A,r[1]=v+O,r[2]=w-R,r[3]=0,r[4]=v-O,r[5]=1-g-A,r[6]=I+P,r[7]=0,r[8]=w+R,r[9]=I-P,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var Gl=Gi;function ui(){var r=new $i(3);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Bo(r){var e=new $i(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Cr(r){return Math.hypot(r[0],r[1],r[2])}
1function lr(r,e,i){var s=new $i(3);return s[0]=r,s[1]=e,s[2]=i,s}function nr(r,e,i,s){return r[0]=e,r[1]=i,r[2]=s,r}function ki(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function cn(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function ka(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function cs(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 Ln(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 Fi(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function Hr(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r}function No(r,e){var i=e[0]-r[0],s=e[1]-r[1],a=e[2]-r[2];return i*i+s*s+a*a}function ql(r){var e=r[0],i=r[1],s=r[2];return e*e+i*i+s*s}function Ps(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function Ri(r,e){var i=e[0],s=e[1],a=e[2],h=i*i+s*s+a*a;return h>0&&(h=1/Math.sqrt(h)),r[0]=e[0]*h,r[1]=e[1]*h,r[2]=e[2]*h,r}function er(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function cr(r,e,i){var s=e[0],a=e[1],h=e[2],u=i[0],p=i[1],_=i[2];return r[0]=a*_-h*p,r[1]=h*u-s*_,r[2]=s*p-a*u,r}function Qr(r,e,i,s){var a=e[0],h=e[1],u=e[2];return r[0]=a+s*(i[0]-a),r[1]=h+s*(i[1]-h),r[2]=u+s*(i[2]-u),r}function tr(r,e,i){var s=e[0],a=e[1],h=e[2],u=i[3]*s+i[7]*a+i[11]*h+i[15];return r[0]=(i[0]*s+i[4]*a+i[8]*h+i[12])/(u=u||1),r[1]=(i[1]*s+i[5]*a+i[9]*h+i[13])/u,r[2]=(i[2]*s+i[6]*a+i[10]*h+i[14])/u,r}function zs(r,e,i){var s=e[0],a=e[1],h=e[2];return r[0]=s*i[0]+a*i[3]+h*i[6],r[1]=s*i[1]+a*i[4]+h*i[7],r[2]=s*i[2]+a*i[5]+h*i[8],r}function Rs(r,e,i){var s=i[0],a=i[1],h=i[2],u=e[0],p=e[1],_=e[2],g=a*_-h*p,v=h*u-s*_,b=s*p-a*u,w=a*b-h*v,I=h*g-s*b,A=s*v-a*g,P=2*i[3];return v*=P,b*=P,I*=2,A*=2,r[0]=u+(g*=P)+(w*=2),r[1]=p+v+I,r[2]=_+b+A,r}function Ba(r){return r[0]=0,r[1]=0,r[2]=0,r}function Fn(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var ir=cn,en=ka,Ds=Cr;function Na(){var r=new $i(4);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function hs(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 gn(r,e){var i=e[0],s=e[1],a=e[2],h=e[3],u=i*i+s*s+a*a+h*h;return u>0&&(u=1/Math.sqrt(u)),r[0]=i*u,r[1]=s*u,r[2]=a*u,r[3]=h*u,r}function hn(r,e,i){var s=e[0],a=e[1],h=e[2],u=e[3];return r[0]=i[0]*s+i[4]*a+i[8]*h+i[12]*u,r[1]=i[1]*s+i[5]*a+i[9]*h+i[13]*u,r[2]=i[2]*s+i[6]*a+i[10]*h+i[14]*u,r[3]=i[3]*s+i[7]*a+i[11]*h+i[15]*u,r}function us(){var r=new $i(4);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function ds(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function fo(r,e,i){i*=.5;var s=e[0],a=e[1],h=e[2],u=e[3],p=Math.sin(i),_=Math.cos(i);return r[0]=s*_+u*p,r[1]=a*_+h*p,r[2]=h*_-a*p,r[3]=u*_-s*p,r}function Vo(r,e,i){i*=.5;var s=e[0],a=e[1],h=e[2],u=e[3],p=Math.sin(i),_=Math.cos(i);return r[0]=s*_-h*p,r[1]=a*_+u*p,r[2]=h*_+s*p,r[3]=u*_-a*p,r}ui(),Na();var tn,yn,Va,fs=gn,Uo=(tn=ui(),yn=lr(1,0,0),Va=lr(0,1,0),function(r,e,i){var s=er(e,i);return s<-.999999?(cr(tn,yn,e),Ds(tn)<1e-6&&cr(tn,Va,e),Ri(tn,tn),(function(a,h,u){u*=.5;var p=Math.sin(u);a[0]=p*h[0],a[1]=p*h[1],a[2]=p*h[2],a[3]=Math.cos(u)})(r,tn,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(cr(tn,e,i),r[0]=tn[0],r[1]=tn[1],r[2]=tn[2],r[3]=1+s,fs(r,r))});function Or(){var r=new $i(2);return $i!=Float32Array&&(r[0]=0,r[1]=0),r}function xn(r,e){var i=new $i(2);return i[0]=r,i[1]=e,i}function Ls(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[0],r[1]=e[1]-i[1],r}function Fs(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function Os(r){return Math.hypot(r[0],r[1])}function jo(r,e){var i=e[0],s=e[1],a=i*i+s*s;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function Di(r,e){return r[0]*e[0]+r[1]*e[1]}us(),us(),jl();var Ua,ja,vn=ps;function Ga(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Or();var uh=(function(){if(ja)return Ua;function r(e,i,s,a){this.cx=3*e,this.bx=3*(s-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=s,this.p2y=a}return ja=1,Ua=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 s=e,a=0;a<8;a++){var h=this.sampleCurveX(s)-e;if(Math.abs(h)<i)return s;var u=this.sampleCurveDerivativeX(s);
1if(Math.abs(u)<1e-6)break;s-=h/u}var p=0,_=1;for(s=e,a=0;a<20&&(h=this.sampleCurveX(s),!(Math.abs(h-e)<i));a++)e>h?p=s:_=s,s=.5*(_-p)+p;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Ua})(),Go=Ga(uh);function ke(r,e){this.x=r,this.y=e}function ms(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(!ms(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(!ms(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),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround(r,e){const i=Math.cos(r),s=Math.sin(r),a=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(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 dh=Math.PI/180,qa=180/Math.PI;function ei(r){return r*dh}function ge(r){return r*qa}const k=[[0,0],[1,0],[1,1],[0,1]];function B(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 Z(r,e,i,s){const a=new Go(r,e,i,s);return function(h){return a.solve(h)}}const ne=Z(.25,.1,.25,1);function W(r,e,i){return Math.min(i,Math.max(e,r))}function le(r,e,i){return(i=W((i-r)/(e-r),0,1))*i*(3-2*i)}function ve(r,e,i){const s=i-e,a=((r-e)%s+s)%s+e;return a===e?i:a}function he(r,e,i){if(!r.length)return i(null,[]);let s=r.length;const a=new Array(r.length);let h=null;r.forEach(((u,p)=>{e(u,((_,g)=>{_&&(h=_),a[p]=g,--s==0&&i(h,a)}))}))}function ye(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let qe=1;function Pe(){return qe++}function ft(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function bt(r,e){r.forEach((i=>{e[i]&&(e[i]=e[i].bind(e))}))}function St(r,e,i){const s={};for(const a in r)s[a]=e.call(this,r[a],a,r);return s}function Ut(r,e,i){const s={};for(const a in r)e.call(this,r[a],a,r)&&(s[a]=r[a]);return s}function Ft(r){return Array.isArray(r)?r.map(Ft):typeof r=="object"&&r?St(r,Ft):r}function jt(r,e){for(let i=0;i<r.length;i++)if(e.indexOf(r[i])>=0)return!0;return!1}const bi={};function Gt(r){bi[r]||(typeof console<"u"&&console.warn(r),bi[r]=!0)}function Ki(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function yr(r){let e=0;for(let i,s,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}function dr([r,e,i]){const s=ei(e+90),a=ei(i);return{x:r*Math.cos(s)*Math.sin(a),y:r*Math.sin(s)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function gi(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function ri(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,s,a,h)=>{const u=a||h;return e[s]=!u||u.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Xi=null;function qi(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function Bi(r,e,i,s){for(;e<i;){const a=e+i>>1;r[a]<s?e=a+1:i=a}return e}function wr(r,e,i,s){for(;e<i;){const a=e+i>>1;r[a]<=s?e=a+1:i=a}return e}function rn(r){return r>0?1/(1.001-r):1+r}function kr(r){return r>0?1-1/(1.001-r):-r}function Ha(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const Ar={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(!Ar.API_URL)return null;
vendor: 2,458 bytes, line 1
1try{const r=new URL(Ar.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.1.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function ks(r){return Ar.API_URL_REGEX.test(r)}function Hl(r){return Ar.API_SPRITE_REGEX.test(r)}let $a,Za,$l,Zl,po,Wa;function Wl(){return $a==null&&($a=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),$a}const Hn={now:()=>Zl!==void 0?Zl:performance.now(),setNow(r){Zl=r},restoreNow(){Zl=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:s}=r;po||(po=document.createElement("canvas"));const a=po.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>po.width||s>po.height)&&(po.width=i,po.height=s),a.clearRect(-e,-e,i+2*e,s+2*e),a.drawImage(r,0,0,i,s),a.getImageData(-e,-e,i+2*e,s+2*e)},resolveURL:r=>(Za||(Za=document.createElement("a")),Za.href=r,Za.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&($l==null&&($l=window.matchMedia("(prefers-reduced-motion: reduce)")),$l.matches)},hasCanvasFingerprintNoise(){if(Wa!==void 0)return Wa;if(!Wl())return Wa=!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 s=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<s.data.length;++a)if(a%4!=3&&i++!==s.data[a])return Wa=!0,!0;return Wa=!1,!1}};function bn(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
1const s=new URLSearchParams(r.slice(i));for(const a in e)s.set(a,e[a]);return`${r.slice(0,i)}?${s.toString()}`}function On(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const s=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const u of e.persistentParams){const p=a.get(u);p&&s.set(u,p)}const h=s.toString();return`${r.slice(0,i)}${h.length>0?`?${h}`:""}`}const _s="mapbox-tiles";let $n=500,gs=50;const Xa=["language","worldview","jobid"];let Jn,Ya;function mo(){try{return caches}catch{}}function qo(){const r=mo();r&&Jn==null&&(Jn=r.open(_s))}let fh=1/0;const ph={supported:!1,testSupport:function(r){!Ka&&_o&&(Ho?dd(r):nn=r)}};let nn,_o,Ka=!1,Ho=!1;const ud=typeof self<"u"?self:{};function dd(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,_o),r.isContextLost())return;ph.supported=!0}catch{}r.deleteTexture(e),Ka=!0}ud.document&&(_o=ud.document.createElement("img"),_o.onload=function(){nn&&dd(nn),nn=null,Ho=!0},_o.onerror=function(){Ka=!0,nn=null},_o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ja={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(Ja);class Xt extends Error{constructor(e,i,s){i===401&&ks(s)&&(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=s}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Xl=gi()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,$o=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(Xl())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return(function(s,a){const h=new AbortController,u=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,referrer:Xl(),referrerPolicy:s.referrerPolicy,signal:h.signal});let p=!1,_=!1;const g=(v=u.url).indexOf("sku=")>0&&ks(v);var v;s.type==="json"&&u.headers.set("Accept","application/json");const b=(I,A,P)=>{if(_)return;if(I&&I.message!=="SecurityError"&&Gt(I.toString()),A&&P)return w(A);const R=Date.now();fetch(u).then((O=>{if(O.ok){const U=g?O.clone():null;return w(O,U,R)}return a(new Xt(O.statusText,O.status,s.url))})).catch((O=>{O.name!=="AbortError"&&a(new Error(`${O.message} ${s.url}`))}))},w=(I,A,P)=>{(s.type==="arrayBuffer"?I.arrayBuffer():s.type==="json"?I.json():I.text()).then((R=>{_||(A&&P&&(function(O,U,V){if(qo(),Jn==null)return;const G=ri(U.headers.get("Cache-Control")||"");if(G["no-store"])return;const re={status:U.status,statusText:U.statusText,headers:new Headers};U.headers.forEach(((ae,ce)=>re.headers.set(ce,ae))),G["max-age"]&&re.headers.set("Expires",new Date(V+1e3*G["max-age"]).toUTCString());const Q=re.headers.get("Expires");if(!Q||new Date(Q).getTime()-V<42e4)return;
1let te=On(O.url,{persistentParams:Xa});if(U.status===206){const ae=O.headers.get("Range");if(!ae)return;re.status=200,te=bn(te,{range:ae})}(function(ae,ce){if(Ya===void 0)try{new Response(new ReadableStream),Ya=!0}catch{Ya=!1}Ya?ce(ae.body):ae.blob().then(ce).catch((Ee=>Gt(Ee.message)))})(U,(ae=>{const ce=new Response((Ee=U.status)!==200&&Ee!==404&&[101,103,204,205,304].includes(Ee)?null:ae,re);var Ee;qo(),Jn!=null&&Jn.then((de=>de.put(te,ce))).catch((de=>Gt(de.message)))}))})(u,A,P),p=!0,a(null,R,I.headers.get("Cache-Control"),I.headers.get("Expires")))})).catch((R=>{_||a(new Error(R.message))}))};return g?(function(I,A){if(qo(),Jn==null)return A(null);Jn.then((P=>{let R=On(I.url,{persistentParams:Xa});const O=I.headers.get("Range");O&&(R=bn(R,{range:O})),P.match(R).then((U=>{const V=(function(G){if(!G)return!1;const re=new Date(G.headers.get("Expires")||0),Q=ri(G.headers.get("Cache-Control")||"");return Number(re)>Date.now()&&!Q["no-cache"]})(U);P.delete(R).catch(A),V&&P.put(R,U.clone()).catch(A),A(null,U,V)})).catch(A)})).catch(A)})(u,b):b(null,null),{cancel:()=>{_=!0,p||h.abort()}}})(r,e);if(gi(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return(function(s,a){const h=new XMLHttpRequest;h.open(s.method||"GET",s.url,!0),s.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const u in s.headers)h.setRequestHeader(u,s.headers[u]);return s.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=s.credentials==="include",h.onerror=()=>{a(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let u=h.response;if(s.type==="json")try{u=JSON.parse(h.response)}catch(p){return a(p)}a(null,u,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else a(new Xt(h.statusText,h.status,s.url))},h.send(s.body),{cancel:()=>h.abort()}})(r,e)},Qa=function(r,e){return $o(ye(r,{type:"arrayBuffer"}),e)};function fp(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const el="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let go,Bs;go=[],Bs=0;const tl=function(r,e){if(ph.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),Bs>=Ar.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return go.push(h),h}Bs++;let i=!1;const s=()=>
1{if(!i)for(i=!0,Bs--;go.length&&Bs<Ar.MAX_PARALLEL_IMAGE_REQUESTS;){const h=go.shift(),{requestParameters:u,callback:p,cancelled:_}=h;_||(h.cancel=tl(u,p).cancel)}},a=Qa(r,((h,u,p,_)=>{s(),h?e(h):u&&(self.createImageBitmap?(function(g,v){const b=new Blob([new Uint8Array(g)],{type:"image/png"});createImageBitmap(b).then((w=>{v(null,w)})).catch((w=>{v(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))})(u,((g,v)=>e(g,v,p,_))):(function(g,v){const b=new Image;b.onload=()=>{v(null,b),URL.revokeObjectURL(b.src),b.onload=null,requestAnimationFrame((()=>{b.src=el}))},b.onerror=()=>v(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 w=new Blob([new Uint8Array(g)],{type:"image/png"});b.src=g.byteLength?URL.createObjectURL(w):el})(u,((g,v)=>e(g,v,p,_))))}));return{cancel:()=>{a.cancel(),s()}}};var fd,Yl,pd,Zo={exports:{}},yo={exports:{}},md={exports:{}},il=(function(){if(pd)return Zo.exports;pd=1;var r=(fd||(fd=1,yo.exports=function(i,s){var a,h,u,p,_,g,v,b;for(h=i.length-(a=3&i.length),u=s,_=3432918353,g=461845907,b=0;b<h;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,u=27492+(65535&(p=5*(65535&(u=(u^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(p>>>16)&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:u^=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 u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0}),yo.exports),e=(Yl||(Yl=1,md.exports=function(i,s){for(var a,h=i.length,u=s^h,p=0;h>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(p)|(255&i.charCodeAt(++p))<<8|(255&i.charCodeAt(++p))<<16|(255&i.charCodeAt(++p))<<24))+((1540483477*(a>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),h-=4,++p;switch(h){case 3:u^=(255&i.charCodeAt(p+2))<<16;case 2:u^=(255&i.charCodeAt(p+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(p)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}
1),md.exports);return Zo.exports=r,Zo.exports.murmur3=r,Zo.exports.murmur2=e,Zo.exports})(),Wo=Ga(il);class ys{constructor(e,...i){ye(this,i[0]||{}),this.type=e}}class wn extends ys{constructor(e,i={}){super("error",ye({error:e},i))}}function mh(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function _h(r,e,i){if(i&&i[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class xo{on(e,i){return this._listeners=this._listeners||{},mh(e,i,this._listeners),this}off(e,i){return _h(e,i,this._listeners),_h(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},mh(e,i,this._oneTimeListeners),this):new Promise((s=>{this.once(e,s)}))}fire(e,i){const s=typeof e=="string"?new ys(e,i):e,a=s.type;if(this.listens(a)){s.target=this;const h=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of h)_.call(this,s);const u=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of u)_h(a,_,this._oneTimeListeners),_.call(this,s);const p=this._eventedParent;p&&(ye(s,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(s))}else s instanceof wn&&console.error(s.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 un{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new un(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,s]=e.split("�");return new un({name:i,iconsetId:s})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return un.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var gh,Kl={},yh=(function(){if(gh)return Kl;gh=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]};
1function e(h){return(h=Math.round(h))<0?0:h>255?255:h}function i(h){return e(h[h.length-1]==="%"?parseFloat(h)/100*255:parseInt(h))}function s(h){return(u=h[h.length-1]==="%"?parseFloat(h)/100:parseFloat(h))<0?0:u>1?1:u;var u}function a(h,u,p){return p<0?p+=1:p>1&&(p-=1),6*p<1?h+(u-h)*p*6:2*p<1?u:3*p<2?h+(u-h)*(2/3-p)*6:h}try{Kl.parseCSSColor=function(h){var u,p=h.replace(/ /g,"").toLowerCase();if(p in r)return r[p].slice();if(p[0]==="#")return p.length===4?(u=parseInt(p.substr(1),16))>=0&&u<=4095?[(3840&u)>>4|(3840&u)>>8,240&u|(240&u)>>4,15&u|(15&u)<<4,1]:null:p.length===7&&(u=parseInt(p.substr(1),16))>=0&&u<=16777215?[(16711680&u)>>16,(65280&u)>>8,255&u,1]:null;var _=p.indexOf("("),g=p.indexOf(")");if(_!==-1&&g+1===p.length){var v=p.substr(0,_),b=p.substr(_+1,g-(_+1)).split(","),w=1;switch(v){case"rgba":if(b.length!==4)return null;w=s(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=s(b.pop());case"hsl":if(b.length!==3)return null;var I=(parseFloat(b[0])%360+360)%360/360,A=s(b[1]),P=s(b[2]),R=P<=.5?P*(A+1):P+A-P*A,O=2*P-R;return[e(255*a(O,R,I+1/3)),e(255*a(O,R,I)),e(255*a(O,R,I-1/3)),w];default:return null}}return null}}catch{}return Kl})();class li{constructor(e,i,s,a=1){this.r=e,this.g=i,this.b=s,this.a=a}static parse(e){if(!e)return;if(e instanceof li)return e;if(typeof e!="string")return;const i=yh.parseCSSColor(e);return i?new li(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,s,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*s)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:s,b:a,a:h}=this;return new Xo(e,i,s,a,h)}toPremultipliedRenderColor(e){const{r:i,g:s,b:a,a:h}=this;return new _d(e,i*h,s*h,a*h,h)}clone(){return new li(this.r,this.g,this.b,this.a)}}class rl{constructor(e,i,s,a,h,u=!1){if(this.premultiplied=!1,this.premultiplied=u,e){const p=e.image.height,_=p*p;this.premultiplied?(i=h===0?0:i/h*(p-1),s=h===0?0:s/h*(p-1),a=h===0?0:a/h*(p-1)):(i*=p-1,s*=p-1,a*=p-1);const g=Math.floor(i),v=Math.floor(s),b=Math.floor(a),w=Math.ceil(i),I=Math.ceil(s),A=Math.ceil(a),P=i-g,R=s-v,O=a-b,U=e.image.data,V=4*(g+v*_+b*p),G=4*(g+v*_+A*p),re=4*(g+I*_+b*p),Q=4*(g+I*_+A*p),te=4*(w+v*_+b*p),ae=4*(w+v*_+A*p),ce=4*(w+I*_+b*p),Ee=4*(w+I*_+A*p);if(V<0||Ee>=U.length)throw new Error("out of range");this.r=pt(pt(pt(U[V],U[G],O),pt(U[re],U[Q],O),R),pt(pt(U[te],U[ae],O),pt(U[ce],U[Ee],O),R),P)/255*(this.premultiplied?h:1),this.g=pt(pt(pt(U[V+1],U[G+1],O),pt(U[re+1],U[Q+1],O),R),pt(pt(U[te+1],U[ae+1],O),pt(U[ce+1],U[Ee+1],O),R),P)/255*(this.premultiplied?h:1),this.b=pt(pt(pt(U[V+2],U[G+2],O),pt(U[re+2],U[Q+2],O),R),pt(pt(U[te+2],U[ae+2],O),pt(U[ce+2],U[Ee+2],O),R),P)/255*(this.premultiplied?h:1),this.a=h}else this.r=i,this.g=s,this.b=a,this.a=h}toArray(){const{r:e,g:i,b:s,a}=this;return[255*e,255*i,255*s,a]}toHslaArray(){let{r:e,g:i,b:s,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];e/=a,i/=a,s/=a}const h=Math.min(Math.max(e,0),1),u=Math.min(Math.max(i,0),1),p=Math.min(Math.max(s,0),1),_=Math.min(h,u,p),g=Math.max(h,u,p),v=(_+g)/2;if(_===g)return[0,0,100*v,a];const b=g-_,w=v>.5?b/(2-g-_):b/(g+_);let I=0;return g===h?I=(u-p)/b+(u<p?6:0):g===u?I=(p-h)/b+2:g===p&&(I=(h-u)/b+4),I*=60,[Math.min(Math.max(I,0),360),Math.min(Math.max(100*w,0),100),Math.min(Math.max(100*v,0),100),a]}toArray01(){const{r:e,g:i,b:s,a}=this;return[e,i,s,a]}toArray01Scaled(e){const{r:i,g:s,b:a}=this;return[i*e,s*e,a*e]}toArray01Linear(){const{r:e,g:i,b:s,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(s,2.2),a]}}class Xo extends rl{constructor(e,i,s,a,h){super(e,i,s,a,h,!1)}}class _d extends rl{constructor(e,i,s,a,h){super(e,i,s,a,h,!0)}}function pt(r,e,i){return r*(1-i)+e*i}function gd(r,e,i){return r.map(((s,a)=>pt(s,e[a],i)))}li.black=new li(0,0,0,1),li.white=new li(1,1,1,1),li.transparent=new li(0,0,0,0),li.red=new li(1,0,0,1),li.blue=new li(0,0,1,1);var nl=Object.freeze({__proto__:null,array:gd,color:function(r,e,i){return new li(pt(r.r,e.r,i),pt(r.g,e.g,i),pt(r.b,e.b,i),pt(r.a,e.a,i))},number:pt});function vo(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}
1class Tn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class xh{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,a]of i)this.bindings[s]=a}concat(e){return new xh(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 Yo={kind:"null"},ut={kind:"number"},oi={kind:"string"},ai={kind:"boolean"},dn={kind:"color"},xs={kind:"object"},ci={kind:"value"},Jl={kind:"collator"},sl={kind:"formatted"},ol={kind:"resolvedImage"};function Br(r,e){return{kind:"array",itemType:r,N:e}}function fr(r){if(r.kind==="array"){const e=fr(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const pp=[Yo,ut,oi,ai,dn,sl,xs,Br(ci),ol];function Ko(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Ko(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 pp)if(!Ko(i,e))return null}}return`Expected ${fr(r)} but found ${fr(e)} instead.`}function Ns(r,e){return e.some((i=>i.kind===r.kind))}function al(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 Ql(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&Ql(r.itemType,e.itemType):r.kind===e.kind}class ll{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,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 ec{constructor(e,i,s,a,h){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=s,this.fontStack=a,this.textColor=h}}class $r{constructor(e){this.sections=e}static fromString(e){return new $r([new ec(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 $r?e:$r.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 s={};i.fontStack&&(s["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(s["font-scale"]=i.scale),i.textColor&&(s["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(s)}return e}}class vs{constructor(e,i={}){if(this.id=un.from(e),this.options=Object.assign({},i),i.transform){const{a:s,b:a,c:h,d:u,e:p,f:_}=i.transform;this.options.transform=new DOMMatrix([s,a,h,u,p,_])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:i,c:s,d:a,e:h,f:u}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:i,c:s,d:a,e:h,f:u}})}static parse(e){let i,s,a,h;try{({name:i,iconsetId:s,params:a,transform:h}=JSON.parse(e)||{})}catch{return null}if(!i)return null;const{a:u,b:p,c:_,d:g,e:v,f:b}=h||{};return new vs({name:i,iconsetId:s},{params:a,transform:new DOMMatrix([u,p,_,g,v,b])})}scaleSelf(e,i){return this.options.transform.scaleSelf(e,i),this}}class sn{constructor(e,i,s,a,h=!1){this.primaryId=un.from(e),this.primaryOptions=i,s&&(this.secondaryId=un.from(s)),this.secondaryOptions=a,this.available=h}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new vs(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new vs(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?sn.build({name:e}):e}static build(e,i,s,a){return!e||typeof e=="object"&&!("name"in e)?null:new sn(e,s,i,a)}}function bo(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Pt(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof li||r instanceof ll||r instanceof $r||r instanceof sn)return!0;
vendor: 5,973 bytes, line 1
1if(Array.isArray(r)){for(const e of r)if(!Pt(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Pt(r[e]))return!1;return!0}return!1}function it(r){if(r===null)return Yo;if(typeof r=="string")return oi;if(typeof r=="boolean")return ai;if(typeof r=="number")return ut;if(r instanceof li)return dn;if(r instanceof ll)return Jl;if(r instanceof $r)return sl;if(r instanceof sn)return ol;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const a=it(s);if(i){if(i===a)continue;i=ci;break}i=a}return Br(i||ci,e)}return xs}function kn(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof $r||r instanceof sn||r instanceof li?r.toString():JSON.stringify(r)}class xt{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(!Pt(e[1]))return i.error("invalid value");const s=e[1];let a=it(s);const h=i.expectedType;return a.kind!=="array"||a.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(a=h),new xt(a,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof li?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof $r?this.value.serialize():this.value}}class hr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const cl={string:oi,number:ut,boolean:ai,object:xs};class mt{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 s,a=1;const h=e[0];if(h==="array"){let p,_;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in cl)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);p=cl[g],a++}else p=ci;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++}s=Br(p,_)}else s=cl[h];const u=[];for(;a<e.length;a++){const p=i.parse(e[a],a,ci);if(!p)return null;u.push(p)}return new mt(s,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!Ko(this.type,it(s)))return s;if(i===this.args.length-1)throw new hr(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${fr(it(s))} but was expected to be of type ${fr(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 s=e.itemType;if(s.kind==="string"||s.kind==="number"||s.kind==="boolean"){i.push(s.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map((s=>s.serialize())))}}class Jo{constructor(e){this.type=sl,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const a=[];let h=!1;for(let u=1;u<=e.length-1;++u){const p=e[u];if(h&&typeof p=="object"&&!Array.isArray(p)){h=!1;let _=null;if(p["font-scale"]&&(_=i.parseObjectValue(p["font-scale"],u,"font-scale",ut),!_))return null;let g=null;if(p["text-font"]&&(g=i.parseObjectValue(p["text-font"],u,"text-font",Br(oi)),!g))return null;let v=null;if(p["text-color"]&&(v=i.parseObjectValue(p["text-color"],u,"text-color",dn),!v))return null;const b=a[a.length-1];b.scale=_,b.font=g,b.textColor=v}else{const _=i.parse(e[u],u,ci);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'.");h=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new Jo(a)}evaluate(e){return new $r(this.sections.map((i=>{const s=i.content.evaluate(e);return Ql(it(s),ol)?new ec("",s,null,null,null):new ec(kn(s),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 s={};i.scale&&(s["font-scale"]=i.scale.serialize()),i.font&&(s["text-font"]=i.font.serialize()),i.textColor&&(s["text-color"]=i.textColor.serialize()),e.push(s)}return e}}class Qo{constructor(e,i,s,a){this._imageWarnHistory={},this.type=ol,this.namePrimary=e,this.nameSecondary=i,s&&(this.paramsPrimary=s.params,this.iconsetIdPrimary=s.iconset?s.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 s=1;const a=[];function h(){if(s<e.length){const p=i.parse(e[s],s++,oi);return p?(a.push({image:p,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function u(){if(s<e.length){const _=e[s];if((p=_)===null||typeof p!="object"||Array.isArray(p))return!0;const g=_.params,v=_.iconset,b=i.concat(s);if(!g&&!v)return s++,!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 P=I.concat(void 0,A).parse(g[A],void 0,dn,void 0,{typeAnnotation:"coerce"});if(!P)return!1;w[A]=P}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 "i
1d" property'),!1;a[a.length-1].options.iconset=v}return s++,!0}var p;return!0}for(let p=0;p<2;p++)if(!h()||!u())return;return new Qo(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const s={};if(i){for(const a in i)if(i[a])try{s[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(s).length!==0)return{params:s}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},s=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=sn.build(i,s,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const h=a.getPrimary().id;if(a.available=e.availableImages.some((u=>un.isEqual(u,h))),a.available){const u=a.getSecondary()?a.getSecondary().id:null;u&&(a.available=e.availableImages.some((p=>un.isEqual(p,u))))}}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 s={};if(i&&(s.iconset={id:i}),e){s.params={};for(const a in e)e[a]&&(s.params[a]=e[a].serialize())}return Object.keys(s).length>0?s: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 Vs(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}const yd={"to-boolean":ai,"to-color":dn,"to-number":ut,"to-string":oi};class Bn{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 s=e[0],a=[];let h=Yo;if(s==="to-array"){if(!Array.isArray(e[1]))return null;const u=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);h=Br(i.expectedType.itemType,u)}else{if(!(u>0&&Pt(e[1][0])))return null;h=Br(it(e[1][0]),u)}for(let p=0;p<u;p++){const _=e[1][p];let g;if(Vs(_)==="array")g=i.parse(_,void 0,h.itemType);else{const v=Vs(_);if(v!==h.itemType.kind)return i.error(`Expected ${h.itemType.kind} but found ${v}.`);g=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!g)return null;a.push(g)}}else{if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");h=yd[s];for(let u=1;u<e.length;u++){const p=i.parse(e[u],u,ci);if(!p)return null;a.push(p)}}return new Bn(h,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,s;for(const a of this.args){if(i=a.evaluate(e),s=null,i instanceof li)return i;if(typeof i=="string"){const h=e.parseColor(i);if(h)return h}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:bo(i[0],i[1],i[2],i[3]),!s))return new li(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new hr(s||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new hr(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?$r.fromString(kn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?sn.build(kn(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map((i=>i.evaluate(e))):kn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}
vendor: 5,449 bytes, line 1
1serialize(){if(this.type.kind==="formatted")return new Jo([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Qo(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild((i=>{e.push(i.serialize())})),e}}const Zr=["Unknown","Point","LineString","Polygon"];class hl{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Zr[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:s,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(s*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=li.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Tr{constructor(e,i,s,a,h){this.name=e,this.type=i,this._evaluate=s,this.args=a,this._overloadIndex=h}evaluate(e){if(!this._evaluate){const i=Tr.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 s=e[0],a=Tr.definitions[s];if(!a)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(a)?a[0]:a.type,u=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,p=[];let _=null,g=-1;for(const[v,b]of u){if(Array.isArray(v)&&v.length!==e.length-1)continue;p.push(v),g++,_=new fc(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const w=[];let I=!1;for(let A=1;A<e.length;A++){const P=e[A],R=Array.isArray(v)?v[A-1]:v.type,O=_.parse(P,1+w.length,R);if(!O){I=!0;break}w.push(O)}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 P=Array.isArray(v)?v[A]:v.type,R=w[A];_.concat(A+1).checkSubtype(P,R.type)}if(_.errors.length===0)return new Tr(s,h,b,w,g)}}if(p.length===1)i.errors.push(..._.errors);else{const v=(p.length?p:u.map((([w])=>w))).map(vh).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(fr(I.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){Tr.definitions=i;for(const s in i)e[s]=Tr}}function vh(r){return Array.isArray(r)?`(${r.map(fr).join(", ")})`:`(${fr(r.type)}...)`}class Qn{constructor(e,i,s){this.type=Jl,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const a=s["case-sensitive"]===void 0?i.parse(!1,1,ai):i.parseObjectValue(s["case-sensitive"],1,"case-sensitive",ai);if(!a)return null;const h=s["diacritic-sensitive"]===void 0?i.parse(!1,1,ai):i.parseObjectValue(s["diacritic-sensitive"],1,"diacritic-sensitive",ai);if(!h)return null;let u=null;return s.locale&&(u=i.parseObjectValue(s.locale,1,"locale",oi),!u)?null:new Qn(a,h,u)}evaluate(e){return new ll(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 Nr(r,e,i=0,s=r.length-1,a=mp){for(;s>i;){if(s-i>600){const _=s-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);Nr(r,e,Math.max(i,Math.floor(e-g*b/_+w)),Math.min(s,Math.floor(e+(_-g)*b/_+w)),a)}const h=r[e];let u=i,p=s;for(ul(r,i,e),a(r[s],h)>0&&ul(r,i,s);u<p;){for(ul(r,u,p),u++,p--;a(r[u],h)<0;)u++;for(;a(r[p],h)>0;)p--}a(r[i],h)===0?ul(r,i,p):(p++,ul(r,p,s)),p<=e&&(i=p+1),e<=p&&(s=p-1)}}function ul(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function mp(r,e){return r<e?-1:r>e?1:0}function _p(r){let e=0;for(let i,s,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}function Us(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 ea(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function wo(r,e,i){const s=r[0]-e[0],a=r[1]-e[1],h=r[0]-i[0],u=r[1]-i[1];return s*u-h*a==0&&s*h<=0&&a*u<=0}function ta(r,e,i=!1){let s=!1;for(let p=0,_=e.length;p<_;p++){const g=e[p];for(let v=0,b=g.length,w=b-1;v<b;w=v++){const I=g[w],A=g[v];if(wo(r,I,A))return i;
vendor: 1,712 bytes, line 1
1(h=I)[1]>(a=r)[1]!=(u=A)[1]>a[1]&&a[0]<(u[0]-h[0])*(a[1]-h[1])/(u[1]-h[1])+h[0]&&(s=!s)}}var a,h,u;return s}function xd(r,e,i,s){const a=s[0]-i[0],h=s[1]-i[1],u=(r[0]-i[0])*h-a*(r[1]-i[1]),p=(e[0]-i[0])*h-a*(e[1]-i[1]);return u>0&&p<0||u<0&&p>0}function tc(r,e,i,s){return(a=[s[0]-i[0],s[1]-i[1]])[0]*(h=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*h[0]!=0&&!(!xd(r,e,i,s)||!xd(i,s,r,e));var a,h}function bh(r){const e=new ke(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new ke(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const s of r[0])e.x>s.x&&(e.x=s.x),e.y>s.y&&(e.y=s.y),i.x<s.x&&(i.x=s.x),i.y<s.y&&(i.y=s.y);return{min:e,max:i}}const js=8192;function gp(r,e){const i=(180+r[0])/360,s=(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*js),Math.round(s*a*js)]}function vd(r,e){for(let i=0;i<e.length;i++)if(ta(r,e[i]))return!0;return!1}function yp(r,e,i){for(const s of i)for(let a=0,h=s.length,u=h-1;a<h;u=a++)if(tc(r,e,s[u],s[a]))return!0;return!1}function bd(r,e){for(let i=0;i<r.length;++i)if(!ta(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(yp(r[i],r[i+1],e))return!1;return!0}function wd(r,e){for(let i=0;i<e.length;i++)if(bd(r,e[i]))return!0;return!1}function wh(r,e,i){const s=[];for(let a=0;a<r.length;a++){const h=[];for(let u=0;u<r[a].length;u++){const p=gp(r[a][u],i);Us(e,p),h.push(p)}s.push(h)}return s}function Gs(r,e,i){const s=[];for(let a=0;a<r.length;a++){const h=wh(r[a],e,i);s.push(h)}return s}function Td(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const a=.5*s;let h=r[0]-i[0]>a?-s:i[0]-r[0]>a?s:0;h===0&&(h=r[0]-i[2]>a?-s:i[2]-r[0]>a?s:0),r[0]+=h}Us(e,r)}function Sd(r,e,i,s){const a=Math.pow(2,s.z)*js,h=[s.x*js,s.y*js],u=[];
1if(!r)return u;for(const p of r)for(const _ of p){const g=[_.x+h[0],_.y+h[1]];Td(g,e,i,a),u.push(g)}return u}function ic(r,e,i,s){const a=Math.pow(2,s.z)*js,h=[s.x*js,s.y*js],u=[];if(!r)return u;for(const _ of r){const g=[];for(const v of _){const b=[v.x+h[0],v.y+h[1]];Us(e,b),g.push(b)}u.push(g)}if(e[2]-e[0]<=a/2){(p=e)[0]=p[1]=1/0,p[2]=p[3]=-1/0;for(const _ of u)for(const g of _)Td(g,e,i,a)}var p;return u}class qs{constructor(e,i){this.type=ai,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(Pt(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let a=0;a<s.features.length;++a){const h=s.features[a].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new qs(s,s.features[a].geometry)}else if(s.type==="Feature"){const a=s.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new qs(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new qs(s,s)}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,s){const a=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(!u)return!1;if(s.type==="Polygon"){const p=wh(s.coordinates,h,u),_=Sd(i.geometry(),a,h,u);if(!ea(a,h))return!1;for(const g of _)if(!ta(g,p))return!1}if(s.type==="MultiPolygon"){const p=Gs(s.coordinates,h,u),_=Sd(i.geometry(),a,h,u);if(!ea(a,h))return!1;for(const g of _)if(!vd(g,p))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const a=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(!u)return!1;if(s.type==="Polygon"){const p=wh(s.coordinates,h,u),_=ic(i.geometry(),a,h,u);if(!ea(a,h))return!1;for(const g of _)if(!bd(g,p))return!1}if(s.type==="MultiPolygon"){const p=Gs(s.coordinates,h,u),_=ic(i.geometry(),a,h,u);if(!ea(a,h))return!1;for(const g of _)if(!wd(g,p))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const dl={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Nn=1/298.257223563,Th=Nn*(2-Nn),ia=Math.PI/180;class ra{static fromTile(e,i,s){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),h=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/ia;return new ra(h,s)}static get units(){return dl}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!dl[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(dl).join(", ")}`);const s=6378.137*ia*(i?dl[i]:1),a=Math.cos(e*ia),h=1/(1-Th*(1-a*a)),u=Math.sqrt(h);this.kx=s*u*a,this.ky=s*u*h*(1-Th)}distance(e,i){const s=Sn(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+a*a)}bearing(e,i){const s=Sn(i[0]-e[0])*this.kx;return Math.atan2(s,(i[1]-e[1])*this.ky)/ia}destination(e,i,s){const a=s*ia;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,s){return[e[0]+i/this.kx,e[1]+s/this.ky]}lineDistance(e){let i=0;for(let s=0;s<e.length-1;s++)i+=this.distance(e[s],e[s+1]);return i}area(e){let i=0;for(let s=0;s<e.length;s++){const a=e[s];for(let h=0,u=a.length,p=u-1;h<u;p=h++)i+=Sn(a[h][0]-a[p][0])*(a[h][1]+a[p][1])*(s?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let s=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const h=e[a],u=e[a+1],p=this.distance(h,u);if(s+=p,s>i)return rc(h,u,(i-(s-p))/p)}return e[e.length-1]}pointToSegmentDistance(e,i,s){let[a,h]=i,u=Sn(s[0]-a)*this.kx,p=(s[1]-h)*this.ky;if(u!==0||p!==0){const _=(Sn(e[0]-a)*this.kx*u+(e[1]-h)*this.ky*p)/(u*u+p*p);_>1?(a=s[0],h=s[1]):_>0&&(a+=u/this.kx*_,h+=p/this.ky*_)}return u=Sn(e[0]-a)*this.kx,p=(e[1]-h)*this.ky,Math.sqrt(u*u+p*p)}pointOnLine(e,i){let s=1/0,a=e[0][0],h=e[0][1],u=0,p=0;for(let _=0;_<e.length-1;_++){let g=e[_][0],v=e[_][1],b=Sn(e[_+1][0]-g)*this.kx,w=(e[_+1][1]-v)*this.ky,I=0;b===0&&w===0||(I=(Sn(i[0]-g)*this.kx*b+(i[1]-v)*this.ky*w)/(b*b+w*w),I>1?(g=e[_+1][0],v=e[_+1][1]):I>0&&(g+=b/this.kx*I,v+=w/this.ky*I)),b=Sn(i[0]-g)*this.kx,w=(i[1]-v)*this.ky;const A=b*b+w*w;A<s&&(s=A,a=g,h=v,u=_,p=I)}return{point:[a,h],index:u,t:Math.max(0,Math.min(1,p))}}lineSlice(e,i,s){let a=this.pointOnLine(s,e),h=this.pointOnLine(s,i);if(a.index>h.index||a.index===h.index&&a.t>h.t){const g=a;a=h,h=g}const u=[a.point],p=a.index+1,_=h.index;!Sh(s[p],u[0])&&p<=_&&u.push(s[p]);for(let g=p+1;g<=_;g++)u.push(s[g]);return Sh(s[_],h.point)||u.push(h.point),u}lineSliceAlong(e,i,s){let a=0;const h=[];for(let u=0;u<s.length-1;u++){const p=s[u],_=s[u+1],g=this.distance(p,_);if(a+=g,a>e&&h.length===0&&h.push(rc(p,_,(e-(a-g))/g)),a>=i)return h.push(rc(p,_,(i-(a-g))/g)),h;a>e&&h.push(_)}return h}bufferPoint(e,i){const s=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-s,e[0]+a,e[1]+s]}bufferBBox(e,i){const s=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-s,e[2]+a,e[3]+s]}insideBBox(e,i){return Sn(e[0]-i[0])>=0&&Sn(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Sh(r,e){return r[0]===e[0]&&r[1]===e[1]}function rc(r,e,i){const s=Sn(e[0]-r[0]);return[r[0]+s*i,r[1]+(e[1]-r[1])*i]}function Sn(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class nc{constructor(e=[],i=((s,a)=>s<a?-1:s>
vendor: 5,024 bytes, line 1
1a?1:0)){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}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:s}=this,a=i[e];for(;e>0;){const h=e-1>>1,u=i[h];if(s(a,u)>=0)break;i[e]=u,e=h}i[e]=a}_down(e){const{data:i,compare:s}=this,a=this.length>>1,h=i[e];for(;e<a;){let u=1+(e<<1);const p=u+1;if(p<this.length&&s(i[p],i[u])<0&&(u=p),s(i[u],h)>=0)break;i[e]=i[u],e=u}i[e]=h}}var We=8192;function Eh(r,e){return e.dist-r.dist}const sc=100,oc=50;function fl(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 To(r){return r[1]-r[0]+1}function Vn(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function ac(r,e){if(r[0]>r[1])return[null,null];const i=To(r);if(e){if(i===2)return[r,null];const s=Math.floor(i/2);return[[r[0],r[0]+s],[r[0]+s,r[1]]]}{if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}}function Hs(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!Vn(e,r.length))return i;for(let s=e[0];s<=e[1];++s)Us(i,r[s]);return i}function pl(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let s=0;s<r[i].length;++s)Us(e,r[i][s]);return e}function Zn(r,e,i){if(fl(r)||fl(e))return NaN;let s=0,a=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=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],[s,a])}function Ht(r){return 360*r-180}function xp(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Ih(r,e){const i=Math.pow(2,e.z),s=(r.y/We+e.y)/i;return[Ht((r.x/We+e.x)/i),xp(s)]}function vp(r,e){const i=[];for(let s=0;s<r.length;++s)i.push(Ih(r[s],e));return i}function Ah(r,e,i){const s=i.pointOnLine(e,r).point;return i.distance(r,s)}function Ed(r,e,i,s,a){const h=i.slice(s[0],s[1]+1);let u=1/0;for(let p=e[0];p<=e[1];++p)if((u=Math.min(u,Ah(r[p],h,a)))===0)return 0;return u}function Oi(r,e,i,s,a){const h=Math.min(a.pointToSegmentDistance(r,i,s),a.pointToSegmentDistance(e,i,s)),u=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(s,r,e));return Math.min(h,u)}function bp(r,e,i,s,a){if(!Vn(e,r.length)||!Vn(s,i.length))return NaN;let h=1/0;for(let u=e[0];u<e[1];++u)for(let p=s[0];p<s[1];++p){if(tc(r[u],r[u+1],i[p],i[p+1]))return 0;h=Math.min(h,Oi(r[u],r[u+1],i[p],i[p+1],a))}return h}function wp(r,e,i,s,a){if(!Vn(e,r.length)||!Vn(s,i.length))return NaN;let h=1/0;for(let u=e[0];u<=e[1];++u)for(let p=s[0];p<=s[1];++p)if((h=Math.min(h,a.distance(r[u],i[p])))===0)return h;return h}function Tp(r,e,i){if(ta(r,e,!0))return 0;let s=1/0;for(const a of e){const h=a.length;if(h<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[h-1]&&(s=Math.min(s,i.pointToSegmentDistance(r,a[h-1],a[0])))===0||(s=Math.min(s,Ah(r,a,i)))===0)return s}return s}function Sp(r,e,i,s){if(!Vn(e,r.length))return NaN;for(let h=e[0];h<=e[1];++h)if(ta(r[h],i,!0))return 0;let a=1/0;for(let h=e[0];h<e[1];++h)for(const u of i)for(let p=0,_=u.length,g=_-1;p<_;g=p++){if(tc(r[h],r[h+1],u[g],u[p]))return 0;a=Math.min(a,Oi(r[h],r[h+1],u[g],u[p],s))}return a}function Id(r,e){for(const i of r)for(let s=0;s<=i.length-1;++s)if(ta(i[s],e,!0))return!0;return!1}function Ep(r,e,i,s=1/0){const a=pl(r),h=pl(e);if(s!==1/0&&Zn(a,h,i)>=s)return s;if(ea(a,h)){if(Id(r,e))return 0}else if(Id(e,r))return 0;let u=s;for(const p of r)for(let _=0,g=p.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(tc(p[v],p[_],b[A],b[w]))return 0;u=Math.min(u,Oi(p[v],p[_],b[A],b[w],i))}return u}function lc(r,e,i,s,a,h,u){if(h===null||u===null)return;const p=Zn(Hs(s,h),Hs(a,u),i);p<e&&r.push({dist:p,range1:h,range2:u})}function Ip(r,e,i,s,a=1/0){let h=Math.min(s.distance(r[0],i[0][0]),a);if(h===0)return h;const u=new nc([{dist:0,range1:[0,r.length-1],range2:[0,0]}],Eh),p=e?oc:sc,_=pl(i);for(;u.length;){const g=u.pop();if(g.dist>=h)continue;const v=g.range1;if(To(v)<=p){if(!Vn(v,r.length))return NaN;if(e){const b=Sp(r,v,i,s);if((h=Math.min(h,b))===0)return h}else for(let b=v[0];b<=v[1];++b){const w=Tp(r[b],i,s);if((h=Math.min(h,w))===0)return h}}else{const b=ac(v,e);if(b[0]!==null){const w=Zn(Hs(r,b[0]),_,s);w<h&&u.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=Zn(Hs(r,b[1]),_,s);w<h&&u.push({dist:w,range1:b[1],range2:[0,0]})}}}return h}function Ad(r,e,i,s,a,h=1/0){let u=Math.min(h,a.distance(r[0],i[0]));if(u===0)return u;const p=new nc([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],Eh),_=e?oc:sc,g=s?oc:sc;for(;p.length;){const v=p.pop();if(v.dist>=u)continue;const b=v.range1,w=v.range2;if(To(b)<=_&&To(w)<=g){if(!Vn(b,r.length)||!Vn(w,i.length))return NaN;if(e&&s?u=Math.min(u,bp(r,b,i,w,a)):e||s?e&&!s?u=Math.min(u,Ed(i,w,r,b,a)):!e&&s&&(u=Math.min(u,Ed(r,b,i,w,a))):u=M
1ath.min(u,wp(r,b,i,w,a)),u===0)return u}else{const I=ac(b,e),A=ac(w,s);lc(p,u,a,r,i,I[0],A[0]),lc(p,u,a,r,i,I[0],A[1]),lc(p,u,a,r,i,I[1],A[0]),lc(p,u,a,r,i,I[1],A[1])}}return u}function Mh(r,e,i,s,a=1/0){let h=a;const u=Hs(r,[0,r.length-1]);for(const p of i)if(!(h!==1/0&&Zn(u,Hs(p,[0,p.length-1]),s)>=h)&&(h=Math.min(h,Ad(r,e,p,!0,s,h)),h===0))return h;return h}function cc(r,e,i,s,a=1/0){let h=a;const u=Hs(r,[0,r.length-1]);for(const p of i){if(h!==1/0&&Zn(u,pl(p),s)>=h)continue;const _=Ip(r,e,p,s,h);if(isNaN(_))return _;if((h=Math.min(h,_))===0)return h}return h}function Ch(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class So{constructor(e,i){this.type=ut,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(Pt(e[1])){const s=e[1];if(s.type==="FeatureCollection"){for(let a=0;a<s.features.length;++a)if(Ch(s.features[a].geometry.type))return new So(s,s.features[a].geometry)}else if(s.type==="Feature"){if(Ch(s.geometry.type))return new So(s,s.geometry)}else if(Ch(s.type))return new So(s,s)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),s=e.canonicalID();if(i!=null&&s!=null){if(e.geometryType()==="Point")return(function(a,h,u){const p=[];for(const g of a)for(const v of g)p.push(Ih(v,h));const _=new ra(p[0][1],"meters");return u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString"?Ad(p,!1,u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",_):u.type==="MultiLineString"?Mh(p,!1,u.coordinates,_):u.type==="Polygon"||u.type==="MultiPolygon"?cc(p,!1,u.type==="Polygon"?[u.coordinates]:u.coordinates,_):null})(i,s,this.geometries);if(e.geometryType()==="LineString")return(function(a,h,u){const p=[];for(const g of a){const v=[];for(const b of g)v.push(Ih(b,h));p.push(v)}const _=new ra(p[0][0][1],"meters");if(u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString")return Mh(u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",p,_);if(u.type==="MultiLineString"){let g=1/0;for(let v=0;v<u.coordinates.length;v++){const b=Mh(u.coordinates[v],!0,p,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(u.type==="Polygon"||u.type==="MultiPolygon"){let g=1/0;for(let v=0;v<p.length;v++){const b=cc(p[v],!0,u.type==="Polygon"?[u.coordinates]:u.coordinates,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null})(i,s,this.geometries);if(e.geometryType()==="Polygon")return(function(a,h,u){const p=[];for(const g of(function(v,b){const w=v.length;if(w<=1)return[v];const I=[];let A,P;for(let R=0;R<w;R++){const O=_p(v[R]);O!==0&&(v[R].area=Math.abs(O),P===void 0&&(P=O<0),P===O<0?(A&&I.push(A),A=[v[R]]):A.push(v[R]))}return A&&I.push(A),I})(a)){const v=[];for(let b=0;b<g.length;++b)v.push(vp(g[b],h));p.push(v)}const _=new ra(p[0][0][0][1],"meters");if(u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString")return cc(u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",p,_);if(u.type==="MultiLineString"){let g=1/0;for(let v=0;v<u.coordinates.length;v++){const b=cc(u.coordinates[v],!0,p,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return u.type==="Polygon"||u.type==="MultiPolygon"?(function(g,v,b){let w=1/0;for(const I of g)for(const A of v){const P=Ep(I,A,b,w);if(isNaN(P))return P;if((w=Math.min(w,P))===0)return w}return w})(u.type==="Polygon"?[u.coordinates]:u.coordinates,p,_):null})(i,s,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 na(r){if(r instanceof Tr&&(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 qs||r instanceof So)return!1;if(r instanceof oa)return r.featureConstant;let e=!0;return r.eachChild((i=>{e&&!na(i)&&(e=!1)})),e}function hc(r){if(r instanceof Tr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!hc(i)&&(e=!1)})),e}function uc(r){if(r instanceof oa)return new Set([r.key]);let e=new Set;return r.eachChild((i=>{e=new Set([...e,...uc(i)])})),e}function sa(r,e){if(r instanceof Tr&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!sa(s,e)&&(i=!1)})),i}
vendor: 9,632 bytes, line 1
1function Md(r,e,i){return[r,e,i].filter(Boolean).join("�")}function Ph(r,e){switch(r){case"string":return kn(e);case"number":return+e;case"boolean":return!!e;case"color":return li.parse(e);case"formatted":return $r.fromString(kn(e));case"resolvedImage":return sn.build(kn(e))}return e}function Cd(r,e,i,s){return s!==void 0&&(r=s*Math.round(r/s)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class oa{constructor(e,i,s,a=!1){this.type=e,this.key=i,this.scope=s,this.featureConstant=a}static parse(e,i){let s=i.expectedType;if(s==null&&(s=ci),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 xt))return i.error("Key name of 'config' expression must be a string literal.");let h,u=!0;const p=kn(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof xt))return i.error("Scope of 'config' expression must be a string literal.");h=kn(_.value)}if(i.options){const _=Md(p,h,i._scope),g=i.options.get(_);g&&(u=na(g.value||g.default))}return new oa(s,p,h,u)}evaluate(e){const i=Md(this.key,this.scope,e.scope),s=e.getConfig(i);if(!s)return null;const{type:a,value:h,values:u,minValue:p,maxValue:_,stepValue:g}=s,v=s.default.evaluate(e);let b=v;if(h){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=h.evaluate(e),e.scope=w}return a&&(b=Ph(a,b)),b===void 0||p===void 0&&_===void 0&&g===void 0||(typeof b=="number"?b=Cd(b,p,_,g):Array.isArray(b)&&(b=b.map((w=>typeof w=="number"?Cd(w,p,_,g):w)))),h!==void 0&&b!==void 0&&u&&!u.includes(b)&&(b=v,a&&(b=Ph(a,b))),(a&&a!==this.type||b!==void 0&&!Ql(it(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 dc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new dc(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" 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 fc{constructor(e,i=[],s,a=new xh,h=[],u,p){this.registry=e,this.path=i,this.key=i.map((_=>typeof _=="string"?`['${_}']`:`[${_}]`)).join(""),this.scope=a,this.errors=h,this.expectedType=s,this._scope=u,this.options=p}parse(e,i,s,a,h={}){return i||s?this.concat(i,null,s,a)._parse(e,h):this._parse(e,h)}parseObjectValue(e,i,s,a,h,u={}){return this.concat(i,s,a,h)._parse(e,u)}_parse(e,i){function s(a,h,u){return u==="assert"?new mt(h,[a]):u==="coerce"?new Bn(h,[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 h=a.parse(e,this);if(!h)return null;if(this.expectedType){const u=this.expectedType,p=h.type;if(u.kind!=="string"&&u.kind!=="number"&&u.kind!=="boolean"&&u.kind!=="object"&&u.kind!=="array"||p.kind!=="value")if(u.kind!=="color"&&u.kind!=="formatted"&&u.kind!=="resolvedImage"||p.kind!=="value"&&p.kind!=="string"){if(this.checkSubtype(u,p))return null}else h=s(h,u,i.typeAnnotation||"coerce");else h=s(h,u,i.typeAnnotation||"assert")}if(!(h instanceof xt)&&h.type.kind!=="resolvedImage"&&zh(h)){const u=new hl(this._scope,this.options);try{h=new xt(h.type,h.evaluate(u))}catch(p){return this.error(p.message),null}}return h}return Bn.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,s,a){let h=typeof e=="number"?this.path.concat(e):this.path;h=typeof i=="string"?h.concat(i):h;const u=a?this.scope.concat(a):this.scope;return new fc(this.registry,h,s||null,u,this.errors,this._scope,this.options)}error(e,...i){const s=`${this.key}${i.map((a=>`[${a}]`)).join("")}`;this.errors.push(new Tn(s,e))}checkSubtype(e,i){const s=Ko(e,i);return s&&this.error(s),s}}function zh(r){if(r instanceof dc)return zh(r.boundExpression);if(r instanceof Tr&&r.name==="error"||r instanceof Qn||r instanceof qs||r instanceof So||r instanceof oa)return!1;const e=r instanceof Bn||r instanceof mt;let i=!0;return r.eachChild((s=>{i=e?i&&zh(s):i&&s instanceof xt})),!!i&&na(r)&&sa(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 pc(r,e){const i=r.length-1;let s,a,h=0,u=i,p=0;for(;h<=u;)if(p=Math.floor((h+u)/2),s=r[p],a=r[p+1],s<=e){if(p===i||e<a)return p;h=p+1}else{if(!(s>e))throw new hr("Input is not a number.");u=p-1}return 0}class ml{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,h]of s)this.labels.push(a),this.outputs.push(h)}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 s=i.parse(e[1],1,ut);if(!s)return null;const a=[];let h=null;i.expectedType&&i.expectedType.kind!=="value"&&(h=i.expectedType);for(let u=1;u<e.length;u+=2){const p=u===1?-1/0:e[u],_=e[u+1],g=u,v=u+1;if(typeof p!="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]>=p)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,h);if(!b)return null;h=h||b.type,a.push([p,b])}return new ml(h,s,a)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const h=i.length;return a>=i[h-1]?s[h-1].evaluate(e):s[pc(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 Pd=.95047,zd=1.08883,Rd=4/29,aa=6/29,Dd=3*aa*aa,Rh=aa*aa*aa,Ap=Math.PI/180,Ld=180/Math.PI;function Dh(r){return r>Rh?Math.pow(r,1/3):r/Dd+Rd}function Lh(r){return r>aa?r*r*r:Dd*(r-Rd)}function Fh(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function mc(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Oh(r){const e=mc(r.r),i=mc(r.g),s=mc(r.b),a=Dh((.4124564*e+.3575761*i+.1804375*s)/Pd),h=Dh((.2126729*e+.7151522*i+.072175*s)/1);return{l:116*h-16,a:500*(a-h),b:200*(h-Dh((.0193339*e+.119192*i+.9503041*s)/zd)),alpha:r.a}}function Eo(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,s=isNaN(r.b)?e:e-r.b/200;return e=1*Lh(e),i=Pd*Lh(i),s=zd*Lh(s),new li(Fh(3.2404542*i-1.5371385*e-.4985314*s),Fh(-.969266*i+1.8760108*e+.041556*s),Fh(.0556434*i-.2040259*e+1.0572252*s),r.alpha)}function Fd(r,e,i){const s=e-r;return r+i*(s>180||s<-180?s-360*Math.round(s/360):s)}const la={forward:Oh,reverse:Eo,interpolate:function(r,e,i){return{l:pt(r.l,e.l,i),a:pt(r.a,e.a,i),b:pt(r.b,e.b,i),alpha:pt(r.alpha,e.alpha,i)}}},_l={forward:function(r){const{l:e,a:i,b:s}=Oh(r),a=Math.atan2(s,i)*Ld;return{h:a<0?a+360:a,c:Math.sqrt(i*i+s*s),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Ap,i=r.c;return Eo({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:Fd(r.h,e.h,i),c:pt(r.c,e.c,i),l:pt(r.l,e.l,i),alpha:pt(r.alpha,e.alpha,i)}}};var _c=Object.freeze({__proto__:null,hcl:_l,lab:la});class on{constructor(e,i,s,a,h){this.type=e,this.operator=i,this.interpolation=s,this.input=a,this.labels=[],this.outputs=[];for(const[u,p]of h)this.labels.push(u),this.outputs.push(p)}static interpolationFactor(e,i,s,a){let h=0;if(e.name==="exponential")h=kh(i,e.base,s,a);else if(e.name==="linear")h=kh(i,1,s,a);else if(e.name==="cubic-bezier"){const u=e.controlPoints;h=new Go(u[0],u[1],u[2],u[3]).solve(kh(i,1,s,a))}return h}static parse(e,i){let[s,a,h,...u]=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(h=i.parse(h,2,ut),!h)return null;const p=[];let _=null;s==="interpolate-hcl"||s==="interpolate-lab"?_=dn:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let g=0;g<u.length;g+=2){const v=u[g],b=u[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 c
1omputed expressions) for the input values.',w);if(p.length&&p[p.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,p.push([v,A])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new on(_,s,a,h,p):i.error(`Type ${fr(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return s[0].evaluate(e);const h=i.length;if(a>=i[h-1])return s[h-1].evaluate(e);const u=pc(i,a),p=on.interpolationFactor(this.interpolation,a,i[u],i[u+1]),_=s[u].evaluate(e),g=s[u+1].evaluate(e);return this.operator==="interpolate"?nl[this.type.kind.toLowerCase()](_,g,p):this.operator==="interpolate-hcl"?_l.reverse(_l.interpolate(_l.forward(_),_l.forward(g),p)):la.reverse(la.interpolate(la.forward(_),la.forward(g),p))}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 s=0;s<this.labels.length;s++)i.push(this.labels[s],this.outputs[s].serialize());return i}}function kh(r,e,i,s){const a=s-i,h=r-i;return a===0?0:e===1?h/a:(Math.pow(e,h)-1)/(Math.pow(e,a)-1)}class gc{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 s=null;const a=i.expectedType;a&&a.kind!=="value"&&(s=a);const h=[];for(const p of e.slice(1)){const _=i.parse(p,1+h.length,s,void 0,{typeAnnotation:"omit"});if(!_)return null;s=s||_.type,h.push(_)}const u=a&&h.some((p=>Ko(a,p.type)));return new gc(u?ci:s,h)}evaluate(e){let i,s=null,a=0;for(const h of this.args){if(a++,s=h.evaluate(e),s&&s instanceof sn&&!s.available&&(i||(i=s),s=null,a===this.args.length))return i;if(s!==null)break}return s}eachChild(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 gl{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 s=[];for(let h=1;h<e.length-1;h+=2){const u=e[h];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,h);if(/[^a-zA-Z0-9_]/.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",h);const p=i.parse(e[h+1],h+1);if(!p)return null;s.push([u,p])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return a?new gl(s,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,s]of this.bindings)e.push(i,s.serialize());return e.push(this.result.serialize()),e}}class yc{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ut),a=i.parse(e[2],2,Br(i.expectedType||ci));return s&&a?new yc(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new hr(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new hr(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new hr(`Array index must be an integer, but found ${i} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Bh{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ut),a=i.parse(e[2],2,Br(i.expectedType||ci));return s&&a?new Bh(a.type.itemType,s,a):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new hr(`Array index out of bounds: ${i} < 0.`);if(i>s.length-1)throw new hr(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i===Math.floor(i))return s[i];const a=Math.floor(i),h=Math.ceil(i),u=s[a],p=s[h];if(typeof u!="number"||typeof p!="number")throw new hr(`Cannot interpolate between non-number values at index ${i}.`);const _=i-a;return u*(1-_)+p*_}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Nh{constructor(e,i){this.type=ai,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 s=i.parse(e[1],1,ci),a=i.parse(e[2],2,ci);return s&&a?Ns(s.type,[ai,oi,ut,Yo,ci])?new Nh(s,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${fr(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(s==null)return!1;if(!al(i,["boolean","string","number","null"]))throw new hr(`Expected first argument to be of type boolean, string, number or null, but found ${fr(it(i))} instead.`);if(!al(s,["string","array"]))throw new hr(`Expected second argument to be of type array or string, but found ${fr(it(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class xc{constructor(e,i,s){this.type=ut,this.needle=e,this.haystack=i,this.fromIndex=s}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 s=i.parse(e[1],1,ci),a=i.parse(e[2],2,ci);if(!s||!a)return null;if(!Ns(s.type,[ai,oi,ut,Yo,ci]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${fr(s.type)} instead`);if(e.length===4){const h=i.parse(e[3],3,ut);return h?new xc(s,a,h):null}return new xc(s,a)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!al(i,["boolean","string","number","null"]))throw new hr(`Expected first argument to be of type boolean, string, number or null, but found ${fr(it(i))} instead.`);if(!al(s,["string","array"]))throw new hr(`Expected second argument to be of type array or string, but found ${fr(it(s))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return s.indexOf(i,a)}return s.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 vc{constructor(e,i,s,a,h,u){this.inputType=e,this.type=i,this.input=s,this.cases=a,this.outputs=h,this.otherwise=u}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 s,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const h={},u=[];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(s){if(w.checkSubtype(s,it(A)))return null}else s=it(A);if(h[String(A)]!==void 0)return w.error("Branch labels must be unique.");h[String(A)]=u.length}const I=i.parse(b,g,a);if(!I)return null;a=a||I.type,u.push(I)}const p=i.parse(e[1],1,ci);if(!p)return null;const _=i.parse(e[e.length-1],e.length-1,a);return _?p.type.kind!=="value"&&i.concat(1).checkSubtype(s,p.type)?null:new vc(s,a,p,h,u,_):null}evaluate(e){const i=this.input.evaluate(e);return(Ql(it(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
vendor: 4,284 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(),s=[],a={};for(const u of i){const p=a[this.cases[u]];p===void 0?(a[this.cases[u]]=s.length,s.push([this.cases[u],[u]])):s[p][1].push(u)}const h=u=>this.inputType.kind==="number"?Number(u):u;for(const[u,p]of s)e.push(p.length===1?h(p[0]):p.map(h)),e.push(this.outputs[u].serialize());return e.push(this.otherwise.serialize()),e}}class bc{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}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 s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const a=[];for(let u=1;u<e.length-1;u+=2){const p=i.parse(e[u],u,ai);if(!p)return null;const _=i.parse(e[u+1],u+1,s);if(!_)return null;a.push([p,_]),s=s||_.type}const h=i.parse(e[e.length-1],e.length-1,s);return h?new bc(s,a,h):null}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);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 Io{constructor(e,i,s,a){this.type=e,this.input=i,this.beginIndex=s,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 s=i.parse(e[1],1,ci),a=i.parse(e[2],2,ut);if(!s||!a)return null;if(!Ns(s.type,[Br(ci),oi,ci]))return i.error(`Expected first argument to be of type array or string, but found ${fr(s.type)} instead`);if(e.length===4){const h=i.parse(e[3],3,ut);return h?new Io(s.type,s,a,h):null}return new Io(s.type,s,a)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!al(i,["string","array"]))throw new hr(`Expected first argument to be of type array or string, but found ${fr(it(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(s,a)}return i.slice(s)}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 Vh{constructor(e,i){this.type=Br(oi),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 s=i.parse(e[1],1,oi),a=i.parse(e[2],2,oi);return s&&a?new Vh(s,a):void 0}evaluate(e){const i=this.str.evaluate(e),s=this.delimiter.evaluate(e);return i.split(s)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Uh(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 Od(r,e,i,s){return s.compare(e,i)===0}function ca(r,e,i){const s=r!=="=="&&r!=="!=";return class Jx{constructor(h,u,p){this.type=ai,this.lhs=h,this.rhs=u,this.collator=p,this.hasUntypedArgument=h.type.kind==="value"||u.type.kind==="value"}static parse(h,u){if(h.length!==3&&h.length!==4)return u.error("Expected two or three arguments.");const p=h[0];let _=u.parse(h[1],1,ci);if(!_)return null;if(!Uh(p,_.type))return u.concat(1).error(`"${p}" comparisons are not supported for type '${fr(_.type)}'.`);let g=u.parse(h[2],2,ci);if(!g)return null;if(!Uh(p,g.type))return u.concat(2).error(`"${p}" comparisons are not supported for type '${fr(g.type)}'.`);if(_.type.kind!==g.type.kind&&_.type.kind!=="value"&&g.type.kind!=="value")return u.error(`Cannot compare types '${fr(_.type)}' and '${fr(g.type)}'.`);s&&(_.type.kind==="value"&&g.type.kind!=="value"?_=new mt(g.type,[_]):_.type.kind!=="value"&&g.type.kind==="value"&&(g=ne
1w mt(_.type,[g])));let v=null;if(h.length===4){if(_.type.kind!=="string"&&g.type.kind!=="string"&&_.type.kind!=="value"&&g.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(v=u.parse(h[3],3,Jl),!v)return null}return new Jx(_,g,v)}evaluate(h){const u=this.lhs.evaluate(h),p=this.rhs.evaluate(h);if(s&&this.hasUntypedArgument){const _=it(u),g=it(p);if(_.kind!==g.kind||_.kind!=="string"&&_.kind!=="number")throw new hr(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${g.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const _=it(u),g=it(p);if(_.kind!=="string"||g.kind!=="string")return e(h,u,p)}return this.collator?i(h,u,p,this.collator.evaluate(h)):e(h,u,p)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}serialize(){const h=[r];return this.eachChild((u=>{h.push(u.serialize())})),h}}}const kd=ca("==",(function(r,e,i){return e===i}),Od),Bd=ca("!=",(function(r,e,i){return e!==i}),(function(r,e,i,s){return!Od(0,e,i,s)})),Mp=ca("<",(function(r,e,i){return e<i}),(function(r,e,i,s){return s.compare(e,i)<0})),Cp=ca(">",(function(r,e,i){return e>i}),(function(r,e,i,s){return s.compare(e,i)>0})),Pp=ca("<=",(function(r,e,i){return e<=i}),(function(r,e,i,s){return s.compare(e,i)<=0})),wc=ca(">=",(function(r,e,i){return e>=i}),(function(r,e,i,s){return s.compare(e,i)>=0}));class jh{constructor(e,i,s,a,h,u){this.type=oi,this.number=e,this.locale=i,this.currency=s,this.unit=a,this.minFractionDigits=h,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,ut);if(!s)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let h=null;if(a.locale&&(h=i.parseObjectValue(a.locale,2,"locale",oi),!h))return null;let u=null;if(a.currency&&(u=i.parseObjectValue(a.currency,2,"currency",oi),!u))return null;let p=null;if(a.unit&&(p=i.parseObjectValue(a.unit,2,"unit",oi),!p))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",ut),!_))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",ut),!g)?null:new jh(s,h,u,p,_,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 Gh{constructor(e){this.type=ut,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${fr(s.type)} instead.`):new Gh(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new hr(`Expected value to be of type string or array, but found ${fr(it(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((i=>{e.push(i.serialize())})),e}}function Nd(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 ha={"==":kd,"!=":Bd,">":Cp,"<":Mp,">
1=":wc,"<=":Pp,array:mt,at:yc,"at-interpolated":Bh,boolean:mt,case:bc,coalesce:gc,collator:Qn,format:Jo,image:Qo,in:Nh,"index-of":xc,interpolate:on,"interpolate-hcl":on,"interpolate-lab":on,length:Gh,let:gl,literal:xt,match:vc,number:mt,"number-format":jh,object:mt,slice:Io,step:ml,string:mt,"to-boolean":Bn,"to-color":Bn,"to-number":Bn,"to-string":Bn,var:dc,within:qs,distance:So,config:oa,split:Vh};function qh(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const h=a?a.evaluate(r):1,u=bo(e,i,s,h);if(u)throw new hr(u);return new li(e/255,i/255,s/255,h)}function Vd(r,[e,i,s,a]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const h=a?a.evaluate(r):1,u=(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,s,h);if(u)throw new hr(u);const p=`hsla(${e}, ${i}%, ${s}%, ${h})`,_=li.parse(p);if(!_)throw new hr(`Failed to parse HSLA color: ${p}`);return _}function Ud(r,e){return r in e}function Tc(r,e){const i=e[r];return i===void 0?null:i}function $s(r){return{type:r}}function Hh(r){return{result:"success",value:r}}function Zs(r){return{result:"error",value:r}}function Ws(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function Sc(r){return r["property-type"]==="data-driven"}function jd(r){return Ws(r.expression,"measure-light")}function Gd(r){return Ws(r.expression,"zoom")}function Ec(r){return!!r.expression&&r.expression.interpolated}function Ic(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function qd(r){return r}function $h(r,e){const i=e.type==="color",s=r.stops&&typeof r.stops[0][0]=="object",a=s||!(s||r.property!==void 0),h=r.type||(Ec(e)?"exponential":"interval");if(i&&((r=vo({},r)).stops&&(r.stops=r.stops.map((g=>[g[0],li.parse(g[1])]))),r.default=li.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!_c[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let u,p,_;if(h==="exponential")u=$d;else if(h==="interval")u=Hd;else if(h==="categorical"){u=Zh,p=Object.create(null);for(const g of r.stops)p[g[0]]=g[1];_=typeof r.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);u=Xs}if(s){const g={},v=[];for(let I=0;I<r.stops.length;I++){const A=r.stops[I],P=A[0].zoom;g[P]===void 0&&(g[P]={zoom:P,type:r.type,property:r.property,default:r.default,stops:[]},v.push(P)),g[P].stops.push([A[0].value,A[1]])}const b=[];for(const I of v)b.push([g[I].zoom,$h(g[I],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:on.interpolationFactor.bind(void 0,w),zoomStops:b.map((I=>I[0])),evaluate:({zoom:I},A)=>$d({stops:b,base:r.base},e,I).evaluate(I,A)}}if(a){const g=h==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:on.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map((v=>v[0])),evaluate:({zoom:v})=>u(r,e,v,p,_)}}return{kind:"source",evaluate(g,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?Ao(r.default,e.default):u(r,e,b,p,_)}}}function Ao(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function Zh(r,e,i,s,a){return Ao(typeof i===a?s[i]:void 0,r.default,e.default)}function Hd(r,e,i){if(Vs(i)!=="number")return Ao(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const a=pc(r.stops.map((h=>h[0])),i);return r.stops[a][1]}function $d(r,e,i){const s=r.base!==void 0?r.base:1;if(Vs(i)!=="number")return Ao(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 h=pc(r.stops.map((v=>v[0])),i),u=(function(v,b,w,I){const A=I-w,P=v-w;return A===0?0:b===1?P/A:(Math.pow(b,P)-1)/(Math.pow(b,A)-1)}
vendor: 10,845 bytes, line 1
1)(i,s,r.stops[h][0],r.stops[h+1][0]),p=r.stops[h][1],_=r.stops[h+1][1];let g=nl[e.type]||qd;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=_c[r.colorSpace];g=(b,w)=>v.reverse(v.interpolate(v.forward(b),v.forward(w),u))}return typeof p.evaluate=="function"?{evaluate(...v){const b=p.evaluate.apply(void 0,v),w=_.evaluate.apply(void 0,v);if(b!==void 0&&w!==void 0)return g(b,w,u)}}:g(p,_,u)}function Xs(r,e,i){return e.type==="color"?i=li.parse(i):e.type==="formatted"?i=$r.fromString(i.toString()):e.type==="resolvedImage"?i=sn.build(i.toString()):Vs(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Ao(i,r.default,e.default)}Tr.register(ha,{error:[{kind:"error"},[oi],(r,[e])=>{throw new hr(e.evaluate(r))}],typeof:[oi,[ci],(r,[e])=>fr(it(e.evaluate(r)))],"to-rgba":[Br(ut,4),[dn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Br(ut,4),[dn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[dn,[ut,ut,ut],qh],rgba:[dn,[ut,ut,ut,ut],qh],hsl:[dn,[ut,ut,ut],Vd],hsla:[dn,[ut,ut,ut,ut],Vd],has:{type:ai,overloads:[[[oi],(r,[e])=>Ud(e.evaluate(r),r.properties())],[[oi,xs],(r,[e,i])=>Ud(e.evaluate(r),i.evaluate(r))]]},get:{type:ci,overloads:[[[oi],(r,[e])=>Tc(e.evaluate(r),r.properties())],[[oi,xs],(r,[e,i])=>Tc(e.evaluate(r),i.evaluate(r))]]},"feature-state":[ci,[oi],(r,[e])=>Tc(e.evaluate(r),r.featureState||{})],properties:[xs,[],r=>r.properties()],"geometry-type":[oi,[],r=>r.geometryType()],worldview:[oi,[],r=>r.globals.worldview||""],id:[ci,[],r=>r.id()],zoom:[ut,[],r=>r.globals.zoom],pitch:[ut,[],r=>r.globals.pitch||0],"distance-from-center":[ut,[],r=>r.distanceFromCenter()],"measure-light":[ut,[oi],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[ut,[],r=>r.globals.heatmapDensity||0],"line-progress":[ut,[],r=>r.globals.lineProgress||0],"raster-value":[ut,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[ut,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[ut,[],r=>r.globals.skyRadialProgress||0],accumulated:[ci,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[ut,$s(ut),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[ut,$s(ut),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:ut,overloads:[[[ut,ut],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[ut],(r,[e])=>-e.evaluate(r)]]},"/":[ut,[ut,ut],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[ut,[ut,ut],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[ut,[ut],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))],log2:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[ut,[ut],(r,[e])=>Math.sin(e.evaluate(r))],cos:[ut,[ut],(r,[e])=>Math.cos(e.evaluate(r))],tan:[ut,[ut],(r,[e])=>Math.tan(e.evaluate(r))],asin:[ut,[ut],(r,[e])=>Math.asin(e.evaluate(r))],acos:[ut,[ut],(r,[e])=>Math.acos(e.evaluate(r))],atan:[ut,[ut],(r,[e])=>Math.atan(e.evaluate(r))],min:[ut,$s(ut),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[ut,$s(ut),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[ut,[ut],(r,[e])=>Math.abs(e.evaluate(r))],round:[ut,[ut],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[ut,[ut],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[ut,[ut],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[ai,[oi,ci],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[ai,[ci],(r,[e])=>r.id()===e.value],"filter-type-==":[ai,[oi],(r,[e])=>r.geometryType()===e.value],"filter-<":[ai,[oi,ci],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<a}],"filter-id-<":[ai,[ci],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[ai,[oi,ci],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>a}],"filter-id->":[ai,[ci],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[ai,[oi,ci],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s<=a}],"filter-id-<=":[ai,[ci],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[ai,[oi,ci],(r,[e,i])=>{const s=r.properties()[e.value],a=i.value;return typeof s==typeof a&&s>=a}],"filter-id->=":[ai,[ci],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[ai,[ci],(r,[e])=>e.value in r.properties()],"filter-has-id":[ai,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[ai,[Br(oi)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[ai,[Br(ci)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[ai,[oi,Br(ci)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[ai,[oi,Br(ci)],(r,[e,i])=>(function(s,a,h,u){for(;h<=u;){const p=h+u>>1;if(a[p]===s)return!0;a[p]>s?u=p-1:h=p+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ai,overloads:[[[ai,ai],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[$s(ai),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:ai,overloads:[[[ai,ai],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[$s(ai),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[ai,[ai],(r,[e])=>!e.evaluate(r)],"is-supported-script":[ai,[oi],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[oi,[oi],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[oi,[oi],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[oi,$s(ci),(r,e)=>e.map((i=>kn(i.evaluate(r)))).join("")],"resolved-locale":[oi,[Jl],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[ut,[ut,ut,ci],(r,e)=>{const[i,s,a]=e.map((u=>u.evaluate(r)));if(i>s||i===s)return i;let h;if(typeof a=="string")h=(function(u){let p=0;if(u.length===0)return p;for(let _=0;_<u.length;_++)p=(p<<5)-p+u.charCodeAt(_),p|=0;return p})(a);else{if(typeof a!="number")throw new hr(`Invalid seed input: ${a}`);h=a}return i+Nd(h)()*(s-i)}]});class Wh{constructor(e,i,s,a){this.expression=e,this._warningHistory={},this._evaluator=new hl(s,a),this._defaultValue=i?(function(h){return h.type==="color"&&(Ic(h.default)||Array.isArray(h.default))?new li(0,0,0,0):h.type==="color"?li.parse(h.default)||null:h.default===void 0?null:h.default})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=uc(e)}evaluateWithoutErrorHandling(e,i,s,a,h,u,p,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=a||null,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=u,this._evaluator.featureTileCoord=p||null,this._evaluator.featureDistanceData=_||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,a,h,u,p,_){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=u||null,this._evaluator.featureTileCoord=p||null,this._evaluator.featureDistanceData=_||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new hr(`Expected value to be one of ${Object.keys(this._enumValues).map((v=>JSON.stringify(v))).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${g.message}`)),this._defaultValue}}}function Xh(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ha}function Mo(r,e,i,s){const a=new fc(ha,[],e?(function(u){const p={color:dn,string:oi,number:ut,enum:oi,boolean:ai,formatted:sl,resolvedImage:ol};return u.type==="array"?Br(p[u.value]||ci,u.length):p[u.type]})(e):void 0,void 0,void 0,i,s),h=a.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?Hh(new Wh(h,e,i,s)):Zs(a.errors)}class Ac{constructor(e,i,s,a){this.kind=e,this._styleExpression=i,this.isLightConstant=s,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!hc(i.expression),this.configDependencies=uc(i.expression)}evaluateWithoutErrorHandling(e,i,s,a,h,u){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,h,u)}evaluate(e,i,s,a,h,u){return this._styleExpression.evaluate(e,i,s,a,h,u)}}class Ys{constructor(e,i,s,a,h,u){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!hc(i.expression),this.isLightConstant=h,this.isLineProgressConstant=u,this.configDependencies=uc(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,s,a,h,u){return this._styleExpression.evaluateWithoutErrorHandling(e,i,s,a,h,u)}evaluate(e,i,s,a,h,u){return this._styleExpression.evaluate(e,i,s,a,h,u)}interpolationFactor(e,i,s){return this.interpolationType?on.interpolationFactor(this.interpolationType,e,i,s):0}}function Yh(r,e,i,s){if((r=Mo(r,e,i,s)).result==="error")return r;const a=r.value.expression,h=na(a);if(!h&&!Sc(e))return Zs([new Tn("","data expressions not supported")]);const u=sa(a,["zoom","pitch","distance-from-center"]);if(!u&&!Gd(e))return Zs([new Tn("","zoom expressions not supported")]);const p=sa(a,["measure-light"]);if(!p&&!jd(e))return Zs([new Tn("","measure-light expression not supported")]);const _=sa(a,["line-progress"]);if(!_&&!(function(b){return Ws(b.expression,"line-progress")})(e))return Zs([new Tn("","line-progress expression not supported")]);const g=e.expression&&e.expression.relaxZoomRestriction,v=yl(a);return v||u||g?v instanceof Tn?Zs([v]):v instanceof on&&!Ec(e)?Zs([new Tn("",'"interpolate" expressions cannot be used with this property')]):Hh(v?new Ys(h&&_?"camera":"composite",r.value,v.labels,v instanceof on?v.interpolation:void 0,p,_):new Ac(h&&_?"constant":"source",r.value,p,_)):Zs([new Tn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Co{constructor(e,i){this._parameters=e,this._specification=i,vo(this,$h(this._parameters,this._specification))}static deserialize(e){return new Co(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function yl(r){let e=null;if(r instanceof gl)e=yl(r.result);else if(r instanceof gc){for(const i of r.args)if(e=yl(i),e)break}else(r instanceof ml||r instanceof on)&&r.input instanceof Tr&&r.input.name==="zoom"&&(e=r);return e instanceof Tn||r.eachChild((i=>{const s=yl(i);s instanceof Tn?e=s:e&&s&&e!==s&&(e=new Tn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}
1var Kh,Zd,Jh=(function(){if(Zd)return Kh;Zd=1,Kh=e;var r=3;function e(i,s,a){var h=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var u=new Int32Array(this.arrayBuffer);i=u[0],this.d=(s=u[1])+2*(a=u[2]);for(var p=0;p<this.d*this.d;p++){var _=u[r+p],g=u[r+p+1];h.push(_===g?null:u.subarray(_,g))}var v=u[r+h.length+1];this.keys=u.subarray(u[r+h.length],v),this.bboxes=u.subarray(v),this.insert=this._insertReadonly}else{this.d=s+2*a;for(var b=0;b<this.d*this.d;b++)h.push([]);this.keys=[],this.bboxes=[]}this.n=s,this.extent=i,this.padding=a,this.scale=s/i,this.uid=0;var w=a/s*i;this.min=-w,this.max=i+w}return e.prototype.insert=function(i,s,a,h,u){this._forEachCell(s,a,h,u,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(s),this.bboxes.push(a),this.bboxes.push(h),this.bboxes.push(u)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,s,a,h,u,p){this.cells[u].push(p)},e.prototype.query=function(i,s,a,h,u){var p=this.min,_=this.max;if(i<=p&&s<=p&&_<=a&&_<=h&&!u)return Array.prototype.slice.call(this.keys);var g=[];return this._forEachCell(i,s,a,h,this._queryCell,g,{},u),g},e.prototype._queryCell=function(i,s,a,h,u,p,_,g){var v=this.cells[u];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 P=4*A;(g?g(w[P+0],w[P+1],w[P+2],w[P+3]):i<=w[P+2]&&s<=w[P+3]&&a>=w[P+0]&&h>=w[P+1])?(_[A]=!0,p.push(b[A])):_[A]=!1}}},e.prototype._forEachCell=function(i,s,a,h,u,p,_,g){for(var v=this._convertToCellCoord(i),b=this._convertToCellCoord(s),w=this._convertToCellCoord(a),I=this._convertToCellCoord(h),A=v;A<=w;A++)for(var P=b;P<=I;P++){var R=this.d*P+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(P),this._convertFromCellCoord(A+1),this._convertFromCellCoord(P+1)))&&u.call(this,i,s,a,h,R,p,_,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,s=r+this.cells.length+1+1,a=0,h=0;h<this.cells.length;h++)a+=this.cells[h].length;var u=new Int32Array(s+a+this.keys.length+this.bboxes.length);u[0]=this.extent,u[1]=this.n,u[2]=this.padding;for(var p=s,_=0;_<i.length;_++){var g=i[_];u[r+_]=p,u.set(g,p),p+=g.length}return u[r+i.length]=p,u.set(this.keys,p),u[r+i.length+1]=p+=this.keys.length,u.set(this.bboxes,p),p+=this.bboxes.length,u.buffer},Kh})(),Ks=Ga(Jh);const xl={};function rt(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),xl[e]={klass:r,omit:i.omit||[]}}rt(Object,"Object"),Ks.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},Ks.deserialize=function(r){return new Ks(r.buffer)},Object.defineProperty(Ks,"name",{value:"Grid"}),rt(Ks,"Grid"),delete ke.prototype.constructor,typeof DOMMatrix<"u"&&rt(DOMMatrix,"DOMMatrix"),rt(li,"Color"),rt(Error,"Error"),rt($r,"Formatted"),rt(ec,"FormattedSection"),rt(Xt,"AJAXError"),rt(sn,"ResolvedImage"),rt(Co,"StylePropertyFunction"),rt(Wh,"StyleExpression",{omit:["_evaluator"]}),rt(un,"ImageId"),rt(vs,"ImageVariant"),rt(Ys,"ZoomDependentExpression"),rt(Ac,"ZoomConstantExpression"),rt(Tr,"CompoundExpression",{omit:["_evaluate"]});for(const r in ha)xl[ha[r]._classRegistryKey]||rt(ha[r],`Expression${r}`);function Mc(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function vl(r){return self.ImageBitmap&&r instanceof ImageBitmap}function bs(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(Mc(r)||vl(r))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 s of r)i.push(bs(s,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[s,a]of r.entries())i.entries.push(bs(s),bs(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let s=0;for(const a of r.values())i[++s]=bs(a);return i}if(r instanceof DOMMatrix){const i={$name:"DOMMatrix"},s=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const a of s)i[a]=r[a];return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,s=i._classRegistryKey;if(!s)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 h in r)r.hasOwnProperty(h)&&(xl[s].omit.indexOf(h)>=0||(a[h]=bs(r[h],e)));r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(a.$name=s),a}throw new Error("can't serialize object of type "+typeof r)}function an(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||Mc(r)||vl(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(an);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const a=r.entries||[],h=new Map;for(let u=0;u<a.length;u+=2)h.set(an(a[u]),an(a[u+1]));return h}if(e==="Set"){const a=new Set;for(const h of Object.keys(r))h!=="$name"&&a.add(an(r[h]));return a}if(e==="DOMMatrix"){let a;return a=r.is2D?[r.a,r.b,r.c,r.d,r.e,r.f]:[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.m41,r.m42,r.m43,r.m44],new DOMMatrix(a)}if(e==="BigInt")return BigInt(r.value);const{klass:i}=xl[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(s[a]=an(r[a]));return s}throw new Error("can't deserialize object of type "+typeof r)}const gt={"Latin-1 Supplement":r=>r>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>
1=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519,Osage:r=>r>=66736&&r<=66815,"CJK Unified Ideographs Extension B":r=>r>=131072&&r<=173791};function Qh(r){for(const e of r)if(Cc(e.charCodeAt(0)))return!0;return!1}function zp(r){for(const e of r)if(!Rp(e.charCodeAt(0)))return!1;return!0}function Rp(r){return!(gt.Arabic(r)||gt["Arabic Supplement"](r)||gt["Arabic Extended-A"](r)||gt["Arabic Presentation Forms-A"](r)||gt["Arabic Presentation Forms-B"](r))}function Cc(r){return!(r!==746&&r!==747&&(r<4352||!(gt["Bopomofo Extended"](r)||gt.Bopomofo(r)||gt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||gt["CJK Compatibility Ideographs"](r)||gt["CJK Compatibility"](r)||gt["CJK Radicals Supplement"](r)||gt["CJK Strokes"](r)||!(!gt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||gt["CJK Unified Ideographs Extension A"](r)||gt["CJK Unified Ideographs"](r)||gt["Enclosed CJK Letters and Months"](r)||gt["Hangul Compatibility Jamo"](r)||gt["Hangul Jamo Extended-A"](r)||gt["Hangul Jamo Extended-B"](r)||gt["Hangul Jamo"](r)||gt["Hangul Syllables"](r)||gt.Hiragana(r)||gt["Ideographic Description Characters"](r)||gt.Kanbun(r)||gt["Kangxi Radicals"](r)||gt["Katakana Phonetic Extensions"](r)||gt.Katakana(r)&&r!==12540||!(!gt["Halfwidth and Fullwidth Forms"](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)||!(!gt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||gt["Unified Canadian Aboriginal Syllabics"](r)||gt["Unified Canadian Aboriginal Syllabics Extended"](r)||gt["Vertical Forms"](r)||gt["Yijing Hexagram Symbols"](r)||gt["Yi Syllables"](r)||gt["Yi Radicals"](r))))}function Pc(r){return!(Cc(r)||(function(e){return!!(gt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||gt["General Punctuation"](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)||gt["Letterlike Symbols"](e)||gt["Number Forms"](e)||gt["Miscellaneous Technical"](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)||gt["Control Pictures"](e)&&e!==9251||gt["Optical Character Recognition"](e)||gt["Enclosed Alphanumerics"](e)||gt["Geometric Shapes"](e)||gt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||gt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||gt["CJK Symbols and Punctuation"](e)||gt.Katakana(e)||gt["Private Use Area"](e)||gt["CJK Compatibility Forms"](e)||gt["Small Form Variants"](e)||gt["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)})(r))}function Wd(r){return gt.Arabic(r)||gt["Arabic Supplement"](r)||gt["Arabic Extended-A"](r)||gt["Arabic Presentation Forms-A"](r)||gt["Arabic Presentation Forms-B"](r)}function zc(r){return r>=1424&&r<=2303||gt["Arabic Presentation Forms-A"](r)||gt["Arabic Presentation Forms-B"](r)}function Dp(r,e){return!(!e&&zc(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||gt.Khmer(r))}function Lp(r){for(const e of r)if(zc(e.charCodeAt(0)))return!0;return!1}const fn={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let eu=null,Wr=fn.unavailable,Js=null;const Xd=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(Wr=fn.error),eu&&eu(r)};function tu(){iu.fire(new ys("pluginStateChange",{pluginStatus:Wr,pluginURL:Js}
vendor: 11,230 bytes, line 1
1))}const iu=new xo,ru=function(){return Wr},Yd=function(){if(Wr!==fn.deferred||!Js)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Wr=fn.loading,tu(),Js&&Qa({url:Js},(r=>{r?Xd(r):(Wr=fn.loaded,tu())}))},es={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Wr===fn.loaded||es.applyArabicShaping!=null,isLoading:()=>Wr===fn.loading,setState(r){Wr=r.pluginStatus,Js=r.pluginURL},isParsing:()=>Wr===fn.parsing,isParsed:()=>Wr===fn.parsed,getPluginURL:()=>Js};class pi{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.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return(function(i,s){for(const a of i)if(!Dp(a.charCodeAt(0),s))return!1;return!0})(e,es.isLoaded())}}class bl{constructor(e,i,s,a){this.property=e,this.value=i,this.expression=(function(h,u,p,_){if(Ic(h))return new Co(h,u);if(Xh(h)||Array.isArray(h)&&h.length>0){const g=Yh(h,u,p,_);if(g.result==="error")throw new Error(g.value.map((v=>`${v.key}: ${v.message}`)).join(", "));return g.value}{let g=h;return typeof h=="string"&&u.type==="color"&&(g=li.parse(h)),{kind:"constant",configDependencies:new Set,evaluate:()=>g}}})(i===void 0?e.specification.default:i,e.specification,s,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class Rc{constructor(e,i,s){this.property=e,this.value=new bl(e,void 0,i,s)}transitioned(e,i){return new Kd(this.property,this.value,i,ye({},e.transition,this.transition),e.now)}untransitioned(){return new Kd(this.property,this.value,null,{},0)}}class wl{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return Ft(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Rc(this._values[e].property,this._scope,this._options)),this._values[e].value=new bl(this._values[e].property,i===null?void 0:Ft(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const s=this._properties.properties;if(e)for(const a in e){const h=e[a];if(a.endsWith("-transition")){const u=a.slice(0,-11);s[u]&&this.setTransition(u,h)}else s.hasOwnProperty(a)&&this.setValue(a,h)}}getTransition(e){return Ft(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Rc(this._values[e].property)),this._values[e].transition=Ft(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const s=new Jd(this._properties);for(const a of Object.keys(this._values))s._values[a]=this._values[a].transitioned(e,i._values[a]);return s}untransitioned(){const e=new Jd(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class Kd{constructor(e,i,s,a,h){const u=a.delay||0,p=a.duration||0;h=h||0,this.property=e,this.value=i,this.begin=h+u,this.end=this.begin+p,e.specification.transition&&(a.delay||a.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const a=e.now||0,h=this.value.possiblyEvaluate(e,i,s),u=this.prior;if(u){if(a>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(a<this.begin)return u.possiblyEvaluate(e,i,s);{const p=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(e,i,s),h,B(p))}}return h}}class Jd{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const a=new Wn(this._properties);for(const h of Object.keys(this._values))a._values[h]=this._values[h].possiblyEvaluate(e,i,s);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Qs{constructor(e,i,s){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=s,this.configDependencies=new Set}getValue(e){return Ft(this._values[e].value)}setValue(e,i){this._values[e]=new bl(this._values[e].property,i===null?void 0:Ft(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const a=new Wn(this._properties);for(const h of Object.keys(this._values))a._values[h]=this._values[h].possiblyEvaluate(e,i,s);return a}}class Po{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,a){return this.property.evaluate(this.value,this.parameters,e,i,s,a)}}class Wn{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ge{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,s){const a=nl[this.specification.type];return a?a(e,i,s):e}}class Je{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,a){return new Po(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,a)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Po(this,{kind:"constant",value:void 0},e.parameters);const a=nl[this.specification.type];return a?new Po(this,{kind:"constant",value:a(e.value.value,i.value.value,s)},e.parameters):e}evaluate(e,i,s,a,h,u){return e.kind==="constant"?e.value:e.evaluate(i,s,a,h,u)}}class ua{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,a){return!!e.expression.evaluate(i,null,{},s,a)}interpolate(){return!1}}class Yi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new pi(0,{});for(const s in e){const a=e[s];a.specification.overridable&&this.overridableProperties.push(s);const h=this.defaultPropertyValues[s]=new bl(a,void 0),u=this.defaultTransitionablePropertyValues[s]=new Rc(a);this.defaultTransitioningPropertyValues[s]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=h.possiblyEvaluate(i)}}}rt(Je,"DataDrivenProperty"),rt(Ge,"DataConstantProperty"),rt(ua,"ColorRampProperty");var ue=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}},"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"}}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string"},"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":"expression"},"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"]}}},"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":{}}},"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-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"}},"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,"maximum":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,"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,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"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,"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],"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":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"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","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"ty
1pe":"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":{}}},"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"]}},"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"]}},"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":0,"minimum":0,"maximum":1,"expression":{"int
1erpolated":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]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Qd(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Tl(r){if(Array.isArray(r))return r.map(Tl);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=Tl(r[i]);return e}return Qd(r)}function Sl(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(!Sl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function da(r,e="",i=null,s="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Sl(r)||(r=Lc(r));const a=r;let h=!0;try{h=(function(v){if(!fa(v))return v;let b=Tl(v);return Dc(b),b=nu(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 u=null,p=null;if(s!=="background"&&s!=="sky"&&s!=="slot"){p=ue[`filter_${s}`];const v=Mo(h,p,e,i);if(v.result==="error")throw new Error(v.value.map((b=>`${b.key}: ${b.message}`)).join(", "));u=(b,w,I)=>v.value.evaluate(b,w,{},I)}let _=null,g=null;if(h!==a){const v=Mo(a,p,e,i);if(v.result==="error")throw new Error(v.value.map((b=>`${b.key}: ${b.message}`)).join(", "));_=(b,w,I,A,P)=>v.value.evaluate(b,w,{},I,void 0,void 0,A,P),g=!na(v.value.expression)}return{filter:u,dynamicFilter:_||void 0,needGeometry:su(h),needFeature:!!g}}function nu(r){if(!Array.isArray(r))return r;const e=(function(i){if(ts.has(i[0])){for(let s=1;s<i.length;s++)if(fa(i[s]))return!0}return i})(r);return e===!0?e:e.map((i=>nu(i)))}function Dc(r){let e=!1;const i=[];if(r[0]==="case"){for(let s=1;s<r.length-1;s+=2)e=e||fa(r[s]),i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||fa(r[1]);for(let s=2;s<r.length-1;s+=2)i.push(r[s+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||fa(r[1]);for(let s=1;s<r.length-1;s+=2)i.push(r[s+1])}e&&(r.length=0,r.push("any",...i));for(let s=1;s<r.length;s++)Dc(r[s])}function fa(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
vendor: 20,617 bytes, line 7
7for(let i=1;i<r.length;i++)if(fa(r[i]))return!0;return!1}const ts=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Fp(r,e){return r<e?-1:r>e?1:0}function su(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(su(r[e]))return!0;return!1}function Lc(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?ou(r[1],r[2],"=="):e==="!="?Fc(ou(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?ou(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Lc))):e==="all"?["all"].concat(r.slice(1).map(Lc)):e==="none"?["all"].concat(r.slice(1).map(Lc).map(Fc)):e==="in"?ef(r[1],r.slice(2)):e==="!in"?Fc(ef(r[1],r.slice(2))):e==="has"?tf(r[1]):e!=="!has"||Fc(tf(r[1]));var i}function ou(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 ef(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(Fp)]]:["filter-in-small",r,["literal",e]]}}function tf(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Fc(r){return["!",r]}const El="�";function pa(r,e){return e?`${r}${El}${e}`:r}const rf="-transition",Op=new Set(["fill","line","background","hillshade","raster"]);class Vr extends xo{constructor(e,i,s,a,h){if(super(),this.id=e.id,this.fqid=pa(this.id,s),this.type=e.type,this.scope=s,this.lut=a,this.options=h,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.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 u=Mo(this.filter,ue[`filter_${e.type}`]);u.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...u.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new Qs(i.layout,this.scope,h),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){this._transitionablePaint=new wl(i.paint,this.scope,h);for(const u in e.paint)this.setPaintProperty(u,e.paint[u]);for(const u in e.layout)this.setLayoutProperty(u,e.layout[u]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Wn(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Op.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const s=this._unevaluatedLayout;s._properties.properties[e]&&(s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(rf)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const s=this._transitionablePaint,a=s._properties.properties;if(e.endsWith(rf)){const b=e.slice(0,-11);return a[b]&&s.setTransition(b,i||void 0),!1}if(!a[e])return!1;const h=s._values[e],u=h.value.isDataDriven(),p=h.value;s.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...s.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const _=s._values[e].value,g=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return g||u||v||this._handleOverridablePaintPropertyUpdate(e,p,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,s){return null}_handleOverridablePaintPropertyUpdate(e,i,s){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.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return Ut({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},((e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).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 Po&&Sc(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=da(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)}queryRadius(e){}queryIntersectsFeature(e,i,s,a,h,u,p,_,g){}}const kp={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Il{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ci{constructor(){this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&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,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_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 $t(r,e=1){let i=0,s=0;return{members:r.map((a=>{const h=kp[a.type].BYTES_PER_ELEMENT,u=i=au(i,Math.max(e,h)),p=a.components||1;return s=Math.max(s,h),i+=h*p,{name:a.name,type:a.type,components:p,offset:u}})),size:au(i,Math.max(s,e)),alignment:e}}function au(r,e){return Math.ceil(r/e)*e}class ln extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=s,e}}ln.prototype.bytesPerElement=4,rt(ln,"StructArrayLayout2i4");class ma extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const h=3*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=a,e}}ma.prototype.bytesPerElement=6,rt(ma,"StructArrayLayout3i6");class _a extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a)}emplace(e,i,s,a,h){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=s,this.int16[u+2]=a,this.int16[u+3]=h,e}}_a.prototype.bytesPerElement=8,rt(_a,"StructArrayLayout4i8");class zo extends Ci{_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}}zo.prototype.bytesPerElement=4,rt(zo,"StructArrayLayout1f4");class lu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const h=4*e,u=2*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.float32[u+1]=a,e}}lu.prototype.bytesPerElement=8,rt(lu,"StructArrayLayout2i1f8");class cu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=a,e}}cu.prototype.bytesPerElement=8,rt(cu,"StructArrayLayout3i8");class Oc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a,h)}emplace(e,i,s,a,h,u){const p=5*e;return this.int16[p+0]=i,this.int16[p+1]=s,this.int16[p+2]=a,this.int16[p+3]=h,this.int16[p+4]=u,e}}Oc.prototype.bytesPerElement=10,rt(Oc,"StructArrayLayout5i10");class kc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u,p){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,h,u,p)}emplace(e,i,s,a,h,u,p,_){const g=6*e,v=12*e,b=3*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[v+4]=a,this.uint8[v+5]=h,this.uint8[v+6]=u,this.uint8[v+7]=p,this.float32[b+2]=_,e}}kc.prototype.bytesPerElement=12,rt(kc,"StructArrayLayout2i4ub1f12");class En extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const h=3*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=a,e}}En.prototype.bytesPerElement=12,rt(En,"StructArrayLayout3f12");class eo extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a,h)}emplace(e,i,s,a,h,u){const p=6*e,_=3*e;return this.uint16[p+0]=i,this.uint16[p+1]=s,this.uint16[p+2]=a,this.uint16[p+3]=h,this.float32[_+2]=u,e}}eo.prototype.bytesPerElement=12,rt(eo,"StructArrayLayout4ui1f12");class ga extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a)}emplace(e,i,s,a,h){const u=4*e;return this.uint16[u+0]=i,this.uint16[u+1]=s,this.uint16[u+2]=a,this.uint16[u+3]=h,e}}ga.prototype.bytesPerElement=8,rt(ga,"StructArrayLayout4ui8");class Bc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,a,h,u)}emplace(e,i,s,a,h,u,p){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=a,this.int16[_+3]=h,this.int16[_+4]=u,this.int16[_+5]=p,e}}Bc.prototype.bytesPerElement=12,rt(Bc,"StructArrayLayout6i12");class Nc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u,p,_,g,v,b,w){const I=this.length;return this.resize(I+1),this.emplace(I,e,i,s,a,h,u,p,_,g,v,b,w)}emplace(e,i,s,a,h,u,p,_,g,v,b,w,I){const A=12*e;return this.int16[A+0]=i,this.int16[A+1]=s,this.int16[A+2]=a,this.int16[A+3]=h,this.uint16[A+4]=u,this.uint16[A+5]=p,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}}Nc.prototype.bytesPerElement=24,rt(Nc,"StructArrayLayout4i4ui4i24");class ya extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,a,h,u)}emplace(e,i,s,a,h,u,p){const _=10*e,g=5*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=a,this.float32[g+2]=h,this.float32[g+3]=u,this.float32[g+4]=p,e}}ya.prototype.bytesPerElement=20,rt(ya,"StructArrayLayout3i3f20");class to extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a)}emplace(e,i,s,a,h){const u=4*e;return this.float32[u+0]=i,this.float32[u+1]=s,this.float32[u+2]=a,this.float32[u+3]=h,e}}to.prototype.bytesPerElement=16,rt(to,"StructArrayLayout4f16");class hu extends Ci{_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}}hu.prototype.bytesPerElement=4,rt(hu,"StructArrayLayout1ul4");class is extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=s,e}}is.prototype.bytesPerElement=4,rt(is,"StructArrayLayout2ui4");class uu extends Ci{_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,s,a,h,u,p,_,g,v,b,w,I){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s,a,h,u,p,_,g,v,b,w,I)}emplace(e,i,s,a,h,u,p,_,g,v,b,w,I,A){const P=20*e,R=10*e;return this.int16[P+0]=i,this.int16[P+1]=s,this.int16[P+2]=a,this.int16[P+3]=h,this.int16[P+4]=u,this.float32[R+3]=p,this.float32[R+4]=_,this.float32[R+5]=g,this.float32[R+6]=v,this.int16[P+14]=b,this.uint32[R+8]=w,this.uint16[P+18]=I,this.uint16[P+19]=A,e}}uu.prototype.bytesPerElement=40,rt(uu,"StructArrayLayout5i4f1i1ul2ui40");class Vc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u,p){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,h,u,p)}emplace(e,i,s,a,h,u,p,_){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=a,this.int16[g+4]=h,this.int16[g+5]=u,this.int16[g+6]=p,this.int16[g+7]=_,e}}Vc.prototype.bytesPerElement=16,rt(Vc,"StructArrayLayout3i2i2i16");class xa extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,s,a,h)}emplace(e,i,s,a,h,u){const p=4*e,_=8*e;return this.float32[p+0]=i,this.float32[p+1]=s,this.float32[p+2]=a,this.int16[_+6]=h,this.int16[_+7]=u,e}}xa.prototype.bytesPerElement=16,rt(xa,"StructArrayLayout2f1f2i16");class va extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,a,h,u)}emplace(e,i,s,a,h,u,p){const _=20*e,g=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=s,this.float32[g+1]=a,this.float32[g+2]=h,this.float32[g+3]=u,this.float32[g+4]=p,e}}va.prototype.bytesPerElement=20,rt(va,"StructArrayLayout2ub4f20");class Li extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,s)}emplace(e,i,s,a){const h=3*e;return this.uint16[h+0]=i,this.uint16[h+1]=s,this.uint16[h+2]=a,e}}Li.prototype.bytesPerElement=6,rt(Li,"StructArrayLayout3ui6");class ba extends Ci{_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,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O,U,V,G,re){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O,U,V,G,re)}emplace(e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O,U,V,G,re,Q){const te=30*e,ae=15*e,ce=60*e;return this.int16[te+0]=i,this.int16[te+1]=s,this.int16[te+2]=a,this.float32[ae+2]=h,this.float32[ae+3]=u,this.uint16[te+8]=p,this.uint16[te+9]=_,this.uint32[ae+5]=g,this.uint32[ae+6]=v,this.uint32[ae+7]=b,this.uint16[te+16]=w,this.uint16[te+17]=I,this.uint16[te+18]=A,this.float32[ae+10]=P,this.float32[ae+11]=R,this.uint8[ce+48]=O,this.uint8[ce+49]=U,this.uint8[ce+50]=V,this.uint32[ae+13]=G,this.int16[te+28]=re,this.uint8[ce+58]=Q,e}}ba.prototype.bytesPerElement=60,rt(ba,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class du extends Ci{_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,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O,U,V,G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce,Fe,Ve,Te){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O,U,V,G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce,Fe,Ve,Te)}emplace(e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O,U,V,G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce,Fe,Ve,Te,Oe){const fe=20*e,Se=40*e,He=80*e;return this.float32[fe+0]=i,this.float32[fe+1]=s,this.int16[Se+4]=a,this.int16[Se+5]=h,this.int16[Se+6]=u,this.int16[Se+7]=p,this.int16[Se+8]=_,this.int16[Se+9]=g,this.int16[Se+10]=v,this.int16[Se+11]=b,this.int16[Se+12]=w,this.uint16[Se+13]=I,this.uint16[Se+14]=A,this.uint16[Se+15]=P,this.uint16[Se+16]=R,this.uint16[Se+17]=O,this.uint16[Se+18]=U,this.uint16[Se+19]=V,this.uint16[Se+20]=G,this.uint16[Se+21]=re,this.uint16[Se+22]=Q,this.uint16[Se+23]=te,this.uint16[Se+24]=ae,this.uint16[Se+25]=ce,this.uint16[Se+26]=Ee,this.uint16[Se+27]=de,this.uint32[fe+14]=Ae,this.float32[fe+15]=je,this.float32[fe+16]=Ce,this.float32[fe+17]=Fe,this.float32[fe+18]=Ve,this.uint8[He+76]=Te,this.uint16[Se+39]=Oe,e}}du.prototype.bytesPerElement=80,rt(du,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class fu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,s,a,h,u)}emplace(e,i,s,a,h,u,p){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=s,this.float32[_+2]=a,this.float32[_+3]=h,this.float32[_+4]=u,this.float32[_+5]=p,e}}fu.prototype.bytesPerElement=24,rt(fu,"StructArrayLayout6f24");class Ro extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h){const u=this.length;
vendor: 5,630 bytes, line 7
7return this.resize(u+1),this.emplace(u,e,i,s,a,h)}emplace(e,i,s,a,h,u){const p=5*e;return this.float32[p+0]=i,this.float32[p+1]=s,this.float32[p+2]=a,this.float32[p+3]=h,this.float32[p+4]=u,e}}Ro.prototype.bytesPerElement=20,rt(Ro,"StructArrayLayout5f20");class pu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u,p){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,h,u,p)}emplace(e,i,s,a,h,u,p,_){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=s,this.float32[g+2]=a,this.float32[g+3]=h,this.float32[g+4]=u,this.float32[g+5]=p,this.float32[g+6]=_,e}}pu.prototype.bytesPerElement=28,rt(pu,"StructArrayLayout7f28");class Al extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u,p,_,g,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,s,a,h,u,p,_,g,v,b)}emplace(e,i,s,a,h,u,p,_,g,v,b,w){const I=11*e;return this.float32[I+0]=i,this.float32[I+1]=s,this.float32[I+2]=a,this.float32[I+3]=h,this.float32[I+4]=u,this.float32[I+5]=p,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}}Al.prototype.bytesPerElement=44,rt(Al,"StructArrayLayout11f44");class mu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u,p,_,g){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,s,a,h,u,p,_,g)}emplace(e,i,s,a,h,u,p,_,g,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=s,this.float32[b+2]=a,this.float32[b+3]=h,this.float32[b+4]=u,this.float32[b+5]=p,this.float32[b+6]=_,this.float32[b+7]=g,this.float32[b+8]=v,e}}mu.prototype.bytesPerElement=36,rt(mu,"StructArrayLayout9f36");class io extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=s,e}}io.prototype.bytesPerElement=8,rt(io,"StructArrayLayout2f8");class _u extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,a)}emplace(e,i,s,a,h){const u=6*e;return this.uint32[3*e+0]=i,this.uint16[u+2]=s,this.uint16[u+3]=a,this.uint16[u+4]=h,e}}_u.prototype.bytesPerElement=12,rt(_u,"StructArrayLayout1ul3ui12");class gu extends Ci{_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}}gu.prototype.bytesPerElement=2,rt(gu,"StructArrayLayout1ui2");class Uc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R){const O=this.length;return this.resize(O+1),this.emplace(O,e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R)}emplace(e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O){const U=16*e;return this.float32[U+0]=i,this.float32[U+1]=s,this.float32[U+2]=a,this.float32[U+3]=h,this.float32[U+4]=u,this.float32[U+5]=p,this.float32[U+6]=_,this.float32[U+7]=g,this.float32[U+8]=v,this.float32[U+9]=b,this.float32[U+10]=w,this.float32[U+11]=I,this.float32[U+12]=A,this.float32[U+13]=P,this.float32[U+14]=R,this.float32[U+15]=O,e}}Uc.prototype.bytesPerElement=64,rt(Uc,"StructArrayLayout16f64");class wa extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,a,h,u,p){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,a,h,u,p)}emplace(e,i,s,a,h,u,p,_){const g=10*e,v=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=s,this.uint16[g+2]=a,this.uint16[g+3]=h,this.float32[v+2]=u,this.float32[v+3]=p,this.float32[v+4]=_,e}}wa.prototype.bytesPerElement=20,rt(wa,"StructArrayLayout4ui3f20");class yu extends Ci{_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}}yu.prototype.bytesPerElement=2,rt(yu,"StructArrayLayout1i2");class jc extends Ci{_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}}jc.prototype.bytesPerElement=1,rt(jc,"StructArrayLayout1ub1");class xu extends Il{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]}}xu.prototype.size=40;
vendor: 30,225 bytes, line 7
7class nf extends uu{get(e){return new xu(this,e)}}rt(nf,"CollisionBoxArray");class Gc extends Il{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}}Gc.prototype.size=60;class Ml extends ba{get(e){return new Gc(this,e)}}rt(Ml,"PlacedSymbolArray");class vu extends Il{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}vu.prototype.size=80;class sf extends du{get(e){return new vu(this,e)}}rt(sf,"SymbolInstanceArray");class bu extends zo{getoffsetX(e){return this.float32[1*e+0]}}rt(bu,"GlyphOffsetArray");class of extends ln{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}rt(of,"SymbolLineVertexArray");class qc extends Il{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]}}qc.prototype.size=12;class af extends _u{get(e){return new qc(this,e)}}rt(af,"FeatureIndexArray");class lf extends is{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}rt(lf,"FillExtrusionCentroidArray");class cf extends Il{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]}}cf.prototype.size=6;class hf extends ma{get(e){return new cf(this,e)}}rt(hf,"FillExtrusionWallArray");const uf=$t([{name:"a_pos",components:2,type:"Int16"}],4),Bp=$t([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Np=$t([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ni{constructor(e=[]){this.segments=e}_prepareSegment(e,i,s,a){let h=this.segments[this.segments.length-1];return e>Ni.MAX_VERTEX_ARRAY_LENGTH&&Gt(`Max vertices per segment is ${Ni.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>Ni.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==a)&&(h={vertexOffset:i,primitiveOffset:s,vertexLength:0,primitiveLength:0},a!==void 0&&(h.sortKey=a),this.segments.push(h)),h}prepareSegment(e,i,s,a){return this._prepareSegment(e,i.length,s.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,s,a){return new Ni([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:a,vaos:{},sortKey:0}])}}function df(r,e){return 256*(r=W(Math.floor(r),0,255))+W(Math.floor(e),0,255)}Ni.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,rt(Ni,"SegmentVector");const Vp=$t([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),wu=$t([{name:"a_pattern_b",components:4,type:"Uint16"}]),Up=$t([{name:"a_dash",components:4,type:"Uint16"}]);class Cl{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,s,a){this.ids.push(Pl(e)),this.positions.push(i,s,a)}eachPosition(e,i){const s=Pl(e);let a=0,h=this.ids.length-1;for(;a<h;){const u=a+h>>1;this.ids[u]>=s?h=u:a=u+1}for(;this.ids[a]===s;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const s=new Float64Array(e.ids),a=new Uint32Array(e.positions);return Tu(s,a,0,s.length-1),i&&(i.add(s.buffer),i.add(a.buffer)),{ids:s,positions:a}}static deserialize(e){const i=new Cl;let s;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==s&&i.uniqueIds.push(a),s=a;return i.indexed=!0,i}}function Pl(r){const e=+r;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Wo(String(r))}function Tu(r,e,i,s){for(;i<s;){const a=r[i+s>>1];let h=i-1,u=s+1;for(;;){do h++;while(r[h]<a);do u--;while(r[u]>a);if(h>=u)break;Hc(r,h,u),Hc(e,3*h,3*u),Hc(e,3*h+1,3*u+1),Hc(e,3*h+2,3*u+2)}u-i<s-u?(Tu(r,e,i,u),i=u+1):(Tu(r,e,u+1,s),s=u)}}function Hc(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}rt(Cl,"FeaturePositionMap");class Un{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,s){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class $c extends Un{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1i(this.location,s))}}class sr extends Un{constructor(e){super(e),this.current=0}set(e,i,s){this.fetchUniformLocation(e,i)&&this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class rs extends Un{constructor(e){super(e),this.current=[0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]||(this.current=s,this.gl.uniform2f(this.location,s[0],s[1])))}}class Ta extends Un{constructor(e){super(e),this.current=[0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]||(this.current=s,this.gl.uniform3f(this.location,s[0],s[1],s[2])))}}class zl extends Un{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,s){this.fetchUniformLocation(e,i)&&(s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3])))}}class Su extends Un{constructor(e){super(e),this.current=li.transparent.toPremultipliedRenderColor(null)}set(e,i,s){this.fetchUniformLocation(e,i)&&(s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a)))}}const ff=new Float32Array(16);class Rl extends Un{constructor(e){super(e),this.current=ff}set(e,i,s){if(this.fetchUniformLocation(e,i)){if(s[12]!==this.current[12]||s[0]!==this.current[0])return this.current=s,void this.gl.uniformMatrix4fv(this.location,!1,s);for(let a=1;a<16;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix4fv(this.location,!1,s);break}}}}const jp=new Float32Array(9),pf=new Float32Array(4);class Eu extends Un{constructor(e){super(e),this.current=pf}set(e,i,s){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(s[a]!==this.current[a]){this.current=s,this.gl.uniformMatrix2fv(this.location,!1,s);break}}}}function Iu(r){return[df(255*r.r,255*r.g),df(255*r.b,255*r.a)]}class Dl{constructor(e,i,s,a){this.value=e,this.uniformNames=i.map((h=>`u_${h}`)),this.type=s,this.context=a}setUniform(e,i,s,a,h){const u=a.constantOr(this.value);i.set(e,h,u instanceof li?u.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):u)}getBinding(e,i){return this.type==="color"?new Su(e):new sr(e)}}class Sa{constructor(e,i){this.uniformNames=i.map((s=>`u_${s}`)),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,s,a,h){let u=null;h!=="u_pattern"&&h!=="u_dash"||(u=this.pattern),h==="u_pattern_b"&&(u=this.patternTransition),h==="u_pixel_ratio"&&(u=this.pixelRatio),u&&i.set(e,h,u)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new zl(e):new sr(e)}}class ws{constructor(e,i,s,a){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map((h=>({name:`a_${h}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new a}populatePaintArray(e,i,s,a,h,u,p,_){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new pi(0,{brightness:u,worldview:_}),i,{},h,a,p):this.expression.kind==="constant"&&this.expression.value,b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new pi(0,{brightness:u,worldview:_}),i,{},h,a,p):this.lutExpression.value)==="none";this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,b?null:this.context.lut)}updatePaintArray(e,i,s,a,h,u,p,_){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:p,worldview:_},s,a,void 0,h):this.expression.kind==="constant"&&this.expression.value,v=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new pi(0,{brightness:p,worldview:_}),s,a,void 0,h):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v?null:this.context.lut)}_setPaintValue(e,i,s,a){if(this.type==="color"){const h=Iu(s.toPremultipliedRenderColor(a));for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,h[0],h[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}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 jn{constructor(e,i,s,a,h,u){this.expression=e,this.uniformNames=i.map((p=>`u_${p}_t`)),this.type=s,this.useIntegerZoom=a,this.context=h,this.maxValue=0,this.paintVertexAttributes=i.map((p=>({name:`a_${p}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new u}populatePaintArray(e,i,s,a,h,u,p,_){const g=this.expression.evaluate(new pi(this.context.zoom,{brightness:u,worldview:_}),i,{},h,a,p),v=this.expression.evaluate(new pi(this.context.zoom+1,{brightness:u,worldview:_}),i,{},h,a,p),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new pi(0,{brightness:u,worldview:_}),i,{},h,a,p):this.lutExpression.value)==="none",w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,v,b?null:this.context.lut)}updatePaintArray(e,i,s,a,h,u,p,_){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:p,worldview:_},s,a,void 0,h),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:p,worldview:_},s,a,void 0,h),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new pi(0,{brightness:p,worldview:_}),s,a,void 0,h):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v,b?null:this.context.lut)}_setPaintValue(e,i,s,a,h){if(this.type==="color"){const u=Iu(s.toPremultipliedRenderColor(h)),p=Iu(s.toPremultipliedRenderColor(h));for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,u[0],u[1],p[0],p[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,s,a);this.maxValue=Math.max(this.maxValue,Math.abs(s),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,s,a,h){const u=this.useIntegerZoom?Math.floor(s.zoom):s.zoom,p=W(this.expression.interpolationFactor(u,this.context.zoom,this.context.zoom+1),0,1);i.set(e,h,p)}getBinding(e,i){return new sr(e)}}class In{constructor(e,i,s,a,h){this.expression=e,this.layerId=h,this.paintVertexAttributes=(s==="array"?Up:Vp).members;for(let u=0;u<i.length;++u);this.paintVertexArray=new a,this.paintTransitionVertexArray=new ga}populatePaintArray(e,i,s,a){const h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(h,e,i.patterns&&i.patterns[this.layerId],s)}updatePaintArray(e,i,s,a,h,u,p){this._setPaintValues(e,i,s.patterns&&s.patterns[this.layerId],u)}_setPaintValues(e,i,s,a){if(!a||!s)return;const h=a[s[0]],u=a[s[1]];if(h){if(h){const{tl:p,br:_,pixelRatio:g}=h;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,p[0],p[1],_[0],_[1],g)}if(u){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:p,br:_}=u;for(let g=e;g<i;g++)this.paintTransitionVertexArray.emplace(g,p[0],p[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,wu.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Xr{constructor(e,i,s=(()=>!0)){this.binders={},this._buffers=[],this.context=i;const a=[];for(const h in e.paint._values){const u=e.paint.get(h);if(h.endsWith("-use-theme")||!s(h)||!(u instanceof Po&&Sc(u.property.specification)))continue;const p=qp(h,e.type),_=u.value,g=u.property.specification.type,v=!!u.property.useIntegerZoom,b=h==="line-dasharray"||h.endsWith("pattern"),w=e.paint.get(`${h}-use-theme`),I=h==="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=mf(h,g,"source");this.binders[h]=b?new In(_,p,g,A,e.id):new ws(_,p,g,A),a.push(`/a_${h}`)}else{const A=mf(h,g,"composite");this.binders[h]=new jn(_,p,g,v,i,A),a.push(`/z_${h}`)}else this.binders[h]=b?new Sa(_.value,p):new Dl(_.value,p,g,i),a.push(`/u_${h}`);w&&(this.binders[h].lutExpression=w.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof ws||i instanceof jn?i.maxValue:0}populatePaintArrays(e,i,s,a,h,u,p,_){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof ws||v instanceof jn||v instanceof In)&&v.populatePaintArray(e,i,s,a,h,u,p,_)}}setConstantPatternPositions(e,i){for(const s in this.binders){const a=this.binders[s];a instanceof Sa&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof In?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,s,a,h,u,p,_,g,v){let b=!1;const w=Object.keys(e),I=w.length!==0&&!_,A=I?w:i.uniqueIds;this.context.lut=h.lut;for(const P in this.binders){const R=this.binders[P];if(R.context=this.context,(R instanceof ws||R instanceof jn||R instanceof In)&&R.expression&&R.expression.kind&&R.expression.kind!=="constant"&&(R.expression.isStateDependent===!0||R.expression.isLightConstant===!1)){const O=h.paint.get(P);R.expression=O.value;for(const U of A){const V=e[U.toString()];i.eachPosition(U,((G,re,Q)=>{const te=a.feature(G);R.updatePaintArray(re,Q,te,V,u,p,g,v)}))}if(!I)for(const U of s.uniqueIds){const V=e[U.toString()];s.eachPosition(U,((G,re,Q)=>{const te=a.feature(G);R.updatePaintArray(re,Q,te,V,u,p,g,v)}))}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof Dl||s instanceof Sa)&&e.push(...s.uniformNames.map((a=>`#define HAS_UNIFORM_${a}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof ws||s instanceof jn||s instanceof In)for(let a=0;a<s.paintVertexAttributes.length;a++)e.push(s.paintVertexAttributes[a].name);if(s instanceof In)for(let a=0;a<wu.members.length;a++)e.push(wu.members[a].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Dl||s instanceof Sa||s instanceof jn)for(const a of s.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const s in this.binders){const a=this.binders[s];if(a instanceof Dl||a instanceof Sa||a instanceof jn)for(const h of a.uniformNames)i.push({name:h,property:s,binding:a.getBinding(e,h)})}return i}setUniforms(e,i,s,a,h){for(const{name:u,property:p,binding:_}of s)this.binders[p].setUniform(e,_,h,a.get(p),u)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof ws||i instanceof jn||i instanceof In)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof In&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof ws||s instanceof jn||s instanceof In)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof ws||i instanceof jn||i instanceof In)&&i.destroy()}}}class An{constructor(e,i,s=(()=>!0)){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Xr(a,i,s);this.needsUpload=!1,this._featureMap=new Cl,this._featureMapWithoutIds=new Cl,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,s,a,h,u,p,_,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,h,u,p,_,g);i.id!==void 0?this._featureMap.add(i.id,s,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,s,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,a,h,u,p,_){for(const g of s)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,h,u,p||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 Gp={"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 qp(r,e){return Gp[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const Hp={"line-pattern":{source:eo,composite:eo},"fill-pattern":{source:eo,composite:eo},"fill-extrusion-pattern":{source:eo,composite:eo},"line-dasharray":{source:ga,composite:ga}},$p={color:{source:io,composite:to},number:{source:zo,composite:io}};function mf(r,e,i){const s=Hp[r];return s&&s[i]||$p[e][i]}rt(Dl,"ConstantBinder"),rt(Sa,"PatternConstantBinder"),rt(ws,"SourceExpressionBinder"),rt(In,"PatternCompositeBinder"),rt(jn,"CompositeExpressionBinder"),rt(Xr,"ProgramConfiguration",{omit:["_buffers"]}),rt(An,"ProgramConfigurationSet");const Ur=We/Math.PI/2,_f=5,l=6,t=16383,n=64,c=[n,32,16],d=-Ur,f=Ur;function m(r,e,i,s=Ur){return i=ei(i),[r*Math.sin(i)*s,-e*s,r*Math.cos(i)*s]}function y(r,e,i){return m(Math.cos(ei(r)),Math.sin(ei(r)),e,i)}const x=63710088e-1,T=2*Math.PI*x;class S{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 S(ve(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,s=this.lat*i,a=e.lat*i,h=Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return x*Math.acos(Math.min(h,1))}toBounds(e=0){const i=360*e/40075017,s=i/Math.cos(Math.PI/180*this.lat);return new M({lng:this.lng-s,lat:this.lat-i},{lng:this.lng+s,lat:this.lat+i})}toEcef(e){return y(this.lat,this.lng,Ur+e*Ur/x)}static convert(e){if(e instanceof S)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new S(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new S(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 M{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const s=e;this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]])}else{const s=e;this.setSouthWest(s[0]).setNorthEast(s[1])}}setNorthEast(e){return this._ne=e instanceof S?new S(e.lng,e.lat):S.convert(e),this}setSouthWest(e){return this._sw=e instanceof S?new S(e.lng,e.lat):S.convert(e),this}extend(e){const i=this._sw,s=this._ne;let a,h;if(e instanceof S)a=e,h=e;else{if(!(e instanceof M))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(M.convert(e)):this.extend(S.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(S.convert(e)):this;if(a=e._sw,h=e._ne,!a||!h)return this}return i||s?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new S(a.lng,a.lat),this._ne=new S(h.lng,h.lat)),this}getCenter(){return new S((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 S(this.getWest(),this.getNorth())}getSouthEast(){return new S(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:s}=S.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<=s&&s<=this._ne.lat&&a}static convert(e){if(e)return e instanceof M?e:new M(e)}}const E=0,C=25.5;function D(r){return T*Math.cos(r*Math.PI/180)}function z(r){return(180+r)/360}function F(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function L(r,e){return r/D(e)}function N(r){return 360*r-180}function j(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function q(r,e){return r*D(j(e))}const X=85.051129;function ee(r){return Math.cos(ei(W(r,-X,X)))}function ie(r,e){const i=W(e,E,C),s=Math.pow(2,i);return ee(r)*T/(512*s)}function Y(r){return 1/Math.cos(r*Math.PI/180)}function K(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/We)/(1<<r.z)*2));return 80150034*i/(i*i+1)/We/(1<<r.z)}class J{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=S.convert(e);return new J(z(s.lng),F(s.lat),L(i,s.lat))}toLngLat(){return new S(N(this.x),j(this.y))}toAltitude(){return q(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/T*Y(j(this.y))}}function pe(r,e,i,s,a,h,u,p,_){const g=(e+s)/2,v=(i+a)/2,b=new ke(g,v);p(b),(function(w,I,A,P,R,O){const U=A-R,V=P-O;return Math.abs((P-I)*U-(A-w)*V)/Math.hypot(U,V)})(b.x,b.y,h.x,h.y,u.x,u.y)>=_?(pe(r,e,i,g,v,h,b,p,_),pe(r,g,v,s,a,b,u,p,_)):r.push(u)}function oe(r,e,i){let s=r[0],a=s.x,h=s.y;e(s);const u=[s];for(let p=1;p<r.length;p++){const _=r[p],{x:g,y:v}=_;e(_),pe(u,a,h,g,v,s,_,e,i),a=g,h=v,s=_}return u}function Ie(r,e,i,s){if(s(e,i)){const a=e.add(i)._mult(.5);Ie(r,e,a,s),Ie(r,a,i,s)}else r.push(i)}function xe(r,e){let i=r[0];const s=[i];for(let a=1;a<r.length;a++){const h=r[a];Ie(s,i,h,e),i=h}return s}const Me=Math.pow(2,14)-1,Ue=-Me-1;function me(r,e){const i=Math.round(r.x*e),s=Math.round(r.y*e);return r.x=W(i,Ue,Me),r.y=W(s,Ue,Me),(i<r.x||i>r.x+1||s<r.y||s>r.y+1)&&Gt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function se(r,e,i){const s=r.loadGeometry(),a=r.extent,h=We/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const u=1<<e.z,{scale:p,x:_,y:g,projection:v}=i,b=w=>{const I=N((e.x+w.x/a)/u),A=j((e.y+w.y/a)/u),P=v.project(I,A);w.x=(P.x*p-_)*a,w.y=(P.y*p-g)*a};for(let w=0;w<s.length;w++)if(r.type!==1)s[w]=oe(s[w],b,1);else{const I=[];for(const A of s[w])A.x<0||A.x>=a||A.y<0||A.y>=a||(b(A),I.push(A));s[w]=I}}for(const u of s)for(const p of u)me(p,h);return s}function we(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?se(r):[]}}class _e{constructor(e,i,s,a,h){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=h,e.readFields(ze,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,s=[];let a,h=1,u=0,p=0,_=0;for(;e.pos<i;){if(u<=0){const g=e.readVarint();h=7&g,u=g>>3}if(u--,h===1||h===2)p+=e.readSVarint(),_+=e.readSVarint(),h===1&&(a&&s.push(a),a=[]),a&&a.push(new ke(p,_));else{if(h!==7)throw new Error(`unknown command ${h}`);a&&a.push(a[0].clone())}}return a&&s.push(a),s}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let s=1,a=0,h=0,u=0,p=1/0,_=-1/0,g=1/0,v=-1/0;for(;e.pos<i;){if(a<=0){const b=e.readVarint();s=7&b,a=b>>3}if(a--,s===1||s===2)h+=e.readSVarint(),u+=e.readSVarint(),h<p&&(p=h),h>_&&(_=h),u<g&&(g=u),u>v&&(v=u);else if(s!==7)throw new Error(`unknown command ${s}`)}return[p,g,_,v]}toGeoJSON(e,i,s){const a=this.extent*Math.pow(2,s),h=this.extent*e,u=this.extent*i,p=this.loadGeometry();function _(w){return[360*(w.x+h)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(w.y+u)/a)*Math.PI))-90]}function g(w){return w.map(_)}let v;
7if(this.type===1){const w=[];for(const A of p)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=p.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 P=A.length;if(P<=1)return[A];const R=[];let O,U;for(let V=0;V<P;V++){const G=Re(A[V]);G!==0&&(U===void 0&&(U=G<0),U===G<0?(O&&R.push(O),O=[A[V]]):O&&O.push(A[V]))}return O&&R.push(O),R})(p),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 ze(r,e,i){r===1?e.id=i.readVarint():r===2?(function(s,a){const h=s.readVarint()+s.pos;for(;s.pos<h;){const u=a._keys[s.readVarint()],p=a._values[s.readVarint()];a.properties[u]=p}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function Re(r){let e=0;for(let i,s,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],s=r[u],e+=(s.x-i.x)*(i.y+s.y);return e}_e.types=["Unknown","Point","LineString","Polygon"];class Le{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(Ze,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 _e(this._pbf,i,this.extent,this._keys,this._values)}}function Ze(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(s){let a=null;const h=s.readVarint()+s.pos;for(;s.pos<h;){const u=s.readVarint()>>3;a=u===1?s.readString():u===2?s.readFloat():u===3?s.readDouble():u===4?s.readVarint64():u===5?s.readVarint():u===6?s.readSVarint():u===7?s.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a})(i))}class at{constructor(e,i){this.layers=e.readFields(dt,{},i)}}function dt(r,e,i){if(r===3){const s=new Le(i,i.readVarint()+i.pos);s.length&&(e[s.name]=s)}}const Qe="3d_elevation_id",ht="level";class lt{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,s){return this.get(e,!0,i,s)}optional(e,i,s){return this.get(e,!1,i,s)}success(){return this._valid}get(e,i,s,a){const h=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&h!==void 0&&!Number.isNaN(h)?s(a?a(h):h):i&&(this._valid=!1),this}}class wt{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,s){return this.featureFunc(e,i,s)}parseVertex(e,i,s){return this.vertexFunc(e,i,s)}}const At=new wt(((r,e,i)=>r.reset(e).require(Qe,(s=>{i.id=s})).optional("fixed_height_relative",(s=>{i.constantHeight=s}),Yt.decodeRelativeHeight).geometry((s=>{i.bounds=s}),bh).success()),((r,e,i)=>r.reset(e).require(Qe,(s=>{i.id=s})).require("elevation_idx",(s=>{i.idx=s})).require("extent",(s=>{i.extent=s})).require("height_relative",(s=>{i.height=s}),Yt.decodeRelativeHeight).geometry((s=>{i.position=s}),Yt.getPoint).success())),Ot=new wt(((r,e,i)=>r.reset(e).require(Qe,(s=>{i.id=s})).optional("fixed_height",(s=>{i.constantHeight=s}),Yt.decodeMetricHeight).geometry((s=>{i.bounds=s}),bh).success()),((r,e,i)=>r.reset(e).require(Qe,(s=>{i.id=s})).require("elevation_idx",(s=>{i.idx=s})).require("extent",(s=>{i.extent=s})).require("height",(s=>{i.height=s}),Yt.decodeMetricHeight).geometry((s=>{i.position=s}),Yt.getPoint).success()));class Yt{static getPoint(e){return xn(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const i=[],s=[],a=e.length,h=new lt;for(let p=0;p<a;p++){const _=e.feature(p),g=_.properties.version,v=(u=g)?u==="1.0.1"?Ot:void 0:At;if(v===void 0){Gt(`Unknown elevation feature version number ${g||"(unknown)"}`);continue}const b=_.properties.hasOwnProperty("type")?_.properties.type:void 0;if(b){if(_e.types[_.type]==="Point"&&b==="curve_point"){const w={};v.parseVertex(h,_,w)&&i.push(w)}else if(_e.types[_.type]==="Polygon"&&b==="curve_meta"){const w={};v.parseFeature(h,_,w)&&s.push(w)}}}var u;return{vertices:i,features:s}}}class Et{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=Di(i,this.dir);if(Math.abs(a)<1e-6)return!1;const h=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return s[0]=this.pos[0]+this.dir[0]*h,s[1]=this.pos[1]+this.dir[1]*h,!0}}class Kt{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,s){const a=er(i,this.dir);if(Math.abs(a)<1e-6)return!1;const h=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return s[0]=this.pos[0]+this.dir[0]*h,s[1]=this.pos[1]+this.dir[1]*h,s[2]=this.pos[2]+this.dir[2]*h,!0}closestPointOnSphere(e,i,s){if((function(I,A){var P=I[0],R=I[1],O=I[2],U=A[0],V=A[1],G=A[2];return Math.abs(P-U)<=Gr*Math.max(1,Math.abs(P),Math.abs(U))&&Math.abs(R-V)<=Gr*Math.max(1,Math.abs(R),Math.abs(V))&&Math.abs(O-G)<=Gr*Math.max(1,Math.abs(O),Math.abs(G))})(this.pos,e)||i===0)return s[0]=s[1]=s[2]=0,!1;const[a,h,u]=this.dir,p=this.pos[0]-e[0],_=this.pos[1]-e[1],g=this.pos[2]-e[2],v=a*
vendor: 7,474 bytes, line 7
7a+h*h+u*u,b=2*(p*a+_*h+g*u),w=b*b-4*v*(p*p+_*_+g*g-i*i);if(w<0){const I=Math.max(-b/2,0),A=p+a*I,P=_+h*I,R=g+u*I,O=Math.hypot(A,P,R);return s[0]=A*i/O,s[1]=P*i/O,s[2]=R*i/O,!1}{const I=(-b-Math.sqrt(w))/(2*v);if(I<0){const A=Math.hypot(p,_,g);return s[0]=p*i/A,s[1]=_*i/A,s[2]=g*i/A,!1}return s[0]=p+a*I,s[1]=_+h*I,s[2]=g+u*I,!0}}}class ti{constructor(e,i,s,a,h){this.TL=e,this.TR=i,this.BR=s,this.BL=a,this.horizon=h}static fromInvProjectionMatrix(e,i,s){const a=[-1,1,1],h=[1,1,1],u=[1,-1,1],p=[-1,-1,1],_=tr(a,a,e),g=tr(h,h,e),v=tr(u,u,e),b=tr(p,p,e);return new ti(_,g,v,b,i/s)}}function vi(r,e,i){let s=1/0,a=-1/0;const h=[];for(const u of r){ir(h,u,e);const p=er(h,i);s=Math.min(s,p),a=Math.max(a,p)}return[s,a]}function Dt(r,e){let i=!0;for(let s=0;s<r.planes.length;s++){const a=r.planes[s];let h=0;for(let u=0;u<e.length;u++)h+=er(a,e[u])+a[3]>=0;if(h===0)return 0;h!==e.length&&(i=!1)}return i?2:1}function Jt(r,e){for(const i of r.projections){const s=vi(e,r.points[0],i.axis);if(i.projection[1]<s[0]||i.projection[0]>s[1])return 0}return 1}function Qt(r,e){let i=0;const s=[0,0,0,0];for(let u=0;u<r.length;u++)s[0]=r[u][0],s[1]=r[u][1],s[2]=r[u][2],s[3]=1,(a=s)[0]*(h=e)[0]+a[1]*h[1]+a[2]*h[2]+a[3]*h[3]>=0&&i++;var a,h;return i}class ni{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=kt.fromPoints(this.points),this.projections=[],this.frustumEdges=[ir([],this.points[2],this.points[3]),ir([],this.points[0],this.points[3]),ir([],this.points[4],this.points[0]),ir([],this.points[5],this.points[1]),ir([],this.points[6],this.points[2]),ir([],this.points[7],this.points[3])];for(const s of this.frustumEdges){const a=[0,-s[2],s[1]],h=[s[2],0,-s[0]];this.projections.push({axis:a,projection:vi(this.points,this.points[0],a)}),this.projections.push({axis:h,projection:vi(this.points,this.points[0],h)})}}static fromInvProjectionMatrix(e,i,s,a){const h=Math.pow(2,s),u=[[-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=hn([],g,e),b=1/v[3]/i*h;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})),p=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((g=>{const v=Ri([],cr([],ir([],u[g[0]],u[g[1]]),ir([],u[g[2]],u[g[1]]))),b=-er(v,u[g[1]]);return v.concat(b)})),_=[];for(let g=0;g<u.length;g++)_.push([u[g][0],u[g][1],u[g][2]]);return new ni(_,p)}intersectsPrecise(e,i,s){for(let a=0;a<i.length;a++)if(!Qt(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!Qt(e,this.planes[a]))return 0;for(const a of s)for(const h of this.frustumEdges){const u=cr([],a,h),p=Cr(u);if(p===0)continue;Fi(u,u,1/p);const _=vi(this.points,this.points[0],u),g=vi(e,this.points[0],u);if(_[0]>g[1]||g[0]>_[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const s=i[3];if(er([i[0],i[1],i[2]],e)+s<0)return!1}return!0}}class kt{static fromPoints(e){const i=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(const a of e)cs(i,i,a),Ln(s,s,a);return new kt(i,s)}static fromTileIdAndHeight(e,i,s){const a=1<<e.canonical.z,h=e.canonical.x,u=e.canonical.y;return new kt([h/a,u/a,i],[(h+1)/a,(u+1)/a,s])}static applyTransform(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)tr(s[a],s[a],i);return kt.fromPoints(s)}static applyTransformFast(e,i){const s=[i[12],i[13],i[14]],a=[...s];for(let h=0;h<3;h++)for(let u=0;u<3;u++){const p=i[4*u+h],_=p*e.min[u],g=p*e.max[u];s[h]+=Math.min(_,g),a[h]+=Math.max(_,g)}return new kt(s,a)}static projectAabbCorners(e,i){const s=e.getCorners();for(let a=0;a<s.length;++a)tr(s[a],s[a],i);return s}constructor(e,i){this.min=e,this.max=i,this.center=Fi([],ki([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=Bo(this.min),a=Bo(this.max);for(let h=0;h<i.length;h++)s[h]=i[h]?this.min[h]:this.center[h],a[h]=i[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new kt(s,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)?Dt(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Dt(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)?Jt(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?Jt(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])]}}rt(kt,"Aabb");class di{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,s=i[1],a=-i[0],h=(e.extent+1)*this.metersToTile;return[new ke(Math.trunc(e.position[0]+s*h),Math.trunc(e.position[1]+a*h)),new ke(Math.trunc(e.position[0]-s*h),Math.trunc(e.position[1]-a*h))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class ii{constructor(e,i,s,a,h,u){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:s,max:s},this.safeArea=i,this.constantHeight=s,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=h,this.edges=this.edges.filter((p=>{return p.a<this.vertices.length&&p.b<this.vertices.length&&!((_=this.vertices[p.a].position)[0]===(g=this.vertices[p.b].position)[0]&&_[1]===g[1]);var _,g})),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const p of this.vertices)this.vertexProps.push({dir:xn(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,p.height),this.heightRange.max=Math.max(this.heightRange.max,p.height);for(const p of this.edges){const _=this.vertices[p.a].position,g=this.vertices[p.b].position,v=ps(Or(),g,_),b=Os(v),w=Fs(Or(),v,1/b);this.edgeProps.push({vec:v,dir:w,len:b});const I=this.vertexProps[p.a].dir,A=this.vertexProps[p.b].dir;Ls(I,I,w),Ls(A,A,w)}for(const p of this.vertexProps)p.dir[0]===0&&p.dir[1]===0||jo(p.dir,p.dir);this.tessellate(u)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[s,a]=i;return pt(this.vertices[this.edges[s].a].height,this.vertices[this.edges[s].b].height,a)}computeSlopeNormal(e,i){const s=this.getClosestEdge(e);if(!s)return lr(0,0,1);const a=s[0],h=this.edges[a],u=this.edgeProps[a].vec,p=lr(u[0],u[1],(this.vertices[h.b].height-this.vertices[h.a].height)*i),_=lr(p[1],-p[0],0);cr(_,_,p);
7const g=Cr(_);return g>0?Fi(_,_,1/g):lr(0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,s=Number.POSITIVE_INFINITY,a=0;const h=xn(e.x,e.y);for(let u=0;u<this.edges.length;u++){const p=this.edges[u],_=this.edgeProps[u].dir,g=new Et(h,this.edgeProps[u].dir),v=this.vertices[p.a].position,b=this.vertices[p.b].position,w=Or(),I=Or(),A=g.intersectsPlane(v,this.vertexProps[p.a].dir,w),P=g.intersectsPlane(b,this.vertexProps[p.b].dir,I);if(!A||!P)continue;const R=ps(Or(),I,w),O=ps(Or(),h,w),U=Di(R,R),V=U>0?Di(O,R)/U:0,G=W(V,0,1),re=Math.abs((V-G)*this.edgeProps[u].len),Q=ps(Or(),h,v),te=re+Math.abs(Di(Q,xn(_[1],-_[0])));te<s&&(i=u,s=te,a=G)}return[i,a]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){const s=this.edges[i].a,a=this.edges[i].b,{position:h,height:u,extent:p}=this.vertices[s],{position:_,height:g,extent:v}=this.vertices[a],b=this.vertexProps[s].dir,w=this.vertexProps[a].dir,I=lr(h[0]/e,h[1]/e,u),A=lr(_[0]/e,_[1]/e,g),P=lr(b[1],-b[0],0);Fi(P,P,p);const R=lr(w[1],-w[0],0);if(Fi(R,R,v),this.distSqLines(lr(I[0]+.5*P[0],I[1]+.5*P[1],I[2]+.5*P[2]),lr(A[0]-.5*R[0],A[1]-.5*R[1],A[2]-.5*R[2]),lr(I[0]-.5*P[0],I[1]-.5*P[1],I[2]-.5*P[2]),lr(A[0]+.5*R[0],A[1]+.5*R[1],A[2]+.5*R[2]))<=.0025000000000000005)continue;const O=this.vertices.length,U=Ls(Or(),h,_);this.vertices.push({position:Fs(U,U,.5),height:.5*(u+g),extent:.5*(p+v)});const V=Ls(Or(),b,w);this.vertexProps.push({dir:jo(V,V)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:s,b:O}),this.edges.push({a:O,b:a});const G=ps(Or(),this.vertices[O].position,h),re=Os(G),Q={vec:G,dir:Fs(Or(),G,1/re),len:re};this.edgeProps.push(Q),this.edgeProps.push(Q)}}distSqLines(e,i,s,a){const h=cn(ui(),i,e),u=cn(ui(),a,s),p=cn(ui(),e,s),_=er(h,h),g=er(h,u),v=er(h,p),b=er(u,u),w=er(u,p),I=_*b-g*g;if(I===0){const R=er(p,u)/er(u,u);return No(Qr(ui(),s,a,R),e)}const A=(g*w-v*b)/I,P=(_*w-g*v)/I;return No(Qr(ui(),e,i,A),Qr(ui(),s,a,P))}}class Vi{static parseFrom(e,i){const s=Yt.parse(e);if(!s)return[];let{vertices:a,features:h}=s;const u=1/K(i);h.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 p=new Array;let _=0;const g=a.length;for(const v of h){if(v.constantHeight){p.push(new ii(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 P=_-I;w.push({a:P-1,b:P})}_++}p.push(new ii(v.id,v.bounds,void 0,b,w,u))}return p}static getElevationFeature(e,i){if(!i)return;const s=+e.properties[Qe];return Number.isNaN(s)?void 0:i.find((a=>a.id===s))}}class Wt{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)*We,this.yOffset=(e.y*this.zScale-i.y)*We)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,s){const a=this.constantElevation(i,s);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),s))}computeBiasedHeight(e,i){return i<=0?e:e+i*le(0,i,e>=0?e:Math.abs(.5*e))}}rt(ii,"ElevationFeature");class si{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 ln,this.indexArray=new Li,this.segments=new Ni,this.programConfigurations=new An(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 zo),this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){const h=this.layers[0],u=[];let p=null;
vendor: 19,828 bytes, line 7
7h.type==="circle"&&(p=h.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=we(g,I);if(!this.layers[0]._featureFilter.filter(new pi(this.zoom,{worldview:this.worldview}),A,s))continue;const P=p?p.evaluate(A,{},s):void 0,R={id:v,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:I?A.geometry:se(g,s,a),patterns:{},sortKey:P};u.push(R)}p&&u.sort(((g,v)=>g.sortKey-v.sortKey));let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new Bc,_=a.projection);for(const g of u){const{geometry:v,index:b,sourceLayerIndex:w}=g,I=e[b].feature;this.addFeature(g,v,b,i.availableImages,s,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(I,v,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,s,a,h,u,p){this.programConfigurations.updatePaintArrays(e,i,h,s,a,u,p,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,uf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Np.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Bp.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,s,a,h,u,p,_){let g;this.elevationMode!=="none"&&(g=Vi.getElevationFeature(e,_));for(const v of i)for(const b of v){const w=b.x,I=b.y;if(w<0||w>=We||I<0||I>=We)continue;if(u){const R=u.projectTilePoint(w,I,h),O=u.upVector(h,w,I);this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O)}const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),P=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 R=g?g.pointElevation(new ke(w,I)):0;this.hasElevation=this.hasElevation||R!==0;for(let O=0;O<4;O++)this.elevatedLayoutVertexArray.emplaceBack(R)}this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+2,P+3),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},a,h,p,void 0,this.worldview)}addCircleVertex(e,i,s,a){this.layoutVertexArray.emplaceBack(2*e+(s+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 yi(r,e){for(let i=0;i<r.length;i++)if(zr(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(zr(r,e[i]))return!0;return!!Sr(r,e)}function or(r,e,i){return!!zr(r,e)||!!Pr(e,r,i)}function rr(r,e){if(r.length===1)return Gn(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let a=0;a<s.length;a++)if(zr(r,s[a]))return!0}for(let i=0;i<r.length;i++)if(Gn(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Sr(r,e[i]))return!0;return!1}function ar(r,e,i){if(r.length>1){if(Sr(r,e))return!0;for(let s=0;s<e.length;s++)if(Pr(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(Pr(r[s],e,i))return!0;return!1}function Sr(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],a=r[i+1];for(let h=0;h<e.length-1;h++)if(Xn(s,a,e[h],e[h+1]))return!0}return!1}function Xn(r,e,i,s){return Ki(r,i,s)!==Ki(e,i,s)&&Ki(r,e,i)!==Ki(r,e,s)}function Yr(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function pn(r,e,i,s){const a=Yr(r,e,s),h=Yr(r,e,i);if(Math.sign(a)===Math.sign(h))return;const u=Yr(i,s,r),p=u+h-a;return Math.sign(u)!==Math.sign(p)?[u/(u-p),h/(h-a)]:void 0}function Pr(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let a=1;a<e.length;a++)if(Mn(r,e[a-1],e[a])<s)return!0;return!1}function Mn(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function Gn(r,e){let i,s,a,h=!1;for(let u=0;u<r.length;u++){i=r[u];for(let p=0,_=i.length-1;p<i.length;_=p++)s=i[p],a=i[_],s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(h=!h)}return h}function zr(r,e){let i=!1;for(let s=0,a=r.length-1;s<r.length;a=s++){const h=r[s],u=r[a];h.y>e.y!=u.y>e.y&&e.x<(u.x-h.x)*(e.y-h.y)/(u.y-h.y)+h.x&&(i=!i)}return i}function Ji(r,e,i,s,a){for(const u of r)if(e<=u.x&&i<=u.y&&s>=u.x&&a>=u.y)return!0;const h=[new ke(e,i),new ke(e,a),new ke(s,a),new ke(s,i)];if(r.length>2){for(const u of h)if(zr(r,u))return!0}for(let u=0;u<r.length-1;u++)if(Zi(r[u],r[u+1],h))return!0;return!1}function Zi(r,e,i){const s=i[0],a=i[2];if(r.x<s.x&&e.x<s.x||r.x>a.x&&e.x>a.x||r.y<s.y&&e.y<s.y||r.y>a.y&&e.y>a.y)return!1;const h=Ki(r,e,i[0]);return h!==Ki(r,e,i[1])||h!==Ki(r,e,i[2])||h!==Ki(r,e,i[3])}function wi(r,e,i,s,a,h){let u=e.y-r.y,p=r.x-e.x;if(h=h||0){const _=u*u+p*p;if(_===0)return!0;const g=Math.sqrt(_);u/=g,p/=g}return!((i.x-r.x)*u+(i.y-r.y)*p-h<0||(s.x-r.x)*u+(s.y-r.y)*p-h<0||(a.x-r.x)*u+(a.y-r.y)*p-h<0)}function pr(r,e,i,s,a,h,u){return!(wi(r,e,s,a,h,u)||wi(e,i,s,a,h,u)||wi(i,r,s,a,h,u)||wi(s,a,r,e,i,u)||wi(a,h,r,e,i,u)||wi(h,s,r,e,i,u))}function Er(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function Qi(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Cn(r,e,i,s,a){if(!e[0]&&!e[1])return r;const h=ke.convert(e)._mult(a);i==="viewport"&&h._rotate(-s);const u=[];for(let p=0;p<r.length;p++)u.push(r[p].sub(h));return u}function Do(r,e,i,s){const a=ke.convert(r)._mult(s);return e==="viewport"&&a._rotate(-i),a}let ro,Ea;function Ia(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}rt(si,"CircleBucket",{omit:["layers"]});class Pn{constructor(e,i,s){this.z=e,this.x=i,this.y=s,this.key=zn(0,e,e,i,s)}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 s=(function(h,u,p){var _=Ia(256*h,256*(u=Math.pow(2,p)-u-1),p),g=Ia(256*(h+1),256*(u+1),p);return _[0]+","+_[1]+","+g[0]+","+g[1]})(this.x,this.y,this.z),a=(function(h,u,p){let _,g="";for(let v=h;v>0;v--)_=1<<v-1,g+=(u&_?1:0)+(p&_?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}",s)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ns{constructor(e,i){this.wrap=e,this.canonical=i,this.key=zn(e,i.z,i.z,i.x,i.y)}}class mr{constructor(e,i,s,a,h){this.overscaledZ=e,this.wrap=i,this.canonical=new Pn(s,+a,+h),this.key=i===0&&e===s?this.canonical.key:zn(i,e,s,a,h)}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 mr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new mr(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 zn(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const s=this.canonical.z-e;return zn(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}}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 mr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,a=2*this.canonical.y;return[new mr(i,this.wrap,i,s,a),new mr(i,this.wrap,i,s+1,a),new mr(i,this.wrap,i,s,a+1),new mr(i,this.wrap,i,s+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 mr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new mr(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 ns(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function zn(r,e,i,s,a){const h=1<<Math.min(i,22);let u=h*(a%h)+s%h;return r&&i<22&&(u+=h*h*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*u+i)+(e-i)}const Lo=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new mr(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 mr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new mr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new mr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];rt(Pn,"CanonicalTileID"),rt(mr,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const tv=$t([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:gf}=tv,iv=$t([{name:"a_pos_3",components:3,type:"Int16"}]);var l_=$t([{name:"a_pos",type:"Int16",components:2}]);function yf(r){return r*Ur/x}const rv=[new kt([d,d,d],[f,f,f]),new kt([d,d,d],[0,0,f]),new kt([0,d,d],[f,0,f]),new kt([d,0,d],[0,f,f]),new kt([0,0,d],[f,f,f])];function c_(r,e,i,s=!0){const a=Fi([],r._camera.position,r.worldSize),h=[e,i,1,1];hn(h,h,r.pixelMatrixInverse),hs(h,h,1/h[3]);const u=Ri([],ir([],h,a)),p=r.globeMatrix,_=[p[12],p[13],p[14]],g=ir([],_,a),v=Cr(g),b=Ri([],g),w=r.worldSize/(2*Math.PI),I=er(b,u),A=Math.asin(w/v);if(A<Math.acos(I)){if(!s)return null;const Ee=[],de=[];Fi(Ee,u,v/I),Ri(de,ir(de,Ee,g)),Ri(u,ki(u,g,Fi(u,de,Math.tan(A)*v)))}const P=[];new Kt(a,u).closestPointOnSphere(_,w,P);const R=Ri([],qi(p,0)),O=Ri([],qi(p,1)),U=Ri([],qi(p,2)),V=er(R,P),G=er(O,P),re=er(U,P),Q=ge(Math.asin(-G/w));let te=ge(Math.atan2(V,re));te=r.center.lng+(function(Ee,de){const Ae=(de-Ee+180)%360-180;return Ae<-180?Ae+360:Ae})(r.center.lng,te);const ae=z(te),ce=W(F(Q),0,1);return new J(ae,ce)}class nv{constructor(e,i,s){this.a=ir([],e,s),this.b=ir([],i,s),this.center=s;const a=Ri([],this.a),h=Ri([],this.b);this.angle=Math.acos(er(a,h))}}function Zp(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(s,a,h,u){const p=Math.sin(h);return s*(Math.sin((1-u)*h)/p)+a*(Math.sin(u*h)/p)})(r.a[e],r.b[e],r.angle,W(i,0,1))+r.center[e]}function no(r){if(r.z<=1)return rv[r.z+2*r.y+r.x];const e=Wp(xf(r));return kt.fromPoints(e)}function Fo(r,e,i){return Fi(r,r,1-i),Hr(r,r,e,i)}function h_(r,e,i){for(const s of r)tr(s,s,e),Fi(s,s,i)}function u_(r,e,i,s){const a=e/r.worldSize,h=r.globeMatrix;if(i.z<=1){const ce=no(i).getCorners();return h_(ce,h,a),kt.fromPoints(ce)}const u=xf(i,s),p=Wp(u,Ur+yf(r._tileCoverLift));h_(p,h,a);const _=Number.MAX_VALUE,g=[-_,-_,-_],v=[_,_,_];if(u.contains(r.center)){for(const de of p)cs(v,v,de),Ln(g,g,de);g[2]=0;const ce=r.point,Ee=[ce.x*a,ce.y*a,0];return cs(v,v,Ee),Ln(g,g,Ee),new kt(v,g)}if(r._tileCoverLift>0){for(const ce of p)cs(v,v,ce),Ln(g,g,ce);return new kt(v,g)}const b=[h[12]*a,h[13]*a,h[14]*a],w=u.getCenter(),I=W(r.center.lat,-X,X),A=W(w.lat,-X,X),P=z(r.center.lng),R=F(I);let O=P-z(w.lng);const U=R-F(A);O>.5?O-=1:O<-.5&&(O+=1);let V=0;Math.abs(O)>Math.abs(U)?V=O>=0?1:3:(V=U>=0?0:2,Hr(b,b,[h[4]*a,h[5]*a,h[6]*a],-Math.sin(ei(U>=0?u.getSouth():u.getNorth()))*Ur));const G=p[V],re=p[(V+1)%4],Q=new nv(G,re,b),te=[Zp(Q,0)||G[0],Zp(Q,1)||G[1],Zp(Q,2)||G[2]],ae=Aa(r.zoom);if(ae>0){const ce=(function({x:de,y:Ae,z:je},Ce,Fe,Ve,Te){const Oe=1/(1<<je);let fe=de*Oe,Se=fe+Oe,He=Ae*Oe,Be=He+Oe,ct=0;const nt=(fe+Se)/2-Ve;return nt>.5?ct=-1:nt<-.5&&(ct=1),fe=((fe+ct)*Ce-(Ve*=Ce))*Fe+Ve,Se=((Se+ct)*Ce-Ve)*Fe+Ve,He=(He*Ce-(Te*=Ce))*Fe+Te,Be=(Be*Ce-Te)*Fe+Te,[[fe,Be,0],[Se,Be,0],[Se,He,0],[fe,He,0]]})(i,e,r._pixelsPerMercatorPixel,P,R);for(let de=0;de<p.length;de++)Fo(p[de],ce[de],ae);const Ee=ki([],ce[V],ce[(V+1)%4]);Fi(Ee,Ee,.5),Fo(te,Ee,ae)}for(const ce of p)cs(v,v,ce),Ln(g,g,ce);return v[2]=Math.min(G[2],re[2]),cs(v,v,te),Ln(g,g,te),new kt(v,g)}function xf({x:r,y:e,z:i},s=!1){const a=1/(1<<i),h=new S(N(r*a),e===(1<<i)-1&&s?-90:j((e+1)*a)),u=new S(N((r+1)*a),e===0&&s?90:j(e*a));return new M(h,u)}function Wp(r,e=Ur){const i=ei(r.getNorth()),s=ei(r.getSouth()),a=Math.cos(i),h=Math.cos(s),u=Math.sin(i),p=Math.sin(s),_=r.getWest(),g=r.getEast();return[m(h,p,_,e),m(h,p,g,e),m(a,u,g,e),m(a,u,_,e)]}function Au(r,e,i,s){const a=1<<i.z,h=(r/We+i.x)/a;return y(j((e/We+i.y)/a),N(h),s)}function vf({min:r,max:e}){return t/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const d_=new Float64Array(16);function bf(r){const e=vf(r),i=ko(d_,[e,e,e]);return qr(i,i,Ps([],r.min))}function Xp(r){const e=(s=r.min,(i=d_)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=s[0],i[13]=s[1],i[14]=s[2],i[15]=1,i);var i,s;const a=1/vf(r);return Fr(e,e,[a,a,a])}function Yp(r){const e=We/(2*Math.PI);return r/(2*Math.PI)/e}function f_(r,e){return We/(512*Math.pow(2,r))*vf(no(e))}function p_(r,e,i,s,a){const h=Yp(i),u=[r,e,-i/(2*Math.PI)],p=Bt(new Float64Array(16));return qr(p,p,u),Fr(p,p,[h,h,h]),As(p,p,ei(-a)),ls(p,p,ei(-s)),p}function Aa(r){return le(_f,l,r)}function m_(r,e){const i=y(e.lat,e.lng),s=(function(A){const P=y(A._center.lat,A._center.lng);let R=cr([],lr(0,1,0),P);const O=qn([],-A.angle,P);R=tr(R,R,O),qn(O,-A._pitch,R);const U=Ri([],P);return Fi(U,U,yf(A.cameraToCenterDistance/A.pixelsPerMeter)),tr(U,U,O),ki([],P,U)})(r);return u=(a=cn([],s,i))[0],p=a[1],_=a[2],g=(h=i)[0],v=h[1],b=h[2],I=(w=Math.sqrt(u*u+p*p+_*_)*Math.sqrt(g*g+v*v+b*b))&&er(a,h)/w,Math.acos(Math.min(Math.max(I,-1),1));var a,h,u,p,_,g,v,b,w,I}function Kp(r,e){return m_(r,e)>Math.PI/2*1.01}const __=ei(85),sv=Math.cos(__),ov=Math.sin(__),av=uo(),g_=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 y_(r,e,i,s,a,h,u,p,_){if(h&&r.queryGeometry.isAboveHorizon)return!1;h&&(_*=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(p),A=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(I.x,I.y,!0):0,P=i.projection.projectTilePoint(I.x,I.y,g);if(A>0){const V=i.projection.upVector(g,I.x,I.y);P.x+=V[0]*v*A,P.y+=V[1]*v*A,P.z+=V[2]*v*A}const R=h?I:lv(P.x,P.y,P.z,s),O=h?r.tilespaceRays.map((V=>hv(V,A))):r.queryGeometry.screenGeometry,U=hn([],[P.x,P.y,P.z,1],s);if(!u&&h?_*=U[3]/i.cameraToCenterDistance:u&&!h&&(_*=i.cameraToCenterDistance/U[3]),h){const V=j((w.y/We+g.y)/(1<<g.z));_/=i.projection.pixelsPerMeter(V,1)/L(1,V)}if(or(O,R,_))return!0}return!1}function lv(r,e,i,s){const a=hn([],[r,e,i,1],s);return new ke(a[0]/a[3],a[1]/a[3])}const x_=lr(0,0,0),cv=lr(0,0,1);function hv(r,e){const i=ui();return x_[2]=e,r.intersectsPlane(x_,cv,i),new ke(i[0],i[1])}class v_ extends si{}let b_,w_,T_,S_;function E_(r,{width:e,height:i},s,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*s)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=a,r}function I_(r,e,i){const{width:s,height:a}=e;s===r.width&&a===r.height||(Jp(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,s),height:Math.min(r.height,a)},i,null),r.width=s,r.height=a,r.data=e.data)}function Jp(r,e,i,s,a,h,u,p){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||s.x>e.width-a.width||s.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,g=e.data,v=h===4&&p;for(let b=0;b<a.height;b++){const w=((i.y+b)*r.width+i.x)*h,I=((s.y+b)*e.width+s.x)*h;if(v)for(let A=0;A<a.width;A++){const P=w+A*h+3,R=I+A*h;g[R+0]=255,g[R+1]=255,g[R+2]=255,g[R+3]=_[P]}else if(u)for(let A=0;A<a.width;A++){const P=w+A*h,R=I+A*h,O=new li(_[P+0]/255,_[P+1]/255,_[P+2]/255,_[P+3]).toNonPremultipliedRenderColor(u).toArray();g[R+0]=O[0],g[R+1]=O[1],g[R+2]=O[2],g[R+3]=O[3]}else for(let A=0;A<a.width*h;A++)g[I+A]=_[w+A]}return e}rt(v_,"HeatmapBucket",{omit:["layers"]});class Ma{constructor(e,i){E_(this,e,1,i)}resize(e){I_(this,new Ma(e),1)}clone(){return new Ma({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,h){Jp(e,i,s,a,h,1,null)}}class Rr{constructor(e,i){E_(this,e,4,i)}resize(e){I_(this,new Rr(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Rr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,a,h,u,p){Jp(e,i,s,a,h,4,u,p)}}class A_{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Mu(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,a=r.image||new Rr({width:i,height:s}),h=(u,p,_)=>{e[r.evaluationKey]=_;const g=r.expression.evaluate(e),v=g?g.toNonPremultipliedRenderColor(null):null;v&&(a.data[u+p+0]=Math.floor(255*v.r),a.data[u+p+1]=Math.floor(255*v.g),a.data[u+p+2]=Math.floor(255*v.b),a.data[u+p+3]=Math.floor(255*v.a))};if(r.clips)for(let u=0,p=0;u<s;++u,p+=4*i)for(let _=0,g=0;_<i;_++,g+=4){const v=_/(i-1),{start:b,end:w}=r.clips[u];h(p,g,b*(1-v)+w*v)}else for(let u=0,p=0;u<i;u++,p+=4)h(0,p,u/(i-1));return a}rt(Ma,"AlphaImage"),rt(Rr,"RGBAImage");const uv=$t([{name:"a_pos",components:2,type:"Int16"}],4),dv=$t([{name:"a_road_z_offset",components:1,type:"Float32"}],4),fv=$t([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),pv=$t([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Zc(r,e,i=2){const s=e&&e.length,a=s?e[0]*i:r.length;let h=M_(r,0,a,i,!0);const u=[];if(!h||h.next===h.prev)return u;let p,_,g;if(s&&(h=(function(v,b,w,I){const A=[];for(let P=0,R=b.length;P<R;P++){const O=M_(v,b[P]*I,P<R-1?b[P+1]*I:v.length,I,!1);O===O.next&&(O.steiner=!0),A.push(wv(O))}A.sort(xv);for(let P=0;P<A.length;P++)w=vv(A[P],w);return w})(r,e,h,i)),r.length>80*i){p=r[0],_=r[1];let v=p,b=_;for(let w=i;w<a;w+=i){const I=r[w],A=r[w+1];I<p&&(p=I),A<_&&(_=A),I>v&&(v=I),A>b&&(b=A)}g=Math.max(v-p,b-_),g=g!==0?32767/g:0}return Cu(h,u,i,p,_,g,0),u}function M_(r,e,i,s,a){let h;if(a===(function(u,p,_,g){let v=0;for(let b=p,w=_-g;b<_;b+=g)v+=(u[w]-u[b])*(u[b+1]+u[w+1]),w=b;return v})(r,e,i,s)>0)for(let u=e;u<i;u+=s)h=R_(u/s|0,r[u],r[u+1],h);else for(let u=i-s;u>=e;u-=s)h=R_(u/s|0,r[u],r[u+1],h);return h&&Wc(h,h.next)&&(Ru(h),h=h.next),h}function Ll(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!Wc(s,s.next)&&br(s.prev,s,s.next)!==0)s=s.next;else{if(Ru(s),s=e=s.prev,s===s.next)break;
vendor: 4,375 bytes, line 7
7i=!0}while(i||s!==e);return e}function Cu(r,e,i,s,a,h,u){if(!r)return;!u&&h&&(function(_,g,v,b){let w=_;do w.z===0&&(w.z=Qp(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,P=1;do{let R,O=I;I=null;let U=null;for(A=0;O;){A++;let V=O,G=0;for(let Q=0;Q<P&&(G++,V=V.nextZ,V);Q++);let re=P;for(;G>0||re>0&&V;)G!==0&&(re===0||!V||O.z<=V.z)?(R=O,O=O.nextZ,G--):(R=V,V=V.nextZ,re--),U?U.nextZ=R:I=R,R.prevZ=U,U=R;O=V}U.nextZ=null,P*=2}while(A>1)})(w)})(r,s,a,h);let p=r;for(;r.prev!==r.next;){const _=r.prev,g=r.next;if(h?_v(r,s,a,h):mv(r))e.push(_.i,r.i,g.i),Ru(r),r=g.next,p=g.next;else if((r=g)===p){u?u===1?Cu(r=gv(Ll(r),e),e,i,s,a,h,2):u===2&&yv(r,e,i,s,a,h):Cu(Ll(r),e,i,s,a,h,1);break}}}function mv(r){const e=r.prev,i=r,s=r.next;if(br(e,i,s)>=0)return!1;const a=e.x,h=i.x,u=s.x,p=e.y,_=i.y,g=s.y,v=Math.min(a,h,u),b=Math.min(p,_,g),w=Math.max(a,h,u),I=Math.max(p,_,g);let A=s.next;for(;A!==e;){if(A.x>=v&&A.x<=w&&A.y>=b&&A.y<=I&&Pu(a,p,h,_,u,g,A.x,A.y)&&br(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function _v(r,e,i,s){const a=r.prev,h=r,u=r.next;if(br(a,h,u)>=0)return!1;const p=a.x,_=h.x,g=u.x,v=a.y,b=h.y,w=u.y,I=Math.min(p,_,g),A=Math.min(v,b,w),P=Math.max(p,_,g),R=Math.max(v,b,w),O=Qp(I,A,e,i,s),U=Qp(P,R,e,i,s);let V=r.prevZ,G=r.nextZ;for(;V&&V.z>=O&&G&&G.z<=U;){if(V.x>=I&&V.x<=P&&V.y>=A&&V.y<=R&&V!==a&&V!==u&&Pu(p,v,_,b,g,w,V.x,V.y)&&br(V.prev,V,V.next)>=0||(V=V.prevZ,G.x>=I&&G.x<=P&&G.y>=A&&G.y<=R&&G!==a&&G!==u&&Pu(p,v,_,b,g,w,G.x,G.y)&&br(G.prev,G,G.next)>=0))return!1;G=G.nextZ}for(;V&&V.z>=O;){if(V.x>=I&&V.x<=P&&V.y>=A&&V.y<=R&&V!==a&&V!==u&&Pu(p,v,_,b,g,w,V.x,V.y)&&br(V.prev,V,V.next)>=0)return!1;V=V.prevZ}for(;G&&G.z<=U;){if(G.x>=I&&G.x<=P&&G.y>=A&&G.y<=R&&G!==a&&G!==u&&Pu(p,v,_,b,g,w,G.x,G.y)&&br(G.prev,G,G.next)>=0)return!1;G=G.nextZ}return!0}function gv(r,e){let i=r;do{const s=i.prev,a=i.next.next;!Wc(s,a)&&P_(s,i,i.next,a)&&zu(s,a)&&zu(a,s)&&(e.push(s.i,i.i,a.i),Ru(i),Ru(i.next),i=r=a),i=i.next}while(i!==r);return Ll(i)}function yv(r,e,i,s,a,h){let u=r;do{let p=u.next.next;for(;p!==u.prev;){if(u.i!==p.i&&Tv(u,p)){let _=z_(u,p);return u=Ll(u,u.next),_=Ll(_,_.next),Cu(u,e,i,s,a,h,0),void Cu(_,e,i,s,a,h,0)}p=p.next}u=u.next}while(u!==r)}function xv(r,e){let i=r.x-e.x;return 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 vv(r,e){const i=(function(a,h){let u=h;const p=a.x,_=a.y;let g,v=-1/0;if(Wc(a,u))return u;do{if(Wc(a,u.next))return u.next;if(_<=u.y&&_>=u.next.y&&u.next.y!==u.y){const P=u.x+(_-u.y)*(u.next.x-u.x)/(u.next.y-u.y);if(P<=p&&P>v&&(v=P,g=u.x<u.next.x?u:u.next,P===p))return g}u=u.next}while(u!==h);if(!g)return null;const b=g,w=g.x,I=g.y;let A=1/0;u=g;do{if(p>=u.x&&u.x>=w&&p!==u.x&&C_(_<I?p:v,_,w,I,_<I?v:p,_,u.x,u.y)){const P=Math.abs(_-u.y)/(p-u.x);zu(u,a)&&(P<A||P===A&&(u.x>g.x||u.x===g.x&&bv(g,u)))&&(g=u,A=P)}u=u.next}while(u!==b);return g})(r,e);if(!i)return e;const s=z_(i,r);return Ll(s,s.next),Ll(i,i.next)}function bv(r,e){return br(r.prev,r,e.prev)<0&&br(e.next,r,r.next)<0}function Qp(r,e,i,s,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-s)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function wv(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 C_(r,e,i,s,a,h,u,p){return(a-u)*(e-p)>=(r-u)*(h-p)&&(r-u)*(s-p)>=(i-u)*(e-p)&&(i-u)*(h-p)>=(a-u)*(s-p)}function Pu(r,e,i,s,a,h,u,p){return!(r===u&&e===p)&&C_(r,e,i,s,a,h,u,p)}function Tv(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,s){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==s.i&&a.next.i!==s.i&&P_(a,a.next,i,s))return!0;a=a.next}while(a!==i);return!1})(r,e)&&(zu(r,e)&&zu(e,r)&&(function(i,s){let a=i,h=!1;const u=(i.x+s.x)/2,p=(i.y+s.y)/2;do a.y>p!=a.next.y>p&&a.next.y!==a.y&&u<(a.next.x-a.x)*(p-a.y)/(a.next.y-a.y)+a.x&&(h=!h),a=a.next;while(a!==i);return h})(r,e)&&(br(r.prev,r,e.prev)||br(r,e.prev,e))||Wc(r,e)&&br(r.prev,r,r.next)>0&&br(e.prev,e,e.next)>0)}function br(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Wc(r,e){return r.x===e.x&&r.y===e.y}function P_(r,e,i,s){const a=Tf(br(r,e,i)),h=Tf(br(r,e,s)),u=Tf(br(i,s,r)),p=Tf(br(i,s,e));return a!==h&&u!==p||!(a!==0||!wf(r,i,e))||!(h!==0||!wf(r,s,e))||!(u!==0||!wf(i,r,s))||!(
7p!==0||!wf(i,e,s))}function wf(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 Tf(r){return r>0?1:r<0?-1:0}function zu(r,e){return br(r.prev,r,r.next)<0?br(r,e,r.next)>=0&&br(r,r.prev,e)>=0:br(r,e,r.prev)<0||br(r,r.next,e)<0}function z_(r,e){const i=em(r.i,r.x,r.y),s=em(e.i,e.x,e.y),a=r.next,h=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,s.next=i,i.prev=s,h.next=s,s.prev=h,s}function R_(r,e,i,s){const a=em(r,e,i);return s?(a.next=s.next,a.prev=s,s.next.prev=a,s.next=a):(a.prev=a,a.next=a),a}function Ru(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 em(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Du(r,e){const i=r.length;if(i<=1)return[r];const s=[];let a,h;for(let u=0;u<i;u++){const p=yr(r[u]);p!==0&&(r[u].area=Math.abs(p),h===void 0&&(h=p<0),h===p<0?(a&&s.push(a),a=[r[u]]):a.push(r[u]))}if(a&&s.push(a),e>1)for(let u=0;u<s.length;u++)s[u].length<=e||(Nr(s[u],e,1,s[u].length-1,Sv),s[u]=s[u].slice(0,e));return s}function Sv(r,e){return e.area-r.area}function D_(r,e,i=1){if(!r)return null;const s=typeof r=="string"?sn.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const h of[s,a]){if(!h)continue;const u=h.id.toString();e.has(u)||e.set(u,[]),h.scaleSelf(i),e.get(u).push(h)}return{primary:s.toString(),secondary:a?a.toString():null}}function tm(r,e,i,s){const a=s.patternDependencies;let h=!1;for(const u of e){const p=u.paint.get(`${r}-pattern`);p.isConstant()||(h=!0),D_(p.constantOr(null),a,i)&&(h=!0)}return h}function im(r,e,i,s,a,h){const u=h.patternDependencies;for(const p of e){const _=p.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let g=_.evaluate({zoom:s},i,{},h.availableImages);g=g&&g.name?g.name:g;const v=D_(g,u,a);if(!v)continue;const{primary:b,secondary:w}=v;b&&(i.patterns[p.id]=[b,w].filter(Boolean))}}return i}class L_{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(const[i,s]of e.polygons)this.add(i,...s)}}class Fl{constructor(){this.portals=[]}static evaluate(e){if(e.length===0)return new Fl;let i=[];for(const g of e)i.push(...g.portals);if(i.length===0)return new Fl;const s=(g,v)=>g<=0&&v<=0||g>=We&&v>=We;for(const g of i){const v=g.va,b=g.vb;(s(v.x,b.x)||s(v.y,b.y))&&(g.type="border")}const a=i.filter((g=>g.type!=="unevaluated")),h=i.filter((g=>g.type==="unevaluated"));if(h.length===0)return new Fl;h.sort(((g,v)=>g.hash===v.hash?g.isTunnel===v.isTunnel?0:g.isTunnel?-1:1:g.hash<v.hash?1:-1)),i=a.concat(h);let u=a.length,p=u,_=u;do if(p++,p===i.length||i[u].hash!==i[p].hash){if(p-u==2){_<u&&(i[_]=i[u],i[u]=null);const g=i[_],v=i[p-1];g.type=g.isTunnel!==v.isTunnel?"tunnel":"polygon",g.connection={a:g.connection.a,b:v.connection.a},_++}u=p}while(u!==i.length);return i.splice(_),i.sort(((g,v)=>g.hash<v.hash?1:-1)),{portals:i}}}rt(Fl,"ElevationPortalGraph"),rt(L_,"ElevationPolygons");class Ev{constructor(e,i,s){this.outPositions=e,this.outNormals=i,this.outIndices=s,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,s){let a=e[2];s!=null&&(a*=s);const h=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),u=this.vertexLookup.get(h);if(u!=null)return u;const p=this.outPositions.length;this.vertexLookup.set(h,p);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),p}addTriangle(e,i,s){this.outIndices.emplaceBack(e,i,s)}addTriangles(e,i,s){if(e.length===0)return;const a=s.length===1,h=ui(),u=ui();for(let p=0;p<e.length;p+=3){const _=i[e[p+0]],g=i[e[p+1]],v=i[e[p+2]],b=a?s[0]:s[e[p+1]],w=a?s[0]:s[e[p+2]];nr(h,_.x,_.y,a?s[0]:s[e[p+0]]);const I=this.addVertex(h,u);nr(h,g.x,g.y,b);const A=this.addVertex(h,u);nr(h,v.x,v.y,w);const P=this.addVertex(h,u);this.outIndices.emplaceBack(I,A,P)}}addQuad(e,i,s,a,h,u){const p=this.addVertex(e,h,u),_=this.addVertex(i,h,u),g=this.addVertex(s,h,u),v=this.addVertex(a,h,u);this.addTriangle(p,_,g),this.addTriangle(g,v,p)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class Rn{constructor(e,i,s,a){this.unevaluatedPortals=new Fl,this.portalPolygons=new L_,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new lu,this.vertexNormals=new cu,this.indexArray=new Li,this.tileToMeters=K(e),this.bridgeProgramConfigurations=new An(i,{zoom:s,lut:a},(h=>h!=="fill-tunnel-structure-color")),this.tunnelProgramConfigurations=new An(i,{zoom:s,lut:a},(h=>h!=="fill-bridge-guard-rail-color"))}addVertices(e,i){const s=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return s}addTriangles(e,i,s){const a=s?this.unevalTunnelTriangles:this.unevalTriangles;for(const h of e)a.push(h+i)}addRenderableRing(e,i,s,a,h,u){const p=[new ke(h.min.x,h.min.y),new ke(h.max.x,h.min.y),new ke(h.max.x,h.max.y),new ke(h.min.x,h.max.y)];for(let _=0;_<s-1;_++){const g=i+_,v=g+1,b=this.unevalVertices[g],w=this.unevalVertices[v];if(!(b.x>=h.min.x&&b.x<=h.max.x&&b.y>=h.min.y&&b.y<=h.max.y||w.x>=h.min.x&&w.x<=h.max.x&&w.y>=h.min.y&&w.y<=h.max.y||Zi(b,w,p))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const I=Rn.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let A,P=this.vertexHashLookup.get(Rn.computePosHash(b));P!=null?A=P.next:(P=this.vertexHashLookup.get(Rn.computePosHash(w)),A=P!=null?P.prev:I),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:I,portalHash:A,isTunnel:a,type:"unevaluated",featureInfo:u})}}
vendor: 10,584 bytes, line 7
7addPortalCandidates(e,i,s,a,h){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:h});const u=i[0];this.vertexHashLookup.clear();let p=Rn.computeEdgeHash(u[u.length-2],u[u.length-1]);for(let _=0;_<u.length-1;_++){const g=u[_+0],v=u[_+1],b=xn(v.x-g.x,v.y-g.y),w=Os(b);if(w===0)continue;let I="unevaluated";const A=a.pointElevation(g),P=a.pointElevation(v);Math.abs(A)<.01&&Math.abs(P)<.01?I="entrance":(this.isOnBorder(g.x,v.x)||this.isOnBorder(g.y,v.y))&&(I="border");const R=Rn.computeEdgeHash(g,v);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:g,vb:v,vab:b,length:w,hash:R,isTunnel:s,type:I});const O=Rn.computePosHash(g);this.vertexHashLookup.set(O,{prev:p,next:R}),p=R}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),s=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},a=new Ev(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const h=i(),u=i(),p=i(),_=(w,I)=>{w.sort(((P,R)=>P.type===I&&R.type!==I?-1:P.type!==I&&R.type===I?1:0));const A=w.findIndex((P=>P.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)),s(p);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})}s(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),s(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),s(u),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),s(h),this.maskSegments=Ni.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=Ni.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.renderableBridgeSegments=Ni.simpleSegment(0,p.primitiveOffset,0,p.primitiveLength),this.renderableTunnelSegments=Ni.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=Ni.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength)}update(e,i,s,a,h,u,p,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,h,s,a,u,p,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,h,s,a,u,p,_)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,fv.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,pv.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,s,a,h){const u=(p,_)=>{for(let g=0;g<_.length-1;g++){const v=_[g].featureIndex,b=_[g+1].vertexStart,w=e.feature(v);p.populatePaintArrays(b,w,v,{},s,i,a,void 0,h)}};u(this.bridgeProgramConfigurations,this.bridgeFeatureSections),u(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,s,a,h){const u=new Map;for(let p=a;p<h;p++){const _=s[p],g=_.a,v=_.b,b=Rn.computePosHash(e[g]),w=Rn.computePosHash(e[v]);let I=u.get(b);I||(I={},u.set(b,I));let A=u.get(w);A||(A={},u.set(w,A)),i[g]<=0&&i[v]<=0||(I.to=v,A.from=g)}return u}isTerminalVertex(e,i){const s=Rn.computePosHash(this.unevalVertices[e]),a=i.get(s);return!a||!a.from||!a.to}constructBridgeStructures(e,i,s,a,h,u){e.clearVertexLookup();const p=this.computeVertexConnections(i,s,a,h.min,h.max),_=1/u,g=.5*_,v=(Fe,Ve)=>nr(Fe,i[Ve].x,i[Ve].y,s[Ve]*_),b=ui(),w=ui(),I=ui(),A=ui(),P=ui(),R=(Fe,Ve)=>{const Te=p.get(Rn.computePosHash(i[Ve])),Oe=Te.from,fe=Te.to;if(!Oe||!fe)return;v(b,Oe),v(w,Ve),v(I,fe),Ba(A),Fn(b,w)||(ir(P,w,b),Ri(A,P)),Fn(I,w)||(ir(P,I,w),ki(A,A,Ri(P,P)));const Se=Ds(A);return Se>0?Fi(Fe,A,1/Se):void 0};let O=Number.POSITIVE_INFINITY;this.sortSubarray(a,h.min,h.max,((Fe,Ve)=>Fe.featureInfo.featureIndex-Ve.featureInfo.featureIndex));const U=ui(),V=ui(),G=ui(),re=ui(),Q=ui(),te=ui(),ae=ui(),ce=ui(),Ee=ui(),de=[ui(),ui(),ui(),ui()],Ae=[ui(),ui(),ui(),ui()],je=[{coord:new ke(0,0),height:0},{coord:new ke(0,0),height:0}],Ce=(Fe,Ve)=>Fe>Ve;for(let Fe=h.min;Fe<h.max;Fe++){const Ve=a[Fe];if(!Ve.featureInfo.guardRailEnabled||!this.prepareEdgePoints(je,i,s,Ve,Ce))continue;const[Te,Oe]=je;if(nr(U,Te.coord.x,Te.coord.y,_*Te.height),nr(V,Oe.coord.x,Oe.coord.y,_*Oe.height),Fn(U,V))continue;ir(G,V,U),Ri(G,G);const fe=R(ce,Ve.a)||G,Se=R(Ee,Ve.b)||G;nr(re,fe[1],-fe[0],0),Ri(re,re),nr(Q,Se[1],-Se[0],0),Ri(Q,Q),cr(ce,re,fe),Ri(te,ce),cr(ce,Q,Se),Ri(ae,ce),ki(de[0],U,Fi(ce,ir(ce,re,te),g)),ki(de[1],U,Fi(ce,ki(ce,re,te),g)),ki(de[2],U,Fi(ce,te,g)),de[3]=U,ki(Ae[0],V,Fi(ce,ir(ce,Q,ae),g)),ki(Ae[1],V,Fi(ce,ki(ce,Q,ae),g)),ki(Ae[2],V,Fi(ce,ae,g)),Ae[3]=V,O=this.addFeatureSection(Ve.featureInfo.featureIndex,O,this.bridgeFeatureSections,e);const He=e.addVertex(de[0],re,u),Be=e.addVertex(de[1],re,u),ct=e.addVertex(Ae[0],Q,u),nt=e.addVertex(Ae[1],Q,u);e.addTriangle(He,Be,ct),e.addTriangle(Be,nt,ct);const De=e.addVertex(de[1],te,u),Ne=e.addVertex(de[2],te,u),ot=e.addVertex(Ae[1],ae,u),et=e.addVertex(Ae[2],ae,u);e.addTriangle(De,Ne,ot),e.addTriangle(Ne,et,ot),Ps(re,re),Ps(Q,Q);const Xe=e.addVertex(de[2],re,u),tt=e.addVertex(de[3],re,u),_t=e.addVertex(Ae[2],Q,u),Tt=e.addVertex(Ae[3],Q,u);e.addTriangle(Xe,tt,_t),e.addTriangle(tt,Tt,_t);const Mt=this.isTerminalVertex(Ve.a,p),It=this.isTerminalVertex(Ve.b,p);Te.height<.01&&Mt&&e.addQuad(de[3],de[2],de[1],de[0],Ps(fe,fe),u),Oe.height<.01&&It&&e.addQuad(Ae[0],Ae[1],Ae[2],Ae[3],Se,u)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,s,a,h,u){e.clearVertexLookup();let p=Number.POSITIVE_INFINITY;const _=(O,U)=>O.featureInfo.featureIndex-U.featureInfo.featureIndex;this.sortSubarray(a,h.min,h.max,_),this.sortSubarray(a,u.min,u.max,_);const g=O=>Ri(O,O),v=[{coord:new ke(0,0),height:0},{coord:new ke(0,0),height:0}],b=(O,U)=>O<U,w=ui(),I=ui(),A=ui(),P=ui(),R=ui();for(let O=h.min;O<h.max;O++){if(!this.prepareEdgePoints(v,i,s,a[O],b))continue;const[U,V]=v,G=g(nr(R,-(V.coord.y-U.coord.y),V.coord.x-U.coord.x,0));p=this.addFeatureSection(a[O].featureInfo.featureIndex,p,this.tunnelFeatureSections,e),e.addQuad(nr(w,U.coord.x,U.coord.y,U.height),nr(I,V.coord.x,V.coord.y,V.height),nr(A,V.coord.x,V.coord.y,a[O].isTunnel?-.1:0),nr(P,U.coord.x,U.coord.y,a[O].isTunnel?-.1:0),G)}for(let O=u.min;O<u.max;O++){const U=a[O];U.isTunnel&&([U.a,U.b]=[U.b,U.a]);const V=i[U.a],G=i[U.b],re=g(nr(R,-(G.y-V.y),G.x-V.x,0));p=this.addFeatureSection(U.featureInfo.featureIndex,p,this.tunnelFeatureSections,e),e.addQuad(nr(w,G.x,G.y,0),nr(I,V.x,V.y,0),nr(A,V.x,V.y,s[U.a]+4),nr(P,G.x,G.y,s[U.b]+4),re),e.addQuad(nr(w,V.x,V.y,0),nr(I,G.x,G.y,0),nr(A,G.x,G.y,s[U.b]+4),nr(P,V.x,V.y,s[U.a]+4),re)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,s,a){e.coord.x=i,e.coord.y=s,e.height=a}prepareEdgePoints(e,i,s,a,h){let u=i[a.a].x,p=i[a.a].y,_=i[a.b].x,g=i[a.b].y,v=s[a.a],b=s[a.b];const w=h(v,0),I=h(b,0);if(w&&I)return this.setElevatedPoint(e[0],u,p,v),this.setElevatedPoint(e[1],_,g,b),!0;if(!w&&!I)return!1;if(w){if(!I){const A=b/(b-v);_=pt(_,u,A),g=pt(g,p,A),b=pt(b,v,A)}}else{const A=v/(v-b);u=pt(u,_,A),p=pt(p,g,A),v=pt(v,b,A)}return this.setElevatedPoint(e[0],u,p,v),this.setElevatedPoint(e[1],_,g,b),!0}prepareEdges(e,i){if(i.length===0)return;i.sort(((p,_)=>p.hash===_.hash?_.polygonIdx-p.polygonIdx:_.hash>p.hash?1:-1));let s=0,a=0,h=0,u=i[s].polygonIdx;do a++,(a===i.length||i[s].hash!==i[a].hash)&&((a-s==1||i[a-1].polygonIdx!==u)&&(h<s&&(i[h]=i[s],i[s]=null),i[h].type="none",h++),s=a,s!==i.length&&(u=i[s].polygonIdx));while(s!==i.length);if(i.splice(h),i.length!==0&&e.length!==0){i.sort(((g,v)=>g.portalHash<v.portalHash?1:-1));let p=0,_=0;for(;p!==i.length&&_!==e.length;){const g=i[p],v=e[_];g.portalHash>v.hash?p++:v.hash>g.portalHash?_++:(g.type=v.type,p++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=We&&i>=We}addFeatureSection(e,i,s,a){return e!==i&&(i=e,s.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,s,a){const h=e.slice(i,s);h.sort(a),e.splice(i,h.length,...h)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(Rn.computePosHash(e))<<32n|BigInt(Rn.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var F_,O_={exports:{}},k_=(F_||(F_=1,(function(r,e){(function(i){function s(H,$){return H>$?1:H<$?-1:0}var a=function(H,$){H===void 0&&(H=s),$===void 0&&($=!1),this._compare=H,this._root=null,this._size=0,this._noDuplicates=!!$},h={size:{configurable:!0}};function u(H,$,be,$e,Ke){var Ye=Ke-$e;if(Ye>0){var st=$e+Math.floor(Ye/2),vt={key:$[st],data:be[st],parent:H};return vt.left=u(vt,$,be,$e,st),vt.right=u(vt,$,be,st+1,Ke),vt}return null}function p(H,$,be,$e,Ke){if(!(be>=$e)){for(var Ye=H[be+$e>>1],st=be-1,vt=$e+1;;){do st++;while(Ke(H[st],Ye)<0);do vt--;while(Ke(H[vt],Ye)>0);if(st>=vt)break;var Nt=H[st];H[st]=H[vt],H[vt]=Nt,Nt=$[st],$[st]=$[vt],$[vt]=Nt}p(H,$,be,vt,Ke),p(H,$,vt+1,$e,Ke)}}a.prototype.rotateLeft=function(H){var $=H.right;$&&(H.right=$.left,$.left&&($.left.parent=H),$.parent=H.parent),H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.left=H),H.parent=$},a.prototype.rotateRight=function(H){var $=H.left;$&&(H.left=$.right,$.right&&($.right.parent=H),$.parent=H.parent),H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.right=H),H.parent=$},a.prototype._splay=function(H){for(;H.parent;){var $=H.parent;$.parent?$.left===H&&$.parent.left===$?(this.rotateRight($.parent),this.rotateRight($)):$.right===H&&$.parent.right===$?(this.rotateLeft($.parent),this.rotateLeft($)):$.left===H&&$.parent.right===$?(this.rotateRight($),this.rotateLeft($)):(this.rotateLeft($),this.rotateRight($)):$.left===H?this.rotateRight($):this.rotateLeft($)}},a.prototype.splay=function(H){for(var $,be,$e,Ke,Ye;H.parent;
7)(be=($=H.parent).parent)&&be.parent?(($e=be.parent).left===be?$e.left=H:$e.right=H,H.parent=$e):(H.parent=null,this._root=H),Ke=H.left,Ye=H.right,H===$.left?(be&&(be.left===$?($.right?(be.left=$.right,be.left.parent=be):be.left=null,$.right=be,be.parent=$):(Ke?(be.right=Ke,Ke.parent=be):be.right=null,H.left=be,be.parent=H)),Ye?($.left=Ye,Ye.parent=$):$.left=null,H.right=$,$.parent=H):(be&&(be.right===$?($.left?(be.right=$.left,be.right.parent=be):be.right=null,$.left=be,be.parent=$):(Ye?(be.left=Ye,Ye.parent=be):be.left=null,H.right=be,be.parent=H)),Ke?($.right=Ke,Ke.parent=$):$.right=null,H.left=$,$.parent=H)},a.prototype.replace=function(H,$){H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.parent=H.parent)},a.prototype.minNode=function(H){if(H===void 0&&(H=this._root),H)for(;H.left;)H=H.left;return H},a.prototype.maxNode=function(H){if(H===void 0&&(H=this._root),H)for(;H.right;)H=H.right;return H},a.prototype.insert=function(H,$){var be=this._root,$e=null,Ke=this._compare;if(this._noDuplicates)for(;be;){if($e=be,Ke(be.key,H)===0)return;be=Ke(be.key,H)<0?be.right:be.left}else for(;be;)$e=be,be=Ke(be.key,H)<0?be.right:be.left;return be={key:H,data:$,left:null,right:null,parent:$e},$e?Ke($e.key,be.key)<0?$e.right=be:$e.left=be:this._root=be,this.splay(be),this._size++,be},a.prototype.find=function(H){for(var $=this._root,be=this._compare;$;){var $e=be($.key,H);if($e<0)$=$.right;else{if(!($e>0))return $;$=$.left}}return null},a.prototype.contains=function(H){for(var $=this._root,be=this._compare;$;){var $e=be(H,$.key);if($e===0)return!0;$=$e<0?$.left:$.right}return!1},a.prototype.remove=function(H){var $=this.find(H);if(!$)return!1;if(this.splay($),$.left)if($.right){var be=this.minNode($.right);be.parent!==$&&(this.replace(be,be.right),be.right=$.right,be.right.parent=be),this.replace($,be),be.left=$.left,be.left.parent=be}else this.replace($,$.left);else this.replace($,$.right);return this._size--,!0},a.prototype.removeNode=function(H){if(!H)return!1;if(this.splay(H),H.left)if(H.right){var $=this.minNode(H.right);$.parent!==H&&(this.replace($,$.right),$.right=H.right,$.right.parent=$),this.replace(H,$),$.left=H.left,$.left.parent=$}else this.replace(H,H.left);else this.replace(H,H.right);return this._size--,!0},a.prototype.erase=function(H){var $=this.find(H);if($){this.splay($);var be=$.left,$e=$.right,Ke=null;be&&(be.parent=null,Ke=this.maxNode(be),this.splay(Ke),this._root=Ke),$e&&(be?Ke.right=$e:this._root=$e,$e.parent=Ke),this._size--}},a.prototype.pop=function(){var H=this._root,$=null;if(H){for(;H.left;)H=H.left;$={key:H.key,data:H.data},this.remove(H.key)}return $},a.prototype.next=function(H){var $=H;if($)if($.right)for($=$.right;$&&$.left;)$=$.left;else for($=H.parent;$&&$.right===H;)H=$,$=$.parent;return $},a.prototype.prev=function(H){var $=H;if($)if($.left)for($=$.left;$&&$.right;)$=$.right;else for($=H.parent;$&&$.left===H;)H=$,$=$.parent;return $},a.prototype.forEach=function(H){for(var $=this._root,be=[],$e=!1,Ke=0;!$e;)$?(be.push($),$=$.left):be.length>0?(H($=be.pop(),Ke++),$=$.right):$e=!0;return this},a.prototype.range=function(H,$,be,$e){for(var Ke=[],Ye=this._compare,st=this._root;Ke.length!==0||st;)if(st)Ke.push(st),st=st.left;else{if(Ye((st=Ke.pop()).key,$)>0)break;if(Ye(st.key,H)>=0&&be.call($e,st))return this;st=st.right}return this},a.prototype.keys=function(){for(var H=this._root,$=[],be=[],$e=!1;!$e;)H?($.push(H),H=H.left):$.length>0?(H=$.pop(),be.push(H.key),H=H.right):$e=!0;return be},a.prototype.values=function(){for(var H=this._root,$=[],be=[],$e=!1;!$e;)H?($.push(H),H=H.left):$.length>0?(H=$.pop(),be.push(H.data),H=H.right):$e=!0;return be},a.prototype.at=function(H){for(var $=this._root,be=[],$e=!1,Ke=0;!$e;)if($)be.push($),$=$.left;else if(be.length>0){if($=be.pop(),Ke===H)return $;Ke++,$=$.right}else $e=!0;return null},a.prototype.load=function(H,$,be){if(H===void 0&&(H=[]),$===void 0&&($=[]),be===void 0&&(be=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var $e=H.length;return be&&p(H,$,0,$e-1,this._compare),this._root=u(null,H,$,0,$e),this._size=$e,this},a.prototype.min=function(){var H=this.minNode(this._root);return H?H.key:null},a.prototype.max=function(){var H=this.maxNode(this._root);return H?H.key:null},a.prototype.isEmpty=function(){return this._root===null},h.size.get=function(){return this._size},a.createTree=function(H,$,be,$e,Ke){return new a(be,Ke).load(H,$,$e)},Object.defineProperties(a.prototype,h);var _=0,g=1,v=2,b=3,w=0,I=1,A=2,P=3;function R(H,$,be){$===null?(H.inOut=!1,H.otherInOut=!0):(H.isSubject===$.isSubject?(H.inOut=!$.inOut,H.otherInOut=$.otherInOut):(H.inOut=!$.otherInOut,H.otherInOut=$.isVertical()?!$.inOut:$.inOut),$&&(H.prevInResult=!O($,be)||$.isVertical()?$.prevInResult:$));var $e=O(H,be);H.resultTransition=$e?(function(Ke,Ye){var st,vt=!Ke.inOut,Nt=!Ke.otherInOut;switch(Ye){case w:st=vt&&Nt;break;case I:st=vt||Nt;break;case P:st=vt^Nt;break;case A:st=Ke.isSubject?vt&&!Nt:Nt&&!vt}return st?1:-1})(H,be):0}function O(H,$){switch(H.type){case _:switch($){case w:return!H.otherInOut;case I:return H.otherInOut;case A:return H.isSubject&&H.otherInOut||!H.isSubject&&!H.otherInOut;case P:return!0}break;case v:return $===w||$===I;case b:return $===A;case g:return!1}return!1}var U=function(H,$,be,$e,Ke){this.left=$,this.point=H,this.otherEvent=be,this.isSubject=$e,this.type=Ke||_,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},V={inResult:{configurable:!0}};function G(H,$){return H[0]===$[0]&&H[1]===$[1]}U.prototype.isBelow=function(H){var $=this.point,be=this.otherEvent.point;
7return this.left?($[0]-H[0])*(be[1]-H[1])-(be[0]-H[0])*($[1]-H[1])>0:(be[0]-H[0])*($[1]-H[1])-($[0]-H[0])*(be[1]-H[1])>0},U.prototype.isAbove=function(H){return!this.isBelow(H)},U.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},V.inResult.get=function(){return this.resultTransition!==0},U.prototype.clone=function(){var H=new U(this.point,this.left,this.otherEvent,this.isSubject,this.type);return H.contourId=this.contourId,H.resultTransition=this.resultTransition,H.prevInResult=this.prevInResult,H.isExteriorRing=this.isExteriorRing,H.inOut=this.inOut,H.otherInOut=this.otherInOut,H},Object.defineProperties(U.prototype,V);var re=11102230246251565e-32,Q=134217729,te=(3+8*re)*re;function ae(H,$,be,$e,Ke){var Ye,st,vt,Nt,Vt=$[0],zt=$e[0],mi=0,Hi=0;zt>Vt==zt>-Vt?(Ye=Vt,Vt=$[++mi]):(Ye=zt,zt=$e[++Hi]);var Ct=0;if(mi<H&&Hi<be)for(zt>Vt==zt>-Vt?(vt=Ye-((st=Vt+Ye)-Vt),Vt=$[++mi]):(vt=Ye-((st=zt+Ye)-zt),zt=$e[++Hi]),Ye=st,vt!==0&&(Ke[Ct++]=vt);mi<H&&Hi<be;)zt>Vt==zt>-Vt?(vt=Ye-((st=Ye+Vt)-(Nt=st-Ye))+(Vt-Nt),Vt=$[++mi]):(vt=Ye-((st=Ye+zt)-(Nt=st-Ye))+(zt-Nt),zt=$e[++Hi]),Ye=st,vt!==0&&(Ke[Ct++]=vt);for(;mi<H;)vt=Ye-((st=Ye+Vt)-(Nt=st-Ye))+(Vt-Nt),Vt=$[++mi],Ye=st,vt!==0&&(Ke[Ct++]=vt);for(;Hi<be;)vt=Ye-((st=Ye+zt)-(Nt=st-Ye))+(zt-Nt),zt=$e[++Hi],Ye=st,vt!==0&&(Ke[Ct++]=vt);return Ye===0&&Ct!==0||(Ke[Ct++]=Ye),Ct}function ce(H){return new Float64Array(H)}var Ee=33306690738754716e-32,de=22204460492503146e-32,Ae=11093356479670487e-47,je=ce(4),Ce=ce(8),Fe=ce(12),Ve=ce(16),Te=ce(4);function Oe(H,$,be){var $e=(function(Ke,Ye,st,vt,Nt,Vt){var zt=(Ye-Vt)*(st-Nt),mi=(Ke-Nt)*(vt-Vt),Hi=zt-mi;if(zt===0||mi===0||zt>0!=mi>0)return Hi;var Ct=Math.abs(zt+mi);return Math.abs(Hi)>=Ee*Ct?Hi:-(function(Pi,Ti,hi,Ui,Ai,Si,Ei){var fi,Rt,_i,ji,yt,Zt,Mi,Wi,zi,_r,xi,ur,mn,Dr,Mr,_n,ao,gr,vr=Pi-Ai,Lr=hi-Ai,Kr=Ti-Si,jr=Ui-Si;je[0]=(Mr=(Wi=vr-(Mi=(Zt=Q*vr)-(Zt-vr)))*(_r=jr-(zi=(Zt=Q*jr)-(Zt-jr)))-((Dr=vr*jr)-Mi*zi-Wi*zi-Mi*_r))-((xi=Mr-(ao=(Wi=Kr-(Mi=(Zt=Q*Kr)-(Zt-Kr)))*(_r=Lr-(zi=(Zt=Q*Lr)-(Zt-Lr)))-((_n=Kr*Lr)-Mi*zi-Wi*zi-Mi*_r)))+(yt=Mr-xi))+(yt-ao),je[1]=(mn=Dr-((ur=Dr+xi)-(yt=ur-Dr))+(xi-yt))-((xi=mn-_n)+(yt=mn-xi))+(yt-_n),je[2]=ur-((gr=ur+xi)-(yt=gr-ur))+(xi-yt),je[3]=gr;var Fa=(function(Db,Xx){for(var Yx=Xx[0],a_=1;a_<4;a_++)Yx+=Xx[a_];return Yx})(0,je),hd=de*Ei;if(Fa>=hd||-Fa>=hd||(fi=Pi-(vr+(yt=Pi-vr))+(yt-Ai),_i=hi-(Lr+(yt=hi-Lr))+(yt-Ai),Rt=Ti-(Kr+(yt=Ti-Kr))+(yt-Si),ji=Ui-(jr+(yt=Ui-jr))+(yt-Si),fi===0&&Rt===0&&_i===0&&ji===0)||(hd=Ae*Ei+te*Math.abs(Fa),(Fa+=vr*ji+jr*fi-(Kr*_i+Lr*Rt))>=hd||-Fa>=hd))return Fa;Te[0]=(Mr=(Wi=fi-(Mi=(Zt=Q*fi)-(Zt-fi)))*(_r=jr-(zi=(Zt=Q*jr)-(Zt-jr)))-((Dr=fi*jr)-Mi*zi-Wi*zi-Mi*_r))-((xi=Mr-(ao=(Wi=Rt-(Mi=(Zt=Q*Rt)-(Zt-Rt)))*(_r=Lr-(zi=(Zt=Q*Lr)-(Zt-Lr)))-((_n=Rt*Lr)-Mi*zi-Wi*zi-Mi*_r)))+(yt=Mr-xi))+(yt-ao),Te[1]=(mn=Dr-((ur=Dr+xi)-(yt=ur-Dr))+(xi-yt))-((xi=mn-_n)+(yt=mn-xi))+(yt-_n),Te[2]=ur-((gr=ur+xi)-(yt=gr-ur))+(xi-yt),Te[3]=gr;var Eb=ae(4,je,4,Te,Ce);Te[0]=(Mr=(Wi=vr-(Mi=(Zt=Q*vr)-(Zt-vr)))*(_r=ji-(zi=(Zt=Q*ji)-(Zt-ji)))-((Dr=vr*ji)-Mi*zi-Wi*zi-Mi*_r))-((xi=Mr-(ao=(Wi=Kr-(Mi=(Zt=Q*Kr)-(Zt-Kr)))*(_r=_i-(zi=(Zt=Q*_i)-(Zt-_i)))-((_n=Kr*_i)-Mi*zi-Wi*zi-Mi*_r)))+(yt=Mr-xi))+(yt-ao),Te[1]=(mn=Dr-((ur=Dr+xi)-(yt=ur-Dr))+(xi-yt))-((xi=mn-_n)+(yt=mn-xi))+(yt-_n),Te[2]=ur-((gr=ur+xi)-(yt=gr-ur))+(xi-yt),Te[3]=gr;var Ib=ae(Eb,Ce,4,Te,Fe);Te[0]=(Mr=(Wi=fi-(Mi=(Zt=Q*fi)-(Zt-fi)))*(_r=ji-(zi=(Zt=Q*ji)-(Zt-ji)))-((Dr=fi*ji)-Mi*zi-Wi*zi-Mi*_r))-((xi=Mr-(ao=(Wi=Rt-(Mi=(Zt=Q*Rt)-(Zt-Rt)))*(_r=_i-(zi=(Zt=Q*_i)-(Zt-_i)))-((_n=Rt*_i)-Mi*zi-Wi*zi-Mi*_r)))+(yt=Mr-xi))+(yt-ao),Te[1]=(mn=Dr-((ur=Dr+xi)-(yt=ur-Dr))+(xi-yt))-((xi=mn-_n)+(yt=mn-xi))+(yt-_n),Te[2]=ur-((gr=ur+xi)-(yt=gr-ur))+(xi-yt),Te[3]=gr;var Ab=ae(Ib,Fe,4,Te,Ve);return Ve[Ab-1]})(Ke,Ye,st,vt,Nt,Vt,Ct)})(H[0],H[1],$[0],$[1],be[0],be[1]);return $e>0?-1:$e<0?1:0}function fe(H,$){var be=H.point,$e=$.point;return be[0]>$e[0]?1:be[0]<$e[0]?-1:be[1]!==$e[1]?be[1]>$e[1]?1:-1:(function(Ke,Ye,st,vt){return Ke.left!==Ye.left?Ke.left?1:-1:Oe(st,Ke.otherEvent.point,Ye.otherEvent.point)!==0?Ke.isBelow(Ye.otherEvent.point)?-1:1:!Ke.isSubject&&Ye.isSubject?1:-1})(H,$,be)}function Se(H,$,be){var $e=new U($,!1,H,H.isSubject),Ke=new U($,!0,H.otherEvent,H.isSubject);return G(H.point,H.otherEvent.point)&&console.warn("what is that, a collapsed
7segment?",H),$e.contourId=Ke.contourId=H.contourId,fe(Ke,H.otherEvent)>0&&(H.otherEvent.left=!0,Ke.left=!1),H.otherEvent.otherEvent=Ke,H.otherEvent=$e,be.push(Ke),be.push($e),be}function He(H,$){return H[0]*$[1]-H[1]*$[0]}function Be(H,$){return H[0]*$[0]+H[1]*$[1]}function ct(H,$,be){var $e=(function(Nt,Vt,zt,mi,Hi){var Ct=[Vt[0]-Nt[0],Vt[1]-Nt[1]],Pi=[mi[0]-zt[0],mi[1]-zt[1]];function Ti(Zt,Mi,Wi){return[Zt[0]+Mi*Wi[0],Zt[1]+Mi*Wi[1]]}var hi=[zt[0]-Nt[0],zt[1]-Nt[1]],Ui=He(Ct,Pi),Ai=Ui*Ui,Si=Be(Ct,Ct);if(Ai>0){var Ei=He(hi,Pi)/Ui;if(Ei<0||Ei>1)return null;var fi=He(hi,Ct)/Ui;return fi<0||fi>1?null:Ei===0||Ei===1?[Ti(Nt,Ei,Ct)]:fi===0||fi===1?[Ti(zt,fi,Pi)]:[Ti(Nt,Ei,Ct)]}if((Ai=(Ui=He(hi,Ct))*Ui)>0)return null;var Rt=Be(Ct,hi)/Si,_i=Rt+Be(Ct,Pi)/Si,ji=Math.min(Rt,_i),yt=Math.max(Rt,_i);return ji<=1&&yt>=0?ji===1?[Ti(Nt,ji>0?ji:0,Ct)]:yt===0?[Ti(Nt,yt<1?yt:1,Ct)]:[Ti(Nt,ji>0?ji:0,Ct),Ti(Nt,yt<1?yt:1,Ct)]:null})(H.point,H.otherEvent.point,$.point,$.otherEvent.point),Ke=$e?$e.length:0;if(Ke===0||Ke===1&&(G(H.point,$.point)||G(H.otherEvent.point,$.otherEvent.point))||Ke===2&&H.isSubject===$.isSubject)return 0;if(Ke===1)return G(H.point,$e[0])||G(H.otherEvent.point,$e[0])||Se(H,$e[0],be),G($.point,$e[0])||G($.otherEvent.point,$e[0])||Se($,$e[0],be),1;var Ye=[],st=!1,vt=!1;return G(H.point,$.point)?st=!0:fe(H,$)===1?Ye.push($,H):Ye.push(H,$),G(H.otherEvent.point,$.otherEvent.point)?vt=!0:fe(H.otherEvent,$.otherEvent)===1?Ye.push($.otherEvent,H.otherEvent):Ye.push(H.otherEvent,$.otherEvent),st&&vt||st?($.type=g,H.type=$.inOut===H.inOut?v:b,st&&!vt&&Se(Ye[1].otherEvent,Ye[0].point,be),2):vt?(Se(Ye[0],Ye[1].point,be),3):Ye[0]!==Ye[3].otherEvent?(Se(Ye[0],Ye[1].point,be),Se(Ye[1],Ye[2].point,be),3):(Se(Ye[0],Ye[1].point,be),Se(Ye[3].otherEvent,Ye[2].point,be),3)}function nt(H,$){if(H===$)return 0;if(Oe(H.point,H.otherEvent.point,$.point)!==0||Oe(H.point,H.otherEvent.point,$.otherEvent.point)!==0)return G(H.point,$.point)?H.isBelow($.otherEvent.point)?-1:1:H.point[0]===$.point[0]?H.point[1]<$.point[1]?-1:1:fe(H,$)===1?$.isAbove(H.point)?-1:1:H.isBelow($.point)?-1:1;if(H.isSubject!==$.isSubject)return H.isSubject?-1:1;var be=H.point,$e=$.point;return be[0]===$e[0]&&be[1]===$e[1]?(be=H.otherEvent.point)[0]===($e=$.otherEvent.point)[0]&&be[1]===$e[1]?0:H.contourId>$.contourId?1:-1:fe(H,$)===1?1:-1}var De=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Ne(H,$,be,$e){var Ke,Ye=H+1,st=$[H].point,vt=$.length;for(Ye<vt&&(Ke=$[Ye].point);Ye<vt&&Ke[0]===st[0]&&Ke[1]===st[1];){if(!be[Ye])return Ye;++Ye<vt&&(Ke=$[Ye].point)}for(Ye=H-1;be[Ye]&&Ye>$e;)Ye--;return Ye}De.prototype.isExterior=function(){return this.holeOf==null};var ot=Xe,et=Xe;function Xe(H,$){if(!(this instanceof Xe))return new Xe(H,$);if(this.data=H||[],this.length=this.data.length,this.compare=$||tt,this.length>0)for(var be=(this.length>>1)-1;be>=0;be--)this._down(be)}function tt(H,$){return H<$?-1:H>$?1:0}Xe.prototype={push:function(H){this.data.push(H),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var H=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),H}},peek:function(){return this.data[0]},_up:function(H){for(var $=this.data,be=this.compare,$e=$[H];H>0;){var Ke=H-1>>1,Ye=$[Ke];if(be($e,Ye)>=0)break;$[H]=Ye,H=Ke}$[H]=$e},_down:function(H){for(var $=this.data,be=this.compare,$e=this.length>>1,Ke=$[H];H<$e;){var Ye=1+(H<<1),st=Ye+1,vt=$[Ye];if(st<this.length&&be($[st],vt)<0&&(Ye=st,vt=$[st]),be(vt,Ke)>=0)break;$[H]=vt,H=Ye}$[H]=Ke}},ot.default=et;var _t=Math.max,Tt=Math.min,Mt=0;function It(H,$,be,$e,Ke,Ye){var st,vt,Nt,Vt,zt,mi;for(st=0,vt=H.length-1;st<vt;st++)if(Vt=H[st+1],zt=new U(Nt=H[st],!1,void 0,$),mi=new U(Vt,!1,zt,$),zt.otherEvent=mi,Nt[0]!==Vt[0]||Nt[1]!==Vt[1]){zt.contourId=mi.contourId=be,Ye||(zt.isExteriorRing=!1,mi.isExteriorRing=!1),fe(zt,mi)>0?mi.left=!0:zt.left=!0;var Hi=Nt[0],Ct=Nt[1];Ke[0]=Tt(Ke[0],Hi),Ke[1]=Tt(Ke[1],Ct),Ke[2]=_t(Ke[2],Hi),Ke[3]=_t(Ke[3],Ct),$e.push(zt),$e.push(mi)}}var qt=[];function Lt(H,$,be){typeof H[0][0][0]=="number"&&(H=[H]),typeof $[0][0][0]=="number"&&($=[$]);var $e=(function(Ct,Pi,Ti){var hi=null;return Ct.length*Pi.length==0&&(Ti===w?hi=qt:Ti===A?hi=Ct:Ti!==I&&Ti!==P||(hi=Ct.length===0?Pi:Ct)),hi})(H,$,be);if($e)return $e===qt?null:$e;
7var Ke=[1/0,1/0,-1/0,-1/0],Ye=[1/0,1/0,-1/0,-1/0],st=(function(Ct,Pi,Ti,hi,Ui){var Ai,Si,Ei,fi,Rt,_i,ji=new ot(null,fe);for(Ei=0,fi=Ct.length;Ei<fi;Ei++)for(Rt=0,_i=(Ai=Ct[Ei]).length;Rt<_i;Rt++)(Si=Rt===0)&&Mt++,It(Ai[Rt],!0,Mt,ji,Ti,Si);for(Ei=0,fi=Pi.length;Ei<fi;Ei++)for(Rt=0,_i=(Ai=Pi[Ei]).length;Rt<_i;Rt++)Si=Rt===0,Ui===A&&(Si=!1),Si&&Mt++,It(Ai[Rt],!1,Mt,ji,hi,Si);return ji})(H,$,Ke,Ye,be);if($e=(function(Ct,Pi,Ti,hi,Ui){var Ai=null;return(Ti[0]>hi[2]||hi[0]>Ti[2]||Ti[1]>hi[3]||hi[1]>Ti[3])&&(Ui===w?Ai=qt:Ui===A?Ai=Ct:Ui!==I&&Ui!==P||(Ai=Ct.concat(Pi))),Ai})(H,$,Ke,Ye,be))return $e===qt?null:$e;for(var vt=(function(Ct){var Pi,Ti,hi=(function(Ei){var fi,Rt,_i,ji,yt=[];for(Rt=0,_i=Ei.length;Rt<_i;Rt++)((fi=Ei[Rt]).left&&fi.inResult||!fi.left&&fi.otherEvent.inResult)&&yt.push(fi);for(var Zt=!1;!Zt;)for(Zt=!0,Rt=0,_i=yt.length;Rt<_i;Rt++)Rt+1<_i&&fe(yt[Rt],yt[Rt+1])===1&&(ji=yt[Rt],yt[Rt]=yt[Rt+1],yt[Rt+1]=ji,Zt=!1);for(Rt=0,_i=yt.length;Rt<_i;Rt++)(fi=yt[Rt]).otherPos=Rt;for(Rt=0,_i=yt.length;Rt<_i;Rt++)(fi=yt[Rt]).left||(ji=fi.otherPos,fi.otherPos=fi.otherEvent.otherPos,fi.otherEvent.otherPos=ji);return yt})(Ct),Ui={},Ai=[],Si=function(){if(!Ui[Pi]){var Ei=Ai.length,fi=(function(yt,Zt,Mi){var Wi=new De;if(yt.prevInResult!=null){var zi=yt.prevInResult,_r=zi.outputContourId;if(zi.resultTransition>0){var xi=Zt[_r];if(xi.holeOf!=null){var ur=xi.holeOf;Zt[ur].holeIds.push(Mi),Wi.holeOf=ur,Wi.depth=Zt[_r].depth}else Zt[_r].holeIds.push(Mi),Wi.holeOf=_r,Wi.depth=Zt[_r].depth+1}else Wi.holeOf=null,Wi.depth=Zt[_r].depth}else Wi.holeOf=null,Wi.depth=0;return Wi})(hi[Pi],Ai,Ei),Rt=function(yt){Ui[yt]=!0,yt<hi.length&&hi[yt]&&(hi[yt].outputContourId=Ei)},_i=Pi,ji=Pi;for(fi.points.push(hi[Pi].point);Rt(_i),Rt(_i=hi[_i].otherPos),fi.points.push(hi[_i].point),!((_i=Ne(_i,hi,Ui,ji))==ji||_i>=hi.length)&&hi[_i];);Ai.push(fi)}};for(Pi=0,Ti=hi.length;Pi<Ti;Pi++)Si();return Ai})((function(Ct,Pi,Ti,hi,Ui,Ai){for(var Si,Ei,fi,Rt=new a(nt),_i=[],ji=Math.min(hi[2],Ui[2]);Ct.length!==0;){var yt=Ct.pop();if(_i.push(yt),Ai===w&&yt.point[0]>ji||Ai===A&&yt.point[0]>hi[2])break;if(yt.left){Ei=Si=Rt.insert(yt),Si=Si!==(fi=Rt.minNode())?Rt.prev(Si):null,Ei=Rt.next(Ei);var Zt=Si?Si.key:null;if(R(yt,Zt,Ai),Ei&&ct(yt,Ei.key,Ct)===2&&(R(yt,Zt,Ai),R(Ei.key,yt,Ai)),Si&&ct(Si.key,yt,Ct)===2){var Mi=Si;R(Zt,(Mi=Mi!==fi?Rt.prev(Mi):null)?Mi.key:null,Ai),R(yt,Zt,Ai)}}else Ei=Si=Rt.find(yt=yt.otherEvent),Si&&Ei&&(Si=Si!==fi?Rt.prev(Si):null,Ei=Rt.next(Ei),Rt.remove(yt),Ei&&Si&&ct(Si.key,Ei.key,Ct))}return _i})(st,0,0,Ke,Ye,be)),Nt=[],Vt=0;Vt<vt.length;Vt++){var zt=vt[Vt];if(zt.isExterior()){for(var mi=[zt.points],Hi=0;Hi<zt.holeIds.length;Hi++)mi.push(vt[zt.holeIds[Hi]].points);Nt.push(mi)}}return Nt}var Ii={UNION:I,DIFFERENCE:A,INTERSECTION:w,XOR:P};i.diff=function(H,$){return Lt(H,$,A)},i.intersection=function(H,$){return Lt(H,$,w)},i.operations=Ii,i.union=function(H,$){return Lt(H,$,I)},i.xor=function(H,$){return Lt(H,$,P)},Object.defineProperty(i,"__esModule",{value:!0})})(e)})(0,O_.exports)),O_.exports);/** 8 * martinez v0.7.4 9 * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor 10 * 11 * @author Alex Milevski <[email protected]> 12 * @license MIT 13 * @preserve 14 */function Sf(r,e,i,s){const a=[],h=s===0?(u,p,_,g,v,b)=>{u.push(new ke(b,_+(b-p)/(g-p)*(v-_)))}:(u,p,_,g,v,b)=>{u.push(new ke(p+(b-_)/(v-_)*(g-p),b))};for(const u of r){const p=[];for(const _ of u){if(_.length<=2)continue;const g=[];for(let w=0;w<_.length-1;w++){const I=_[w].x,A=_[w].y,P=_[w+1].x,R=_[w+1].y,O=s===0?I:A,U=s===0?P:R;O<e?U>e&&h(g,I,A,P,R,e):O>i?U<i&&h(g,I,A,P,R,i):g.push(_[w]),U<e&&O>=e&&h(g,I,A,P,R,e),U>i&&O<=i&&h(g,I,A,P,R,i)}let v=_[_.length-1];const b=s===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]),p.push(g))}p.length&&a.push(p)}return a}function Iv(r,e){const i=rm(r),s=rm([e]),a=k_.intersection(i,s);return a==null?[]:B_(a)}function Av(r,e){let s=rm(r,65536);for(;e.valid();e.next()){const[a,h]=e.get(),u=a.x*65536,p=a.y*65536,_=h.x*65536,g=h.y*65536,v=_-u,b=g-p,w=Math.hypot(v,b),I=Math.trunc(b/w*3),A=-Math.trunc(v/w*3);s=k_.diff(s,[[[u,p],[_,g],[_+I,g+A],[u+I,p+A],[u,p]]])}return B_(s,1/65536)}function rm(r,e=1){return[r.map((i=>i.map((s=>[s.x*e,s.y*e]))))]}function B_(r,e=1){return r.map((i=>i.map(((s,a)=>{const h=s.map((u=>new ke(u[0]*e,u[1]*e).round()));return a>0&&h.reverse(),h}))))}class nm{constructor(e,i){this.layoutVertexArray=new ln,this.indexArray=new Li,this.lineIndexArray=new is,this.triangleSegments=new Ni,this.lineSegments=new Ni,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new zo)}update(e,i,s,a,h,u,p,_){this.programConfigurations.updatePaintArrays(e,i,h,s,a,u,p,_)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uv.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,dv.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,s,a,h,u,p){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,s,a,h,u,void 0,p)}}class sm{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 nm(e,!1),this.elevationBufferData=new nm(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.s
vendor: 42,847 bytes, line 14
14ourceLayerIndex,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=tm("fill",this.layers,this.pixelRatio,i);const h=this.layers[0].layout.get("fill-sort-key"),u=[];for(const{feature:p,id:_,index:g,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,w=we(p,b);if(!this.layers[0]._featureFilter.filter(new pi(this.zoom,{worldview:this.worldview}),w,s))continue;const I=h?h.evaluate(w,{},s,i.availableImages):void 0,A={id:_,properties:p.properties,type:p.type,sourceLayerIndex:v,index:g,geometry:b?w.geometry:se(p,s,a),patterns:{},sortKey:I};u.push(A)}h&&u.sort(((p,_)=>p.sortKey-_.sortKey));for(const p of u){const{geometry:_,index:g,sourceLayerIndex:v}=p;if(this.hasPattern){const b=im("fill",this.layers,p,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(p,_,g,s,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[g].feature,_,g,v,this.index)}}update(e,i,s,a,h,u,p){this.bufferData.update(e,i,s,a,h,u,p,this.worldview),this.elevationBufferData.update(e,i,s,a,h,u,p,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,s,a,h,u,p,this.worldview)}addFeatures(e,i,s,a,h,u){for(const p of this.patternFeatures)this.addFeature(p,p.geometry,p.index,i,s,a,u,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()}addFeature(e,i,s,a,h,u=[],p,_){const g=Du(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,a,s,_):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,s,h,u,a,p,this.worldview),this.elevationBufferData.populatePaintArrays(e,s,h,u,a,p,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e,i,s,a,h){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,s,a,h,this.worldview))}addElevatedRoadFeature(e,i,s,a,h){const u=new Array,p=Vi.getElevationFeature(e,h);if(!p)return void this.addGeometry(i,this.bufferData);{const g=this.clipPolygonsToTile(i,1);g.length>0&&u.push({polygons:g,elevationFeature:p,elevationTileID:s})}const _={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},s),featureIndex:a};for(const g of u)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Rn(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;e.properties.hasOwnProperty(ht)&&(w=+e.properties[ht]);for(const I of g.polygons)this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,I,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new Wt(s,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,_)}}addElevatedGeometry(e,i,s,a,h,u){const p={elevation:s,elevationSampler:i,bias:a,index:h,featureInfo:u},[_,g]=this.addGeometry(e,this.elevationBufferData,p);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,s){let a=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,u=null;s&&(u=s.elevationSampler.constantElevation(s.elevation,s.bias),u!=null&&(a=u,h=u));const p=(_,g,v)=>{if(s!=null)if(g.push(_),u!=null)i.elevatedLayoutVertexArray.emplaceBack(u),v.push(u);else{const b=s.elevationSampler.pointElevation(_,s.elevation,s.bias);i.elevatedLayoutVertexArray.emplaceBack(b),v.push(b),a=Math.min(a,b),h=Math.max(h,b)}};for(const _ of e){let g=0;for(const V of _)g+=V.length;const v=i.triangleSegments.prepareSegment(g,i.layoutVertexArray,i.indexArray),b=v.vertexLength,w=[],I=[],A=[],P=[],R=[],O=i.layoutVertexArray.length;for(const V of _){if(V.length===0)continue;V!==_[0]&&I.push(w.length/2);const G=i.lineSegments.prepareSegment(V.length,i.layoutVertexArray,i.lineIndexArray),re=G.vertexLength;s&&R.push(i.layoutVertexArray.length-O),p(V[0],A,P),i.layoutVertexArray.emplaceBack(V[0].x,V[0].y),i.lineIndexArray.emplaceBack(re+V.length-1,re),w.push(V[0].x),w.push(V[0].y);for(let Q=1;Q<V.length;Q++)p(V[Q],A,P),i.layoutVertexArray.emplaceBack(V[Q].x,V[Q].y),i.lineIndexArray.emplaceBack(re+Q-1,re+Q),w.push(V[Q].x),w.push(V[Q].y);G.vertexLength+=V.length,G.primitiveLength+=V.length}const U=Zc(w,I);for(let V=0;V<U.length;V+=3)i.indexArray.emplaceBack(b+U[V],b+U[V+1],b+U[V+2]);if(U.length>0&&s&&this.elevationMode==="hd-road-base"){const V=s.elevation.isTunnel(),G=s.elevation.safeArea,re=this.elevatedStructures.addVertices(A,P);this.elevatedStructures.addTriangles(U,re,V);const Q=R.length;if(Q>0){for(let te=0;te<Q-1;te++)this.elevatedStructures.addRenderableRing(s.index,R[te]+re,R[te+1]-R[te],V,G,s.featureInfo);this.elevatedStructures.addRenderableRing(s.index,R[Q-1]+re,A.length-R[Q-1],V,G,s.featureInfo)}}v.vertexLength+=g,v.primitiveLength+=U.length/3}return[a,h]}prepareElevatedPolygons(e,i,s){const a=1/K(s),h=[];for(const u of e){const p=Av(u,new di(i,a));h.push(...p)}return h}clipPolygonsToTile(e,i){const s=-i,a=-i,h=We+i,u=We+i;let p=0;const _=[],g=[];for(;p<e.length;p++){const w=e[p],I=bh(w);(I.min.x>=s&&I.max.x<=h&&I.min.y>=a&&I.max.y<=u?_:g).push(w)}if(_.length===e.length)return e;const v=[new ke(s,a),new ke(h,a),new ke(h,u),new ke(s,u),new ke(s,a)],b=_;for(const w of g)b.push(...Iv(w,v));return b}}let N_,V_,U_,j_;rt(sm,"FillBucket",{omit:["layers","patternFeatures"]}),rt(nm,"FillBufferData"),rt(Rn,"ElevatedStructures");class Ef{constructor(e,i,s,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[h,u]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const w=e[b];h.x=Math.min(h.x,w.x),h.y=Math.min(h.y,w.y),u.x=Math.max(u.x,w.x),u.y=Math.max(u.y,w.y)}if(a){const b=Math.ceil(Math.max(u.x-h.x,u.y-h.y)/a);s=Math.max(s,b)}if(s===0)return;this.min=h,this.max=u;const p=this.max.sub(this.min);p.x=Math.max(p.x,1),p.y=Math.max(p.y,1);const _=Math.max(p.x,p.y)/s;this.cellsX=Math.max(1,Math.ceil(p.x/_)),this.cellsY=Math.max(1,Math.ceil(p.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),P=so(Math.floor(Math.min(w.x,I.x,A.x)),this.xScale,this.cellsX),R=so(Math.floor(Math.max(w.x,I.x,A.x)),this.xScale,this.cellsX),O=so(Math.floor(Math.min(w.y,I.y,A.y)),this.yScale,this.cellsY),U=so(Math.floor(Math.max(w.y,I.y,A.y)),this.yScale,this.cellsY),V=new ke(0,0),G=new ke(0,0),re=new ke(0,0),Q=new ke(0,0);for(let te=O;te<=U;++te){V.y=G.y=te*_,re.y=Q.y=(te+1)*_;for(let ae=P;ae<=R;++ae)V.x=re.x=ae*_,G.x=Q.x=(ae+1)*_,(pr(w,I,A,V,G,Q)||pr(w,I,A,V,Q,re))&&g.push({cellIdx:te*this.cellsX+ae,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 s=so(e.x-this.min.x,this.xScale,this.cellsX),a=so(e.y-this.min.y,this.yScale,this.cellsY),h=this.cells[a*this.cellsX+s];if(h){this._lazyInitLookup();for(let u=0;u<h.len;u++){const p=this.payload[h.start+u],_=Math.floor(p/8),g=1<<p%8;if(!(this.lookup[_]&g)&&(this.lookup[_]|=g,i.push(p),i.length===this.triangleCount))return}}}query(e,i,s){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=so(e.x-this.min.x,this.xScale,this.cellsX),h=so(i.x-this.min.x,this.xScale,this.cellsX),u=so(e.y-this.min.y,this.yScale,this.cellsY),p=so(i.y-this.min.y,this.yScale,this.cellsY);for(let _=u;_<=p;_++)for(let g=a;g<=h;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,s.push(w),s.length===this.triangleCount))return}}}}function so(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}rt(Ef,"TriangleGridIndex");class G_{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}updateFootprints(e,i){for(const s of this.footprints)i.push({footprint:s,id:e})}populate(e,i,s,a){const h=[];for(const{feature:u,id:p,index:_,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,b=we(u,v);if(!this.layers[0]._featureFilter.filter(new pi(this.zoom,{worldview:this.worldview}),b,s))continue;const w={id:p,properties:u.properties,type:u.type,sourceLayerIndex:g,index:_,geometry:v?b.geometry:se(u,s,a),patterns:{}};h.push(w)}for(const u of h){const{geometry:p,index:_,sourceLayerIndex:g}=u;this.addFeature(u,p,_,s,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,p,_,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,s,a,h,u,p){}destroy(){}addFeature(e,i,s,a,h,u=[],p){for(const _ of Du(i,2)){const g=[],v=[],b=[],w=new ke(1/0,1/0),I=new ke(-1/0,-1/0);for(const R of _)if(R.length!==0){R!==_[0]&&b.push(v.length/2);for(let O=0;O<R.length;O++)v.push(R[O].x),v.push(R[O].y),g.push(R[O]),w.x=Math.min(w.x,R[O].x),w.y=Math.min(w.y,R[O].y),I.x=Math.max(I.x,R[O].x),I.y=Math.max(I.y,R[O].y)}const A=Zc(v,b),P=new Ef(g,A,8,256);this.footprints.push({vertices:g,indices:A,grid:P,min:w,max:I})}}}rt(G_,"ClipBucket",{omit:["layers"]});const Mv=$t([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Cv=$t([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),Pv=$t([{name:"a_centroid_pos",components:2,type:"Uint16"}]),zv=$t([{name:"a_join_normal_inside",components:3,type:"Int16"}]),Rv=$t([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),Dv=$t([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Lv}=Mv,Lu=Number.MAX_SAFE_INTEGER,q_=Lu-1;function H_(r,e,i,s){return r.order<e||r.order===Lu||!(r.clipMask&i)||(function(a,h){return h.length!==0&&h.find((u=>u===a))===void 0})(s,r.clipScope)}function If(r,e){return r.x-e.x||r.y-e.y}function $_(r,e){return If(r.min,e.min)===0&&If(r.max,e.max)===0}function om(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 Af(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!$_(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!ms(r[i].clipScope,e[i].clipScope))return!1;return!0}function Z_(r,e,i){const s=1/We,a=1/(1<<i.canonical.z),h=(e.x*s+i.canonical.x)*a+i.wrap,u=(e.y*s+i.canonical.y)*a;return{min:new ke((r.x*s+i.canonical.x)*a+i.wrap,(r.y*s+i.canonical.y)*a),max:new ke(h,u)}}function Fv(r,e,i){const s=1<<i.canonical.z,a=((e.x-i.wrap)*s-i.canonical.x)*We,h=(e.y*s-i.canonical.y)*We;return{min:new ke(((r.x-i.wrap)*s-i.canonical.x)*We,(r.y*s-i.canonical.y)*We),max:new ke(a,h)}}function am(r,e,i,s,a,h,u){const p=r.indices,_=r.vertices,g=[];for(let v=s;v<s+a;v+=3){const b=e[i[v+0]+h],w=e[i[v+1]+h],I=e[i[v+2]+h],A=Math.min(b.x,w.x,I.x),P=Math.max(b.x,w.x,I.x),R=Math.min(b.y,w.y,I.y),O=Math.max(b.y,w.y,I.y);g.length=0,r.grid.query(new ke(A,R),new ke(P,O),g);for(let U=0;U<g.length;U++){const V=g[U];if(pr(_[p[3*V+0]],_[p[3*V+1]],_[p[3*V+2]],b,w,I,u))return!0}}return!1}function W_(r,e,i,s){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(s.canonical)||e.wrap!==s.wrap){if(i.vertices.length<r.vertices.length)return W_(i,s,r,e);const h=e.canonical,u=s.canonical,p=Math.pow(2,u.z-h.z);a=r.vertices.map((_=>new ke((_.x+h.x*We)*p-u.x*We,(_.y+h.y*We)*p-u.y*We)))}return am(i,a,r.indices,0,r.indices.length,0,0)}function X_(r,e,i,s){const a=Math.pow(2,s.z-i.z);return new ke((r+i.x*We)*a-s.x*We,(e+i.y*We)*a-s.y*We)}function lm(r,e){const i=[];e.grid.queryPoint(r,i);const s=e.indices,a=e.vertices;for(let h=0;h<i.length;h++){const u=i[h];if(zr([a[s[3*u+0]],a[s[3*u+1]],a[s[3*u+2]]],r))return!0}return!1}const cm=[new ke(0,0),new ke(We,0),new ke(We,We),new ke(0,We)];function Y_(r,e){const i=[];let s=[];if(!e||r.length<2)return[r];if(r.length===2)return Zi(r[0],r[1],cm)?[r]:[];for(let a=0;a<r.length+2;a++){const h=r[a%r.length],u=r[(a+1)%r.length],p=Zi(a===0?r[r.length-1]:r[(a-1)%r.length],h,cm),_=Zi(h,u,cm),g=p||_;g&&s.push(h),g&&_||s.length>0&&(s.length>1&&i.push(s),s=[])}return s.length>1&&i.push(s),i}const hm=_e.types,Ov=["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"],kv=["fill-extrusion-flood-light-ground-radius"],Bv=Math.pow(2,13),Nv=Math.pow(2,15)-1,K_=new ke(0,1),Ca=2147483648;function Fu(r,e,i,s,a,h,u,p){r.emplaceBack((e<<1)+u,(i<<1)+h,(Math.floor(s*Bv)<<1)+a,Math.round(p))}function Ou(r,e,i){r.emplaceBack(e.x*We,e.y*We,i?1:0)}function Mf(r,e,i,s,a,h){r.emplaceBack(e.x,e.y,(i.x<<1)+s,(i.y<<1)+a,h)}function ku(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class J_{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Q_{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 eg{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,s){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===We)&&i.x===s.x)!=((i.y===0||i.y===We)&&i.y===s.y)&&this.processBorderOverlap(i,s),a&&this.checkBorderIntersection(i,s)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,pt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>We!=e.x>We&&this.addBorderIntersection(1,pt(i.y,e.y,(We-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,pt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>We!=e.y>We&&this.addBorderIntersection(3,pt(i.x,e.x,(We-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 s=this.borders[e];i<s[0]&&(s[0]=i),i>s[1]&&(s[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const s=e.x===0?0:1;this.addBorderIntersection(s,i.y),this.addBorderIntersection(s,e.y)}else{const s=e.y===0?2:3;this.addBorderIntersection(s,i.x),this.addBorderIntersection(s,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 tg(r,e){const i=r.add(e)._unit(),s=W(r.x*i.x+r.y*i.y,-1,1);var a,h,u;return a=Math.acos(s),Math.min(4,Math.max(-4,Math.tan(a)))/4*Nv*((h=r).x*(u=e).y-h.y*u.x<0?-1:1)}const Vv=[r=>r.x<0,r=>r.x>We,r=>r.y<0,r=>r.y>We];function Uv(r,e,i,s){const a=[4];if(s===0)return a;i._mult(s);const h=r.sub(i),u=e.sub(i),p=[r,e,h,u];for(let _=0;_<4;_++)for(const g of p)if(Vv[_](g)){a.push(_);break}return a}class um{constructor(e){this.vertexArray=new Oc,this.indexArray=new Li,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut},(i=>kv.includes(i))),this._segments=new Ni,this.hiddenByLandmarkVertexArray=new jc,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Ni}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,s,a=!1){const h=e.length;if(h>2){let u=Math.max(0,this._segments.get().length-1);const p=this._segments._prepareSegment(4*h,this.vertexArray.length,2*this._segmentToGroundQuads[u].length);let _;u!==this._segments.get().length-1&&(u++,this._segmentToGroundQuads[u]=[],this._segmentToRegionTriCounts[u]=[0,0,0,0,0]);{const g=e[0],v=e[1];_=tg(g.sub(e[h-1])._perp()._unit(),v.sub(g)._perp()._unit())}for(let g=0;g<h;g++){const v=g===h-1?0:g+1,b=e[g],w=e[v],I=e[v===h-1?0:v+1],A=w.sub(b)._perp()._unit(),P=tg(A,I.sub(w)._perp()._unit()),R=_,O=P;if(dm(b,w,i)||a&&ng(b,i)&&ng(w,i)){_=P;continue}const U=p.vertexLength;Mf(this.vertexArray,b,w,1,1,R),Mf(this.vertexArray,b,w,1,0,R),Mf(this.vertexArray,b,w,0,1,O),Mf(this.vertexArray,b,w,0,0,O),p.vertexLength+=4;const V=Uv(b,w,A,s);for(const G of V)this._segmentToGroundQuads[u].push({id:U,region:G}),this._segmentToRegionTriCounts[u][G]+=2,p.primitiveLength+=2;_=P}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let s=0;s<i;s++)this._segmentToGroundQuads[s].sort(((a,h)=>a.region-h.region));for(let s=0;s<i;s++){const a=this._segmentToGroundQuads[s],h=e[s],u=this._segmentToRegionTriCounts[s];u.reduce(((_,g)=>_+g),0);let p=0;for(let _=0;_<=4;_++){const g=u[_];if(g!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new Ni);const b={vertexOffset:h.vertexOffset,primitiveOffset:h.primitiveOffset+p,vertexLength:h.vertexLength,primitiveLength:g};v.get().push(b)}p+=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,s,a,h,u,p){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,s,a,h,u,void 0,p)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Cv.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,s,a,h,u,p,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,s,a,h,u,p,_)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Ca))}updateHiddenByLandmarkRange(e,i,s){if(!this.hasData())return;const a=i+e;if(i!==0){for(let h=e;h<a;++h)this.hiddenByLandmarkVertexArray.emplace(h,s?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Rv.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Cf{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 Li,this.footprintVertices=new ln,this.footprintSegments=[],this.layoutVertexArray=new _a,this.centroidVertexArray=new lf,this.wallVertexArray=new hf,this.indexArray=new Li,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut},(i=>Ov.includes(i))),this.segments=new Ni,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.groundEffect=new um(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){this.features=[],this.hasPattern=tm("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=K(s),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:h,id:u,index:p,sourceLayerIndex:_}of e){const g=this.layers[0]._featureFilter.needGeometry,v=we(h,g);if(!this.layers[0]._featureFilter.filter(new pi(this.zoom,{worldview:this.worldview}),v,s))continue;const b={id:u,sourceLayerIndex:_,index:p,geometry:g?v.geometry:se(h,s,a),properties:h.properties,type:h.type,patterns:{}},w=this.layoutVertexArray.length,I=hm[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:h.id,feature:im("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const A of b.geometry)for(const P of Y_(A,I))this.addFeature(h.id,b,[P],p,s,{},i.availableImages,a,i.brightness);else this.addFeature(h.id,b,b.geometry,p,s,{},i.availableImages,a,i.brightness);i.featureIndex.insert(h,b.geometry,p,_,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,s,a,h,u){for(const{featureId:p,feature:_}of this.features){const g=hm[_.type]==="Polygon",{geometry:v}=_;if(this.wallMode)for(const b of v)for(const w of Y_(b,g))this.addFeature(p,_,[w],_.index,i,s,a,h,u);else this.addFeature(p,_,v,_.index,i,s,a,h,u)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,s,a,h,u,p){this.programConfigurations.updatePaintArrays(e,i,h,s,a,u,p,this.worldview),this.groundEffect.update(e,i,h,s,a,u,p,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,Lv),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,zv.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Dv.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,Pv.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,s,a,h,u,p,_,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(We,We)],w=_.projection,I=w.name==="globe",A=this.wallMode||hm[i.type]==="Polygon",P=new eg;P.centroidDataIndex=this.centroidData.length;const R=new Q_;R.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(R.buildingId=i.properties.building_id);const O=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},h)<=0,U=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},h);let V;if(R.height=U,R.vertexArrayOffset=this.layoutVertexArray.length,R.groundVertexArrayOffset=this.groundEffect.vertexArray.length,I&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Bc),this.wallMode){if(I)return void Gt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(s.length!==1)return;V=(function(de){const Ae=de[0].x===de[de.length-1].x&&de[0].y===de[de.length-1].y;(function(Ne){let ot=0;const et=Ne.length;for(let Xe=0;Xe<et;Xe++)ot+=(Ne[(Xe+1)%et].x-Ne[Xe].x)*(Ne[(Xe+1)%et].y+Ne[Xe].y);return ot>=0})(de)||(de=de.reverse());const Ce={geometry:[],joinNormals:[],indices:[]},Fe=[],Ve=[],Te=[];let Oe=de.length;for(;Oe>=2&&de[Oe-1].equals(de[Oe-2]);)Oe--;if(Oe<(Ae?3:2))return Ce;let fe,Se,He,Be,ct,nt=0;for(;nt<Oe-1&&de[nt].equals(de[nt+1]);)nt++;Ae&&(fe=de[Oe-2],ct=de[nt].sub(fe)._unit()._perp());for(let Ne=nt;Ne<Oe;Ne++){if(He=Ne===Oe-1?Ae?de[nt+1]:void 0:de[Ne+1],He&&de[Ne].equals(He))continue;ct&&(Be=ct),fe&&(Se=fe),fe=de[Ne],ct=He?He.sub(fe)._unit()._perp():Be,Be=Be||ct;let ot=Be.add(ct);ot.x===0&&ot.y===0||ot._unit();const et=ot.x*ct.x+ot.y*ct.y,Xe=et!==0?1/et:1/0,tt=Be.x*ct.y-Be.y*ct.x>0;let _t="miter";const Tt=2;_t==="miter"&&Xe>Tt&&(_t="bevel"),_t==="bevel"&&(Xe>100&&(_t="flipbevel"),Xe<Tt&&(_t="miter"));const Mt=(It,qt,Lt,Ii)=>{const H=new ke(It.x,It.y),$=new ke(It.x,It.y);H.x+=qt.x*Ii,H.y+=qt.y*Ii,$.x-=qt.x*Math.max(Lt,1),$.y-=qt.y*Math.max(Lt,1),Te.push(qt),Fe.push(H),Ve.push($)};if(_t==="miter")ot._mult(Xe),Mt(fe,ot,0,0);else if(_t==="flipbevel")ot=ct.mult(-1),Mt(fe,ot,0,0),Mt(fe,ot.mult(-1),0,0);else{const It=-Math.sqrt(Xe*Xe-1),qt=tt?It:0,Lt=tt?0:It;Se&&Mt(fe,Be,qt,Lt),He&&Mt(fe,ct,qt,Lt)}}Ce.geometry=[...Fe,...Ve.reverse(),Fe[0]],Ce.joinNormals=[...Te,...Te.reverse(),Te[Te.length-1]];const De=Ce.geometry.length-1;for(let Ne=0;Ne<De/2;Ne++)if(Ne+1<De/2){let ot=Ne,et=Ne+1,Xe=De-1-Ne,tt=De-2-Ne;ot=ot===0?De-1:ot-1,et=et===0?De-1:et-1,Xe=Xe===0?De-1:Xe-1,tt=tt===0?De-1:tt-1,Ce.indices.push(Xe),Ce.indices.push(et),Ce.indices.push(ot),Ce.indices.push(Xe),Ce.indices.push(tt),Ce.indices.push(et)}return Ce})(s[0]),s=[V.geometry]}const G=(de,Ae)=>de<(Ae.length-1)/2||de===Ae.length-1,re=this.wallMode?[s]:Du(s,500);for(let de=re.length-1;de>=0;de--){const Ae=re[de];(Ae.length===0||(Q=Ae[0]).every((je=>je.x<=0))||Q.every((je=>je.x>=We))||Q.every((je=>je.y<=0))||Q.every((je=>je.y>=We)))&&re.splice(de,1)}var Q;let te;if(I)te=lg(re,b,h);else{te=[];for(const de of re)te.push({polygon:de,bounds:b})}const ae=A?this.edgeRadius:0,ce=ae>0&&this.zoom<17,Ee=(de,Ae)=>{if(de.length===0)return!1;const je=de[de.length-1];return Ae.x===je.x&&Ae.y===je.y};for(const{polygon:de,bounds:Ae}of te){let je=0,Ce=0;for(const Oe of de)A&&!Oe[0].equals(Oe[Oe.length-1])&&Oe.push(Oe[0]),Ce+=A?Oe.length-1:Oe.length;const Fe=this.segments.prepareSegment((A?5:4)*Ce,this.layoutVertexArray,this.indexArray);R.footprintSegIdx<0&&(R.footprintSegIdx=this.footprintSegments.length),R.polygonSegIdx<0&&(R.polygonSegIdx=this.polygonSegments.length);const Ve={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Te=new J_;if(Te.vertexOffset=this.footprintVertices.length,Te.indexOffset=3*this.footprintIndices.length,Te.ringIndices=[],A){const Oe=[],fe=[];je=Fe.vertexLength;for(let He=0;He<de.length;He++){const Be=de[He];Be.length&&He!==0&&fe.push(Oe.length/2);const ct=[];let nt,De;nt=Be[1].sub(Be[0])._perp()._unit(),Te.ringIndices.push(Be.length-1);for(let Ne=1;Ne<Be.length;Ne++){const ot=Be[Ne],et=Be[Ne===Be.length-1?1:Ne+1],Xe=ot.clone();if(ae){De=et.sub(ot)._perp()._unit();const tt=nt.add(De)._unit(),_t=ae*Math.min(4,1/(nt.x*tt.x+nt.y*tt.y));Xe.x+=_t*tt.x,Xe.y+=_t*tt.y,Xe.x=Math.round(Xe.x),Xe.y=Math.round(Xe.y),nt=De}if(!O||ae!==0&&!ce||Ee(ct,Xe)||ct.push(Xe),Fu(this.layoutVertexArray,Xe.x,Xe.y,0,0,1,1,0),this.wallMode){const tt=G(Ne,Be);Ou(this.wallVertexArray,V.joinNormals[Ne],!tt)}Fe.vertexLength++,this.footprintVertices.emplaceBack(ot.x,ot.y),Oe.push(ot.x,ot.y),I&&ku(this.layoutVertexExtArray,w.projectTilePoint(Xe.x,Xe.y,h),w.upVector(h,Xe.x,Xe.y))}O&&(ae===0||ce)&&(ct.length!==0&&Ee(ct,ct[0])&&ct.pop(),this.groundEffect.addData(ct,Ae,v))}const Se=this.wallMode?V.indices:Zc(Oe,fe);for(let He=0;He<Se.length;He+=3)this.footprintIndices.emplaceBack(Te.vertexOffset+Se[He+0],Te.vertexOffset+Se[He+1],Te.vertexOffset+Se[He+2]),this.indexArray.emplaceBack(je+Se[He],je+Se[He+2],je+Se[He+1]),Fe.primitiveLength++;Te.indexCount+=Se.length,Te.vertexCount+=this.footprintVertices.length-Te.vertexOffset}for(let Oe=0;Oe<de.length;Oe++){const fe=de[Oe];P.startRing(R,fe[0]);let Se=fe.length>4&&sg(fe[fe.length-2],fe[0],fe[1]),He=ae?jv(fe[fe.length-2],fe[0],fe[1],ae):0;const Be=[];let ct,nt,De;nt=fe[1].sub(fe[0])._perp()._unit();let Ne=!0;for(let ot=1,et=0;ot<fe.length;ot++){let Xe=fe[ot-1],tt=fe[ot];const _t=fe[ot===fe.length-1?1:ot+1];if(P.appendEdge(R,tt,Xe),dm(tt,Xe,Ae)){ae&&(nt=_t.sub(tt)._perp()._unit(),Ne=!Ne);continue}const Tt=tt.sub(Xe)._perp(),Mt=Tt.x/(Math.abs(Tt.x)+Math.abs(Tt.y)),It=Tt.y>0?1:0,qt=Xe.dist(tt);if(et+qt>32768&&(et=0),ae){De=_t.sub(tt)._perp()._unit();let $=rg(Xe,tt,_t,ig(nt,De),ae);isNaN($)&&($=0);const be=tt.sub(Xe)._unit();Xe=Xe.add(be.mult(He))._round(),tt=tt.add(be.mult(-$))._round(),He=$,nt=De,O&&this.zoom>=17&&(Ee(Be,Xe)||Be.push(Xe),Ee(Be,tt)||Be.push(tt))}const Lt=Fe.vertexLength,Ii=fe.length>4&&sg(Xe,tt,_t);let H=og(et,Se,Ne);if(Fu(this.layoutVertexArray,Xe.x,Xe.y,Mt,It,0,0,H),Fu(this.layoutVertexArray,Xe.x,Xe.y,Mt,It,0,1,H),this.wallMode){const $=G(ot-1,fe),be=V.joinNormals[ot-1];Ou(this.wallVertexArray,be,$),Ou(this.wallVertexArray,be,$)}if(et+=qt,H=og(et,Ii,!Ne),Se=Ii,Fu(this.layoutVertexArray,tt.x,tt.y,Mt,It,0,0,H),Fu(this.layoutVertexArray,tt.x,tt.y,Mt,It,0,1,H),this.wallMode){const $=G(ot,fe),be=V.joinNormals[ot];Ou(this.wallVertexArray,be,$),Ou(this.wallVertexArray,be,$)}if(Fe.vertexLength+=4,this.indexArray.emplaceBack(Lt+0,Lt+1,Lt+2),this.indexArray.emplaceBack(Lt+1,Lt+3,Lt+2),Fe.primitiveLength+=2,ae){const $=je+(ot===1?fe.length-2:ot-2),be=ot===1?je:$+1;if(this.indexArray.emplaceBack(Lt+1,$,Lt+3),this.indexArray.emplaceBack($,be,Lt+3),Fe.primitiveLength+=2,ct===void 0&&(ct=Lt),!dm(_t,fe[ot],Ae)){const $e=ot===fe.length-1?ct:Fe.vertexLength;this.indexArray.emplaceBack(Lt+2,Lt+3,$e),this.indexArray.emplaceBack(Lt+3,$e+1,$e),this.indexArray.emplaceBack(Lt+3,be,$e+1),Fe.primitiveLength+=3}Ne=!Ne}if(I){const $=this.layoutVertexExtArray,be=w.projectTilePoint(Xe.x,Xe.y,h),$e=w.projectTilePoint(tt.x,tt.y,h),Ke=w.upVector(h,Xe.x,Xe.y),Ye=w.upVector(h,tt.x,tt.y);ku($,be,Ke),ku($,be,Ke),ku($,$e,Ye),ku($,$e,Ye)}}A&&(je+=fe.length-1),O&&ae&&this.zoom>=17&&(Be.length!==0&&Ee(Be,Be[0])&&Be.pop(),this.groundEffect.addData(Be,Ae,v,ae>0))}this.footprintSegments.push(Te),Ve.triangleCount=this.indexArray.length-Ve.triangleArrayOffset,this.polygonSegments.push(Ve),++R.footprintSegLen,++R.polygonSegLen}if(R.vertexCount=this.layoutVertexArray.length-R.vertexArrayOffset,R.groundVertexCount=this.groundEffect.vertexArray.length-R.groundVertexArrayOffset,R.vertexCount!==0){if(R.centroidXY=P.borders?K_:this.encodeCentroid(P,R),this.centroidData.push(R),P.borders){this.featuresOnBorder.push(P);const de=this.featuresOnBorder.length-1;for(let Ae=0;Ae<P.borders.length;Ae++)P.borders[Ae][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Ae].push(de)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,u,p,h,g,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,a,u,p,h,g,this.worldview),this.maxHeight=Math.max(this.maxHeight,U)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort(((i,s)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[s].borders[e][0]))}splitToSubtiles(){const e=[];for(let p=0;p<this.centroidData.length;p++){const _=this.centroidData[p],g=+(_.min.y+_.max.y>We),v=2*g+(+(_.min.x+_.max.x>We)^g);for(let b=0;b<_.polygonSegLen;b++){const w=_.polygonSegIdx+b;e.push({centroidIdx:p,subtile:v,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Li;e.sort(((p,_)=>p.triangleSegmentIdx===_.triangleSegmentIdx?p.subtile-_.subtile:p.triangleSegmentIdx-_.triangleSegmentIdx));let s=0,a=0,h=0;for(const p of e){if(p.triangleSegmentIdx!==s)break;h++}const u=e.length;for(;a!==e.length;){s=e[a].triangleSegmentIdx;let p=0,_=a,g=a;for(let v=_;v<h&&e[v].subtile===p;v++)g++;for(;_!==h;){const v=e[_];p=v.subtile;const b=this.centroidData[v.centroidIdx].min.clone(),w=this.centroidData[v.centroidIdx].max.clone(),I={vertexOffset:this.segments.segments[s].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[s].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let A=_;A<g;A++){const P=e[A],R=this.polygonSegments[P.polygonSegmentIdx],O=this.centroidData[P.centroidIdx].min,U=this.centroidData[P.centroidIdx].max,V=this.indexArray.uint16;for(let G=R.triangleArrayOffset;G<R.triangleArrayOffset+R.triangleCount;G++)i.emplaceBack(V[3*G],V[3*G+1],V[3*G+2]);I.primitiveLength+=R.triangleCount,b.x=Math.min(b.x,O.x),b.y=Math.min(b.y,O.y),w.x=Math.max(w.x,U.x),w.y=Math.max(w.y,U.y)}I.primitiveLength>0&&this.triangleSubSegments.push({segment:I,min:b,max:w}),_=g;for(let A=_;A<h&&e[A].subtile===e[_].subtile;A++)g++}a=h;for(let v=a;v<u&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)h++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,s){const a=new Ni;if(this.wallMode){for(const P of this.triangleSubSegments)a.segments.push(P.segment);return a}let h=0,u=0;const p=1<<e.canonical.z;if(i){const P=i.getMinMaxForTile(e);P&&(h=P.min,u=P.max)}u+=this.maxHeight;const _=e.toUnwrapped();let g;const v=[_.canonical.x/p+_.wrap,_.canonical.y/p],b=[(_.canonical.x+1)/p+_.wrap,(_.canonical.y+1)/p],w=(P,R,O)=>[P[0]*(1-O[0])+R[0]*O[0],P[1]*(1-O[1])+R[1]*O[1]],I=[],A=[];for(const P of this.triangleSubSegments){I[0]=P.min.x/We,I[1]=P.min.y/We,A[0]=P.max.x/We,A[1]=P.max.y/We;const R=w(v,b,I),O=w(v,b,A);if(new kt([R[0],R[1],h],[O[0],O[1],u]).intersectsPrecise(s)===0){g&&(a.segments.push(g),g=void 0);continue}const U=P.segment;g&&g.vertexOffset!==U.vertexOffset&&(a.segments.push(g),g=void 0),g?(g.vertexLength+=U.vertexLength,g.primitiveLength+=U.primitiveLength):g={vertexOffset:U.vertexOffset,primitiveLength:U.primitiveLength,vertexLength:U.vertexLength,primitiveOffset:U.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&a.segments.push(g),a}encodeCentroid(e,i){const s=e.centroid(),a=i.span(),h=Math.min(7,Math.round(a.x*this.tileToMeter/10)),u=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new ke(W(s.x,1,We-1)<<3|h,W(s.y,1,We-1)<<3|u)}encodeBorderCentroid(e){if(!e.borders)return new ke(0,0);const i=e.borders,s=Number.MAX_VALUE;if(i[0][0]!==s||i[1][0]!==s){const a=i[0][0]!==s?0:1;return new ke(6|(i[0][0]!==s?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==s?2:3;return new ke((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==s?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,s=e.vertexCount+e.vertexArrayOffset,a=e.flags&Ca?K_:e.centroidXY,h=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||h!==a.x){for(let u=i;u<s;++u)this.centroidVertexArray.emplace(u,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,s){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Af(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const u of this.centroidData)u.flags&=2147483647;const h=[];for(const u of this.activeReplacements){if(u.order<s)continue;const p=Math.max(1,Math.pow(2,u.footprintTileId.canonical.z-e.canonical.z));if(u.footprint.buildingId){const _=u.footprint.buildingId;for(const g of this.centroidData)g.buildingId===_&&(g.flags|=Ca)}else for(const _ of this.centroidData)if(!(_.flags&Ca||u.min.x>_.max.x||_.min.x>u.max.x||u.min.y>_.max.y||_.min.y>u.max.y))for(let g=0;g<_.footprintSegLen;g++){const v=this.footprintSegments[_.footprintSegIdx+g];if(h.length=0,Gv(this.footprintVertices,v.vertexOffset,v.vertexCount,u.footprintTileId.canonical,e.canonical,h),am(u.footprint,h,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,-p)){_.flags|=Ca;break}}}for(const u of this.centroidData)this.writeCentroidToBuffer(u);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,s){let a=!1;for(let h=0;h<s.footprintSegLen;h++){const u=this.footprintSegments[s.footprintSegIdx+h];let p=0;for(const _ of u.ringIndices){for(let g=p,v=_+p-1;g<_+p;v=g++){const b=this.footprintVertices.int16[2*(g+u.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+u.vertexOffset)+1],I=this.footprintVertices.int16[2*(v+u.vertexOffset)+1];w>i!=I>i&&e<(this.footprintVertices.int16[2*(v+u.vertexOffset)+0]-b)*(i-w)/(I-w)+b&&(a=!a)}p=_}}return a}getHeightAtTileCoord(e,i){let s=Number.NEGATIVE_INFINITY,a=!0;const h=4*(e+We)*We+(i+We);if(this.partLookup.hasOwnProperty(h)){const u=this.partLookup[h];return u?{height:u.height,hidden:!!(u.flags&Ca)}:void 0}for(const u of this.centroidData)e>u.max.x||u.min.x>e||i>u.max.y||u.min.y>i||u.height<=s||this.footprintContainsPoint(e,i,u)&&(s=u.height,this.partLookup[h]=u,a=!!(u.flags&Ca));if(s!==Number.NEGATIVE_INFINITY)return{height:s,hidden:a};this.partLookup[h]=void 0}}function ig(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function jv(r,e,i,s){const a=e.sub(r)._perp()._unit(),h=i.sub(e)._perp()._unit();return rg(r,e,i,ig(a,h),s)}function rg(r,e,i,s,a){const h=Math.sqrt(1-s*s);return Math.min(r.dist(e)/3,e.dist(i)/3,a*h/s)}function dm(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 ng(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function sg(r,e,i){if(r.x<0||r.x>=We||e.x<0||e.x>=We||i.x<0||i.x>=We)return!1;const s=i.sub(e),a=s.perp(),h=r.sub(e);return(s.x*h.x+s.y*h.y)/Math.sqrt((s.x*s.x+s.y*s.y)*(h.x*h.x+h.y*h.y))>-.866&&a.x*h.x+a.y*h.y<0}function og(r,e,i){const s=e?2|r:-3&r;return i?1|s:-2&s}function ag(){const r=Math.PI/32,e=Math.tan(r),i=x;return i*Math.sqrt(1+2*e*e)-i}function lg(r,e,i){const s=1<<i.z,a=N(i.x/s),h=N((i.x+1)/s),u=j(i.y/s),p=j((i.y+1)/s);return(function(_,g,v,b,w=0,I){const A=[];if(!_.length||!v||!b)return A;const P=(Q,te)=>{for(const ae of Q)A.push({polygon:ae,bounds:te})},R=Math.ceil(Math.log2(v)),O=Math.ceil(Math.log2(b)),U=R-O,V=[];for(let Q=0;Q<Math.abs(U);Q++)V.push(U>0?0:1);for(let Q=0;Q<Math.min(R,O);Q++)V.push(0),V.push(1);let G=_;if(G=Sf(G,g[0].y-w,g[1].y+w,1),G=Sf(G,g[0].x-w,g[1].x+w,0),!G.length)return A;const re=[];for(V.length?re.push({polygons:G,bounds:g,depth:0}):P(G,g);re.length;){const Q=re.pop(),te=Q.depth,ae=V[te],ce=Q.bounds[0],Ee=Q.bounds[1],de=ae===0?ce.x:ce.y,Ae=ae===0?Ee.x:Ee.y,je=I?I(ae,de,Ae):.5*(de+Ae),Ce=Sf(Q.polygons,de-w,je+w,ae),Fe=Sf(Q.polygons,je-w,Ae+w,ae);if(Ce.length){const Ve=[ce,new ke(ae===0?je:Ee.x,ae===1?je:Ee.y)];V.length>te+1?re.push({polygons:Ce,bounds:Ve,depth:te+1}):P(Ce,Ve)}if(Fe.length){const Ve=[new ke(ae===0?je:ce.x,ae===1?je:ce.y),Ee];V.length>te+1?re.push({polygons:Fe,bounds:Ve,depth:te+1}):P(Fe,Ve)}}return A})(r,e,Math.ceil((h-a)/11.25),Math.ceil((u-p)/11.25),1,((_,g,v)=>{if(_===0)return .5*(g+v);{const b=j((i.y+g/We)/s);return(F(.5*(j((i.y+v/We)/s)+b))*s-i.y)*We}}))}function Gv(r,e,i,s,a,h){const u=Math.pow(2,s.z-a.z);for(let p=0;p<i;p++){let _=r.int16[2*(p+e)+0],g=r.int16[2*(p+e)+1];_=(_+a.x*We)*u-s.x*We,g=(g+a.y*We)*u-s.y*We,h.push(new ke(_,g))}}let cg,hg;rt(Cf,"FillExtrusionBucket",{omit:["layers","features"]}),rt(Q_,"PartData"),rt(J_,"FootprintSegment"),rt(eg,"BorderCentroidData"),rt(um,"GroundEffect");class Ol extends ke{constructor(e,i,s){super(e,i),this.z=s}}class ug extends Ol{constructor(e,i,s,a){super(e,i,s),this.w=a}}function dg(r,e,i,s){const a=i==="x"?"y":"x",h=(s-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*h),r[i]=s,r.hasOwnProperty("z")&&(r.z=pt(r.z,e.z,h)),r.hasOwnProperty("w")&&(r.w=pt(r.w,e.w,h))}function fg(r,e,i,s){const a=i,h=s;for(const u of["x","y"]){let p=r,_=e;p[u]>=_[u]&&(p=e,_=r),p[u]<a&&_[u]>a&&dg(p,_,u,a),p[u]<h&&_[u]>h&&dg(_,p,u,h)}}function Pf(r,e,i,s,a,h){const u=[];for(let p=0;p<r.length;p++){const _=r[p];let g;const v=u.length;let b=0;for(let w=0;w<_.length-1;w++){let I=_[w],A=_[w+1],P=0;const R=b;let O,U;h&&(P=Math.hypot(A.x-I.x,A.y-I.y),b+=P,O=I,U=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>=s&&A.x>=s||(I.x>=s?I=new ke(s,I.y+(s-I.x)/(A.x-I.x)*(A.y-I.y))._round():A.x>=s&&(A=new ke(s,I.y+(s-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],u.push(g),h&&h.push({progress:{min:R+pg
14(O,U,I)*P,max:1},parentIndex:p,prevPoint:O,nextPoint:U})),g.push(A),h&&(h[h.length-1].progress.max=R+pg(O,U,A)*P,h[h.length-1].nextPoint=U)))))}if(h&&b>0)for(let w=v;w<u.length;w++)h[w].progress.min/=b,h[w].progress.max/=b}return u}function qv(r,e,i,s,a){if(r.length<2)return void s.push(r);const h=[];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=pn(w,I,g,v);if(A){const[P]=A,R=new ke(pt(w.x,I.x,P),pt(w.y,I.y,P));h.push({t:b+P,distance:0,point:R})}}e.next()}if(h.length===0)return void s.push(r);h.sort(((g,v)=>g.t-v.t));let u=0,p=0,_=[];for(s.push(_);u!==r.length;){if(p===h.length){for(;u!==r.length;)_.length!==0&&_[_.length-1].equals(r[u])||_.push(r[u]),u++;break}h[p].t<=u?(_.length!==0&&_[_.length-1].equals(h[p].point)||_.push(h[p].point),Math.trunc(h[p].t),p++):(_.length!==0&&_[_.length-1].equals(r[u])||_.push(r[u]),u++)}}function pg(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 Bu(r,e){return r.x*e.x+r.y*e.y}function mg(r,e){if(r.length===1){let i=0;const s=e[i++];let a;for(;!a||s.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const h=e[i],u=r[0],p=a.sub(s),_=h.sub(s),g=u.sub(s),v=Bu(p,p),b=Bu(p,_),w=Bu(_,_),I=Bu(g,p),A=Bu(g,_),P=v*w-b*b,R=(w*I-b*A)/P,O=(v*A-b*I)/P,U=s.z*(1-R-O)+a.z*R+h.z*O;if(isFinite(U))return U}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}function _g(r,e,i,s,a,h,u,p){const _=u*a.getElevationAt(r,e,!0,!0),g=h[0]!==0,v=g?h[1]===0?u*(h[0]/7-450):u*(function(b,w,I){const A=Math.floor(w[0]/8),P=Math.floor(w[1]/8),R=10*(w[0]-8*A),O=10*(w[1]-8*P),U=b.getElevationAt(A,P,!0,!0),V=b.getMeterToDEM(I),G=Math.floor(.5*(R*V-1)),re=Math.floor(.5*(O*V-1)),Q=b.tileCoordToPixel(A,P),te=2*G+1,ae=2*re+1,ce=(function(Fe,Ve,Te,Oe,fe){return[Fe.getElevationAtPixel(Ve,Te,!0),Fe.getElevationAtPixel(Ve+fe,Te,!0),Fe.getElevationAtPixel(Ve,Te+fe,!0),Fe.getElevationAtPixel(Ve+Oe,Te+fe,!0)]})(b,Q.x-G,Q.y-re,te,ae),Ee=Math.abs(ce[0]-ce[1]),de=Math.abs(ce[2]-ce[3]),Ae=Math.abs(ce[0]-ce[2])+Math.abs(ce[1]-ce[3]),je=Math.min(.25,.5*V*(Ee+de)/te),Ce=Math.min(.25,.5*V*Ae/ae);return U+Math.max(je*R,Ce*O)})(a,h,p):_;return{base:_+(i===0?-1:i),top:g?Math.max(v+s,_+i+2):_+s}}class Hv{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 $v{constructor(){this.tasks={},this.taskQueue=[],bt(["process"],this),this.invoker=new Hv(this.process),this.nextId=0}add(e,i){const s=this.nextId++,a=(function({type:h,isSymbolTile:u,zoom:p}){return p=p||0,h==="message"?0:h!=="maybePrepare"||u?h!=="parseTile"||u?h==="parseTile"&&u?300-p:h==="maybePrepare"&&u?400-p:500:200-p:100-p})(i);if(a===0){try{e()}finally{}return null}return this.tasks[s]={fn:e,metadata:i,priority:a,id:s},this.taskQueue.push(s),this.invoker.trigger(),{cancel:()=>{delete this.tasks[s]}}}process(){try{if(this.taskQueue=this.taskQueue.filter((s=>!!this.tasks[s])),!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()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const h=this.tasks[this.taskQueue[a]];h.priority<i&&(i=h.priority,e=a)}if(e===null)return null;const s=this.taskQueue[e];return this.taskQueue.splice(e,1),s}remove(){this.invoker.remove()}}class gg{constructor(e,i,s){this.target=e,this.parent=i,this.mapId=s,this.callbacks={},this.cancelCallbacks={},bt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new $v}send(e,i,s,a,h=!1,u){const p=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(s.metadata=u,this.callbacks[p]=s);const _=new Set;return this.target.postMessage({id:p,type:e,hasCallback:!!s,targetMapId:a,mustQueue:h,sourceMapId:this.mapId,data:bs(i,_)},_),{cancel:()=>{s&&delete this.callbacks[p],this.target.postMessage({id:p,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const s=i.id;if(s&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[s];delete this.cancelCallbacks[s],a&&a.cancel()}else if(i.mustQueue||gi(self)){const a=this.callbacks[s],h=this.scheduler.add((()=>this.processTask(s,i)),a&&a.metadata||{type:"message"});h&&(this.cancelCallbacks[s]=h)}else this.processTask(s,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const s=this.callbacks[e];delete this.callbacks[e],s&&(i.error?s(an(i.error)):s(null,an(i.data)))}else{const s=new Set,a=i.hasCallback?(u,p)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:u?bs(u):null,data:bs(p,s)},s)}:()=>{},h=an(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,h,a);else if(this.parent.getWorkerSource){const u=i.type.split("."),{source:p,scope:_}=h;this.parent.getWorkerSource(i.sourceMapId,u[0],p,_)[u[1]](h,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Nu={workerUrl:"",workerClass:null,workerParams:void 0};const fm="mapboxgl_preloaded_worker_pool";class kl{constructor(){this.active={}}acquire(e,i=kl.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(Nu.workerClass!=null?new Nu.workerClass:new self.Worker(Nu.workerUrl,Nu.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEac
14h((i=>{i.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[fm]}numActive(){return Object.keys(this.active).length}}kl.workerCount=2;class Xc{constructor(e,i,s="Worker",a=kl.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Pe();const h=this.workerPool.acquire(this.id,a);for(let u=0;u<h.length;u++){const p=new Xc.Actor(h[u],i,this.id);p.name=`${s} ${u}`,this.actors.push(p)}this.ready=!1,this.broadcast("checkIfReady",null,(()=>{this.ready=!0}))}broadcast(e,i,s){he(this.actors,((a,h)=>{a.send(e,i,h)}),s=s||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 Vu,pm;function zf(){return Vu||(Vu=new kl),Vu}Xc.Actor=gg;class Zv{constructor(e){this.module=e}createIntArray(e){const i=new Int32Array(e),s=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heap32.set(i,s/i.BYTES_PER_ELEMENT),s}createFloatArray(e){const i=new Float32Array(e),s=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heapF32.set(i,s/i.BYTES_PER_ELEMENT),s}createStringBuffer(e){const i=this.module.malloc(e.length+1);for(let s=0;s<e.length;++s)this.module.heapU8[i+s]=e.charCodeAt(s);return this.module.heapU8[i+e.length]=0,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.entranceColorRgb,s=e.facadeGlazingColorRgb,a=e.roofColorRgb,h=e.wallColorRgb,u=e.normalScale;this.module.setStyle(i[0],i[1],i[2],s[0],s[1],s[2],a[0],a[1],a[2],h[0],h[1],h[2],u[0],u[1],u[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,s){this.module.setFauxFacadeOptions(e?1:0,i?1:0,s)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){for(const p of e){const _=this.createStringBuffer(p.roofType),g=[0],v=[];for(const I of p.coordinates)if(Array.isArray(I)){for(const A of I)v.push(A.x),v.push(A.y);g.push(v.length)}const b=this.createIntArray(g),w=this.createFloatArray(v);this.module.addFeature(p.id,p.sourceId,p.minHeight,p.height,_,p.roofType.length,w,b,g.length-1),this.module.free(_),this.module.free(b),this.module.free(w)}for(const p of i){let _;_=p.entrances?JSON.parse(p.entrances):[];const g=this.createFloatArray(_),v=[];for(const w of p.coordinates)v.push(w.x),v.push(w.y);const b=this.createFloatArray(v);this.module.addFacade(p.sourceId,p.crossPerc,p.distanceToRoad,g,_.length,b,v.length),this.module.free(g),this.module.free(b)}if(!this.module.generateMesh()){const p=this.module.getLastError();return this.readStringBuffer(p)}const s=this.module.getMeshCount(),a=new Array(s);for(let p=0;p<s;p++){const _=this.module.getPositionsPtr(p),g=this.module.getPositionsLength(p),v=new Float32Array(this.module.heapF32.buffer,_,g),b=this.module.getNormalsPtr(p),w=this.module.getNormalsLength(p),I=new Float32Array(this.module.heapF32.buffer,b,w),A=this.module.getColorsPtr(p),P=this.module.getColorsLength(p),R=new Uint8Array(this.module.heapU8.buffer,A,P),O=this.module.getAOPtr(p),U=this.module.getAOLength(p),V=new Float32Array(this.module.heapF32.buffer,O,U),G=this.module.getUVPtr(p),re=this.module.getUVLength(p),Q=new Float32Array(this.module.heapF32.buffer,G,re),te=this.module.getFauxFacadePtr(p),ae=this.module.getFauxFacadeLength(p),ce=new Uint8Array(this.module.heapU8.buffer,te,ae),Ee=this.module.getIndicesPtr(p),de=this.module.getIndicesLength(p),Ae=new Int32Array(this.module.heap32.buffer,Ee,de),je=this.module.getBuildingPart(p),Ce=this.readStringBuffer(je);a[p]={positions:v,normals:I,colors:R,ao:V,uv:Q,isFauxFacade:ce,indices:Ae,buildingPart:Ce}}const h=this.module.getRingCount(),u=[];for(let p=0;p<h;p++){const _=this.module.getRingPtr(p),g=this.module.getRingLength(p),v=new Float32Array(this.module.heapF32.buffer,_,g);u.push(v)}return{meshes:a,modifiedPolygonRings:u}}}let Uu,mm,Ts,Yc,_m,Kc=null,Jc=null,yg=null,Rf=null;function xg(){return gi(self)&&self.worker.dracoUrl?self.worker.dracoUrl:mm||Ar.DRACO_URL}function vg(){if(gi(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Yc)return Yc;
14const 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 Yc=WebAssembly.validate(r)?Ar.MESHOPT_SIMD_URL:Ar.MESHOPT_URL,Yc}function Wv(){return Rf}const Df={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Xv={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},ju={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function bg(r,e,i){const s=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=s,i.json.bufferViews[s]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const gm="KHR_draco_mesh_compression";function Yv(r,e){const i=r.extensions&&r.extensions[gm];if(!i)return;const s=new Ts.Decoder,a=Eg(e,i.bufferView),h=new Ts.Mesh;if(!s.DecodeArrayToMesh(a,a.byteLength,h))throw new Error("Failed to decode Draco mesh");const u=e.json.accessors[r.indices],p=Df[u.componentType],_=u.count*p.BYTES_PER_ELEMENT,g=Ts._malloc(_);p===Uint16Array?s.GetTrianglesUInt16Array(h,_,g):s.GetTrianglesUInt32Array(h,_,g),bg(Ts.memory.buffer.slice(g,g+_),u,e),Ts._free(g);for(const v of Object.keys(i.attributes)){const b=s.GetAttributeByUniqueId(h,i.attributes[v]),w=e.json.accessors[r.attributes[v]],I=Xv[w.componentType],A=w.count*ju[w.type]*Df[w.componentType].BYTES_PER_ELEMENT,P=Ts._malloc(A);s.GetAttributeDataArrayForAllPoints(h,b,Ts[I],A,P),bg(Ts.memory.buffer.slice(P,P+A),w,e),Ts._free(P)}s.destroy(),h.destroy(),delete r.extensions[gm]}const Lf="EXT_meshopt_compression";function Kv(r,e){if(!r.extensions||!r.extensions[Lf])return;const i=r.extensions[Lf],s=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);_m.decodeGltfBuffer(a,i.count,i.byteStride,s,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[Lf]}const wg=1179937895,Tg=new TextDecoder("utf8");function Sg(r,e){return new URL(r,e).href}function Jv(r,e,i,s){return fetch(Sg(r.uri,s)).then((a=>a.arrayBuffer())).then((a=>{e.buffers[i]=a}))}function Eg(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function Qv(r,e,i,s){if(r.uri){const a=Sg(r.uri,s);return fetch(a).then((h=>h.blob())).then((h=>createImageBitmap(h))).then((h=>{e.images[i]=h}))}if(r.bufferView!==void 0){const a=Eg(e,r.bufferView),h=new Blob([a],{type:r.mimeType});return createImageBitmap(h).then((u=>{e.images[i]=u}))}}function Ig(r,e=0,i){const s={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===wg){const v=new Uint32Array(r,e);let b=2;const w=(v[b++]>>2)-3,I=v[b++]>>2;if(b++,s.json=JSON.parse(Tg.decode(v.subarray(b,b+I))),b+=I,b<w){const A=v[b++];b++;const P=e+(b<<2);s.buffers[0]=r.slice(P,P+A)}}else s.json=JSON.parse(Tg.decode(new Uint8Array(r,e)));const{buffers:a,images:h,meshes:u,extensionsUsed:p,bufferViews:_}=s.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(Jv(w,s,b,i)):s.buffers[b]||(s.buffers[b]=null)}g=Promise.all(v)}return g.then((()=>{const v=[],b=p&&p.includes(gm),w=p&&p.includes(Lf);if(b&&v.push((function(){if(!Ts)return Uu??(Uu=(function(I){let A,P=null;function R(){A=new Uint8Array(P.buffer)}function O(){throw new Error("Unexpected Draco error.")}const U={a:{a:O,d:function(V,G,re){return A.copyWithin(V,G,G+re)},c:function(V){const G=A.length,re=Math.max(V>>>0,Math.ceil(1.2*G)),Q=Math.ceil((re-G)/65536);try{return P.grow(Q),R(),!0}catch{return!1}},b:O}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(I,U):I.then((V=>V.arrayBuffer())).then((V=>WebAssembly.instantiate(V,U)))).then((V=>{const{Rb:G,Qb:re,P:Q,T:te,X:ae,Ja:ce,La:Ee,Qa:de,Va:Ae,Wa:je,eb:Ce,jb:Fe,f:Ve,e:Te,yb:Oe,zb:fe,Ab:Se,Bb:He,Db:Be,Gb:ct}=V.instance.exports;P=Te;const nt=(()=>{let De=0,Ne=0,ot=0,et=0;return Xe=>{ot&&(G(et),G(De),Ne+=ot,ot=De=0),De||(Ne+=128,De=re(Ne));const tt=Xe.length+7&-8;let _t=De;tt>=Ne&&(ot=tt,_t=et=re(tt));for(let Tt=0;Tt<Xe.length;Tt++)A[_t+Tt]=Xe[Tt];return _t}})();return R(),Ve(),{memory:Te,_free:G,_malloc:re,Mesh:class{constructor(){this.ptr=Q()}destroy(){te(this.ptr)}},Decoder:class{constructor(){this.ptr=ce()}destroy(){Fe(this.ptr)}DecodeArrayToMesh(De,Ne,ot){const et=nt(De),Xe=Ee(this.ptr,et,Ne,ot.ptr);return!!ae(Xe)}GetAttributeByUniqueId(De,Ne){return{ptr:de(this.ptr,De.ptr,Ne)}}GetTrianglesUInt16Array(De,Ne,ot){Ae(this.ptr,De.ptr,Ne,ot)}GetTrianglesUInt32Array(De,Ne,ot){je(this.ptr,De.ptr,Ne,ot)}GetAttributeDataArrayForAllPoints(De,Ne,ot,et,Xe){Ce(this.ptr,De.ptr,Ne.ptr,ot,et,Xe)}},DT_INT8:Oe(),DT_UINT8:fe(),DT_INT16:Se(),DT_UINT16:He(),DT_UINT32:Be(),DT_FLOAT32:ct()}}))})(fetch(xg())),Uu.then((I=>{Ts=I,Uu=void 0})))})()),w&&v.push((function(){if(_m)return;const I=(function(A){let P;const R=WebAssembly.instantiateStreaming(A,{}).then((V=>{P=V.instance,P.exports.__wasm_call_ctors()})),O={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},U={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:R,supported:!0,decodeGltfBuffer(V,G,re,Q,te,ae){(function(ce,Ee,de,Ae,je,Ce,Fe){const Ve=ce.exports.sbrk,Te=Ae+3&-4,Oe=Ve(Te*je),fe=Ve(Ce.length),Se=new Uint8Array(ce.exports.memory.buffer);Se.set(Ce,fe);const He=Ee(Oe,Ae,je,fe,Ce.length);if(He===0&&Fe&&Fe(Oe,Te,je),de.set(Se.subarray(Oe,Oe+Ae*je)),Ve(Oe-Ve(0)),He!==0)throw new Error(`Malformed buffer data: ${He}`)})(P,P.exports[U[te]],V,G,re,Q,P.exports[O[ae]])}}})(fetch(vg()));return I.ready.then((()=>{_m=I}))})()),h)for(let I=0;I<h.length;I++)v.push(Qv(h[I],s,I,i));return(v.length?Promise.all(v):Promise.resolve()).then((()=>
vendor: 10,711 bytes, line 14
14{if(b&&u)for(const{primitives:I}of u)for(const A of I)Yv(A,s);if(w&&u&&_)for(const I of _)Kv(I,s);return s}))}))}function ym(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 xm(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 vm{constructor(e,i,s,a){this.context=e,this.format=s,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const s=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:h}=this,{gl:u}=h,{x:p,y:_}=i&&i.position?i.position:{x:0,y:0},g=p+s,v=_+a;!this.size||this.size[0]===g&&this.size[1]===v||(u.bindTexture(u.TEXTURE_2D,null),u.deleteTexture(this.texture),this.texture=u.createTexture(),this.size=null),u.bindTexture(u.TEXTURE_2D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1),h.pixelStoreUnpackPremultiplyAlpha.set(this.format===u.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;u.texStorage2D(u.TEXTURE_2D,w,this.format,g,v),this.size=[g,v]}if(this.size)if(b)u.texSubImage2D(u.TEXTURE_2D,0,p,_,ym(this.format),xm(this.format),e);else{const w=e.data;w&&u.texSubImage2D(u.TEXTURE_2D,0,p,_,s,a,ym(this.format),xm(this.format),w)}this.useMipmap&&u.generateMipmap(u.TEXTURE_2D)}bind(e,i,s=!1){const{context:a}=this,{gl:h}=a;h.bindTexture(h.TEXTURE_2D,this.texture),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap&&!s?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,s,a,h){const{context:u}=this,{gl:p}=u;p.bindTexture(p.TEXTURE_2D,this.texture),i!==this.magFilter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,this.useMipmap?e===p.NEAREST?p.NEAREST_MIPMAP_NEAREST:p.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),s!==this.wrapS&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,s),this.wrapS=s),a!==this.wrapT&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,a),this.wrapT=a),h!==this.compareMode&&(h?(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_COMPARE_MODE,p.COMPARE_REF_TO_TEXTURE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_COMPARE_FUNC,h)):p.texParameteri(p.TEXTURE_2D,p.TEXTURE_COMPARE_MODE,p.NONE),this.compareMode=h)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Gu{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:s}=this,{gl:a}=s;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 e0=$t([{name:"a_pos_3f",components:3,type:"Float32"}]),t0=$t([{name:"a_color_3f",components:3,type:"Float32"}]),i0=$t([{name:"a_color_4f",components:4,type:"Float32"}]),r0=$t([{name:"a_uv_2f",components:2,type:"Float32"}]),n0=$t([{name:"a_normal_3f",components:3,type:"Float32"}]),s0=$t([{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"}]),o0=$t([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Ag(r,e){const i=Ff(r.projection,r.zoom,r.width,r.height),s=(function(h,u,p,_,g){const v=new S(p.lng-180*Pa,p.lat),b=new S(p.lng+180*Pa,p.lat),w=h.project(v.lng,v.lat),I=h.project(b.lng,b.lat),A=-Math.atan2(I.y-w.y,I.x-w.x),P=J.fromLngLat(p);P.y=W(P.y,-1+Pa,1-Pa);const R=P.toLngLat(),O=h.project(R.lng,R.lat),U=J.fromLngLat(R);U.x+=Pa;const V=U.toLngLat(),G=h.project(V.lng,V.lat),re=Cg(G.x-O.x,G.y-O.y,A),Q=J.fromLngLat(R);Q.y+=Pa;const te=Q.toLngLat(),ae=h.project(te.lng,te.lat),ce=Cg(ae.x-O.x,ae.y-O.y,A),Ee=Math.abs(re.x)/Math.abs(ce.y),de=Bt([]);Ms(de,de,-A*(1-(g?0:_)));const Ae=Bt([]);return Fr(Ae,Ae,[1,1-(1-Ee)*_,1]),Ae[4]=-ce.x/ce.y*_,Ms(Ae,Ae,A),Gi(Ae,de,Ae),Ae})(r.projection,0,r.center,i,e),a=Mg(r);return Fr(s,s,[a,a,1]),s}function Mg(r){const e=r.projection,i=Ff(r.projection,r.zoom,r.width,r.height),s=bm(e,r.center),a=bm(e,S.convert(e.center));return Math.pow(2,s*i+(1-i)*a)}function Ff(r,e,i,s,a=1/0){const h=r.range;if(!h)return 0;const u=Math.min(a,Math.max(i,s)),p=Math.log(u/1024)/Math.LN2;return le(h[0]+p,h[1]+p,e)}const Pa=1/4e4;function bm(r,e){const i=W(e.lat,-X,X),s=new S(e.lng-180*Pa,i),a=new S(e.lng+180*Pa,i),h=r.project(s.lng,i),u=r.project(a.lng,i),p=J.fromLngLat(s),_=J.fromLngLat(a),g=u.x-h.x,v=u.y-h.y,b=_.x-p.x,w=_.y-p.y,I=Math.sqrt((b*b+w*w)/(g*g+v*v));return Math.log(I)/Math.LN2}function Cg(r,e,i){const s=Math.cos(i),a=Math.sin(i);return{x:r*s-e*a,y:r*a+e*s}}function Pg(r,e,i){Bt(r),Ms(r,r,ei(e[2])),As(r,r,ei(e[0])),ls(r,r,ei(e[1])),Fr(r,r,i),Gi(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Of(r,e,i,s,a,h,u,p){const _=[i[0]-e[0],i[1]-e[1],0],g=[s[0]-e[0],s[1]-e[1],0];if(Cr(_)<1e-12||Cr(g)<1e-12)return ds(r);const v=cr([],_,g);Ri(v,v),cn(g,s,e),_[2]=(h-a)*p,g[2]=(u-a)*p;const b=_;return cr(b,_,g),Ri(b,b),Uo(r,v,b)}function wm(r,e,i=!1){const s=Aa(e.zoom),a=(function(h,u,p){const _=u.worldSize,g=[h[12],h[13],h[14]],v=j(g[1]/_),b=N(g[0]/_),w=Bt([]),I=L(1,v)*_,A=L(1,0)*_*ie(v,u.zoom),P=1/Yp(_);let R=A*P;if(p){const G=Ff(u.projection,u.zoom,u.width,u.height,1024);R=P*u.projection.pixelSpaceConversion(u.center.lat,_,G)}const O=y(v,b);ki(O,O,Fi([],Ri([],O),I*R*g[2]));const U=(function(G){const re=[G[0],G[1],G[2]];let Q=[0,1,0];const te=cr([],Q,re);return cr(Q,re,te),ql(Q)===0&&(Q=[0,1,0],cr(te,re,Q)),Ri(te,te),Ri(Q,Q),Ri(re,re),[te[0],te[1],te[2],0,Q[0],Q[1],Q[2],0,re[0],re[1],re[2],0,G[0],G[1],G[2],1]})(O);Fr(w,w,[R,R,R*I]),qr(w,w,[-g[0],-g[1],-g[2]]);const V=Gi([],u.globeMatrix,U);return Gi(V,V,w),Gi(V,V,h),V})(r,e,i);if(s>0){const h=(function(u,p){const _=p.worldSize,g=L(1,0)*_*ie(p.center.lat,p.zoom)/Yp(_),v=L(1,p.center.lat)*_,b=Bt([]);return ls(b,b,ei(p.center.lng)),As(b,b,ei(p.center.lat)),qr(b,b,[0,0,Ur]),Fr(b,b,[g,g,g*v]),qr(b,b,[p.point.x-.5*_,p.point.y-.5*_,0]),Gi(b,b,u),Gi(b,p.globeMatrix,b)})(r,e);return(function(u,p,_){const g=(A,P,R)=>{const O=Cr(A),U=Cr(P),V=Fo(A,P,R);return Fi(V,V,1/Cr(V)*pt(O,U,R))},v=g([u[0],u[1],u[2]],[p[0],p[1],p[2]],_),b=g([u[4],u[5],u[6]],[p[4],p[5],p[6]],_),w=g([u[8],u[9],u[10]],[p[8],p[9],p[10]],_),I=Fo([u[12],u[13],u[14]],[p[12],p[13],p[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,h,s)}return a}function zg(r,e,i,s){const a=kt.projectAabbCorners(s,i);let h=Number.MAX_VALUE,u=-1;for(let g=0;g<a.length;++g){const v=a[g];v[0]=(.5*v[0]+.5)*e.width,v[1]=(.5-.5*v[1])*e.height,v[2]<h&&(u=g,h=v[2])}const p=g=>new ke(a[g][0],a[g][1]);let _;switch(u){case 0:case 6:_=[p(1),p(5),p(4),p(7),p(3),p(2),p(1)];break;case 1:case 7:_=[p(0),p(4),p(5),p(6),p(2),p(3),p(0)];break;case 3:case 5:_=[p(1),p(0),p(4),p(7),p(6),p(2),p(1)];break;default:_=[p(1),p(5),p(6),p(7),p(3),p(0),p(1)]}if(yi(r,_))return h}const Bl=64,Qc={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Rg(r,e,i,s,a,h,u,p,_,g=!1){const v=i.zoom,b=i.project(s),w=ie(s.lat,v),I=1/w;Bt(r),qr(r,r,[b.x+u[0]*I,b.y+u[1]*I,u[2]]);let A=1,P=1;const R=i.worldSize;if(g){if(i.projection.name==="mercator"){let G=0;i.elevation&&(G=i.elevation.getAtPointOrZero(new J(b.x/R,b.y/R),0));const re=hn([],[b.x,b.y,G,1],i.projMatrix)[3]/i.cameraToCenterDistance;A=re,P=re*ie(i.center.lat,v)}else if(i.projection.name==="globe"){const G=wm(r,i),re=[0,0,0,1];hn(re,re,Gi([],i.projMatrix,G));const Q=re[3]/i.cameraToCenterDistance,te=Aa(v),ae=i.projection.pixelsPerMeter(s.lat,R)*ie(s.lat,v),ce=i.projection.pixelsPerMeter(i.center.lat,R)*ie(i.center.lat,v);A=Q/pt(ae,ee(i.center.lat),te),P=Q*w/ae,A*=ce,P*=ce}}else A=I;Fr(r,r,[A,A,P]);const O=[...r],U=e.orientation,V=[];if(Pg(V,[U[0]+a[0],U[1]+a[1],U[2]+a[2]],h),Gi(r,O,V),p&&i.elevation){let G=0;const re=[];if(_&&i.elevation){G=(function(te,ae,ce,Ee,de){const Ae=ae.elevation;if(!Ae)return 0;const je=kt.projectAabbCorners(ce,Ee),Ce=L(1,de.lat)*ae.worldSize,Fe=(function(Ne,ot){const et=[0,0,1],Xe=[{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 tt of Xe){const _t=Ne[tt.corners[0]],Tt=Ne[tt.corners[1]],Mt=Ne[tt.corners[2]],It=[Tt[0]-_t[0],Tt[1]-_t[1],ot*(Tt[2]-_t[2])],qt=cr(It,It,[Mt[0]-_t[0],Mt[1]-_t[1],ot*(Mt[2]-_t[2])]);Ri(qt,qt),tt.dotProductWithUp=er(qt,et)}return Xe.sort(((tt,_t)=>tt.dotProductWithUp-_t.dotProductWithUp)),Xe[0].corners})(je,Ce),Ve=je[Fe[0]],Te=je[Fe[1]],Oe=je[Fe[2]],fe=je[Fe[3]],Se=Ae.getAtPointOrZero(new J(Ve[0]/ae.worldSize,Ve[1]/ae.worldSize),0),He=Ae.getAtPointOrZero(new J(Te[0]/ae.worldSize,Te[1]/ae.worldSize),0),Be=Ae.getAtPointOrZero(new J(Oe[0]/ae.worldSize,Oe[1]/ae.worldSize),0),ct=Ae.getAtPointOrZero(new J(fe[0]/ae.worldSize,fe[1]/ae.worldSize),0),nt=(Se+ct)/2,De=(He+Be)/2;return nt>De?He<Be?Of(te,Te,fe,Ve,He,ct,Se,Ce):Of(te,Oe,Ve,fe,Be,Se,ct,Ce):Se<ct?Of(te,Ve,Te,Oe,Se,He,Be,Ce):Of(te,fe,Oe,Te,ct,Be,He,Ce),Math.max(nt,De)})(re,i,e.aabb,r,s);const Q=Gi([],Cs([],re),V);Gi(r,O,Q)}else G=i.elevation.getAtPointOrZero(new J(b.x/R,b.y/R),0);G!==0&&(r[14]+=G)}}function qu(r,e,i=!1){r.uploaded||(r.gfxTexture=new vm(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)}
14function a0(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,e0.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,n0.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,r0.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?t0:i0).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,o0.members,!0)),r.segments=Ni.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const s=r.material;s.pbrMetallicRoughness.baseColorTexture&&qu(s.pbrMetallicRoughness.baseColorTexture,e),s.pbrMetallicRoughness.metallicRoughnessTexture&&qu(s.pbrMetallicRoughness.metallicRoughnessTexture,e),s.normalTexture&&qu(s.normalTexture,e),s.occlusionTexture&&qu(s.occlusionTexture,e,i),s.emissionTexture&&qu(s.emissionTexture,e)}function Tm(r,e,i){if(r.meshes)for(const s of r.meshes)a0(s,e,i);if(r.children)for(const s of r.children)Tm(s,e,i)}function kf(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)kf(e)}function Sm(r){if(r.meshes)for(const i of r.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(r.children)for(const i of r.children)Sm(i)}function Nl(r,e){const i=r.json.bufferViews[e.bufferView],s=Df[e.componentType];return new s(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==ju[e.type]*s.BYTES_PER_ELEMENT?i.byteStride/s.BYTES_PER_ELEMENT:ju[e.type]))}function Em(r,e,i,s){const a=Df[e.componentType],h=(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),u=r.json.bufferViews[e.bufferView],p=u.byteStride?u.byteStride/a.BYTES_PER_ELEMENT:ju[e.type],_=i.float32,g=_.length/i.capacity;for(let v=0,b=0;v<e.count*p;v+=p,b+=g)for(let w=0;w<g;w++)_[b+w]=s[v+w]*h;i._trim()}function l0(r,e,i){const s=r.indices,a=r.attributes,h={};h.indexArray=new Li;const u=e.json.accessors[s],p=u.count/3;h.indexArray.reserve(p);const _=Nl(e,u);for(let w=0;w<p;w++)h.indexArray.emplaceBack(_[3*w],_[3*w+1],_[3*w+2]);h.indexArray._trim(),h.vertexArray=new En;const g=e.json.accessors[a.POSITION];h.vertexArray.reserve(g.count);const v=Nl(e,g);for(let w=0;w<g.count;w++)h.vertexArray.emplaceBack(v[3*w],v[3*w+1],v[3*w+2]);if(h.vertexArray._trim(),h.aabb=new kt(g.min,g.max),h.centroid=(function(w,I){const A=[0,0,0],P=w.length;if(P>0){for(let R=0;R<P;R++){const O=3*w[R];A[0]+=I[O],A[1]+=I[O+1],A[2]+=I[O+2]}A[0]/=P,A[1]/=P,A[2]/=P}return A})(_,v),a.COLOR_0!==void 0){const w=e.json.accessors[a.COLOR_0],I=ju[w.type],A=Nl(e,w);h.colorArray=I===3?new En:new to,h.colorArray.resize(w.count),Em(e,w,h.colorArray,A)}if(a.NORMAL!==void 0){h.normalArray=new En;const w=e.json.accessors[a.NORMAL];h.normalArray.resize(w.count);const I=Nl(e,w);Em(e,w,h.normalArray,I)}if(a.TEXCOORD_0!==void 0&&i.length>0){h.texcoordArray=new io;const w=e.json.accessors[a.TEXCOORD_0];h.texcoordArray.resize(w.count);const I=Nl(e,w);Em(e,w,h.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")&&(h.featureData=Nl(e,w))}a._FEATURE_RGBA4444!==void 0&&(h.featureData=new Uint32Array(Nl(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const b=r.material;return h.material=(function(w,I){const{emissiveFactor:A=[0,0,0],alphaMode:P="OPAQUE",alphaCutoff:R=.5,normalTexture:O,occlusionTexture:U,emissiveTexture:V,doubleSided:G}=w,{baseColorFactor:re=[1,1,1,1],metallicFactor:Q=1,roughnessFactor:te=1,baseColorTexture:ae,metallicRoughnessTexture:ce}=w.pbrMetallicRoughness||{},Ee=U?I[U.index]:void 0;if(U&&U.extensions&&U.extensions.KHR_texture_transform&&Ee){const de=U.extensions.KHR_texture_transform;Ee.offsetScale=[de.offset[0],de.offset[1],de.scale[0],de.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new li(...re),metallicFactor:Q,roughnessFactor:te,baseColorTexture:ae?I[ae.index]:void 0,metallicRoughnessTexture:ce?I[ce.index]:void 0},doubleSided:G,emissiveFactor:new li(...A),alphaMode:P,alphaCutoff:R,normalTexture:O?I[O.index]:void 0,occlusionTexture:Ee,emissionTexture:V?I[V.index]:void 0,defined:w.defined===void 0}})(b!==void 0?e.json.materials[b]:{defined:!1},i),h}function Dg(r,e,i){const{matrix:s,rotation:a,translation:h,scale:u,mesh:p,extras:_,children:g}=r,v={};if(v.matrix=s||(function(b,w,I,A){var P=w[0],R=w[1],O=w[2],U=w[3],V=P+P,G=R+R,re=O+O,Q=P*V,te=P*G,ae=P*re,ce=R*G,Ee=R*re,de
vendor: 5,161 bytes, line 14
14=O*re,Ae=U*V,je=U*G,Ce=U*re,Fe=A[0],Ve=A[1],Te=A[2];return b[0]=(1-(ce+de))*Fe,b[1]=(te+Ce)*Fe,b[2]=(ae-je)*Fe,b[3]=0,b[4]=(te-Ce)*Ve,b[5]=(1-(Q+de))*Ve,b[6]=(Ee+Ae)*Ve,b[7]=0,b[8]=(ae+je)*Te,b[9]=(Ee-Ae)*Te,b[10]=(1-(Q+ce))*Te,b[11]=0,b[12]=I[0],b[13]=I[1],b[14]=I[2],b[15]=1,b})([],a||[0,0,0,1],h||[0,0,0],u||[1,1,1]),p!==void 0){v.meshes=i[p];const b=v.anchor=[0,0];for(const w of v.meshes){const{min:I,max:A}=w.aabb;b[0]+=I[0]+A[0],b[1]+=I[1]+A[1]}b[0]=Math.floor(b[0]/v.meshes.length/2),b[1]=Math.floor(b[1]/v.meshes.length/2)}if(_&&(_.id&&(v.id=_.id),_.lights&&(v.lights=(function(b){if(!b.length)return[];const w=(function(O){const U=atob(O),V=new Uint8Array(U.length);for(let G=0;G<U.length;G++)V[G]=U.codePointAt(G);return V})(b),I=[],A=w.length/24,P=new Uint16Array(w.buffer),R=new Float32Array(w.buffer);for(let O=0;O<A;O++){const U=P[2*O*6]/30,V=P[2*O*6+1]/30,G=P[2*O*6+10]/100,re=R[6*O+1],Q=R[6*O+2],te=R[6*O+3],ae=R[6*O+4],ce=te-re,Ee=ae-Q,de=Math.hypot(ce,Ee);I.push({pos:[re+.5*ce,Q+.5*Ee,V],normal:[Ee/de,-ce/de,0],width:de,height:U,depth:G,points:[re,Q,te,ae]})}return I})(_.lights))),g){const b=[];for(const w of g)b.push(Dg(e.json.nodes[w],e,i));v.children=b}return v}function c0(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new Ef(r.vertices,r.indices,8,256),[i,s]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:s}}function h0(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 s=[];for(const u of i){if(!Array.isArray(u)||u.length!==2)continue;const p=u[0],_=u[1];typeof p=="number"&&typeof _=="number"&&s.push(new ke(p,_))}if(s.length<3)return null;s.length>1&&s[s.length-1].equals(s[0])&&s.pop();let a=0;for(let u=0;u<s.length;u++){const p=s[u],_=s[(u+1)%s.length],g=s[(u+2)%s.length];a+=(p.x-_.x)*(g.y-_.y)-(g.x-_.x)*(p.y-_.y)}a>0&&s.reverse();const h=Zc(s.flatMap((u=>[u.x,u.y])),[]);return h.length===0?null:{vertices:s,indices:h}}function u0(r,e){const i=[],s=[];let a=0;const h=[];for(const u of r){a=i.length;const p=u.vertexArray.float32,_=u.indexArray.uint16;for(let g=0;g<u.vertexArray.length;g++)h[0]=p[3*g+0],h[1]=p[3*g+1],h[2]=p[3*g+2],tr(h,h,e),i.push(new ke(h[0],h[1]));for(let g=0;g<3*u.indexArray.length;g++)s.push(_[g]+a)}if(s.length%3!=0)return null;for(let u=0;u<s.length;u+=3){const p=i[s[u+0]],_=i[s[u+1]],g=i[s[u+2]];(p.x-_.x)*(g.y-_.y)-(g.x-_.x)*(p.y-_.y)>0&&([s[u+1],s[u+2]]=[s[u+2],s[u+1]])}return{vertices:i,indices:s}}function Lg(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(l0(I,_,g));v.push(w)}return v})(r,e),{scenes:s,scene:a,nodes:h}=r.json,u=s?s[a||0].nodes:h,p=[];for(const _ of u)p.push(Dg(h[_],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 P=A.extras["mapbox:footprint:version"],R=A.extras["mapbox:footprint:id"];(P||R)&&w.add(I),P==="1.0.0"&&R&&(b[R]=I)}for(let I=0;I<_.length;I++){if(w.has(I))continue;const A=_[I],P=v[g[I]];if(!P.extras)continue;let R=null;A.id in b&&(R=u0(_[b[A.id]].meshes,A.matrix)),R||(R=h0(P)),R&&(A.footprint=c0(R))}if(w.size>0){const I=Array.from(w.values()).sort(((A,P)=>A-P));for(let A=I.length-1;A>=0;A--)_.splice(I[A],1)}})(p,u,r.json.nodes),p}function d0(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,s=r.aabb.min[1]-1,a=Bl/(r.aabb.max[0]-i+2),h=Bl/(r.aabb.max[1]-s+2);for(let u=0;u<e.length;u+=3){const p=e[u+2],_=(e[u+0]-i)*a|0,g=(e[u+1]-s)*h|0;p>r.heightmap[g*Bl+_]&&(r.heightmap[g*Bl+_]=p)}}function Fg(r,e,i,s,a){i.reserve(i.length+4*r.length),s.reserve(s.length+10*r.length),a.reserve(a.length+10*r.length);let h=s.length;for(const u of r){const p=Math.min(10,Math.max(4,1.3*u.height))*e,_=[-u.normal[1],u.normal[0],0],g=Math.min(.29,.1*u.width/u.depth),v=u.width-2*u.depth*e*(g+.01),b=Hr([],u.pos,_,v/2),w=Hr([],u.pos,_,-v/2),I=[b[0],b[1],b[2]+u.height],A=[w[0],w[1],w[2]+u.height],P=Hr([],u.normal,_,g);Fi(P,P,p);const R=Hr([],u.normal,_,-g);Fi(R,R,p),ki(P,b,P),ki(R,w,R),b[2]+=.1,w[2]+=.1,s.emplaceBack(P[0],P[1],P[2]),s.emplaceBack(R[0],R[1],R[2]),s.emplaceBack(b[0],b[1],b[2]),s.emplaceBack(w[0],w[1],w[2]),s.emplaceBack(I[0],I[1],I[2]),s.emplaceBack(A[0],A[1],A[2]),s.emplaceBack(b[0],b[1],b[2]),s.emplaceBack(w[0],w[1],w[2]),s.emplaceBack(P[0],P[1],P[2]),s.emplaceBack(R[0],R[1],R[2]);const O=v/p/2;a.emplaceBack(-O-g,-1,O,.8),a.emplaceBack(O+g,-1,O,.8),a.emplaceBack(-O,0,O,1.3),a.emplaceBack(O,0,O,1.3),a.emplaceBack(O+g,-.8,O,.7),a.emplaceBack(O+g,-.8,O,.7),a.emplaceBack(0,0,O,1.3),a.emplaceBack(0,0,O,1.3),a.emplaceBack(O+g,-1.2,O,.8),a.emplaceBack(O+g,-1.2,O,.8),i.emplaceBack(6+h,4+h,8+h),i.emplaceBack(7+h,9+h,5+h
14),i.emplaceBack(0+h,1+h,2+h),i.emplaceBack(1+h,3+h,2+h),h+=10}}function f0(r,e){const i={};i.indexArray=new Li,i.vertexArray=new En,i.colorArray=new to,Fg(r,e,i.indexArray,i.vertexArray,i.colorArray);const s={defined:!0};s.emissiveFactor=li.black;const a={};return a.baseColorFactor=li.white,s.pbrMetallicRoughness=a,i.material=s,i.aabb=new kt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const Og=$t([{name:"a_pos_3f",components:3,type:"Float32"}]),p0=$t([{name:"a_normal_3",components:3,type:"Int16"}]),kg=$t([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),m0=$t([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),Bg=_e.types,Im=32767;function _0(r,e){const i=We+e;for(const s of r)for(const a of s)if(a.x<-e||a.x>i||a.y<-e||a.y>i)return!1;return!0}class Ng{constructor(e){this.layoutAOArray=[],this.indexArrayForConflationUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],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.layoutVertexArray=new En,this.layoutNormalArray=new ma,this.layoutColorArray=new is,this.indexArray=new Li,this.indexArrayForConflation=new Li,this.entranceBloom={layoutVertexArray:new En,layoutVertexBuffer:null,layoutAttenuationArray:new to,layoutAttenuationBuffer:null,layoutColorArray:new is,layoutColorBuffer:null,indexArray:new Li,indexArrayForConflation:new Li,indexBuffer:null,segmentsBucket:new Ni},this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.segmentsBucket=new Ni,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.projection=e.projection,this.groundEffect=new um(e)}get segments(){return this.segmentsBucket}get bloomGeometry(){return this.entranceBloom}updateFootprints(e,i){for(const s of this.footprints)i.push({footprint:s,id:e})}prepare(){return(function(){if(Rf!=null||yg!=null)return null;if(Jc!=null)return Jc;const e=fetch(Ar.BUILDING_GEN_URL);return Jc=(function(i){let s,a,h,u;function p(){s=new Uint8Array(u.buffer),a=new Int32Array(u.buffer),h=new Float32Array(u.buffer)}function _(){throw new Error("Unexpected BuildingGen error.")}const g=()=>{},v={a:{a:_,f:function(b){const w=s.length,I=Math.max(b>>>0,Math.ceil(1.2*w)),A=Math.ceil((I-w)/65536);try{return u.grow(A),p(),!0}catch{return!1}},g:_,b:g,c:g,d:g,e:g}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,v):i.then((b=>b.arrayBuffer())).then((b=>WebAssembly.instantiate(b,v)))).then((b=>{const w=b.instance.exports;return(0,w.g)(),u=w.f,p(),new Zv({setStyle:w.h,setAOOptions:w.i,setMetricOptions:w.j,setStructuralOptions:w.k,setFacadeOptions:w.l,setFauxFacadeOptions:w.m,setFacadeClassifierOptions:w.n,addFeature:w.o,addFacade:w.p,generateMesh:w.q,getLastError:w.r,getMeshCount:w.s,getPositionsPtr:w.t,getPositionsLength:w.u,getNormalsPtr:w.v,getNormalsLength:w.w,getColorsPtr:w.x,getColorsLength:w.y,getAOPtr:w.z,getAOLength:w.A,getUVPtr:w.B,getUVLength:w.C,getFauxFacadePtr:w.D,getFauxFacadeLength:w.E,getIndicesPtr:w.F,getIndicesLength:w.G,getBuildingPart:w.H,getRingCount:w.I,getRingPtr:w.J,getRingLength:w.K,free:w.L,malloc:w.M,heapU8:s,heap32:a,heapF32:h})}))})(e).then((i=>(Jc=null,Rf=i,Rf))).catch((i=>{Gt("Could not load building-gen"),Jc=null,yg=i})),Jc})()}populate(e,i,s,a){const h=Wv();if(!h)return;const u=K(s);this.tileToMeter=u,this.brightness=i.brightness,h.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,u],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:u,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),h.setAOOptions(!1,.3),h.setMetricOptions(!1,16),h.setStructuralOptions(!0),h.setFacadeOptions(4,!0),h.setFauxFacadeOptions(!1,!1,1),h.setFacadeClassifierOptions(3);const p=new Map;for(const{feature:_}of e){if(Bg[_.type]!=="LineString")continue;const g=this.layers[0]._featureFilter.needGeometry,v=we(_,g);if(!this.layers[0]._featureFilter.filter(new pi(this.zoom),v,s))continue;const b=g?v.geometry:se(_,s,a),w=[];for(const R of b)for(const O of R)w.push({x:O.x,y:O.y});const I={coordinates:w,crossPerc:_.properties.cross_perc,distanceToRoad:_.properties.distance_to_road,entrances:_.properties.entrances,sourceId:0},A=_.properties.source_id;let P=p.get(A);P||(P=[],p.set(A,P)),P.push(I)}this.maxHeight=0;for(const{feature:_,index:g}of e){if(Bg[_.type]==="LineString")continue;const v=this.layers[0]._featureFilter.needGeometry,b=we(_,v);if(!this.layers[0]._featureFilter.filter(new pi(this.zoom),b,s))continue;const w=v?b.geometry:se(_,s,a),I=Du(w,500);if(!_0(w,163))continue;const A=this.layers[0],P=A.layout.get("building-base").evaluate(_,{},s),R=A.layout.get("building-height").evaluate(_,{},s),O=A.layout.get("building-roof-shape").evaluate(_,{},s),U=A.paint.get("building-ambient-occlusion-intensity"),V=A.paint.get("building-ambient-occlusion-ground-radius")/this.tileToMeter;if(O==="flat")continue;const G=_.properties.source_id;let re;re=p.has(G)?p.get(G):[];const Q=[],te=new ke(1/0,1/0),ae=new ke(-1/0,-1/0);for(const De of I)if(De.length>0){const Ne=[];for(const ot of De){const et=[];for(let Xe=ot.length-1;Xe>=0;Xe--){const tt=ot[Xe];et.push({x:tt.x,y:tt.y}),te.x=Math.min(te.x,tt.x),te.y=Math.min(te.y,tt.y),ae.x=Math.max(ae.x,tt.x),ae.y=Math.max(ae.y,tt.y)}Ne.push(et)}Q.push({id:_.id,height:R,minHeight:P,sourceId:0,roofType:O,coordinates:Ne})}const ce=h.generateMesh(Q,re);if(typeof ce=="string"||ce.meshes.length===0||ce.modifiedPolygonRings.length===0)continue;let Ee=0;for(const De of ce.meshes)Ee+=De.positions.length/3;const de=this.segmentsBucket.prepareSegment(Ee,this.layoutVertexArray,this.indexArray),Ae=[];let je=null,Ce=0,Fe=-1;const Ve=this.indexArray.length;let Te=0;for(const De of ce.meshes){const Ne=this.layoutVertexArray.length;if(De.buildingPart==="entrance"){const et=new Array;for(let Tt=0;Tt<De.indices.length;Tt+=12){const Mt=De.positions[Tt+0],It=De.positions[Tt+1],qt=De.positions[Tt+3],Lt=De.positions[Tt+4],Ii=De.positions[Tt+2],H=De.positions[Tt+8]-Ii,$=1,be=qt-Mt,$e=Lt-It,Ke=Math.hypot(be,$e);et.push({pos:[Mt+.5*be,It+.5*$e,Ii],normal:[$e/Ke,-be/Ke,0],width:Ke,height:H,depth:$,points:[Mt,It,qt,Lt]})}const Xe=this.entranceBloom.segmentsBucket.prepareSegment(10*et.length,this.entranceBloom.layoutVertexArray,this.entranceBloom.indexArray),tt=this.entranceBloom.layoutVertexArray.length;Ce=this.entranceBloom.indexArray.length,Fg(et,.5/this.tileToMeter,this.entranceBloom.indexArray,this.entranceBloom.layoutVertexArray,this.entranceBloom.layoutAttenuationArray);const _t=this.entranceBloom.layoutVertexArray.length-tt;Fe=this.entranceBloom.indexArray.length-Ce;for(let Tt=0;Tt<_t;Tt++)this.entranceBloom.layoutColorArray.emplaceBack(65535,65535);Xe.vertexLength+=_t,Xe.primitiveLength+=Fe,je={part:De.buildingPart,vertexOffset:tt,vertexLength:_t}}for(let et=0;et<De.positions.length;et+=3)Te=Math.max(Te,De.positions[et+2]),this.layoutVertexArray.emplaceBack(De.positions[et],De.positions[et+1],De.positions[et+2]);for(let et=0;et<De.normals.length;et+=3)this.layoutNormalArray.emplaceBack(De.normals[et+0]*Im,De.normals[et+1]*Im,De.normals[et+2]*Im);for(let et=0;et<De.ao.length;et++)this.layoutAOArray.push(De.ao[et]);for(let et=0;et<De.colors.length;et+=3){const Xe=1+(De.ao[et/3]-1)*U;this.layoutColorArray.emplaceBack(De.colors[et]*Xe<<8|De.colors[et+1]*Xe,De.colors[et+2]*Xe<<8)}const ot=de.vertexLength;for(let et=0;et<De.indices.length;et+=3)this.indexArray.emplaceBack(ot+De.indices[et],ot+De.indices[et+1],ot+De.indices[et+2]);de.vertexLength+=De.positions.length/3,de.primitiveLength+=De.indices.length/3,(De.buildingPart==="roof"||De.buildingPart==="wall"||De.buildingPart==="facade_glazing"||De.buildingPart==="entrance")&&Ae.push({part:De.buildingPart,vertexOffset:Ne,vertexLength:De.positions.length/3})}this.maxHeight=Math.max(this.maxHeight,Te),this.buildingFeatures.push({feature:b,segment:de,parts:Ae,buildingBloom:je});const Oe=this.indexArray.length-Ve,fe=[],Se=[],He=new ke(1/0,1/0),Be=new ke(-1/0,-1/0),ct=this.groundEffect.vertexArray.length;for(const De of ce.modifiedPolygonRings){const Ne=[],ot=new ke(1/0,1/0),et=new ke(-1/0,-1/0);for(let Xe=0;Xe<De.length;Xe+=2){const tt=De.length-Xe-2;ot.x=Math.min(ot.x,De[tt]),ot.y=Math.min(ot.y,De[tt+1]),et.x=Math.max(et.x,De[tt]),et.y=Math.max(et.y,De[tt+1]);const _t=new ke(De[tt],De[tt+1]);Ne.push(_t),fe.push(_t.x,_t.y),Se.push(_t.clone())}He.x=Math.min(He.x,ot.x),He.y=Math.min(He.y,ot.y),Be.x=Math.max(Be.x,et.x),Be.y=Math.max(Be.y,et.y),this.groundEffect.addData(Ne,[ot,et],V)}const nt=this.groundEffect.vertexArray.length-ct;(te.x<0||ae.x>We||te.y<0||ae.y>We)&&this.featuresOnBorder.push({featureId:_.id,footprintIndex:this.footprints.length});{const De=Zc(fe,null,2),Ne=new Ef(Se,De,8,256);let ot=_.id;_.properties&&_.properties.hasOwnProperty("building_id")&&(ot=_.properties.building_id),this.footprints.push({vertices:Se,indices:De,grid:Ne,min:He,max:Be,buildingId:ot,hiddenFlags:0,indicesOffset:Ve,indicesLength:Oe,bloomIndicesOffset:Ce,bloomIndicesLength:Fe,groundEffectVertexOffset:ct,groundEffectVertexLength:nt,segment:de,height:Te})}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,_,g,{},i.availableImages,s,i.brightness),this.groundEffect.addPaintPropertiesData(_,g,{},i.availableImages,s,i.brightness)}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0])}update(e,i,s,a,h,u,p){this.programConfigurations.updatePaintArrays(e,i,h,s,a,u,p),this.groundEffect.update(e,i,h,s,a,u,p)}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,Og.members),this.layoutNormalBuffer=e.createVertexBuffer(this.layoutNormalArray,p0.members),this.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(this.entranceBloom.layoutVertexArray,Og.members),this.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(this.entranceBloom.layoutAttenuationArray,m0.members),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.layoutNormalBuffer.destroy(),this.layoutColorBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segmentsBucket.destroy(),this.entranceBloom.layoutVertexBuffer.destroy(),this.entranceBloom.layoutColorBuffer.destroy(),this.entranceBloom.layoutAttenuationBuffer.destroy(),this.entranceBloom.indexBuffer.destroy(),this.entranceBloom.segmentsBucket.destroy())}updateFootprintHiddenFlags(e,i,s=!0){let a=!1;const h=s?i:0,u=0|(s?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const p of e){const _=this.footprints[p],g=_.hiddenFlags&u|h;_.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),
14!this.indexArrayForConflationUploaded&&this.indexArray.length!==0){this.indexArrayForConflation.resize(this.indexArray.length),this.indexArrayForConflation.uint16.set(this.indexArray.uint16),this.entranceBloom.indexArrayForConflation.resize(this.entranceBloom.indexArray.length),this.entranceBloom.indexArrayForConflation.uint16.set(this.entranceBloom.indexArray.uint16);for(const i of this.footprints){const s=i.indicesOffset+i.indicesLength;if(i.hiddenFlags!==0){for(let h=i.indicesOffset;h<s;h++)this.indexArrayForConflation.uint16[3*h+0]=0,this.indexArrayForConflation.uint16[3*h+1]=0,this.indexArrayForConflation.uint16[3*h+2]=0;const a=i.bloomIndicesOffset+i.bloomIndicesLength;for(let h=i.bloomIndicesOffset;h<a;h++)this.entranceBloom.indexArrayForConflation.uint16[3*h+0]=0,this.entranceBloom.indexArrayForConflation.uint16[3*h+1]=0,this.entranceBloom.indexArrayForConflation.uint16[3*h+2]=0}}this.indexBuffer?this.indexBuffer.updateData(this.indexArrayForConflation):this.indexBuffer=e.createIndexBuffer(this.indexArrayForConflation,!0),this.entranceBloom.indexBuffer?this.entranceBloom.indexBuffer.updateData(this.entranceBloom.indexArrayForConflation):this.entranceBloom.indexBuffer=e.createIndexBuffer(this.entranceBloom.indexArrayForConflation,!0),this.indexArrayForConflationUploaded=!0}}uploadUpdatedColorBuffer(e){this.layoutColorBuffer?this.layoutColorBuffer.updateData(this.layoutColorArray):this.layoutColorBuffer=e.createVertexBuffer(this.layoutColorArray,kg.members,!0),this.entranceBloom.layoutColorBuffer?this.entranceBloom.layoutColorBuffer.updateData(this.entranceBloom.layoutColorArray):this.entranceBloom.layoutColorBuffer=e.createVertexBuffer(this.entranceBloom.layoutColorArray,kg.members,!0)}evaluate(e){const i=e.paint.get("building-ambient-occlusion-intensity");for(const s of this.buildingFeatures){const a=s.feature;a.properties["building-part"]="roof";const h=e.paint.get("building-color").evaluate(a,{},this.canonical),u=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="wall";const p=e.paint.get("building-color").evaluate(a,{},this.canonical),_=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="window";const g=e.paint.get("building-color").evaluate(a,{},this.canonical),v=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="door";const b=e.paint.get("building-color").evaluate(a,{},this.canonical),w=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);for(const A of s.parts){let P,R=h;A.part==="roof"?(R=h,P=u):A.part==="wall"?(R=p,P=_):A.part==="facade_glazing"?(R=g,P=v):A.part==="entrance"&&(R=b,P=w),P=W(P,0,1);for(let O=0;O<A.vertexLength;O++){const U=A.vertexOffset+O,V=1+(this.layoutAOArray[U]-1)*i;this.layoutColorArray.emplace(U,R.r*V*255<<8|R.g*V*255,R.b*V*255<<8|255*P)}}const I=s.buildingBloom;if(I)for(let A=0;A<I.vertexLength;A++)this.bloomGeometry.layoutColorArray.emplace(I.vertexOffset+A,255*b.r<<8|255*b.g,255*b.b<<8|51*w)}}needsEvaluation(e,i){const s=e.transform.projectionOptions,a=e.style.getBrightness();return!(this.uploaded&&s.name===this.projection.name&&this.brightness===a||(this.projection=s,this.brightness=a,0))}updateReplacement(e,i,s){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Af(this.activeReplacements,a))return;this.activeReplacements=a;for(const u of this.footprints)u.hiddenFlags&=-2;const h=[];for(const u of this.activeReplacements){if(u.order<=q_)continue;const p=Math.max(1,Math.pow(2,u.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.footprints)_.min.x>u.max.x||_.max.x<u.min.x||_.min.y>u.max.y||_.max.y<u.min.y||(h.length=0,g0(_.vertices,0,_.vertices.length,u.footprintTileId.canonical,e.canonical,h),am(u.footprint,h,_.indices,0,_.indices.length,0,-p)&&(_.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const u of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(u.groundEffectVertexOffset,u.groundEffectVertexLength,u.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getHeightAtTileCoord(e,i){let s=Number.NEGATIVE_INFINITY,a=!0;const h=4*(e+We)*We+(i+We);
vendor: 21,435 bytes, line 14
14if(this.footprintLookup.hasOwnProperty(h)){const p=this.footprintLookup[h];return p?{height:p.height,hidden:p.hiddenFlags!==0}:void 0}const u=new ke(e,i);for(const p of this.footprints)e>p.max.x||p.min.x>e||i>p.max.y||p.min.y>i||p.height<=s||lm(u,p)&&(s=p.height,this.footprintLookup[h]=p,a=p.hiddenFlags!==0);if(s!==Number.NEGATIVE_INFINITY)return{height:s,hidden:a};this.footprintLookup[h]=void 0}}function g0(r,e,i,s,a,h){const u=Math.pow(2,s.z-a.z);for(let p=0;p<i;p++){let _=r[p+e].x,g=r[p+e].y;_=(_+a.x*We)*u-s.x*We,g=(g+a.y*We)*u-s.y*We,h.push(new ke(_,g))}}let Vg,Ug;rt(Ng,"BuildingBucket",{omit:["layers"]});const y0=$t([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),x0=$t([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:v0}=y0,b0=$t([{name:"a_packed",components:3,type:"Float32"}]),{members:w0}=b0,T0=$t([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:S0}=T0;class jg{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Ma({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const s=this.getKey(e,i);return this.positions[s]}trim(){const e=this.width,i=this.height=ft(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,s){const a=[];let h=e.length%2==1?-e[e.length-1]*s:0,u=e[0]*s,p=!0;a.push({left:h,right:u,isDash:p,zeroLength:e[0]===0});let _=e[0];for(let g=1;g<e.length;g++){p=!p;const v=e[g];h=_*s,_+=v,u=_*s,a.push({left:h,right:u,isDash:p,zeroLength:v===0})}return a}addRoundDash(e,i,s){const a=i/2;for(let h=-s;h<=s;h++){const u=this.width*(this.nextRow+s+h);let p=0,_=e[p];for(let g=0;g<this.width;g++){g/_.right>1&&(_=e[++p]);const v=Math.abs(g-_.left),b=Math.abs(g-_.right),w=Math.min(v,b);let I;const A=h/s*(a+1);if(_.isDash){const P=a-Math.abs(A);I=Math.sqrt(w*w+P*P)}else I=a-Math.sqrt(w*w+A*A);this.image.data[u+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 s=e[0],a=e[e.length-1];s.isDash===a.isDash&&(s.left=a.left-this.width,a.right=s.right+this.width);const h=this.width*this.nextRow;let u=0,p=e[u];for(let _=0;_<this.width;_++){_/p.right>1&&(p=e[++u]);const g=Math.abs(_-p.left),v=Math.abs(_-p.right),b=Math.min(g,v);this.image.data[h+_]=Math.max(0,Math.min(255,(p.isDash?b:-b)+i+128))}}addDash(e,i){const s=this.getKey(e,i);if(this.positions[s])return this.positions[s];const a=i==="round",h=a?7:0,u=2*h+1;if(this.nextRow+u>this.height)return Gt("LineAtlas out of space"),null;e.length===0&&e.push(1);let p=0;for(let v=0;v<e.length;v++)e[v]<0&&(Gt("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),p+=e[v];if(p!==0){const v=this.width/p,b=this.getDashRanges(e,this.width,v);a?this.addRoundDash(b,v,h):this.addRegularDash(b,i==="square"?.5*v:0)}const _=this.nextRow+h;this.nextRow+=u;const g={tl:[_,h],br:[p,0]};return this.positions[s]=g,g}}rt(jg,"LineAtlas");const E0=_e.types,I0=Math.cos(Math.PI/180*37.5),A0=Math.cos(Math.PI/180*5);class Am{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 kc,this.layoutVertexArray2=new En,this.patternVertexArray=new En,this.indexArray=new Li,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Ni,this.maxLineLength=0,this.zOffsetVertexArray=new En,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.tessellationStep=e.tessellationStep?e.tessellationStep:We/64,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,s,a){this.hasPattern=tm("line",this.layers,this.pixelRatio,i);const h=this.layers[0].layout.get("line-sort-key");this.tileToMeter=K(s);const u=this.layers[0].layout.get("line-elevation-reference");if(u==="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=u!=="sea"&&u!=="ground"&&I?"none":"offset",this.elevationType==="offset"&&u==="none"&&Gt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const p=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&p!==void 0;const _=[];for(const{feature:w,id:I,index:A,sourceLayerIndex:P}of e){const R=this.layers[0]._featureFilter.needGeometry,O=we(w,R);if(!this.layers[0]._featureFilter.filter(new pi(this.zoom,{worldview:this.worldview}),O,s))continue;const U=h?h.evaluate(O,{},s):void 0,V={id:I,properties:w.properties,type:w.type,sourceLayerIndex:P,index:A,geometry:R?O.geometry:se(w,s,a),patterns:{},sortKey:U};_.push(V)}h&&_.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:P}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const R=im("line",this.layers,w,this.zoom,this.pixelRatio,i);this.patternFeatures.push(R)}else this.addFeature(w,I,A,s,g.positions,i.availableImages,i.brightness,i.elevationFeatures);v.insert(e[A].feature,I,A,P,this.index)}}addConstantDashes(e){let i=!1;for(const s of this.layers){const a=s.paint.get("line-dasharray").value,h=s.layout.get("line-cap").value;if(a.kind!=="constant"||h.kind!=="constant")i=!0;else{const u=h.value,p=a.value;if(!p)continue;e.addDash(p,u)}}return i}addFeatureDashes(e,i){const s=this.zoom;for(const a of this.layers){const h=a.paint.get("line-dasharray").value,u=a.layout.get("line-cap").value;if(h.kind==="constant"&&u.kind==="constant")continue;let p,_;if(h.kind==="constant"){if(p=h.value,!p)continue}else p=h.evaluate({zoom:s},e);_=u.kind==="constant"?u.value:u.evaluate({zoom:s},e),i.addDash(p,_),e.patterns[a.id]=[i.getKey(p,_)]}}update(e,i,s,a,h,u,p,_){this.programConfigurations.updatePaintArrays(e,i,h,s,a,u,p,_)}addFeatures(e,i,s,a,h,u){for(const p of this.patternFeatures)this.addFeature(p,p.geometry,p.index,i,s,a,u)}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,w0)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,S0)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,x0.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,v0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,s,a,h,u,p,_){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,this.zOffsetValue=g.get("line-z-offset").value;const A=this.layers[0].paint.get("line-width").value;if(A.kind!=="constant"&&A.isLineProgressConstant===!1&&(this.variableWidthValue=A),this.elevationType==="road"){const P=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,_,v,b,w,I)){const[R,O]=this.clipRuntimeLinesToTile(i,1);for(let U=0;U<R.length;U++){const V=R[U],G=O[U],re={progress:{min:G.progress.min,max:G.progress.max},nextDir:this.computeSegNextDir(G,V),prevDir:this.computeSegPrevDir(G,V)};this.addLine(V,e,a,v,b,w,I,re)}this.fillNonElevatedRoadSegment(P)}}else for(const P of i)this.addLine(P,e,a,v,b,w,I);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,h,u,a,p,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 Pf(e,-i,-i,We+i,We+i)}clipRuntimeLinesToTile(e,i){const s=[];return[Pf(e,-i,-i,We+i,We+i,s),s]}addElevatedRoadFeature(e,i,s,a,h,u,p,_){const g=[],v=Vi.getElevationFeature(e,a);if(v){const b=this.clipLinesToTile(i,1),w=this.prepareElevatedLines(b,v,s);for(const I of w)g.push({geometry:I,elevation:v,elevationTileID:s,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,s,h,u,p,_);const I=new Wt(s,b.elevationTileID);if(b.elevation)for(let A=w;A<this.layoutVertexArray.length;A++){const P=new ke(this.layoutVertexArray.int16[6*A]>>1,this.layoutVertexArray.int16[6*A+1]>>1),R=I.pointElevation(P,b.elevation,.05);this.updateHeightRange(R),this.zOffsetVertexArray.emplaceBack(R,0,0)}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,i,s){if(i.constantHeight!=null)return e;const a=[],h=1/K(s);for(const u of e)qv(u,new di(i,h),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,s,a,h,u,p,_){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const g=a==="none";this.patternJoinNone=this.hasPattern&&g,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const v=_&&_.progress.min>0,b=_&&_.progress.max<1;if(this.lineClips){let ae={min:this.lineClips.start,max:this.lineClips.end},ce=1;if(_){const Ae=this.lineClips.end-this.lineClips.start;ae=(function(je,Ce,Fe){return{min:Ha(je.min,Ce,Fe),max:Ha(je.max,Ce,Fe)}})(_.progress,{min:0,max:1},ae),Ae>0&&(ce=(ae.max-ae.min)/Ae)}const Ee=+i.properties.mapbox_clip_feature_len,de=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(Ee)||Number.isNaN(de)){for(let je=0;je<e.length-1;je++)this.totalDistance+=e[je].dist(e[je+1]);const Ae=this.totalDistance/(ae.max-ae.min);this.totalFeatureLength=Number.isFinite(Ae)?Ae:0,this.lineClips.start=ae.min,this.lineClips.end=ae.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=Ee,this.distance=de*ce,this.lineClips.start=ae.min,this.lineClips.end=ae.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const w=E0[i.type]==="Polygon";let I=e.length;for(;I>=2&&e[I-1].equals(e[I-2]);)I--;let A=0;for(;A<I-1&&e[A].equals(e[A+1]);)A++;if(I<(w?3:2))return;a==="bevel"&&(u=1.05);const P=this.segments.prepareSegment(10*I,this.layoutVertexArray,this.indexArray);let R,O,U,V,G,re,Q,te;_&&_.prevDir&&(re=_.prevDir.perp()),_&&_.nextDir&&(Q=_.nextDir.perp()),this.e1=this.e2=-1,w&&(R=e[I-2],G=e[A].sub(R)._unit()._perp());for(let ae=A;ae<I;ae++){if(U=ae===I-1?w?e[A+1]:void 0:e[ae+1],U&&e[ae].equals(U))continue;G&&(V=G),R&&(O=R),R=e[ae],te=this.evaluateLineProgressFeatures(O?O.dist(R):0),G=U?U.sub(R)._unit()._perp():V,V=V||G;const ce=O&&U;let Ee=ce?a:w||g?"butt":h;const de=V.x*G.x+V.y*G.y;if(g){const fe=function(Se){if(Se.patternJoinNone){const He=Se.segmentPoints.length/2,Be=Se.lineSoFar-Se.segmentStart;for(let ct=0;ct<He;++ct){const nt=Se.segmentPoints[2*ct+1],De=Math.round(Se.segmentPoints[2*ct])+.5+.25*nt;Se.patternVertexArray.emplaceBack(De,Be,Se.segmentStart),Se.patternVertexArray.emplaceBack(De,Be,Se.segmentStart)}Se.segmentPoints.length=0}Se.e1=Se.e2=-1};if(ce&&de<A0){this.updateDistance(O,R),this.addCurrentVertex(R,V,1,1,P,te),fe(this),this.addCurrentVertex(R,G,-1,-1,P,te);continue}if(O){if(!U){this.updateDistance(O,R),this.addCurrentVertex(R,V,1,1,P,te),fe(this);continue}Ee="miter"}}let Ae=V.add(G);Ae.x===0&&Ae.y===0||Ae._unit();const je=Ae.x*G.x+Ae.y*G.y,Ce=je!==0?1/je:1/0,Fe=2*Math.sqrt(2-2*je),Ve=je<I0&&O&&U,Te=V.x*G.y-V.y*G.x>0,Oe=this.overscaling<=16?15*We/(512*this.overscaling):0;if(ce&&Ee==="round"){if(Ce<p)Ee="miter";else if(Ce<=2){const fe=Mm(R,-10,We+10);Ee=this.elevationType==="offset"&&(fe||this.hasCrossSlope)?"miter":"fakeround"}}if(Ee==="miter"&&Ce>u&&(Ee="bevel"),Ee==="bevel"&&(Ce>2&&(Ee="flipbevel"),Ce<u&&(Ee="miter")),O&&!(Ee==="miter"&&Ve)&&this.updateDistance(O,R),Ee==="miter")if(Ve){const fe=R.dist(O);if(fe>2*Oe){const He=R.sub(R.sub(O)._mult(Oe/fe)._round());this.updateDistance(O,He),this.addCurrentVertex(He,V,0,0,P,te),O=He}this.updateDistance(O,R),Ae._mult(Ce),this.addCurrentVertex(R,Ae,0,0,P,te);const Se=R.dist(U);if(Se>2*Oe){const He=R.add(U.sub(R)._mult(Oe/Se)._round());this.updateDistance(R,He),this.addCurrentVertex(He,G,0,0,P,te),R=He}}else Ae._mult(Ce),this.addCurrentVertex(R,Ae,0,0,P,te);else if(Ee==="flipbevel"){if(Ce>100)Ae=G.mult(-1);else{const fe=Ce*V.add(G).mag()/V.sub(G).mag();Ae._perp()._mult(fe*(Te?-1:1))}this.addCurrentVertex(R,Ae,0,0,P,te),this.addCurrentVertex(R,Ae.mult(-1),0,0,P,te)}else if(Ee==="bevel"||Ee==="fakeround"){te!=null&&O&&this.addCurrentVertex(R,Q||V,-1,-1,P,te);const fe=R.dist(O)<=2*Oe&&Ee!=="bevel",Se=Ae.mult(Te?1:-1);Se._mult(Ce);const He=G.mult(Te?-1:1),Be=V.mult(Te?-1:1),ct=this.evaluateLineProgressFeatures(this.distance);if(te==null&&(this.addHalfVertex(R,Se.x,Se.y,!1,!Te,0,P,ct),fe||this.addHalfVertex(R,Se.x+2*Be.x,Se.y+2*Be.y,!1,Te,0,P,ct)),Ee==="fakeround"){const nt=Math.round(180*Fe/Math.PI/20);this.addHalfVertex(R,Be.x,Be.y,!1,Te,0,P,ct);for(let De=0;De<nt;De++){let Ne=De/nt;if(Ne!==.5){const et=Ne-.5;Ne+=Ne*et*(Ne-1)*((1.0904+de*(de*(3.55645-1.43519*de)-3.2452))*et*et+(.848013+de*(.215638*de-1.06021)))}const ot=He.sub(Be)._mult(Ne)._add(Be)._unit();this.addHalfVertex(R,ot.x,ot.y,!1,Te,0,P,ct)}this.addHalfVertex(R,He.x,He.y,!1,Te,0,P,ct)}fe||te!=null||this.addHalfVertex(R,Se.x+2*He.x,Se.y+2*He.y,!1,Te,0,P,ct),te!=null&&U&&this.addCurrentVertex(R,re||G,1,1,P,te)}else if(Ee==="butt")this.addCurrentVertex(R,Ae,0,0,P,te);else if(Ee==="square"){if(!O){const fe=v?0:-1;this.addCurrentVertex(R,Ae,fe,fe,P,te)}if(this.addCurrentVertex(R,Ae,0,0,P,te),O){const fe=b?0:1;this.addCurrentVertex(R,Ae,fe,fe,P,te)}}else if(Ee==="round"){if(O){const fe=!ce&&Q?Q:V;this.addCurrentVertex(R,fe,0,0,P,te),!ce&&b||this.addCurrentVertex(R,fe,1,1,P,te,!0)}if(U){const fe=!ce&&re?re:G;!ce&&v||this.addCurrentVertex(R,fe,-1,-1,P,te,!0),this.addCurrentVertex(R,fe,0,0,P,te)}}}}addVerticesTo(e,i,s,a,h,u,p,_,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 P=(i.x-e.x)/b,R=(i.y-e.y)/b,O=(i.z-e.z)/b,U=(i.w-e.w)/b;for(let V=1;V<b;++V){e.x+=P,e.y+=R,e.z+=O,this.lineSoFar+=U,w+=U;const G=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,s,a,v,!1,p,g,G),this.addHalfVertex(e,h,u,v,!0,-_,g,G)}}this.lineSoFar=i.w,this.scaledDistance=I;const A=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,s,a,v,!1,p,g,A),this.addHalfVertex(i,h,u,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):Gt(`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,s,a,h,u,p=!1){const _=i.x+i.y*s,g=i.y-i.x*s,v=i.y*a-i.x,b=-i.y-i.x*a;if(u!=null){const w=this.elevationType==="offset",I=-10,A=We+10,P=u.zOffset,R=new ug(e.x,e.y,P,this.lineSoFar),O=!!w&&Mm(e,I,A),U=this.lineSoFar,V=this.distance;if(this.currentVertex)if(O){const G=this.currentVertexIsOutside,re=this.currentVertex,Q=new ug(e.x,e.y,P,this.lineSoFar);if(fg(re,Q,I,A),!Mm(Q,I,A)){if(G){this.e1=this.e2=-1,this.distance-=re.dist(R),this.lineSoFar=re.w;const te=this.evaluateLineProgressFeatures(re.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(re,_,g,p,!1,s,h,te),this.addHalfVertex(re,v,b,p,!0,-a,h,te),this.prevDistance=this.distance}this.distance=this.prevDistance+re.dist(Q),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(re,Q,_,g,v,b,s,a,h,p),this.distance=V,this.scaledDistance=this.distance/this.totalDistance}}else{const G=this.currentVertex;if(this.currentVertexIsOutside){fg(G,R,I,A),this.e1=this.e2=-1,this.distance-=G.dist(R),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=G.w;const re=this.evaluateLineProgressFeatures(G.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(G,_,g,p,!1,s,h,re),this.addHalfVertex(G,v,b,p,!0,-a,h,re),this.prevDistance=this.distance,this.distance=V,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(G,R,_,g,v,b,s,a,h,p)}else O||(this.addHalfVertex(e,_,g,p,!1,s,h,u),this.addHalfVertex(e,v,b,p,!0,-a,h,u));this.currentVertex=R,this.currentVertexIsOutside=O,this.lineSoFar=U}else this.addHalfVertex(e,_,g,p,!1,s,h,u),this.addHalfVertex(e,v,b,p,!0,-a,h,u)}addHalfVertex({x:e,y:i},s,a,h,u,p,_,g){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),u||this.segmentPoints.push(this.lineSoFar-this.segmentStart,p)),this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(i<<1)+(u?1:0),Math.round(63*s)+128,Math.round(63*a)+128,1+(p===0?0:p<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=pt(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++),u?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 Mm(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let Gg,qg;function Hg(r,e,i){return e*(We/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}rt(Am,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const $g=(r,e,i)=>(1-i)*r+i*e;function Zg(r,e){return 1/Hg(r,1,e.tileZoom)}function Wg(r,e,i,s){return r.translatePosMatrix(s||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Xg=r=>{const e=[];Yg(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 s=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return s&&a&&e.push("LINE_JOIN_NONE"),e};function Yg(r){const e=r.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}let Cm;const Kg=()=>Cm||(Cm={layout:Gg||(Gg=new Yi({"line-cap":new Je(ue.layout_line["line-cap"]),"line-join":new Je(ue.layout_line["line-join"]),"line-miter-limit":new Ge(ue.layout_line["line-miter-limit"]),"line-round-limit":new Ge(ue.layout_line["line-round-limit"]),"line-sort-key":new Je(ue.layout_line["line-sort-key"]),"line-z-offset":new Je(ue.layout_line["line-z-offset"]),"line-elevation-reference":new Ge(ue.layout_line["line-elevation-reference"]),"line-cross-slope":new Ge(ue.layout_line["line-cross-slope"]),visibility:new Ge(ue.layout_line.visibility),"line-width-unit":new Ge(ue.layout_line["line-width-unit"])})),paint:qg||(qg=new Yi({"line-opacity":new Je(ue.paint_line["line-opacity"]),"line-color":new Je(ue.paint_line["line-color"]),"line-translate":new Ge(ue.paint_line["line-translate"]),"line-translate-anchor":new Ge(ue.paint_line["line-translate-anchor"]),"line-width":new Je(ue.paint_line["line-width"]),"line-gap-width":new Je(ue.paint_line["line-gap-width"]),"line-offset":new Je(ue.paint_line["line-offset"]),"line-blur"
vendor: 5,335 bytes, line 14
14:new Je(ue.paint_line["line-blur"]),"line-dasharray":new Je(ue.paint_line["line-dasharray"]),"line-pattern":new Je(ue.paint_line["line-pattern"]),"line-pattern-cross-fade":new Ge(ue.paint_line["line-pattern-cross-fade"]),"line-gradient":new ua(ue.paint_line["line-gradient"]),"line-trim-offset":new Ge(ue.paint_line["line-trim-offset"]),"line-trim-fade-range":new Ge(ue.paint_line["line-trim-fade-range"]),"line-trim-color":new Ge(ue.paint_line["line-trim-color"]),"line-emissive-strength":new Ge(ue.paint_line["line-emissive-strength"]),"line-border-width":new Je(ue.paint_line["line-border-width"]),"line-border-color":new Je(ue.paint_line["line-border-color"]),"line-occlusion-opacity":new Ge(ue.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},Cm);class M0 extends Je{possiblyEvaluate(e,i){return i=new pi(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,a){return i=ye({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,a)}}let Hu;function Jg(r,e){return e>0?e+2*r:r}const C0=$t([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),P0=$t([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),z0=$t([{name:"a_projected_pos",components:4,type:"Float32"}],4);$t([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const R0=$t([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),D0=$t([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),L0=$t([{name:"a_texb",components:2,type:"Uint16"}]),F0=$t([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),O0=$t([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);$t([{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 Qg=$t([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),k0=$t([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);$t([{name:"triangle",components:3,type:"Uint16"}]),$t([{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"}]),$t([{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,467 bytes, line 14
14]),$t([{type:"Float32",name:"offsetX"}]),$t([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Ir=24;function B0(r,e,i){return r.sections.forEach((s=>{s.text=(function(a,h,u){const p=h.layout.get("text-transform").evaluate(u,{});return p==="uppercase"?a=a.toLocaleUpperCase():p==="lowercase"&&(a=a.toLocaleLowerCase()),es.applyArabicShaping&&(a=es.applyArabicShaping(a)),a})(s.text,e,i)})),r}const $u={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function N0(r){return r==="︶"||r==="ï¹"||r==="︸"||r==="ï¹"||r==="ï¹"||r==="︾"||r==="︼"||r==="︺"||r==="ï¸"||r==="ï¹"||r==="ï¸"||r==="ï¸"||r==="ï¸"||r==="ï½"||r==="ï¿£"||r==="ï¸"||r==="ï¸"}function V0(r){return r==="︵"||r==="ï¹"||r==="︷"||r==="ï¹"||r==="ï¹"||r==="︽"||r==="︻"||r==="︹"||r==="ï¸"||r==="︿"}const Pm=4294967296,ey=1/Pm,ty=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Bf=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 s=this.readVarint(),a=s>>3,h=this.pos;this.type=7&s,r(a,e,this),this.pos===h&&this.skip(s)}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)*Pm;return this.pos+=8,r}readSFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Pm;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,s;return s=e[this.pos++],i=127&s,s<128?i:(s=e[this.pos++],i|=(127&s)<<7,s<128?i:(s=e[this.pos++],i|=(127&s)<<14,s<128?i:(s=e[this.pos++],i|=(127&s)<<21,s<128?i:(s=e[this.pos],i|=(15&s)<<28,(function(a,h,u){const p=u.buf;let _,g;if(g=p[u.pos++],_=(112&g)>>4,g<128||(g=p[u.pos++],_|=(127&g)<<3,g<128)||(g=p[u.pos++],_|=(127&g)<<10,g<128)||(g=p[u.pos++],_|=(127&g)<<17,g<128)||(g=p[u.pos++],_|=(127&g)<<24,g<128)||(g=p[u.pos++],_|=(1&g)<<31,g<128))return eh(a,_,h);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&&ty?ty.decode(this.buf.subarray(e,r)):(function(i,s,a){let h="",u=s;for(;u<a;){const p=i[u];let _,g,v,b=null,w=p>239?4:p>223?3:p>191?2:1;if(u+w>a)break;w===1?p<128&&(b=p):w===2?(_=i[u+1],(192&_)==128&&(b=(31&p)<<6|63&_,b<=127&&(b=null))):w===3?(_=i[u+1],g=i[u+2],(192&_)==128&&(192&g)==128&&(b=(15&p)<<12|(63&_)<<6|63&g,(b<=2047||b>=55296&&b<=57343)&&(b=null))):w===4&&(_=i[u+1],g=i[u+2],v=i[u+3],(192&_)==128&&(192&g)==128&&(192&v)==128&&(b=(15&p)<<18|(63&_)<<12|(63&g)<<6|63&v,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,w=1):b>65535&&(b-=65536,h+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),h+=String.fromCharCode(b),u+=w}return h})(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*ey),!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*ey),!0),this.pos+=8}writeVarint(r){(r=+r||0)>268435455||r<0?(function(e,i){let s,a;if(e>=0?(s=e%4294967296|0,a=e/4294967296|0):(s=~(-e%4294967296),a=~(-e/4294967296),4294967295^s?s=s+1|0:(s=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),(function(h,u,p){p.buf[p.pos++]=127&h|128,h>>>=7,p.buf[p.pos++]=127&h|128,h>>>=7,p.buf[p.pos++]=127&h|128,h>>>=7,p.buf[p.pos++]=127&h|128,p.buf[p.pos]=127&(h>>>=7)})(s,0,i),(function(h,u){const p=(7&h)<<4;u.buf[u.pos++]|=p|((h>>>=3)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h)))))})(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(s,a,h){for(let u,p,_=0;_<a.length;_++){if(u=a.charCodeAt(_),u>55295&&u<57344){if(!p){u>56319||_+1===a.length?(s[h++]=239,s[h++]=191,s[h++]=189):p=u;continue}if(u<56320){s[h++]=239,s[h++]=191,s[h++]=189,p=u;continue}u=p-55296<<10|u-56320|65536,p=null}else p&&(s[h++]=239,s[h++]=191,s[h++]=189,p=null);u<128?s[h++]=u:(u<2048?s[h++]=u>>6|192:(u<65536?s[h++]=u>>12|224:(s[h++]=u>>18|240,s[h++]=u>>12&63|128),s[h++]=u>>6&63|128),s[h++]=63&u|128)}return h})(this.buf,r,this.pos);const i=this.pos-e;i>=128&&iy(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 s=this.pos-i;s>=128&&iy(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeMessage(r,e,i){this.writeTag(r,2),this.writeRawMessage(e,i)}writePackedVarint(r,e){e.length&&this.writeMessage(r,U0,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,j0,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,H0,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,G0,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,q0,e)}writePackedFixed32(r,e){e.length&&this.writeMessage(r,$0,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,Z0,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,W0,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,X0,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 eh(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function iy(r,e,i){const s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(s);for(let a=i.pos-1;a>=r;a--)i.buf[a+s]=i.buf[a]}function U0(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function j0(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function G0(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function q0(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function H0(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function $0(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function Z0(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function W0(r,e){for(let i=0;i<r.length;
14i++)e.writeFixed64(r[i])}function X0(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}const zm=3;function Y0(r,e,i){e.glyphs=[],r===1&&i.readMessage(K0,e)}function K0(r,e,i){if(r===3){const{id:s,bitmap:a,width:h,height:u,left:p,top:_,advance:g}=i.readMessage(J0,{});e.glyphs.push({id:s,bitmap:new Ma({width:h+2*zm,height:u+2*zm},a),metrics:{width:h,height:u,left:p,top:_,advance:g}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function J0(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 ry=zm,Dn={horizontal:1,vertical:2,horizontalOnly:3};class Zu{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const s=new Zu;return s.scale=e||1,s.fontStack=i,s}static forImage(e){const i=new Zu;return i.image=e,i}}class th{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,s){const a=new th;for(let h=0;h<e.sections.length;h++){const u=e.sections[h];u.image?a.addImageSection(u,s):a.addTextSection(u,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,s){let a="";for(let h=0;h<i.length;h++){const u=i.charCodeAt(h+1)||null,p=i.charCodeAt(h-1)||null;a+=!s&&(u&&Pc(u)&&!$u[i[h+1]]||p&&Pc(p)&&!$u[i[h-1]])||!$u[i[h]]?i[h]:$u[i[h]]}return a})(this.text,e)}trim(){let e=0;for(let s=0;s<this.text.length&&Nf[this.text.charCodeAt(s)];s++)e++;let i=this.text.length;for(let s=this.text.length-1;s>=0&&s>=e&&Nf[this.text.charCodeAt(s)];s--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const s=new th;return s.text=this.text.substring(e,i),s.sectionIndex=this.sectionIndex.slice(e,i),s.sections=this.sections,s}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(Zu.forText(e.scale,e.fontStack||i));const s=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(s)}addImageSection(e,i){const s=e.image?e.image.getPrimary():null;if(!s)return void Gt("Can't add FormattedSection with an empty image.");s.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(Zu.forImage(s)),this.sectionIndex.push(this.sections.length-1)):Gt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Rm(r,e,i,s,a,h,u,p,_,g,v,b,w,I,A,P=1){const R=th.fromFeature(r,a,P);
14b===Dn.vertical&&R.verticalizePunctuation(w);let O=[];const U=(function(te,ae,ce,Ee,de,Ae){if(!te)return[];const je=[],Ce=(function(Oe,fe,Se,He,Be,ct){let nt=0;for(let De=0;De<Oe.length();De++){const Ne=Oe.getSection(De);nt+=ny(Oe.getCodePoint(De),Ne,He,Be,fe,ct)}return nt/Math.max(1,Math.ceil(nt/Se))})(te,ae,ce,Ee,de,Ae),Fe=te.text.indexOf("â")>=0;let Ve=0;for(let Oe=0;Oe<te.length();Oe++){const fe=te.getSection(Oe),Se=te.getCodePoint(Oe);if(Nf[Se]||(Ve+=ny(Se,fe,Ee,de,ae,Ae)),Oe<te.length()-1){const He=!((Te=Se)<11904||!(gt["Bopomofo Extended"](Te)||gt.Bopomofo(Te)||gt["CJK Compatibility Forms"](Te)||gt["CJK Compatibility Ideographs"](Te)||gt["CJK Compatibility"](Te)||gt["CJK Radicals Supplement"](Te)||gt["CJK Strokes"](Te)||gt["CJK Symbols and Punctuation"](Te)||gt["CJK Unified Ideographs Extension A"](Te)||gt["CJK Unified Ideographs"](Te)||gt["Enclosed CJK Letters and Months"](Te)||gt["Halfwidth and Fullwidth Forms"](Te)||gt.Hiragana(Te)||gt["Ideographic Description Characters"](Te)||gt["Kangxi Radicals"](Te)||gt["Katakana Phonetic Extensions"](Te)||gt.Katakana(Te)||gt["Vertical Forms"](Te)||gt["Yi Radicals"](Te)||gt["Yi Syllables"](Te)));(Q0[Se]||He||fe.image)&&je.push(oy(Oe+1,Ve,Ce,je,e1(Se,te.getCodePoint(Oe+1),He&&Fe),!1))}}var Te;return ay(oy(te.length(),Ve,Ce,je,0,!0))})(R,g,h,e,s,I),{processBidirectionalText:V,processStyledBidirectionalText:G}=es;if(V&&R.sections.length===1){const te=V(R.toString(),U);for(const ae of te){const ce=new th;ce.text=ae,ce.sections=R.sections;for(let Ee=0;Ee<ae.length;Ee++)ce.sectionIndex.push(0);O.push(ce)}}else if(G){const te=G(R.text,R.sectionIndex,U);for(const ae of te){const ce=new th;ce.text=ae[0],ce.sectionIndex=ae[1],ce.sections=R.sections,O.push(ce)}}else O=(function(te,ae){const ce=[],Ee=te.text;let de=0;for(const Ae of ae)ce.push(te.substring(de,Ae)),de=Ae;return de<Ee.length&&ce.push(te.substring(de,Ee.length)),ce})(R,U);const re=[],Q={positionedLines:re,text:R.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if((function(te,ae,ce,Ee,de,Ae,je,Ce,Fe,Ve,Te,Oe){let fe=0,Se=0,He=0;const Be=Ce==="right"?1:Ce==="left"?0:.5;let ct=!1;for(const Xe of de){const tt=Xe.getSections();for(const _t of tt){if(_t.image)continue;const Tt=ae[_t.fontStack];if(Tt&&(ct=Tt.ascender!==void 0&&Tt.descender!==void 0,!ct))break}if(!ct)break}let nt=0;for(const Xe of de){Xe.trim();const tt=Xe.getMaxScale(),_t=(tt-1)*Ir,Tt={positionedGlyphs:[],lineOffset:0};te.positionedLines[nt]=Tt;const Mt=Tt.positionedGlyphs;let It=0;if(!Xe.length()){Se+=Ae,++nt;continue}let qt=0,Lt=0;for(let H=0;H<Xe.length();H++){const $=Xe.getSection(H),be=Xe.getSectionIndex(H),$e=Xe.getCodePoint(H);let Ke=$.scale,Ye=null,st=null,vt=null,Nt=Ir,Vt=0,zt=Fe;zt===Dn.vertical&&((De=$e)===12312||De===12313||De===12316||De===12540||De===12448)&&(zt=Dn.horizontal);const mi=!(zt===Dn.horizontal||!Te&&!Cc($e)||Te&&(Nf[$e]||Wd($e)));if($.image){const Hi=Ee.get($.image.toString());if(!Hi)continue;vt=$.image,te.iconsInText=te.iconsInText||!0,st=Hi.paddedRect;const Ct=Hi.displaySize;Ke=Ke*Ir/Oe,Ye={width:Ct[0],height:Ct[1],left:0,top:-ry,advance:mi?Ct[1]:Ct[0],localGlyph:!1},Vt=ct?-Ye.height*Ke:tt*Ir-17-Ct[1]*Ke,Nt=Ye.advance;const Pi=(mi?Ct[0]:Ct[1])*Ke-Ir*tt;Pi>0&&Pi>It&&(It=Pi)}else{const Hi=ce[$.fontStack];if(!Hi)continue;Hi[$e]&&(st=Hi[$e]);const Ct=ae[$.fontStack];if(!Ct)continue;const Pi=Ct.glyphs[$e];if(!Pi)continue;if(Ye=Pi.metrics,Nt=$e!==8203?Ir:0,ct){const Ti=Ct.ascender!==void 0?Math.abs(Ct.ascender):0,hi=Ct.descender!==void 0?Math.abs(Ct.descender):0,Ui=(Ti+hi)*Ke;qt<Ui&&(qt=Ui,Lt=(Ti-hi)/2*Ke),Vt=-Ti*Ke}else Vt=(tt-Ke)*Ir-17}mi?(te.verticalizable=!0,Mt.push({glyph:$e,image:vt,x:fe,y:Se+Vt,vertical:mi,scale:Ke,localGlyph:Ye.localGlyph,fontStack:$.fontStack,sectionIndex:be,metrics:Ye,rect:st}),fe+=Nt*Ke+Ve):(Mt.push({glyph:$e,image:vt,x:fe,y:Se+Vt,vertical:mi,scale:Ke,localGlyph:Ye.localGlyph,fontStack:$.fontStack,sectionIndex:be,metrics:Ye,rect:st}),fe+=Ye.advance*Ke+Ve)}Mt.length!==0&&(He=Math.max(fe-Ve,He),ct?ly(Mt,Be,It,Lt,Ae*tt/2):ly(Mt,Be,It,0,Ae/2)),fe=0;const Ii=Ae*tt+It;Tt.lineOffset=Math.max(It,_t),Se+=Ii,++nt}var De;const Ne=Se,{horizontalAlign:ot,verticalAlign:et}=Dm(je);(function(Xe,tt,_t,Tt,Mt,It){const qt=(tt-_t)*Mt,Lt=-It*Tt;for(const Ii of Xe)for(const H of Ii.positionedGlyphs)H.x+=qt,H.y+=Lt})(te.positionedLines,Be,ot,et,He,Ne),te.top+=-et*Ne,te.bottom=te.to
vendor: 10,207 bytes, line 14
14p+Ne,te.left+=-ot*He,te.right=te.left+He,te.hasBaseline=ct})(Q,e,i,s,O,u,p,_,b,g,w,A),!(function(te){for(const ae of te)if(ae.positionedGlyphs.length!==0)return!1;return!0})(re))return Q}const Nf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Q0={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 ny(r,e,i,s,a,h){if(e.image){const u=s.get(e.image.toString());return u?u.displaySize[0]*e.scale*Ir/h+a:0}{const u=i[e.fontStack],p=u&&u.glyphs[r];return p?p.metrics.advance*e.scale+a:0}}function sy(r,e,i,s){const a=Math.pow(r-e,2);return s?r<e?a/2:2*a:a+Math.abs(i)*i}function e1(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function oy(r,e,i,s,a,h){let u=null,p=sy(e,i,a,h);for(const _ of s){const g=sy(e-_.x,i,a,h)+_.badness;g<=p&&(u=_,p=g)}return{index:r,x:e,priorBreak:u,badness:p}}function ay(r){return r?ay(r.priorBreak).concat(r.index):[]}function Dm(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 ly(r,e,i,s,a){if(!(e||i||s||a))return;const h=r.length-1,u=r[h],p=(u.x+u.metrics.advance*u.scale)*e;for(let _=0;_<=h;_++)r[_].x-=p,r[_].y+=i+s+a}function cy(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function t1(r,e,i,s){const{horizontalAlign:a,verticalAlign:h}=Dm(s),u=i[0]-r.displaySize[0]*a,p=i[1]-r.displaySize[1]*h;return{imagePrimary:r,imageSecondary:e,top:p,bottom:p+r.displaySize[1],left:u,right:u+r.displaySize[0]}}function hy(r,e,i,s,a,h){const u=r.imagePrimary;let p;if(u.content){const R=u.content,O=u.pixelRatio||1;p=[R[0]/O,R[1]/O,u.displaySize[0]-R[2]/O,u.displaySize[1]-R[3]/O]}const _=e.left*h,g=e.right*h;let v,b,w,I;i==="width"||i==="both"?(I=a[0]+_-s[3],b=a[0]+g+s[1]):(I=a[0]+(_+g-u.displaySize[0])/2,b=I+u.displaySize[0]);const A=e.top*h,P=e.bottom*h;return i==="height"||i==="both"?(v=a[1]+A-s[0],w=a[1]+P+s[2]):(v=a[1]+(A+P-u.displaySize[1])/2,w=v+u.displaySize[1]),{imagePrimary:u,imageSecondary:void 0,top:v,right:b,bottom:w,left:I,collisionPadding:p}}function uy(r){return!r.imagePrimary.stretchX}function dy(r){return!r.imagePrimary.stretchY}function fy(r){return{width:r.right-r.left,height:r.bottom-r.top}}const oo=128;function py(r,e,i){const{expression:s}=e;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new pi(r+1,{worldview:i}))};if(s.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:h}=s;let u=0;for(;u<a.length&&a[u]<=r;)u++;u=Math.max(0,u-1);let p=u;for(;p<a.length&&a[p]<r+1;)p++;p=Math.min(a.length-1,p);const _=a[u],g=a[p];return s.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:g,interpolationType:h}:{kind:"camera",minZoom:_,maxZoom:g,minSize:s.evaluate(new pi(_,{worldview:i})),maxSize:s.evaluate(new pi(g,{worldview:i})),interpolationType:h}}}function Lm(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:a}){return r.kind==="source"?s/oo:r.kind==="composite"?pt(s/oo,a/oo,i):e}function Wu(r,e,i=1){let s=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:h,minZoom:u,maxZoom:p}=r,_=h?W(on.interpolationFactor(h,e,u,p),0,1):0;r.kind==="camera"?a=pt(r.minSize,r.maxSize,_)*i:s=_*i}return{uSizeT:s,uSize:a}}class Oo extends ke{constructor(e,i,s,a,h){super(e,i),this.angle=a,this.z=s,h!==void 0&&(this.segment=h)}clone(){return new Oo(this.x,this.y,this.z,this.angle,this.segment)}}function my(r,e,i,s,a){if(e.segment===void 0)return!0;let h=e,u=e.segment+1,p=0;for(;p>-i/2;){if(u--,u<0)return!1;p-=r[u].dist(h),h=r[u]}p+=r[u].dist(r[u+1]),u++;const _=[];let g=0;for(;p<i/2;){const v=r[u],b=r[u+1];if(!b)return!1;let w=r[u-1].angleTo(v)-v.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:p,angleDelta:w}),g+=w;p-_[0].distance>s;)g-=_.shift().angleDelta;if(g>a)return!1;u++,p+=v.dist(b)}return!0}function _y(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function gy(r,e,i){return r?.6*e*i:0}function yy(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function i1(r,e,i,s,a,h){const u=gy(i,a,h),p=yy(i,s)*h;let _=0;const g=_y(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,P=pt(b.x,w.x,A),R=pt(b.y,w.y,A),O=new Oo(P,R,0,w.angleTo(b),v);return!u||my(r,O,p,u,e)?O:void 0}_+=I}}function r1(r,e,i,s,a,h,u,p,_){const g=gy(s,h,u),v=yy(s,a),b=v*u,w=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),xy(r,w?e/2*p%e:(v/2+2*h)*u*p%e,e,g,i,b,w,!1,_)}function xy(r,e,i,s,a,h,u,p,_){const g=h/2,v=_y(r);let b=0,w=e-i,I=[];for(let A=0;A<r.length-1;A++){const P=r[A],R=r[A+1],O=P.dist(R),U=R.angleTo(P);for(;w+i<b+O;){w+=i;const V=(w-b)/O,G=pt(P.x,R.x,V),re=pt(P.y,R.y,V);if(G>=0&&G<_&&re>=0&&re<_&&w-g>=0&&w+g<=v){const Q=new Oo(G,re,0,U,A);s&&!my(r,Q,h,s,a)||I.push(Q)}}b+=O}return p||I.length||u||(I=xy(r,b/2,i,s,a,h,u,!0,_)),I}function vy(r){let e=0,i=0;for(const u of r)e+=u.w*u.h,i=Math.max(i,u.w);r.sort(((u,p)=>p.h-u.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,h=0;for(const u of r)for(let p=s.length-1;p>=0;p--){const _=s[p];if(!(u.w>_.w||u.h>_.h)){if(u.x=_.x,u.y=_.y,h=Math.max(h,u.y+u.h),a=Math.max(a,u.x+u.w),u.w===_.w&&u.h===_.h){const g=s.pop();g&&p<s.length&&(s[p]=g)}else u.h===_.h?(_.x+=u.w,_.w-=u.w):u.w===_.w?(_.y+=u.h,_.h-=u.h):(s.push({x:_.x+u.w,y:_.y,w:_.w-u.w,h:u.h}),_.y+=u.h,_.h-=u.h);break}}return{w:a,h,fill:e/(a*h)||0}}rt(Oo,"Anchor");const Vl=1;class Xu{static getImagePositionScale(e,i,s){if(i&&e&&e.options&&e.options.transform){const a=e.options.transform;return{x:a.a,y:a.d}}return{x:s,y:s}}constructor(e,i,s,a){this.paddedRect=e;const{pixelRatio:h,version:u,stretchX:p,stretchY:_,content:g,sdf:v,usvg:b}=i;this.pixelRatio=h,this.stretchX=p,this.stretchY=_,this.content=g,this.version=u,this.padding=s,this.sdf=v,this.usvg=b,this.scale=Xu.getImagePositionScale(a,b,h)}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 Fm(r,e,i){const s=vs.parse(r),a=(function(h,u,p=[1,1]){return{x:0,y:0,w:(h.data?h.data.width:h.width*p[0])+2*u,h:(h.data?h.data.height:h.height*p[1])+2*u}})(e,i,[s.options.transform.a,s.options.transform.d]);return{bin:a,imagePosition:new Xu(a,e,i,s),imageVariant:s}}class by{constructor(e,i,s){const a=new Map,h=new Map;this.haveRenderCallbacks=[];const u=[];this.addImages(e,a,Vl,u),this.addImages(i,h,2,u);const{w:p,h:_}=vy(u),g=new Rr({width:p||1,height:_||1});for(const[v,b]of e.entries()){const w=a.get(v).paddedRect;Rr.copy(b.data,g,{x:0,y:0},{x:w.x+Vl,y:w.y+Vl},b.data,s,b.sdf)}for(const[v,b]of i.entries()){const w=h.get(v),I=w.paddedRect;let A=w.padding;const P=I.x+A,R=I.y+A,O=b.data.width,U=b.data.height;A=A>1?A-1:A,Rr.copy(b.data,g,{x:0,y:0},{x:P,y:R},b.data,s),Rr.copy(b.data,g,{x:0,y:U-A},{x:P,y:R-A},{width:O,height:A},s),Rr.copy(b.data,g,{x:0,y:0},{x:P,y:R+U},{width:O,height:A},s),Rr.copy(b.data,g,{x:O-A,y:0},{x:P-A,y:R},{width:A,height:U},s),Rr.copy(b.data,g,{x:0,y:0},{x:P+O,y:R},{width:A,height:U},s),Rr.copy(b.data,g,{x:O-A,y:U-A},{x:P-A,y:R-A},{width:A,height:A},s),Rr.copy(b.data,g,{x:0,y:U-A},{x:P+O,y:R-A},{width:A,height:A},s),Rr.copy(b.data,g,{x:0,y:0},{x:P+O,y:R+U},{width:A,height:A},s),Rr.copy(b.data,g,{x:O-A,y:0},{x:P-A,y:R+U},{width:A,height:A},s)}this.lut=s,this.image=g,this.iconPositions=a,this.patternPositions=h}addImages(e,i,s,a){for(const[h,u]of e.entries()){const{bin:p,imagePosition:_,imageVariant:g}=Fm(h,u,s);i.set(h,_),a.push(p),u.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,i,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((a=>e.hasImage(a,s))),e.dispatchRenderCallbacks(this.haveRenderCallbacks,s);for(const a of e.getUpdatedImages(s)){for(const h of this.iconPositions.keys()){const u=vs.parse(h);if(un.isEqual(u.id,a)){const p=e.getImage(a,s);this.patchUpdatedImage(this.iconPositions.get(h),p,i)}}for(const h of this.patternPositions.keys()){const u=vs.parse(h);if(un.isEqual(u.id,a)){const p=e.getImage(a,s);this.patchUpdatedImage(this.patternPositions.get(h),p,i)}}}}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,h]=e.tl,u=e.sdf;if(this.lut||u){const p={width:i.data.width,height:i.data.height},_=new Rr(p);Rr.copy(i.data,_,{x:0,y:0},{x:0,y:0},p,this.lut,u),s.update(_,{position:{x:a,y:h}})}else s.update(i.data,{position:{x:a,y:h}})}}rt(Xu,"ImagePosition"),rt(by,"ImageAtlas");const Yu=1e20;function wy(r,e,i,s,a,h,u,p,_){for(let g=e;g<e+s;g++)Ty(r,i*h+g,h,a,u,p,_);for(let g=i;g<i+a;g++)Ty(r,g*h+e,1,s,u,p,_)}function Ty(r,e,i,s,a,h,u){h[0]=0,u[0]=-Yu,u[1]=Yu,a[0]=r[e];for(let p=1,_=0,g=0;p<s;p++){a[p]=r[e+p*i];const v=p*p;do{const b=h[_];g=(a[p]-a[b]+v-b*b)/(p-b)/2}while(g<=u[_]&&--_>-1);_++,h[_]=p,u[_]=g,u[_+1]=Yu}for(let p=0,_=0;p<s;p++){for(;u[_+1]<p;)_++;const g=h[_],v=p-g;r[e+p*i]=a[g]+v*v}}const Ss=2,Om={none:0,ideographs:1,all:2};class ih{constructor(e,i,s){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=s,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,i){const s=[],a=this.url||Ar.GLYPHS_URL;for(const h in e)for(const u of e[h])s.push({stack:h,id:u});he(s,(({stack:h,id:u},p)=>{let _=this.entries[h];_||(_=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let g=_.glyphs[u];if(g!==void 0)return void p(null,{stack:h,id:u,glyph:g});if(g=this._tinySDF(_,h,u),g)return _.glyphs[u]=g,void p(null,{stack:h,id:u,glyph:g});const v=Math.floor(u/256);if(256*v>65535)return Gt("glyphs > 65535 not supported"),void p(null,{stack:h,id:u,glyph:g});if(_.ranges[v])return void p(null,{stack:h,id:u,glyph:g});let b=_.requests[v];b||(b=_.requests[v]=[],ih.loadGlyphRange(h,v,a,this.requestManager,((w,I)=>
14{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?p(w):I&&p(null,{stack:h,id:u,glyph:I.glyphs[u]||null})}))}),((h,u)=>{if(h)i(h);else if(u){const p={};for(const{stack:_,id:g,glyph:v}of u)p[_]===void 0&&(p[_]={}),p[_].glyphs===void 0&&(p[_].glyphs={}),p[_].glyphs[g]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},p[_].ascender=this.entries[_].ascender,p[_].descender=this.entries[_].descender;i(null,p)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Om.none&&(this.localGlyphMode===Om.all?!!this.localFontFamily:!!this.localFontFamily&&(gt["CJK Unified Ideographs"](e)||gt["Hangul Syllables"](e)||gt.Hiragana(e)||gt.Katakana(e)||gt["CJK Symbols and Punctuation"](e)||gt["CJK Unified Ideographs Extension A"](e)||gt["CJK Unified Ideographs Extension B"](e)||gt.Osage(e)))}_tinySDF(e,i,s){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(s))return;let h=e.tinySDF;if(!h){let P="400";/bold/i.test(i)?P="900":/medium/i.test(i)?P="500":/light/i.test(i)&&(P="200"),h=e.tinySDF=new ih.TinySDF({fontFamily:a,fontWeight:P,fontSize:24*Ss,buffer:3*Ss,radius:8*Ss}),h.fontWeight=P}if(this.localGlyphs[h.fontWeight][s])return this.localGlyphs[h.fontWeight][s];const u=String.fromCodePoint(s),{data:p,width:_,height:g,glyphWidth:v,glyphHeight:b,glyphLeft:w,glyphTop:I,glyphAdvance:A}=h.draw(u);return this.localGlyphs[h.fontWeight][s]={id:s,bitmap:new Ma({width:_,height:g},p),metrics:{width:v/Ss,height:b/Ss,left:w/Ss,top:I/Ss-27,advance:A/Ss,localGlyph:!0}}}}ih.loadGlyphRange=function(r,e,i,s,a){const h=256*e,u=h+255,p=s.transformRequest(s.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${h}-${u}`),Ja.Glyphs);Qa(p,((_,g)=>{if(_)a(_);else if(g){const v={},b=(function(w){return new Bf(w).readFields(Y0,{})})(g);for(const w of b.glyphs)v[w.id]=w;a(null,{glyphs:v,ascender:b.ascender,descender:b.descender})}}))},ih.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:a="sans-serif",fontWeight:h="normal",fontStyle:u="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const p=this.size=r+4*e,_=this._createCanvas(p),g=this.ctx=_.getContext("2d",{willReadFrequently:!0});g.font=`${u} ${h} ${r}px ${a}`,g.textBaseline="alphabetic",g.textAlign="left",g.fillStyle="black",this.gridOuter=new Float64Array(p*p),this.gridInner=new Float64Array(p*p),this.f=new Float64Array(p),this.z=new Float64Array(p+1),this.v=new Uint16Array(p)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:a,actualBoundingBoxRight:h}=this.ctx.measureText(r),u=Math.ceil(i),p=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),_=Math.min(this.size-this.buffer,u+Math.ceil(s)),g=p+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:p,glyphHeight:_,glyphTop:u,glyphLeft:0,glyphAdvance:e};if(p===0||_===0)return I;const{ctx:A,buffer:P,gridInner:R,gridOuter:O}=this;A.clearRect(P,P,p,_),A.fillText(r,P,P+u);const U=A.getImageData(P,P,p,_);O.fill(Yu,0,b),R.fill(0,0,b);for(let V=0;V<_;V++)for(let G=0;G<p;G++){const re=U.data[4*(V*p+G)+3]/255;if(re===0)continue;const Q=(V+P)*g+G+P;if(re===1)O[Q]=0,R[Q]=Yu;else{const te=.5-re;O[Q]=te>0?te*te:0,R[Q]=te<0?te*te:0}}wy(O,0,0,g,v,g,this.f,this.v,this.z),wy(R,P,P,p,_,g,this.f,this.v,this.z);for(let V=0;V<b;V++){const G=Math.sqrt(O[V])-Math.sqrt(R[V]);w[V]=Math.round(255-255*(G/this.radius+this.cutoff))}return I}};const za=Vl;function Sy(r,e){return r+e[1]-e[0]}function Ey(r,e,i,s,a=1){const h=[],u=r.imagePrimary,p=u.pixelRatio,_=u.paddedRect.w-2*za,g=u.paddedRect.h-2*za,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,w=u.stretchX||[[0,_]],I=u.stretchY||[[0,g]],A=w.reduce(Sy,0),P=I.reduce(Sy,0),R=_-A,O=g-P;let U=0,V=A,G=0,re=P,Q=0,te=R,ae=0,ce=O;if(u.content&&s){const de=u.content;U=Vf(w,0,de[0]),G=Vf(I,0,de[1]),V=Vf(w,de[0],de[2]),re=Vf(I,de[1],de[3]),Q=de[0]-U,ae=de[1]-G,te=de[2]-de[0]-V,ce=de[3]-de[1]-re}const Ee=(de,Ae,je,Ce)=>{const Fe=Uf(de.stretch-U,V,v,r.left*a),Ve=jf(de.fixed-Q,te,de.stretch,A),Te=Uf(Ae.stretch-G,re,b,r.top*a),Oe=jf(Ae.fixed-ae,ce,Ae.stretch,P),fe=Uf(je.stretch-U,V,v,r.left*a),Se=jf(je.f
vendor: 6,869 bytes, line 14
14ixed-Q,te,je.stretch,A),He=Uf(Ce.stretch-G,re,b,r.top*a),Be=jf(Ce.fixed-ae,ce,Ce.stretch,P),ct=new ke(Fe,Te),nt=new ke(fe,Te),De=new ke(fe,He),Ne=new ke(Fe,He),ot=new ke(Ve/p,Oe/p),et=new ke(Se/p,Be/p),Xe=e*Math.PI/180;if(Xe){const qt=Math.sin(Xe),Lt=Math.cos(Xe),Ii=[Lt,-qt,qt,Lt];ct._matMult(Ii),nt._matMult(Ii),Ne._matMult(Ii),De._matMult(Ii)}const tt=de.stretch+de.fixed,_t=je.stretch+je.fixed,Tt=Ae.stretch+Ae.fixed,Mt=Ce.stretch+Ce.fixed,It=r.imageSecondary;return{tl:ct,tr:nt,bl:Ne,br:De,texPrimary:{x:u.paddedRect.x+za+tt,y:u.paddedRect.y+za+Tt,w:_t-tt,h:Mt-Tt},texSecondary:It?{x:It.paddedRect.x+za+tt,y:It.paddedRect.y+za+Tt,w:_t-tt,h:Mt-Tt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ot,pixelOffsetBR:et,minFontScaleX:te/p/v,minFontScaleY:ce/p/b,isSDF:i}};if(s&&(u.stretchX||u.stretchY)){const de=Iy(w,R,A),Ae=Iy(I,O,P);for(let je=0;je<de.length-1;je++){const Ce=de[je],Fe=de[je+1];for(let Ve=0;Ve<Ae.length-1;Ve++)h.push(Ee(Ce,Ae[Ve],Fe,Ae[Ve+1]))}}else h.push(Ee({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:g+1}));return h}function Vf(r,e,i){let s=0;for(const a of r)s+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return s}function Iy(r,e,i){const s=[{fixed:-za,stretch:0}];for(const[a,h]of r){const u=s[s.length-1];s.push({fixed:a-u.stretch,stretch:u.stretch}),s.push({fixed:a-u.stretch,stretch:u.stretch+(h-a)})}return s.push({fixed:e+za,stretch:i}),s}function Uf(r,e,i,s){return r/e*i+s}function jf(r,e,i,s){return r-e*i/s}function n1(r,e,i,s){const a=e+r.positionedLines[s].lineOffset;return s===0?i+a/2:i+(a+(e+r.positionedLines[s-1].lineOffset))/2}function s1(r,e=1,i=!1){let s=1/0,a=1/0,h=-1/0,u=-1/0;const p=r[0];for(let I=0;I<p.length;I++){const A=p[I];(!I||A.x<s)&&(s=A.x),(!I||A.y<a)&&(a=A.y),(!I||A.x>h)&&(h=A.x),(!I||A.y>u)&&(u=A.y)}const _=Math.min(h-s,u-a);let g=_/2;const v=new nc([],o1);if(_===0)return new ke(s,a);for(let I=s;I<h;I+=_)for(let A=a;A<u;A+=_)v.push(new rh(I+g,A+g,g,r));let b=(function(I){let A=0,P=0,R=0;const O=I[0];for(let U=0,V=O.length,G=V-1;U<V;G=U++){const re=O[U],Q=O[G],te=re.x*Q.y-Q.x*re.y;P+=(re.x+Q.x)*te,R+=(re.y+Q.y)*te,A+=3*te}return new rh(P/A,R/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 rh(I.p.x-g,I.p.y-g,g,r)),v.push(new rh(I.p.x+g,I.p.y-g,g,r)),v.push(new rh(I.p.x-g,I.p.y+g,g,r)),v.push(new rh(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 o1(r,e){return e.max-r.max}class rh{constructor(e,i,s,a){this.p=new ke(e,i),this.h=s,this.d=(function(h,u){let p=!1,_=1/0;for(let g=0;g<u.length;g++){const v=u[g];for(let b=0,w=v.length,I=w-1;b<w;I=b++){const A=v[b],P=v[I];A.y>h.y!=P.y>h.y&&h.x<(P.x-A.x)*(h.y-A.y)/(P.y-A.y)+A.x&&(p=!p),_=Math.min(_,Mn(h,A,P))}}return(p?1:-1)*Math.sqrt(_)})(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const a1=Object.keys,km=Number.POSITIVE_INFINITY,l1=Math.sqrt(2);function Ay(r,[e,i]){let s=0,a=0;if(i===km){e<0&&(e=0);const h=e/l1;switch(r){case"top-right":case"top-left":a=h-7;break;case"bottom-right":case"bottom-left":a=7-h;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":s=-h;break;case"top-left":case"bottom-left":s=h;break;case"left":s=e;break;case"right":s=-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":s=-e;break;case"top-left":case"bottom-left":case"left":s=e}}return[s,a]}function Gf(r,e,i,s,a,h,u,p,_){if(!e||!e.usvg)return;const g=fy(s),v=fy(a),b=h!=="both"&&h!=="width"||!uy(s)?1:v.width/g.width,w=h!=="both"&&h!=="height"||!dy(s)?1:v.height/g.height;i.scaleSelf(b,w);const I=i.toString();u.set(I,i),p.set(I,e);const{imagePosition:A}=Fm(I,e,Vl);_.set(I,A)}function My(r,e,i,s,a,h,u,p,_){if(!r)return;const g=(function(v,b,w,I,A,P){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const R=b.possiblyEvaluate(new pi(v.maxZoom,{worldview:P}),w).evaluate(A,{},w),O=b.possiblyEvaluate(new pi(v.minZoom,{worldview:P}),w).evaluate(A,{},w);return Math.max(R,O)}return b.possiblyEvaluate(new pi(I,{worldview:P})).evaluate(A,{},w)})(e,i,s,a,h,_);return r.scaleSelf(g*p*u)}function Cy(r,e,i,s,a,h,u,p,_){return{iconPrimary:My(r.getPrimary(),e,i,s,a,h,u,p,_),iconSecondary:My(r.getSecondary(),e,i,s,a,h,u,p,_)}}function c1(r,e,i){if(!e)return;const s=i.get(r.toString()),a=i.get(e.toString());a&&(s.paddedRect.w===a.paddedRect.w&&s.paddedRect.h===a.paddedRect.h||Gt(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),s.usvg!==a.usvg&&Gt(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function Py(r,e,i,s){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,s){const h=e.get(s.toString());r.imageSecondary=h}}function h1(r,e){for(const i in r.horizontal)zy(r.horizontal[i],e);zy(r.vertical,e)}function zy(r,e){if(r){for(const i of r.positionedLines)for(const s of i.positionedGlyphs)if(s.image!==null){const a=s.image.toString();s.rect=e.get(a).paddedRect}}}function Bm(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 u1(r,e,i,s,a,h,u,p,_){const g=Nm(h.horizontal)||h.vertical,v=i.get("icon-text-fit-padding").evaluate(s,{},a);let b,w=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&h.vertical&&(b=hy(e,h.vertical,_,v,p,u)),g&&(w=hy(e,g,_,v,p,u))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function d1(r,e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O,U,V){let G=u.textMaxSize.evaluate(e,{},w);G===void 0?G=p*u.textScaleFactor:G*=u.textScaleFactor;const re=r.layers[0].layout,Q=Nm(i.horizontal)||i.vertical,te=I.name==="globe",ae=Ir,ce=r.tilePixelRatio*G/ae,Ee=(Ve=r.overscaling,r.zoom>18&&Ve>2&&(Ve>>=1),Math.max(We/(512*Ve),1)*re.get("symbol-spacing")),de=re.get("text-padding")*r.tilePixelRatio,Ae=re.get("icon-padding")*r.tilePixelRatio,je=ei(re.get("text-max-angle")),Ce=re.get("icon-rotation-alignment")==="map"&&V!=="point",Fe=Ee/2;var Ve;r.hasAnyIconTextFit===!1&&R!=="none"&&(r.hasAnyIconTextFit=!0);const Te=e.properties?+e.properties[Qe]:null,Oe=Te&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(Te):65535,fe=(Se,He,Be)=>{if(He.x<0||He.x>=We||He.y<0||He.y>=We)return;let ct=null;if(te){const{x:nt,y:De,z:Ne}=I.projectTilePoint(He.x,He.y,Be);ct={anchor:new Oo(nt,De,Ne,0,void 0),up:I.upVector(Be,He.x,He.y)}}(function(nt,De,Ne,ot,et,Xe,tt,_t,Tt,Mt,It,qt,Lt,Ii,H,$,be,$e,Ke,Ye,st,vt,Nt,Vt,zt,mi,Hi,Ct,Pi){const Ti=nt.addToLineVertexArray(De,ot);let hi,Ui,Ai,Si,Ei,fi,Rt,_i=0,ji=0,yt=0,Zt=0,Mi=-1,Wi=-1;const zi={};let _r=Wo("");const xi=Ne?Ne.anchor:De,ur=Ct!=="none";let mn=0,Dr=0;
14if(Tt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const gr=Tt.layout.get("text-offset").evaluate(st,{},zt);mn=gr[0]*Ir,Dr=gr[1]*Ir}else mn=Tt.layout.get("text-radial-offset").evaluate(st,{},zt)*Ir,Dr=km;if(nt.allowVerticalPlacement&&et.vertical){const gr=et.vertical;if(H)fi=Vm(gr),_t&&(Rt=Vm(_t));else{const vr=Tt.layout.get("text-rotate").evaluate(st,{},zt)+90;Ai=qf(Mt,xi,De,It,qt,Lt,gr,Ii,vr,$),_t&&(Si=qf(Mt,xi,De,It,qt,Lt,_t,$e,vr))}}if(Xe){const gr=nt.iconSizeData,vr=Tt.layout.get("icon-rotate").evaluate(st,{},zt),Lr=Ey(Xe,vr,Nt,ur,vt.iconScaleFactor),Kr=_t?Ey(_t,vr,Nt,ur,vt.iconScaleFactor):void 0;Ui=qf(Mt,xi,De,It,qt,Lt,Xe,$e,vr,null),_i=4*Lr.length;let jr=null;gr.kind==="source"?(jr=[oo*Tt.layout.get("icon-size").evaluate(st,{},zt)*vt.iconScaleFactor],jr[0]>Ra&&Gt(`${nt.layerIds[0]}: Value for "icon-size" is >= ${Ku}. Reduce your "icon-size".`)):gr.kind==="composite"&&(jr=[oo*vt.compositeIconSizes[0].evaluate(st,{},zt)*vt.iconScaleFactor,oo*vt.compositeIconSizes[1].evaluate(st,{},zt)*vt.iconScaleFactor],(jr[0]>Ra||jr[1]>Ra)&&Gt(`${nt.layerIds[0]}: Value for "icon-size" is >= ${Ku}. Reduce your "icon-size".`)),nt.addSymbols(nt.icon,Lr,jr,Ye,Ke,st,void 0,Ne,De,Ti.lineStartIndex,Ti.lineLength,-1,Vt,zt,mi,Hi),Mi=nt.icon.placedSymbolArray.length-1,Kr&&(ji=4*Kr.length,nt.addSymbols(nt.icon,Kr,jr,Ye,Ke,st,Dn.vertical,Ne,De,Ti.lineStartIndex,Ti.lineLength,-1,Vt,zt,mi,Hi),Wi=nt.icon.placedSymbolArray.length-1)}for(const gr in et.horizontal){const vr=gr,Lr=et.horizontal[vr];hi||(_r=Wo(Lr.text),H?Ei=Vm(Lr):hi=qf(Mt,xi,De,It,qt,Lt,Lr,Ii,Tt.layout.get("text-rotate").evaluate(st,{},zt),$));const Kr=Lr.positionedLines.length===1;if(yt+=Ry(nt,Ne,De,Lr,tt,Tt,H,st,$,Ti,et.vertical?Dn.horizontal:Dn.horizontalOnly,Kr?a1(et.horizontal):[vr],zi,Mi,vt,Vt,zt,mi),Kr)break}et.vertical&&(Zt+=Ry(nt,Ne,De,et.vertical,tt,Tt,H,st,$,Ti,Dn.vertical,["vertical"],zi,Wi,vt,Vt,zt,mi));let Mr=-1;const _n=(gr,vr)=>gr?Math.max(gr,vr):vr;Mr=_n(Ei,Mr),Mr=_n(fi,Mr),Mr=_n(Rt,Mr);const ao=Mr>-1?1:0;nt.glyphOffsetArray.length>=65535&&Gt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),st.sortKey!==void 0&&nt.addToSortKeyRanges(nt.symbolInstances.length,st.sortKey),nt.symbolInstances.emplaceBack(De.x,De.y,xi.x,xi.y,xi.z,zi.right>=0?zi.right:-1,zi.center>=0?zi.center:-1,zi.left>=0?zi.left:-1,zi.vertical>=0?zi.vertical:-1,Mi,Wi,_r,hi!==void 0?hi:nt.collisionBoxArray.length,hi!==void 0?hi+1:nt.collisionBoxArray.length,Ai!==void 0?Ai:nt.collisionBoxArray.length,Ai!==void 0?Ai+1:nt.collisionBoxArray.length,Ui!==void 0?Ui:nt.collisionBoxArray.length,Ui!==void 0?Ui+1:nt.collisionBoxArray.length,Si||nt.collisionBoxArray.length,Si?Si+1:nt.collisionBoxArray.length,It,yt,Zt,_i,ji,ao,0,mn,Dr,Mr,0,ur?1:0,Pi)})(r,He,ct,Se,i,s,h,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,de,U,g,0,Ae,Ce,O,e,u,v,b,w,A,P,R,Oe)};if(V==="line")for(const Se of Pf(e.geometry,0,0,We,We)){const He=r1(Se,Ee,je,i.vertical||Q,s,ae,ce,r.overscaling,We);for(const Be of He)Q&&f1(r,Q.text,Fe,Be)||fe(Se,Be,w)}else if(V==="line-center"){for(const Se of e.geometry)if(Se.length>1){const He=i1(Se,je,i.vertical||Q,s,ae,ce);He&&fe(Se,He,w)}}else if(e.type==="Polygon")for(const Se of Du(e.geometry,0)){const He=s1(Se,16);fe(Se[0],new Oo(He.x,He.y,0,0,void 0),w)}else if(e.type==="LineString")for(const Se of e.geometry)fe(Se,new Oo(Se[0].x,Se[0].y,0,0,void 0),w);else if(e.type==="Point")for(const Se of e.geometry)for(const He of Se)fe([He],new Oo(He.x,He.y,0,0,void 0),w)}const Ku=255,Ra=Ku*oo;function Ry(r,e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R,O){const U=(function(re,Q,te,ae,ce,Ee,de,Ae){const je=[];if(Q.positionedLines.length===0)return je;const Ce=ae.layout.get("text-rotate").evaluate(Ee,{})*Math.PI/180,Fe=(function(Se){const He=Se[0],Be=Se[1],ct=He*Be;return ct>0?[He,-Be]:ct<0?[-He,Be]:He===0?[Be,He]:[Be,-He]})(te);let Ve=Math.abs(Q.top-Q.bottom);for(const Se of Q.positionedLines)Ve-=Se.lineOffset;const Te=Q.positionedLines.length,Oe=Ve/Te;let fe=Q.top-te[1];for(let Se=0;Se<Te;++Se){const He=Q.positionedLines[Se];fe=n1(Q,Oe,fe,Se);for(const Be of He.positionedGlyphs){if(!Be.rect)continue;const ct=Be.rect||{};let nt=ry+1,De=!0,Ne=1,ot=0;if(Be.image){const st=de.get(Be.image.toString());if(!st)continue;if(st.sdf){Gt("SDF images are not supported in formatted text and will be ignored.");continue}De=!1,Ne=st.pixelRatio,nt=Vl/Ne}const et=(ce||Ae)&&Be.vertical,Xe=Be.metrics.advance*Be.scale/2,tt=Be.metrics,_t=Be.rect;if(_t===null)continue;Ae&&Q.verticalizable&&(ot=Be.image?Xe-Be.metrics.width*Be.scale/2:0);const Tt=ce?[Be.x+Xe,Be.y]:[0,0];let Mt=[0,0],It=[0,0],qt=!1;ce||(et?(It=[Be.x+Xe+Fe[0],Be.y+Fe[1]-ot],qt=!0):Mt=[Be.x+Xe+te[0],Be.y+te[1]-ot]);const Lt=_t.w*Be.scale/(Ne*(Be.localGlyph?Ss:1)),Ii=_t.h*Be.scale/(Ne*(Be.localGlyph?Ss:1));let H,$,be,$e;if(et){const st=Be.y-fe,vt=new ke(-Xe,Xe-st),Nt=-Math.PI/2,Vt=new ke(...It);
vendor: 27,658 bytes, line 14
14H=new ke(-Xe+Mt[0],Mt[1]),H._rotateAround(Nt,vt)._add(Vt),H.x+=-st+Xe,H.y-=(tt.left-nt)*Be.scale;const zt=Be.image?tt.advance*Be.scale:Ir*Be.scale,mi=String.fromCodePoint(Be.glyph);N0(mi)?H.x+=(1-nt)*Be.scale:V0(mi)?H.x+=zt-tt.height*Be.scale+(-nt-1)*Be.scale:H.x+=Be.image||tt.width+2*nt===_t.w&&tt.height+2*nt===_t.h?(zt-Ii)/2:(zt-(tt.height+2*nt)*Be.scale)/2,$=new ke(H.x,H.y-Lt),be=new ke(H.x+Ii,H.y),$e=new ke(H.x+Ii,H.y-Lt)}else{const st=(tt.left-nt)*Be.scale-Xe+Mt[0],vt=(-tt.top-nt)*Be.scale+Mt[1],Nt=st+Lt,Vt=vt+Ii;H=new ke(st,vt),$=new ke(Nt,vt),be=new ke(st,Vt),$e=new ke(Nt,Vt)}if(Ce){let st;st=ce?new ke(0,0):qt?new ke(Fe[0],Fe[1]):new ke(te[0],te[1]),H._rotateAround(Ce,st),$._rotateAround(Ce,st),be._rotateAround(Ce,st),$e._rotateAround(Ce,st)}const Ke=new ke(0,0),Ye=new ke(0,0);je.push({tl:H,tr:$,bl:be,br:$e,texPrimary:ct,texSecondary:void 0,writingMode:Q.writingMode,glyphOffset:Tt,sectionIndex:Be.sectionIndex,isSDF:De,pixelOffsetTL:Ke,pixelOffsetBR:Ye,minFontScaleX:0,minFontScaleY:0})}}return je})(0,s,_,h,u,p,a,r.allowVerticalPlacement),V=r.textSizeData;let G=null;V.kind==="source"?(G=[oo*h.layout.get("text-size").evaluate(p,{},R)*A.textScaleFactor],G[0]>Ra&&Gt(`${r.layerIds[0]}: Value for "text-size" is >= ${Ku}. Reduce your "text-size".`)):V.kind==="composite"&&(G=[oo*A.compositeTextSizes[0].evaluate(p,{},R)*A.textScaleFactor,oo*A.compositeTextSizes[1].evaluate(p,{},R)*A.textScaleFactor],(G[0]>Ra||G[1]>Ra)&&Gt(`${r.layerIds[0]}: Value for "text-size" is >= ${Ku}. Reduce your "text-size".`)),r.addSymbols(r.text,U,G,_,u,p,v,e,i,g.lineStartIndex,g.lineLength,I,P,R,O,!1);for(const re of b)w[re]=r.text.placedSymbolArray.length-1;return 4*U.length}function Nm(r){for(const e in r)return r[e];return null}function qf(r,e,i,s,a,h,u,p,_,g){let v=u.top,b=u.bottom,w=u.left,I=u.right;if(cy(u)&&u.collisionPadding){const A=u.collisionPadding;w-=A[0],v-=A[1],I+=A[2],b+=A[3]}if(_){const A=new ke(w,v),P=new ke(I,v),R=new ke(w,b),O=new ke(I,b),U=ei(_);let V=new ke(0,0);g&&(V=new ke(g[0],g[1])),A._rotateAround(U,V),P._rotateAround(U,V),R._rotateAround(U,V),O._rotateAround(U,V),w=Math.min(A.x,P.x,R.x,O.x),I=Math.max(A.x,P.x,R.x,O.x),v=Math.min(A.y,P.y,R.y,O.y),b=Math.max(A.y,P.y,R.y,O.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,w,v,I,b,p,s,a,h),r.length-1}function Vm(r){cy(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 f1(r,e,i,s){const a=r.compareText;if(e in a){const h=a[e];for(let u=h.length-1;u>=0;u--)if(s.dist(h[u])<i)return!0}else a[e]=[];return a[e].push(s),!1}function Dy(r,e){const i=r.fovAboveCenter,s=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-s)/Math.cos(r._pitch),h=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let u=Math.sin(r._pitch)*h+a;const p=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let _=Math.max(r.zoom-17,0);r.isOrthographic&&(_/=10),u*=1+_}return Math.min(1.01*u,p)}function Ju(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),s=r.x*i,a=(r.x+1)*i,h=r.y*i,u=(r.y+1)*i,p=N(s),_=N(a),g=j(h),v=j(u),b=e.project(p,g),w=e.project(_,g),I=e.project(_,v),A=e.project(p,v);let P=Math.min(b.x,w.x,I.x,A.x),R=Math.min(b.y,w.y,I.y,A.y),O=Math.max(b.x,w.x,I.x,A.x),U=Math.max(b.y,w.y,I.y,A.y);const V=i/16;function G(Q,te,ae,ce,Ee,de){const Ae=(ae+Ee)/2,je=(ce+de)/2,Ce=e.project(N(Ae),j(je)),Fe=Math.max(0,P-Ce.x,R-Ce.y,Ce.x-O,Ce.y-U);P=Math.min(P,Ce.x),O=Math.max(O,Ce.x),R=Math.min(R,Ce.y),U=Math.max(U,Ce.y),Fe>V&&(G(Q,Ce,ae,ce,Ae,je),G(Ce,te,Ae,je,Ee,de))}G(b,w,s,h,a,h),G(w,I,a,h,a,u),G(I,A,a,u,s,u),G(A,b,s,u,s,h),P-=V,R-=V,O+=V,U+=V;const re=1/Math.max(O-P,U-R);return{scale:re,x:P*re,y:R*re,x2:O*re,y2:U*re,projection:e}}function Ly(r,{x:e,y:i},s=0){return new ke(((e-s)*r.scale-r.x)*We,(i*r.scale-r.y)*We)}const p1=Bt(new Float32Array(16));class Da{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new S(0,0)}projectTilePoint(e,i,s){return{x:e,y:i,z:0}}locationPoint(e,i,s,a=!0){return e._coordinatePoint(e.locationCoordinate(i,s),a)}pixelsPerMeter(e,i){return L(1,e)*i}pixelSpaceConversion(e,i,s){return 1}farthestPixelDistance(e){return Dy(e,e.pixelsPerMeter)}pointCoordinate(e,i,s,a){const h=e.horizonLineFromTop(!1),u=new ke(i,Math.max(h,s));return e.rayIntersectionCoordinate(e.pointRayIntersection(u,a))}pointCoordinate3D(e,i,s){const a=new ke(i,s);if(e.elevation)return e.elevation.pointCoordinate(a);{const h=this.pointCoordinate(e,a.x,a.y,0);return[h.x,h.y,h.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const s=e.horizonLineFromTop();return i.y<s}createInversionMatrix(e,i){return p1}createTileMatrix(e,i,s){let a,h,u;const p=s.canonical,_=Bt(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=Ju(p,this);a=1,h=g.x+s.wrap*g.scale,u=g.y,Fr(_,_,[a/g.scale,a/g.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(p.z),h=(p.x+Math.pow(2,p.z)*s.wrap)*a,u=p.y*a;return qr(_,_,[h,u,0]),Fr(_,_,[a/We,a/We,1]),_}upVector(e,i,s){return[0,0,1]}upVectorScale(e,i,s){return{metersToTile:1}}}class m1 extends Da{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,s]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(ei(i));this.n=(a+Math.sin(ei(s)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:s,c:a,r0:h}=this,u=ei(e-this.center[0]),p=ei(i),_=Math.sqrt(a-2*s*Math.sin(p))/s;return{x:_*Math.sin(u*s),y:_*Math.cos(u*s)-h,z:0}}unproject(e,i){const{n:s,c:a,r0:h}=this,u=h+i;let p=Math.atan2(e,Math.abs(u))*Math.sign(u);u*s<0&&(p-=Math.PI*Math.sign(e)*Math.sign(u));const _=ei(this.center[0])*s;p=ve(p,-Math.PI-_,Math.PI-_);const g=W(ge(p/s)+this.center[0],-180,180),v=Math.asin(W((a-(e*e+u*u)*s*s)/(2*s),-1,1)),b=W(ge(v),-X,X);return new S(g,b)}}const Qu=1.340264,ed=-.081106,td=893e-6,id=.003796,Hf=Math.sqrt(3)/2;class _1 extends Da{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const s=Math.asin(Hf*Math.sin(i)),a=s*s,h=a*a*a;return{x:.5*(e*Math.cos(s)/(Hf*(Qu+3*ed*a+h*(7*td+9*id*a)))/Math.PI+.5),y:1-.5*(s*(Qu+ed*a+h*(td+id*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=s*s,h=a*a*a;for(let v,b,w,I=0;I<12&&(b=s*(Qu+ed*a+h*(td+id*a))-i,w=Qu+3*ed*a+h*(7*td+9*id*a),v=b/w,s=W(s-v,-Math.PI/3,Math.PI/3),a=s*s,h=a*a*a,!(Math.abs(v)<1e-12));++I);const u=Hf*e*(Qu+3*ed*a+h*(7*td+9*id*a))/Math.cos(s),p=Math.asin(Math.sin(s)/Hf),_=W(180*u/Math.PI,-180,180),g=W(180*p/Math.PI,-X,X);return new S(_,g)}}class g1 extends Da{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 s=360*(e-.5),a=W(360*(.5-i),-X,X);return new S(s,a)}}const nh=Math.PI/2;function $f(r){return Math.tan((nh+r)/2)}class y1 extends Da{constructor(e){super(e),this.center=e.center||[0,30];const[i,s]=this.parallels=e.parallels||[30,30];let a=ei(i),h=ei(s);this.southernCenter=a+h<0,this.southernCenter&&(a=-a,h=-h);const u=Math.cos(a),p=$f(a);this.n=a===h?Math.sin(a):Math.log(u/Math.cos(h))/Math.log($f(h)/p),this.f=u*Math.pow($f(a),this.n)/this.n}project(e,i){i=ei(i),this.southernCenter&&(i=-i),e=ei(e-this.center[0]);const s=1e-6,{n:a,f:h}=this;h>0?i<-nh+s&&(i=-nh+s):i>nh-s&&(i=nh-s);const u=h/Math.pow($f(i),a);let p=u*Math.sin(a*e),_=h-u*Math.cos(a*e);return p=.5*(p/Math.PI+.5),_=.5*(_/Math.PI+.5),{x:p,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:s,f:a}=this,h=a-i,u=Math.sign(h),p=Math.sign(s)*Math.sqrt(e*e+h*h);let _=Math.atan2(e,Math.abs(h))*u;h*s<0&&(_-=Math.PI*Math.sign(e)*u);const g=W(ge(_/s)+this.center[0],-180,180),v=W(ge(2*Math.atan(Math.pow(a/p,1/s))-nh),-X,X);return new S(g,this.southernCenter?-v:v)}}class Fy extends Da{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:z(e),y:F(i),z:0}}unproject(e,i){const s=N(e),a=j(i);return new S(s,a)}}const Oy=ei(X);class x1 extends Da{project(e,i){const s=(i=ei(i))*i,a=s*s;return{x:.5*((e=ei(e))*(.8707-.131979*s+a*(a*(.003971*s-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+s*(.015085+a*(.028874*s-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let s=i=(2*(1-i)-1)*Math.PI,a=25,h=0,u=s*s;do{u=s*s;const g=u*u;h=(s*(1.007226+u*(.015085+g*(.028874*u-.044475-.005916*g)))-i)/(1.007226+u*(.045255+g*(.259866*u-.311325-.005916*11*g))),s=W(s-h,-Oy,Oy)}while(Math.abs(h)>1e-6&&--a>0);u=s*s;const p=W(ge(e/(.8707+u*(u*(u*u*u*(.003971-.001529*u)-.013791)-.131979))),-180,180),_=ge(s);return new S(p,_)}}const ky=ei(X);class v1 extends Da{project(e,i){i=ei(i),e=ei(e);const s=Math.cos(i),a=2/Math.PI,h=Math.acos(s*Math.cos(e/2)),u=Math.sin(h)/h,p=.5*(e*a+2*s*Math.sin(e/2)/u)||0,_=.5*(i+Math.sin(i)/u)||0;return{x:.5*(p/Math.PI+.5),y:1-.5*(_/Math.PI+1),z:0}}unproject(e,i){let s=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,h=25;const u=1e-6;let p=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(s/2),P=Math.sin(s/2),R=2*A*P,O=P*P,U=1-I*A*A,V=U?1/U:0,G=U?Math.acos(g*A)*Math.sqrt(1/U):0,re=.5*(2*G*g*P+2*s/Math.PI)-e,Q=.5*(G*v+a)-i,te=.5*V*(I*O+G*g*A*w)+1/Math.PI,ae=V*(R*b/4-G*v*P),ce=.125*V*(b*P-G*v*I*R),Ee=.5*V*(w*A+G*O*g)+.5,de=ae*ce-Ee*te;p=(Q*ae-re*Ee)/de,_=(re*ce-Q*te)/de,s=W(s-p,-Math.PI,Math.PI),a=W(a-_,-ky,ky)}while((Math.abs(p)>u||Math.abs(_)>u)&&--h>0);return new S(ge(s),ge(a))}}class By extends Da{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ei(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:s,cosPhi:a}=this;return{x:ei(e)*a*s+.5,y:-Math.sin(ei(i))/a*s+.5,z:0}}unproject(e,i){const{scale:s,cosPhi:a}=this,h=-(i-.5)/s,u=W(ge((e-.5)/s)/a,-180,180),p=Math.asin(W(h*a,-1,1)),_=W(ge(p),-X,X);return new S(u,_)}}class b1 extends Fy{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,s){const a=Au(e,i,s);return tr(a,a,bf(no(s))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,s){const a=y(i.lat,i.lng),h=Ri([],a),u=s?e._centerAltitude+s:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;Hr(a,a,h,L(1,0)*We*u);const p=Bt(new Float64Array(16));return Gi(p,e.pixelMatrix,e.globeMatrix),tr(a,a,p),new ke(a[0],a[1])}pixelsPerMeter(e,i){return L(1,0)*i}pixelSpaceConversion(e,i,s){const a=L(1,e)*i,h=pt(L(1,45)*i,a,s);return this.pixelsPerMeter(e,i)/h}createTileMatrix(e,i,s){const a=Xp(no(s.canonical));return Gi(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:s}=e,a=bf(no(i));return ls(a,a,ei(s.lng)),As(a,a,ei(s.lat)),Fr(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,s,a){return c_(e,i,s,!0)||new J(0,0)}pointCoordinate3D(e,i,s){const a=this.pointCoordinate(e,i,s,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!c_(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=(function(a,h){const u=a.cameraToCenterDistance,p=a._centerAltitude*h,_=a._camera,g=a._camera.forward(),v=ki([],Fi([],g,-u),[0,0,p]),b=a.worldSize/(2*Math.PI),w=[0,0,-b],I=a.width/a.height,A=Math.tan(a.fovAboveCenter),P=Fi([],_.up(),A),R=Fi([],_.right(),A*I),O=Ri([],ki([],ki([],g,P),R)),U=[];let V;if(new Kt(v,O).closestPointOnSphere(w,b,U)){const G=ki([],U,w),re=ir([],G,v);V=Math.cos(a.fovAboveCenter)*Cr(re)}else{const G=ir([],v,w),re=ir([],w,v);Ri(re,re);const Q=Cr(G)-b;V=Math.sqrt(Q*(Q+2*b));const te=Math.acos(V/(b+Q))-Math.acos(er(g,re));V*=Math.cos(te)}return 1.01*V})(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),s=Aa(e.zoom);if(s>0){const a=Dy(e,L(1,e.center.lat)*e.worldSize),h=e.worldSize/(2*Math.PI),u=Math.max(e.width,e.height)/e.worldSize*Math.PI;return pt(i,a+h*(1-Math.cos(u)),Math.pow(s,10))}return i}upVector(e,i,s){return Au(i,s,e,1)}upVectorScale(e){return{metersToTile:yf(vf(no(e)))}}}function Ny(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(r.name){case"mercator":return new Fy(r);case"equirectangular":return new g1(r);case"naturalEarth":return new x1(r);case"equalEarth":return new _1(r);case"winkelTripel":return new v1(r);case"albers":return i?new By(r):new m1(r);case"lambertConformalConic":return i?new By(r):new y1(r);case"globe":return new b1(r)}throw new Error(`Invalid projection name: ${r.name}`)}const w1=_e.types,T1=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Zf(r,e,i,s,a,h,u,p,_,g,v,b,w){const I=p?Math.min(Ra,Math.round(p[0])):0,A=p?Math.min(Ra,Math.round(p[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*a),h,u,(I<<1)+(_?1:0),A,16*g,16*v,256*b,256*w)}function Wf(r,e,i){r.emplaceBack(e,i)}function Xf(r,e,i,s,a,h,u){r.emplaceBack(e,i,s,a,h,u)}const Yf=(r,e,i,s)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],s[0],s[1],s[2])};function Kf(r,e,i,s,a){r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a),r.emplaceBack(e,i,s,a)}function S1(r){for(const e of r.sections)if(Lp(e.text))return!0;return!1}class Um{constructor(e){this.layoutVertexArray=new Nc,this.indexArray=new Li,this.programConfigurations=e,this.segments=new Ni,this.dynamicLayoutVertexArray=new to,this.opacityVertexArray=new hu,this.placedSymbolArray=new Ml,this.iconTransitioningVertexArray=new is,this.globeExtVertexArray=new ya,this.zOffsetVertexArray=new zo,this.orientationVertexArray=new fu}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,s,a,h){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,C0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,z0.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,T1,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,L0.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,P0.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||h)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,R0.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,D0.members,!0)),this.opacityVertexBuffer.itemSize=1),(s||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())}}rt(Um,"SymbolBuffers");class jm{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Ni,this.collisionVertexArray=new va,this.collisionVertexArrayExt=new to}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,F0.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,O0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}rt(jm,"CollisionBuffers");class Jf{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((u=>u.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=Bt([]),this.placementViewportMatrix=Bt([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.textSizeData=py(this.zoom,i["text-size"],this.worldview),this.iconSizeData=py(this.zoom,i["icon-size"],this.worldview);const s=this.layers[0].layout,a=s.get("symbol-sort-key"),h=s.get("symbol-z-order");this.canOverlap=s.get("text-allow-overlap")||s.get("icon-allow-overlap")||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=s.get("text-writing-mode").map((u=>Dn[u])),this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.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}createArrays(){this.text=new Um(new An(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("text")||e.startsWith("symbol")))),this.icon=new Um(new An(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("icon")||e.startsWith("symbol")))),this.glyphOffsetArray=new bu,this.lineVertexArray=new of,this.symbolInstances=new sf}calculateGlyphDependencies(e,i,s,a,h){for(const u of e){const p=u.codePointAt(0);if(p===void 0)break;if(i[p]=!0,a&&h&&p<=65535){const _=$u[u];_&&(i[_.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Af(this.activeReplacements,s)&&(this.activeReplacements=s,!0)}populate(e,i,s,a){const h=this.layers[0],u=h.layout,p=this.projection.name==="globe",_=u.get("text-font"),g=u.get("text-field"),v=u.get("icon-image"),[b,w]=u.get("icon-size-scale-range"),I=W(i.scaleFactor||1,b,w),A=(g.value.kind!=="constant"||g.value.value instanceof $r&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),P=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,R=u.get("symbol-sort-key");if(this.features=[],!A&&!P)return;const O=i.iconDependencies,U=i.glyphDependencies,V=i.availableImages,G=new pi(this.zoom,{worldview:this.worldview});for(const{feature:re,id:Q,index:te,sourceLayerIndex:ae}of e){const ce=h._featureFilter.needGeometry,Ee=we(re,ce);if(!h._featureFilter.filter(G,Ee,s))continue;if(ce||(Ee.geometry=se(re,s,a)),p&&re.type!==1&&s.z<=5){const Fe=Ee.geometry,Ve=.98078528056,Te=(Oe,fe)=>er(Au(Oe.x,Oe.y,s,1),Au(fe.x,fe.y,s,1))<Ve;for(let Oe=0;Oe<Fe.length;Oe++)Fe[Oe]=xe(Fe[Oe],Te)}let de,Ae;if(A){const Fe=h.getValueAndResolveTokens("text-field",Ee,s,V),Ve=$r.factory(Fe);S1(Ve)&&(this.hasRTLText=!0),(!this.hasRTLText||ru()==="unavailable"||this.hasRTLText&&es.isParsed())&&(de=B0(Ve,h,Ee))}if(P){const Fe=h.getValueAndResolveTokens("icon-image",Ee,s,V);Ae=typeof Fe=="string"?sn.build(Fe):Fe}if(!de&&!Ae)continue;const je=this.sortFeaturesByKey?R.evaluate(Ee,{},s):void 0,Ce={id:Q,text:de,icon:Ae,index:te,sourceLayerIndex:ae,geometry:Ee.geometry,properties:re.properties,type:w1[re.type],sortKey:je};if(this.features.push(Ce),Ae){const Fe=this.layers[0]._unevaluatedLayout._values,{iconPrimary:Ve,iconSecondary:Te}=Cy(Ae,this.iconSizeData,Fe["icon-size"],s,this.zoom,Ce,this.pixelRatio,I,this.worldview),Oe=Ve.id.toString();if(O.has(Oe)?O.get(Oe).push(Ve):O.set(Oe,[Ve]),Te){this.hasAnySecondaryIcon=!0;const fe=Te.id.toString();O.has(fe)?O.get(fe).push(Te):O.set(fe,[Te])}}if(de){const Fe=_.evaluate(Ee,{},s).join(","),Ve=u.get("text-rotation-alignment")==="map"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Dn.vertical)>=0;for(const Te of de.sections)if(Te.image){const Oe=Te.image.getPrimary().scaleSelf(this.pixelRatio),fe=Oe.id.toString(),Se=O.get(fe)||[];Se.push(Oe),O.set(fe,Se)}else{const Oe=Qh(de.toString()),fe=Te.fontStack||Fe,Se=U[fe]=U[fe]||{};this.calculateGlyphDependencies(Te.text,Se,Ve,this.allowVerticalPlacement,Oe)}}}if(u.get("symbol-placement")==="line"&&(this.features=(function(re){const Q={},te={},ae=[];let ce=0;function Ee(Ce){ae.push(re[Ce]),ce++}function de(Ce,Fe,Ve){const Te=te[Ce];return delete te[Ce],te[Fe]=Te,ae[Te].geometry[0].pop(),ae[Te].geometry[0]=ae[Te].geometry[0].concat(Ve[0]),Te}function Ae(Ce,Fe,Ve){const Te=Q[Fe];return delete Q[Fe],Q[Ce]=Te,ae[Te].geometry[0].shift(),ae[Te].geometry[0]=Ve[0].concat(ae[Te].geometry[0]),Te}function je(Ce,Fe,Ve){const Te=Ve?Fe[0][Fe[0].length-1]:Fe[0][0];return`${Ce}:${Te.x}:${Te.y}`}for(let Ce=0;Ce<re.length;Ce++){const Fe=re[Ce],Ve=Fe.geometry,Te=Fe.text?Fe.text.toString():null;if(!Te){Ee(Ce);continue}const Oe=je(Te,Ve),fe=je(Te,Ve,!0);if(Oe in te&&fe in Q&&te[Oe]!==Q[fe]){const Se=Ae(Oe,fe,Ve),He=de(Oe,fe,ae[Se].geometry);delete Q[Oe],delete te[fe],te[je(Te,ae[He].geometry,!0)]=He,ae[Se].geometry=null}else Oe in te?de(Oe,fe,Ve):fe in Q?Ae(Oe,fe,Ve):(Ee(Ce),Q[Oe]=ce-1,te[fe]=ce-1)}return ae.filter((Ce=>Ce.geometry))})(this.features)),u.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 u.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort(((re,Q)=>re.sortKey-Q.sortKey))}update(e,i,s,a,h,u,p){this.text.programConfigurations.updatePaintArrays(e,i,h,s,a,u,p,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,h,s,a,u,p,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const s=K(e),a=1/s;let h=!1,u=!1;for(let p=0;p<this.symbolInstances.length;p++){const _=this.symbolInstances.get(p),g=lr(1,0,0),v=lr(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:I,numVerticalIconVertices:A}=_,P=b>0||w>0,R=I>0,O=this.elevationFeatures[_.elevationFeatureIndex];if(O){const U=new ke(_.tileAnchorX,_.tileAnchorY),V=.075+O.pointElevation(U);_.zOffset!==V&&(i=!0,_.zOffset=V);const G=O.computeSlopeNormal(U,a),re=Uo(us(),lr(0,0,1),G);Rs(g,g,re),Rs(v,v,re),g[2]*=s,v[2]*=s,g[0]===1&&g[1]===0&&g[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(h=h||P,u=u||R)}if(P&&(Yf(this.text.orientationVertexArray,b,g,v),Yf(this.text.orientationVertexArray,w,g,v)),R){const{placedIconSymbolIndex:U,verticalPlacedIconSymbolIndex:V}=_;U>=0&&Yf(this.icon.orientationVertexArray,I,g,v),V>=0&&Yf(this.icon.orientationVertexArray,A,g,v)}}h||(this.text.orientationVertexArray=void 0),u||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(h,u,p)=>{s+=u,s>h.length&&h.resize(s);for(let _=-u;_<0;_++)h.emplace(_+s,p)},i=(h,u,p)=>{a+=u,a>h.length&&h.resize(a);for(let _=-u;_<0;_++)h.emplace(_+a,p)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let s=0,a=0;for(let h=0;h<this.symbolInstances.length;h++){const u=this.symbolInstances.get(h),{numHorizontalGlyphVertices:p,numVerticalGlyphVertices:_,numIconVertices:g}=u,v=u.zOffset,b=g>0;if((p>0||_>0)&&(e(this.text.zOffsetVertexArray,p,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:I}=u;w>=0&&i(this.icon.zOffsetVertexArray,g,v),I>=0&&i(this.icon.zOffsetVertexArray,u.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){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Ny(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:h}of i)this.lineVertexArray.emplaceBack(a,h);return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,a,h,u,p,_,g,v,b,w,I,A,P,R){const O=e.indexArray,U=e.layoutVertexArray,V=e.globeExtVertexArray,G=e.segments.prepareSegment(4*i.length,U,O,this.canOverlap?u.sortKey:void 0),re=this.glyphOffsetArray.length,Q=G.vertexLength,te=this.allowVerticalPlacement&&p===Dn.vertical?Math.PI/2:0,ae=u.text&&u.text.sections;for(let Ee=0;Ee<i.length;Ee++){const{tl:de,tr:Ae,bl:je,br:Ce,texPrimary:Fe,texSecondary:Ve,pixelOffsetTL:Te,pixelOffsetBR:Oe,minFontScaleX:fe,minFontScaleY:Se,glyphOffset:He,isSDF:Be,sectionIndex:ct}=i[Ee],nt=G.vertexLength,De=He[1];if(Zf(U,g.x,g.y,de.x,De+de.y,Fe.x,Fe.y,s,Be,Te.x,Te.y,fe,Se),Zf(U,g.x,g.y,Ae.x,De+Ae.y,Fe.x+Fe.w,Fe.y,s,Be,Oe.x,Te.y,fe,Se),Zf(U,g.x,g.y,je.x,De+je.y,Fe.x,Fe.y+Fe.h,s,Be,Te.x,Oe.y,fe,Se),Zf(U,g.x,g.y,Ce.x,De+Ce.y,Fe.x+Fe.w,Fe.y+Fe.h,s,Be,Oe.x,Oe.y,fe,Se),_){const{x:Ne,y:ot,z:et}=_.anchor,[Xe,tt,_t]=_.up;Xf(V,Ne,ot,et,Xe,tt,_t),Xf(V,Ne,ot,et,Xe,tt,_t),Xf(V,Ne,ot,et,Xe,tt,_t),Xf(V,Ne,ot,et,Xe,tt,_t),Kf(e.dynamicLayoutVertexArray,Ne,ot,et,te)}else Kf(e.dynamicLayoutVertexArray,g.x,g.y,g.z,te);if(R){const Ne=Ve||Fe;Wf(e.iconTransitioningVertexArray,Ne.x,Ne.y),Wf(e.iconTransitioningVertexArray,Ne.x+Ne.w,Ne.y),Wf(e.iconTransitioningVertexArray,Ne.x,Ne.y+Ne.h),Wf(e.iconTransitioningVertexArray,Ne.x+Ne.w,Ne.y+Ne.h)}O.emplaceBack(nt,nt+1,nt+2),O.emplaceBack(nt+1,nt+2,nt+3),G.vertexLength+=4,G.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(He[0]),Ee!==i.length-1&&
vendor: 6,967 bytes, line 14
14ct===i[Ee+1].sectionIndex||e.programConfigurations.populatePaintArrays(U.length,u,u.index,{},I,A,P,ae&&ae[ct],this.worldview)}const ce=_?_.anchor:g;e.placedSymbolArray.emplaceBack(ce.x,ce.y,ce.z,g.x,g.y,re,this.glyphOffsetArray.length-re,Q,v,b,g.segment,s?s[0]:0,s?s[1]:0,a[0],a[1],p,0,0,0,w,0)}_commitLayoutVertex(e,i,s,a,h,u,p){e.emplaceBack(i,s,a,h,u,Math.round(p.x),Math.round(p.y))}_addCollisionDebugVertices(e,i,s,a,h,u,p){const _=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),g=_.vertexLength,v=p.tileAnchorX,b=p.tileAnchorY;for(let I=0;I<4;I++)s.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(s.collisionVertexArrayExt,i,e.padding,p.zOffset),this._commitLayoutVertex(s.layoutVertexArray,a,h,u,v,b,new ke(e.x1,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,h,u,v,b,new ke(e.x2,e.y1)),this._commitLayoutVertex(s.layoutVertexArray,a,h,u,v,b,new ke(e.x2,e.y2)),this._commitLayoutVertex(s.layoutVertexArray,a,h,u,v,b,new ke(e.x1,e.y2)),_.vertexLength+=4;const w=s.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,s,a,h,u){for(let p=a;p<h;p++){const _=s.get(p),g=this.getSymbolInstanceTextSize(e,u,i,p);this._addCollisionDebugVertices(_,g,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,u)}}_addIconDebugCollisionBoxes(e,i,s,a,h,u){for(let p=a;p<h;p++){const _=s.get(p),g=this.getSymbolInstanceIconSize(e,i,u.placedIconSymbolIndex);this._addCollisionDebugVertices(_,g,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,u)}}generateCollisionDebugBuffers(e,i,s){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new jm(Vc,Qg.members,is),this.iconCollisionBox=new jm(Vc,Qg.members,is);const a=Wu(this.iconSizeData,e),h=Wu(this.textSizeData,e,s);for(let u=0;u<this.symbolInstances.length;u++){const p=this.symbolInstances.get(u);this._addTextDebugCollisionBoxes(h,e,i,p.textBoxStartIndex,p.textBoxEndIndex,p),this._addTextDebugCollisionBoxes(h,e,i,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p),this._addIconDebugCollisionBoxes(a,e,i,p.iconBoxStartIndex,p.iconBoxEndIndex,p),this._addIconDebugCollisionBoxes(a,e,i,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex,p)}}getSymbolInstanceTextSize(e,i,s,a){const h=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),u=Lm(this.textSizeData,e,h)/Ir;return this.tilePixelRatio*u}getSymbolInstanceIconSize(e,i,s){const a=this.icon.placedSymbolArray.get(s),h=Lm(this.iconSizeData,e,a);return this.tilePixelRatio*h}_commitDebugCollisionVertexUpdate(e,i,s,a){e.emplaceBack(i,-s,-s,a),e.emplaceBack(i,s,-s,a),e.emplaceBack(i,s,s,a),e.emplaceBack(i,-s,s,a)}_updateTextDebugCollisionBoxes(e,i,s,a,h,u,p){for(let _=a;_<h;_++){const g=s.get(_),v=this.getSymbolInstanceTextSize(e,u,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,g.padding,u.zOffset)}}_updateIconDebugCollisionBoxes(e,i,s,a,h,u,p){for(let _=a;_<h;_++){const g=s.get(_),v=this.getSymbolInstanceIconSize(e,i,u.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,g.padding,u.zOffset)}}updateCollisionDebugBuffers(e,i,s,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const h=Wu(this.iconSizeData,e,a),u=Wu(this.textSizeData,e,s);for(let p=0;p<this.symbolInstances.length;p++){const _=this.symbolInstances.get(p);this._updateTextDebugCollisionBoxes(u,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,s),this._updateTextDebugCollisionBoxes(u,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,s),this._updateIconDebugCollisionBoxes(h,e,i,_.iconBoxStartIndex,_.iconBoxEndIndex,_,a),this._updateIconDebugCollisionBoxes(h,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,s,a,h,u,p,_,g){const v={};if(i<s){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G,featureIndex:re}=e.get(i);v.textBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G},v.textFeatureIndex=re}if(a<h){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G,featureIndex:re}=e.get(a);v.verticalTextBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G},v.verticalTextFeatureIndex=re}if(u<p){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G,featureIndex:re}=e.get(u);v.iconBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G},v.iconFeatureIndex=re}if(_<g){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G,featureIndex:re}=e.get(_);v.verticalIconBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G},v.verticalIconFeatureIndex=re}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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 s=e.placedSymbolArray.get(i),a=s.vertexStartIndex+4*s.numGlyphs;for(let h=s.vertexStartIndex;h<a;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}
vendor: 11,157 bytes, line 14
14getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),a=[],h=[],u=[];for(let p=0;p<this.symbolInstances.length;++p){u.push(p);const _=this.symbolInstances.get(p);a.push(0|Math.round(i*_.tileAnchorX+s*_.tileAnchorY)),h.push(_.featureIndex)}return u.sort(((p,_)=>a[p]-a[_]||h[_]-h[p])),u}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 s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.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 s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:h,leftJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:p,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:g}=s;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),h>=0&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),u>=0&&u!==h&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),p>=0&&this.addIndicesForPlacedSymbol(this.text,p),_>=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)}}}let Vy,Uy,Gm;rt(Jf,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Jf.addDynamicAttributes=Kf;class jy{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Yo,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}}rt(jy,"FormatSectionOverride",{omit:["defaultValue"]});const qm=()=>Gm||(Gm={layout:Vy||(Vy=new Yi({"symbol-placement":new Ge(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new Ge(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ge(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ge(ue.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Ge(ue.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Ge(ue.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Ge(ue.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ge(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ge(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ge(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(ue.layout_symbol["icon-size"]),"icon-size-scale-range":new Ge(ue.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Je(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Je(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(ue.layout_symbol["icon-image"]),"icon-rotate":new Je(ue.layout_symbol["icon-rotate"]),"icon-padding":new Ge(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new Ge(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(ue.layout_symbol["icon-offset"]),"icon-anchor":new Je(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ge(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ge(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ge(ue.layout_symbol["text-rotation-alignment"]),"text-field":new Je(ue.layout_symbol["text-field"]),"text-font":new Je(ue.layout_symbol["text-font"]),"text-size":new Je(ue.layout_symbol["text-size"]),"text-size-scale-range":new Ge(ue.layout_symbol["text-size-scale-range"]),"text-max-width":new Je(ue.layout_symbol["text-max-width"]),"text-line-height":new Je(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(ue.layout_symbol["text-letter-spacing"]),"text-justify":new Je(ue.layout_symbol["text-justify"]),"text-radial-offset":new Je(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ge(ue.layout_symbol["text-variable-anchor"]),"text-anchor":new Je(ue.layout_symbol["text-anchor"]),"text-max-angle":new Ge(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new Ge(ue.layout_symbol["text-writing-mode"]),"text-rotate":new Je(ue.layout_symbol["text-rotate"]),"text-padding":new Ge(ue.layout_symbol["text-padding"]),"text-keep-upright":new Ge(ue.layout_symbol["text-keep-upright"]),"text-transform":new Je(ue.layout_symbol["text-transform"]),"text-offset":new Je(ue.layout_symbol["text-offset"]),"text-allow-overlap":new Ge(ue.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ge(ue.layout_symbol["text-ignore-placement"]),"text-optional":new Ge(ue.layout_symbol["text-optional"]),visibility:new Ge(ue.layout_symbol.visibility)})),paint:Uy||(Uy=new Yi({"icon-opacity":new Je(ue.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Je(ue.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Je(ue.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Je(ue.paint_symbol["text-emissive-strength"]),"icon-color":new Je(ue.paint_symbol["icon-color"]),"icon-halo-color":new Je(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new Ge(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ge(ue.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Ge(ue.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Je(ue.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Je(ue.paint_symbol["text-occlusion-opacity"]),"text-color":new Je(ue.paint_symbol["text-color"],{runtimeType:dn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Je(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Je(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(ue.paint_symbol["text-halo-blur"]),"text-translate":new Ge(ue.paint_symbol["text-translate"]),"text-translate-anchor":new Ge(ue.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Ge(ue.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Ge(ue.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Ge(ue.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Ge(ue.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Je(ue.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},Gm);class Qf extends Vr{constructor(e,i,s,a){super(e,qm(),i,s,a),this._colorAdjustmentMatrix=Bt([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),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 s=this.layout.get("text-writing-mode");if(s){const a=[];for(const h of s)a.indexOf(h)<0&&a.push(h);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,s,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===s&&this._brightnessMax===a||(this._colorAdjustmentMatrix=(function(h,u,p,_){h=kr(h),u=rn(u);const g=uo(),v=h/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*u,A=_-p;return Gi(g,[A,0,0,0,0,A,0,0,0,0,A,0,p,p,p,1],[u,0,0,0,0,u,0,0,0,0,u,0,I,I,I,1]),Gi(g,g,w),g})(e,i,s,a),this._saturation=e,this._contrast=i,this._brightnessMin=s,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,s,a){const h=this.layout.get(e).evaluate(i,{},s,a),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||Xh(u.value)||!h?h:(function(p,_){return _.replace(/{([^{}]+)}/g,((g,v)=>v in p?String(p[v]):""))})(i.properties,h)}createBucket(e){return new Jf(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of qm().paint.overridableProperties){if(!Qf.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new jy(i),a=new Wh(s,i.property.specification,this.scope,this.options);let h=null;h=i.value.kind==="constant"||i.value.kind==="source"?new Ac("source",a):new Ys("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Po(i.property,h,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&Qf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),a=qm().paint.properties[i];let h=!1;const u=p=>{for(const _ of p)if(a.overrides&&a.overrides.hasOverride(_))return void(h=!0)};if(s.value.kind==="constant"&&s.value.value instanceof $r)u(s.value.value.sections);else if(s.value.kind==="source"){const p=g=>{h||(g instanceof xt&&it(g.value)===sl?u(g.value.sections):g instanceof Jo?u(g.sections):g.eachChild(p))},_=s.value;_._styleExpression&&p(_._styleExpression.expression)}return h}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,s){return{config:new Xr(this,{zoom:i,lut:s}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}
vendor: 5,233 bytes, line 14
14let Gy,qy,Hy,$y;var Hm=$t([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function ep(r,e,i,s,a,h,u,p){const _=[r,e,1,i,s,1,a,h,1],g=[u,p,1],v=ho([],_),[b,w,I]=zs(g,g,v);return Kn(_,_,[b,0,0,0,w,0,0,0,I])}function Zy(r,e,i,s,a,h,u,p){const _=(function(g,v,b,w,I,A,P,R){const O=ep(0,0,1,0,1,1,0,1),U=ep(g,v,b,w,I,A,P,R);return Kn(U,U,ho([],O))})(r,e,i,s,a,h,u,p);return[_[2]/_[8]/We,_[5]/_[8]/We]}function tp(r){return[r[0],Math.min(Math.max(r[1],-X),X)]}class Wy extends xo{constructor(e,i,s,a){super(),this.id=e,this.dispatcher=s,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 ys("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=tl(this.map._requestManager.transformRequest(this.url,Ja.Image),((s,a)=>{this._imageRequest=null,this._loaded=!0,s?this.fire(new wn(s)):a&&(this.image=a instanceof HTMLImageElement?Hn.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 Gu(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 ys("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 Gu||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],s=e[0][1];for(const h of e)h[1]>s&&(s=h[1]),h[1]<i&&(i=h[1]);const a=(s+i)/2;if(a>X?this.onNorthPole=!0:a<-X&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const h=e.map(J.fromLngLat);this.tileID=(function(u){let p=1/0,_=1/0,g=-1/0,v=-1/0;for(const P of u)p=Math.min(p,P.x),_=Math.min(_,P.y),g=Math.max(g,P.x),v=Math.max(v,P.y);const b=Math.max(g-p,v-_),w=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),I=Math.pow(2,w);let A=Math.floor((p+g)/2*I);return A>1&&(A-=1),new Pn(w,A,Math.floor((_+v)/2*I))})(h),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new ys("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Gu||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const O in this.tiles){const U=this.tiles[O];U.state!=="loaded"&&(U.state="loaded",U.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Ju(new Pn(0,0,0),this.map.transform.projection),s=[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(O){const U=O[1].x-O[0].x,V=O[1].y-O[0].y,G=O[2].x-O[1].x,re=O[2].y-O[1].y,Q=O[3].x-O[2].x,te=O[3].y-O[2].y,ae=O[0].x-O[3].x,ce=O[0].y-O[3].y,Ee=U*re-G*V,de=G*te-Q*re,Ae=Q*ce-ae*te,je=ae*V-U*ce;return Ee>0&&de>0&&Ae>0&&je>0||Ee<0&&de<0&&Ae<0&&je<0})(s))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=Ju(this.tileID,this.map.transform.projection),[h,u,p,_]=this.coordinates.map((O=>{const U=a.projection.project(O[0],O[1]);return Ly(a,U)._round()}));this.perspectiveTransform=Zy(h.x,h.y,u.x,u.y,p.x,p.y,_.x,_.y);const g=this._boundsArray=new _a;g.emplaceBack(h.x,h.y,0,0),g.emplaceBack(u.x,u.y,We,0),g.emplaceBack(_.x,_.y,0,We),g.emplaceBack(p.x,p.y,We,We),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,Hm.members),this.boundsSegments=Ni.simpleSegment(0,0,4,2);const v=[],b=[tp((w=this.coordinates)[0]),tp(w[1]),tp(w[2]),tp(w[3])];var w;const[I,A,P,R]=(function(O){let U=O[0][0],V=U,G=O[0][1],re=G;for(let Q=1;Q<O.length;Q++)O[Q][0]<U?U=O[Q][0]:O[Q][0]>V&&(V=O[Q][0]),O[Q][1]<G?G=O[Q][1]:O[Q][1]>re&&(re=O[Q][1]);return[U,G,V-U,re-G]}
vendor: 5,181 bytes, line 14
14)(b);{const O=new _a,[U,V,G,re]=(function(Te){let Oe=Te[0].x,fe=Oe,Se=Te[0].y,He=Se;for(let Be=1;Be<Te.length;Be++)Te[Be].x<Oe?Oe=Te[Be].x:Te[Be].x>fe&&(fe=Te[Be].x),Te[Be].y<Se?Se=Te[Be].y:Te[Be].y>He&&(He=Te[Be].y);return[Oe,Se,fe-Oe,He-Se]})(s),Q=Te=>[(Te.x-U)/G,(Te.y-V)/re],[te,ae,ce,Ee]=s.map(Q),de=(function(Te,Oe,fe,Se,He,Be,ct,nt){const De=ep(0,0,1,0,1,1,0,1);return Kn(De,De,ho([],ep(Te,Oe,fe,Se,He,Be,ct,nt)))})(te[0],te[1],ae[0],ae[1],ce[0],ce[1],Ee[0],Ee[1]);this.elevatedGlobePerspectiveTransform=Zy(te[0],te[1],ae[0],ae[1],ce[0],ce[1],Ee[0],Ee[1]);const Ae=(Te,Oe)=>{v.push(Te.lng);const fe=Math.round((Te.lng-I)/P*We),Se=Math.round((Te.lat-A)/R*We),He=Q(Oe),Be=zs([],[He[0],He[1],1],de),ct=Math.round(Be[0]/Be[2]*We),nt=Math.round(Be[1]/Be[2]*We);O.emplaceBack(fe,Se,ct,nt)},je=s[3].x-s[0].x,Ce=s[3].y-s[0].y,Fe=s[2].x-s[1].x,Ve=s[2].y-s[1].y;for(let Te=0;Te<65;Te++){const Oe=Te/64,fe=[s[0].x+Oe*je,s[0].y+Oe*Ce],Se=[s[1].x+Oe*Fe,s[1].y+Oe*Ve],He=Se[0]-fe[0],Be=Se[1]-fe[1];for(let ct=0;ct<65;ct++){const nt=ct/64,De={x:fe[0]+He*nt,y:fe[1]+Be*nt};Ae(i.projection.unproject(De.x,De.y),De)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(O,Hm.members)}{this.maxLongitudeTriangleSize=0;let O=[],U=new Li;const V=(G,re,Q)=>{U.emplaceBack(G,re,Q);const te=v[G],ae=v[re],ce=v[Q],Ee=Math.min(Math.min(te,ae),ce),de=Math.max(Math.max(te,ae),ce)-Ee;de>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=de),O.push(Ee+de/2)};for(let G=0;G<64;G++)for(let re=0;re<64;re++){const Q=65*G+re,te=Q+1,ae=Q+65,ce=ae+1;V(Q,ae,te),V(te,ae,ce)}[O,U]=(function(G,re){const Q=Array.from({length:G.length},((ce,Ee)=>Ee));Q.sort(((ce,Ee)=>G[ce]-G[Ee]));const te=[],ae=new Li;for(let ce=0;ce<Q.length;ce++){const Ee=Q[ce];te.push(G[Ee]);const de=3*Ee,Ae=de+1;ae.emplaceBack(re.uint16[de],re.uint16[Ae],re.uint16[Ae+1])}return[te,ae]})(O,U),this.elevatedGlobeTrianglesCenterLongitudes=O,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(U)}this.elevatedGlobeSegments=Ni.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,P/We,0,R/We,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,s=i.gl;!this._dirty||this.texture instanceof Gu||(this.texture?this.texture.update(this.image):(this.texture=new vm(i,this.image,s.RGBA8),this.texture.bind(s.LINEAR,s.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 s=this.elevatedGlobeTrianglesCenterLongitudes;let a=(h=e+180)+360*Math.round((s[0]-h)/360);var h;const u=new Ni,p=(b,w)=>{u.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},_=.51*this.maxLongitudeTriangleSize;if(Math.abs(s[0]-a)<=_){const b=wr(s,0,s.length,a+_);return b===s.length||p(b,Bi(s,b+1,s.length,a+360-_)-b),u}a<s[0]&&(a+=360);const g=Bi(s,0,s.length,a-_);if(g===s.length)return p(0,s.length),u;p(0,g-0);const v=wr(s,g+1,s.length,a+_);return v!==s.length&&p(v,s.length-v),u}}const E1=(Math.pow(256,2)-1)/16907520;class Xy extends Vr{constructor(e,i,s,a){super(e,{layout:Hy||(Hy=new Yi({visibility:new Ge(ue.layout_raster.visibility)})),paint:$y||($y=new Yi({"raster-opacity":new Ge(ue.paint_raster["raster-opacity"]),"raster-color":new ua(ue.paint_raster["raster-color"]),"raster-color-mix":new Ge(ue.paint_raster["raster-color-mix"]),"raster-color-range":new Ge(ue.paint_raster["raster-color-range"]),"raster-hue-rotate":new Ge(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ge(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ge(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new Ge(ue.paint_raster["raster-saturation"]),"raster-contrast":new Ge(ue.paint_raster["raster-contrast"]),"raster-resampling":new Ge(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new Ge(ue.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Ge(ue.paint_raster["raster-emissive-strength"]),"raster-array-band":new Ge(ue.paint_raster["raster-array-band"]),"raster-elevation":new Ge(ue.paint_raster["raster-elevation"]),"raster-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},i,s,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 Wy&&(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)}
vendor: 20,782 bytes, line 14
14updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[s,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(s)&&isNaN(a)||s===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Mu({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:s,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[s,a])}}let Yy,Ky,Jy,Qy,ex;class tx extends Vr{constructor(e,i,s,a){super(e,{layout:Yy||(Yy=new Yi({visibility:new Ge(ue["layout_raster-particle"].visibility)})),paint:Ky||(Ky=new Yi({"raster-particle-array-band":new Ge(ue["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Ge(ue["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new ua(ue["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Ge(ue["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Ge(ue["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Ge(ue["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Ge(ue["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Ge(ue["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},i,s,a),this._updateColorRamp(),this.lastInvalidatedAt=Hn.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=Mu({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Hn.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class I1 extends Vr{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 $m(r,e,i){const s=[0,0,1],a=ds([]);return Vo(a,a,i?-ei(r)+Math.PI:ei(r)),fo(a,a,-ei(e)),Rs(s,s,a),Ri(s,s)}const ix={None:0,Model:1,Symbol:2,FillExtrusion:4};class ip{constructor(e,i,s,a){this.message=(e?`${e}: `:"")+s,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function Zm(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class rx{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 nx{constructor(){this.instancedDataArray=new Uc,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class Wm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,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?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}updateFootprints(e,i){}populate(e,i,s,a){this.tileToMeter=K(s);const h=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:u,id:p,index:_,sourceLayerIndex:g}of e){const v=p??(u.properties&&u.properties.hasOwnProperty("id")?u.properties.id:void 0),b=we(u,h);if(!this.layers[0]._featureFilter.filter(new pi(this.zoom,{worldview:this.worldview}),b,s))continue;const w={id:v,sourceLayerIndex:g,index:_,geometry:h?b.geometry:se(u,s,a),properties:u.properties,type:u.type,patterns:{}},I=this.addFeature(w,w.geometry,b);I&&i.featureIndex.insert(u,w.geometry,_,g,this.index,this.instancesPerModel[I].instancedDataArray.length,We/32)}this.lookup=null}update(e,i,s,a){for(const h in this.instancesPerModel){const u=this.instancesPerModel[h];for(const p in e)u.idToFeaturesIndex.hasOwnProperty(p)&&(this.evaluate(u.features[u.idToFeaturesIndex[p]],e[p],u,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];for(const a of s.features){const h=this.layers[0],u=a.feature,p=this.canonical,_=h.paint.get("model-rotation").evaluate(u,{},p),g=h.paint.get("model-scale").evaluate(u,{},p),v=h.paint.get("model-translation").evaluate(u,{},p);Fn(a.rotation,_)&&Fn(a.scale,g)&&Fn(a.translation,v)||(this.evaluate(a,a.featureStates,s,!0),e=!0)}}return e}updateReplacement(e,i,s,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const h=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Af(this.activeReplacements,h))return!1;this.activeReplacements=h;let u=!1;for(const p in this.instancesPerModel){const _=this.instancesPerModel[p],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 P=g.float32[A+0];const R=P>We;P=R?P-We:P;const O=Math.floor(P),U=g.float32[A+1];let V=!1;for(const G of this.activeReplacements)if(!H_(G,s,ix.Model,a)&&!(G.min.x>O||O>G.max.x||G.min.y>U||U>G.max.y)&&(V=lm(X_(O,U,e.canonical,G.footprintTileId.canonical),G.footprint),V))break;g.float32[A]=V?P+We:P,u=u||V!==R}}}return u}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 s=this.instancesPerModel[i];s.instancedDataArray.length<0||s.instancedDataArray.length===0||(s.instancedDataBuffer?s.instancedDataBuffer.updateData(s.instancedDataArray):s.instancedDataBuffer=e.createVertexBuffer(s.instancedDataArray,s0.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const s=this.instancesPerModel[i];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)e.removeModel(i,"",!0)}addFeature(e,i,s){const a=this.layers[0],h=a.layout.get("model-id").evaluate(s,{},this.canonical);if(!h)return Gt(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),h;(Zm(h,!1)||this.styleDefinedModelURLs[h]!==void 0)&&(this.modelUris.includes(h)||this.modelUris.push(h)),this.instancesPerModel[h]||(this.instancesPerModel[h]=new nx);const u=this.instancesPerModel[h],p=u.instancedDataArray,_=new rx(s,p.length);for(const g of i)for(const v of g){if(v.x<0||v.x>=We||v.y<0||v.y>=We)continue;const b=(this.lookupDim-1)/We,w=this.lookupDim*(v.y*b|0)+v.x*b|0;if(this.lookup){if(this.lookup[w]!==0)continue;this.lookup[w]=1}this.instanceCount++;const I=p.length;p.resize(I+1),u.instancesEvaluatedElevation.push(0),p.float32[16*I]=v.x,p.float32[16*I+1]=v.y}return _.instancedDataCount=u.instancedDataArray.length-_.instancedDataOffset,_.instancedDataCount>0&&(e.id&&(u.idToFeaturesIndex[e.id]=u.features.length),u.features.push(_),this.evaluate(_,{},u,!1)),h}getModelUris(){return this.modelUris}evaluate(e,i,s,a){const h=this.layers[0],u=e.feature,p=this.canonical,_=e.rotation=h.paint.get("model-rotation").evaluate(u,i,p),g=e.scale=h.paint.get("model-scale").evaluate(u,i,p),v=e.translation=h.paint.get("model-translation").evaluate(u,i,p),b=h.paint.get("model-color").evaluate(u,i,p);b.a=h.paint.get("model-color-mix-intensity").evaluate(u,i,p);const w=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),Pg(w,_,g);const I=Math.round(100*b.a)+b.b/1.05;for(let A=0;A<e.instancedDataCount;++A){const P=e.instancedDataOffset+A,R=16*P,O=s.instancedDataArray.float32;let U=0;a&&(U=O[R+6]-s.instancesEvaluatedElevation[P]);const V=0|O[R+1];O[R]=(0|O[R])+b.r/1.05,O[R+1]=V+b.g/1.05,O[R+2]=I,O[R+3]=1/(p.z>10?this.tileToMeter:K(p,V)),O[R+4]=v[0],O[R+5]=v[1],O[R+6]=v[2]+U,O[R+7]=w[0],O[R+8]=w[1],O[R+9]=w[2],O[R+10]=w[4],O[R+11]=w[5],O[R+12]=w[6],O[R+13]=w[8],O[R+14]=w[9],O[R+15]=w[10],s.instancesEvaluatedElevation[P]=v[2]}}}let sx,ox;rt(Wm,"ModelBucket",{omit:["layers"]}),rt(nx,"PerModelAttributes"),rt(rx,"ModelFeature");class sh{constructor(e,i,s){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=s}static create(e,i,s){const a=s||e.findDEMTileFor(i);if(!a||!a.dem)return;const h=a.dem,u=a.tileID,p=1<<i.canonical.z-u.canonical.z;return new sh(a,h.dim/We/p,[(i.canonical.x/p-u.canonical.x)*h.dim,(i.canonical.y/p-u.canonical.y)*h.dim])}tileCoordToPixel(e,i){const s=i*this._scale+this._offset[1];return new ke(Math.floor(e*this._scale+this._offset[0]),Math.floor(s))}getElevationAt(e,i,s,a){const h=e*this._scale+this._offset[0],u=i*this._scale+this._offset[1],p=Math.floor(h),_=Math.floor(u),g=this._dem;return a=!!a,s?pt(pt(g.get(p,_,a),g.get(p,_+1,a),u-_),pt(g.get(p+1,_,a),g.get(p+1,_+1,a),u-_),h-p):g.get(p,_,a)}getElevationAtPixel(e,i,s){return this._dem.get(e,i,!!s)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*L(1,e)*this._dem.stride}}const Xm=new Float32Array(262144),Ul=new Uint8Array(262144);function ax(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,ax(i));return e}function lx(r,e,i){if(r.meshes)for(const s of r.meshes){if(s.aabb.min[0]===1/0)continue;const a=kt.applyTransform(s.aabb,r.matrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const s of r.children)lx(s,e,i)}const cx=["","wall","door","roof","window","lamp","logo"];class hx{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:ax(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new kt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new kt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const s of this.node.meshes)this.node.lightMeshIndex!==e&&(s.transformedAabb=kt.applyTransformFast(s.aabb,this.node.matrix),i.encapsulate(s.transformedAabb)),e++;this.aabb=i}return this.aabb}}class rp{constructor(e,i,s,a,h,u,p,_){this.id=s,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|=Qc.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=Qc.HasMapboxMeshFeatures),h&&(this.modelTraits|=Qc.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=u,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new hx(g)),lx(g,p.featureIndexArray.length,p.grid),p.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,p.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(const s of this.getNodesInfo()){const a=s.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const s=i?this.stateDependentLayers:this.layers;if(!ms(e,this.states))for(const a of s)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 s of i){const a=s.node;this.uploaded?this.updatePbrBuffer(a):Tm(a,e,!0)}for(const s of i)kf(s.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const s of e.meshes)s.pbrBuffer&&(s.pbrBuffer.updateData(s.featureArray),i=!0);return i}needsReEvaluation(e,i,s){const a=e.transform.projectionOptions,h=e.style.getBrightness(),u=this.brightness!==h;if(!this.uploaded||this.dirty||a.name!==this.projection.name||rd(s.paint.get("model-color").value,u)||rd(s.paint.get("model-color-mix-intensity").value,u)||rd(s.paint.get("model-roughness").value,u)||rd(s.paint.get("model-emissive-strength").value,u)||rd(s.paint.get("model-height-based-emissive-strength-multiplier").value,u)){this.projection=a,this.brightness=h;const p=this.getNodesInfo();for(const _ of p)_.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const s=this.getNodesInfo(),a=this.id.canonical;for(const h of s){const u=h.feature;h.evaluatedTranslation=i.paint.get("model-translation").evaluate(u,{},a),h.evaluatedScale=i.paint.get("model-scale").evaluate(u,{},a)}}evaluate(e,i){const s=this.getNodesInfo();for(const a of s){if(!a.node.meshes)continue;const h=a.feature,u=i&&i[h.id];if(ms(u,a.state))continue;a.state=structuredClone(u);const p=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],g=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,p){for(let b=0;b<cx.length;b++){const w=cx[b];w.length&&(h.properties.part=w);const I=e.paint.get("model-color").evaluate(h,u,v).toPremultipliedRenderColor(null),A=e.paint.get("model-color-mix-intensity").evaluate(h,u,v);a.evaluatedColor[b]=[I.r,I.g,I.b,A],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(h,u,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(h,u,v),a.evaluatedRMEA[b][3]=I.a,a.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(h,u,v),!a.hasTranslucentParts&&I.a<1&&(a.hasTranslucentParts=!0)}delete h.properties.part,M1(a,_!==a.evaluatedColor[2]||g!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(h,u,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(h,u,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(h,u,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,s,a){const h=e.findDEMTileFor(s);if(h&&(h.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(h.dem&&h.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=h.tileID.overscaledZ;const u=sh.create(e,s,h);if(!u)return;this.modelTraits&Qc.HasMapboxMeshFeatures&&this.updateDEM(e,u,s,a);for(const p of this.getNodesInfo()){const _=p.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const g=_.footprint.vertices;let v=u.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)v=Math.min(v,u.getElevationAt(g[b].x,g[b].y,!0,!0));_.elevation=v}}this.terrainTile=h.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,s,a){let h=i._dem._modifiedForSources[a];if(h===void 0&&(i._dem._modifiedForSources[a]=[],h=i._dem._modifiedForSources[a]),h.includes(s.canonical))return;const u=i._dem.dim;h.push(s.canonical);let p=!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(u-w.y,b.x),Math.min(b.y,u-w.x));if(I<0)continue;const A=W(I,2,5);let P=Math.max(0,b.x-A),R=Math.max(0,b.y-A),O=Math.min(w.x+A,u-1),U=Math.min(w.y+A,u-1);for(let Q=R;Q<=U;++Q)for(let te=P;te<=O;++te)Ul[Q*u+te]=255;let V=0,G=0;for(let Q=0;Q<v.cellsY;++Q)for(let te=0;te<v.cellsX;++te){if(!v.cells[Q*v.cellsX+te])continue;const ae=i.tileCoordToPixel(v.min.x+te/v.xScale,v.min.y+Q/v.yScale),ce=i.tileCoordToPixel(v.min.x+(te+1)/v.xScale,v.min.y+(Q+1)/v.yScale);for(let Ee=ae.y;Ee<=Math.min(ce.y+1,u-1);++Ee)for(let de=ae.x;de<=Math.min(ce.x+1,u-1);++de)Ul[Ee*u+de]===255&&(Ul[Ee*u+de]=0,V+=i.getElevationAtPixel(de,Ee),G++)}const re=V/G;P=Math.max(1,b.x-A),R=Math.max(1,b.y-A),O=Math.min(w.x+A,u-2),U=Math.min(w.y+A,u-2),p=!0;for(let Q=R;Q<=U;++Q)for(let te=P;te<=O;++te)Ul[Q*u+te]===0&&(Xm[Q*u+te]=i._dem.set(te,Q,re));for(let Q=1;Q<A;++Q){P=Math.max(1,b.x-Q),R=Math.max(1,b.y-Q),O=Math.min(w.x+Q,u-2),U=Math.min(w.y+Q,u-2);for(let te=R;te<=U;++te)for(let ae=P;ae<=O;++ae){const ce=te*u+ae;if(Ul[ce]===255){let Ee=0,de=0,Ae=-1,je=-1;for(let Ce=-1;Ce<=1;++Ce)for(let Fe=-1;Fe<=1;++Fe){const Ve=(te+Ce)*u+ae+Fe;if(Ul[Ve]>=Q)continue;const Te=Xm[Ve],Oe=Math.abs(Te);Oe>de&&(Ee=Te,de=Oe,Ae=Fe,je=Ce)}if(de>.1){const Ce=1-(Q+.5*Math.abs(Ae*je))/A;let Fe=i._dem.get(ae,te)+Ee*Ce;const Ve=i._dem.get(ae+Ae,te+je),Te=i._dem.get(ae-Ae,te-je,!0);(Fe-Ve)*(Fe-Te)>0&&(Fe=(Ve+Te)/2),Xm[ce]=i._dem.set(ae,te,Fe),Ul[ce]=Q}}}}}p&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Hn.now())}setFilter(e){this.filter=e?da(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter((e=>this.filter.filter(new pi(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical))):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)kf(i.node),Sm(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const h=a.node.footprint;a.hiddenByReplacement=!!h&&!s.find((u=>u.footprint===h))}}getHeightAtTileCoord(e,i){const s=[],a=[0,0,0],h=Bt([]);for(const u of this.getNodesInfo()){const p=u.node.meshes[0],_=p.transformedAabb;if(e<_.min[0]||i<_.min[1]||e>_.max[0]||i>_.max[1])continue;if(u.node.hidden===!0)return{height:1/0,maxHeight:u.feature.properties.height,hidden:!1,verticalScale:u.evaluatedScale[2]};Jr(h,u.node.matrix),a[0]=e,a[1]=i,tr(a,a,h);const g=(a[0]-p.aabb.min[0])/(p.aabb.max[0]-p.aabb.min[0])*Bl|0,v=Math.min(63,(a[1]-p.aabb.min[1])/(p.aabb.max[1]-p.aabb.min[1])*Bl|0)*Bl+Math.min(63,g),b=p.heightmap[v];if(!(b<0&&u.node.footprint))return u.hiddenByReplacement?void 0:{height:b,maxHeight:u.feature.properties.height,hidden:!1,verticalScale:u.evaluatedScale[2]};if(u.node.footprint.grid.query(new ke(e,i),new ke(e,i),s),s.length>0)return{height:void 0,maxHeight:u.feature.properties.height,hidden:u.hiddenByReplacement,verticalScale:u.evaluatedScale[2]}}}}function rd(r,e){return r instanceof Ac&&!r.isLightConstant&&e}function A1(r,e,i,s,a,h,u,p){let _=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,v=240&e|(240&e)>>4;i[3]>0&&(_=pt(_,255*i[0],i[3]),g=pt(g,255*i[1],i[3]),v=pt(v,255*i[2],i[3]));const b=_<<8|g,w=v<<8|Math.floor(255*s[3]),I=(function(Q){const te=W(Q,0,2);return Math.min(Math.round(.5*te*255),255)}
14)(s[2])<<8|15*s[0]<<4|15*s[1],A=W(a[0],0,1),P=W(a[1],0,1),R=W(a[2],0,1),O=W(a[3],0,1);let U,V,G,re;if(A!==P&&u!==h&&P!==A){const Q=u-h;V=1/(Q*(P-A)),G=-(h+Q*A)/(Q*(P-A));const te=W(a[4],-1,1);re=Math.pow(10,te),U=255*R<<8|255*O}else U=65535,V=0,G=1,re=1;if(r.emplaceBack(b,w,I,U,V,G,re),p){const Q=p.length;p.clear();for(let te=0;te<Q;te++)p.emplaceBack(b,w,I,U,V,G,re)}}function M1(r,e,i){const s=r.node;let a=0;const h=i&Qc.HasMeshoptCompression;for(const u of s.meshes){if(s.lights&&s.lightMeshIndex===a||!u.featureData)continue;u.featureArray=new wa,u.featureArray.reserve(u.featureData.length);let p=e;for(const _ of u.featureData){const g=h?65535&_:_>>16&65535,v=h?_>>16&65535:65535&_,b=(15&v)<8?15&v:0,w=r.evaluatedRMEA[b],I=r.evaluatedColor[b],A=r.emissionHeightBasedParams[b];let P;if(p&&b===2&&s.lights&&(P=new wa,P.resize(10*s.lights.length)),A1(u.featureArray,g,I,w,A,u.aabb.min[2],u.aabb.max[2],P),P&&p){p=!1;const R=s.meshes[s.lightMeshIndex];R.featureArray=P,R.featureArray._trim()}}u.featureArray._trim(),a++}}function ux(r,e,i,s){const a=1<<r.z;e.lat=j((s/We+r.y)/a),e.lng=N((i/We+r.x)/a)}function C1(r,e,i,s){const a=r.getNodesInfo()[e];
vendor: 27,403 bytes, line 14
14if(!a||a.hiddenByReplacement||!a.node.meshes)return;let h=Number.MAX_VALUE;const u=a.node,p=i.tile,_=s.calculatePosMatrix(p.tileID.toUnwrapped(),s.worldSize),g=a.evaluatedScale;let v=0;s.elevation&&u.elevation&&(v=u.elevation*s.elevation.exaggeration()),qr(_,_,[(u.anchor?u.anchor[0]:0)*(g[0]-1),(u.anchor?u.anchor[1]:0)*(g[1]-1),v]),Fr(_,_,g);const b=i.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,I=function(P){const R=Gi([],_,P.matrix);Gi(R,s.expandedFarZProjMatrix,R);for(let O=0;O<P.meshes.length;++O){const U=P.meshes[O];if(O===P.lightMeshIndex)continue;const V=zg(w,s,R,U.aabb);V!=null&&(h=Math.min(V,h))}if(P.children)for(const O of P.children)I(O)};if(I(u),h===Number.MAX_VALUE)return;const A=new S(0,0);return ux(p.tileID.canonical,A,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:h,position:A,feature:a.feature}}rt(rp,"Tiled3dModelBucket",{omit:["layers"]}),rt(hx,"Tiled3dModelFeature");const P1={circle:class extends Vr{constructor(r,e,i,s){super(r,{layout:ro||(ro=new Yi({"circle-sort-key":new Je(ue.layout_circle["circle-sort-key"]),"circle-elevation-reference":new Ge(ue.layout_circle["circle-elevation-reference"]),visibility:new Ge(ue.layout_circle.visibility)})),paint:Ea||(Ea=new Yi({"circle-radius":new Je(ue.paint_circle["circle-radius"]),"circle-color":new Je(ue.paint_circle["circle-color"]),"circle-blur":new Je(ue.paint_circle["circle-blur"]),"circle-opacity":new Je(ue.paint_circle["circle-opacity"]),"circle-translate":new Ge(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new Ge(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ge(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ge(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(ue.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Ge(ue.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}createBucket(r){return new si(r)}queryRadius(r){const e=r;return Er("circle-radius",this,e)+Er("circle-stroke-width",this,e)+Qi(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,s,a,h,u,p){const _=Do(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return y_(r,s,h,u,p,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const s=g_(this);return{config:new Xr(this,{zoom:e,lut:i}),defines:s,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 Vr{createBucket(r){return new v_(r)}constructor(r,e,i,s){super(r,{layout:b_||(b_=new Yi({visibility:new Ge(ue.layout_heatmap.visibility)})),paint:w_||(w_=new Yi({"heatmap-radius":new Je(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ge(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ua(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ge(ue.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Mu({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 Er("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,s,a,h,u,p){const _=this.paint.get("heatmap-radius").evaluate(e,i);return y_(r,s,h,u,p,!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 Xr(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Vr{constructor(r,e,i,s){super(r,{layout:T_||(T_=new Yi({visibility:new Ge(ue.layout_hillshade.visibility)})),paint:S_||(S_=new Yi({"hillshade-illumination-direction":new Ge(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ge(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ge(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ge(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ge(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ge(ue.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Ge(ue.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}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 Vr{constructor(r,e,i,s){super(r,{layout:N_||(N_=new Yi({"fill-sort-key":new Je(ue.layout_fill["fill-sort-key"]),visibility:new Ge(ue.layout_fill.visibility),"fill-elevation-reference":new Ge(ue.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Je(ue.layout_fill["fill-construct-bridge-guard-rail"])})),paint:V_||(V_=new Yi({"fill-antialias":new Ge(ue.paint_fill["fill-antialias"]),"fill-opacity":new Je(ue.paint_fill["fill-opacity"]),"fill-color":new Je(ue.paint_fill["fill-color"]),"fill-outline-color":new Je(ue.paint_fill["fill-outline-color"]),"fill-translate":new Ge(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new Ge(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new Je(ue.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new Ge(ue.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new Ge(ue.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Je(ue.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Je(ue.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Je(ue.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}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 Xr(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 sm(r)}queryRadius(){return Qi(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,s,a,h){return!r.queryGeometry.isAboveHorizon&&rr(Cn(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),s)}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 Vr{constructor(r,e,i,s){super(r,{layout:cg||(cg=new Yi({visibility:new Ge(ue["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Ge(ue["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:hg||(hg=new Yi({"fill-extrusion-opacity":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Je(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Je(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Je(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Je(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Je(ue["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Je(ue["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Cf(r)}queryRadius(){return Qi(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,s,a,h,u,p,_){const g=Do(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.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=p&&h.elevation,A=h.elevation?h.elevation.exaggeration():1,P=r.tile.getBucket(this);if(I&&P instanceof Cf){const G=P.centroidVertexArray,re=_+1;re<G.length&&(w[0]=G.geta_centroid_pos0(re),w[1]=G.geta_centroid_pos1(re))}if(w[0]===0&&w[1]===1)return!1;h.projection.name==="globe"&&(s=lg([s],[new ke(0,0),new ke(We,We)],r.tileID.canonical).map((G=>G.polygon)).flat());const R=I?p:null,[O,U]=(function(G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce){return G.projection.name==="globe"?(function(Fe,Ve,Te,Oe,fe,Se,He,Be,ct,nt,De){const Ne=[],ot=[],et=Fe.projection.upVectorScale(De,Fe.center.lat,Fe.worldSize).metersToTile,Xe=[0,0,0,1],tt=[0,0,0,1],_t=(Mt,It,qt,Lt)=>{Mt[0]=It,Mt[1]=qt,Mt[2]=Lt,Mt[3]=1},Tt=ag();Te>0&&(Te+=Tt),Oe+=Tt;for(const Mt of Ve){const It=[],qt=[];for(const Lt of Mt){const Ii=Lt.x+fe.x,H=Lt.y+fe.y,$=Fe.projection.projectTilePoint(Ii,H,De),be=Fe.projection.upVector(De,Lt.x,Lt.y);let $e=Te,Ke=Oe;if(He){const Ye=_g(Ii,H,Te,Oe,He,Be,ct,nt);$e+=Ye.base,Ke+=Ye.top}Te!==0?_t(Xe,$.x+be[0]*et*$e,$.y+be[1]*et*$e,$.z+be[2]*et*$e):_t(Xe,$.x,$.y,$.z),_t(tt,$.x+be[0]*et*Ke,$.y+be[1]*et*Ke,$.z+be[2]*et*Ke),tr(Xe,Xe,Se),tr(tt,tt,Se),It.push(new Ol(Xe[0],Xe[1],Xe[2])),qt.push(new Ol(tt[0],tt[1],tt[2]))}Ne.push(It),ot.push(qt)}return[Ne,ot]})(G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce):Ee?(function(Fe,Ve,Te,Oe,fe,Se,He,Be,ct){const nt=[],De=[],Ne=[0,0,0,1];for(const ot of Fe){const et=[],Xe=[];for(const tt of ot){const _t=tt.x+Oe.x,Tt=tt.y+Oe.y,Mt=_g(_t,Tt,Ve,Te,Se,He,Be,ct);Ne[0]=_t,Ne[1]=Tt,Ne[2]=Mt.base,Ne[3]=1,hn(Ne,Ne,fe),Ne[3]=Math.max(Ne[3],1e-5);const It=new Ol(Ne[0]/Ne[3],Ne[1]/Ne[3],Ne[2]/Ne[3]);Ne[0]=_t,Ne[1]=Tt,Ne[2]=Mt.top,Ne[3]=1,hn(Ne,Ne,fe),Ne[3]=Math.max(Ne[3],1e-5);const qt=new Ol(Ne[0]/Ne[3],Ne[1]/Ne[3],Ne[2]/Ne[3]);et.push(It),Xe.push(qt)}nt.push(et),De.push(Xe)}return[nt,De]})(re,Q,te,ae,ce,Ee,de,Ae,je):(function(Fe,Ve,Te,Oe,fe){const Se=[],He=[],Be=fe[8]*Ve,ct=fe[9]*Ve,nt=fe[10]*Ve,De=fe[11]*Ve,Ne=fe[8]*Te,ot=fe[9]*Te,et=fe[10]*Te,Xe=fe[11]*Te;for(const tt of Fe){const _t=[],Tt=[];for(const Mt of tt){const It=Mt.x+Oe.x,qt=Mt.y+Oe.y,Lt=fe[0]*It+fe[4]*qt+fe[12],Ii=fe[1]*It+fe[5]*qt+fe[13],H=fe[2]*It+fe[6]*qt+fe[14],$=fe[3]*It+fe[7]*qt+fe[15],be=Lt+Be,$e=Ii+ct,Ke=H+nt,Ye=Math.max($+De,1e-5),st=Lt+Ne,vt=Ii+ot,Nt=H+et,Vt=Math.max($+Xe,1e-5);_t.push(new Ol(be/Ye,$e/Ye,Ke/Ye)),Tt.push(new Ol(st/Vt,vt/Vt,Nt/Vt))}Se.push(_t),He.push(Tt)}return[Se,He]})(re,Q,te,ae,ce)})(h,s,b,v,g,u,R,w,A,h.center.lat,r.tileID.canonical),V=r.queryGeometry;return(function(G,re,Q){let te=1/0;rr(Q,re)&&(te=mg(Q,re[0]));for(let ae=0;ae<re.length;ae++){const ce=re[ae],Ee=G[ae];for(let de=0;de<ce.length-1;de++){const Ae=ce[de],je=[Ae,ce[de+1],Ee[de+1],Ee[de],Ae];yi(Q,je)&&(te=Math.min(te,mg(Q,je)))}}return te!==1/0&&te})(O,U,V.isPointQuery()?V.screenBounds:V.screenGeometry)}},building:class extends Vr{constructor(r,e,i,s){super(r,{layout:Vg||(Vg=new Yi({visibility:new Ge(ue.layout_building.visibility),"building-facade":new Je(ue.layout_building["building-facade"]),"building-facade-floors":new Je(ue.layout_building["building-facade-floors"]),"building-facade-window":new Je(ue.layout_building["building-facade-window"]),"building-roof-shape":new Je(ue.layout_building["building-roof-shape"]),"building-height":new Je(ue.layout_building["building-height"]),"building-base":new Je(ue.layout_building["building-base"])})),paint:Ug||(Ug=new Yi({"building-opacity":new Ge(ue.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Ge(ue.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Ge(ue.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Ge(ue.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Ge(ue.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Ge(ue.paint_building["building-vertical-scale"]),"building-cast-shadows":new Ge(ue.paint_building["building-cast-shadows"]),"building-color":new Je(ue.paint_building["building-color"]),"building-emissive-strength":new Je(ue.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Ge(ue.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Ge(ue.paint_building["building-cutoff-fade-range"]),"building-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Ng(r)}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(r){return!0}},line:class extends Vr{constructor(r,e,i,s){const a=Kg();super(r,a,e,i,s),a.layout&&(this.layout=new Wn(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 ml,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>{if(Hu)return Hu;const i=Kg();return Hu=new M0(i.paint.properties["line-width"].specification),Hu.useIntegerZoom=!0,Hu})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Am(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const s=Xg(this);return{config:new Xr(this,{zoom:e,lut:i}),defines:s,overrideFog:!1}}queryRadius(r){const e=r,i=Jg(Er("line-width",this,e),Er("line-gap-width",this,e)),s=Er("line-offset",this,e);return i/2+Math.abs(s)+Qi(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,s,a,h){if(r.queryGeometry.isAboveHorizon)return!1;const u=Cn(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),p=r.pixelToTileUnitsFactor/2*Jg(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 _&&(s=(function(g,v){const b=[],w=new ke(0,0);for(let I=0;I<g.length;I++){const A=g[I],P=[];for(let R=0;R<A.length;R++){const O=A[R],U=A[R+1],V=R===0?w:O.sub(A[R-1])._unit()._perp(),G=R===A.length-1?w:U.sub(O)._unit()._perp(),re=V._add(G)._unit();re._mult(1/(re.x*G.x+re.y*G.y)),P.push(re._mult(v)._add(O))}b.push(P)}return b})(s,_*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(zr(g,I[A]))return!0}if(ar(g,I,b))return!0}return!1})(u,s,p)}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:Qf,background:class extends Vr{constructor(r,e,i,s){super(r,{layout:Gy||(Gy=new Yi({visibility:new Ge(ue.layout_background.visibility)})),paint:qy||(qy=new Yi({"background-pitch-alignment":new Ge(ue.paint_background["background-pitch-alignment"]),"background-color":new Ge(ue.paint_background["background-color"]),"background-pattern":new Ge(ue.paint_background["background-pattern"]),"background-opacity":new Ge(ue.paint_background["background-opacity"]),"background-emissive-strength":new Ge(ue.paint_background["background-emissive-strength"]),"background-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s)}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:Xy,"raster-particle":tx,sky:class extends Vr{constructor(r,e,i,s){super(r,{layout:Jy||(Jy=new Yi({visibility:new Ge(ue.layout_sky.visibility)})),paint:Qy||(Qy=new Yi({"sky-type":new Ge(ue.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ge(ue.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ge(ue.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ge(ue.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ge(ue.paint_sky["sky-gradient-radius"]),"sky-gradient":new ua(ue.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ge(ue.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ge(ue.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ge(ue.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),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._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Mu({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 s=this.paint.get("sky-atmosphere-sun"),a=!s,h=r.style.light,u=h.properties.get("position");return a&&h.properties.get("anchor")==="viewport"&&Gt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?$m(u.azimuthal,90-u.polar,e):$m(s[0],90-s[1],e)}const i=this.paint.get("sky-gradient-center");return $m(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 Vr{constructor(r,e,i,s){super(r,{paint:ex||(ex=new Yi({}))},e,null)}},model:class extends Vr{constructor(r,e,i,s){super(r,{layout:sx||(sx=new Yi({visibility:new Ge(ue.layout_model.visibility),"model-id":new Je(ue.layout_model["model-id"])})),paint:ox||(ox=new Yi({"model-opacity":new Je(ue.paint_model["model-opacity"]),"model-rotation":new Je(ue.paint_model["model-rotation"]),"model-scale":new Je(ue.paint_model["model-scale"]),"model-translation":new Je(ue.paint_model["model-translation"]),"model-color":new Je(ue.paint_model["model-color"]),"model-color-mix-intensity":new Je(ue.paint_model["model-color-mix-intensity"]),"model-type":new Ge(ue.paint_model["model-type"]),"model-cast-shadows":new Ge(ue.paint_model["model-cast-shadows"]),"model-receive-shadows":new Ge(ue.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Ge(ue.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Je(ue.paint_model["model-emissive-strength"]),"model-roughness":new Je(ue.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Je(ue.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Ge(ue.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Ge(ue.paint_model["model-front-cutoff"]),"model-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,s),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Wm(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 rp?We-1:0}queryIntersectsFeature(r,e,i,s,a,h){if(!this.modelManager)return!1;const u=this.modelManager,p=r.tile.getBucket(this);if(!(p&&p instanceof Wm))return!1;for(const _ in p.instancesPerModel){const g=p.instancesPerModel[_],v=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(g.idToFeaturesIndex.hasOwnProperty(v)){const b=g.features[g.idToFeaturesIndex[v]],w=u.getModel(_,this.scope);if(!w)return!1;let I=uo();const A=new S(0,0),P=p.canonical;let R=Number.MAX_VALUE;for(let O=0;O<b.instancedDataCount;++O){const U=16*(b.instancedDataOffset+O),V=g.instancedDataArray.float32,G=[V[U+4],V[U+5],V[U+6]];ux(P,A,V[U],0|V[U+1]),Rg(I,w,h,A,b.rotation,b.scale,G,!1,!1,!1),h.projection.name==="globe"&&(I=wm(I,h));const re=Gi([],h.projMatrix,I),Q=r.queryGeometry,te=zg(Q.isPointQuery()?Q.screenBounds:Q.screenGeometry,h,re,w.aabb);te!=null&&(R=Math.min(te,R))}return R!==Number.MAX_VALUE&&R}}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 Ys}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Vr{constructor(r,e,i,s){super(r,{layout:U_||(U_=new Yi({"clip-layer-types":ne
14w Ge(ue.layout_clip["clip-layer-types"]),"clip-layer-scope":new Ge(ue.layout_clip["clip-layer-scope"])})),paint:j_||(j_=new Yi({}))},e,i,s)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new G_(r)}is3D(r){return!0}}},Ym=new li(0,0,0),Km={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},Jm={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},np={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},z1={PAINT_ORDER_FILL_AND_STROKE:1},nd={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},dx={MASK_TYPE_LUMINANCE:1};function R1(r,e,i){r===1&&e.icons.push((function(s,a){return(function(h){if(h.usvg_tree.height||(h.usvg_tree.height=h.usvg_tree.width),!h.metadata)return h;const{metadata:u}=h;if(u.content_area){const{content_area:p}=u;p.top==null&&(p.top=p.left),p.width==null&&(p.width=h.usvg_tree.width),p.height==null&&(p.height=p.width)}return u.stretch_x&&u.stretch_x.length&&fx(u,"x"),u.stretch_y&&u.stretch_y.length&&fx(u,"y"),h})(s.readFields(D1,{name:void 0},a))})(i,i.readVarint()+i.pos))}function fx(r,e){const i=[],s=r[`stretch_${e}`];let a=null;for(let h=0;h<s.length;h++)a===null?a=i.length===0?s[0]:i[i.length-1][1]+s[h]:(i.push([a,a+s[h]]),a=null);r[`stretch_${e}_areas`]=i}function D1(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=(function(s,a){return s.readFields(L1,{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(s,a){return s.readFields(k1,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)})(i,i.readVarint()+i.pos),e.data="usvg_tree")}function L1(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=(function(s,a){return s.readFields(F1,{left:0},a)})(i,i.readVarint()+i.pos):r===4&&e.variables.push((function(s,a){return s.readFields(O1,{name:void 0},a)})(i,i.readVarint()+i.pos))}function F1(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 O1(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=ap(i.readVarint()),e.value="rgb_color")}function k1(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(sp(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push((function(s,a){return s.readFields(q1,{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(s,a){return s.readFields($1,{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(s,a){return s.readFields(Z1,{children:[]},a)})(i,i.readVarint()+i.pos)):r===8&&e.masks.push((function(s,a){const h=s.readFields(W1,{left:0,width:20,mask_type:dx.MASK_TYPE_LUMINANCE,children:[]},a);return h.height==null&&(h.height=h.width),h.top==null&&(h.top=h.left),h})(i,i.readVarint()+i.pos))}function sp(r,e){return r.readFields(B1,{},e)}function B1(r,e,i){r===1?(e.group=(function(s,a){return s.readFields(N1,{opacity:255,children:[]},a)})(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=(function(s,a){return s.readFields(U1,{paint_order:1,commands:[],step:1,diffs:[],rule:Km.PATH_RULE_NON_ZERO},a)})(i,i.readVarint()+i.pos),e.node="path")}function N1(r,e,i){r===1?e.transform=op(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(sp(i,i.readVarint()+i.pos))}function op(r,e){return r.readFields(V1,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function V1(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 U1(r,e,i){r===1?e.fill=(function(s,a){return s.readFields(j1,{rgb_color:Ym,paint:"rgb_color",opacity:255},a)})(i,i.readVarint()+i.pos):r===2?e.stroke=(function(s,a){return s.readFields(G1,{rgb_color:Ym,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.
14step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function j1(r,e,i){r===1?(e.rgb_color=ap(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 ap(r){return new li((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function G1(r,e,i){r===1?(e.rgb_color=ap(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 q1(r,e,i){r===1?e.transform=op(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(px(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&&(e.y2=i.readFloat())}function px(r,e){return r.readFields(H1,{offset:0,opacity:255,rgb_color:Ym},e)}function H1(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=ap(i.readVarint()))}function $1(r,e,i){r===1?e.transform=op(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(px(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 Z1(r,e,i){r===1?e.transform=op(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(sp(i,i.readVarint()+i.pos))}function W1(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(sp(i,i.readVarint()+i.pos))}class X1{static calculate(e={},i=[]){const s=new Map,a=new Map;if(Object.keys(e).length===0)return s;i.forEach((h=>{a.set(h.name,h.rgb_color||new li(0,0,0))}));for(const[h,u]of Object.entries(e))a.has(h)?s.set(a.get(h).toString(),u):console.warn(`Ignoring unknown image variable "${h}"`);return s}}function oh(r,e=255,i){const s=e/255,a=r.toString(),h=i.has(a)?i.get(a).clone():r.clone();return h.a*=s,h.toString()}function sd(r,e){if(!Wl()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}function Y1(r,e){const i=X1.calculate(e.params,r.metadata?r.metadata.variables:[]),s=r.usvg_tree,a=s.width,h=s.height,u=e.transform?e.transform:new DOMMatrix,p=Math.max(1,Math.round(a*u.a)),_=Math.max(1,Math.round(h*u.d)),g=new DOMMatrix([p/a,0,0,_/h,0,0]),v=sd(p,_).getContext("2d");return Qm(v,g,s,s,i),v.getImageData(0,0,p,_)}function Qm(r,e,i,s,a){for(const h of s.children)mx(r,e,i,h,a)}function mx(r,e,i,s,a){s.group?(r.save(),(function(h,u,p,_,g){const v=_.mask_idx!=null?p.masks[_.mask_idx]:null,b=_.clip_path_idx!=null?p.clip_paths[_.clip_path_idx]:null;if(_.transform&&(u=ah(_.transform).preMultiplySelf(u)),!(function(A,P,R){return A.opacity!==255||P||R})(_,b!=null,v!=null))return void Qm(h,u,p,_,g);const w=sd(h.canvas.width,h.canvas.height),I=w.getContext("2d");Qm(I,u,p,_,g),b&&wx(I,u,p,b),v&&Tx(I,u,p,v,g),h.globalAlpha=_.opacity/255,h.drawImage(w,0,0)})(r,e,i,s.group,a),r.restore()):s.path&&(r.save(),(function(h,u,p,_,g){h.setTransform(u),_.paint_order===z1.PAINT_ORDER_FILL_AND_STROKE?(_x(h,p,_,g),yx(h,p,_,g)):(yx(h,p,_,g),_x(h,p,_,g))})(r,e,i,s.path,a),r.restore())}function _x(r,e,i,s){const a=i.fill;if(!a)return;const h=a.opacity/255;switch(r.save(),r.beginPath(),Sx(i,r),a.paint){case"rgb_color":r.fillStyle=oh(a.rgb_color,a.opacity,s);break;case"linear_gradient_idx":{const u=e.linear_gradients[a.linear_gradient_idx];u.transform&&r.setTransform(ah(u.transform).preMultiplySelf(r.getTransform())),r.fillStyle=xx(r,u,h,s);break}case"radial_gradient_idx":{const u=e.radial_gradients[a.radial_gradient_idx];u.transform&&r.setTransform(ah(u.transform).preMultiplySelf(r.getTransform())),r.fillStyle=vx(r,u,h,s)}}
14r.fill(gx(i)),r.restore()}function gx(r){return r.rule===Km.PATH_RULE_NON_ZERO?"nonzero":r.rule===Km.PATH_RULE_EVEN_ODD?"evenodd":void 0}function yx(r,e,i,s){const a=i.stroke;if(!a)return;const h=Ex(i);r.lineWidth=a.width,r.miterLimit=a.miterlimit,r.setLineDash(a.dasharray),r.lineDashOffset=a.dashoffset;const u=a.opacity/255;switch(a.paint){case"rgb_color":r.strokeStyle=oh(a.rgb_color,a.opacity,s);break;case"linear_gradient_idx":r.strokeStyle=xx(r,e.linear_gradients[a.linear_gradient_idx],u,s,!0);break;case"radial_gradient_idx":r.strokeStyle=vx(r,e.radial_gradients[a.radial_gradient_idx],u,s,!0)}switch(a.linejoin){case np.LINE_JOIN_MITER_CLIP:case np.LINE_JOIN_MITER:r.lineJoin="miter";break;case np.LINE_JOIN_ROUND:r.lineJoin="round";break;case np.LINE_JOIN_BEVEL:r.lineJoin="bevel"}switch(a.linecap){case Jm.LINE_CAP_BUTT:r.lineCap="butt";break;case Jm.LINE_CAP_ROUND:r.lineCap="round";break;case Jm.LINE_CAP_SQUARE:r.lineCap="square"}r.stroke(h)}function xx(r,e,i,s,a=!1){if(e.stops.length===1){const w=e.stops[0];return oh(w.rgb_color,w.opacity*i,s)}const{x1:h,y1:u,x2:p,y2:_}=e;let g=new DOMPoint(h,u),v=new DOMPoint(p,_);if(a){const w=ah(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,oh(w.rgb_color,w.opacity*i,s));return b}function vx(r,e,i,s,a=!1){if(e.stops.length===1){const O=e.stops[0];return oh(O.rgb_color,O.opacity*i,s)}const h=ah(e.transform),{fx:u,fy:p,fr:_,cx:g,cy:v,r:b}=e;let w=new DOMPoint(u,p),I=new DOMPoint(g,v),A=_,P=b;if(a){w=h.transformPoint(w),I=h.transformPoint(I);const O=(h.a+h.d)/2;A=_*O,P=e.r*O}const R=r.createRadialGradient(w.x,w.y,A,I.x,I.y,P);for(const O of e.stops)R.addColorStop(O.offset,oh(O.rgb_color,O.opacity*i,s));return R}function bx(r,e,i,s){const a=s.transform?ah(s.transform).preMultiplySelf(e):e,h=sd(r.canvas.width,r.canvas.height),u=h.getContext("2d");for(const _ of s.children)if(_.group)bx(u,a,i,_.group);else if(_.path){const g=_.path,v=new Path2D;v.addPath(Ex(g),a),u.fill(v,gx(g))}const p=s.clip_path_idx!=null?i.clip_paths[s.clip_path_idx]:null;p&&wx(u,a,i,p),r.globalCompositeOperation="source-over",r.drawImage(h,0,0)}function wx(r,e,i,s){const a=sd(r.canvas.width,r.canvas.height);bx(a.getContext("2d"),e,i,s),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function Tx(r,e,i,s,a){if(s.children.length===0)return;const h=s.mask_idx!=null?i.masks[s.mask_idx]:null;h&&Tx(r,e,i,h,a);const u=r.canvas.width,p=r.canvas.height,_=sd(u,p),g=_.getContext("2d"),v=s.width,b=s.height,w=s.left,I=s.top,A=new Path2D,P=new Path2D;P.rect(w,I,v,b),A.addPath(P,e),g.clip(A);for(const U of s.children)mx(g,e,i,U,a);const R=g.getImageData(0,0,u,p),O=R.data;if(s.mask_type===dx.MASK_TYPE_LUMINANCE)for(let U=0;U<O.length;U+=4)O[U+3]=O[U+3]/255*(.2126*O[U]+.7152*O[U+1]+.0722*O[U+2]);g.putImageData(R,0,0),r.globalCompositeOperation="destination-in",r.drawImage(_,0,0)}function ah(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function Sx(r,e){const i=r.step;let s=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(s,a);for(let h=0,u=2;h<r.commands.length;h++)switch(r.commands[h]){case nd.PATH_COMMAND_MOVE:s+=r.diffs[u++]*i,a+=r.diffs[u++]*i,e.moveTo(s,a);break;case nd.PATH_COMMAND_LINE:s+=r.diffs[u++]*i,a+=r.diffs[u++]*i,e.lineTo(s,a);break;case nd.PATH_COMMAND_QUAD:{const p=s+r.diffs[u++]*i,_=a+r.diffs[u++]*i;s=p+r.diffs[u++]*i,a=_+r.diffs[u++]*i,e.quadraticCurveTo(p,_,s,a);break}case nd.PATH_COMMAND_CUBIC:{const p=s+r.diffs[u++]*i,_=a+r.diffs[u++]*i,g=p+r.diffs[u++]*i,v=_+r.diffs[u++]*i;s=g+r.diffs[u++]*i,a=v+r.diffs[u++]*i,e.bezierCurveTo(p,_,g,v,s,a);break}case nd.PATH_COMMAND_CLOSE:e.closePath()}return e}function Ex(r){return Sx(r,new Path2D)}class lp{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)}}rt(lp,"LRUCache");class e_{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new Rr(e,e.data)}getFromCache(e,i,s){return this.cacheMap.has(s)||this.cacheMap.set(s,new lp(150)),this.cacheMap.get(s).get(pa(e.toString(),i))}setInCache(e,i,s,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new lp(150));const h=this.cacheDependenciesMap.get(a),u=pa(e.id.toString(),s);h.get(u)||h.set(u,new Set);const p=this.cacheMap.get(a),_=e.toString();h.get(u).add(_),p.put(pa(e.toString(),s),i)}removeImagesFromCacheByIds(e,i,s=0){if(!this.cacheMap.has(s)||!this.cacheDependenciesMap.has(s))return;const a=this.cacheMap.get(s),h=this.cacheDependenciesMap.get(s);for(const u of e){const p=pa(u.toString(),i);
vendor: 27,290 bytes, line 14
14if(h.has(p)){for(const _ of h.get(p))a.delete(_);h.delete(p)}}}rasterize(e,i,s,a,h=Y1){const u=this.getFromCache(e,s,a);if(u)return u.clone();const p=h(i.icon,e.options),_=e_._getImage(p);return this.setInCache(e,_,s,a),_.clone()}}class Ix{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const s=this.toIdx(e,i);return{min:this.minimums[s],max:this.maximums[s]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function Ax(r,e,i,s){let a=0,h=Number.MAX_VALUE;for(let u=0;u<3;u++)if(Math.abs(s[u])<1e-15){if(i[u]<r[u]||i[u]>e[u])return null}else{const p=1/s[u];let _=(r[u]-i[u])*p,g=(e[u]-i[u])*p;if(_>g){const v=_;_=g,g=v}if(_>a&&(a=_),g<h&&(h=g),a>h)return null}return a}function Mx(r,e,i,s,a,h,u,p,_,g,v){const b=s-r,w=a-e,I=h-i,A=u-r,P=p-e,R=_-i,O=v[1]*R-v[2]*P,U=v[2]*A-v[0]*R,V=v[0]*P-v[1]*A,G=b*O+w*U+I*V;if(Math.abs(G)<1e-15)return null;const re=1/G,Q=g[0]-r,te=g[1]-e,ae=g[2]-i,ce=(Q*O+te*U+ae*V)*re;if(ce<0||ce>1)return null;const Ee=te*I-ae*w,de=ae*b-Q*I,Ae=Q*w-te*b,je=(v[0]*Ee+v[1]*de+v[2]*Ae)*re;return je<0||ce+je>1?null:(A*Ee+P*de+R*Ae)*re}function Cx(r,e,i){return(r-e)/(i-e)}function Px(r,e,i,s,a,h,u,p,_){const g=1<<i,v=h-s,b=u-a,w=(r+1)/g*v+s,I=(e+0)/g*b+a,A=(e+1)/g*b+a;p[0]=(r+0)/g*v+s,p[1]=I,_[0]=w,_[1]=A}class zx{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(h){const u=Math.ceil(Math.log2(h.dim/8)),p=[];let _=Math.ceil(Math.pow(2,u));const g=1/_,v=(I,A,P,R,O)=>{const U=R?1:0,V=(I+1)*P-U,G=A*P,re=(A+1)*P-U;O[0]=I*P,O[1]=G,O[2]=V,O[3]=re};let b=new Ix(_);const w=[];for(let I=0;I<_*_;I++){v(I%_,Math.floor(I/_),g,!1,w);const A=La(w[0],w[1],h),P=La(w[2],w[1],h),R=La(w[2],w[3],h),O=La(w[0],w[3],h);b.minimums.push(Math.min(A,P,R,O)),b.maximums.push(Math.max(A,P,R,O)),b.leaves.push(1)}for(p.push(b),_/=2;_>=1;_/=2){const I=p[p.length-1];b=new Ix(_);for(let A=0;A<_*_;A++){v(A%_,Math.floor(A/_),2,!0,w);const P=I.getElevation(w[0],w[1]),R=I.getElevation(w[2],w[1]),O=I.getElevation(w[2],w[3]),U=I.getElevation(w[0],w[3]),V=I.isLeaf(w[0],w[1]),G=I.isLeaf(w[2],w[1]),re=I.isLeaf(w[2],w[3]),Q=I.isLeaf(w[0],w[3]),te=Math.min(P.min,R.min,O.min,U.min),ae=Math.max(P.max,R.max,O.max,U.max),ce=V&&G&&re&&Q;b.maximums.push(ae),b.minimums.push(te),b.leaves.push(ae-te<=5&&ce?1:0)}p.push(b)}return p})(this.dem),s=i.length-1,a=i[s];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,s,0)}raycastRoot(e,i,s,a,h,u,p=1){return Ax([e,i,-100],[s,a,this.maximums[0]*p],h,u)}raycast(e,i,s,a,h,u,p=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,s,a,h,u,p);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:P,nodex:R,nodey:O,depth:U}=I.pop();if(this.leaves[A]){Px(R,O,U,e,i,s,a,b,w);const G=1<<U,re=(R+0)/G,Q=(R+1)/G,te=(O+0)/G,ae=(O+1)/G,ce=La(re,te,this.dem)*p,Ee=La(Q,te,this.dem)*p,de=La(Q,ae,this.dem)*p,Ae=La(re,ae,this.dem)*p,je=Mx(b[0],b[1],ce,w[0],b[1],Ee,w[0],w[1],de,h,u),Ce=Mx(w[0],w[1],de,b[0],w[1],Ae,b[0],b[1],ce,h,u),Fe=Math.min(je!==null?je:Number.MAX_VALUE,Ce!==null?Ce:Number.MAX_VALUE);if(Fe!==Number.MAX_VALUE)return Fe;{const Ve=Hr([],h,u,P);if(Rx(ce,Ee,Ae,de,Cx(Ve[0],b[0],w[0]),Cx(Ve[1],b[1],w[1]))>=Ve[2])return P}continue}let V=0;for(let G=0;G<this._siblingOffset.length;G++){Px((R<<1)+this._siblingOffset[G][0],(O<<1)+this._siblingOffset[G][1],U+1,e,i,s,a,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[A]+G]*p;const re=Ax(b,w,h,u);if(re!=null){const Q=re;g[G]=Q;let te=!1;for(let ae=0;ae<V&&!te;ae++)Q>=g[v[ae]]&&(v.splice(ae,0,G),te=!0);te||(v[V]=G),V++}}for(let G=0;G<V;G++){const re=v[G];I.push({idx:this.childOffsets[A]+re,t:g[re],nodex:(R<<1)+this._siblingOffset[re][0],nodey:(O<<1)+this._siblingOffset[re][1],depth:U+1})}}return null}_addNode(e,i,s){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(s),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,s,a,h){if(e[a].isLeaf(i,s)===1)return;this.childOffsets[h]||(this.childOffsets[h]=this.nodeCount);const u=a-1,p=e[u];let _=0,g=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],w=2*s+this._siblingOffset[v][1],I=p.getElevation(b,w),A=p.isLeaf(b,w),P=this._addNode(I.min,I.max,A);A&&(_|=1<<v),g||(g=P)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*s+this._siblingOffset[v][1],u,g+v)}}function Rx(r,e,i,s,a,h){return pt(pt(r,i,h),pt(e,s,h),a)}function La(r,e,i){const s=i.dim,a=W(r*s-.5,0,s-1),h=W(e*s-.5,0,s-1),u=Math.floor(a),p=Math.floor(h),_=Math.min(u+1,s-1),g=Math.min(p+1,s-1);return Rx(i.get(u,p),i.get(_,p),i.get(u,g),i.get(_,g),a-u,h-p)}const K1={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function J1(r,e,i){return(256*r*256+256*e+i)/10-1e4}function Q1(r,e,i){return 256*r+e+i/256-32768}class cp{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,s,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&s!=="mapbox"&&s!=="terrarium")return void Gt(`"${s}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const h=this.dim=i.height-2,u=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;_<h;_++)u[this._idx(-1,_)]=u[this._idx(0,_)],u[this._idx(h,_)]=u[this._idx(h-1,_)],u[this._idx(_,-1)]=u[this._idx(_,0)],u[this._idx(_,h)]=u[this._idx(_,h-1)];u[this._idx(-1,-1)]=u[this._idx(0,0)],u[this._idx(h,-1)]=u[this._idx(h-1,0)],u[this._idx(-1,h)]=u[this._idx(0,h-1)],u[this._idx(h,h)]=u[this._idx(h-1,h-1)]}const p=s==="terrarium"?Q1:J1;for(let _=0;_<u.length;++_){const g=4*_;this.floatView[_]=p(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=Hn.now()}_buildQuadTree(){this._tree=new zx(this)}get(e,i,s=!1){s&&(e=W(e,-1,this.dim),i=W(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,s){const a=this._idx(e,i),h=this.floatView[a];return this.floatView[a]=s,s-h}static getUnpackVector(e){return K1[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 s=[0,0,0,0],a=cp.getUnpackVector(i);let h=Math.floor((e+a[3])/a[2]);return s[2]=h%256,h=Math.floor(h/256),s[1]=h%256,h=Math.floor(h/256),s[0]=h,s}getPixels(){return new A_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,h=i*this.dim+this.dim,u=s*this.dim,p=s*this.dim+this.dim;switch(i){case-1:a=h-1;break;case 1:h=a+1}switch(s){case-1:u=p-1;break;case 1:p=u+1}const _=-i*this.dim,g=-s*this.dim;for(let v=u;v<p;v++)for(let b=a;b<h;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 eb(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(s,a){return s.readFields(sb,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)})(i,i.readVarint()+i.pos))}function tb(r,e,i){r===1?(e.delta_filter=(function(s,a){return s.readFields(ib,{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 ib(r,e,i){r===1&&(e.blockSize=i.readVarint())}function rb(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 nb(r,e,i){let s=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push((function(h,u){return h.readFields(tb,{},u)})(i,i.readVarint()+i.pos)):r===4?e.codec=(function(h,u){return h.readFields(rb,{},u)})(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?s=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=s)}function sb(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(s,a){return s.readFields(nb,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)})(i,i.readVarint()+i.pos))}function ob(r,e,i){if(r===2)(function(s,a,h){s.readFields(ab,h,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function ab(r,e,i){if(r===1){let s=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[s++]=i.readVarint()}}function lb(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let s=2;s>=1;s--){const a=s===1?1:0,h=s===2?1:0;for(let u=0;u<e[0];u++){const p=e[1]*u;for(let _=a;_<e[1];_++){const g=e[2]*(_+p);for(let v=h;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[s]}return r}function cb(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function hb(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const s=r[i],a=r[i+1];r[i]=(240&s)>>4|(61440&s)>>8|(240&a)<<4|61440&a,r[i+1]=15&s|(3840&s)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const s=r[i],a=r[i+1],h=r[i+2],u=r[i+3];r[i+0]=(192&s)>>6|(192&a)>>4|(192&h)>>2|192&u,r[i+1]=(48&s)>>4|(48&a)>>2|48&h|(48&u)<<2,r[i+2]=(12&s)>>2|12&a|(12&h)<<2|(12&u)<<4,r[i+3]=3&s|(3&a)<<2|(3&h)<<4|(3&u)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}rt(cp,"DEMData"),rt(zx,"DemMinMaxQuadTree",{omit:["dem"]});var Yn=Uint8Array,od=Uint16Array,ub=Int32Array,Dx=new Yn([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]),Lx=new Yn([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]),db=new Yn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fx=function(r,e){for(var i=new od(31),s=0;s<31;++s)i[s]=e+=1<<r[s-1];var a=new ub(i[30]);for(s=1;s<30;++s)for(var h=i[s];h<i[s+1];++h)a[h]=h-i[s]<<5|s;return{b:i,r:a}},Ox=Fx(Dx,2),kx=Ox.b,fb=Ox.r;kx[28]=258,fb[258]=28;for(var pb=Fx(Lx,0).b,Bx=new od(32768),xr=0;xr<32768;++xr){var lh=(43690&xr)>>1|(21845&xr)<<1;Bx[xr]=((65280&(lh=(61680&(lh=(52428&lh)>>2|(13107&lh)<<2))>>4|(3855&lh)<<4))>>8|(255&lh)<<8)>>1}var ad=function(r,e,i){for(var s=r.length,a=0,h=new od(e);a<s;++a)r[a]&&++h[r[a]-1];var u,p=new od(e);for(a=1;a<e;++a)p[a]=p[a-1]+h[a-1]<<1;u=new od(1<<e);var _=15-e;for(a=0;a<s;++a)if(r[a])for(var g=a<<4|r[a],v=e-r[a],b=p[r[a]-1]++<<v,w=b|(1<<v)-1;b<=w;++b)u[Bx[b]>>_]=g;return u},ld=new Yn(288);for(xr=0;xr<144;++xr)ld[xr]=8;for(xr=144;xr<256;++xr)ld[xr]=9;for(xr=256;xr<280;++xr)ld[xr]=7;for(xr=280;xr<288;++xr)ld[xr]=8;var Nx=new Yn(32);for(xr=0;xr<32;++xr)Nx[xr]=5;var mb=ad(ld,9),_b=ad(Nx,5),t_=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},Es=function(r,e,i){var s=e/8|0;return(r[s]|r[s+1]<<8)>>(7&e)&i},i_=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},gb=["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"],Is=function(r,e,i){var s=new Error(e||gb[r]);if(s.code=r,Error.captureStackTrace&&Error.captureStackTrace(s,Is),!i)throw s;return s},yb=new Yn(0),xb=typeof TextDecoder<"u"&&new TextDecoder;try{xb.decode(yb,{stream:!0})}catch{}const vb={gzip_data:"gzip"};class ss extends Error{constructor(e){super(e),this.name="MRTError"}}const bb={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Vx={uint32:1,uint16:2,uint8:4},wb={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let r_;class hp{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 ss(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),s=new DataView(e);if(i[0]!==13)throw new ss("File is not a valid MRT.");return s.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),s=this.getHeaderLength(e);if(i.length<s)throw new ss(`Expected header with length >= ${s} but got buffer of length ${i.length}`);const a=new r_(i.subarray(0,s)).readFields(eb,{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 ss(`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 h of a.layers)this.layers[h.name]=new Ux(h,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],s=this.getLayer(e.layerName);for(let a of e.blockIndices){const h=s.dataIndex[a],u=h.firstByte-e.firstByte,p=h.lastByte-e.firstByte;if(s._blocksInProgress.has(a))continue;const _={layerName:s.name,firstByte:u,lastByte:p,pixelFormat:s.pixelFormat,blockIndex:a,blockShape:[h.bands.length].concat(s.bandShape),buffer:s.buffer,codec:h.codec.codec,filters:h.filters.map((g=>g.filter))};s._blocksInProgress.add(a),i.push(_)}return new jx(i,(()=>{i.forEach((a=>s._blocksInProgress.delete(a.blockIndex)))}),((a,h)=>{if(i.forEach((u=>s._blocksInProgress.delete(u.blockIndex))),a)throw a;h.forEach((u=>{this.getLayer(u.layerName).processDecodedData(u)}))}))}}class Ux{constructor({version:e,name:i,units:s,tileSize:a,pixelFormat:h,buffer:u,dataIndex:p},_){if(this.version=e,this.version!==1)throw new ss(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=s,this.tileSize=a,this.buffer=u,this.pixelFormat=bb[h],this.dataIndex=p,this.bandShape=[a+2*u,a+2*u,Vx[this.pixelFormat]],this._decodedBlocks=new lp(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Vx[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[s,a]of this.dataIndex.entries()){for(const[h,u]of a.bands.entries())if(u===e)return{bandIndex:i+h,blockIndex:s,blockBandIndex:h};i+=a.bands.length}break;case"number":for(const[s,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:s,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new ss(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,s=-1/0;const a=[],h=new Set;for(const u of e){const{blockIndex:p}=this.getBlockForBand(u);if(p<0)throw new ss(`Invalid band: ${JSON.stringify(u)}`);const _=this.dataIndex[p];a.includes(p)||a.push(p),h.add(p),i=Math.min(i,_.firstByte),s=Math.max(s,_.lastByte)}if(h.size>this.cacheSize)throw new ss(`Number of blocks to decode (${h.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:s,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:s}=this.getBlockForBand(e);if(i<0)throw new ss(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new ss(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const h=this.dataIndex[i],u=this.bandShape.reduce(((g,v)=>g*v),1),p=s*u,_=a.subarray(p,p+u);return{data:_,bytes:new Uint8Array(_.buffer).subarray(_.byteOffset,_.byteOffset+_.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:h.offset,scale:h.scale}}}hp.setPbf=function(r){r_=r};class jx{constructor(e,i,s){this.tasks=e,this._onCancel=i,this._onComplete=s,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}hp.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map((s=>{const{layerName:a,firstByte:h,lastByte:u,pixelFormat:p,blockShape:_,blockIndex:g,filters:v,codec:b}=s,w=i.subarray(h,u+1),I=new Uint32Array(_[0]*_[1]*_[2]);let A;if(b!=="gzip_data")throw new ss(`Unhandled codec: ${b}`);return A=(function(P,R){if(!globalThis.DecompressionStream&&R==="gzip_data")return Promise.resolve(((G=(function(te){te[0]==31&&te[1]==139&&te[2]==8||Is(6,"invalid gzip data");var ae=te[3],ce=10;4&ae&&(ce+=2+(te[10]|te[11]<<8));for(var Ee=(ae>>3&1)+(ae>>4&1);Ee>0;Ee-=!te[ce++]);return ce+(2&ae)})(V=P))+8>V.length&&Is(6,"invalid gzip data"),(function(te,ae,ce,Ee){var de=te.length;if(!de||ae.f&&!ae.l)return ce||new Yn(0);var Ae=!ce,je=Ae||ae.i!=2,Ce=ae.i;Ae&&(ce=new Yn(3*de));var Fe,Ve,Te=function(Ui){var Ai=ce.length;if(Ui>Ai){var Si=new Yn(Math.max(2*Ai,Ui));Si.set(ce),ce=Si}},Oe=ae.f||0,fe=ae.p||0,Se=ae.b||0,He=ae.l,Be=ae.d,ct=ae.m,nt=ae.n,De=8*de;do{if(!He){Oe=Es(te,fe,1);var Ne=Es(te,fe+1,3);if(fe+=3,!Ne){var ot=te[(H=4+((fe+7)/8|0))-4]|te[H-3]<<8,et=H+ot;if(et>de){Ce&&Is(0);break}je&&Te(Se+ot),ce.set(te.subarray(H,et),Se),ae.b=Se+=ot,ae.p=fe=8*et,ae.f=Oe;continue}if(Ne==1)He=mb,Be=_b,ct=9,nt=5;else if(Ne==2){var Xe=Es(te,fe,31)+257,tt=Es(te,fe+10,15)+4,_t=Xe+Es(te,fe+5,31)+1;fe+=14;for(var Tt=new Yn(_t),Mt=new Yn(19),It=0;It<tt;++It)Mt[db[It]]=Es(te,fe+3*It,7);fe+=3*tt;var qt=t_(Mt),Lt=(1<<qt)-1,Ii=ad(Mt,qt);for(It=0;It<_t;){var H,$=Ii[Es(te,fe,Lt)];if(fe+=15&$,(H=$>>4)<16)Tt[It++]=H;else{var be=0,$e=0;for(H==16?($e=3+Es(te,fe,3),fe+=2,be=Tt[It-1]):H==17?($e=3+Es(te,fe,7),fe+=3):H==18&&($e=11+Es(te,fe,127),fe+=7);$e--;)Tt[It++]=be}}var Ke=Tt.subarray(0,Xe),Ye=Tt.subarray(Xe);ct=t_(Ke),nt=t_(Ye),He=ad(Ke,ct),Be=ad(Ye,nt)}else Is(1);if(fe>De){Ce&&Is(0);break}}je&&Te(Se+131072);for(var st=(1<<ct)-1,vt=(1<<nt)-1,Nt=fe;;Nt=fe){var Vt=(be=He[i_(te,fe)&st])>>4;if((fe+=15&be)>De){Ce&&Is(0);break}if(be||Is(2),Vt<256)ce[Se++]=Vt;else{if(Vt==256){Nt=fe,He=null;break}var zt=Vt-254;Vt>264&&(zt=Es(te,fe,(1<<(Ct=Dx[It=Vt-257]))-1)+kx[It],fe+=Ct);var mi=Be[i_(te,fe)&vt],Hi=mi>>4;if(mi||Is(3),fe+=15&mi,Ye=pb[Hi],Hi>3){var Ct=Lx[Hi];Ye+=i_(te,fe)&(1<<Ct)-1,fe+=Ct}if(fe>De){Ce&&Is(0);break}je&&Te(Se+131072);var Pi=Se+zt;if(Se<Ye){var Ti=0-Ye,hi=Math.min(Ye,Pi);for(Ti+Se<0&&Is(3);Se<hi;++Se)ce[Se]=(void 0)[Ti+Se]}for(;Se<Pi;++Se)ce[Se]=ce[Se-Ye]}}ae.l=He,ae.p=Nt,ae.b=Se,ae.f=Oe,He&&(Oe=1,ae.m=ct,ae.d=Be,ae.n=nt)}while(!Oe);return Se!=ce.length&&Ae?(Fe=ce,((Ve=Se)==null||Ve>Fe.length)&&(Ve=Fe.length),new Yn(Fe.subarray(0,Ve))):ce.subarray(0,Se)})(V.subarray(G,-8),{i:2},new Yn(((O=V)[(U=O.length)-4]|O[U-3]<<8|O[U-2]<<16|O[U-1]<<24)>>>0))));var O,U,V,G;const re=vb[R];if(!re)throw new Error(`Unhandled codec: ${R}`);const Q=new globalThis.DecompressionStream(re);return new Response(new Blob([P]).stream().pipeThrough(Q)).arrayBuffer().then((te=>new Uint8Array(te)))})(w,b).then((P=>((function(R,O){R.readFields(ob,O)})(new r_(P),I),new wb[p](I.buffer)))),A.then((P=>{for(let R=v.length-1;R>=0;R--)switch(v[R]){case"delta_filter":lb(P,_);break;case"zigzag_filter":cb(P);break;case"bitshuffle_filter":hb(P,p);break;default:throw new ss(`Unhandled filter "${v[R]}"`)}return{layerName:a,blockIndex:g,data:P}})).catch((P=>{throw P}))})))},rt(jx,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),rt(hp,"MapboxRasterTile"),rt(Ux,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class Gx{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const Tb=["id","tile","layer","source","sourceLayer","state"];class ch{constructor(e,i,s,a,h){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=s,this._y=a,this.properties=e.properties,this.id=h}clone(){const e=new ch(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._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 Tb)this[i]!==void 0&&(e[i]=this[i]);return e}}class qx{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ks(We,16,0),this.featureIndexArray=new af,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,s,a,h,u=0,p=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,a,h,u);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)}p!==0&&(w[0]-=p,w[1]-=p,w[2]+=p,w[3]+=p),w[0]<We&&w[1]<We&&w[2]>=0&&w[3]>=0&&g.insert(_,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new at(new Bf(this.rawTileData)).layers,this.sourceLayerCoder=new Gx(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:s,transform:a,tileTransform:h,pixelPosMatrix:u,availableImages:p,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=s.bufferedTilespaceBounds,v=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,((A,P,R,O)=>Ji(s.bufferedTilespaceGeometry,A,P,R,O)));v.sort(Sb);let b=null;a.elevation&&v.length>0&&(b=sh.create(a.elevation,this.tileID));const w={};let I;for(let A=0;A<v.length;A++){const P=v[A];if(P===I)continue;I=P;const R=this.featureIndexArray.get(P);let O=null;this.is3DTile?this.loadMatchingModelFeature(w,R,e,s,a,_):this.loadMatchingFeature(w,R,e,p,_,((U,V,G,re=0)=>(O||(O=se(U,this.tileID.canonical,h)),V.queryIntersectsFeature(s,U,G,O,this.z,a,u,b,re))))}return w}loadMatchingFeature(e,i,s,a,h,u){const{featureIndex:p,bucketIndex:_,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],w=s.layers,I=Object.keys(w);if(I.length&&!jt(I,b))return;const A=s.sourceCache,P=this.sourceLayerCoder.decode(g),R=this.vtLayers[P].feature(p),O=this.getId(R,P);for(let U=0;U<b.length;U++){const V=b[U];if(!w[V])continue;const{styleLayer:G,targets:re}=w[V];let Q={};O!==void 0&&(Q=A.getFeatureState(G.sourceLayer,O));const te=!u||u(R,G,Q,v);if(!te)continue;const ae=new ch(R,this.z,this.x,this.y,O);ae.tile=this.tileID.canonical,ae.state=Q;let ce=this.serializedLayersCache.get(V);ce||(ce=G.serialize(),ce.id=V,this.serializedLayersCache.set(V,ce)),ae.source=ce.source,ae.sourceLayer=ce["source-layer"],ae.layer=ye({},ce),ae.layer.paint=Hx(ce.paint,G.paint,R,Q,a),ae.layer.layout=Hx(ce.layout,G.layout,R,Q,a);let Ee=!1;for(const de of re){this.updateFeatureProperties(ae,de);const{filter:Ae}=de;if(Ae){if(R.properties=ae.properties,Ae.needGeometry){const je=we(R,!0);if(!Ae.filter(new pi(this.tileID.overscaledZ,{worldview:h}),je,this.tileID.canonical))continue}else if(!Ae.filter(new pi(this.tileID.overscaledZ,{worldview:h}),R))continue}Ee=!0,de.targetId&&this.addFeatureVariant(ae,de)}Ee&&this.appendToResult(e,V,p,ae,te)}}loadMatchingModelFeature(e,i,s,a,h,u){const{featureIndex:p,bucketIndex:_}=i,g=this.bucketLayerIDs[_],v=s.layers,b=Object.keys(v);if(!b.length||jt(b,g))for(let w=0;w<g.length;w++){const I=g[w],{styleLayer:A,targets:P}=v[I];if(A.type!=="model")continue;const R=a.tile,O=R.getBucket(A);if(!(O&&O instanceof rp))continue;const U=C1(O,p,a,h);if(!U)continue;const{z:V,x:G,y:re}=R.tileID.canonical,{feature:Q,intersectionZ:te,position:ae}=U;let ce={};Q.id!==void 0&&(ce=s.sourceCache.getFeatureState(A.sourceLayer,Q.id));const Ee=new ch({},V,G,re,Q.id);Ee.tile=this.tileID.canonical,Ee.state=ce,Ee.properties=Q.properties,Ee.geometry={type:"Point",coordinates:[ae.lng,ae.lat]};let de=this.serializedLayersCache.get(I);de||(de=A.serialize(),de.id=I,this.serializedLayersCache.set(I,de)),Ee.source=de.source,Ee.sourceLayer=de["source-layer"],Ee.layer=ye({},de);let Ae=!1;for(const je of P){this.updateFeatureProperties(Ee,je);const{filter:Ce}=je;if(Ce){if(Q.properties=Ee.properties,Ce.needGeometry){if(!Ce.filter(new pi(this.tileID.overscaledZ,{worldview:u}),Q,this.tileID.canonical))continue}else if(!Ce.filter(new pi(this.tileID.overscaledZ,{worldview:u}),Q))continue}Ae=!0,je.targetId&&this.addFeatureVariant(Ee,je)}Ae&&this.appendToResult(e,I,p,Ee,te)}}updateFeatureProperties(e,i,s){if(i.properties){const a={};for(const h in i.properties){const u=i.properties[h].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,s);u!=null&&(a[h]=u)}e.properties=a}}addFeatureVariant(e,i,s){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,s,a,h){let u=e[i];u===void 0&&(u=e[i]=[]),u.push({featureIndex:s,feature:a,intersectionZ:h})}lookupSymbolFeatures(e,i,s,a,h,u){const p={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(p,{bucketIndex:i,sourceLayerIndex:s,featureIndex:_,layoutVertexArrayOffset:0},a,h,u);return p}loadFeature(e){const{featureIndex:i,sourceLayerIndex:s}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(s),h=this.vtFeatures[a];if(h[i])return h[i];const u=this.vtLayers[a].feature(i);return h[i]=u,u}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){let s=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 h=Mo(a);if(h.result!=="success"){const u=h.value.map((p=>`${p.key}: ${p.message}`)).join(", ");return void Gt(`Failed to create expression for promoteId: ${u}`)}this.promoteIdExpression=h.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new hl),s=this.promoteIdExpression.evaluate({zoom:0},e)}else s=e.properties[a];typeof s=="boolean"&&(s=Number(s))}return s}}function Hx(r,e,i,s,a){return St(r,((h,u)=>{const p=e instanceof Wn?e.get(u):null;return p&&p.evaluate?p.evaluate(i,s,void 0,a):p}))}function Sb(r,e){return e-r}rt(qx,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const $x=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,392 bytes, line 14
14];class n_{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=s>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const h=$x[15&s];if(!h)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[p]=new Uint32Array(e,4,1);return new n_(p,u,h,e)}constructor(e,i=64,s=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=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const h=$x.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,p=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-p%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${s}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+p+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+p+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+p+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return s_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:u,nodeSize:p}=this,_=[0,h.length-1,0],g=[];for(;_.length;){const v=_.pop()||0,b=_.pop()||0,w=_.pop()||0;if(b-w<=p){for(let R=w;R<=b;R++){const O=u[2*R],U=u[2*R+1];O>=e&&O<=s&&U>=i&&U<=a&&g.push(h[R])}continue}const I=w+b>>1,A=u[2*I],P=u[2*I+1];A>=e&&A<=s&&P>=i&&P<=a&&g.push(h[I]),(v===0?e<=A:i<=P)&&(_.push(w),_.push(I-1),_.push(1-v)),(v===0?s>=A:a>=P)&&(_.push(I+1),_.push(b),_.push(1-v))}return g}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:h,nodeSize:u}=this,p=[0,a.length-1,0],_=[],g=s*s;for(;p.length;){const v=p.pop()||0,b=p.pop()||0,w=p.pop()||0;if(b-w<=u){for(let R=w;R<=b;R++)Wx(h[2*R],h[2*R+1],e,i)<=g&&_.push(a[R]);continue}const I=w+b>>1,A=h[2*I],P=h[2*I+1];Wx(A,P,e,i)<=g&&_.push(a[I]),(v===0?e-s<=A:i-s<=P)&&(p.push(w),p.push(I-1),p.push(1-v)),(v===0?e+s>=A:i+s>=P)&&(p.push(I+1),p.push(b),p.push(1-v))}return _}}function s_(r,e,i,s,a,h){if(a-s<=i)return;const u=s+a>>1;Zx(r,e,u,s,a,h),s_(r,e,i,s,u-1,1-h),s_(r,e,i,u+1,a,1-h)}function Zx(r,e,i,s,a,h){for(;a>s;){if(a-s>600){const g=a-s+1,v=i-s+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);Zx(r,e,i,Math.max(s,Math.floor(i-v*w/g+I)),Math.min(a,Math.floor(i+(g-v)*w/g+I)),h)}const u=e[2*i+h];let p=s,_=a;for(cd(r,e,s,i),e[2*a+h]>u&&cd(r,e,s,a);p<_;){for(cd(r,e,p,_),p++,_--;e[2*p+h]<u;)p++;for(;e[2*_+h]>u;)_--}e[2*s+h]===u?cd(r,e,s,_):(_++,cd(r,e,_,a)),_<=i&&(s=_+1),i<=_&&(a=_-1)}}function cd(r,e,i,s){o_(r,i,s),o_(e,2*i,2*s),o_(e,2*i+1,2*s+1)}function o_(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Wx(r,e,i,s){const a=r-i,h=e-s;return a*a+h*h}o.$=Tr,o.A=ys,o.B=vs,o.C=pa,o.D=Xc,o.E=xo,o.F=2,o.G=Xu,o.H=vy,o.I=un,o.J=Vs,o.K=class extends ip{},o.L=vo,o.M=Qd,o.N=Ec,o.O=Sc,o.P=ke,o.Q=Gd,o.R=Ja,o.S=Xh,o.T=vm,o.U=Tl,o.V=ip,o.W=Yh,o.X=Mo,o.Y=hc,o.Z=sa,o._=na,o.a=function(r){return Ar.API_CDN_URL_REGEX.test(r)},o.a$=Pe,o.a0=yh,o.a1=Sl,o.a2=Ic,o.a3=jd,o.a4=function(r){const e=r.value;let i=[];if(!e)return i;const s=Vs(e);return s!=="string"?(i=i.concat([new ip(r.key,e,`string expected, "${s}" found`)]),i):(Zm(e,!0)||(i=i.concat([new ip(r.key,e,`invalid url "${e}"`)])),i)},o.a5=ue,o.a6=wl,o.a7=Yi,o.a8=Ge,o.a9=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return dr(r.expression.evaluate(e))}interpolate(r,e,i){return{x:pt(r.x,e.x,i),y:pt(r.y,e.y,i),z:pt(r.z,e.z,i),azimuthal:pt(r.azimuthal,e.azimuthal,i),polar:pt(r.polar,e.polar,i)}}},o.aA=hn,o.aB=Ur,o.aC=zr,o.aD=z,o.aE=oe,o.aF=function(r,e){const i={};for(let s=0;s<e.length;s++){const a=e[s];a in r&&(i[a]=r[a])}return i},o.aG=M,o.aH=F,o.aI=class{constructor(r){this.entries={}
14,this.scheduler=r}request(r,e,i,s){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[h,u]=a.result;return this.scheduler?this.scheduler.add((()=>{s(h,u)}),e):s(h,u),()=>{}}return a.callbacks.push(s),a.cancel||(a.cancel=i(((h,u)=>{a.result=[h,u];for(const p of a.callbacks)this.scheduler?this.scheduler.add((()=>{p(h,u)}),e):p(h,u);setTimeout((()=>delete this.entries[r]),3e3)}))),()=>{a.result||(a.callbacks=a.callbacks.filter((h=>h!==s)),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},o.aJ=function(r,e,i){const s=JSON.stringify(r.request);return r.data&&(this.deduped.entries[s]={result:[null,r.data]}),this.deduped.request(s,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},(a=>{const h=Qa(r.request,((u,p,_,g)=>{u?a(u):p&&a(null,{vectorTile:i?void 0:new at(new Bf(p)),rawData:p,cacheControl:_,expires:g})}));return()=>{h.cancel(),a()}}),e)},o.aK=function(r){fh++,fh>gs&&(r.getActor().send("enforceCacheSizeLimit",$n),fh=0)},o.aL=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log(r)/Math.LN2))},o.aM=mr,o.aN=Xy,o.aO=tx,o.aP=Wy,o.aQ=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let s=0;s<r.length;s++){const a=document.createElement("source");fp(r[s])||(i.crossOrigin="Anonymous"),a.src=r[s],i.appendChild(a)}return{cancel:()=>{}}},o.aR=Gu,o.aS=function(r){return fetch(r).then((e=>e.arrayBuffer())).then((e=>Ig(e,0,r)))},o.aT=Lg,o.aU=class{constructor(r,e,i,s){this.id=r,this.position=e!=null?new S(e[0],e[1]):new S(0,0),this.orientation=i??[0,0,0],this.nodes=s,this.uploaded=!1,this.aabb=new kt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(r,e){if(Gi(r.matrix,e,r.matrix),r.meshes)for(const i of r.meshes){const s=kt.applyTransformFast(i.aabb,r.matrix);this.aabb.encapsulate(s)}if(r.children)for(const i of r.children)this._applyTransformations(i,r.matrix)}computeBoundsAndApplyParent(){const r=Bt([]);for(const e of this.nodes)this._applyTransformations(e,r)}computeModelMatrix(r,e,i,s,a,h,u=!1){Rg(this.matrix,this,r.transform,this.position,e,i,s,a,h,u)}upload(r){if(!this.uploaded){for(const e of this.nodes)Tm(e,r);for(const e of this.nodes)kf(e);this.uploaded=!0}}destroy(){for(const r of this.nodes)Sm(r)}},o.aV=bt,o.aW=Ju,o.aX=N,o.aY=j,o.aZ=_a,o.a_=Li,o.aa=pi,o.ab=Ys,o.ac=J,o.ad=tr,o.ae=Cr,o.af=le,o.ag=Wn,o.ah=Aa,o.ai=pt,o.aj=We,o.ak=gd,o.al=ei,o.am=li,o.an=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return(function([i,s]){const a=dr([1,i,s]);return{x:a.x,y:a.y,z:a.z}})(r.expression.evaluate(e))}interpolate(r,e,i){return{x:pt(r.x,e.x,i),y:pt(r.y,e.y,i),z:pt(r.z,e.z,i)}}},o.ao=function(r,e,i=0,s=!0){const a=new ke(i,i),h=r.sub(a),u=e.add(a),p=[h,new ke(u.x,h.y),u,new ke(h.x,u.y)];return s&&p.push(h.clone()),p},o.ap=function(r,e){const i=[];for(let s=0;s<r.length;s++){const a=ve(s-1,-1,r.length-1),h=ve(s+1,-1,r.length-1),u=r[s],p=r[h],_=r[a].sub(u).unit(),g=p.sub(u).unit(),v=g.angleWithSep(_.x,_.y),b=_.add(g).unit().mult(-1*e/Math.sin(v/2));i.push(u.add(b))}return i},o.aq=Ly,o.ar=Ji,o.as=function(r,e,i=0){return lr(((e.x-i)*r.scale-r.x)*We,(e.y*r.scale-r.y)*We,q(e.z,e.y))},o.at=ir,o.au=Ri,o.av=Kt,o.aw=Hg,o.ax=function(r){let e=1/0,i=1/0,s=-1/0,a=-1/0;for(const h of r)e=Math.min(e,h.x),i=Math.min(i,h.y),s=Math.max(s,h.x),a=Math.max(a,h.y);return{min:new ke(e,i),max:new ke(s,a)}},o.ay=W,o.az=Gi,o.b=function(r){return Ar.API_FONTS_REGEX.test(r)},o.b$=Bm,o.b0=nf,o.b1=Jf,o.b2=function(){es.isLoading()||es.isLoaded()||ru()!=="deferred"||Yd()},o.b3=da,o.b4=we,o.b5=ch,o.b6=ri,o.b7=Am,o.b8=sm,o.b9=se,o.bA=function(r,e){const{x:i,y:s}=r.point,a=p_(i,s,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Gi(a,a,Xp(no(e)))},o.bB=as,o.bC=Ba,o.bD=function(r,e){return Math.hypot(e[0]-r[0],e[1]-r[1],e[2]-r[2])},o.bE=Hr,o.bF=cr,o.bG=er,o.bH=Wu,o.bI=Dn,o.bJ=Lm,o.bK=function(r,e,i,s,a){const h=5*e+2;r.float32[h+0]=i,r.float32[h+1]=s,r.float32[h+2]=a},o.bL=Kf,o.bM=xn,o.bN=Fs,o.bO=Ls,o.bP=vn,o.bQ=ve,o.bR=function(r,e,i,s){var a=new $i(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=s,a},o.bS=Pf,o.bT=yi,o.bU=Ir,o.bV=H_,o.bW=ix,o.bX=X_,o.bY=lm,o.bZ=Dm,o.b_=Ay,o.ba=ln,o.bb=gu,o.bc=l_,o.bd=Ni,o.be=Zc,o.bf=Hm,o.bg=function(r,e){const i=Aa(e.zoom);if(i===0)return no(r);
14const s=xf(r),a=Wp(s),h=z(s.getWest())*e.worldSize,u=z(s.getEast())*e.worldSize,p=F(s.getNorth())*e.worldSize,_=F(s.getSouth())*e.worldSize,g=[h,p,0],v=[u,p,0],b=[h,_,0],w=[u,_,0],I=Jr([],e.globeMatrix);return tr(g,g,I),tr(v,v,I),tr(b,b,I),tr(w,w,I),a[0]=Fo(a[0],b,i),a[1]=Fo(a[1],w,i),a[2]=Fo(a[2],v,i),a[3]=Fo(a[3],g,i),kt.fromPoints(a)},o.bh=bf,o.bi=Jr,o.bj=Au,o.bk=Fo,o.bl=ma,o.bm=iv,o.bn=ko,o.bo=qr,o.bp=hp,o.bq=Bf,o.br=Qa,o.bs=function(r,e){const i=[];for(const s in r)s in e||i.push(s);return i},o.bt=he,o.bu=["type","source","source-layer","minzoom","maxzoom","filter","layout"],o.bv=ms,o.bw=function(r){var e=new $i(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},o.bx=Bt,o.by=Ms,o.bz=uo,o.c=Hl,o.c$=45,o.c0=n_,o.c1=Fi,o.c2=Ds,o.c3=ds,o.c4=function(r,e,i){i*=.5;var s=e[0],a=e[1],h=e[2],u=e[3],p=Math.sin(i),_=Math.cos(i);return r[0]=s*_+a*p,r[1]=a*_-s*p,r[2]=h*_+u*p,r[3]=u*_-h*p,r},o.c5=fo,o.c6=qi,o.c7=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},o.c8=Cs,o.c9=function(r,e,i,s,a){var h,u=1/Math.tan(e/2);return 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?(r[10]=(a+s)*(h=1/(s-a)),r[14]=2*a*s*h):(r[10]=-1,r[14]=-2*s),r},o.cA=Pn,o.cB=u_,o.cC=function(r,e,i,s,a,h,u,p,_){if(_.name==="globe")return u_(r,e,new Pn(i,s,a),!1);const g=Ju({z:i,x:s,y:a},_);return new kt([(h+g.x/g.scale)*e,e*(g.y/g.scale),u],[(h+g.x2/g.scale)*e,e*(g.y2/g.scale),p])},o.cD=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},o.cE=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},o.cF=function(r){const e=Math.round((r+45+360)%360/90)%4;return k[e]},o.cG=X,o.cH=hs,o.cI=l,o.cJ=function(r){const e=Bt(new Float64Array(16));Gi(e,r.pixelMatrix,r.globeMatrix);const i=[0,d,0],s=[0,f,0];return tr(i,i,e),tr(s,s,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!Kp(r,new S(r.center.lat,90)),s[0]>0&&s[0]<=r.width&&s[1]>0&&s[1]<=r.height&&!Kp(r,new S(r.center.lat,-90))]},o.cK=function(r,e){const{scale:i}=r.tileTransform,s=i*We/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return(function(a,h,u){var p=h[1],_=h[2],g=h[3],v=u[0],b=u[1];return a[0]=h[0]*v,a[1]=p*v,a[2]=_*b,a[3]=g*b,a})(new Float32Array(4),e.inverseAdjustmentMatrix,[s,s])},o.cL=Ff,o.cM=Gl,o.cN=Ag,o.cO=function(r){const e=Ag(r,!0);return as([],[e[0],e[1],e[4],e[5]])},o.cP=Fr,o.cQ=ti,o.cR=As,o.cS=function(r){const{x:e,y:i}=r.point,{lng:s,lat:a}=r._center;return p_(e,i,r.worldSize,s,a)},o.cT=ka,o.cU=ge,o.cV=zn,o.cW=Zi,o.cX=_f,o.cY=function(r,e,i){let s=0;for(let a=0;a<2;++a)r[a]>0&&(s+=(r[a]-0)*(r[a]-0)),e[a]<0&&(s+=(0-e[a])*(0-e[a]));return s},o.cZ=function(r){return r*r*r*r*r},o.c_=D,o.ca=function(r,e,i,s,a,h,u){var p=1/(e-i),_=1/(s-a),g=1/(h-u);return r[0]=-2*p,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)*p,r[13]=(a+s)*_,r[14]=(u+h)*g,r[15]=1,r},o.cb=L,o.cc=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]},o.cd=$c,o.ce=Ta,o.cf=sr,o.cg=rs,o.ch=Rl,o.ci=S,o.cj=Ny,o.ck=function(){var r=new $i(4);return $i!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},o.cl=function(r,e,i){var s=e[0],a=e[1],h=e[2],u=e[3],p=Math.sin(i),_=Math.cos(i);return r[0]=s*_+h*p,r[1]=a*_+u*p,r[2]=s*-p+h*_,r[3]=a*-p+u*_,r},o.cm=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},o.cn=Fn,o.co=function(r){return Math.hypot(r[0],r[1],r[2],r[3])},o.cp=fs,o.cq=Rs,o.cr=ns,o.cs=3,o.ct=2,o.cu=7,o.cv=6,o.cw=Qr,o.cx=ui,o.cy=ni,o.cz=Mg,o.d=function(r){return Ar.API_TILEJSON_REGEX.test(r)},o.d$=(r,e,i,s,a,h,u,p,_,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?$g(.07,.7,W((14-v.zoom)/5,0,1)):.07;return{u_matrix:Wg(r,e,i,s),u_pixels_to_tile_units:b,u_device_pixel_ratio:h,u_width_scale:u,u_floor_width_scale:p,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:Yg(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Zg(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:_,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:I,u_tile_to_meter:K(e.tileID.canonical,0),u_ground_shadow_factor:g}},o.d0=zl,o.d1=function(r,e,i){const s=Math.sqrt(r*r+e*e+i*i),a=s>0?Math.acos(i/s)*qa:0;let h=r!==0||e!==0?Math.atan2(-e,-r)*qa+90:0;return h<0&&(h+=360),[s,h,a]},o.d2=lr,o.d3=dr,o.d4=K,o.d5=ki,o.d6=kt,o.d7=cn,o.d8=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},o.d9=Zm,o.dA=xf,o.dB=function(r){const e=X-5;r=W(r,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(ei(r))),3);return Math.round(i*(c.length-1))},o.dC=function(r,e,i,s){const a=e.getNorth(),h=e.getSouth(),u=e.getWest(),p=e.getEast(),_=1<<r.z,g=p-u,v=a-h,b=g/n,w=-v/c[i],I=[0,b,0,w,0,0,a,u,0];if(r.z>0){const A=180/s;Kn(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}
vendor: 18,271 bytes, line 14
14,o.dD=no,o.dE=function(r,e,i){const s=Bt(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return ls(s,i.globeMatrix,a),Float32Array.from(s)},o.dF=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,s=1<<i,a=Math.floor(r.x),h=Math.floor((r.x-a)*s),u=Math.floor(r.y*s),p=this.findDEMTileFor(new mr(i,a,i,h,u));return!(!p||!p.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 s=this._source();if(!s||r.y<0||r.y>1)return e;const a=s.getSource().maxzoom,h=1<<a,u=Math.floor(r.x),p=r.x-u,_=new mr(a,u,a,Math.floor(p*h),Math.floor(r.y*h)),g=this.findDEMTileFor(_);if(!g||!g.dem)return e;const v=g.dem,b=1<<g.tileID.canonical.z,w=(p*b-g.tileID.canonical.x)*v.dim,I=(r.y*b-g.tileID.canonical.y)*v.dim,A=Math.floor(w),P=Math.floor(I);return(i?this.exaggeration():1)*pt(pt(v.get(A,P),v.get(A,P+1),I-P),pt(v.get(A+1,P),v.get(A+1,P+1),I-P),w-A)}getAtTileOffset(r,e,i){const s=1<<r.canonical.z;return this.getAtPointOrZero(new J(r.wrap+(r.canonical.x+e/We)/s,(r.canonical.y+i/We)/s))}getAtTileOffsetFunc(r,e,i,s){return a=>{const h=this.getAtTileOffset(r,a.x,a.y),u=s.upVector(r.canonical,a.x,a.y);return Fi(u,u,h*s.upVectorScale(r.canonical,e,i).metersToTile),u}}getForTilePoints(r,e,i,s){if(this.isUsingMockSource())return!1;const a=sh.create(this,r,s);return!!a&&(e.forEach((h=>{h[2]=this.exaggeration()*a.getElevationAt(h[0],h[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,s=e.tileID,a=1<<r.canonical.z-s.canonical.z;let h=r.canonical.x/a-s.canonical.x,u=r.canonical.y/a-s.canonical.y,p=0;for(let _=0;_<r.canonical.z-s.canonical.z&&!i.leaves[p];_++){h*=2,u*=2;const g=2*Math.floor(u)+Math.floor(h);p=i.childOffsets[p]+g,h%=1,u%=1}return{min:this.exaggeration()*i.minimums[p],max:this.exaggeration()*i.maximums[p]}}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,s=Number.MIN_VALUE;for(const a of r){const h=this.getMinMaxForTile(a.tileID);h&&(i=Math.min(i,h.min),s=Math.max(s,h.max),e=!0)}return e?{min:i,max:s}:null}},o.dG=A_,o.dH=yf,o.dI=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]},o.dJ=jl,o.dK=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},o.dL=zs,o.dM=f_,o.dN=rn,o.dO=kr,o.dP=256,o.dQ=function(r,e){const i=[0,0,0];return tr(i,i,bf(no(e.canonical))),tr(i,i,r),i},o.dR=r=>({u_matrix:new Rl(r),u_texsize:new rs(r),u_pixels_to_tile_units:new Eu(r),u_device_pixel_ratio:new sr(r),u_width_scale:new sr(r),u_floor_width_scale:new sr(r),u_image:new $c(r),u_units_to_pixels:new rs(r),u_tile_units_to_pixels:new sr(r),u_alpha_discard_threshold:new sr(r),u_trim_offset:new rs(r),u_trim_fade_range:new rs(r),u_trim_color:new zl(r),u_emissive_strength:new sr(r),u_zbias_factor:new sr(r),u_tile_to_meter:new sr(r),u_ground_shadow_factor:new Ta(r),u_pattern_transition:new sr(r)}),o.dS=r=>({u_matrix:new Rl(r),u_pixels_to_tile_units:new Eu(r),u_device_pixel_ratio:new sr(r),u_width_scale:new sr(r),u_floor_width_scale:new sr(r),u_units_to_pixels:new rs(r),u_dash_image:new $c(r),u_gradient_image:new $c(r),u_image_height:new sr(r),u_texsize:new rs(r),u_tile_units_to_pixels:new sr(r),u_alpha_discard_threshold:new sr(r),u_trim_offset:new rs(r),u_trim_fade_range:new rs(r),u_trim_color:new zl(r),u_emissive_strength:new sr(r),u_zbias_factor:new sr(r),u_tile_to_meter:new sr(r),u_ground_shadow_factor:new Ta(r)}),o.dT=r=>({u_camera_to_center_distance:new sr(r),u_extrude_scale:new Eu(r),u_device_pixel_ratio:new sr(r),u_matrix:new Rl(r),u_inv_rot_matrix:new Rl(r),u_merc_center:new rs(r),u_tile_id:new Ta(r),u_zoom_transition:new sr(r),u_up_dir:new Ta(r),u_emissive_strength:new sr(r)}),o.dU=xa,o.dV=k0,o.dW=g_,o.dX=(r,e,i,s,a,h)=>{const u=r.transform,p=u.projection.name==="globe";let _;if(h.paint.get("circle-pitch-alignment")==="map")if(p){const v=f_(u.zoom,e.canonical)*u._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=u.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([u.pixelsToGLUnits[0],0,0,u.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(u.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,h.paint.get("circle-translate"),h.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Hn.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:av,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:h.paint.get("circle-emissive-strength")};if(p){g.u_inv_rot_matrix=s,g.u_merc_center=a,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=Aa(u.zoom);const v=a[0]*We,b=a[1]*We;g.u_up_dir=u.projection.upVector(new Pn(0,0,0),v,b)}return g},o.dY=Xg,o.dZ=sn,o.d_=(r,e,i,s,a,h,u,p,_,g)=>{const v=r.transform,b=v.pitch<15?$g(.07,.7,W((14-v.zoom)/5,0,1)):.07,w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:Wg(r,e,i,s),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:h,u_floor_width_scale:u,u_image:0,u_tile_units_to_pixels:Zg(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:p,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:b,u_tile_to_meter:K(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:g}},o.da=function(r,e){return r.readFields(R1,{icons:[]},e)},o.db=zf,o.dc=ih,o.dd=Om,o.de=Xl,o.df=Xd,o.dg=On,o.dh=Wo,o.di=Ft,o.dj=function(r){const e=r.indexOf(El);return e>=0?r.slice(0,e):r},o.dk=function(r){return r.indexOf(El)>=0},o.dl=function(r){const e=r.lastIndexOf(El);return e>=0?r.slice(e+1):""},o.dm=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},o.dn=function(r,e,i,s){return r.type==="custom"?new I1(r,e):new P1[r.type](r,e,i,s)},o.dp=Ut,o.dq=function(r){const e=r.indexOf(El);return e>=0?r.slice(e+1):""},o.dr=class extends ch{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}},o.ds=iu,o.dt=$o,o.du=function(r){return r({pluginStatus:Wr,pluginURL:Js}),iu.on("pluginStateChange",r),r},o.dv=Su,o.dw=class extends Un{constructor(r){super(r),this.current=jp}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let s=0;s<9;s++)if(i[s]!==this.current[s]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},o.dx=B,o.dy=function(r,e,i){const s=Aa(i.zoom),a=r.style.map._antialias,h=r.terrain&&r.terrain.exaggeration()>0;return s===0&&!a&&!h},o.dz=function(r){const e=r.pixelsPerMeter,i=e/L(1,r.center.lat),s=Bt(new Float64Array(16));return qr(s,s,[r.point.x,r.point.y,0]),Fr(s,s,[i,i,e]),Float32Array.from(s)},o.e=Ar,o.e$=ru,o.e0=ft,o.e1=Mu,o.e2=q,o.e3=Lo,o.e4=Cf,o.e5=ag,o.e6=Ca,o.e7=450,o.e8=7,o.e9=ie,o.eA=function(r,e,i,s,a,h,u,p,_,g,v,b,w,I,A,P){var R=new $i(16);return R[0]=r,R[1]=e,R[2]=i,R[3]=s,R[4]=a,R[5]=h,R[6]=u,R[7]=p,R[8]=_,R[9]=g,R[10]=v,R[11]=b,R[12]=w,R[13]=I,R[14]=A,R[15]=P,R},o.eB=x,o.eC=mu,o.eD=Al,o.eE=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=Z_(new ke(0,0),new ke(We,We),r),s=[];if(e&&!om(i,this._globalClipBounds))return s;for(const a of this._activeRegions){if(a.hiddenByOverlap||!om(i,a))continue;const h=Fv(a.min,a.max,r);s.push({min:h.min,max:h.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return s}setSources(r){this._setSources(r.map((e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const s of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(s).buckets[e.layer];a&&a.updateFootprints(s.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(),s=r.getClipMask(),a=r.getClipScope();for(const h of e){if(!h.footprint)continue;const u=Z_(h.footprint.min,h.footprint.max,h.id);this._activeRegions.push({min:u.min,max:u.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:h.id,footprint:h.footprint,order:i,clipMask:s,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort(((e,i)=>e.priority-i.priority||If(e.min,i.min)||If(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(function(s,a){const h=(u,p)=>u+p;return s.length-a.length||s.reduce(h,"").localeCompare(a.reduce(h,""))})(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],s=this._prevRegions[e];r=i.priority!==s.priority||!$_(i,s)||i.order!==s.order||i.clipMask!==s.clipMask||!ms(i.clipScope,s.clipScope),++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==Lu&&(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 s=this._activeRegions;if(i>=s.length)return i;const a=s[i].priority;for(;i<s.length&&s[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,s=e(i);for(;i!==s;){let a=i;const h=i;for(;a!==s;){const u=this._activeRegions[a];u.hiddenByOverlap=!1;for(let p=0;p<h;p++){const _=this._activeRegions[p];if(!_.hiddenByOverlap&&u.order===Lu&&om(u,_)&&(u.hiddenByOverlap=W_(u.footprint,u.tileId,_.footprint,_.tileId),u.hiddenByOverlap))break}++a}i=s,s=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()}},o.eF=Lu,o.eG=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 ln,s=new Li,a=[],h=r+1+2,u=e[0]+1,p=e[0]+1+(1+e.length),_=(g,v,b)=>{let w=g===h-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,v]};for(let g=0;g<h;++g)i.emplaceBack(..._(g,0,!0));for(let g=0;g<u;++g)for(let v=0;v<h;++v)i.emplaceBack(..._(v,g,(v===0||v===h-1)&&!0));for(let g=0;g<e.length;++g){const v=e[g];for(let b=0;b<h;++b)i.emplaceBack(..._(b,v,!0))}for(let g=0;g<e.length;++g){const v=s.length,b=e[g]+1+2,w=new Li;for(let P=0;P<b-1;P++){const R=P===b-2,O=R?h*(p-e.length+g-P):h;for(let U=0;U<h-1;U++){const V=P*h+U;P===0||R||U===0||U===h-2?(w.emplaceBack(V+1,V,V+O),w.emplaceBack(V+O,V+O+1,V+1)):(s.emplaceBack(V+1,V,V+O),s.emplaceBack(V+O,V+O+1,V+1))}}const I=Ni.simpleSegment(0,v,i.length,s.length-v);for(let P=0;P<w.uint16.length;P+=3)s.emplaceBack(w.uint16[P],w.uint16[P+1],w.uint16[P+2]);const A=Ni.simpleSegment(0,v,i.length,s.length-v);a.push({withoutSkirts:I,withSkirts:A})}return{vertices:i,indices:s,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(n,c);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,l_.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Li;for(let u=0;u<=n;u++)e.emplaceBack(0,u+1,u+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new Ro,s=new Ro,a=new Ro,h=new Ro;this._poleSegments=[];for(let u=0,p=0;u<_f;u++){const _=360/(1<<u);i.emplaceBack(0,-Ur,0,.5,0),s.emplaceBack(0,-Ur,0,.5,1),a.emplaceBack(0,-Ur,0,.5,.5),h.emplaceBack(0,-Ur,0,.5,.5);for(let g=0;g<=n;g++){let v=g/n,b=0;const w=pt(0,_,v),[I,A,P]=m(sv,ov,w,Ur);i.emplaceBack(I,A,P,v,b),s.emplaceBack(I,A,P,v,1-b);const R=ei(w);v=.5+.5*Math.sin(R),b=.5+.5*Math.cos(R),a.emplaceBack(I,A,P,v,b),h.emplaceBack(I,A,P,v,1-b)}this._poleSegments.push(Ni.simpleSegment(p,0,66,64)),p+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,gf,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(s,gf,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,gf,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(h,gf,!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]]}},o.eH=q_,o.eI=Z,o.eJ=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},o.eK=ne,o.eL=Y,o.eM=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},o.eN=en,o.eO=y,o.eP=ql,o.eQ=nr,o.eR=function([r,e,i]){const s=Math.hypot(r,e,i),a=Math.atan2(r,i),h=.5*Math.PI-Math.acos(-e/s);return new S(ge(a),ge(h))},o.eS=gn,o.eT=bm,o.eU=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!(function(i){if(Xi==null){const s=i.navigator?i.navigator.userAgent:null;Xi=!!i.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Xi})(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/)))},o.eV=function(r,e){$n=r,gs=e},o.eW=Kp,o.eX=m_,o.eY=function(r){const e=[0,0,0],i=Bt(new Float64Array(16));return Gi(i,r.pixelMatrix,r.globeMatrix),tr(e,e,i),new ke(e[0],e[1])},o.eZ=function(){const r=Vu;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(fm),Vu=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()"))},o.e_=function(){zf().acquire(fm)},o.ea=function(r,e){if(r===e){var i=e[1],s=e[2],a=e[3],h=e[6],u=e[7],p=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]=s,r[9]=h,r[11]=e[14],r[12]=a,r[13]=u,r[14]=p}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},o.eb=E1,o.ec=$t,o.ed=yu,o.ee=256,o.ef=Xp,o.eg=En,o.eh=ls,o.ei=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},o.ej=Ro,o.ek=pu,o.el=Nd,o.em=function(r,e,i,s,a){return W((r-e)/(i-e)*(a-s)+s,s,a)},o.en=Vo,o.eo=function(r,e){var i=e[0],s=e[1],a=e[2],h=e[3],u=e[4],p=e[5],_=e[6],g=e[7],v=e[8],b=v*u-p*g,w=-v*h+p*_,I=g*h-u*_,A=i*b+s*w+a*I;return A?(r[0]=b*(A=1/A),r[1]=(-v*s+a*g)*A,r[2]=(p*s-a*u)*A,r[3]=w*A,r[4]=(v*i-a*_)*A,r[5]=(-p*i+a*h)*A,r[6]=I*A,r[7]=(-g*i+s*_)*A,r[8]=(u*i-s*h)*A,r):null},o.ep=2,o.eq=Ps,o.er=wm,o.es=[1,1,1],o.et=class{constructor(r,e,i,s){this.context=r,this.format=s,this.size=i,this.texture=r.gl.createTexture();const[a,h,u]=this.size,{gl:p}=r;p.bindTexture(p.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),p.texImage3D(p.TEXTURE_3D,0,this.format,a,h,u,0,ym(this.format),xm(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:s}=i;s.bindTexture(s.TEXTURE_3D,this.texture),r!==this.minFilter&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MAG_FILTER,r),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},o.eu=sh,o.ev=Na,o.ew=function(r,e,i,s){var a=e[0],h=e[1],u=e[2],p=e[3];return r[0]=a+s*(i[0]-a),r[1]=h+s*(i[1]-h),r[2]=u+s*(i[2]-u),r[3]=p+s*(i[3]-p),r},o.ex=Qc,o.ey=is,o.ez=io,o.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,((e,i)=>String.fromCharCode(+("0x"+i)))))},o.f0=function(r,e,i=!1){if(Wr===fn.deferred||Wr===fn.loading||Wr===fn.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Js=Hn.resolveURL(r),Wr=fn.deferred,eu=e,tu(),i||Yd()},o.f1=function(r){Yc=Hn.resolveURL(r),Kc||(Kc=new Xc(zf(),new xo)),Kc.broadcast("setMeshoptUrl",Yc)},o.f2=vg,o.f3=function(r){mm=Hn.resolveURL(r),Kc||(Kc=new Xc(zf(),new xo)),Kc.broadcast("setDracoUrl",mm)},o.f4=xg,o.f5=Nu,o.f6=function(r){const e=mo();if(!e)return;const i=e.delete(_s);r&&i.then((()=>
14r())).catch(r)},o.f7=kl,o.f8=rt,o.f9=Ma,o.fa=Ss,o.fb=Gx,o.fc=qx,o.fd=jg,o.fe=Qe,o.ff="hd_road_elevation",o.fg=Vi,o.fh=St,o.fi=Fl,o.fj=Fm,o.fk=Vl,o.fl=function(r,e,i,s,a,h,u,p=1,_,g,v){r.createArrays(),r.tilePixelRatio=We/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const b=r.layers[0].layout,w=r.layers[0]._unevaluatedLayout._values,I={};I.scaleFactor=p,I.textSizeScaleRange=b.get("text-size-scale-range"),I.iconSizeScaleRange=b.get("icon-size-scale-range");const[A,P]=I.textSizeScaleRange,[R,O]=I.iconSizeScaleRange;I.textScaleFactor=W(I.scaleFactor,A,P),I.iconScaleFactor=W(I.scaleFactor,R,O);const U=w["text-size"],V=w["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:ce,maxZoom:Ee}=r.textSizeData;I.compositeTextSizes=[U.possiblyEvaluate(new pi(ce,{worldview:v}),h),U.possiblyEvaluate(new pi(Ee,{worldview:v}),h)]}if(r.iconSizeData.kind==="composite"){const{minZoom:ce,maxZoom:Ee}=r.iconSizeData;I.compositeIconSizes=[V.possiblyEvaluate(new pi(ce,{worldview:v}),h),V.possiblyEvaluate(new pi(Ee,{worldview:v}),h)]}I.layoutTextSize=U.possiblyEvaluate(new pi(u+1,{worldview:v}),h),I.layoutIconSize=V.possiblyEvaluate(new pi(u+1,{worldview:v}),h),I.textMaxSize=U.possiblyEvaluate(new pi(18,{worldview:v}),h);const G=b.get("symbol-placement"),re=b.get("text-rotation-alignment")==="map"&&G!=="point",Q=b.get("text-size");let te=!1;const ae=[];for(const ce of r.features){const Ee=b.get("text-font").evaluate(ce,{},h).join(","),de=Q.evaluate(ce,{},h)*I.textScaleFactor,Ae=I.layoutTextSize.evaluate(ce,{},h)*I.textScaleFactor,je=I.layoutIconSize.evaluate(ce,{},h)*I.iconScaleFactor,Ce={horizontal:{},vertical:void 0},Fe=ce.text;let Ve,Te=[0,0];if(Fe){const tt=Fe.toString(),_t=b.get("text-letter-spacing").evaluate(ce,{},h)*Ir,Tt=b.get("text-line-height").evaluate(ce,{},h)*Ir,Mt=zp(tt)?_t:0,It=b.get("text-anchor").evaluate(ce,{},h),qt=b.get("text-variable-anchor");if(!qt){const be=b.get("text-radial-offset").evaluate(ce,{},h);if(be)Te=Ay(It,[be*Ir,km]);else{const $e=b.get("text-offset").evaluate(ce,{},h);Te=[$e[0]*Ir,$e[1]*Ir]}}let Lt=re?"center":b.get("text-justify").evaluate(ce,{},h);const Ii=G==="point",H=Ii?b.get("text-max-width").evaluate(ce,{},h)*Ir:1/0,$=be=>{r.allowVerticalPlacement&&Qh(tt)&&(Ce.vertical=Rm(Fe,e,i,a,Ee,H,Tt,It,be,Mt,Te,Dn.vertical,!0,Ae,de,_))};if(!re&&qt){const be=Lt==="auto"?qt.map((Ke=>Bm(Ke))):[Lt];let $e=!1;for(let Ke=0;Ke<be.length;Ke++){const Ye=be[Ke];if(!Ce.horizontal[Ye])if($e)Ce.horizontal[Ye]=Ce.horizontal[0];else{const st=Rm(Fe,e,i,a,Ee,H,Tt,"center",Ye,Mt,Te,Dn.horizontal,!1,Ae,de,_);st&&(Ce.horizontal[Ye]=st,$e=st.positionedLines.length===1)}}$("left")}else{if(Lt==="auto"&&(Lt=Bm(It)),Ii||b.get("text-writing-mode").indexOf("horizontal")>=0||!Qh(tt)){const be=Rm(Fe,e,i,a,Ee,H,Tt,It,Lt,Mt,Te,Dn.horizontal,!1,Ae,de,_);be&&(Ce.horizontal[Lt]=be)}$(Ii?"left":Lt)}}let Oe,fe,Se,He,Be,ct,nt=!1;const De=b.get("icon-text-fit").evaluate(ce,{},h);if(ce.icon&&ce.icon.hasPrimary()){const tt=Cy(ce.icon,r.iconSizeData,w["icon-size"],h,r.zoom,ce,_,I.iconScaleFactor,v);Oe=tt.iconPrimary,Se=tt.iconSecondary;const _t=Oe.toString();if(fe=s.get(_t),fe&&(Be=b.get("icon-offset").evaluate(ce,{},h),ct=b.get("icon-anchor").evaluate(ce,{},h),Ve=t1(a.get(_t),Se?a.get(Se.toString()):void 0,Be,ct),nt=fe.sdf,r.sdfIcons===void 0?r.sdfIcons=fe.sdf:r.sdfIcons!==fe.sdf&&Gt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(fe.pixelRatio!==r.pixelRatio||b.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Se){const Tt=Se.toString();He=s.get(Tt)}}te=te||!(!ce.icon||!ce.icon.hasSecondary());const Ne=Nm(Ce.horizontal)||Ce.vertical;r.iconsInText||(r.iconsInText=!!Ne&&Ne.iconsInText);const ot=Ae*I.textScaleFactor/Ir,{defaultShapedIcon:et,verticallyShapedIcon:Xe}=u1(r,Ve,b,ce,h,Ce,ot,Be,De);De!=="none"&&Ve&&(uy(Ve)||dy(Ve))&&(Gf(0,fe,Oe,Ve,et,De,g,s,a),Gf(0,He,Se,Ve,et,De,g,s,a),Xe&&(Gf(0,fe,Oe,Ve,Xe,De,g,s,a),Gf(0,He,Se,Ve,Xe,De,g,s,a))),Ve=et,ae.push({feature:ce,shapedTextOrientations:Ce,shapedText:Ne,shapedIcon:Ve,iconPrimary:Oe,iconSecondary:Se,iconOffset:Be,iconAnchor:ct,verticallyShapedIcon:Xe,layoutTextSize:Ae,layoutIconSize:je,textOffset:Te,isSDFIcon:nt,iconTextFit:De})}return{featureData:ae,sizes:I,hasAnySecondaryIcon:te,textAlongLine:re,symbolPlacement:G}},o.fm=by,o.fn=function(r,e,i,s,a,h,u,p,_,g){const{featureData:v,hasAnySecondaryIcon:b,sizes:w,textAlongLine:I,symbolPlacement:A}=e;for(const P of v){const{shapedIcon:R,verticallyShapedIcon:O,feature:U,shapedTextOrientations:V,shapedText:G,layoutTextSize:re,textOffset:Q,isSDFIcon:te,iconPrimary:ae,iconSecondary:ce,iconTextFit:Ee,iconOffset:de}=P;Py(R,g.iconPositions,ae,ce),Py(O,g.iconPositions,ae,ce),h1(V,g.iconPositions),c1(ae,ce,g.iconPositions),(G||R)&&d1(r,U,V,R,O,_,w,re,0,Q,te,s,a,u,p,b,Ee,de,I,A)}i&&r.generateCollisionDebugBuffers(h,r.collisionBoxArray,w.textScaleFactor)},o.fo=at,o.fp=cp,o.fq=_e,o.fr=function(r){let e=0;
14if(new Uint32Array(r,0,1)[0]!==wg){const i=new Uint32Array(r,0,7),[,,s,a,h,u]=i;e=i.byteLength+a+h+u+h,(s!==r.byteLength||e>=r.byteLength)&&Gt("Invalid b3dm header information.")}return Ig(r,e)},o.fs=function(r,e){const i=Lg(r);for(const s of i){for(const a of s.meshes)d0(a);s.lights&&(s.lightMeshIndex=s.meshes.length,s.meshes.push(f0(s.lights,e)))}return i},o.ft=rp,o.fu=gi,o.fv=gg,o.fw=es,o.fx=fn,o.fy=function(r){qo(),Jn!=null&&Jn.then((e=>{e.keys().then((i=>{for(let s=0;s<i.length-r;s++)e.delete(i[s]).catch((a=>Gt(a.message)))})).catch((i=>Gt(i.message)))})).catch((e=>Gt(e.message)))},o.g=function(r,e){return $o(ye(r,{method:"GET"}),e)},o.h=ye,o.i=function(r){return Ar.API_STYLE_REGEX.test(r)&&!Hl(r)},o.j=function(r){return r.indexOf("mapbox:")===0},o.k=ks,o.l=ph,o.m=function(r){return decodeURIComponent(atob(r).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""))},o.n=function(r,e){return $o(ye(r,{type:"json"}),e)},o.o=tl,o.p=function(r,e){return $o(ye(r,{method:"POST"}),e)},o.q=Hn,o.r=Rr,o.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},o.t=Wl,o.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)})()},o.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)},o.w=Gt,o.x=function(){return pm||(pm=new kl),pm},o.y=e_,o.z=wn})),Oa(["./shared"],(function(o){function Gr(ge){const k=ge?ge.url.toString():void 0;return k?performance.getEntriesByName(k):[]}function $i(ge){if(typeof ge=="number"||typeof ge=="boolean"||typeof ge=="string"||ge==null)return JSON.stringify(ge);if(Array.isArray(ge)){let B="[";for(const Z of ge)B+=`${$i(Z)},`;return`${B}]`}let k="{";for(const B of Object.keys(ge).sort())k+=`${B}:${$i(ge[B])},`;return`${k}}`}function as(ge){let k="";for(const B of o.bu)k+=`/${$i(ge[B])}`;return k}class jl{constructor(k){this.keyCache={},this._layers={},this._layerConfigs={},k&&this.replace(k)}replace(k,B){this._layerConfigs={},this._layers={},this.update(k,[],B)}update(k,B,Z){this._options=Z;for(const W of k)this._layerConfigs[W.id]=W,(this._layers[W.id]=o.dn(W,this.scope,null,this._options)).compileFilter(Z),this.keyCache[W.id]&&delete this.keyCache[W.id];for(const W of B)delete this.keyCache[W],delete this._layerConfigs[W],delete this._layers[W];this.familiesBySource={};const ne=(function(W,le){const ve={};for(let ye=0;ye<W.length;ye++){const qe=W[ye];let Pe=le&&le[qe.id];Pe||(qe.type==="symbol"?Pe=qe.id:(Pe=as(qe),qe.type==="line"&&qe.paint&&(function bt(St){return typeof St=="string"&&St==="line-progress"||(Array.isArray(St)?St.some(bt):!(!St||typeof St!="object")&&Object.values(St).some(bt))})(qe.paint["line-width"])&&(Pe+=`/${$i(qe.paint["line-width"])}`))),le&&(le[qe.id]=Pe);let ft=ve[Pe];ft||(ft=ve[Pe]=[]),ft.push(qe)}const he=[];for(const ye in ve)he.push(ve[ye]);return he})(Object.values(this._layerConfigs),this.keyCache);for(const W of ne){const le=W.map((ft=>this._layers[ft.id])),ve=le[0];if(ve.visibility==="none")continue;const he=ve.source||"";let ye=this.familiesBySource[he];ye||(ye=this.familiesBySource[he]={});const qe=ve.sourceLayer||"_geojsonTileLayer";let Pe=ye[qe];Pe||(Pe=ye[qe]=[]),Pe.push(le)}}}const ho=1*o.fa;class Kn{constructor(k){const B={},Z=[];for(const ve in k){const he=k[ve],ye=B[ve]={};for(const qe in he.glyphs){const Pe=he.glyphs[+qe];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const ft=Pe.metrics.localGlyph?ho:1,bt={x:0,y:0,w:Pe.bitmap.width+2*ft,h:Pe.bitmap.height+2*ft};Z.push(bt),ye[qe]=bt}}const{w:ne,h:W}=o.H(Z),le=new o.f9({width:ne||1,height:W||1});for(const ve in k){const he=k[ve];for(const ye in he.glyphs){const qe=he.glyphs[+ye];if(!qe||qe.bitmap.width===0||qe.bitmap.height===0)continue;const Pe=B[ve][ye],ft=qe.metrics.localGlyph?ho:1;o.f9.copy(qe.bitmap,le,{x:0,y:0},{x:Pe.x+ft,y:Pe.y+ft},qe.bitmap)}}this.image=le,this.positions=B}}o.f8(Kn,"GlyphAtlas");class uo{constructor(k){this.tileID=new o.aM(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.tileZoom=k.tileZoom,this.uid=k.uid,this.zoom=k.zoom,this.lut=k.lut,this.canonical=k.tileID.canonical,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.scope=k.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.request&&k.request.collectResourceTiming,this.promoteId=k.promoteId,this.isSymbolTile=k.isSymbolTile,this.tileTransform=o.aW(k.tileID.canonical,k.projection),this.projection=k.projection,this.worldview=k.worldview,this.localizableLayerIds=k.localizableLayerIds,this.brightness=k.brightness,this.extraShadowCaster=!!k.extraShadowCaster,this.tessellationStep=k.tessellationStep,this.scaleFactor=k.scaleFactor,this.worldview=k.worldview}parse(k,B,Z,ne,W,le){this.status="parsing",this.data=k,this.collisionBoxArray=new o.b0;const ve=new o.fb(Object.keys(k.layers).sort()),he=new o.fc(this.tileID,this.promoteId);he.bucketLayerIDs=[];const ye={},qe=new o.fd(256,256),Pe={featureIndex:he,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:qe,availableImages:Z,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},ft=[],bt=B.familiesBySource[this.source];for(const Ut in bt){const Ft=k.layers[Ut];if(!Ft)continue;let jt=!1,bi=!1,Gt=!1;for(const gi of bt[Ut])gi[0].type==="symbol"?jt=!0:bi=!0,gi[0].is3D()&&gi[0].type!=="model"&&(Gt=!0);if(this.extraShadowCaster&&!Gt||this.isSymbolTile===!0&&!jt||this.isSymbolTile===!1&&!bi)continue;Ft.version===1&&o.w(`Vector tile source "${this.source}" layer "${Ut}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ki=ve.encode(Ut),yr=[];let dr=!1;for(let gi=0,ri=0;gi<Ft.length;gi++){const Xi=Ft.feature(gi),qi=he.getId(Xi,Ut);if(this.localizableLayerIds&&this.localizableLayerIds.has(Ut)){const Bi=Xi.properties?Xi.properties.worldview:null;if(this.worldview&&typeof Bi=="string")if(Bi==="all")Xi.properties.$localized=!0;else{if(!Bi.split(",").includes(this.worldview))continue;Xi.properties.$localized=!0,Xi.properties.worldview=this.worldview}}!dr&&Xi.properties&&Xi.properties.hasOwnProperty(o.fe)&&(dr=!0),yr.push({feature:Xi,id:qi,index:ri,sourceLayerIndex:Ki}),ri++}dr&&!Pe.elevationFeatures&&k.layers.hasOwnProperty(o.ff)&&(Pe.elevationFeatures=o.fg.parseFrom(k.layers[o.ff],this.canonical));for(const gi of bt[Ut]){const ri=gi[0];if(this.extraShadowCaster&&(!ri.is3D()||ri.type==="model")||this.isSymbolTile!==void 0&&ri.type==="symbol"!==this.isSymbolTile||ri.minzoom&&this.zoom<Math.floor(ri.minzoom)||ri.maxzoom&&this.zoom>=ri.maxzoom||ri.visibility==="none")continue;Bt(gi,this.zoom,Pe.brightness,Z,this.worldview);const Xi=ye[ri.id]=ri.createBucket({index:he.bucketLayerIDs.length,layers:gi,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ki,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:ne,worldview:this.worldview});he.bucketLayerIDs.push(gi.map((Bi=>o.C(Bi.id,Bi.scope))));let qi=Xi.prepare?Xi.prepare():null;qi!=null?(qi=qi.then((()=>Xi.populate(yr,Pe,this.tileID.canonical,this.tileTransform))),ft.push(qi)):Xi.populate(yr,Pe,this.tileID.canonical,this.tileTransform)}}const St=()=>{let Ut,Ft,jt,bi,Gt,Ki;qe.trim();const yr={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},dr=()=>{if(Ut)return this.status="done",le(Ut);if(this.extraShadowCaster)this.status="done",le(null,{buckets:Object.values(ye).filter((ri=>!ri.isEmpty())),featureIndex:he,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Pe.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Ft&&jt&&bi){const ri=new Kn(Ft),Xi=new Map;for(const[wr,rn]of jt.entries()){const{imagePosition:kr}=o.fj(wr,rn,o.fk);Xi.set(wr,kr)}const qi={};for(const wr in ye){const rn=ye[wr];rn instanceof o.b1&&(Bt(rn.layers,this.zoom,Pe.brightness,Z,this.worldview),qi[wr]=o.fl(rn,Ft,ri.positions,jt,Xi,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Gt,this.worldview))}const Bi={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(W,jt,Gt,(()=>{Bi.iconsPending=!1,gi(qi,ri,Bi)})),this.rasterizeIfNeeded(W,bi,Ki,(()=>{Bi.patternsPending=!1,gi(qi,ri,Bi)}))}},gi=(ri,Xi,qi,Bi)=>{if(qi.iconsPending||qi.patternsPending)return;const wr=new o.fm(jt,bi,this.lut);for(const rn in ye){const kr=ye[rn];if(rn in ri)o.fn(kr,ri[rn],this.showCollisionBoxes,Z,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,jt,wr);else if(kr.hasPattern&&(kr instanceof o.b7||kr instanceof o.b8||kr instanceof o.e4)){Bt(kr.layers,this.zoom,Pe.brightness,Z,this.worldview);const Ha=Object.fromEntries(wr.patternPositions);kr.addFeatures(Pe,this.tileID.canonical,Ha,Z,this.tileTransform,this.brightness)}}this.status="done",le(null,{buckets:Object.values(ye).filter((rn=>!rn.isEmpty())),featureIndex:he,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Xi.image,lineAtlas:qe,imageAtlas:wr,brightness:Pe.brightness})};if(!this.extraShadowCaster){const ri=o.fh(Pe.glyphDependencies,(Bi=>Object.keys(Bi).map(Number)));Object.keys(ri).length?W.send("getGlyphs",{uid:this.uid,stacks:ri},((Bi,wr)=>{Ut||(Ut=Bi,Ft=wr,dr())}),void 0,!1,yr):Ft={};const Xi=Array.from(Pe.iconDependencies.keys()).map((Bi=>o.I.parse(Bi)));Xi.length?W.send("getImages",{images:Xi,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},((Bi,wr)=>
14{Ut||(Ut=Bi,jt=new Map,Gt=this.updateImageMapAndGetImageTaskQueue(jt,wr,Pe.iconDependencies),dr())}),void 0,!1,yr):(jt=new Map,Gt=new Map);const qi=Array.from(Pe.patternDependencies.keys()).map((Bi=>o.I.parse(Bi)));qi.length?W.send("getImages",{images:qi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},((Bi,wr)=>{Ut||(Ut=Bi,bi=new Map,Ki=this.updateImageMapAndGetImageTaskQueue(bi,wr,Pe.patternDependencies),dr())}),void 0,!1,yr):(bi=new Map,Ki=new Map)}if(Pe.elevationFeatures&&Pe.elevationFeatures.length>0){const ri=[];for(const qi of Object.values(ye))if(qi instanceof o.b8){const Bi=qi.getUnevaluatedPortalGraph();Bi&&ri.push(Bi)}const Xi=o.fi.evaluate(ri);for(const qi of Object.values(ye))if(qi instanceof o.b8){const Bi=k.layers[ve.decode(qi.sourceLayerIndex)];qi.setEvaluatedPortalGraph(Xi,Bi,this.tileID.canonical,Pe.availableImages,Pe.brightness)}}dr()};ft.length>0?Promise.allSettled(ft).then(St).catch(le):St()}rasterizeIfNeeded(k,B,Z,ne){Array.from(B.values()).some((W=>W.usvg))?this.rasterize(k,B,Z,ne):ne()}updateImageMapAndGetImageTaskQueue(k,B,Z){const ne=new Map;for(const W of B.keys()){const le=Z.get(W)||[];for(const ve of le){const he=ve.toString(),ye=B.get(ve.id.toString());ye.usvg?ne.has(he)||(ne.set(he,ve),k.set(he,Object.assign({},ye))):k.set(he,ye)}}return ne}rasterize(k,B,Z,ne){this.rasterizeTask=k.send("rasterizeImages",{scope:this.scope,tasks:Z},((W,le)=>{if(!W)for(const[ve,he]of le.entries()){const ye=Object.assign(B.get(ve),{data:he});B.set(ve,ye)}ne()}))}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Bt(ge,k,B,Z,ne){const W=new o.aa(k,{brightness:B,worldview:ne});for(const le of ge)le.recalculate(W,Z)}class Jr extends o.E{constructor(k,B,Z,ne,W,le,ve){super(),this.actor=k,this.layerIndex=B,this.availableImages=Z,this.availableModels=ne,this.loadVectorData=le||o.aJ,this.loading={},this.loaded={},this.deduped=new o.aI(k.scheduler),this.isSpriteLoaded=W,this.scheduler=k.scheduler,this.brightness=ve}loadTile(k,B){const Z=k.uid,ne=k&&k.request,W=ne&&ne.collectResourceTiming,le=this.loading[Z]=new uo(k);le.abort=this.loadVectorData(k,((ve,he)=>{const ye=!this.loading[Z];if(delete this.loading[Z],le.cancelRasterize(),ye||ve||!he)return le.status="done",ye||(this.loaded[Z]=le),B(ve);const qe=he.rawData,Pe={};he.expires&&(Pe.expires=he.expires),he.cacheControl&&(Pe.cacheControl=he.cacheControl),le.vectorTile=he.vectorTile||new o.fo(new o.bq(qe));const ft=()=>{le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,((bt,St)=>{if(bt||!St)return B(bt);const Ut={};if(W){const Ft=Gr(ne);Ft.length>0&&(Ut.resourceTiming=JSON.parse(JSON.stringify(Ft)))}B(null,o.h({rawTileData:qe.slice(0)},St,Pe,Ut))}))};this.isSpriteLoaded?ft():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(ft,{type:"parseTile",isSymbolTile:k.isSymbolTile,zoom:k.tileZoom}):ft()})),this.loaded=this.loaded||{},this.loaded[Z]=le}))}reloadTile(k,B){const Z=this.loaded,ne=k.uid;if(Z&&Z[ne]){const W=Z[ne];W.scaleFactor=k.scaleFactor,W.showCollisionBoxes=k.showCollisionBoxes,W.projection=k.projection,W.brightness=k.brightness,W.tileTransform=o.aW(k.tileID.canonical,k.projection),W.extraShadowCaster=k.extraShadowCaster,W.lut=k.lut,W.worldview=k.worldview;const le=(ve,he)=>{const ye=W.reloadCallback;ye&&(delete W.reloadCallback,W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ye)),B(ve,he)};W.status==="parsing"?W.reloadCallback=le:W.status==="done"&&(W.vectorTile?W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,le):le())}else B(null,void 0)}abortTile(k,B){const Z=k.uid,ne=this.loading[Z];ne&&(ne.abort&&ne.abort(),delete this.loading[Z]),B()}removeTile(k,B){const Z=this.loaded,ne=k.uid;Z&&Z[ne]&&delete Z[ne],B()}}class Gi{loadTile(k,B){const{uid:Z,encoding:ne,rawImageData:W,padding:le}=k,ve=ImageBitmap&&W instanceof ImageBitmap?this.getImageData(W,le):W;B(null,new o.fp(Z,ve,ne,le<1))}reloadTile(k,B){B(null,null)}abortTile(k,B){B()}removeTile(k,B){B()}getImageData(k,B){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(k.width,k.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=k.width,this.offscreenCanvas.height=k.height,this.offscreenCanvasContext.drawImage(k,0,0,k.width,k.height);const Z=this.offscreenCanvasContext.getImageData(-B,-B,k.width+2*B,k.height+2*B);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Z}}o.bp.setPbf(o.bq);class qr{constructor(k){this._mrt=new o.bp(k.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=k.uid,this.tileID=k.tileID,this.source=k.source}
14parse(k,B){const Z=this._mrt;this.status="parsing",this._entireBuffer=k;try{Z.parseHeader(k),this._isHeaderLoaded=!0;const ne=[];for(const W in Z.layers){const le=Z.getLayer(W),ve=le.getDataRange(le.getBandList()),he=Z.createDecodingTask(ve),ye=k.slice(ve.firstByte,ve.lastByte+1),qe=o.bp.performDecoding(ye,he).then((Pe=>he.complete(null,Pe))).catch((Pe=>he.complete(Pe,null)));ne.push(qe)}Promise.allSettled(ne).then((()=>B(null,Z))).catch((W=>B(W)))}catch(ne){B(ne)}}}class Fr{constructor(k){this.actor=k,this.loading={},this.loaded={}}loadTile(k,B){const Z=k.uid,ne=k.request,W=this.loading[Z]=new qr(k),{cancel:le}=o.br(ne,((ve,he,ye,qe)=>{const Pe=!this.loading[Z];if(delete this.loading[Z],Pe||ve||!he)return W.status="done",Pe||(this.loaded[Z]=W),B(ve);W.parse(he,((ft,bt)=>{if(ft||!bt)return B(ft);B(null,bt,ye,qe)})),this.loaded[Z]=W}));W.abort=le}reloadTile(k,B){B(null,void 0)}abortTile(k,B){const Z=k.uid,ne=this.loading[Z];ne&&(ne.abort&&ne.abort(),delete this.loading[Z]),B()}removeTile(k,B){const Z=k.uid;this.loaded[Z]&&delete this.loaded[Z],B()}decodeRasterArray(k,B){o.bp.performDecoding(k.buffer,k.task).then((Z=>B(null,Z))).catch((Z=>B(Z)))}}const As=o.fq.prototype.toGeoJSON;class ls{constructor(k){this._feature=k,this.extent=o.aj,this.type=k.type,this.properties=k.tags,"id"in k&&!isNaN(k.id)&&(this.id=parseInt(k.id,10))}loadGeometry(){if(this._feature.type===1){const k=[];for(const B of this._feature.geometry)k.push([new o.P(B[0],B[1])]);return k}{const k=[];for(const B of this._feature.geometry){const Z=[];for(const ne of B)Z.push(new o.P(ne[0],ne[1]));k.push(Z)}return k}}toGeoJSON(k,B,Z){return As.call(this,k,B,Z)}}class Ms{constructor(k,B){this.name=k,this.extent=o.aj,this.length=B.length,this._jsonFeatures=B}feature(k){return new ls(this._jsonFeatures[k])}}class ko{constructor(k){this.layers={},this.extent=o.aj;for(const B of Object.keys(k))this.layers[B]=new Ms(B,k[B])}}const qn=64/4096,Cs=128;class Gl{constructor(){this.features=new Map}clear(){this.features.clear()}load(k=[],B){for(const Z of k){const ne=Z.id;if(ne==null)continue;let W=this.features.get(ne);W&&this.updateCache(W,B),Z.geometry?(W=Bo(Z),this.updateCache(W,B),this.features.set(ne,W)):this.features.delete(ne),this.updateCache(W,B)}}updateCache(k,B){for(const{canonical:Z,uid:ne}of Object.values(B)){const{z:W,x:le,y:ve}=Z;ui(k,Math.pow(2,W),le,ve)&&delete B[ne]}}getTile(k,B,Z){const ne=Math.pow(2,k),W=[];for(const le of this.features.values())ui(le,ne,B,Z)&&W.push(ki(le,ne,B,Z));return{features:W}}getFeatures(){return[...this.features.values()]}}function ui({minX:ge,minY:k,maxX:B,maxY:Z},ne,W,le){return ge<(W+1+qn)/ne&&k<(le+1+qn)/ne&&B>(W-qn)/ne&&Z>(le-qn)/ne}function Bo(ge){const{id:k,geometry:B,properties:Z}=ge;if(!B)return;if(B.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:ne,coordinates:W}=B,le={id:k,type:1,geometry:[],tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},ve=le.geometry;if(ne==="Point")Cr(W,ve,le);else if(ne==="MultiPoint")for(const he of W)Cr(he,ve,le);else if(ne==="LineString")le.type=2,lr(W,ve,le);else if(ne==="MultiLineString")le.type=2,nr(W,ve,le);else if(ne==="Polygon")le.type=3,nr(W,ve,le,!0);else{if(ne!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");le.type=3;for(const he of W)nr(he,ve,le,!0)}return le}function Cr([ge,k],B,Z){const ne=o.aD(ge);let W=o.aH(k);W=W<0?0:W>1?1:W,B.push(ne,W),Z.minX=Math.min(Z.minX,ne),Z.minY=Math.min(Z.minY,W),Z.maxX=Math.max(Z.maxX,ne),Z.maxY=Math.max(Z.maxY,W)}function lr(ge,k,B,Z=!1,ne=!1){const W=[];for(const le of ge)Cr(le,W,B);k.push(W),Z&&(function(le,ve){let he=0;for(let ye=0,qe=le.length,Pe=qe-2;ye<qe;Pe=ye,ye+=2)he+=(le[ye]-le[Pe])*(le[ye+1]+le[Pe+1]);if(he>0===ve)for(let ye=0,qe=le.length;ye<qe/2;ye+=2){const Pe=le[ye],ft=le[ye+1];le[ye]=le[qe-2-ye],le[ye+1]=le[qe-1-ye],le[qe-2-ye]=Pe,le[qe-1-ye]=ft}})(W,ne)}function nr(ge,k,B,Z=!1){for(let ne=0;ne<ge.length;ne++)lr(ge[ne],k,B,Z,ne===0)}function ki(ge,k,B,Z){const{id:ne,type:W,geometry:le,tags:ve}=ge,he=[];if(W===1)(function(ye,qe,Pe,ft,bt){for(let St=0;St<ye.length;St+=2){const Ut=Math.round(o.aj*(ye[St+0]*qe-Pe)),Ft=Math.round(o.aj*(ye[St+1]*qe-ft));bt.push([Ut,Ft])}})(le,k,B,Z,he);else for(const ye of le)cn(ye,k,B,Z,he);return{id:ne,type:W,geometry:he,tags:ve}}function cn(ge,k,B,Z,ne){const W=-Cs,le=o.aj+Cs;let ve;
14for(let he=0;he<ge.length-2;he+=2){let ye=Math.round(o.aj*(ge[he+0]*k-B)),qe=Math.round(o.aj*(ge[he+1]*k-Z)),Pe=Math.round(o.aj*(ge[he+2]*k-B)),ft=Math.round(o.aj*(ge[he+3]*k-Z));const bt=Pe-ye,St=ft-qe;ye<W&&Pe<W||(ye<W?(qe+=Math.round(St*((W-ye)/bt)),ye=W):Pe<W&&(ft=qe+Math.round(St*((W-ye)/bt)),Pe=W),qe<W&&ft<W||(qe<W?(ye+=Math.round(bt*((W-qe)/St)),qe=W):ft<W&&(Pe=ye+Math.round(bt*((W-qe)/St)),ft=W),ye>=le&&Pe>=le||(ye>=le?(qe+=Math.round(St*((le-ye)/bt)),ye=le):Pe>=le&&(ft=qe+Math.round(St*((le-ye)/bt)),Pe=le),qe>=le&&ft>=le||(qe>=le?(ye+=Math.round(bt*((le-qe)/St)),qe=le):ft>=le&&(Pe=ye+Math.round(bt*((le-qe)/St)),ft=le),ve&&ye===ve[ve.length-1][0]&&qe===ve[ve.length-1][1]||(ve=[[ye,qe]],ne.push(ve)),ve.push([Pe,ft])))))}}function ka({name:ge,features:k},B){B.writeStringField(1,ge),B.writeVarintField(5,o.aj);const Z=new Map,ne=new Map,W={keys:Z,values:ne,feature:null};for(const le of k)W.feature=le,B.writeMessage(2,cs,W);for(const le of Z.keys())B.writeStringField(3,le);for(const le of ne.keys())B.writeMessage(4,ql,le)}function cs(ge,k){const B=ge.feature;B.id===void 0||isNaN(+B.id)||k.writeVarintField(1,+B.id),B.tags&&k.writeMessage(2,Ln,ge),k.writeVarintField(3,B.type),k.writeMessage(4,No,B)}function Ln({keys:ge,values:k,feature:B},Z){for(const ne of Object.keys(B.tags)){let W=B.tags[ne];if(W===null)continue;let le=ge.get(ne);le===void 0&&(le=ge.size,ge.set(ne,le)),Z.writeVarint(le);const ve=typeof W;ve!=="string"&&ve!=="boolean"&&ve!=="number"&&(W=JSON.stringify(W));let he=k.get(W);he===void 0&&(he=k.size,k.set(W,he)),Z.writeVarint(he)}}function Fi(ge,k){return(k<<3)+(7&ge)}function Hr(ge){return ge<<1^ge>>31}function No(ge,k){const{geometry:B,type:Z}=ge;let ne=0,W=0;if(Z===1){k.writeVarint(Fi(1,B.length));for(const le of B){const ve=le[0]-ne,he=le[1]-W;k.writeVarint(Hr(ve)),k.writeVarint(Hr(he)),ne+=ve,W+=he}}else for(const le of B){k.writeVarint(Fi(1,1));const ve=le.length-(Z===3?1:0);for(let he=0;he<ve;he++){he===1&&k.writeVarint(Fi(2,ve-1));const ye=le[he][0]-ne,qe=le[he][1]-W;k.writeVarint(Hr(ye)),k.writeVarint(Hr(qe)),ne+=ye,W+=qe}Z===3&&k.writeVarint(Fi(7,1))}}function ql(ge,k){const B=typeof ge;B==="string"?k.writeStringField(1,ge):B==="boolean"?k.writeBooleanField(7,ge):B==="number"&&(ge%1!=0?k.writeDoubleField(3,ge):ge<0?k.writeSVarintField(6,ge):k.writeVarintField(5,ge))}const Ps={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ge=>ge},Ri=Math.fround||(er=new Float32Array(1),ge=>(er[0]=+ge,er[0]));var er;const cr=3,Qr=5,tr=6;class zs{constructor(k){this.options=Object.assign(Object.create(Ps),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){const{log:B,minZoom:Z,maxZoom:ne}=this.options;B&&console.time("total time");const W=`prepare ${k.length} points`;B&&console.time(W),this.points=k;const le=[];for(let he=0;he<k.length;he++){const ye=k[he];if(!ye.geometry)continue;const[qe,Pe]=ye.geometry.coordinates,ft=Ri(Fn(qe)),bt=Ri(ir(Pe));le.push(ft,bt,1/0,he,-1,1),this.options.reduce&&le.push(0)}let ve=this.trees[ne+1]=this._createTree(le);B&&console.timeEnd(W);for(let he=ne;he>=Z;he--){const ye=+Date.now();ve=this.trees[he]=this._createTree(this._cluster(ve,he)),B&&console.log("z%d: %d clusters in %dms",he,ve.numItems,+Date.now()-ye)}return B&&console.timeEnd("total time"),this}getClusters(k,B){let Z=((k[0]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,k[1]));let W=k[2]===180?180:((k[2]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)Z=-180,W=180;else if(Z>W){const Pe=this.getClusters([Z,ne,180,le],B),ft=this.getClusters([-180,ne,W,le],B);return Pe.concat(ft)}const ve=this.trees[this._limitZoom(B)],he=ve.range(Fn(Z),ir(le),Fn(W),ir(ne)),ye=ve.data,qe=[];
vendor: 12,259 bytes, line 14
14for(const Pe of he){const ft=this.stride*Pe;qe.push(ye[ft+Qr]>1?Rs(ye,ft,this.clusterProps):this.points[ye[ft+cr]])}return qe}getChildren(k){const B=this._getOriginId(k),Z=this._getOriginZoom(k),ne="No cluster with the specified id.",W=this.trees[Z];if(!W)throw new Error(ne);const le=W.data;if(B*this.stride>=le.length)throw new Error(ne);const ve=this.options.radius/(this.options.extent*Math.pow(2,Z-1)),he=W.within(le[B*this.stride],le[B*this.stride+1],ve),ye=[];for(const qe of he){const Pe=qe*this.stride;le[Pe+4]===k&&ye.push(le[Pe+Qr]>1?Rs(le,Pe,this.clusterProps):this.points[le[Pe+cr]])}if(ye.length===0)throw new Error(ne);return ye}getLeaves(k,B,Z){const ne=[];return this._appendLeaves(ne,k,B=B||10,Z=Z||0,0),ne}getTile(k,B,Z){const ne=this.trees[this._limitZoom(k)],W=Math.pow(2,k),{extent:le,radius:ve}=this.options,he=ve/le,ye=(Z-he)/W,qe=(Z+1+he)/W,Pe={features:[]};return this._addTileFeatures(ne.range((B-he)/W,ye,(B+1+he)/W,qe),ne.data,B,Z,W,Pe),B===0&&this._addTileFeatures(ne.range(1-he/W,ye,1,qe),ne.data,W,Z,W,Pe),B===W-1&&this._addTileFeatures(ne.range(0,ye,he/W,qe),ne.data,-1,Z,W,Pe),Pe.features.length?Pe:null}getClusterExpansionZoom(k){let B=this._getOriginZoom(k)-1;for(;B<=this.options.maxZoom;){const Z=this.getChildren(k);if(B++,Z.length!==1)break;k=Z[0].properties.cluster_id}return B}_appendLeaves(k,B,Z,ne,W){const le=this.getChildren(B);for(const ve of le){const he=ve.properties;if(he&&he.cluster?W+he.point_count<=ne?W+=he.point_count:W=this._appendLeaves(k,he.cluster_id,Z,ne,W):W<ne?W++:k.push(ve),k.length===Z)break}return W}_createTree(k){const B=new o.c0(k.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Z=0;Z<k.length;Z+=this.stride)B.add(k[Z],k[Z+1]);return B.finish(),B.data=k,B}_addTileFeatures(k,B,Z,ne,W,le){for(const ve of k){const he=ve*this.stride,ye=B[he+Qr]>1;let qe,Pe,ft;if(ye)qe=Ba(B,he,this.clusterProps),Pe=B[he],ft=B[he+1];else{const Ut=this.points[B[he+cr]];qe=Ut.properties;const[Ft,jt]=Ut.geometry.coordinates;Pe=Fn(Ft),ft=ir(jt)}const bt={type:1,geometry:[[Math.round(this.options.extent*(Pe*W-Z)),Math.round(this.options.extent*(ft*W-ne))]],tags:qe};let St;St=ye||this.options.generateId?B[he+cr]:this.points[B[he+cr]].id,St!==void 0&&(bt.id=St),le.features.push(bt)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,B){const{radius:Z,extent:ne,reduce:W,minPoints:le}=this.options,ve=Z/(ne*Math.pow(2,B)),he=k.data,ye=[],qe=this.stride;for(let Pe=0;Pe<he.length;Pe+=qe){if(he[Pe+2]<=B)continue;he[Pe+2]=B;const ft=he[Pe],bt=he[Pe+1],St=k.within(he[Pe],he[Pe+1],ve),Ut=he[Pe+Qr];let Ft=Ut;for(const jt of St){const bi=jt*qe;he[bi+2]>B&&(Ft+=he[bi+Qr])}if(Ft>Ut&&Ft>=le){let jt,bi=ft*Ut,Gt=bt*Ut,Ki=-1;const yr=(Pe/qe<<5)+(B+1)+this.points.length;for(const dr of St){const gi=dr*qe;if(he[gi+2]<=B)continue;he[gi+2]=B;const ri=he[gi+Qr];bi+=he[gi]*ri,Gt+=he[gi+1]*ri,he[gi+4]=yr,W&&(jt||(jt=this._map(he,Pe,!0),Ki=this.clusterProps.length,this.clusterProps.push(jt)),W(jt,this._map(he,gi)))}he[Pe+4]=yr,ye.push(bi/Ft,Gt/Ft,1/0,yr,-1,Ft),W&&ye.push(Ki)}else{for(let jt=0;jt<qe;jt++)ye.push(he[Pe+jt]);if(Ft>1)for(const jt of St){const bi=jt*qe;if(!(he[bi+2]<=B)){he[bi+2]=B;for(let Gt=0;Gt<qe;Gt++)ye.push(he[bi+Gt])}}}}return ye}_getOriginId(k){return k-this.points.length>>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,B,Z){if(k[B+Qr]>1){const le=this.clusterProps[k[B+tr]];return Z?Object.assign({},le):le}const ne=this.points[k[B+cr]].properties,W=this.options.map(ne);return Z&&W===ne?Object.assign({},W):W}}function Rs(ge,k,B){return{type:"Feature",id:ge[k+cr],properties:Ba(ge,k,B),geometry:{type:"Point",coordinates:[(Z=ge[k],360*(Z-.5)),en(ge[k+1])]}};var Z}function Ba(ge,k,B){const Z=ge[k+Qr],ne=Z>=1e4?`${Math.round(Z/1e3)}k`:Z>=1e3?Math.round(Z/100)/10+"k":Z,W=ge[k+tr],le=W===-1?{}:Object.assign({},B[W]);return Object.assign(le,{cluster:!0,cluster_id:ge[k+cr],point_count:Z,point_count_abbreviated:ne})}function Fn(ge){return ge/360+.5}function ir(ge){const k=Math.sin(ge*Math.PI/180),B=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return B<0?0:B>1?1:B}function en(ge){const k=(180-360*ge)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function Ds(ge,k,B,Z){let ne=Z;const W=k+(B-k>>1);let le,ve=B-k;const he=ge[k],ye=ge[k+1],qe=ge[B],Pe=ge[B+1];for(let ft=k+3;ft<B;ft+=3){const bt=Na(ge[ft],ge[ft+1],he,ye,qe,Pe);if(bt>ne)le=ft,ne=bt;else if(bt===ne){const St=Math.abs(ft-W);St<ve&&(le=ft,ve=St)}}ne>Z&&(le-k>3&&Ds(ge,k,le,Z),ge[le+2]=ne,B-le>3&&Ds(ge,le,B,Z))}function Na(ge,k,B,Z,ne,W){let le=ne-B,ve=W-Z;if(le!==0||ve!==0){const he=((ge-B)*le+(k-Z)*ve)/(le*le+ve*ve);he>1?(B=ne,Z=W):he>0&&(B+=le*he,Z+=ve*he)}return le=ge-B,ve=k-Z,le*le+ve*ve}function hs(ge,k,B,Z){const ne={id:ge??null,type:k,geometry:B,tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")gn(ne,B);else if(k==="Polygon")gn(ne,B[0]);else if(k==="MultiLineString")for(const W of B)gn(ne,W);else if(k==="MultiPolygon")for(const W of B)gn(ne,W[0]);return ne}function gn(ge,k){for(let B=0;B<k.length;B+=3)ge.minX=Math.min(ge.minX,k[B]),ge.minY=Math.min(ge.minY,k[B+1]),ge.maxX=Math.max(ge.maxX,k[B]),ge.maxY=Math.max(ge.maxY,k[B+1])}function hn(ge,k,B,Z){if(!k.geometry)return;const ne=k.geometry.coordinates;if(ne&&ne.length===0)return;const W=k.geometry.type,le=Math.pow(B.tolerance/((1<<B.maxZoom)*B.extent),2);let ve=[],he=k.id;if(B.promoteId?he=k.properties[B.promoteId]:B.generateId&&(he=Z||0),W==="Point")us(ne,ve);else if(W==="MultiPoint")for(const ye of ne)us(ye,ve);else if(W==="LineString")ds(ne,ve,le,!1);else if(W==="MultiLineString"){if(B.lineMetrics){for(const ye of ne)ve=[],ds(ye,ve,le,!1),ge.push(hs(he,"LineString",ve,k.properties));return}fo(ne,ve,le,!1)}else if(W==="Polygon")fo(ne,ve,le,!0);else{if(W!=="MultiPolygon"){if(W==="GeometryCollection"){for(const ye of k.geometry.geometries)hn(ge,{id:he,geometry:ye,properties:k.properties},B,Z);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ye of ne){const qe=[];fo(ye,qe,le,!0),ve.push(qe)}}ge.push(hs(he,W,ve,k.properties))}function us(ge,k){k.push(Vo(ge[0]),tn(ge[1]),0)}function ds(ge,k,B,Z){let ne,W,le=0;for(let he=0;he<ge.length;he++){const ye=Vo(ge[he][0]),qe=tn(ge[he][1]);k.push(ye,qe,0),he>0&&(le+=Z?(ne*qe-ye*W)/2:Math.sqrt(Math.pow(ye-ne,2)+Math.pow(qe-W,2))),ne=ye,W=qe}const ve=k.length-3;k[2]=1,Ds(k,0,ve,B),k[ve+2]=1,k.size=Math.abs(le),k.start=0,k.end=k.size}function fo(ge,k,B,Z){for(let ne=0;ne<ge.length;ne++){const W=[];ds(ge[ne],W,B,Z),k.push(W)}}function Vo(ge){return ge/360+.5}function tn(ge){const k=Math.sin(ge*Math.PI/180),B=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return B<0?0:B>1?1:B}function yn(ge,k,B,Z,ne,W,le,ve){if(Z/=k,W>=(B/=k)&&le<Z)return ge;if(le<B||W>=Z)return null;const he=[];for(const ye of ge){const qe=ye.geometry;let Pe=ye.type;const ft=ne===0?ye.minX:ye.minY,bt=ne===0?ye.maxX:ye.maxY;if(ft>=B&&bt<Z){he.push(ye);continue}if(bt<B||ft>=Z)continue;let St=[];if(Pe==="Point"||Pe==="MultiPoint")Va(qe,St,B,Z,ne);else if(Pe==="LineString")fs(qe,St,B,Z,ne,!1,ve.lineMetrics);else if(Pe==="MultiLineString")Or(qe,St,B,Z,ne,!1);else if(Pe==="Polygon")Or(qe,St,B,Z,ne,!0);else if(Pe==="MultiPolygon")for(const Ut of qe){const Ft=[];Or(Ut,Ft,B,Z,ne,!0),Ft.length&&St.push(Ft)}if(St.length){if(ve.lineMetrics&&Pe==="LineString"){for(const Ut of St)he.push(hs(ye.id,Pe,Ut,ye.tags));continue}Pe!=="LineString"&&Pe!=="MultiLineString"||(St.length===1?(Pe="LineString",St=St[0]):Pe="MultiLineString"),Pe!=="Point"&&Pe!=="MultiPoint"||(Pe=St.length===3?"Point":"MultiPoint"),he.push(hs(ye.id,Pe,St,ye.tags))}}return he.length?he:null}function Va(ge,k,B,Z,ne){for(let W=0;W<ge.length;W+=3){const le=ge[W+ne];le>=B&&le<=Z&&xn(k,ge[W],ge[W+1],ge[W+2])}}function fs(ge,k,B,Z,ne,W,le){let ve=Uo(ge);const he=ne===0?Ls:ps;let ye,qe,Pe=ge.start;for(let Ft=0;Ft<ge.length-3;Ft+=3){const jt=ge[Ft],bi=ge[Ft+1],Gt=ge[Ft+2],Ki=ge[Ft+3],yr=ge[Ft+4],dr=ne===0?jt:bi,gi=ne===0?Ki:yr;let ri=!1;le&&(ye=Math.sqrt(Math.pow(jt-Ki,2)+Math.pow(bi-yr,2))),dr<B?gi>B&&(qe=he(ve,jt,bi,Ki,yr,B),le&&(ve.start=Pe+ye*qe)):dr>Z?gi<Z&&(qe=he(ve,jt,bi,Ki,yr,Z),le&&(ve.start=Pe+ye*qe)):xn(ve,jt,bi,Gt),gi<B&&dr>=B&&(qe=he(ve,jt,bi,Ki,yr,B),ri=!0),gi>Z&&dr<=Z&&(qe=he(ve,jt,bi,Ki,yr,Z),ri=!0),!W&&ri&&(le&&(ve.end=Pe+ye*qe),k.push(ve),ve=Uo(ge)),le&&(Pe+=ye)}let ft=ge.length-3;const bt=ge[ft],St=ge[ft+1],Ut=ne===0?bt:St;Ut>=B&&Ut<=Z&&xn(ve,bt,St,ge[ft+2]),ft=ve.length-3,W&&ft>=3&&(ve[ft]!==ve[0]||ve[ft+1]!==ve[1])&&xn(ve,ve[0],ve[1],ve[2]),ve.length&&k.push(ve)}function Uo(ge){const k=[];return k.size=ge.size,k.start=ge.start,k.end=ge.end,k}function Or(ge,k,B,Z,ne,W){for(const le of ge)fs(le,k,B,Z,ne,W,!1)}function xn(ge,k,B,Z){ge.push(k,B,Z)}function Ls(ge,k,B,Z,ne,W){const le=(W-k)/(Z-k);return xn(ge,W,B+(ne-B)*le,1),le}function ps(ge,k,B,Z,ne,W){const le=(W-B)/(ne-B);return xn(ge,k+(Z-k)*le,W,1),le}function Fs(ge,k){const B=[];for(let Z=0;Z<ge.length;Z++){const ne=ge[Z],W=ne.type;let le;if(W==="Point"||W==="MultiPoint"||W==="LineString")le=Os(ne.geometry,k);else if(W==="MultiLineString"||W==="Polygon"){le=[];for(const ve of ne.geometry)le.push(Os(ve,k))}else if(W==="MultiPolygon"){le=[];for(const ve of ne.geometry){const he=[];for(const ye of ve)he.push(Os(ye,k));le.push(he)}}B.push(hs(ne.id,W,le,ne.tags))}return B}function Os(ge,k){const B=[];B.size=ge.size,ge.start!==void 0&&(B.start=ge.start,B.end=ge.end);for(let Z=0;Z<ge.length;Z+=3)B.push(ge[Z]+k,ge[Z+1],ge[Z+2]);return B}function jo(ge,k){if(ge.transformed)return ge;const B=1<<ge.z,Z=ge.x,ne=ge.y;for(const W of ge.features){const le=W.geometry,ve=W.type;if(W.geometry=[],ve===1)for(let he=0;he<le.length;he+=2)W.geometry.push(Di(le[he],le[he+1],k,B,Z,ne));else for(let he=0;he<le.length;he++){const ye=[];for(let qe=0;qe<le[he].length;qe+=2)ye.push(Di(le[he][qe],le[he][qe+1],k,B,Z,ne));W.geometry.push(ye)}}return ge.transformed=!0,ge}function Di(ge,k,B,Z,ne,W){return[Math.round(B*(ge*Z-ne)),Math.round(B*(k*Z-W))]}function Ua(ge,k,B,Z,ne){const W=k===ne.maxZoom?0:ne.tolerance/((1<<k)*ne.extent),le={features:[],numPoints:0,numSimplified:0,numFeatures:ge.length,source:null,x:B,y:Z,z:k,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ve of ge)ja(le,ve,W,ne);return le}function ja(ge,k,B,Z){const ne=k.geometry,W=k.type,le=[];if(ge.minX=Math.min(ge.minX,k.minX),ge.minY=Math.min(ge.minY,k.minY),ge.maxX=Math.max(ge.maxX,k.maxX),ge.maxY=Math.max(ge.maxY,k.maxY),W==="Point"||W==="MultiPoint")for(let ve=0;ve<ne.length;ve+=3)le.push(ne[ve],ne[ve+1]),ge.numPoints++,ge.numSimplified++;else if(W==="LineString")vn(le,ne,ge,B,!1,!1);else if(W==="MultiLineString"||W==="Polygon")for(let ve=0;ve<ne.length;ve++)vn(le,ne[ve],ge,B,W==="Polygon",ve===0);else if(W==="MultiPolygon")for(let ve=0;ve<ne.length;ve++){const he=ne[ve];for(let ye=0;ye<he.length;ye++)vn(le,he[ye],ge,B,!0,ye===0)}if(le.length){let ve=k.tags||null;if(W==="LineString"&&Z.lineMetrics){ve={};for(const ye in k.tags)ve[ye]=k.tags[ye];ve.mapbox_clip_start=ne.start/ne.size,ve.mapbox_clip_end=ne.end/ne.size}const he={geometry:le,type:W==="Polygon"||W==="MultiPolygon"?3:W==="LineString"||W==="MultiLineString"?2:1,tags:ve};k.id!==null&&(he.id=k.id),ge.features.push(he)}}function vn(ge,k,B,Z,ne,W){const le=Z*Z;if(Z>0&&k.size<(ne?le:Z))return void(B.numPoints+=k.length/3);const ve=[];for(let he=0;he<k.length;he+=3)(Z===0||k[he+2]>le)&&(B.numSimplified++,ve.push(k[he],k[he+1])),B.numPoints++;ne&&(function(he,ye){let qe=0;for(let Pe=0,ft=he.length,bt=ft-2;Pe<ft;bt=Pe,Pe+=2)qe+=(he[Pe]-he[bt])*(he[Pe+1]+he[bt+1]);if(qe>0===ye)for(let Pe=0,ft=he.length;Pe<ft/2;Pe+=2){const bt=he[Pe],St=he[Pe+1];he[Pe]=he[ft-2-Pe],he[Pe+1]=he[ft-1-Pe],he[ft-2-Pe]=bt,he[ft-1-Pe]=St}})(ve,W),ge.push(ve)}const Ga={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class uh{constructor(k,B){const Z=(B=this.options=(function(W,le){for(const ve in le)W[ve]=le[ve];return W})(Object.create(Ga),B)).debug;if(Z&&console.time("preprocess data"),B.maxZoom<0||B.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(B.promoteId&&B.generateId)throw new Error("promoteId and generateId cannot be used together.");let ne=(function(W,le){const ve=[];
14if(W.type==="FeatureCollection")for(let he=0;he<W.features.length;he++)hn(ve,W.features[he],le,he);else hn(ve,W.type==="Feature"?W:{geometry:W},le);return ve})(k,B);this.tiles={},this.tileCoords=[],Z&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",B.indexMaxZoom,B.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ne=(function(W,le){const ve=le.buffer/le.extent;let he=W;const ye=yn(W,1,-1-ve,ve,0,-1,2,le),qe=yn(W,1,1-ve,2+ve,0,-1,2,le);return(ye||qe)&&(he=yn(W,1,-ve,1+ve,0,-1,2,le)||[],ye&&(he=Fs(ye,1).concat(he)),qe&&(he=he.concat(Fs(qe,-1)))),he})(ne,B),ne.length&&this.splitTile(ne,0,0,0),Z&&(ne.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(k,B,Z,ne,W,le,ve){const he=[k,B,Z,ne],ye=this.options,qe=ye.debug;for(;he.length;){ne=he.pop(),Z=he.pop(),B=he.pop(),k=he.pop();const Pe=1<<B,ft=Go(B,Z,ne);let bt=this.tiles[ft];if(!bt&&(qe>1&&console.time("creation"),bt=this.tiles[ft]=Ua(k,B,Z,ne,ye),this.tileCoords.push({z:B,x:Z,y:ne}),qe)){qe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,Z,ne,bt.numFeatures,bt.numPoints,bt.numSimplified),console.timeEnd("creation"));const ri=`z${B}`;this.stats[ri]=(this.stats[ri]||0)+1,this.total++}if(bt.source=k,W==null){if(B===ye.indexMaxZoom||bt.numPoints<=ye.indexMaxPoints)continue}else{if(B===ye.maxZoom||B===W)continue;if(W!=null){const ri=W-B;if(Z!==le>>ri||ne!==ve>>ri)continue}}if(bt.source=null,k.length===0)continue;qe>1&&console.time("clipping");const St=.5*ye.buffer/ye.extent,Ut=.5-St,Ft=.5+St,jt=1+St;let bi=null,Gt=null,Ki=null,yr=null,dr=yn(k,Pe,Z-St,Z+Ft,0,bt.minX,bt.maxX,ye),gi=yn(k,Pe,Z+Ut,Z+jt,0,bt.minX,bt.maxX,ye);k=null,dr&&(bi=yn(dr,Pe,ne-St,ne+Ft,1,bt.minY,bt.maxY,ye),Gt=yn(dr,Pe,ne+Ut,ne+jt,1,bt.minY,bt.maxY,ye),dr=null),gi&&(Ki=yn(gi,Pe,ne-St,ne+Ft,1,bt.minY,bt.maxY,ye),yr=yn(gi,Pe,ne+Ut,ne+jt,1,bt.minY,bt.maxY,ye),gi=null),qe>1&&console.timeEnd("clipping"),he.push(bi||[],B+1,2*Z,2*ne),he.push(Gt||[],B+1,2*Z,2*ne+1),he.push(Ki||[],B+1,2*Z+1,2*ne),he.push(yr||[],B+1,2*Z+1,2*ne+1)}}getTile(k,B,Z){k=+k,B=+B,Z=+Z;const ne=this.options,{extent:W,debug:le}=ne;if(k<0||k>24)return null;const ve=1<<k,he=Go(k,B=B+ve&ve-1,Z);if(this.tiles[he])return jo(this.tiles[he],W);le>1&&console.log("drilling down to z%d-%d-%d",k,B,Z);let ye,qe=k,Pe=B,ft=Z;for(;!ye&&qe>0;)qe--,Pe>>=1,ft>>=1,ye=this.tiles[Go(qe,Pe,ft)];return ye&&ye.source?(le>1&&(console.log("found parent tile z%d-%d-%d",qe,Pe,ft),console.time("drilling down")),this.splitTile(ye.source,qe,Pe,ft,k,B,Z),le>1&&console.timeEnd("drilling down"),this.tiles[he]?jo(this.tiles[he],W):null):null}}function Go(ge,k,B){return 32*((1<<ge)*B+k)+ge}function ke(ge,k){const B=ge.tileID.canonical;if(!this._geoJSONIndex)return void k(null,null);const Z=this._geoJSONIndex.getTile(B.z,B.x,B.y);if(!Z)return void k(null,null);const ne=ye=>ye.tags&&"3d_elevation_id"in ye.tags&&"source"in ye.tags&&ye.tags.source==="elevation",W=Z.features.filter((ye=>ne(ye)));let le={_geojsonTileLayer:Z.features};W.length>0&&(le={_geojsonTileLayer:Z.features.filter((ye=>!ne(ye))),hd_road_elevation:W});const ve=new ko(le),he=(function(ye){const qe=new o.bq;for(const Pe of Object.keys(ye))qe.writeMessage(3,ka,{name:Pe,features:ye[Pe]});return qe.finish()})(le).buffer;k(null,{vectorTile:ve,rawData:he})}class ms extends Jr{constructor(k,B,Z,ne,W,le,ve){super(k,B,Z,ne,W,ke,ve),le&&(this.loadGeoJSON=le),this._dynamicIndex=new Gl}loadData(k,B){const Z=k&&k.request,ne=Z&&Z.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(k,((W,le)=>{if(W||!le)return B(W);if(typeof le!="object")return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`));{try{if(k.filter){const he=o.X(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(he.result==="error")throw new Error(he.value.map((ye=>`${ye.key}: ${ye.message}`)).join(", "));le.features=le.features.filter((ye=>he.value.evaluate({zoom:0},ye)))}k.dynamic?(le.type==="Feature"&&(le={type:"FeatureCollection",features:[le]}),k.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(le.features,this.loaded),k.cluster&&(le.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=k.cluster?new zs((function({superclusterOptions:he,clusterProperties:ye}){if(!ye||!he)return he;const qe={},Pe={},ft={accumulated:null,zoom:0},bt={properties:null},St=Object.keys(ye);for(const Ut of St){const[Ft,jt]=ye[Ut],bi=o.X(jt),Gt=o.X(typeof Ft=="string"?[Ft,["accumulated"],["get",Ut]]:Ft);qe[Ut]=bi.value,Pe[Ut]=Gt.value}return he.map=Ut=>{bt.properties=Ut;const Ft={};for(const jt of St)Ft[jt]=qe[jt].evaluate(ft,bt);return Ft},he.reduce=(Ut,Ft)=>{bt.properties=Ft;for(const jt of St)ft.accumulated=Ut[jt],Ut[jt]=Pe[jt].evaluate(ft,bt)},he})(k)).load(le.features):k.dynamic?this._dynamicIndex:(function(he,ye){return new uh(he,ye)})(le,k.geojsonVtOptions)}catch(he){return B(he)}const ve={};if(ne){const he=Gr(Z);he&&(ve.resourceTiming={},ve.resourceTiming[k.source]=JSON.parse(JSON.stringify(he)))}B(null,ve)}}))}reloadTile(k,B){const Z=this.loaded;return Z&&Z[k.uid]?k.partial?B(null,void 0):super.reloadTile(k,B):this.loadTile(k,B)}loadGeoJSON(k,B){if(k.request)o.n(k.request,B);else{if(typeof k.data!="string")return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`));setTimeout((()=>{try{return B(null,JSON.parse(k.data))}catch{return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`))}}),0)}}getClusterExpansionZoom(k,B){try{B(null,this._geoJSONIndex.getClusterExpansionZoom(k.clusterId))}catch(Z){B(Z)}}getClusterChildren(k,B){try{B(null,this._geoJSONIndex.getChildren(k.clusterId))}catch(Z){B(Z)}}getClusterLeaves(k,B){try{B(null,this._geoJSONIndex.getLeaves(k.clusterId,
14k.limit,k.offset))}catch(Z){B(Z)}}}class dh{constructor(k,B,Z){this.tileID=new o.aM(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.tileZoom=k.tileZoom,this.uid=k.uid,this.zoom=k.zoom,this.canonical=k.tileID.canonical,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=k.projection,this.brightness=B,this.worldview=Z}parse(k,B,Z,ne){this.status="parsing";const W=new o.aM(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),le=[],ve=B.familiesBySource[Z.source],he=new o.fc(W,Z.promoteId);he.bucketLayerIDs=[],he.is3DTile=!0,o.fr(k).then((ye=>{if(!ye)return ne(new Error("Could not parse tile"));const qe=ye.json.extensionsUsed&&ye.json.extensionsUsed.includes("MAPBOX_mesh_features")||ye.json.asset.extras&&ye.json.asset.extras.MAPBOX_mesh_features,Pe=ye.json.extensionsUsed&&ye.json.extensionsUsed.includes("EXT_meshopt_compression"),ft=new o.aa(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const bt in ve)for(const St of ve[bt]){const Ut=St[0];he.bucketLayerIDs.push(St.map((bi=>o.C(bi.id,bi.scope)))),Ut.recalculate(ft,[]);const Ft=o.fs(ye,1/o.d4(Z.tileID.canonical)),jt=new o.ft(St,Ft,W,qe,Pe,this.brightness,he,this.worldview);qe||(jt.needsUpload=!0),le.push(jt),jt.evaluate(Ut)}this.status="done",ne(null,{buckets:le,featureIndex:he,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})})).catch((ye=>ne(new Error(ye.message))))}}class qa{constructor(k,B,Z,ne,W,le,ve,he){this.actor=k,this.layerIndex=B,this.availableImages=Z,this.availableModels=ne,this.brightness=ve,this.loading={},this.loaded={},this.worldview=he}loadTile(k,B){const Z=k.uid,ne=this.loading[Z]=new dh(k,this.brightness,this.worldview);o.br(k.request,((W,le)=>{const ve=!this.loading[Z];return delete this.loading[Z],ve||W?(ne.status="done",ve||(this.loaded[Z]=ne),B(W)):le&&le.byteLength!==0?void ne.parse(le,this.layerIndex,k,((he,ye)=>{ne.status="done",this.loaded=this.loaded||{},this.loaded[Z]=ne,he||!ye?B(he):B(null,ye)})):(ne.status="done",this.loaded[Z]=ne,B())}))}reloadTile(k,B){const Z=this.loaded,ne=k.uid;if(Z&&Z[ne]){const W=Z[ne];W.projection=k.projection,W.brightness=k.brightness;const le=(ve,he)=>{W.reloadCallback&&(delete W.reloadCallback,this.loadTile(k,B)),B(ve,he)};W.status==="parsing"?W.reloadCallback=le:W.status==="done"&&this.loadTile(k,B)}}abortTile(k,B){const Z=k.uid;this.loading[Z]&&delete this.loading[Z],B()}removeTile(k,B){const Z=this.loaded,ne=k.uid;Z&&Z[ne]&&delete Z[ne],B()}}class ei{constructor(k){this.self=k,this.actor=new o.fv(k,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new o.y,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=o.cj({name:"mercator"}),this.workerSourceTypes={vector:Jr,geojson:ms,"raster-dem":Gi,"raster-array":Fr,"batched-model":qa},this.workerSources={},this.self.registerWorkerSource=(B,Z)=>{if(this.workerSourceTypes[B])throw new Error(`Worker source with name "${B}" already registered.`);this.workerSourceTypes[B]=Z},this.self.registerRTLTextPlugin=B=>{if(o.fw.isParsed())throw new Error("RTL text plugin already registered.");o.fw.setState({pluginStatus:o.fx.parsed,pluginURL:o.fw.getPluginURL()}),o.fw.applyArabicShaping=B.applyArabicShaping,o.fw.processBidirectionalText=B.processBidirectionalText,o.fw.processStyledBidirectionalText=B.processStyledBidirectionalText;for(const Z of this.rtlPluginParsingListeners)Z(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(k,B,Z){delete this.layerIndexes[k],delete this.availableImages[k],delete this.availableModels[k],delete this.workerSources[k],Z()}checkIfReady(k,B,Z){Z()}setReferrer(k,B){this.referrer=B}spriteLoaded(k,B){this.isSpriteLoaded[k]||(this.isSpriteLoaded[k]={});const{scope:Z,isLoaded:ne}=B;if(this.isSpriteLoaded[k][Z]=ne,this.workerSources[k]&&this.workerSources[k][Z])for(const W in this.workerSources[k][Z]){const le=this.workerSources[k][Z][W];for(const ve in le){const he=le[ve];he instanceof Jr&&(he.isSpriteLoaded=ne,he.fire(new o.A("isSpriteLoaded")))}}}setImages(k,B,Z){this.availableImages[k]||(this.availableImages[k]={});const{scope:ne,images:W}=B;if(this.availableImages[k][ne]=W,this.workerSources[k]&&this.workerSources[k][ne]){for(const le in this.workerSources[k][ne]){const ve=this.workerSources[k][ne][le];for(const he in ve)ve[he].availableImages=W}Z()}else Z()}setModels(k,{scope:B,models:Z},ne){if(this.availableModels[k]||(this.availableModels[k]={}),this.availableModels[k][B]=Z,this.workerSources[k]&&this.workerSources[k][B]
14){for(const W in this.workerSources[k][B]){const le=this.workerSources[k][B][W];for(const ve in le)le[ve].availableModels=Z}ne()}else ne()}setProjection(k,B){this.projections[k]=o.cj(B)}setBrightness(k,B,Z){this.brightness=B,Z()}setWorldview(k,B,Z){this.worldview=B,Z()}setLayers(k,B,Z){this.getLayerIndex(k,B.scope).replace(B.layers,B.options),Z()}updateLayers(k,B,Z){this.getLayerIndex(k,B.scope).update(B.layers,B.removedIds,B.options),Z()}loadTile(k,B,Z){B.projection=this.projections[k]||this.defaultProjection,this.getWorkerSource(k,B.type,B.source,B.scope).loadTile(B,Z)}decodeRasterArray(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).decodeRasterArray(B,Z)}reloadTile(k,B,Z){B.projection=this.projections[k]||this.defaultProjection,this.getWorkerSource(k,B.type,B.source,B.scope).reloadTile(B,Z)}abortTile(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).abortTile(B,Z)}removeTile(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).removeTile(B,Z)}removeSource(k,B,Z){if(!(this.workerSources[k]&&this.workerSources[k][B.scope]&&this.workerSources[k][B.scope][B.type]&&this.workerSources[k][B.scope][B.type][B.source]))return;const ne=this.workerSources[k][B.scope][B.type][B.source];delete this.workerSources[k][B.scope][B.type][B.source],ne.removeSource!==void 0?ne.removeSource(B,Z):Z()}loadWorkerSource(k,B,Z){try{this.self.importScripts(B.url),Z()}catch(ne){Z(ne.toString())}}syncRTLPluginState(k,B,Z){if(o.fw.isParsed())Z(null,!0);else if(o.fw.isParsing())this.rtlPluginParsingListeners.push(Z);else try{o.fw.setState(B);const ne=o.fw.getPluginURL();!o.fw.isLoaded()||o.fw.isParsed()||o.fw.isParsing()||ne==null||(o.fw.setState({pluginStatus:o.fx.parsing,pluginURL:o.fw.getPluginURL()}),this.self.importScripts(ne),o.fw.isParsed()?Z(null,!0):this.rtlPluginParsingListeners.push(Z))}catch(ne){Z(ne.toString())}}setDracoUrl(k,B){this.dracoUrl=B}getAvailableImages(k,B){this.availableImages[k]||(this.availableImages[k]={});let Z=this.availableImages[k][B];return Z||(Z=[]),Z}getAvailableModels(k,B){this.availableModels[k]||(this.availableModels[k]={});let Z=this.availableModels[k][B];return Z||(Z={}),Z}getLayerIndex(k,B){this.layerIndexes[k]||(this.layerIndexes[k]={});let Z=this.layerIndexes[k][B];return Z||(Z=this.layerIndexes[k][B]=new jl,Z.scope=B),Z}getWorkerSource(k,B,Z,ne){const W=this.workerSources;return W[k]||(W[k]={}),W[k][ne]||(W[k][ne]={}),W[k][ne][B]||(W[k][ne][B]={}),this.isSpriteLoaded[k]||(this.isSpriteLoaded[k]={}),W[k][ne][B][Z]||(W[k][ne][B][Z]=new this.workerSourceTypes[B]({send:(le,ve,he,ye,qe,Pe)=>this.actor.send(le,ve,he,k,qe,Pe),scheduler:this.actor.scheduler},this.getLayerIndex(k,ne),this.getAvailableImages(k,ne),this.getAvailableModels(k,ne),this.isSpriteLoaded[k][ne],void 0,this.brightness,this.worldview)),W[k][ne][B][Z]}rasterizeImagesWorker(k,B,Z){const ne=new Map;for(const[W,{image:le,imageVariant:ve}]of B.tasks.entries()){const he=this.imageRasterizer.rasterize(ve,le,B.scope,k);ne.set(W,he)}Z(void 0,ne)}removeRasterizedImages(k,B,Z){this.imageRasterizer.removeImagesFromCacheByIds(B.imageIds,B.scope,k),Z()}enforceCacheSizeLimit(k,B){o.fy(B)}getWorkerPerformanceMetrics(k,B,Z){Z(void 0,void 0)}}return o.fu(self)&&(self.worker=new ei(self)),ei})),Oa(["./shared"],(function(o){var Gr="3.14.0";const $i={create:"create",load:"load",fullLoad:"fullLoad"},as={mark(l){performance.mark(l)},measure(l,t,n){performance.measure(l,t,n)}};function jl(l){const t=l.name.split("?")[0];return o.a(t)&&t.includes("mapbox-gl.js")?"javascript":o.a(t)&&t.includes("mapbox-gl.css")?"css":o.b(t)?"fontRange":o.c(t)?"sprite":o.i(t)?"style":o.d(t)?"tilejson":"other"}var ho,Kn={},uo=(function(){if(ho)return Kn;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 f,m,y=new Blob([""],{type:"text/javascript"}),x=URL.createObjectURL(y);try{m=new Worker(x),f=!0}catch{f=!1}return m&&m.terminate(),URL.revokeObjectURL(x),f})()?(function(){var f=document.createElement("canvas");f.width=f.height=1;var m=f.getContext("2d");if(!m)return!1;var y=m.getImageData(0,0,1,1);return y&&y.width===f.width})()?(n[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(n[d]=(function(f){var m,y=(function(x){var T=document.createElement("canvas"),S=Object.create(l.webGLContextAttributes);return S.failIfMajorPerformanceCaveat=x,T.getContext("webgl2",S)})(f);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)),n[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}ho=1,Kn.supported=l,Kn.notSupportedReason=t;var n={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},Kn})();function Bt(l,t,n){const c=document.createElement(l);return t!=null&&(c.className=t),n&&n.appendChild(c),c}function Jr(l,t,n){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 n&&n.appendChild(c),c}const Gi=typeof document<"u"?document.documentElement&&document.documentElement.style:null,qr=Gi&&Gi.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Fr;function As(){Gi&&qr&&(Fr=Gi[qr],Gi[qr]="none")}function ls(){Gi&&qr&&(Gi[qr]=Fr)}function Ms(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",Ms,!0)}function ko(){window.addEventListener("click",Ms,!0),window.setTimeout((()=>{window.removeEventListener("click",Ms,!0)}),0)}function qn(l,t){const n=l.getBoundingClientRect();return ui(l,n,t)}function Cs(l,t){const n=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;
14d++)c.push(ui(l,n,t[d]));return c}function Gl(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function ui(l,t,n){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new o.P((n.clientX-t.left)*c,(n.clientY-t.top)*c)}const Bo="01",Cr="NO_ACCESS_TOKEN";class lr{constructor(t,n,c){this._transformRequestFn=t,this._customAccessToken=n,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=(function(){let n="";for(let c=0;c<10;c++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Bo,n].join(""),tokenExpiresAt:Date.now()+432e5}})();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeStyleURL(t,n){if(!o.j(t))return t;const c=ki(t);return c.params.push(`sdk=js-${Gr}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!o.j(t))return t;const c=ki(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeModelURL(t,n){if(!o.j(t))return t;const c=ki(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeSourceURL(t,n,c,d){if(!o.j(t))return t;const f=ki(t);return f.path=`/v4/${f.authority}.json`,f.params.push("secure"),c&&f.params.push(`language=${c}`),d&&f.params.push(`worldview=${d}`),this._makeAPIURL(f,this._customAccessToken||n)}normalizeIconsetURL(t,n){const c=ki(t);return o.j(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||n)):cn(c)}normalizeSpriteURL(t,n,c,d){const f=ki(t);return o.j(t)?(f.path=`/styles/v1${f.path}/sprite${n}${c}`,this._makeAPIURL(f,this._customAccessToken||d)):(f.path+=`${n}${c}`,cn(f))}normalizeTileURL(t,n,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!o.j(t))return t;const d=ki(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||c&&d.authority!=="raster"&&c===512?"@2x":""}${o.l.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${o.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${o.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${o.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${o.e.TILE_URL_VERSION}${d.path}`);const f=this._customAccessToken||(function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null})(d.params)||o.e.ACCESS_TOKEN;return o.e.REQUIRE_ACCESS_TOKEN&&f&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,f)}canonicalizeTileURL(t,n){const c=ki(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(`/${o.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${o.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${o.e.TILE_URL_VERSION}/`,"")}`;let f=c.params;return n&&(f=f.filter((m=>!m.match(/^access_token=/)))),f.length&&(d+=`?${f.join("&")}`),d}canonicalizeTileset(t,n){const c=!!n&&o.j(n),d=[];for(const f of t.tiles||[])o.k(f)?d.push(this.canonicalizeTileURL(f,c)):d.push(f);return d}_makeAPIURL(t,n){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=ki(o.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const f=t.params.indexOf("secure");f>=0&&t.params.splice(f,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!o.e.REQUIRE_ACCESS_TOKEN)return cn(t);if(n=n||o.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(n[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((f=>f.indexOf("access_token")===-1)),t.params.push(`access_token=${n||""}`),cn(t)}}const nr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ki(l){const t=l.match(nr);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 cn(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const ka="mapbox.eventData";function cs(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(o.m(t[1]))}catch{return null}}class Ln{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const n=cs(o.e.ACCESS_TOKEN);let c="";return c=n&&n.u?o.f(n.u):o.e.ACCESS_TOKEN||"",t?`${ka}.${t}:${c}`:`${ka}:${c}`}fetchEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid");if(t)try{const d=localStorage.getItem(n);d&&(this.eventData=JSON.parse(d));const f=localStorage.getItem(c);f&&(this.anonId=f)}catch{o.w("Unable to read from LocalStorage")}}saveEventData(){const t=o.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.anonId;if(t&&d)try{localStorage.setItem(c,d),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData))}catch{o.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,n,c,d){if(!o.e.EVENTS_URL)return;const f=ki(o.e.EVENTS_URL);f.params.push(`access_token=${d||o.e.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},y=n?o.h(m,n):m,x={url:cn(f),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=o.p(x,(T=>{this.pendingRequest=null,c(T),this.saveEventData(),this.processRequests(d)}))}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}const Fi=new class extends Ln{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){o.e.EVENTS_URL&&o.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some((n=>o.j(n)||o.k(n)))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=cs(o.e.ACCESS_TOKEN),n=t?t.u:o.e.ACCESS_TOKEN;let c=n!==this.eventData.tokenU;
14o.v(this.anonId)||(this.anonId=o.u(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const f=new Date(this.eventData.lastSuccess),m=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||f.getDate()!==m.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Gr,skuId:Bo,"enabled.telemetry":!1,userId:this.anonId},(f=>{f||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)}),l):this.processRequests()}},Hr=Fi.postTurnstileEvent.bind(Fi),No=new class extends Ln{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.EVENTS_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Cr)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),o.v(this.anonId)||(this.anonId=o.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Gr,skuId:Bo,skuToken:this.skuToken,userId:this.anonId},(c=>{c?this.errorCb(c):t&&(this.success[t]=!0)}),l))}remove(){this.errorCb=null}},ql=No.postMapLoadEvent.bind(No),Ps=new class extends Ln{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=o.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:n,style:c,importedStyles:d}=t;if(!o.e.EVENTS_URL||!l&&!o.e.ACCESS_TOKEN)return;const f=this.getMapInstanceId(n),m={mapInstanceId:f,eventId:this.getEventId(f),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:n}=this.queue.shift();this.postEvent(t,n,(()=>{}),l)}},Ri=Ps.postStyleLoadEvent.bind(Ps),er=new class extends Ln{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){o.e.EVENTS_URL&&(l||o.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:n}=this.queue.shift(),c=(function(d){const f=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),y=(function(C){const D={};if(C){for(const z in C)if(z!=="other")for(const F of C[z]){const L=`${z}ResolveRangeMin`,N=`${z}ResolveRangeMax`,j=`${z}RequestCount`,q=`${z}RequestCachedCount`;D[L]=Math.min(D[L]||1/0,F.startTime),D[N]=Math.max(D[N]||-1/0,F.responseEnd);const X=ee=>{D[ee]===void 0&&(D[ee]=0),++D[ee]};F.transferSize!==void 0&&F.transferSize===0&&X(q),X(j)}}return D})((function(C,D){const z={};if(C)for(const F of C){const L=D(F);z[L]===void 0&&(z[L]=[]),z[L].push(F)}return z})(f,jl)),x=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,S=T?T.effectiveType:void 0,M={counters:[],metadata:[],attributes:[]},E=(C,D,z)=>{z!=null&&C.push({name:D,value:z.toString()})};for(const C in y)E(M.counters,C,y[C]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(E(M.counters,"interactionRangeMin",d.interactionRange[0]),E(M.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const C of Object.keys($i)){const D=$i[C],z=m.find((F=>F.name===D));z&&E(M.counters,D,z.startTime)}return E(M.counters,"visibilityHidden",d.visibilityHidden),E(M.attributes,"style",(function(C){if(C)for(const D of C){const z=D.name.split("?")[0];if(o.i(z)){const F=z.split("/").slice(-2);if(F.length===2)return`mapbox://styles/${F[0]}/${F[1]}`}}})(f)),E(M.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),E(M.attributes,"fogEnabled",d.fogEnabled?"true":"false"),E(M.attributes,"projection",d.projection),E(M.attributes,"zoom",d.zoom),E(M.metadata,"devicePixelRatio",x),E(M.metadata,"connectionEffectiveType",S),E(M.metadata,"navigatorUserAgent",navigator.userAgent),E(M.metadata,"screenWidth",window.screen.width),E(M.metadata,"screenHeight",window.screen.height),E(M.metadata,"windowWidth",window.innerWidth),E(M.metadata,"windowHeight",window.innerHeight),E(M.metadata,"mapWidth",d.width/x),E(M.metadata,"mapHeight",d.height/x),E(M.metadata,"webglRenderer",d.renderer),E(M.metadata,"webglVendor",d.vendor),E(M.metadata,"sdkVersion",Gr),E(M.metadata,"sdkIdentifier","mapbox-gl-js"),M})(n);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,(()=>{}),l)}}
14,cr=er.postPerformanceEvent.bind(er),Qr=new class extends Ln{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,n,c){if(!o.e.API_URL||!o.e.SESSION_PATH)return;const d=ki(o.e.API_URL+o.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||o.e.ACCESS_TOKEN||""}`);const f={url:cn(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=o.g(f,(m=>{this.pendingRequest=null,n(m),this.saveEventData(),this.processRequests(c)}))}getSessionAPI(l,t,n,c){this.skuToken=t,this.errorCb=c,o.e.SESSION_PATH&&o.e.API_URL&&(n||o.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Cr)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,(c=>{c?this.errorCb(c):t&&(this.success[t]=!0)}),l)}remove(){this.errorCb=null}},tr=Qr.getSessionAPI.bind(Qr),zs=new Set;function Rs(l,t){t?zs.add(l):zs.delete(l)}class Ba{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,n){this._updatedSourceCaches[t]=n,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const n=t.scope;this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._updatedLayers[n].add(t.id),this.setDirty()}removeLayer(t){const n=t.scope;this._removedLayers[n]=this._removedLayers[n]||{},this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._removedLayers[n][t.id]=t,this._updatedLayers[n].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 n in this._updatedLayers)t[n]=t[n]||{},t[n].updatedIds=Array.from(this._updatedLayers[n].values());for(const n in this._removedLayers)t[n]=t[n]||{},t[n].removedIds=Object.keys(this._removedLayers[n]);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,n){this._updatedImages[n]=this._updatedImages[n]||new Set,this._updatedImages[n].add(o.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 Fn(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class ir extends o.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"&&o.t()&&(this.imageRasterizerDispatcher=new o.D(o.x(),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 o.r({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 n=this.atlasTexture.get(t);n&&(n.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,n){this.imageProviders.has(n)||this.imageProviders.set(n,new Map),this.imageProviders.get(n).set(t.id,t)}removeImageProvider(t,n){this.imageProviders.has(n)&&this.imageProviders.get(n).delete(t)}getPendingImageProviders(){const t=[];for(const n of this.imageProviders.values())for(const c of n.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new o.y),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,n){if(this.loaded.get(n)!==t&&(this.loaded.set(n,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,n,d);this.requestors=[]}}hasImage(t,n){return!!this.getImage(t,n)}getImage(t,n){return this.images.get(n).get(t.toString())}
vendor: 5,815 bytes, line 14
14addImage(t,n,c){this._validate(t,c)&&this.images.get(n).set(t.toString(),c)}_validate(t,n){let c=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new o.z(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,n){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||n<d[1])return!1;c=d[1]}return!0}_validateContent(t,n){return t?t.length!==4||!n.usvg&&(t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,n,c){const d=this.images.get(n).get(t.toString());c.version=d.version+1,this.images.get(n).set(t.toString(),c),this.updatedImages.get(n).add(t),this.removeFromImageRasterizerCache(t,n)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,n){this.spriteFormat!=="raster"&&(o.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:n}):this.imageRasterizer.removeImagesFromCacheByIds([t],n))}removeImage(t,n){const c=this.images.get(n),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(n).delete(t.toString()),this.removeFromImageRasterizerCache(t,n),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map((n=>o.I.from(n)))}getImages(t,n,c){const d=[],f=[],m=this.imageProviders.get(n);for(const S of t){if(!S.iconsetId){d.push(S);continue}const M=m.get(S.iconsetId);M&&(this.getImage(S,n)?f.push(S):M.addPendingRequest(S))}if(d.length===0)return void this._notify(f,n,c);let y=!0;const x=!!this.loaded.get(n),T=this.images.get(n);if(!x)for(const S of d)T.has(S.toString())||(y=!1);x||y?this._notify(d,n,c):this.requestors.push({ids:d,scope:n,callback:c})}rasterizeImages(t,n){const c=new Map,{tasks:d,scope:f}=t;for(const[m,y]of d.entries()){const x=this.getImage(y.id,f);x&&c.set(m,{image:x,imageVariant:y})}this._rasterizeImages(f,c,n)}_rasterizeImages(t,n,c){if(o.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:n,scope:t},c);else{const d=new Map;for(const[f,{image:m,imageVariant:y}]of n.entries())d.set(f,this.imageRasterizer.rasterize(y,m,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,n,c){const d=this.images.get(n),f=new Map;for(const m of t){if(!d.get(m.toString())){if(m.iconsetId)continue;this.fire(new o.A("styleimagemissing",{id:m.name}))}const y=d.get(m.toString());if(!y){o.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}),f.set(o.I.toString(m),x)}c(null,f)}getPixelSize(t){const{width:n,height:c}=this.atlasImage.get(t);return{width:n,height:c}}getPattern(t,n,c){const d=t.toString(),f=this.patterns.get(n),m=f.get(d),y=this.getImage(t,n);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,n);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const T=new o.B(t).scaleSelf(o.q.devicePixelRatio),S=new Map([[T.toString(),{image:y,imageVariant:T}]]);return this._rasterizeImages(n,S,((M,E)=>this.storePatternImage(T,n,y,c,E))),null}this.storePattern(t,n,y)}return this._updatePatternAtlas(n,c),f.get(d).position}getPatternInFlightId(t,n){return o.C(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,c,d,f){const m=t.toString(),y=f?f.get(m):void 0;y&&(c.data=y,this.storePattern(t.id,n,c),this._updatePatternAtlas(n,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),n)))}storePattern(t,n,c){const d={w:c.data.width+2*o.F,h:c.data.height+2*o.F,x:0,y:0},f=new o.G(d,c,o.F);this.patterns.get(n).set(t.toString(),{bin:d,position:f})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,n){const c=t.gl;let d=this.atlasTexture.get(n);d?this.dirty&&(d.update(this.atlasImage.get(n)),this.dirty=!1):(d=new o.T(t,this.atlasImage.get(n),c.RGBA8),this.atlasTexture.set(n,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,n){const c=this.patterns.get(t),d=Array.from(c.values()).map((({bin:T})=>T)),{w:f,h:m}=o.H(d),y=this.atlasImage.get(t);y.resize({width:f||1,height:m||1});const x=this.images.get(t);for(const[T,{bin:S,position:M}]of c.entries()){let E=M.padding;const C=S.x+E,D=S.y+E,z=x.get(T).data,F=z.width,L=z.height;E=E>1?E-1:E,o.r.copy(z,y,{x:0,y:0},{x:C,y:D},{width:F,height:L},n),o.r.copy(z,y,{x:0,y:L-E},{x:C,y:D-E},{width:F,height:E},n),o.r.copy(z,y,{x:0,y:0},{x:C,y:D+L},{width:F,height:E},n),o.r.copy(z,y,{x:F-E,y:0},{x:C-E,y:D},{width:E,height:L},n),o.r.copy(z,y,{x:0,y:0},{x:C+F,y:D},{width:E,height:L},n),o.r.copy(z,y,{x:F-E,y:L-E},{x:C-E,y:D-E},{width:E,height:E},n),o.r.copy(z,y,{x:0,y:L-E},{x:C+F,y:D-E},{width:E,height:E},n),o.r.copy(z,y,{x:0,y:0},{x:C+F,y:D+L},{width:E,height:E},n),o.r.copy(z,y,{x:F-E,y:0},{x:C-E,y:D+L},{width:E,height:E},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
14dispatchRenderCallbacks(t,n){const c=this.images.get(n);for(const d of t){if(this.callbackDispatchedThisFrame.get(n).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(n).add(d.toString());const f=c.get(d.toString());Fn(f)&&this.updateImage(d,n,f)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function en(l){const t=l.key,n=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},f=l.style,m=l.styleSpec;let y=[];const x=o.J(n);if(x!=="object")return[new o.V(t,n,`object expected, ${x} found`)];for(const T in n){const S=T.split(".")[0];let M;d[S]?M=d[S]:c[S]?M=Di:d["*"]?M=d["*"]:c["*"]&&(M=Di),M?y=y.concat(M({key:(t&&`${t}.`)+T,value:n[T],valueSpec:c[S]||c["*"],style:f,styleSpec:m,object:n,objectKey:T},n)):y.push(new o.K(t,n[T],`unknown property "${T}"`))}for(const T in c)d[T]||c[T].required&&c[T].default===void 0&&n[T]===void 0&&y.push(new o.V(t,n,`missing required property "${T}"`));return y}function Ds(l){const t=l.value,n=l.valueSpec,c=l.style,d=l.styleSpec,f=l.key,m=l.arrayElementValidator||Di;if(o.J(t)!=="array")return[new o.V(f,t,`array expected, ${o.J(t)} found`)];if(n.length&&t.length!==n.length)return[new o.V(f,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new o.V(f,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let y={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(y.function=n.function),o.J(n.value)==="object"&&(y=n.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:`${f}[${T}]`},!0));return x}function Na(l){const t=l.key,n=l.value,c=l.valueSpec;let d=o.J(n);if(d==="number"&&n!=n&&(d="NaN"),d!=="number")return[new o.V(t,n,`number expected, ${d} found`)];if("minimum"in c){let f=c.minimum;if(o.J(c.minimum)==="array"&&(f=c.minimum[l.arrayIndex]),n<f)return[new o.V(t,n,`${n} is less than the minimum value ${f}`)]}if("maximum"in c){let f=c.maximum;if(o.J(c.maximum)==="array"&&(f=c.maximum[l.arrayIndex]),n>f)return[new o.V(t,n,`${n} is greater than the maximum value ${f}`)]}return[]}function hs(l){const t=l.valueSpec,n=o.M(l.value.type);let c,d,f,m={};const y=n!=="categorical"&&l.value.property===void 0,x=!y,T=o.J(l.value.stops)==="array"&&o.J(l.value.stops[0])==="array"&&o.J(l.value.stops[0][0])==="object",S=en({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(C){if(n==="identity")return[new o.V(C.key,C.value,'identity function may not have a "stops" property')];let D=[];const z=C.value;return D=D.concat(Ds({key:C.key,value:z,valueSpec:C.valueSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:M})),o.J(z)==="array"&&z.length===0&&D.push(new o.V(C.key,z,"array must have at least one stop")),D},default:function(C){return Di({key:C.key,value:C.value,valueSpec:t,style:C.style,styleSpec:C.styleSpec})}}});return n==="identity"&&y&&S.push(new o.V(l.key,l.value,'missing required property "property"')),n==="identity"||l.value.stops||S.push(new o.V(l.key,l.value,'missing required property "stops"')),n==="exponential"&&l.valueSpec.expression&&!o.N(l.valueSpec)&&S.push(new o.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(x&&!o.O(l.valueSpec)?S.push(new o.V(l.key,l.value,"property functions not supported")):y&&!o.Q(l.valueSpec)&&S.push(new o.V(l.key,l.value,"zoom functions not supported"))),n!=="categorical"&&!T||l.value.property!==void 0||S.push(new o.V(l.key,l.value,'"property" property is required')),S;function M(C){let D=[];const z=C.value,F=C.key;if(o.J(z)!=="array")return[new o.V(F,z,`array expected, ${o.J(z)} found`)];if(z.length!==2)return[new o.V(F,z,`array length 2 expected, length ${z.length} found`)];if(T){if(o.J(z[0])!=="object")return[new o.V(F,z,`object expected, ${o.J(z[0])} found`)];if(z[0].zoom===void 0)return[new o.V(F,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new o.V(F,z,"object stop key must have value")];const L=o.M(z[0].zoom);if(typeof L!="number")return[new o.V(F,z[0].zoom,"stop zoom values must be numbers")];if(f&&f>L)return[new o.V(F,z[0].zoom,"stop zoom values must appear in ascending order")];L!==f&&(f=L,d=void 0,m={}),D=D.concat(en({key:`${F}[0]`,value:z[0],valueSpec:{zoom:{}},style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:Na,value:E}}))}else D=D.concat(E({key:`${F}[0]`,value:z[0],style:C.style,styleSpec:C.styleSpec},z));return o.S(o.U(z[1]))?D.concat([new o.V(`${F}
14[1]`,z[1],"expressions are not allowed in function stops.")]):D.concat(Di({key:`${F}[1]`,value:z[1],valueSpec:t,style:C.style,styleSpec:C.styleSpec}))}function E(C,D){const z=o.J(C.value),F=o.M(C.value),L=C.value!==null?C.value:D;if(c){if(z!==c)return[new o.V(C.key,L,`${z} stop domain type must match previous stop domain type ${c}`)]}else c=z;if(z!=="number"&&z!=="string"&&z!=="boolean"&&typeof F!="number"&&typeof F!="string"&&typeof F!="boolean")return[new o.V(C.key,L,"stop domain value must be a number, string, or boolean")];if(z!=="number"&&n!=="categorical"){let N=`number expected, ${z} found`;return o.O(t)&&n===void 0&&(N+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o.V(C.key,L,N)]}return n!=="categorical"||z!=="number"||typeof F=="number"&&isFinite(F)&&Math.floor(F)===F?n!=="categorical"&&z==="number"&&typeof F=="number"&&typeof d=="number"&&d!==void 0&&F<d?[new o.V(C.key,L,"stop domain values must appear in ascending order")]:(d=F,n==="categorical"&&F in m?[new o.V(C.key,L,"stop domain values must be unique")]:(m[F]=!0,[])):[new o.V(C.key,L,`integer expected, found ${String(F)}`)]}}function gn(l){const t=(l.expressionContext==="property"?o.W:o.X)(o.U(l.value),l.valueSpec);if(t.result==="error")return t.value.map((c=>new o.V(`${l.key}${c.key}`,l.value,c.message)));const n=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!n.outputDefined())return[new o.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"&&!o.Y(n))return[new o.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return hn(n,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!o.Z(n,["zoom","feature-state"]))return[new o.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!o._(n))return[new o.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function hn(l,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.delete(
14d);if(n.size===0)return[];const c=[];return l instanceof o.$&&n.has(l.name)?[new o.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(...hn(d,t))})),c)}function us(l){const t=l.key,n=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${c.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(c.values).indexOf(o.M(n))===-1&&d.push(new o.V(t,n,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function ds(l){return o.a1(o.U(l.value))?gn(o.L({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):fo(l)}function fo(l){const t=l.value,n=l.key;if(o.J(t)!=="array")return[new o.V(n,t,`array expected, ${o.J(t)} found`)];const c=l.styleSpec;let d,f=[];if(t.length<1)return[new o.V(n,t,"filter array must have at least 1 element")];switch(f=f.concat(us({key:`${n}[0]`,value:t[0],valueSpec:c.filter_operator,style:l.style,styleSpec:l.styleSpec})),o.M(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&o.M(t[1])==="$type"&&f.push(new o.V(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&f.push(new o.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=o.J(t[1]),d!=="string"&&f.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`)));for(let m=2;m<t.length;m++)d=o.J(t[m]),o.M(t[1])==="$type"?f=f.concat(us({key:`${n}[${m}]`,value:t[m],valueSpec:c.geometry_type,style:l.style,styleSpec:l.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&f.push(new o.V(`${n}[${m}]`,t[m],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)f=f.concat(fo({key:`${n}[${m}]`,value:t[m],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":d=o.J(t[1]),t.length!==2?f.push(new o.V(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):d!=="string"&&f.push(new o.V(`${n}[1]`,t[1],`string expected, ${d} found`))}return f}function Vo(l,t){const n=l.key,c=l.style,d=l.layer,f=l.styleSpec,m=l.value,y=l.objectKey,x=f[`${t}_${l.layerType}`];if(!x)return[];const T=y.match(/^(.*)-use-theme$/);if(t==="paint"&&T&&x[T[1]])return o.S(m)?[].concat(Di({key:l.key,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:f,expressionContext:"property",propertyType:t,propertyKey:y})):Di({key:n,value:m,valueSpec:{type:"string"},style:c,styleSpec:f});const S=y.match(/^(.*)-transition$/);if(t==="paint"&&S&&x[S[1]]&&x[S[1]].transition)return Di({key:n,value:m,valueSpec:f.transition,style:c,styleSpec:f});const M=l.valueSpec||x[y];if(!M)return[new o.K(n,m,`unknown property "${y}"`)];let E;if(o.J(m)==="string"&&o.O(M)&&!M.tokens&&(E=/^{([^}]+)}$/.exec(m))){const D=`\`{ "type": "identity", "property": ${E?JSON.stringify(E[1]):'"_"'} }\``;return[new o.V(n,m,`"${y}" does not support interpolation syntax 15Use an identity property function instead: ${D}.`)]}const C=[];if(l.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||C.push(new o.V(n,m,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&o.a2(o.U(m))&&o.M(m.type)==="identity"&&C.push(new o.V(n,m,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&o.O(M)&&(o.a3(M)||o.Q(M))){const D=o.W(o.U(m),M),z=D.value.expression||D.value._styleExpression.expression;z&&!o.Z(z,["measure-light"])&&(y==="model-emissive-strength"&&o._(z)&&o.Y(z)||C.push(new o.V(n,m,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return C.concat(Di({key:l.key,value:m,valueSpec:M,style:c,styleSpec:f,expressionContext:"property",propertyType:t,propertyKey:y}))}function tn(l){return Vo(l,"paint")}function yn(l){return Vo(l,"layout")}function Va(l){let t=[];const n=l.value,c=l.key,d=l.style,f=l.styleSpec;n.type||n.ref||t.push(new o.V(c,n,'either "type" or "ref" is required'));let m=o.M(n.type);const y=o.M(n.ref);
15if(n.id){const x=o.M(n.id);for(let T=0;T<l.arrayIndex;T++){const S=d.layers[T];o.M(S.id)===x&&t.push(new o.V(c,n.id,`duplicate layer id "${n.id}", previously used at line ${S.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach((T=>{T in n&&t.push(new o.V(c,n[T],`"${T}" is prohibited for ref layers`))})),d.layers.forEach((T=>{o.M(T.id)===y&&(x=T)})),x?x.ref?t.push(new o.V(c,n.ref,"ref cannot reference another ref layer")):m=o.M(x.type):typeof y=="string"&&t.push(new o.V(c,n.ref,`ref layer "${y}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(n.source){const x=d.sources&&d.sources[n.source],T=x&&o.M(x.type);x?T==="vector"&&m==="raster"?t.push(new o.V(c,n.source,`layer "${n.id}" requires a raster source`)):T==="raster"&&m!=="raster"?t.push(new o.V(c,n.source,`layer "${n.id}" requires a vector source`)):T!=="vector"||n["source-layer"]?T==="raster-dem"&&m!=="hillshade"?t.push(new o.V(c,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&T==="geojson"&&!x.lineMetrics?t.push(new o.V(c,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&T!=="raster-array"&&t.push(new o.V(c,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):t.push(new o.V(c,n.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new o.V(c,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new o.V(c,n.source,`source "${n.source}" not found`))}else t.push(new o.V(c,n,'missing required property "source"'));return t=t.concat(en({key:c,value:n,valueSpec:f.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Di({key:`${c}.type`,value:n.type,valueSpec:f.layer.type,style:l.style,styleSpec:l.styleSpec,object:n,objectKey:"type"}),filter:x=>ds(o.L({layerType:m},x)),layout:x=>en({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>yn(o.L({layerType:m},T))}}),paint:x=>en({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>tn(o.L({layerType:m,layer:n},T))}})}})),t}function fs(l){const t=l.value,n=l.key,c=o.J(t);return c!=="string"?[new o.V(n,t,`string expected, ${c} found`)]:[]}const Uo={promoteId:function l({key:t,value:n}){if(o.J(n)==="string")return fs({key:t,value:n});if(Array.isArray(n)){const c=[],d=o.U(n),f=o.X(d);return f.result==="error"&&f.value.forEach((m=>{c.push(new o.V(`${t}${m.key}`,null,`${m.message}`))})),o.Z(f.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"])||c.push(new o.V(`${t}`,null,"promoteId expression should be only feature dependent")),c}{const c=[];for(const d in n)c.push(...l({key:`${t}.${d}`,value:n[d]}));return c}}};function Or(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new o.V(n,t,'"type" is required')];const f=o.M(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(f)&&(t.url||t.tiles||m.push(new o.K(n,t,'Either "url" or "tiles" is required.'))),f){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat(en({key:n,value:t,valueSpec:c[`source_${f.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:Uo})),m;case"geojson":if(m=en({key:n,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:Uo}),t.cluster)for(const y in t.clusterProperties){const[x,T]=t.clusterProperties[y],S=typeof x=="string"?[x,["accumulated"],["get",y]]:x;m.push(...gn({key:`${n}.${y}.map`,value:T,expressionContext:"cluster-map"})),m.push(...gn({key:`${n}.${y}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return m;case"video":return en({key:n,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return en({key:n,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new o.V(n,null,"Please use runtime APIs to add canvas sources, rather than
15including them in stylesheets.","source.canvas")];default:return us({key:`${n}.type`,value:t.type,valueSpec:{values:xn(c)}})}}function xn(l){return l.source.reduce(((t,n)=>{const c=l[n];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values))),t}),[])}function Ls(l){const t=l.value,n=l.styleSpec,c=n.light,d=l.style;let f=[];const m=o.J(t);if(t===void 0)return f;if(m!=="object")return f=f.concat([new o.V("light",t,`object expected, ${m} found`)]),f;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);f=f.concat(T&&c[T[1]]?Di({key:y,value:t[y],valueSpec:{type:"string"},style:d,styleSpec:n}):x&&c[x[1]]&&c[x[1]].transition?Di({key:y,value:t[y],valueSpec:n.transition,style:d,styleSpec:n}):c[y]?Di({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}):[new o.V(y,t[y],`unknown property "${y}"`)])}return f}function ps(l){const t=l.value;let n=[];if(!t)return n;const c=o.J(t);if(c!=="object")return n=n.concat([new o.V("light-3d",t,`object expected, ${c} found`)]),n;const d=l.styleSpec,f=d["light-3d"],m=l.key,y=l.style,x=l.style.lights;for(const M of["type","id"])if(!(M in t))return n=n.concat([new o.V("light-3d",t,`missing property ${M} on light`)]),n;if(t.type&&x)for(let M=0;M<l.arrayIndex;M++){const E=o.M(t.type),C=x[M];o.M(C.type)===E&&n.push(new o.V(m,t.id,`duplicate light type "${t.type}", previously defined at line ${C.id.__line__}`))}const T=`properties_light_${t.type}`;if(!(T in d))return n=n.concat([new o.V("light-3d",t,`Invalid light type ${t.type}`)]),n;const S=d[T];for(const M in t)if(M==="properties"){const E=t[M],C=o.J(E);if(C!=="object")return n=n.concat([new o.V("properties",E,`object expected, ${C} found`)]),n;for(const D in E){const z=D.match(/^(.*)-transition$/),F=D.match(/^(.*)-use-theme$/);n=n.concat(F&&S[F[1]]?Di({key:M,value:E[D],valueSpec:{type:"string"},style:y,styleSpec:d}):z&&S[z[1]]&&S[z[1]].transition?Di({key:M,value:t[M],valueSpec:d.transition,style:y,styleSpec:d}):S[D]?Di({key:D,value:E[D],valueSpec:S[D],style:y,styleSpec:d}):[new o.K(l.key,E[D],`unknown property "${D}"`)])}}else n=n.concat(f[M]?Di({key:M,value:t[M],valueSpec:f[M],style:y,styleSpec:d}):[new o.K(M,t[M],`unknown property "${M}"`)]);return n}function Fs(l){const t=l.value,n=l.key,c=l.style,d=l.styleSpec,f=d.terrain;let m=[];const y=o.J(t);if(t===void 0||y==="null")return m;if(y!=="object")return m=m.concat([new o.V("terrain",t,`object expected, ${y} found`)]),m;for(const x in t){const T=x.match(/^(.*)-transition$/),S=x.match(/^(.*)-use-theme$/);m=m.concat(S&&f[S[1]]?Di({key:x,value:t[x],valueSpec:{type:"string"},style:c,styleSpec:d}):T&&f[T[1]]&&f[T[1]].transition?Di({key:x,value:t[x],valueSpec:d.transition,style:c,styleSpec:d}):f[x]?Di({key:x,value:t[x],valueSpec:f[x],style:c,styleSpec:d}):[new o.K(x,t[x],`unknown property "${x}"`)])}if(t.source){const x=c.sources&&c.sources[t.source],T=x&&o.M(x.type);x?T!=="raster-dem"&&m.push(new o.V(n,t.source,`terrain cannot be used with a source of type ${String(T)}, it only be used with a "raster-dem" source type`)):m.push(new o.V(n,t.source,`source "${t.source}" not found`))}else m.push(new o.V(n,t,'terrain is missing required property "source"'));return m}function Os(l){const t=l.value,n=l.style,c=l.styleSpec,d=c.fog;let f=[];const m=o.J(t);if(t===void 0)return f;if(m!=="object")return f=f.concat([new o.V("fog",t,`object expected, ${m} found`)]),f;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);f=f.concat(T&&d[T[1]]?Di({key:y,value:t[y],valueSpec:{type:"string"},style:n,styleSpec:c}):x&&d[x[1]]&&d[x[1]].transition?Di({key:y,value:t[y],valueSpec:c.transition,style:n,styleSpec:c}):d[y]?Di({key:y,value:t[y],valueSpec:d[y],style:n,styleSpec:c}):[new o.K(y,t[y],`unknown property "${y}"`)])}return f}const jo={"*":()=>[],array:Ds,boolean:function(l){const t=l.value,n=l.key,c=o.J(t);return c!=="boolean"?[new o.V(n,t,`boolean expected, ${c} found`)]:[]},number:Na,color:function(l){const t=l.key,n=l.value,c=o.J(n);return c!=="string"?[new o.V(t,n,`color expected, ${c} found`)]:o.a0.parseCSSColor(n)===null?[new o.V(t,n,`color expected, "${n}" found`)]:[]},enum:us,filter:ds,function:hs,layer:Va,object:en,source:Or,model:o.a4,light:Ls,"light-3d":ps,terrain:Fs,fog:Os,string:fs,formatted:function(l){return fs(l).length===0?[]:gn(l)},resolvedImage:function(l){return fs(l).length===0?[]:gn(l)},projection:function(l){const t=l.value,n=l.styleSpec,c=n.projection,d=l.style;let f=[];const m=o.J(t);if(m==="object")for(const y in t)f=f.concat(Di({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}));else m!=="string"&&(f=f.concat([new o.V("projection",t,`object or string expected, ${m}
15 found`)]));return f},import:function(l){const{value:t,styleSpec:n}=l,{data:c,...d}=t;Object.defineProperty(d,"__line__",{value:t.__line__,enumerable:!1});let f=en(o.L({},l,{value:d,valueSpec:n.import}));return o.M(d.id)===""&&f.push(new o.V(`${l.key}.id`,d,"import id can't be an empty string")),c&&(f=f.concat(ja(c,n,{key:`${l.key}.data`}))),f},iconset:function(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new o.V(n,t,'"type" is required')];const f=o.M(t.type);let m=[];if(m=m.concat(en({key:n,value:t,valueSpec:c[`iconset_${f}`],style:d,styleSpec:c})),f==="source"&&t.source){const y=d.sources&&d.sources[t.source],x=y&&o.M(y.type);y?x!=="raster-array"&&m.push(new o.V(n,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 o.V(n,t.source,`source "${t.source}" not found`))}return m}};function Di(l,t=!1){const n=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression&&o.a2(o.M(n)))return hs(l);if(c.expression&&o.S(o.U(n)))return gn(l);if(c.type&&jo[c.type]){const f=jo[c.type](l);return t===!0&&f.length>0&&o.J(l.value)==="array"?gn(l):f}return en(o.L({},l,{valueSpec:c.type?d[c.type]:c}))}function Ua(l){const t=l.value,n=l.key,c=fs(l);return c.length||(t.indexOf("{fontstack}")===-1&&c.push(new o.V(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&c.push(new o.V(n,t,'"glyphs" url must include a "{range}" token'))),c}function ja(l,t=o.a5,n={}){return Di({key:n.key||"",value:l,valueSpec:t.$root,styleSpec:t,style:l,objectElementValidators:{glyphs:Ua,"*":()=>[]}})}function vn(l,t=o.a5){return ne(ja(l,t))}const Ga=l=>ne(Or(l)),uh=l=>ne(Ls(l)),Go=l=>ne(ps(l)),ke=l=>ne(Fs(l)),ms=l=>ne(Os(l)),dh=l=>ne((function(t){const n=t.value,c=t.style,d=t.styleSpec,f=d.snow;let m=[];const y=o.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new o.V("snow",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&f[T[1]]&&f[T[1]].transition?Di({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):f[x]?Di({key:x,value:n[x],valueSpec:f[x],style:c,styleSpec:d}):[new o.K(x,n[x],`unknown property "${x}"`)])}return m})(l)),qa=l=>ne((function(t){const n=t.value,c=t.style,d=t.styleSpec,f=d.rain;let m=[];const y=o.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new o.V("rain",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&f[T[1]]&&f[T[1]].transition?Di({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):f[x]?Di({key:x,value:n[x],valueSpec:f[x],style:c,styleSpec:d}):[new o.K(x,n[x],`unknown property "${x}"`)])}return m})(l)),ei=l=>ne(Va(l)),ge=l=>ne(ds(l)),k=l=>ne(tn(l)),B=l=>ne(yn(l)),Z=l=>ne(o.a4(l));function ne(l){return l.slice().sort(((t,n)=>t.line&&n.line?t.line-n.line:0))}function W(l,t){let n=!1;if(t&&t.length)for(const c of t)c instanceof o.K?o.w(c.message):(l.fire(new o.z(new Error(c.message))),n=!0);return n}let le;class ve extends o.E{constructor(t,n="flat"){super(),this._transitionable=new o.a6(le||(le=new o.a7({anchor:new o.a8(o.a5.light.anchor),position:new o.a9(o.a5.light.position),color:new o.a8(o.a5.light.color),intensity:new o.a8(o.a5.light.intensity)}))),this.setLight(t,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n,c={}){this._validate(uh,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=n)}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,n,c){return(!c||c.validate!==!1)&&W(this,t.call(vn,o.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let he=class extends o.E{constructor(l,t,n,c,d){super(),this.scope=n,this._transitionable=new o.a6(new o.a7({source:new o.a8(o.a5.terrain.source),exaggeration:new o.a8(o.a5.terrain.exaggeration)}),n,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 o.aa(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 n=-1,c=-1,d=1;for(const f of t.zoomStops)d=t.evaluate(new o.aa(f,{worldview:this.worldview})),d>.01?(n=f,c=-1):c=f;return d<.01&&n>0&&c>n?[n,c]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof o.ab}};const ye=45,qe=65,Pe=.05;function ft(l,t,n,c){const d=o.af(ye,qe,n),[f,m]=bt(l,c);let y=1-Math.min(1,Math.exp((t-f)/(m-f)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function bt(l,t){const n=.5/Math.tan(.5*t);return[l.range[0]+n,l.range[1]+n]}function St(l,t,n,c,d){const f=o.ad([],[t,n,c],d.mercatorFogMatrix);return ft(l,o.ae(f),d.pitch,d._fov)}function Ut(l,t,n,c,d,f,m){const y=[[n,c,0],[d,c,0],[d,f,0],[n,f,0]];let x=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of y){const M=o.ad([],S,t),E=o.ae(M);x=Math.min(x,E),T=Math.max(T,E)}return[ft(l,x,m.pitch,m._fov),ft(l,T,m.pitch,m._fov)]}class Ft extends o.E{constructor(t,n,c,d){super();const f=new o.a7({range:new o.a8(o.a5.fog.range),color:new o.a8(o.a5.fog.color),"color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new o.a8(o.a5.fog["high-color"]),"high-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new o.a8(o.a5.fog["space-color"]),"space-color-use-theme":new o.a8({type:"string","property-type":"data-constant",default:"default"}
15),"horizon-blend":new o.a8(o.a5.fog["horizon-blend"]),"star-intensity":new o.a8(o.a5.fog["star-intensity"]),"vertical-range":new o.a8(o.a5.fog["vertical-range"])});this._transitionable=new o.a6(f,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=n,this.properties=new o.ag(f),this.scope=c}get state(){const t=this._transform,n=t.projection.name==="globe",c=o.ah(t.zoom),d=this.properties.get("range"),f=[.5,3];return{range:n?[o.ai(f[0],d[0],c),o.ai(f[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,n,c={}){if(this._validate(ms,t,c))return;const d=o.h({},t);for(const f of Object.keys(o.a5.fog))d[f]===void 0&&(d[f]=o.a5.fog[f].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,n)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const n=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:o.af(ye,qe,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?(function(c,d,f){const m=o.ac.fromLngLat(d),y=f.elevation?f.elevation.getAtPointOrZero(m):0;return St(c,m.x,m.y,y,f)})(this.state,t,n):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const n=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Ut(this.state,n,0,0,o.aj,o.aj,this._transform)}getOpacityForBounds(t,n,c,d,f){return this._transform.projection.supportsFog?Ut(this.state,t,n,c,d,f,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?bt(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const n=[4,5,6,7];for(const c of n){const d=t.points[c];let f;if(d[2]>=0)f=d;else{const m=t.points[c-4];f=o.ak(m,d,m[2]/(m[2]-d[2]))}if(St(this.state,f[0],f[1],0,this._transform)>=Pe)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,n,c){return(!c||c.validate!==!1)&&W(this,t.call(vn,o.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}}let jt,bi,Gt,Ki,yr=class extends o.E{constructor(l,t,n,c){super();const d=jt||(jt=new o.a7({density:new o.a8(o.a5.snow.density),intensity:new o.a8(o.a5.snow.intensity),color:new o.a8(o.a5.snow.color),opacity:new o.a8(o.a5.snow.opacity),vignette:new o.a8(o.a5.snow.vignette),"vignette-color":new o.a8(o.a5.snow["vignette-color"]),"center-thinning":new o.a8(o.a5.snow["center-thinning"]),direction:new o.a8(o.a5.snow.direction),"flake-size":new o.a8(o.a5.snow["flake-size"])}));this._transitionable=new o.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=o.al(n[0]),d=-Math.max(o.al(n[1]),.01),f=[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 o.am(t.r,t.g,t.b,t.a*l),direction:f,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(dh,l,n))return;const c=o.h({},l);for(const d of Object.keys(o.a5.snow))c[d]===void 0&&(c[d]=o.a5.snow[d].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,n){return(!n||n.validate!==!1)&&W(this,l.call(vn,o.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}},dr=class extends o.E{constructor(l,t,n,c){super();const d=bi||(bi=new o.a7({density:new o.a8(o.a5.rain.density),intensity:new o.a8(o.a5.rain.intensity),color:new o.a8(o.a5.rain.color),opacity:new o.a8(o.a5.rain.opacity),vignette:new o.a8(o.a5.rain.vignette),"vignette-color":new o.a8(o.a5.rain["vignette-color"]),"center-thinning":new o.a8(o.a5.rain["center-thinning"]),direction:new o.a8(o.a5.rain.direction),"droplet-size":new o.a8(o.a5.rain["droplet-size"]),"distortion-strength":new o.a8(o.a5.rain["distortion-strength"])}));this._transitionable=new o.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new o.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=o.al(n[0]),d=-Math.max(o.al(n[1]),.01),f=[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 o.am(t.r,t.g,t.b,t.a*l),direction:f,centerThinning:this.properties.get("center-thinning"),droplet
15Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:m}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(qa,l,n))return;const c=o.h({},l);for(const d of Object.keys(o.a5.rain))c[d]===void 0&&(c[d]=o.a5.rain[d].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,n){return(!n||n.validate!==!1)&&W(this,l.call(vn,o.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:o.a5})))}};class gi extends o.E{constructor(t,n,c,d){super(),this.scope=c,this._options=t,this.properties=new o.ag(n),this._transitionable=new o.a6(n,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,n){this._options=t,this._transitionable.setTransitionOrValue(t.properties,n)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ri{constructor(t,n,c){this.screenBounds=t,this.cameraPoint=c.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,c)}static createFromScreenPoints(t,n){let c,d;if(t instanceof o.P||typeof t[0]=="number"){const f=o.P.convert(t);c=[f],d=n.isPointAboveHorizon(f)}else{const f=o.P.convert(t[0]),m=o.P.convert(t[1]),y=f.add(m)._div(2);c=[f,m],d=o.ao(f,m).every((x=>n.isPointAboveHorizon(x)))&&n.isPointAboveHorizon(y)}return new ri(c,d,n)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return o.ao(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.ao(n,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(d[3]=this.cameraPoint)),o.ap(d,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new o.P(1,1)):this.screenBounds[1],d=o.ao(n,c,t),f=this.cameraPoint.clone();switch(3*((f.y>n.y)+(f.y>c.y))+((f.x>n.x)+(f.x>c.x))){case 0:d[0]=f,d[4]=f.clone();break;case 1:d.splice(1,0,f);break;case 2:d[1]=f;break;case 3:d.splice(4,0,f);break;case 5:d.splice(2,0,f);break;case 6:d[3]=f;break;case 7:d.splice(3,0,f);break;case 8:d[2]=f}return d}containsTile(t,n,c,d=0){const f=t.queryPadding/n._pixelsPerMercatorPixel+1,m=c?this._bufferedCameraMercator(f,n):this._bufferedScreenMercator(f,n);let y=t.tileID.wrap+(m.unwrapped?d:0);const x=m.polygon.map((F=>o.aq(t.tileTransform,F,y)));if(!o.ar(x,0,0,o.aj,o.aj))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map((F=>o.as(t.tileTransform,F,y))),S=T.map((F=>new o.P(F[0],F[1]))),M=n.getFreeCameraOptions().position||new o.ac(0,0,0),E=o.as(t.tileTransform,M,y),C=T.map((F=>{const L=o.at(F,F,E);return o.au(L,L),new o.av(E,L)})),D=o.aw(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:C,bufferedTilespaceGeometry:x,bufferedTilespaceBounds:(z=o.ax(x),z.min.x=o.ay(z.min.x,0,o.aj),z.min.y=o.ay(z.min.y,0,o.aj),z.max.x=o.ay(z.max.x,0,o.aj),z.max.y=o.ay(z.max.y,0,o.aj),z),tile:t,t
15ileID:t.tileID,pixelToTileUnitsFactor:D};var z}_bufferedScreenMercator(t,n){const c=Bi(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),n):{polygon:this.bufferedScreenGeometry(t).map((f=>n.pointCoordinate3D(f))),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,n){const c=Bi(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),n):{polygon:this.bufferedCameraGeometry(t).map((f=>n.pointCoordinate3D(f))),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,n){const c=(function(f,m){const y=o.az([],m.pixelMatrix,m.globeMatrix),x=[0,-o.aB,0,1],T=[0,o.aB,0,1],S=[0,0,0,1];o.aA(x,x,y),o.aA(T,T,y),o.aA(S,S,y);const M=new o.P(x[0]/x[3],x[1]/x[3]),E=new o.P(T[0]/T[3],T[1]/T[3]),C=o.aC(f,M)&&x[3]<S[3],D=o.aC(f,E)&&T[3]<S[3];if(!C&&!D)return null;const z=(function(ie,Y,K){for(let J=1;J<ie.length;J++){const pe=qi(Y.pointCoordinate3D(ie[J-1]).x),oe=qi(Y.pointCoordinate3D(ie[J]).x);if(K<0){if(pe<oe)return{idx:J,t:-pe/(oe-1-pe)}}else if(oe<pe)return{idx:J,t:(1-pe)/(oe+1-pe)}}return null})(f,m,C?-1:1);if(!z)return null;const{idx:F,t:L}=z;let N=F>1?Xi(f.slice(0,F),m):[],j=F<f.length?Xi(f.slice(F),m):[];N=N.map((ie=>new o.P(qi(ie.x),ie.y))),j=j.map((ie=>new o.P(qi(ie.x),ie.y)));const q=[...N];q.length===0&&q.push(j[j.length-1]);const X=o.ai(q[q.length-1].y,(j.length===0?N[0]:j[0]).y,L);let ee;return ee=C?[new o.P(0,X),new o.P(0,0),new o.P(1,0),new o.P(1,X)]:[new o.P(1,X),new o.P(1,1),new o.P(0,1),new o.P(0,X)],q.push(...ee),j.length===0?q.push(N[0]):q.push(...j),{polygon:q.map((ie=>new o.ac(ie.x,ie.y))),unwrapped:!1}})(t,n);if(c)return c;const d=(function(f,m){let y=!1,x=-1/0,T=0;for(let M=0;M<f.length-1;M++)f[M].x>x&&(x=f[M].x,T=M);for(let M=0;M<f.length-1;M++){const E=(T+M)%(f.length-1),C=f[E],D=f[E+1];Math.abs(C.x-D.x)>.5&&(C.x<D.x?(C.x+=1,E===0&&(f[f.length-1].x+=1)):(D.x+=1,E+1===f.length-1&&(f[0].x+=1)),y=!0)}const S=o.aD(m.center.lng);return y&&S<Math.abs(S-1)&&f.forEach((M=>{M.x-=1})),{polygon:f,unwrapped:y}})(Xi(t,n).map((f=>new o.P(qi(f.x),f.y))),n);return{polygon:d.polygon.map((f=>new o.ac(f.x,f.y))),unwrapped:d.unwrapped}}}function Xi(l,t){return o.aE(l,(n=>{const c=t.pointCoordinate3D(n);n.x=c.x,n.y=c.y}),1/256)}function qi(l){return l<0?1+l%1:l%1}function Bi(l){return 100*l|0}function wr(l,t,n,c,d){const f=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 S of x.variants){if(S==null||typeof S!="object"||S.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(S.capabilities))return d(new Error("capabilities must be an array"));if(S.capabilities.length===1&&S.capabilities[0]==="meshopt"){x=o.h(x,S);break}}}const T=o.aF(o.h({},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 S=Object.values(y.language||{});if(S.length===0)return null;const M=Object.values(y.worldview||{});if(M.length===0)return null;const E=S.every((D=>D===x)),C=M.every((D=>D===T));return E&&C?y:x in(y.language_options||{})||T in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null})(l.data,n,c);return m?o.q.frame((()=>f(null,m))):l.url?o.n(t.transformRequest(t.normalizeSourceURL(l.url,null,n,c),o.R.Source),f):o.q.frame((()=>{const{data:y,...x}=l;f(null,x)}))}function rn(l,t){const n=Math.pow(2,t.z),c=Math.floor(o.aD(l.getWest())*n),d=Math.floor(o.aH(l.getNorth())*n),f=Math.ceil(o.aD(l.getEast())*n),m=Math.ceil(o.aH(l.getSouth())*n);return t.x>=c&&t.x<f&&t.y>=d&&t.y<m}class kr{constructor(t,n,c){this.bounds=t?o.aG.convert(this.validateBounds(t)):null,this.minzoom=n||0,this.maxzoom=c||24}
15validateBounds(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 n of t)this.extraBounds.push(o.aG.convert(this.validateBounds(n)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!rn(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const n of this.extraBounds)if(rn(n,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const n=new kr(t.bounds,t.minzoom,t.maxzoom);return n.addExtraBounds(t.extra_bounds),n}}class Ha extends o.E{constructor(t,n,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,o.h(this,o.aF(n,["url","scheme","tileSize","promoteId"])),this._options=o.h({type:"vector"},n),this._collectResourceTiming=!!n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new o.aI}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=wr(this._options,this.map._requestManager,n,c,((d,f)=>{if(this._tileJSONRequest=null,this._loaded=!0,d)n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new o.z(d));else if(f){if(o.h(this,f),this.hasWorldviews=!!f.worldview_options,f.worldview_default&&(this.worldviewDefault=f.worldview_default),f.vector_layers){this.vectorLayers=f.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const m of f.vector_layers)this.vectorLayerIds.push(m.id),f.worldview&&f.worldview[m.source]&&this.localizableLayerIds.add(m.id)}this.tileBounds=kr.fromTileJSON(f),Hr(f.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("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=o.C(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 o.h({},this._options)}loadTile(t,n){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),f=this.map._requestManager.transformRequest(d,o.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,y=m?{image:m.image.clone()}:null,x={request:f,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
15ype,source:this.id,scope:this.scope,pixelRatio:o.q.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};if(this.hasWorldviews&&o.j(c)&&(x.localizableLayerIds=this.localizableLayerIds),x.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=n: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 S=o.aJ.call({deduped:this._deduped},x,((M,E)=>{M||!E?T.call(this,M):(x.data={cacheControl:E.cacheControl,expires:E.expires,rawData:E.rawData.slice(0)},t.actor&&t.actor.send("loadTile",x,T.bind(this),void 0,!0))}),!0);t.request={cancel:S}}function T(S,M){return delete t.request,t.aborted?n(null):S&&S.status!==404?n(S):(M&&M.resourceTiming&&(t.resourceTiming=M.resourceTiming),this.map._refreshExpiredTiles&&M&&t.setExpiryData(M),t.loadVectorData(M,this.map.painter),o.aK(this.dispatcher),n(null),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
15ype,source:this.id,scope:this.scope})}unloadTile(t,n){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 Ar extends o.E{constructor(t,n,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=o.h({type:"raster"},n),o.h(this,o.aF(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new o.A("dataloading",{dataType:"source"}));const n=this.map.getWorldview();this._tileJSONRequest=wr(this._options,this.map._requestManager,null,n,((c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new o.z(c)):d&&(o.h(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map((f=>f.id))),this.tileBounds=kr.fromTileJSON(d),Hr(d.tiles),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=o.C(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 o.h({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const c=o.q.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=o.o(this.map._requestManager.transformRequest(d,o.R.Tile),((f,m,y,x)=>(delete t.request,t.aborted?(t.state="unloaded",n(null)):f?(t.state="errored",n(f)):m?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:y,expires:x}),t.setTexture(m,this.map.painter),t.state="loaded",o.aK(this.dispatcher),void n(null)):n(null))))}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n&&n()}unloadTile(t,n){t.texture&&t.texture instanceof o.T?(t.destroy(!0),t.texture&&t.texture instanceof o.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),n&&n()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ks extends Ar{constructor(t,n,c,d){super(t,n,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=o.h({type:"raster-array"},n)}triggerRepaint(t){const n=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);n&&n.enabled&&c&&n._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,n){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,o.R.Tile),f={request:d,uid:t.uid,tileID:t.tileID,type:this.t
15ype,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,S)=>{if(delete t.request,t.aborted)return t.state="unloaded",n(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",n(y));if(this.map._refreshExpiredTiles&&x&&t.setExpiryData({cacheControl:T,expires:S}),this.partial)t.state="empty";else{if(!x)return n(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=x}n(null)};t.request=this.partial?t.fetchHeader(void 0,m.bind(this)):t.actor.send("loadTile",f,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,n){const c=t.texturePerLayer;if(t.flushAllQueues(),c.size){t.destroy(!0);for(const d of c.values())this.map.painter.saveTileTexture(d)}else t.destroy()}prepareTile(t,n,c,d){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBand(n,c,d,((f,m)=>{if(f)return t.state="errored",this.fire(new o.z(f)),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 n=this.rasterLayers.find((({id:f})=>f===t)),c=n&&n.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,n,c){if(!t)return;const d=n.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let f=null;n instanceof o.aN?f=n.paint.get("raster-array-band"):n instanceof o.aO&&(f=n.paint.get("raster-particle-array-band"));const m=f||this.getInitialBand(d);if(m==null)return;if(!t.textureDescriptorPerLayer.get(n.id))return void this.prepareTile(t,d,n.id,m);if(t.updateNeeded(n.id,m)&&!c)return;const y=t.textureDescriptorPerLayer.get(n.id);return Object.assign({},y,{texture:t.texturePerLayer.get(n.id)})}getImages(t,n){const c=new Map;for(const d of t)for(const f of n){const[m,y]=f.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(y)||!x.hasDataForBand(y))continue;const{bytes:T,tileSize:S,buffer:M}=x.getBandView(y),E=S+2*M,C={data:new o.r({width:E,height:E},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(f,C)}return c}}const Hl={vector:Ha,raster:Ar,"raster-dem":class extends Ar{constructor(l,t,n,c){super(l,t,n,c),this.type="raster-dem",this.maxzoom=22,this._options=o.h({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,f){d&&(l.state="errored",t(d)),f&&(l.dem=f,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=o.o(this.map._requestManager.transformRequest(n,o.R.Tile),(function(d,f,m,y){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(f){this.map._refreshExpiredTiles&&l.setExpiryData({cacheControl:m,expires:y});const x=ImageBitmap&&f instanceof ImageBitmap&&o.t(),T=1-(f.width-o.aL(f.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const S=x?f:o.q.getImageData(f,T),M={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
15ype,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",M,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const t=l.canonical,n=Math.pow(2,t.z),c=(t.x-1+n)%n,d=t.x===0?l.wrap-1:l.wrap,f=(t.x+1+n)%n,m=t.x+1===n?l.wrap+1:l.wrap,y={};return y[new o.aM(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,f,t.y).key]={backfilled:!1},t.y>0&&(y[new o.aM(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,f,t.y-1).key]={backfilled:!1}),t.y+1<n&&(y[new o.aM(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new o.aM(l.overscaledZ,m,t.z,f,t.y+1).key]={backfilled:!1}),y}},"raster-array":ks,geojson:class extends o.E{constructor(l,t,n,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=n.getActor(),this.setEventedParent(c),this._data=t.data,this._options=o.h({},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=o.aj/this.tileSize;this.workerOptions=o.h({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:o.aj,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:o.aj,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 o.z(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 o.z(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 n of this._data.features)t.set(n.id,n);for(const n of l.features)t.set(n.id,n);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,n,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:n},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new o.A("dataloading",{dataType:"source"})),this._loaded=!1;const t=o.h({append:l},this.workerOptions);t.scope=this.scope;const n=this._data;typeof n=="string"?(t.request=this.map._requestManager.transformRequest(o.q.resolveURL(n),o.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,((c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new o.z(c));else{const f={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(f.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new o.A("data",f)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)}))}loaded(){return this._loaded}reload(){const l=o.C(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const n=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()}
15:null,f=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:o.q.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:f,worldview:this.map.getWorldview()};l.request=this.actor.send(n,m,((y,x)=>f&&!x?(l.state="loaded",t(null)):(delete l.request,l.destroy(),l.aborted?t(null):y?t(y):(l.loadVectorData(x,this.map.painter,n==="reloadTile"),t(null)))),void 0,n==="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 o.h({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends o.aP{constructor(l,t,n,c){super(l,t,n,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,o.R.Source).url);o.aQ(this.urls,((t,n)=>{this._loaded=!0,t?this.fire(new o.z(t)):n&&(this.video=n,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 o.z(new o.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 o.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:o.aP,model:class extends o.E{constructor(l,t,n,c){super(),this.id=l,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const l=[];for(const t in this._options.models){const n=this._options.models[t],c=o.aS(this.map._requestManager.transformRequest(n.uri,o.R.Model).url).then((d=>{if(!d)return;const f=o.aT(d),m=new o.aU(t,n.position,n.orientation,f);m.computeBoundsAndApplyParent(),this.models.push(m)})).catch((d=>{this.fire(new o.z(new Error(`Could not load model ${t} from ${n.uri}: ${d.message}`)))}));l.push(c)}Promise.allSettled(l).then((()=>{this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((t=>{this._loaded=!0,this.fire(new o.z(new Error(`Could not load models: ${t.message}`)))}))}onAdd(l){this.map=l,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(l,t){}serialize(){return this._options}},"batched-model":class extends o.E{constructor(l,t,n,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=n,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=o.C(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 o.A("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=wr(this._options,this.map._requestManager,t,n,((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}`),n&&n.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new o.z(c))):d&&(o.h(this,d),d.bounds&&(this.tileBounds=new kr(d.bounds,this.minzoom,this.maxzoom)),Hr(d.tiles,this.map._requestManager._customAccessToken),this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("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 n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(n,o.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
15ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:o.q.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const f=Object.values(l.buckets);for(const m of f)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(f,m){return l.aborted?t(null):f&&f.status!==404?t(f):(this.map._refreshExpiredTiles&&m&&l.setExpiryData(m),l.loadModelData(m,this.map.painter),l.state="loaded",void t(null))}}serialize(){return o.h({},this._options)}},canvas:class extends o.aP{constructor(l,t,n,c){super(l,t,n,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some((d=>!Array.isArray(d)||d.length!==2||d.some((f=>typeof f!="number"))))||this.fire(new o.z(new o.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.z(new o.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new o.z(new o.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 o.z(new o.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 o.z(new o.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 o.z(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 o.aR||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new o.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 o.E{constructor(l,t,n,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=n,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 o.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new o.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new kr(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),o.h(this,o.aF(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return o.aF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new o.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new o.A("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:n,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:n,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:n,y:c,z:d}=l.tileID.canonical,f=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:n,y:c,z:d}
15,{signal:f.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=()=>f.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof o.T?(l.destroy(!0),l.texture&&l.texture instanceof o.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:n,y:c,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:n,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}).map((l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z})))}_clearTiles(){const l=o.C(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new o.A("data",{dataType:"source",sourceDataType:"content"}))}}},$a=function(l,t,n,c){const d=new Hl[t.type](l,t,n,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return o.aV(["load","abort","unload","serialize","prepare"],d),d};function Za(l,t,n=""){return`${n}:${t.id||""}:${t.layer.id}:${(function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:f}=c;return`featureset:${d}${f?`:import:${f}`:""}`}})(l.target)}`}function $l(l,t,n,c=""){if(l.uniqueFeatureID){const d=Za(l,t,c);if(n.has(d))return!0;n.add(d)}return!1}function Zl(l,t,n,c,d=!1){const f=t.sourceCache.transform,m=t.sourceCache.tilesIn(l,t.has3DLayers,d);m.sort(Wl);const y=[];for(const x of m){const T=x.tile.queryRenderedFeatures(t,x,n,c,f,d);Object.keys(T).length&&y.push({wrappedTileID:x.tile.tileID.wrapped().key,queryResults:T})}return y.length===0?{}:(function(x){const T={},S={};for(const M of x){const E=M.queryResults,C=M.wrappedTileID,D=S[C]=S[C]||{};for(const z in E){const F=E[z],L=D[z]=D[z]||{},N=T[z]=T[z]||[];for(const j of F)L[j.featureIndex]||(L[j.featureIndex]=!0,N.push(j))}}return T})(y)}function po(l,t,n,c,d,f){const m={},y=c.queryRenderedSymbols(l),x=[];for(const T of Object.keys(y).map(Number))x.push(d[T]);x.sort(Wl);for(const T of x){const S=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,t,n,f);for(const M in S){const E=m[M]=m[M]||[],C=S[M];C.sort(((D,z)=>{const F=T.featureSortOrder;if(F){const L=F.indexOf(D.featureIndex);return F.indexOf(z.featureIndex)-L}return z.featureIndex-D.featureIndex}));for(const D of C)E.push(D)}}return m}function Wa(l,t){const n=l.getRenderableIds().map((f=>l.getTileByID(f))),c=[],d={};for(let f=0;f<n.length;f++){const m=n[f],y=m.tileID.canonical.key;d[y]||(d[y]=!0,m.querySourceFeatures(c,t))}return c}function Wl(l,t){const n=l.tileID,c=t.tileID;return n.overscaledZ-c.overscaledZ||n.canonical.y-c.canonical.y||n.wrap-c.wrap||n.canonical.x-c.canonical.x}function Hn(l,t){const n={};if(!t)return n;for(const c of l){const d=c.layerIds.map((f=>t.getLayer(f))).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map((f=>d.filter((m=>m.id===f))[0])));for(const f of d)n[f.fqid]=c}}return n}const bn=32,On=33,_s=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,n=0,c=0,d=0,f=0,m=0,y=0;for(1&t?d=f=m=bn:n=c=y=bn;(t>>=1)>1;){const T=n+d>>1,S=c+f>>1;1&t?(d=n,f=c,n=m,c=y):(n=d,c=f,d=m,f=y),m=T,y=S}const x=4*l;_s[x+0]=n,_s[x+1]=c,_s[x+2]=d,_s[x+3]=f}const $n=new Uint16Array(2178),gs=new Uint8Array(1089),Xa=new Uint16Array(1089);function Jn(l){return l===0?-.03125:l===32?.03125:0}const Ya={type:2,extent:o.aj,loadGeometry:()=>[[new o.P(0,0),new o.P(o.aj+1,0),new o.P(o.aj+1,o.aj+1),new o.P(0,o.aj+1),new o.P(0,0)]]};class mo{constructor(t,n,c,d,f,m){this.tileID=t,this.uid=o.a$(),this.uses=0,this.tileSize=n,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=f,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}registerFadeDuration(t){const n=t+this.timeAdded;n<o.q.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=o.aW(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,n,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=Hn(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const f=this.buckets[d];
vendor: 12,745 bytes, line 15
15if(f instanceof o.b1){if(this.hasSymbolBuckets=!0,!c)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const f=this.buckets[d];if(f instanceof o.b1&&f.hasRTLText){this.hasRTLText=!0,o.b2();break}}this.queryPadding=0;for(const d in this.buckets){const f=this.buckets[d],m=n.style.getOwnLayer(d);if(!m)continue;const y=m.queryRadius(f);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 o.b0}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,n,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,Hn(t.buckets,n.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t){for(const d in this.buckets){const f=this.buckets[d];f.uploadPending()&&f.upload(t)}const n=t.gl,c=this.imageAtlas;c&&!c.uploaded&&(this.imageAtlasTexture=new o.T(t,c.image,n.RGBA8,{useMipmap:!!c.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(t,this.glyphAtlasImage,n.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new o.T(t,this.lineAtlas.image,n.R8),this.lineAtlas.uploaded=!0)}prepare(t,n,c){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c),!n||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=n.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(n,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}queryRenderedFeatures(t,n,c,d,f,m){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const y=(function(x,T){const S=o.bn([],[.5*x.width,.5*-x.height,1]);return o.bo(S,S,[1,-1,0]),o.az(S,S,x.calculateProjMatrix(T.toUnwrapped())),Float32Array.from(S)})(f,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:n,pixelPosMatrix:y,transform:d,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview})}querySourceFeatures(t,n){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),f=n?n.sourceLayer:"",m=d._geojsonTileLayer||d[f];if(!m)return;const y=o.b3(n&&n.filter),{z:x,x:T,y:S}=this.tileID.canonical,M={z:x,x:T,y:S};for(let E=0;E<m.length;E++){const C=m.feature(E);if(y.needGeometry){const F=o.b4(C,!0);if(!y.filter(new o.aa(this.tileID.overscaledZ,{worldview:this.worldview}),F,this.tileID.canonical))continue}else if(!y.filter(new o.aa(this.tileID.overscaledZ,{worldview:this.worldview}),C))continue;const D=c.getId(C,f),z=new o.b5(C,x,T,S,D);z.tile=M,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 n=this.expirationTime;if(t.cacheControl){const c=o.b6(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(n)if(this.expirationTime<n)d=!0;else{const f=this.expirationTime-n;f?this.expirationTime=c+Math.max(f,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)}updateBuckets(t,n){if(!this.latestFeatureIndex||!t.style)return;const c=this.latestFeatureIndex.loadVTLayers(),d=t.style.listImages(),f=t.style.getBrightness();for(const m in this.buckets){if(!t.style.hasLayer(m))continue;const y=this.buckets[m],x=y.layers[0],T=x.sourceLayer||"_geojsonTileLayer",S=c[T],M=t.style.getLayerSourceCache(x);let E={};M&&(E=M._state.getState(T,void 0));const C=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},D=Object.keys(E).length>0&&!n;D&&!y.stateDependentLayers.length&&!n||y.update(E,S,d,C,D?y.stateDependentLayers:y.layers,n,f),(y instanceof o.b7||y instanceof o.b8)&&t._terrain&&t._terrain.enabled&&M&&y.uploadPending()&&t._terrain._clearRenderCacheForTile(M.id,this.tileID);const z=t&&t.style&&t.style.getOwnLayer(m);z&&(this.queryPadding=Math.max(this.queryPadding,z.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<o.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=o.q.now()+t}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof o.T?this.texture.update(t):(this.texture=new o.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}setDependencies(t,n){const c={};for(const d of n)c[d]=!0;this.dependencies[t]=c}hasDependency(t,n){for(const c of t){const d=this.dependencies[c];if(d){for(const f of n)if(d[f])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,n){if(!n||n.name==="mercator"||this._tileDebugBuffer)return;const c=o.b9(Ya,this.tileID.canonical,this.tileTransform)[0],d=new o.ba,f=new o.bb;for(let m=0;m<c.length;m++){const{x:y,y:x}=c[m];d.emplaceBack(y,x),f.emplaceBack(m)}f.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(f),this._tileDebugBuffer=t.createVertexBuffer(d,o.bc.members),this._tileDebugSegments=o.bd.simpleSegment(0,0,d.length,f.length)}_makeTileBoundsBuffers(t,n){if(this._tileBoundsBuffer||!n||n.name==="mercator")return;const c=o.b9(Ya,this.tileID.canonical,this.tileTransform)[0];let d,f;if(this.isRaster){const m=(function(y,x){const T=o.aW(y,x),S=Math.pow(2,y.z);for(let F=0;F<On;F++)for(let L=0;L<On;L++){const N=o.aX((y.x+(L+Jn(L))/bn)/S),j=o.aY((y.y+(F+Jn(F))/bn)/S),q=x.project(N,j),X=F*On+L;$n[2*X+0]=Math.round((q.x*T.scale-T.x)*o.aj),$n[2*X+1]=Math.round((q.y*T.scale-T.y)*o.aj)}gs.fill(0),Xa.fill(0);for(let F=2045;F>=0;F--){const L=4*F,N=_s[L+0],j=_s[L+1],q=_s[L+2],X=_s[L+3],ee=N+q>>1,ie=j+X>>1,Y=ee+ie-j,K=ie+N-ee,J=j*On+N,pe=X*On+q,oe=ie*On+ee,Ie=Math.hypot(($n[2*J+0]+$n[2*pe+0])/2-$n[2*oe+0],($n[2*J+1]+$n[2*pe+1])/2-$n[2*oe+1])>=16;gs[oe]=gs[oe]||(Ie?1:0),F<1022&&(gs[oe]=gs[oe]||gs[(j+K>>1)*On+(N+Y>>1)]||gs[(X+K>>1)*On+(q+Y>>1)])}const M=new o.aZ,E=new o.a_;let C=0;function D(F,L){const N=L*On+F;return Xa[N]===0&&(M.emplaceBack($n[2*N+0],$n[2*N+1],F*o.aj/bn,L*o.aj/bn),Xa[N]=++C),Xa[N]-1}function z(F,L,N,j,q,X){const ee=F+N>>1,ie=L+j>>1;if(Math.abs(F-q)+Math.abs(L-X)>1&&gs[ie*On+ee])z(q,X,F,L,ee,ie),z(N,j,q,X,ee,ie);else{const Y=D(F,L),K=D(N,j),J=D(q,X);E.emplaceBack(Y,K,J)}}return z(0,0,bn,bn,bn,0),z(bn,bn,0,0,0,bn),{vertices:M,indices:E}})(this.tileID.canonical,n);d=m.vertices,f=m.indices}else{d=new o.aZ,f=new o.a_;for(const{x:y,y:x}of c)d.emplaceBack(y,x,0,0);const m=o.be(d.int16.subarray(0,4*d.length),void 0,4);for(let y=0;y<m.length;y+=3)f.emplaceBack(m[y],m[y+1],m[y+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,o.bf.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(f),this._tileBoundsSegments=o.bd.simpleSegment(0,0,d.length,f.length)}_makeGlobeTileDebugBuffers(t,n){const c=n.projection;if(!c||c.name!=="globe"||n.freezeTileCoverage)return;const d=this.tileID.canonical,f=o.bg(d,n),m=o.bh(f),y=o.ah(n.zoom);let x;y>0&&(x=o.bi(new Float64Array(16),n.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,n,m,x,y),this._makeGlobeTileDebugTextBuffer(t,d,n,m,x,y)}_globePoint(t,n,c,d,f,m,y){let x=o.bj(t,n,c);if(m){const T=1<<c.z,S=o.aD(d.center.lng),M=o.aH(d.center.lat),E=(c.x+.5)/T-S;let C=0;E>.5?C=-1:E<-.5&&(C=1);let D=(t/o.aj+c.x)/T+C,z=(n/o.aj+c.y)/T;D=(D-S)*d._pixelsPerMercatorPixel+S,z=(z-M)*d._pixelsPerMercatorPixel+M;const F=[D*d.worldSize,z*d.worldSize,0];o.ad(F,F,m),x=o.bk(x,F,y)}return o.ad(x,x,f)}_makeGlobeTileDebugBorderBuffer(t,n,c,d,f,m){const y=new o.ba,x=new o.bb,T=new o.bl,S=(E,C,D,z,F)=>{const L=(D-E)/(F-1),N=(z-C)/(F-1),j=y.length;for(let q=0;q<F;q++){const X=E+q*L,ee=C+q*N;y.emplaceBack(X,ee);const ie=this._globePoint(X,ee,n,c,d,f,m);T.emplaceBack(ie[0],ie[1],ie[2]),x.emplaceBack(j+q)}},M=o.aj;S(0,0,M,0,16),S(M,0,M,M,16),S(M,M,0,M,16),S(0,M,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(x),this._tileDebugBuffer=t.createVertexBuffer(y,o.bc.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(T,o.bm.members),this._tileDebugSegments=o.bd.simpleSegment(0,0,y.length,x.length)}_makeGlobeTileDebugTextBuffer(t,n,c,d,f,m){const y=o.aj/4,x=new o.ba,T=new o.a_,S=new o.bl,M=25;T.reserve(32),x.reserve(M),S.reserve(M);const E=(C,D)=>M*C+D;for(let C=0;C<M;C++){const D=C*y;for(let z=0;z<M;z++){const F=z*y;x.emplaceBack(F,D);const L=this._globePoint(F,D,n,c,d,f,m);S.emplaceBack(L[0],L[1],L[2])}}for(let C=0;C<4;C++)for(let D=0;D<4;D++){const z=E(C,D),F=E(C,D+1),L=E(C+1,D),N=E(C+1,D+1);T.emplaceBack(z,F,L),T.emplaceBack(L,F,N)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(T),this._tileDebugTextBuffer=t.createVertexBuffer(x,o.bc.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(S,o.bm.members),this._tileDebugTextSegments=o.bd.simpleSegment(0,0,M,32)}destroy(t=!1){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&&this.texture&&this.texture instanceof o.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}o.bp.setPbf(o.bq);class qo extends mo{constructor(t,n,c,d,f){super(t,n,c,d,f),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
15getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,n,c){const d=c.context,f=d.gl;let m=this.texturePerLayer.get(t)||c.getTileTexture(n.width);m&&m instanceof o.T?m.update(n,{premultiply:!1}):m=new o.T(d,n,f.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,m)}flushQueues(t){const n=this._workQueuePerLayer.get(t)||[],c=this._fetchQueuePerLayer.get(t)||[];for(;n.length;)n.pop()();for(;c.length;)c.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const n=this._workQueuePerLayer.get(t)||[];for(;n.length;)n.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const n=this._fetchQueuePerLayer.get(t)||[];for(;n.length;)n.pop()()}}fetchHeader(t=16384,n){const c=this._mrt=new o.bp(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=o.br(d,((f,m,y,x)=>{if(f)n(f);else try{const T=c.getHeaderLength(m);if(T>t)return void(this.request=this.fetchHeader(T,n));c.parseHeader(m),this._isHeaderLoaded=!0;let S=0;for(const M of Object.values(c.layers))S=Math.max(S,M.dataIndex[M.dataIndex.length-1].lastByte);m.byteLength>=S&&(this.entireBuffer=m),n(null,this.entireBuffer||m,y,x)}catch(T){n(T)}})),this.request}fetchBand(t,n,c,d){const f=this._mrt;if(!this._isHeaderLoaded||!f)return void d(new Error("Tile header is not ready"));const m=this.actor;if(!m)return void d(new Error("Can't fetch tile band without an actor"));let y;const x=(E,C)=>{if(y.complete(E,C),E)return void d(E);this.updateTextureDescriptor(t,n,c);const D=this.textureDescriptorPerLayer.get(n);d(null,D&&D.img)},T=(E,C)=>{if(E)return d(E);const D=m.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:C,task:y},x,void 0,!0),z=this._workQueuePerLayer.get(n)||[];z.push((()=>{D&&D.cancel(),y.cancel()})),this._workQueuePerLayer.has(n)||this._workQueuePerLayer.set(n,z)},S=f.getLayer(t);if(!S)return void d(new Error(`Unknown sourceLayer "${t}"`));if(S.hasDataForBand(c)){this.updateTextureDescriptor(t,n,c);const E=this.textureDescriptorPerLayer.get(n);return void d(null,E?E.img:null)}const M=S.getDataRange([c]);if(y=f.createDecodingTask(M),!y||y.tasks.length)if(this.flushQueues(n),this.entireBuffer)T(null,this.entireBuffer.slice(M.firstByte,M.lastByte+1));else{const E=Object.assign({},this.requestParams,{headers:{Range:`bytes=${M.firstByte}-${M.lastByte}`}}),C=o.br(E,T),D=this._fetchQueuePerLayer.get(n)||[];D.push((()=>{C.cancel(),y.cancel()})),this._fetchQueuePerLayer.has(n)||this._fetchQueuePerLayer.set(n,D)}else d(null)}updateNeeded(t,n){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==n)&&this.state!=="errored"}updateTextureDescriptor(t,n,c){if(!this._mrt)return;const d=this._mrt.getLayer(t);if(!d||!d.hasBand(c)||!d.hasDataForBand(c))return;const{bytes:f,tileSize:m,buffer:y,offset:x,scale:T}=d.getBandView(c),S=m+2*y,M=new o.r({width:S,height:S},f),E=this.texturePerLayer.get(n);E&&E instanceof o.T&&E.update(M,{premultiply:!1}),this.textureDescriptorPerLayer.set(n,{layer:t,band:c,img:M,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 n of this.texturePerLayer.values())n&&n instanceof o.T&&n.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 fh{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const f={value:n,timeout:void 0};if(c!==void 0&&(f.timeout=setTimeout((()=>{this.remove(t,f)}),c)),this.data[d].push(f),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 n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const c=t.wrapped().key,d=n===void 0?0:this.data[c].indexOf(n),f=this.data[c][d];return this.data[c].splice(d,1),f.timeout&&clearTimeout(f.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(f.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||n.push(d);for(const c of n)this.remove(c.value.tileID,c)}}class ph{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,c){const d=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},o.h(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const f in this.state[t])f!==d&&(this.deletedStates[t][f]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const f in this.state[t][d])c[f]||(this.deletedStates[t][d][f]=null)}else for(const f in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][f]===null&&delete this.deletedStates[t][d][f]}removeFeatureState(t,n,c){if(this.deletedStates[t]===null)return;const d=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&n!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(n!==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,n){const c=this.state[t]||{},d=this.stateChanges[t]||{},f=this.deletedStates[t];if(f===null)return{};if(n!==void 0){const y=String(n),x=o.h({},c[y],d[y]);if(f){const T=f[n];if(T===null)return{};for(const S in T)delete x[S]}return x}const m=o.h({},c,d);if(f)for(const y in f)delete m[y];return m}initializeTileState(t,n){t.refreshFeatureState(n)}coalesceChanges(t,n){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const f={};for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]={}),o.h(this.state[d][m],this.stateChanges[d][m]),f[m]=this.state[d][m];c[d]=f}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const f={};if(this.deletedStates[d]===null)for(const m in this.state[d])f[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];f[m]=this.state[d][m]}c[d]=c[d]||{},o.h(c[d],f)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(n)}}class nn extends o.E{constructor(t,n,c){super(),this.id=t,this._onlySymbols=c,n.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))})),n.on("error",(()=>{this._sourceErrored=!0})),this._source=n,this._tiles={},this._cache=new fh(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
vendor: 19,920 bytes, line 15
15,this._minTileCacheSize=n.minTileCacheSize,this._maxTileCacheSize=n.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new ph,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,n){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,n)}_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 n in this._tiles){const c=this._tiles[n];c.upload(t),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(_o).map((t=>t.key))}getRenderableIds(t,n){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,n)&&c.push(this._tiles[d]);return t?c.sort(((d,f)=>{const m=d.tileID,y=f.tileID,x=new o.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new o.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(_o).map((d=>d.key))}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!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,n){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=n),this._loadTile(c,this._tileLoaded.bind(this,c,t,n)))}_tileLoaded(t,n,c,d){if(d)if(t.state="errored",d.status!==404)this._source.fire(new o.z(d,{tile:t}));else{if(this._source.fire(new o.A("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 f=this.map.painter.terrain;this.update(this.transform,f.getScaledDemTileSize(),!0),f.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=o.q.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new o.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const f=n[d];if(t.neighboringTiles&&t.neighboringTiles[f]){const m=this.getTileByID(f);c(t,m),c(m,t)}}function c(d,f){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let m=f.tileID.canonical.x-d.tileID.canonical.x;const y=f.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),T=f.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)),f.dem&&d.dem&&(d.dem.backfillBorder(f.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,n,c,d){for(const f in this._tiles){let m=this._tiles[f];if(d[f]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>c)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>n+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>n;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=n?c:null}for(let c=t.overscaledZ-1;c>=n;c--){const d=t.scaledTo(c),f=this._getLoadedTile(d);if(f)return f}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,n){n=n||this._source.tileSize;const c=Math.ceil(t.width/n)+1,d=Math.ceil(t.height/n)+1,f=Math.floor(c*d*5),m=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,f):f,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(y)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const c={};for(const d in this._tiles){const f=this._tiles[d];f.tileID=f.tileID.unwrapTo(f.tileID.wrap+n),c[f.tileID.key]=f}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,n,c,d,f){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,n),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 E=T.attenuationRange()[0],C=Math.floor(E)-Math.log2(T.getDemUpscale());x>C&&(x=C)}if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((E=>new o.aM(E.canonical.z,E.wrap,E.canonical.z,E.canonical.x,E.canonical.y)));else if(this.tileCoverLift!==0){const E=t.clone();E.tileCoverLift=this.tileCoverLift,y=E.coveringTiles({tileSize:n||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 o.aM(1,0,1,0,0)),y.push(new o.aM(1,0,1,1,0)),y.push(new o.aM(1,0,1,0,1)),y.push(new o.aM(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:n||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 E=this._source.hasTile.bind(this._source);y=y.filter((C=>E(C)))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Ka(this._source.type)){const E=t.coveringZoomLevel({tileSize:n||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),C=Math.min(E,this._source.maxzoom);if(m){const D=t.extendTileCover(y,C);for(const z of D)y.push(z)}else if(f){const D=t.extendTileCoverToNearPlane(y,this.transform.getFrustum(C),C);for(const z of D)y.push(z)}else if(this.castsShadows&&d){const D=t.extendTileCover(y,C,d);for(const z of D)this._shadowCasterTiles[z.key]=!0,y.push(z)}}const S=this._updateRetainedTiles(y);if(Ka(this._source.type)&&y.length!==0){const E={},C={},D=Object.keys(S);for(const F of D){const L=S[F],N=this._tiles[F];if(!N||N.fadeEndTime&&N.fadeEndTime<=o.q.now())continue;const j=this.findLoadedParent(L,Math.max(L.overscaledZ-nn.maxOverzooming,this._source.minzoom));j&&(this._addTile(j.tileID),E[j.tileID.key]=j.tileID),C[F]=L}const z=y[y.length-1].overscaledZ;for(const F in this._tiles){const L=this._tiles[F];if(S[F]||!L.hasData())continue;let N=L.tileID;for(;N.overscaledZ>z;){N=N.scaledTo(N.overscaledZ-1);const j=this._tiles[N.key];if(j&&j.hasData()&&C[N.key]){S[F]=L.tileID;break}}}for(const F in E)S[F]||(this._coveredTiles[F]=!0,S[F]=E[F])}for(const E in S)this._tiles[E].clearFadeHold();const M=o.bs(this._tiles,S);for(const E of M){const C=this._tiles[E];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(+E)}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 n={};if(t.length===0)return n;const c={},d=t.reduce(((T,S)=>Math.min(T,S.overscaledZ)),1/0),f=t[0].overscaledZ,m=Math.max(f-nn.maxOverzooming,this._source.minzoom),y=Math.max(f+nn.maxUnderzooming,this._source.minzoom),x={};for(const T of t){const S=this._addTile(T);n[T.key]=T,S.hasData()||d<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,d,y,n);for(const T of t){let S=this._tiles[T.key];if(S.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const E=T.children(this._source.maxzoom)[0],C=this.getTile(E);if(C&&C.hasData()){n[E.key]=E;continue}}else{const E=T.children(this._source.maxzoom);if(n[E[0].key]&&n[E[1].key]&&n[E[2].key]&&n[E[3].key])continue}let M=S.wasRequested();for(let E=T.overscaledZ-1;E>=m;--E){const C=T.scaledTo(E);if(c[C.key]||(c[C.key]=!0,S=this.getTile(C),!S&&M&&(S=this._addTile(C)),S&&(n[C.key]=C,M=S.wasRequested(),S.hasData())))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}n.push(d.key);const f=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(f),c)break;d=f}for(const f of n)this._loadedParentTiles[f]=c}}_addTile(t){let n=this._tiles[t.key];if(n)return n.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const c=!!n;if(!c){const d=this.map?this.map.painter:null,f=this._source.tileSize*t.overscaleFactor();n=this._source.type==="raster-array"?new qo(t,f,this.transform.tileZoom,d,this._isRaster):new mo(t,f,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))}return n.uses++,this._tiles[t.key]=n,c||this._source.fire(new o.A("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=n.getExpiryTimeout();c&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),c))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"||n.state==="empty"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}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,n,c){const d=[],f=this.transform;if(!f)return d;const m=f.projection.name==="globe",y=o.aD(f.center.lng);for(const x in this._tiles){const T=this._tiles[x];if(c&&T.clearQueryDebugViz(),T.holdingForFade())continue;let S;if(m){const M=T.tileID.canonical;if(M.z===0){const E=[Math.abs(o.ay(y,...Ho(M,-1))-y),Math.abs(o.ay(y,...Ho(M,1))-y)];S=[0,2*E.indexOf(Math.min(...E))-1]}else{const E=[Math.abs(o.ay(y,...Ho(M,-1))-y),Math.abs(o.ay(y,...Ho(M,0))-y),Math.abs(o.ay(y,...Ho(M,1))-y)];S=[E.indexOf(Math.min(...E))-1]}}else S=[0];for(const M of S){const E=t.containsTile(T,f,n,M);E&&d.push(E)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,n){const c=this.getRenderableIds(t,n).map((f=>this._tiles[f].tileID)),d=this.transform.projection.name==="globe";for(const f of c)f.projMatrix=this.transform.calculateProjMatrix(f.toUnwrapped()),f.expandedProjMatrix=d?this.transform.calculateProjMatrix(f.toUnwrapped(),!1,!0):f.projMatrix;return c}sortCoordinatesByDistance(t){const n=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),f={};for(const m of n){const y=1/(1<<m.canonical.z);f[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 n.sort(((m,y)=>f[m.key]-f[y.key])),n}hasTransition(){if(this._source.hasTransition())return!0;if(Ka(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=o.q.now())return!0}return!1}setFeatureState(t,n,c){this._state.updateState(t=t||"_geojsonTileLayer",n,c)}removeFeatureState(t,n,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,c)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,c){const d=this._tiles[t];d&&d.setDependencies(n,c)}reloadTilesForDependencies(t,n){for(const c in this._tiles)this._tiles[c].hasDependency(t,n)&&this._reloadTile(+c,"reloading");this._cache.filter((c=>!c.hasDependency(t,n)))}_preloadTiles(t,n){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(t,n))};return void this._source.on("data",x)}const c=new Map,d=Array.isArray(t)?t:[t],f=this.map.painter.terrain,m=this.usedForTerrain&&f?f.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 S of T)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}const y=Array.from(c.values());o.bt(y,((x,T)=>{const S=new mo(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(S,(M=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),T(M,S)}))}),n)}}function _o(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||c-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function Ka(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function Ho(l,t){const n=1<<l.z;return[l.x/n+t,(l.x+1)/n+t]}nn.maxOverzooming=10,nn.maxUnderzooming=3;class ud{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,n=!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:n});else if(d.type==="model"){const f=this.style.getLayerSource(d);f&&f.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:n})}}}onNewFrame(t){this.layersGotHidden=!1;for(const n of this.layers){const c=n.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&&n.visible,n.visible=d}}updateZOffset(t,n){this.currentBuildingBuckets=[];for(const d of this.layers){const f=d.layer,m=this.style.getLayerSourceCache(f);let y=1;f.type==="fill-extrusion"?y=d.visible?f.paint.get("fill-extrusion-vertical-scale"):0:f.type==="building"&&(y=d.visible?f.paint.get("building-vertical-scale"):0);let x=m?m.getTile(n):null;if(!x&&m)for(const T in m._tiles){const S=m._tiles[T];if(n.canonical.isChildOf(S.tileID.canonical)){x=S;break}}this.currentBuildingBuckets.push({bucket:x?x.getBucket(f):null,tileID:x?x.tileID:n,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const f=t.symbolInstances.get(d),m=f.zOffset,y=this._getHeightAtTileOffset(n,f.tileAnchorX,f.tileAnchorY);f.zOffset=y!==Number.NEGATIVE_INFINITY?y:m,c||m===f.zOffset||(c=!0),t.hasAnyZOffset||f.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,n,c,d){let f=n,m=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,x=1/(1<<t.canonical.z-y.z);f=(n+t.canonical.x*o.aj)*x-y.x*o.aj|0,m=(c+t.canonical.y*o.aj)*x-y.y*o.aj|0}return{tileX:f,tileY:m}}_getHeightAtTileOffset(t,n,c){let d,f;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:S}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:M,tileY:E}=this._mapCoordToOverlappingTile(t,n,c,T),C=x.getHeightAtTileCoord(M,E);C&&C.height!==void 0&&(C.hidden?d=C.height:f=Math.max(C.height*S,f||0))}if(f!==void 0)return f;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:S,tileY:M}=this._mapCoordToOverlappingTile(t,n,c,T),E=x.getHeightAtTileCoord(S,M);if(E&&!E.hidden)return E.height===void 0&&d!==void 0?Math.min(E.maxHeight,d)*E.verticalScale:E.height?E.height*E.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function dd(l,t){const n={};for(const c in l)c!=="ref"&&(n[c]=l[c]);return o.bu.forEach((c=>{c in t&&(n[c]=t[c])})),n}function Ja(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=dd(l[n],t[l[n].ref]));return l}const Xt={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 Xl(l,t,n){n.push({command:Xt.addSource,args:[l,t[l]]})}function $o(l,t,n){t.push({command:Xt.removeSource,args:[l]}),n[l]=!0}function Qa(l,t,n,c){$o(l,n,c),Xl(l,t,n)}function fp(l,t,n){let c;for(c in l[n])if(l[n].hasOwnProperty(c)&&c!=="data"&&!o.bv(l[n][c],t[n][c]))return!1;for(c in t[n])if(t[n].hasOwnProperty(c)&&c!=="data"&&!o.bv(l[n][c],t[n][c]))return!1;return!0}function el(l,t,n,c,d,f){let m;
vendor: 6,378 bytes, line 15
15for(m in t=t||{},l=l||{})l.hasOwnProperty(m)&&(o.bv(l[m],t[m])||n.push({command:f,args:[c,m,t[m],d]}));for(m in t)t.hasOwnProperty(m)&&!l.hasOwnProperty(m)&&(o.bv(l[m],t[m])||n.push({command:f,args:[c,m,t[m],d]}))}function go(l){return l.id}function Bs(l,t){return l[t.id]=t,l}function tl(l,t,n){const c=t.createTileMatrix(l,l.worldSize,n.toUnwrapped());return o.az(new Float32Array(16),l.projMatrix,c)}function fd(l,t,n){if(t.projection.name===n.projection.name)return l.projMatrix;const c=n.clone();return c.setProjection(t.projection),tl(c,t.getProjection(),l)}function Yl(l,t,n){return t.name===n.projection.name?l.projMatrix:tl(n,t,l)}class pd{constructor(t,n){this.reset(t,n)}reset(t,n){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(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=o.ay(t,0,1);let n=1,c=this._distances[n];const d=t*this.paddedLength+this.padding;for(;c<d&&n<this._distances.length;)c=this._distances[++n];const f=n-1,m=this._distances[f],y=c-m,x=y>0?(d-m)/y:0;return this.points[f].mult(1-x).add(this.points[n].mult(x))}}class Zo{constructor(t,n,c){const d=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(n/c);for(let m=0;m<this.xCellCount*this.yCellCount;m++)d.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,c,d,f){this._forEachCell(n,c,d,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(f)}insertCircle(t,n,c,d){this._forEachCell(n-d,c-d,n+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(c),this.circles.push(d)}_insertBoxCell(t,n,c,d,f,m){this.boxCells[f].push(m)}_insertCircleCell(t,n,c,d,f,m){this.circleCells[f].push(m)}_query(t,n,c,d,f,m){if(c<0||t>this.width||d<0||n>this.height)return!f&&[];const y=[];if(t<=0&&n<=0&&this.width<=c&&this.height<=d){if(f)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],S=this.circles[3*x+1],M=this.circles[3*x+2];y.push({key:this.circleKeys[x],x1:T-M,y1:S-M,x2:T+M,y2:S+M})}return m?y.filter(m):y}return this._forEachCell(t,n,c,d,this._queryCell,y,{hitTest:f,seenUids:{box:{},circle:{}}},m),f?y.length>0:y}_queryCircle(t,n,c,d,f){const m=t-c,y=t+c,x=n-c,T=n+c;if(y<0||m>this.width||T<0||x>this.height)return!d&&[];const S=[];return this._forEachCell(m,x,y,T,this._queryCellCircle,S,{hitTest:d,circle:{x:t,y:n,radius:c},seenUids:{box:{},circle:{}}},f),d?S.length>0:S}query(t,n,c,d,f){return this._query(t,n,c,d,!1,f)}hitTest(t,n,c,d,f){return this._query(t,n,c,d,!0,f)}hitTestCircle(t,n,c,d){return this._queryCircle(t,n,c,!0,d)}_queryCell(t,n,c,d,f,m,y,x){const T=y.seenUids,S=this.boxCells[f];if(S!==null){const E=this.bboxes;for(const C of S)if(!T.box[C]){T.box[C]=!0;const D=4*C;if(t<=E[D+2]&&n<=E[D+3]&&c>=E[D+0]&&d>=E[D+1]&&(!x||x(this.boxKeys[C]))){if(y.hitTest)return m.push(!0),!0;m.push({key:this.boxKeys[C],x1:E[D],y1:E[D+1],x2:E[D+2],y2:E[D+3]})}}}const M=this.circleCells[f];if(M!==null){const E=this.circles;for(const C of M)if(!T.circle[C]){T.circle[C]=!0;const D=3*C;if(this._circleAndRectCollide(E[D],E[D+1],E[D+2],t,n,c,d)&&(!x||x(this.circleKeys[C]))){if(y.hitTest)return m.push(!0),!0;{const z=E[D],F=E[D+1],L=E[D+2];m.push({key:this.circleKeys[C],x1:z-L,y1:F-L,x2:z+L,y2:F+L})}}}}}_queryCellCircle(t,n,c,d,f,m,y,x){const T=y.circle,S=y.seenUids,M=this.boxCells[f];if(M!==null){const C=this.bboxes;for(const D of M)if(!S.box[D]){S.box[D]=!0;const z=4*D;if(this._circleAndRectCollide(T.x,T.y,T.radius,C[z+0],C[z+1],C[z+2],C[z+3])&&(!x||x(this.boxKeys[D])))return m.push(!0),!0}}const E=this.circleCells[f];if(E!==null){const C=this.circles;for(const D of E)if(!S.circle[D]){S.circle[D]=!0;const z=3*D;if(this._circlesCollide(C[z],C[z+1],C[z+2],T.x,T.y,T.radius)&&(!x||x(this.circleKeys[D])))return m.push(!0),!0}}}_forEachCell(t,n,c,d,f,m,y,x){const T=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),M=this._convertToXCellCoord(c),E=this._convertToYCellCoord(d);for(let C=T;C<=M;C++)for(let D=S;D<=E;D++)if(f.call(this,t,n,c,d,this.xCellCount*D+C,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,n,c,d,f,m){const y=d-t,x=f-n,T=c+m;return T*T>y*y+x*x}_circleAndRectCollide(t,n,c,d,f,m,y){const x=(m-d)/2,T=Math.abs(t-(d+x));if(T>x+c)return!1;const S=(y-f)/2,M=Math.abs(n-(f+S));if(M>S+c)return!1;if(T<=x||M<=S)return!0;const E=T-x,C=M-S;return E*E+C*C<=c*c}}const yo={unknown:0,flipRequired:1,flipNotRequired:2},md=Math.tan(85*Math.PI/180);function il(l,t,n,c,d,f,m){const y=o.bz();if(n)if(f.name==="globe"){const x=o.bA(d,t);o.az(y,y,x)}else{const x=o.bB([],m);y[0]=x[0],y[1]=x[1],y[4]=x[2],y[5]=x[3],c||o.by(y,y,d.angle)}else o.az(y,d.labelPlaneMatrix,l);return y}function Wo(l,t,n,c,d,f,m){const y=il(l,t,n,c,d,f,m);return f.name==="globe"&&n||(y[2]=y[6]=y[10]=y[14]=0),y}function ys(l,t,n,c,d,f,m){if(n){if(f.name==="globe"){const y=il(l,t,n,c,d,f,m);return o.bi(y,y),o.az(y,l,y),y}{const y=o.bw(l),x=o.bx([]);return x[0]=m[0],x[1]=m[1],x[4]=m[2],x[5]=m[3],o.az(y,y,x),c||o.by(y,y,-d.angle),y}}return d.glCoordMatrix}function wn(l,t,n,c){const d=[l,t,n,1];n?o.aA(d,d,c):_d(d,d,c);const f=d[3];return d[0]/=f,d[1]/=f,d[2]/=f,d}function mh(l,t){return Math.min(.5+l/t*.5,1.5)}function _h(l,t){const n=l[0]/l[3],c=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&c>=-t[1]&&c<=t[1]}function xo(l,t,n,c,d,f,m,y,x,T){const S=n.transform,M=c?l.textSizeData:l.iconSizeData,E=o.bH(M,n.transform.zoom),C=S.projection.name==="globe",D=[256/n.width*2+1,256/n.height*2+1],z=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;z.clear();let F=null;
vendor: 38,051 bytes, line 15
15C&&(F=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const L=l.lineVertexArray,N=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,j=n.transform.width/n.transform.height;let q,X=!1;for(let ee=0;ee<N.length;ee++){const ie=N.get(ee),{numGlyphs:Y,writingMode:K}=ie;if(K!==o.bI.vertical||X||q===o.bI.horizontal||(X=!0),q=K,(ie.hidden||K===o.bI.vertical)&&!X){Xo(Y,z);continue}X=!1;const J=new o.P(ie.tileAnchorX,ie.tileAnchorY);let{x:pe,y:oe,z:Ie}=S.projection.projectTilePoint(J.x,J.y,T.canonical);if(x){const[at,dt,Qe]=x(J);pe+=at,oe+=dt,Ie+=Qe}const xe=[pe,oe,Ie,1];if(o.aA(xe,xe,t),!_h(xe,D)){Xo(Y,z);continue}const Me=xe[3],Ue=mh(n.transform.getCameraToCenterDistance(S.projection),Me),me=o.bJ(M,E,ie),se=m?me/Ue:me*Ue,we=wn(pe,oe,Ie,d);if(we[3]<=0){Xo(Y,z);continue}let _e={};const ze=o.al(l.layers[0].layout.get("text-max-angle")),Re=Math.cos(ze),Le=m?null:x,Ze=Kl(ie,se,!1,y,t,d,f,l.glyphOffsetArray,L,z,F,we,J,_e,j,Le,S.projection,T,m,Re);X=Ze.useVertical,Le&&Ze.needsFlipping&&(_e={}),(Ze.notEnoughRoom||X||Ze.needsFlipping&&Kl(ie,se,!0,y,t,d,f,l.glyphOffsetArray,L,z,F,we,J,_e,j,Le,S.projection,T,m,Re).notEnoughRoom)&&Xo(Y,z)}c?(l.text.dynamicLayoutVertexBuffer.updateData(z),F&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(F)):(l.icon.dynamicLayoutVertexBuffer.updateData(z),F&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(F))}function un(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F){const{lineStartIndex:L,glyphStartIndex:N,segment:j}=y,q=N+y.numGlyphs,X=L+y.lineLength,ee=t.getoffsetX(N),ie=t.getoffsetX(q-1),Y=rl(l*ee,n,c,d,f,m,j,L,X,x,T,S,M,E,!0,C,D,z,F);if(!Y)return null;const K=rl(l*ie,n,c,d,f,m,j,L,X,x,T,S,M,E,!0,C,D,z,F);return K?{first:Y,last:K}:null}function gh(l,t,n,c){return l===o.bI.horizontal&&Math.abs(c)>Math.abs(n)?{useVertical:!0}:l===o.bI.vertical?c>0?{needsFlipping:!0}:null:t!==yo.unknown&&(function(d,f){return d===0||Math.abs(f/d)>md})(n,c)?t===yo.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function Kl(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F,L,N,j){const q=t/24,X=l.lineOffsetX*q,ee=l.lineOffsetY*q,{lineStartIndex:ie,glyphStartIndex:Y,numGlyphs:K,segment:J,writingMode:pe,flipState:oe}=l,Ie=ie+l.lineLength,xe=Me=>{if(S){const[we,_e,ze]=Me.up,Re=T.length;o.bK(S,Re+0,we,_e,ze),o.bK(S,Re+1,we,_e,ze),o.bK(S,Re+2,we,_e,ze),o.bK(S,Re+3,we,_e,ze)}const[Ue,me,se]=Me.point;o.bL(T,Ue,me,se,Me.angle)};if(K>1){const Me=un(q,y,X,ee,n,M,E,l,x,f,C,z,!1,F,L,N,j);if(!Me)return{notEnoughRoom:!0};if(c&&!n){let[Ue,me,se]=Me.first.point,[we,_e,ze]=Me.last.point;[Ue,me]=wn(Ue,me,se,m),[we,_e]=wn(we,_e,ze,m);const Re=gh(pe,oe,(we-Ue)*D,_e-me);if(l.flipState=Re&&Re.needsFlipping?yo.flipRequired:yo.flipNotRequired,Re)return Re}xe(Me.first);for(let Ue=Y+1;Ue<Y+K-1;Ue++){const me=rl(q*y.getoffsetX(Ue),X,ee,n,M,E,J,ie,Ie,x,f,C,z,!1,!1,F,L,N,j);if(!me)return T.length-=4*(Ue-Y),{notEnoughRoom:!0};xe(me)}xe(Me.last)}else{if(c&&!n){const Ue=wn(E.x,E.y,0,d),me=ie+J+1,se=new o.P(x.getx(me),x.gety(me)),we=wn(se.x,se.y,0,d),_e=we[3]>0?we:li(E,se,Ue,1,d,void 0,F,L.canonical),ze=gh(pe,oe,(_e[0]-Ue[0])*D,_e[1]-Ue[1]);if(l.flipState=ze&&ze.needsFlipping?yo.flipRequired:yo.flipNotRequired,ze)return ze}const Me=rl(q*y.getoffsetX(Y),X,ee,n,M,E,J,ie,Ie,x,f,C,z,!1,!1,F,L,N,j);if(!Me)return{notEnoughRoom:!0};xe(Me)}return{}}function yh(l,t,n,c,d){const{x:f,y:m,z:y}=c.projectTilePoint(l.x,l.y,t);if(!d)return wn(f,m,y,n);const[x,T,S]=d(l);return wn(f+x,m+T,y+S,n)}function li(l,t,n,c,d,f,m,y){const x=yh(l.sub(t)._unit()._add(l),y,d,m,f);return o.at(x,n,x),o.au(x,x),o.bE(x,n,x,c)}function rl(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F,L,N){const j=c?l-t:l+t;let q=j>0?1:-1,X=0;c&&(q*=-1,X=Math.PI),q<0&&(X+=Math.PI);let ee=y+m+(q>0?0:1)|0,ie=d,Y=d,K=0,J=0;const pe=Math.abs(j),oe=[],Ie=[];let xe=f,Me=xe,Ue=o.bC([]);const me=()=>li(Me,xe,Y,pe-K+1,S,E,z,F.canonical);for(;K+J<=pe;){if(ee+=q,ee<y||ee>=x)return null;if(Y=ie,Me=xe,oe.push(Y),C&&Ie.push(Me),xe=new o.P(T.getx(ee),T.gety(ee)),ie=M[ee],!ie){const Qe=yh(xe,F.canonical,S,z,E);ie=Qe[3]>0?M[ee]=Qe:me()}K+=J;const at=o.at([],ie,Y),dt=o.bD(Y,ie);if(n&&dt>0&&J>0&&o.bG(Ue,at)/(J*dt)<N)return null;J=dt,Ue=at}D&&E&&(M[ee]&&(ie=me(),J=o.bD(Y,ie),Ue=o.at([],ie,Y)),M[ee]=ie);const se=(pe-K)/J,we=xe.sub(Me)._mult(se)._add(Me),_e=o.bE([],Y,Ue,se);let ze=[0,0,1],Re=Ue[0],Le=Ue[1];if(L&&(ze=z.upVector(F.canonical,we.x,we.y),ze[0]!==0||ze[1]!==0||ze[2]!==1)){const at=[ze[2],0,-ze[0]],dt=o.bF([],ze,at);o.au(at,at),o.au(dt,dt),Re=o.bG(Ue,at),Le=o.bG(Ue,dt)}if(n){const at=o.bF([],ze,Ue);o.au(at,at),o.bE(_e,_e,at,n*q)}const Ze=X+Math.atan2(Le,Re);return oe.push(_e),C&&Ie.push(we),{point:_e,angle:Ze,path:oe,tilePath:Ie,up:ze}}function Xo(l,t){const n=t.length,c=n+4*l;t.resize(c),t.float32.fill(-1/0,4*n,4*c)}function _d(l,t,n){const c=t[0],d=t[1];return l[0]=n[0]*c+n[4]*d+n[12],l[1]=n[1]*c+n[5]*d+n[13],l[3]=n[3]*c+n[7]*d+n[15],l}const pt=100;class gd{constructor(t,n,c=new Zo(t.width+200,t.height+200,25),d=new Zo(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+pt,this.screenBottomBoundary=t.height+pt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=n}placeCollisionBox(t,n,c,d,f,m,y,x,T,S,M){let E=c.projectedAnchorX,C=c.projectedAnchorY,D=c.projectedAnchorZ;const z=c.tileAnchorX,F=c.tileAnchorY,L=c.elevation,N=c.tileID,j=t.getProjection();if(L&&N){const[Ie,xe,Me]=j.upVector(N.canonical,c.tileAnchorX,c.tileAnchorY),Ue=j.upVectorScale(N.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;E+=Ie*L*Ue,C+=xe*L*Ue,D+=Me*L*Ue}const q=t.projection.name==="globe",X=t.projection.name==="globe"?o.ah(this.transform.zoom):0;if(N&&q&&X<1&&!m){const Ie=1<<N.canonical.z,xe=o.bM(z,F);o.bN(xe,xe,1/o.aj),o.bO(xe,xe,o.bM(N.canonical.x,N.canonical.y)),o.bN(xe,xe,1/Ie),o.bP(xe,xe,o.bM(d[0],d[1])),xe[0]=o.bQ(xe[0],-.5,.5),o.bN(xe,xe,o.aj);const Me=o.bR(xe[0],xe[1],o.aj/(2*Math.PI),1);o.aA(Me,Me,f),E=o.ai(E,Me[0],X),C=o.ai(C,Me[1],X),D=o.ai(D,Me[2],X)}const ee=this.projectAndGetPerspectiveRatio(S,E,C,D,c.tileID,j.name==="globe"||!!L||this.transform.pitch>0,j),ie=T*ee.perspectiveRatio,Y=(c.x1*n+y.x-c.padding)*ie+ee.point.x,K=(c.y1*n+y.y-c.padding)*ie+ee.point.y,J=(c.x2*n+y.x+c.padding)*ie+ee.point.x,pe=(c.y2*n+y.y+c.padding)*ie+ee.point.y,oe=ee.perspectiveRatio<=.55||ee.occluded;return!this.isInsideGrid(Y,K,J,pe)||!x&&this.grid.hitTest(Y,K,J,pe,M)||oe?{box:[],offscreen:!1,occluded:ee.occluded}:{box:[Y,K,J,pe],offscreen:this.isOffscreen(Y,K,J,pe),occluded:!1}}placeCollisionCircles(t,n,c,d,f,m,y,x,T,S,M,E,C,D,z){const F=[],L=this.transform.elevation,N=t.getProjection(),j=L?L.getAtTileOffsetFunc(z,this.transform.center.lat,this.transform.worldSize,N):null,q=new o.P(c.tileAnchorX,c.tileAnchorY);let{x:X,y:ee,z:ie}=N.projectTilePoint(q.x,q.y,z.canonical);if(j){const[ze,Re,Le]=j(q);X+=ze,ee+=Re,ie+=Le}const Y=N.name==="globe",K=this.projectAndGetPerspectiveRatio(y,X,ee,ie,z,Y||!!L||this.transform.pitch>0,N),{perspectiveRatio:J}=K,pe=(M?m/J:m*J)/o.bU,oe=wn(X,ee,ie,x),Ie=c.lineOffsetX*pe,xe=c.lineOffsetY*pe,Me=o.al(t.layers[0].layout.get("text-max-angle")),Ue=Math.cos(Me),me=K.signedDistanceFromCamera>0?un(pe,f,Ie,xe,!1,oe,q,c,d,x,{},L&&!M?j:null,M&&!!L,N,z,M,Ue):null;let se=!1,we=!1,_e=!0;if(me&&!K.occluded){const ze=.5*C*J+D,Re=new o.P(-100,-100),Le=new o.P(this.screenRightBoundary,this.screenBottomBoundary),Ze=new pd,{first:at,last:dt}=me,Qe=at.path.length;let ht=[];for(let At=Qe-1;At>=1;At--)ht.push(at.path[At]);for(let At=1;At<dt.path.length;At++)ht.push(dt.path[At]);const lt=2.5*ze;T&&(ht=ht.map((([At,Ot,Yt],Et)=>(j&&!Y&&(Yt=j(Et<Qe-1?at.tilePath[Qe-1-Et]:dt.tilePath[Et-Qe+2])[2]),wn(At,Ot,Yt,T)))),ht.some((At=>At[3]<=0))&&(ht=[]));let wt=[];if(ht.length>0){let At=1/0,Ot=-1/0,Yt=1/0,Et=-1/0;for(const Kt of ht)At=Math.min(At,Kt[0]),Yt=Math.min(Yt,Kt[1]),Ot=Math.max(Ot,Kt[0]),Et=Math.max(Et,Kt[1]);Ot>=Re.x&&At<=Le.x&&Et>=Re.y&&Yt<=Le.y&&(wt=[ht.map((Kt=>new o.P(Kt[0],Kt[1])))],(At<Re.x||Ot>Le.x||Yt<Re.y||Et>Le.y)&&(wt=o.bS(wt,Re.x,Re.y,Le.x,Le.y)))}for(const At of wt){Ze.reset(At,.25*ze);let Ot=0;Ot=Ze.length<=.5*ze?1:Math.ceil(Ze.paddedLength/lt)+1;for(let Yt=0;Yt<Ot;Yt++){const Et=Yt/Math.max(Ot-1,1),Kt=Ze.lerp(Et),ti=Kt.x+pt,vi=Kt.y+pt;F.push(ti,vi,ze,0);const Dt=ti-ze,Jt=vi-ze,Qt=ti+ze,ni=vi+ze;if(_e=_e&&this.isOffscreen(Dt,Jt,Qt,ni),we=we||this.isInsideGrid(Dt,Jt,Qt,ni),!n&&this.grid.hitTestCircle(ti,vi,ze,E)&&(se=!0,!S))return{circles:[],offscreen:!1,collisionDetected:se,occluded:!1}}}}return{circles:!S&&se||!we?[]:F,offscreen:_e,collisionDetected:se,occluded:K.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let c=1/0,d=1/0,f=-1/0,m=-1/0;for(const S of t){const M=new o.P(S.x+pt,S.y+pt);c=Math.min(c,M.x),d=Math.min(d,M.y),f=Math.max(f,M.x),m=Math.max(m,M.y),n.push(M)}const y=this.grid.query(c,d,f,m).concat(this.ignoredGrid.query(c,d,f,m)),x={},T={};for(const S of y){const M=S.key;if(x[M.bucketInstanceId]===void 0&&(x[M.bucketInstanceId]={}),x[M.bucketInstanceId][M.featureIndex])continue;const E=[new o.P(S.x1,S.y1),new o.P(S.x2,S.y1),new o.P(S.x2,S.y2),new o.P(S.x1,S.y2)];o.bT(n,E)&&(x[M.bucketInstanceId][M.featureIndex]=!0,T[M.bucketInstanceId]===void 0&&(T[M.bucketInstanceId]=[]),T[M.bucketInstanceId].push(M.featureIndex))}return T}insertCollisionBox(t,n,c,d,f){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:f},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,c,d,f){const m=n?this.ignoredGrid:this.grid,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:f};for(let x=0;x<t.length;x+=4)m.insertCircle(y,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,n,c,d,f,m,y){const x=[n,c,d,1];let T=!1;d||this.transform.pitch>0?(o.aA(x,x,t),this.fogState&&f&&y.name!=="globe"&&(T=(function(E,C,D,z,F,L){const N=L.calculateFogTileMatrix(F),j=[C,D,z];return o.ad(j,j,N),ft(E,o.ae(j),L.pitch,L._fov)})(this.fogState,n,c,d,f.toUnwrapped(),this.transform)>.9)):_d(x,x,t);const S=x[3];return{point:new o.P((x[0]/S+1)/2*this.transform.width+pt,(-x[1]/S+1)/2*this.transform.height+pt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/S*.5,1.5),signedDistanceFromCamera:S,occluded:m&&x[2]>S||T}}isOffscreen(t,n,c,d){return c<pt||t>=this.screenRightBoundary||d<pt||n>this.screenBottomBoundary}isInsideGrid(t,n,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=o.bx([]);return o.bo(t,t,[-100,-100,0]),t}}class nl{constructor(t,n,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class vo{constructor(t,n,c,d,f,m=!1){this.text=new nl(t?t.text:null,n,c,f),this.icon=new nl(t?t.icon:null,n,d,f),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Tn{constructor(t,n,c,d=!1){this.text=t,this.icon=n,this.skipFade=c,this.clipped=d}}class xh{constructor(){this.invProjMatrix=o.bz(),this.viewportMatrix=o.bz(),this.circles=[]}}class Yo{constructor(t,n,c,d,f){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=f}}class ut{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 n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:c=>c.collisionGroupID===n}}return this.collisionGroups[t]}}function oi(l,t,n,c,d){const{horizontalAlign:f,verticalAlign:m}=o.bZ(l),y=-(f-.5)*t,x=-(m-.5)*n,T=o.b_(l,c);return new o.P(y+T[0]*d,x+T[1]*d)}function ai(l,t,n,c,d){const f=new o.P(l,t);return n&&f._rotate(c?d:-d),f}class dn{constructor(t,n,c,d,f,m){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new gd(this.transform,f),this.buildingIndex=m,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new ut(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,c,d,f=1){const m=c.getBucket(n),y=c.latestFeatureIndex;if(!m||!y||n.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,T=m.layers[0].paint,S=c.collisionBoxArray,M=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),E=c.tileSize/o.aj,C=c.tileID.toUnwrapped();this.transform.setProjection(m.projection);const D=(z=c.tileID,F=m.getProjection(),L=this.transform,F.name===this.projection?L.calculateProjMatrix(z.toUnwrapped()):tl(L,F,z));var z,F,L;const N=x.get("text-pitch-alignment")==="map",j=x.get("text-rotation-alignment")==="map";n.compileFilter(n.options);const q=n.dynamicFilter(),X=n.dynamicFilterNeedsFeature(),ee=this.transform.calculatePixelsToTileUnitsMatrix(c),ie=Wo(D,c.tileID.canonical,N,j,this.transform,m.getProjection(),ee);let Y=null;const K=m.getProjection().createInversionMatrix(this.transform,c.tileID.canonical);if(N){const se=ys(D,c.tileID.canonical,N,j,this.transform,m.getProjection(),ee);Y=o.az([],this.transform.labelPlaneMatrix,se)}let J=null;q&&c.latestFeatureIndex&&(J={unwrappedTileID:C,dynamicFilter:q,dynamicFilterNeedsFeature:X}),this.retainedQueryData[m.bucketInstanceId]=new Yo(m.bucketInstanceId,y,m.sourceLayerIndex,m.index,c.tileID);const[pe,oe]=m.layers[0].layout.get("text-size-scale-range"),Ie=o.ay(f,pe,oe),[xe,Me]=x.get("icon-size-scale-range"),Ue=o.ay(f,xe,Me),me={bucket:m,layout:x,paint:T,posMatrix:D,invMatrix:K,mercatorCenter:[o.aD(this.transform.center.lng),o.aH(this.transform.center.lat)],textLabelPlaneMatrix:ie,labelToScreenMatrix:Y,clippingData:J,scale:M,textPixelRatio:E,holdingForFade:c.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:o.bH(m.textSizeData,this.transform.zoom,Ie),partiallyEvaluatedIconSize:o.bH(m.iconSizeData,this.transform.zoom,Ue),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const se of m.sortKeyRanges){const{sortKey:we,symbolInstanceStart:_e,symbolInstanceEnd:ze}=se;t.push({sortKey:we,symbolInstanceStart:_e,symbolInstanceEnd:ze,parameters:me})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:me})}attemptAnchorPlacement(t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F,L,N,j,q,X){const{textOffset0:ee,textOffset1:ie,crossTileID:Y}=z,K=[ee,ie],J=oi(t,m,y,K,x),pe=this.collisionIndex.placeCollisionBox(L,x,n,c,d,f,ai(J.x,J.y,T,S,this.transform.angle),D,M,E,C.predicate);if(j){const oe=L.getSymbolInstanceIconSize(X,this.transform.zoom,z.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(L,oe,j,c,d,f,ai(J.x,J.y,T,S,this.transform.angle),D,M,E,C.predicate).box.length===0)return}if(pe.box.length>0){let oe;return this.prevPlacement&&this.prevPlacement.variableOffsets[Y]&&this.prevPlacement.placements[Y]&&this.prevPlacement.placements[Y].text&&(oe=this.prevPlacement.variableOffsets[Y].anchor),this.variableOffsets[Y]={textOffset:K,width:m,height:y,anchor:t,textScale:x,prevAnchor:oe},this.markUsedJustification(L,t,z,N),L.allowVerticalPlacement&&(this.markUsedOrientation(L,N,z),this.placedOrientations[Y]=N),{shift:J,placedGlyphBoxes:pe}}}placeLayerBucketPart(t,n,c,d,f=1){const{bucket:m,layout:y,paint:x,posMatrix:T,textLabelPlaneMatrix:S,labelToScreenMatrix:M,clippingData:E,textPixelRatio:C,mercatorCenter:D,invMatrix:z,holdingForFade:F,collisionBoxArray:L,partiallyEvaluatedTextSize:N,partiallyEvaluatedIconSize:j,collisionGroup:q,latestFeatureIndex:X}=t.parameters,ee=y.get("text-optional"),ie=y.get("icon-optional"),Y=y.get("text-allow-overlap"),K=y.get("icon-allow-overlap"),J=y.get("text-rotation-alignment")==="map",pe=y.get("icon-rotation-alignment")==="map",oe=y.get("text-pitch-alignment")==="map",Ie=x.get("symbol-z-offset"),xe=y.get("symbol-elevation-reference")==="sea",Me=y.get("symbol-placement"),[Ue,me]=y.get("text-size-scale-range"),[se,we]=y.get("icon-size-scale-range"),_e=o.ay(f,Ue,me),ze=o.ay(f,se,we),Re=y.get("text-variable-anchor"),Le=J&&Me!=="point",Ze=pe&&Me!=="point",at=Re&&m.hasTextData(),dt=m.hasIconTextFit()&&at&&m.hasIconData();this.transform.setProjection(m.projection);const Qe=at||Le,ht=Ze||dt;let lt=Y&&(K||!m.hasIconData()||ie),wt=K&&(Y||!m.hasTextData()||ee);const At=!Ie.isConstant();!m.collisionArrays&&L&&m.deserializeCollisionBoxes(L),c&&d&&m.updateCollisionDebugBuffers(this.transform.zoom,L,_e,ze);const Ot=(Et,Kt,ti)=>{const{crossTileID:vi,numVerticalGlyphVertices:Dt}=Et;let Jt=null;if(E&&E.dynamicFilterNeedsFeature||At){const Ji=this.retainedQueryData[m.bucketInstanceId];Jt=X.loadFeature({featureIndex:Et.featureIndex,bucketIndex:Ji.bucketIndex,sourceLayerIndex:Ji.sourceLayerIndex,layoutVertexArrayOffset:0})}if(E&&!(0,E.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},Jt,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new o.P(Et.tileAnchorX,Et.tileAnchorY),this.transform.calculateDistanceTileData(E.unwrappedTileID)))return this.placements[vi]=new Tn(!1,!1,!1,!0),void n.add(vi);const Qt=Ie.evaluate(Jt,{});if(n.has(vi))return;if(F)return void(this.placements[vi]=new Tn(!1,!1,!1));let ni=!1,kt=!1,di=!0,ii=!1,Vi=!1,Wt=null,si={box:null,offscreen:null,occluded:null},yi={box:null},or=null,rr=null,ar=null,Sr=0,Xn=0,Yr=0;ti.textFeatureIndex?Sr=ti.textFeatureIndex:Et.useRuntimeCollisionCircles&&(Sr=Et.featureIndex),ti.verticalTextFeatureIndex&&(Xn=ti.verticalTextFeatureIndex);const pn=Ji=>{Ji.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const Zi=this.transform.elevation;Ji.elevation=xe?Qt:Qt+(Zi?Zi.getAtTileOffset(Ji.tileID,Ji.tileAnchorX,Ji.tileAnchorY):0),Ji.elevation+=Et.zOffset},Pr=ti.textBox;if(Pr){pn(Pr);const Ji=wi=>{let pr=o.bI.horizontal;if(m.allowVerticalPlacement&&!wi&&this.prevPlacement){const Er=this.prevPlacement.placedOrientations[vi];Er&&(this.placedOrientations[vi]=Er,pr=Er,this.markUsedOrientation(m,pr,Et))}return pr},Zi=(wi,pr)=>{if(m.allowVerticalPlacement&&Dt>0&&ti.verticalTextBox){for(const Er of m.writingModes)if(Er===o.bI.vertical?(si=pr(),yi=si):si=wi(),si&&si.box&&si.box.length)break}else si=wi()};if(Re){let wi=Re;if(this.prevPlacement&&this.prevPlacement.variableOffsets[vi]){const Qi=this.prevPlacement.variableOffsets[vi];wi.indexOf(Qi.anchor)>0&&(wi=wi.filter((Cn=>Cn!==Qi.anchor)),wi.unshift(Qi.anchor))}const pr=(Qi,Cn,Do)=>{const ro=m.getSymbolInstanceTextSize(N,Et,this.transform.zoom,Kt),Ea=(Qi.x2-Qi.x1)*ro+2*Qi.padding,Ia=(Qi.y2-Qi.y1)*ro+2*Qi.padding,Pn=Et.hasIconTextFit&&!K?Cn:null;Pn&&pn(Pn);let ns={box:[],offscreen:!1,occluded:!1};const mr=Y?2*wi.length:wi.length;for(let zn=0;zn<mr;++zn){const Lo=this.attemptAnchorPlacement(wi[zn%wi.length],Qi,D,z,Qe,Ea,Ia,ro,J,oe,C,T,q,zn>=wi.length,Et,Kt,m,Do,Pn,N,j);if(Lo&&(ns=Lo.placedGlyphBoxes,ns&&ns.box&&ns.box.length)){ni=!0,Wt=Lo.shift;break}}return ns};Zi((()=>pr(Pr,ti.iconBox,o.bI.horizontal)),(()=>{const Qi=ti.verticalTextBox;return Qi&&pn(Qi),m.allowVerticalPlacement&&!(si&&si.box&&si.box.length)&&Dt>0&&Qi?pr(Qi,ti.verticalIconBox,o.bI.vertical):{box:null,offscreen:null,occluded:null}})),si&&(ni=si.box,di=si.offscreen,ii=si.occluded);const Er=Ji(!(!si||!si.box));if(!ni&&this.prevPlacement){const Qi=this.prevPlacement.variableOffsets[vi];Qi&&(this.variableOffsets[vi]=Qi,this.markUsedJustification(m,Qi.anchor,Et,Er))}}else{const wi=(pr,Er)=>{const Qi=m.getSymbolInstanceTextSize(N,Et,this.transform.zoom,Kt,f),Cn=this.collisionIndex.placeCollisionBox(m,Qi,pr,D,z,Qe,new o.P(0,0),Y,C,T,q.predicate);return Cn&&Cn.box&&Cn.box.length&&(this.markUsedOrientation(m,Er,Et),this.placedOrientations[vi]=Er),Cn};Zi((()=>wi(Pr,o.bI.horizontal)),(()=>{const pr=ti.verticalTextBox;return m.allowVerticalPlacement&&Dt>0&&pr?(pn(pr),wi(pr,o.bI.vertical)):{box:null,offscreen:null,occluded:null}})),Ji(!!(si&&si.box&&si.box.length))}}if(or=si,ni=or&&or.box&&or.box.length>0,di=or&&or.offscreen,ii=or&&or.occluded,Et.useRuntimeCollisionCircles){const Ji=m.text.placedSymbolArray.get(Et.centerJustifiedTextSymbolIndex>=0?Et.centerJustifiedTextSymbolIndex:Et.verticalPlacedTextSymbolIndex),Zi=o.bJ(m.textSizeData,N,Ji),wi=y.get("text-padding");rr=this.collisionIndex.placeCollisionCircles(m,Y,Ji,m.lineVertexArray,m.glyphOffsetArray,Zi,T,S,M,c,oe,q.predicate,Et.collisionCircleDiameter*Zi/o.bU,wi,this.retainedQueryData[m.bucketInstanceId].tileID),ni=Y||rr.circles.length>0&&!rr.collisionDetected,di=di&&rr.offscreen,ii=rr.occluded}if(ti.iconFeatureIndex&&(Yr=ti.iconFeatureIndex),ti.iconBox){const Ji=Zi=>{pn(Zi);const wi=Et.hasIconTextFit&&Wt?ai(Wt.x,Wt.y,J,oe,this.transform.angle):new o.P(0,0),pr=m.getSymbolInstanceIconSize(j,this.transform.zoom,Et.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,pr,Zi,D,z,ht,wi,K,C,T,q.predicate)};yi&&yi.box&&yi.box.length&&ti.verticalIconBox?(ar=Ji(ti.verticalIconBox),kt=ar.box.length>0):(ar=Ji(ti.iconBox),kt=ar.box.length>0),di=di&&ar.offscreen,Vi=ar.occluded}const Mn=ee||Et.numHorizontalGlyphVertices===0&&Dt===0,Gn=ie||Et.numIconVertices===0;if(Mn||Gn?Gn?Mn||(kt=kt&&ni):ni=kt&&ni:kt=ni=kt&&ni,ni&&or&&or.box&&this.collisionIndex.insertCollisionBox(or.box,y.get("text-ignore-placement"),m.bucketInstanceId,yi&&yi.box&&Xn?Xn:Sr,q.ID),kt&&ar&&this.collisionIndex.insertCollisionBox(ar.box,y.get("icon-ignore-placement"),m.bucketInstanceId,Yr,q.ID),rr&&(ni&&this.collisionIndex.insertCollisionCircles(rr.circles,y.get("text-ignore-placement"),m.bucketInstanceId,Sr,q.ID),c)){const Ji=m.bucketInstanceId;let Zi=this.collisionCircleArrays[Ji];Zi===void 0&&(Zi=this.collisionCircleArrays[Ji]=new xh);for(let wi=0;wi<rr.circles.length;wi+=4)Zi.circles.push(rr.circles[wi+0]),Zi.circles.push(rr.circles[wi+1]),Zi.circles.push(rr.circles[wi+2]),Zi.circles.push(rr.collisionDetected?1:0)}const zr=m.projection.name!=="globe";lt=lt&&(zr||!ii),wt=wt&&(zr||!Vi),this.placements[vi]=new Tn(ni||lt,kt||wt,di||m.justReloaded),n.add(vi)},Yt=this.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(m,Yt),m.elevationType==="road"&&m.updateRoadElevation(Yt.canonical),m.updateZOffset(),m.sortFeaturesByY){const Et=m.getSortedSymbolIndexes(this.transform.angle);for(let Kt=Et.length-1;Kt>=0;--Kt){const ti=Et[Kt];Ot(m.symbolInstances.get(ti),ti,m.collisionArrays[ti])}m.hasAnyZOffset&&o.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 Et=m.getSortedIndexesByZOffset();for(let Kt=0;Kt<Et.length;++Kt){const ti=Et[Kt];Ot(m.symbolInstances.get(ti),ti,m.collisionArrays[ti])}}else for(let Et=t.symbolInstanceStart;Et<t.symbolInstanceEnd;Et++)Ot(m.symbolInstances.get(Et),Et,m.collisionArrays[Et]);if(c&&m.bucketInstanceId in this.collisionCircleArrays){const Et=this.collisionCircleArrays[m.bucketInstanceId];o.bi(Et.invProjMatrix,T),Et.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(t,n,c,d){const{leftJustifiedTextSymbolIndex:f,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,crossTileID:T}=c,S=o.b$(n),M=d===o.bI.vertical?x:S==="left"?f:S==="center"?m:S==="right"?y:-1;f>=0&&(t.text.placedSymbolArray.get(f).crossTileID=M>=0&&f!==M?0:T),m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=M>=0&&m!==M?0:T),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=M>=0&&y!==M?0:T),x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=M>=0&&x!==M?0:T)}markUsedOrientation(t,n,c){const d=n===o.bI.horizontal||n===o.bI.horizontalOnly?n:0,f=n===o.bI.vertical?n:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:T}=c,S=t.text.placedSymbolArray;m>=0&&(S.get(m).placedOrientation=d),y>=0&&(S.get(y).placedOrientation=d),x>=0&&(S.get(x).placedOrientation=d),T>=0&&(S.get(T).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let c=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const d=n?n.symbolFadeChange(t):1,f=n?n.opacities:{},m=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],S=f[x];S?(this.opacities[x]=new vo(S,d,T.text,T.icon,null,T.clipped),c=c||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[x]=new vo(null,d,T.text,T.icon,T.skipFade,T.clipped),c=c||T.text||T.icon)}for(const x in f){const T=f[x];if(!this.opacities[x]){const S=new vo(T,d,!1,!1);S.isHidden()||(this.opacities[x]=S,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=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n,c,d){const f=new Set;for(const m of n){const y=m.getBucket(t);y&&m.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,f,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,n,c,d,f,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,S=t.layers[0].paint,M=!!t.layers[0].dynamicFilter(),E=new vo(null,0,!1,!1,!0),C=T.get("text-allow-overlap"),D=T.get("icon-allow-overlap"),z=T.get("text-variable-anchor"),F=T.get("text-rotation-alignment")==="map",L=T.get("text-pitch-alignment")==="map",N=S.get("symbol-z-offset"),j=T.get("symbol-elevation-reference")==="sea",q=!N.isConstant(),X=new vo(null,0,C&&(D||!t.hasIconData()||T.get("icon-optional")),D&&(C||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const ee=(Y,K,J)=>{for(let pe=0;pe<K/4;pe++)Y.opacityVertexArray.emplaceBack(J)};let ie=0;m&&t.updateReplacement(y,m);for(let Y=0;Y<t.symbolInstances.length;Y++){const K=t.symbolInstances.get(Y),{numHorizontalGlyphVertices:J,numVerticalGlyphVertices:pe,crossTileID:oe,numIconVertices:Ie,tileAnchorX:xe,tileAnchorY:Me}=K;let Ue=null;const me=this.retainedQueryData[t.bucketInstanceId];q&&K&&me&&(Ue=c.latestFeatureIndex.loadFeature({featureIndex:K.featureIndex,bucketIndex:me.bucketIndex,sourceLayerIndex:me.sourceLayerIndex,layoutVertexArrayOffset:0}));const se=N.evaluate(Ue,{}),we=n.has(oe);let _e=this.opacities[oe];we?_e=E:_e||(_e=X,this.opacities[oe]=_e),n.add(oe);const ze=J>0||pe>0,Re=Ie>0,Le=this.placedOrientations[oe],Ze=Le===o.bI.vertical,at=Le===o.bI.horizontal||Le===o.bI.horizontalOnly;!ze&&!Re||_e.isHidden()||ie++;let dt=!1;if((ze||Re)&&m)for(const Qe of t.activeReplacements){if(o.bV(Qe,f,o.bW.Symbol,x)||Qe.min.x>xe||xe>Qe.max.x||Qe.min.y>Me||Me>Qe.max.y)continue;const ht=o.bX(xe,Me,y.canonical,Qe.footprintTileId.canonical);if(dt=o.bY(ht,Qe.footprint),dt)break}if(ze){const Qe=dt?Ns:Ko(_e.text);ee(t.text,J,Ze?Ns:Qe),ee(t.text,pe,at?Ns:Qe);const ht=_e.text.isHidden(),{leftJustifiedTextSymbolIndex:lt,centerJustifiedTextSymbolIndex:wt,rightJustifiedTextSymbolIndex:At,verticalPlacedTextSymbolIndex:Ot}=K,Yt=t.text.placedSymbolArray,Et=ht||Ze?1:0;lt>=0&&(Yt.get(lt).hidden=Et),wt>=0&&(Yt.get(wt).hidden=Et),At>=0&&(Yt.get(At).hidden=Et),Ot>=0&&(Yt.get(Ot).hidden=ht||at?1:0);const Kt=this.variableOffsets[oe];Kt&&this.markUsedJustification(t,Kt.anchor,K,Le);const ti=this.placedOrientations[oe];ti&&(this.markUsedJustification(t,"left",K,ti),this.markUsedOrientation(t,ti,K))}if(Re){const Qe=dt?Ns:Ko(_e.icon),{placedIconSymbolIndex:ht,verticalPlacedIconSymbolIndex:lt}=K,wt=t.icon.placedSymbolArray,At=_e.icon.isHidden()?1:0;ht>=0&&(ee(t.icon,Ie,Ze?Ns:Qe),wt.get(ht).hidden=At),lt>=0&&(ee(t.icon,K.numVerticalIconVertices,at?Ns:Qe),wt.get(lt).hidden=At)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Qe=t.collisionArrays[Y];if(Qe){let ht=new o.P(0,0),lt=!0;if(Qe.textBox||Qe.verticalTextBox){if(z){const At=this.variableOffsets[oe];At?(ht=oi(At.anchor,At.width,At.height,At.textOffset,At.textScale),F&&ht._rotate(L?this.transform.angle:-this.transform.angle)):lt=!1}M&&(lt=!_e.clipped),Qe.textBox&&xs(t.textCollisionBox.collisionVertexArray,_e.text.placed,!lt||Ze,se,j,ht.x,ht.y),Qe.verticalTextBox&&xs(t.textCollisionBox.collisionVertexArray,_e.text.placed,!lt||at,se,j,ht.x,ht.y)}const wt=lt&&!!(!at&&Qe.verticalIconBox);Qe.iconBox&&xs(t.iconCollisionBox.collisionVertexArray,_e.icon.placed,wt,se,j,K.hasIconTextFit?ht.x:0,K.hasIconTextFit?ht.y:0),Qe.verticalIconBox&&xs(t.iconCollisionBox.collisionVertexArray,_e.icon.placed,!wt,se,j,K.hasIconTextFit?ht.x:0,K.hasIconTextFit?ht.y:0)}}}if(t.fullyClipped=ie===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 Y=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=Y.invProjMatrix,t.placementViewportMatrix=Y.viewportMatrix,t.collisionCircleArray=Y.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 this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const c=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*c>t}setStale(){this.stale=!0}}function xs(l,t,n,c,d,f,m){l.emplaceBack(t?1:0,n?1:0,f||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,f||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,f||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,f||0,m||0,c,d?1:0)}const ci=Math.pow(2,25),Jl=Math.pow(2,24),sl=Math.pow(2,17),ol=Math.pow(2,16),Br=Math.pow(2,9),fr=Math.pow(2,8),pp=Math.pow(2,1);function Ko(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*ci+t*Jl+n*sl+t*ol+n*Br+t*fr+n*pp+t}const Ns=0;class al{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,n,c,d,f,m){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,f())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(n.placeLayerBucketPart(x,this._seenCrossTileIDs,c,x.symbolInstanceStart===0,m),this._currentPartIndex++,f())return!0}return!1}}class Ql{constructor(t,n,c,d,f,m,y,x,T){this.placement=new dn(t,f,m,y,x,T),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,c,d,f){const m=o.q.now(),y=()=>{const x=o.q.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=n[t[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=T)&&(!x.maxzoom||x.maxzoom>T)){const S=x,M=S.layout.get("symbol-z-elevate"),E=S.layout.get("symbol-sort-key").constantOr(1)!==void 0,C=S.layout.get("symbol-z-order"),D=C==="viewport-y"||C==="auto"&&!(C!=="viewport-y"&&E),z=S.layout.get("text-allow-overlap")||S.layout.get("icon-allow-overlap")||S.layout.get("text-ignore-placement")||S.layout.get("icon-ignore-placement"),F=D&&z,L=this._inProgressLayer=this._inProgressLayer||new al(S),N=o.C(x.source,x.scope);if(L.continuePlacement(M||F?d[N]:c[N],this.placement,this._showCollisionBoxes,x,y,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const ll=512/o.aj/2;class ec{constructor(t,n,c){this.tileID=t,this.bucketInstanceId=c,this.index=new o.c0(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*o.aj,f=t.canonical.y*o.aj;for(let m=0;m<n.length;m++){const{key:y,crossTileID:x,tileAnchorX:T,tileAnchorY:S}=n.get(m),M=Math.floor((d+T)*ll),E=Math.floor((f+S)*ll);this.index.add(M,E),this.keys.push(y),this.crossTileIDs.push(x)}this.index.finish()}findMatches(t,n,c){const d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z),f=ll/Math.pow(2,n.canonical.z-this.tileID.canonical.z),m=n.canonical.x*o.aj,y=n.canonical.y*o.aj;for(let x=0;x<t.length;x++){const T=t.get(x);if(T.crossTileID)continue;const{key:S,tileAnchorX:M,tileAnchorY:E}=T,C=Math.floor((m+M)*f),D=Math.floor((y+E)*f),z=this.index.range(C-d,D-d,C+d,D+d).sort(((F,L)=>F-L));for(const F of z){const L=this.crossTileIDs[F];if(this.keys[F]===S&&!c.has(L)){c.add(L),T.crossTileID=L;break}}}}}class $r{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class vs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const c in this.indexes){const d=this.indexes[c],f={};for(const m in d){const y=d[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),f[y.tileID.key]=y}this.indexes[c]=f}this.lng=t}addBucket(t,n,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let f=0;f<n.symbolInstances.length;f++)n.symbolInstances.get(f).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const f in this.indexes){const m=this.indexes[f];if(Number(f)>t.overscaledZ)for(const y in m){const x=m[y];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,d)}else{const y=m[t.scaledTo(Number(f)).key];y&&y.findMatches(n.symbolInstances,t,d)}}for(let f=0;f<n.symbolInstances.length;f++){const m=n.symbolInstances.get(f);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 ec(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const c of n.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let n=!1;for(const c in this.indexes){const d=this.indexes[c];for(const f in d)t[d[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[f]),delete d[f],n=!0)}return n}}class sn{constructor(){this.layerIndexes={},this.crossTileIDs=new $r,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,c,d){let f=this.layerIndexes[t.fqid];f===void 0&&(f=this.layerIndexes[t.fqid]=new vs);let m=!1;const y={};d.name!=="globe"&&f.handleWrapJump(c);for(const x of n){const T=x.getBucket(t);T&&t.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),f.addBucket(x.tileID,T,this.crossTileIDs)&&(m=!0),y[T.bucketInstanceId]=!0)}return f.removeStaleBuckets(y)&&(m=!0),m}pruneUnusedLayers(t){const n={};t.forEach((c=>{n[c]=!0}));for(const c in this.layerIndexes)n[c]||delete this.layerIndexes[c]}}const bo=771;class Pt{constructor(t,n,c,d){this.blendFunction=t,this.blendColor=n.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}Pt.Replace=[1,0,1,0],Pt.disabled=new Pt(Pt.Replace,o.am.transparent,[!1,!1,!1,!1]),Pt.unblended=new Pt(Pt.Replace,o.am.transparent,[!0,!0,!0,!0]),Pt.alphaBlended=new Pt([1,bo,1,bo],o.am.transparent,[!0,!0,!0,!0]),Pt.alphaBlendedNonPremultiplied=new Pt([770,bo,770,bo],o.am.transparent,[!0,!0,!0,!0]),Pt.multiply=new Pt([774,0,774,0],o.am.transparent,[!0,!0,!0,!0]);class it{constructor(t,n,c){this.func=t,this.mask=n,this.range=c}}it.ReadOnly=!1,it.ReadWrite=!0,it.disabled=new it(519,it.ReadOnly,[0,1]);const kn=7680;class xt{constructor(t,n,c,d,f,m){this.test=t,this.ref=n,this.mask=c,this.fail=d,this.depthFail=f,this.pass=m}}xt.disabled=new xt({func:519,mask:0},0,0,kn,kn,kn);const hr=1029,cl=2305;class mt{constructor(t,n,c){this.enable=t,this.mode=n,this.frontFace=c}}function Jo(l,t){const n=o.c6(l,3);o.c8(l,t),o.cc(l,3,n)}function Qo(l,t){const n=o.c3([]);return o.c4(n,n,-t),o.c5(n,n,-l),n}function Vs(l,t){const n=[l[0],l[1],0],c=[t[0],t[1],0];if(o.ae(n)>=1e-15){const m=o.au([],n);o.c1(c,m,o.bG(c,m)),t[0]=c[0],t[1]=c[1]}const d=o.bF([],t,l);if(o.c2(d)<1e-15)return null;const f=Math.atan2(-d[1],d[0]);return Qo(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),f)}mt.disabled=new mt(!1,hr,cl),mt.backCCW=new mt(!0,hr,cl),mt.backCW=new mt(!0,hr,2304),mt.frontCW=new mt(!0,1028,2304),mt.frontCCW=new mt(!0,1028,cl);class yd{constructor(t,n){this.position=t,this.orientation=n}get position(){return this._position}set position(t){if(t){const n=t instanceof o.ac?t:new o.ac(t[0],t[1],t[2]);
vendor: 4,345 bytes, line 15
15this._renderWorldCopies&&(n.x=o.bQ(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n){if(this.orientation=null,!this.position)return;const c=this.position,d=this._elevation?this._elevation.getAtPointOrZero(o.ac.fromLngLat(t)):0,f=o.ac.fromLngLat(t,d),m=[f.x-c.x,f.y-c.y,f.z-c.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=Vs(m,n)}setPitchBearing(t,n){this.orientation=Qo(o.al(t),o.al(-n))}}class Bn{constructor(t,n){this._transform=o.bx([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new o.ac(t[0],t[1],t[2])}get position(){const t=o.c6(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&o.cc(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||o.c3([]),t&&Jo(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),n=this.right();return{bearing:Math.atan2(-n[1],n[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,n){this._orientation=Qo(t,n),Jo(this._transform,this._orientation)}forward(){const t=o.c6(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=o.c6(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=o.c6(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const c=new Float64Array(16);return o.bi(c,this.getWorldToCamera(t,n)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,n,c){const d=this.position;o.c1(d,d,-t);const f=new Float64Array(16);return o.bn(f,[c,c,c]),o.bo(f,f,d),f[10]*=n,f}getWorldToCamera(t,n){const c=new Float64Array(16),d=new Float64Array(4),f=this.position;return o.c7(d,this._orientation),o.c1(f,f,-t),o.c8(c,d),o.bo(c,c,f),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=n,c[9]*=n,c[10]*=n,c[11]*=n,c}getCameraToClipPerspective(t,n,c,d){const f=new Float64Array(16);return o.c9(f,t,n,c,d),f}getCameraToClipOrthographic(t,n,c,d,f,m){const y=new Float64Array(16);return o.ca(y,t,n,c,d,f,m),y}getDistanceToElevation(t,n=!1){const c=t===0?0:o.cb(t,n?o.aY(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new Bn([...this.position],[...this.orientation])}}const Zr={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class hl{constructor(t=0,n=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(n)||n<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=n,this.left=c,this.right=d}interpolate(t,n,c){return n.top!=null&&t.top!=null&&(this.top=o.ai(t.top,n.top,c)),n.bottom!=null&&t.bottom!=null&&(this.bottom=o.ai(t.bottom,n.bottom,c)),n.left!=null&&t.left!=null&&(this.left=o.ai(t.left,n.left,c)),n.right!=null&&t.right!=null&&(this.right=o.ai(t.right,n.right,c)),this}getCenter(t,n){const c=o.ay((this.left+t-this.right)/2,0,t),d=o.ay((this.top+n-this.bottom)/2,0,n);return new o.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 hl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Tr=15;class vh{constructor(t,n,c,d,f,m,y){this.tileSize=512,this._renderWorldCopies=f===void 0||f,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(m),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new o.ci(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 hl,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Bn,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 vh(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: 15,873 bytes, line 15
15xaggeration=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<Tr}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,n=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(n),this._calcMatrices()}getProjection(){return o.aF(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=o.cj(this.projectionOptions);const c=this.getProjection(),d=!o.bv(n,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=o.cj({name:"mercator"});const n=t!==this.projection.name;return n&&this._calcMatrices(),n}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 o.cb(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this.width,this.height)}get bearing(){return o.bQ(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=o.ck(),o.cl(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=o.ay(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,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=o.al(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 n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._setZoom(n),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,n=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!n||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;n||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,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,f=0;for(let m=0;m<n.length;m++){const y=new o.P(n[m][0]*this.width,c+n[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,f+=T}return f===0?NaN:d/f}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,n=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*n,d=this._mercatorZfromZoom(t),f=this._mercatorZfromZoom(this._maxZoom),m=Math.max(d-c,f);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())}computeZoomRelativeTo(t){const n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[n.x,n.y,n.z]:[t.x,t.y,t.z];const d=o.ae(o.at([],this._camera.position,c));return o.ay(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let n=!1;if(t.orientation&&!o.cm(t.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];o.cn(c,this._camera.position)||(this._setCameraPosition(c),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,n=new yd;return n.position=new o.ac(t[0],t[1],t[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(t){if(!o.co(t))return!1;o.cp(t,t);const n=o.cq([],[0,0,-1],t),c=o.cq([],[0,-1,0],t);if(c[2]<0)return!1;const d=Vs(n,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const n=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=o.ay(t[2],d/c,d/n),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,n,c){this._unmodified=!1,this._edgeInsets.interpolate(t,n,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new o.cr(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new o.P(0,0)),d=this.pointCoordinate(new o.P(this.width,0)),f=this.pointCoordinate(new o.P(this.width,this.height)),m=this.pointCoordinate(new o.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,f.x,m.x)),x=Math.floor(Math.max(c.x,d.x,f.x,m.x)),T=1;for(let S=y-T;S<=x+T;S++)S!==0&&n.push(new o.cr(S,t))}return n}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,n,c){let d=[];const f=c!=null,m=!f;if(m&&this.zoom<n||f&&c[0]===0&&c[1]===0)return d;const y=new Set,x=(S,M,E,C,D)=>{const z=o.cV(M,S,E,C,D);y.has(z)||(d.push(new o.aM(S,M,E,C,D)),y.add(z))};for(let S=0;S<t.length;S++){const M=t[S];if(m&&M.canonical.z!==n)continue;const E=M.canonical,C=M.overscaledZ,D=M.wrap,z=1<<E.z,F=E.x+1<z,L=E.x>0,N=E.y+1<z,j=E.y>0,q=M.wrap-(L?0:1),X=M.wrap+(F?0:1),ee=L?E.x-1:z-1,ie=F?E.x+1:0;if(f)c[0]<0?(x(C,X,E.z,ie,E.y),c[1]<0&&N&&(x(C,D,E.z,E.x,E.y+1),x(C,X,E.z,ie,E.y+1)),c[1]>0&&j&&(x(C,D,E.z,E.x,E.y-1),x(C,X,E.z,ie,E.y-1))):c[0]>0?(x(C,q,E.z,ee,E.y),c[1]<0&&N&&(x(C,D,E.z,E.x,E.y+1),x(C,q,E.z,ee,E.y+1)),c[1]>0&&j&&(x(C,D,E.z,E.x,E.y-1),x(C,q,E.z,ee,E.y-1))):c[1]<0&&N?x(C,D,E.z,E.x,E.y+1):j&&x(C,D,E.z,E.x,E.y-1);else{const Y=M.visibleQuadrants;1&Y&&(x(C,q,E.z,ee,E.y),j&&(x(C,D,E.z,E.x,E.y-1),x(C,q,E.z,ee,E.y-1))),2&Y&&(x(C,X,E.z,ie,E.y),j&&(x(C,D,E.z,E.x,E.y-1),x(C,X,E.z,ie,E.y-1))),4&Y&&(x(C,q,E.z,ee,E.y),N&&(x(C,D,E.z,E.x,E.y+1),x(C,q,E.z,ee,E.y+1))),8&Y&&(x(C,X,E.z,ie,E.y),N&&(x(C,D,E.z,E.x,E.y+1),x(C,X,E.z,ie,E.y+1)))}}const T=[];for(const S of d)d.some((M=>S.isChildOf(M)))||T.push(S);if(d=T.filter((S=>!t.some((M=>!!(S.overscaledZ<n&&M.isChildOf(S))||S.equals(M)||S.isChildOf(M))))),m){const S=1<<n,M=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),E=[S*M.x,S*M.y],C=4,D=C*C;d=d.filter((z=>{const F=z.canonical.x+.5-E[0],L=z.canonical.y+.5-E[1];return F*F+L*L<D}))}return d}extendTileCoverToNearPlane(t,n,c){const d=[],f=new Set;for(const N of t)f.add(N.key);const m=(N,j,q,X,ee)=>{const ie=o.cV(j,N,q,X,ee);f.has(ie)||(d.push(new o.aM(N,j,q,X,ee)),f.add(ie))},y=t.reduce(((N,j)=>Math.max(N,j.overscaledZ)),c),x=1<<c,T=[new o.P(0,0),new o.P(o.aj,0),new o.P(o.aj,o.aj),new o.P(0,o.aj)],S=new o.P(0,0),M=new o.P(0,0),E=(N,j)=>{const q=Math.floor(N[0]),X=Math.floor(N[1]),ee=(N[0]-q)*o.aj,ie=(N[1]-X)*o.aj,Y=Math.floor(j[0]),K=Math.floor(j[1]),J=(j[0]-Y)*o.aj,pe=(j[1]-K)*o.aj;for(let oe=-1;oe<=1;oe++){const Ie=q+oe;if(!(Ie<0||Ie>=x)){S.x=ee-oe*o.aj,M.x=J-(Ie-Y)*o.aj;for(let xe=-1;xe<=1;xe++){const Me=X+xe;S.y=ie-xe*o.aj,M.y=pe-(Me-K)*o.aj,o.cW(S,M,T)&&m(y,0,c,Ie,Me)}}}},C=n.points,D=C[o.cs],z=C[o.ct],F=this._projectToGround(D,C[o.cu]),L=this._projectToGround(z,C[o.cv]);return E(D,F),E(z,L),d}_projectToGround(t,n){return o.cw(o.cx(),t,n,t[2]/(t[2]-n[2]))}coveringTiles(t){let n=this.coveringZoomLevel(t);const c=n,d=this.elevation&&this.elevation.exaggeration(),f=d&&!t.isTerrainDEM,m=this.projection.name==="mercator";if(t.minzoom!==void 0&&n<t.minzoom)return[];t.maxzoom!==void 0&&n>t.maxzoom&&(n=t.maxzoom);const y=this.locationCoordinate(this.center),x=this.center.lat,T=1<<n,S=[T*y.x,T*y.y,0],M=this.projection.name==="globe",E=!M,C=o.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,E),D=M?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=T*o.cb(1,this.center.lat),F=this._camera.position[2]/o.cb(1,this.center.lat),L=[T*D.x,T*D.y,F*(E?1:z)],N=M||d,j=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),q=this.isLODDisabled(!0)?n:0;let X;if(this._elevation&&t.isTerrainDEM)X=1e4*this._elevation.exaggeration();else if(this._elevation){const se=this._elevation.getMinMaxForVisibleTiles();X=se?se.max:this._centerAltitude}else X=this._centerAltitude;const ee=t.isTerrainDEM?-X:this._elevation?this._elevation.getMinElevationBelowMSL():0,ie=this.projection.isReprojectedInTileSpace?o.cz(this):1,Y=se=>{const _e=new o.ac(se.x+25e-6,se.y,se.z),ze=new o.ac(se.x,se.y+25e-6,se.z),Re=se.toLngLat(),Le=_e.toLngLat(),Ze=ze.toLngLat(),at=this.locationCoordinate(Re),dt=this.locationCoordinate(Le),Qe=this.locationCoordinate(Ze),ht=Math.hypot(dt.x-at.x,dt.y-at.y),lt=Math.hypot(Qe.x-at.x,Qe.y-at.y);return Math.sqrt(ht*lt)*ie/25e-6},K=se=>{const we=X,_e=ee;return{aabb:o.cC(this,T,0,0,0,se,_e,we,this.projection),zoom:0,x:0,y:0,minZ:_e,maxZ:we,wrap:se,fullyVisible:!1}},J=[];let pe=[];const oe=n,Ie=t.reparseOverscaled?c:n,xe=(F-this._centerAltitude)*z,Me=se=>{if(!this._elevation||!se.tileID||!m)return;const we=this._elevation.getMinMaxForTile(se.tileID),_e=se.aabb;we?(_e.min[2]=we.min,_e.max[2]=we.max,_e.center[2]=(_e.min[2]+_e.max[2])/2):(se.shouldSplit=me(se),se.shouldSplit||(_e.min[2]=_e.max[2]=_e.center[2]=this._centerAltitude))},Ue=(se,we)=>{if(.707*we<se)return 1;const _e=we/se;return _e/(1.4144271570014144+(Math.pow(1.1,_e-1.4144271570014144+1)-1)/(1.1-1)-1)},me=se=>{if(se.zoom<q)return!0;if(se.zoom===oe)return!1;if(se.shouldSplit!=null)return se.shouldSplit;const we=se.aabb.distanceX(L),_e=se.aabb.distanceY(L);let ze=xe,Re=1;if(M){ze=se.aabb.distanceZ(L);const lt=Math.pow(2,se.zoom),wt=o.aY((se.y+1)/lt),At=o.aY(se.y/lt),Ot=Math.min(Math.max(x,wt),At),Yt=o.c_(Ot)/o.c_(x);if(Re=Ot===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Yt/this._mercatorScaleRatio),this.zoom<=o.cX&&se.zoom===oe-1&&Yt>=.9)return!0}else if(f&&(ze=se.aabb.distanceZ(L)*z),this.projection.isReprojectedInTileSpace&&c<=5){const lt=Math.pow(2,se.zoom),wt=Y(new o.ac((se.x+.5)/lt,(se.y+.5)/lt));Re=wt>.85?1:wt}if(!m){const lt=Math.sqrt(we*we+_e*_e+ze*ze);let wt=(1<<oe-se.zoom)*j*Re;return wt*=Ue(Math.max(ze,xe),lt),lt<wt}let Le=Number.MAX_VALUE,Ze=0;const at=se.aabb.getCorners(),dt=[];for(const lt of at){o.at(dt,lt,L),M||(f?dt[2]*=z:dt[2]=xe);const wt=o.bG(dt,this._camera.forward());wt<Le&&(Le=wt,Ze=Math.abs(dt[2]))}let Qe=(1<<oe-se.zoom)*j*Re;if(Qe*=Ue(Math.max(Ze,xe),Le),Le<Qe)return!0;const ht=se.aabb.closestPoint(S);return ht[0]===S[0]&&ht[1]===S[1]};if(this.renderWorldCopies)for(let se=1;se<=3;se++)J.push(K(-se)),J.push(K(se));for(J.push(K(0));J.length>0;){const se=J.pop(),we=se.x,_e=se.y;let ze=se.fullyVisible;const Re=()=>this.projection.name==="globe"&&(se.y===0||se.y===(1<<se.zoom)-1);if(!ze){let Le=N?se.aabb.intersects(C):se.aabb.intersectsFlat(C);if(Le===0&&Re()){const Ze=new o.cA(se.zoom,we,_e);Le=o.cB(this,T,Ze,!0).intersects(C)}if(Le===0)continue;ze=Le===2}if(se.zoom!==oe&&me(se))for(let Le=0;Le<4;Le++){const Ze=(we<<1)+Le%2,at=(_e<<1)+(Le>>1),dt={aabb:m?se.aabb.quadrant(Le):o.cC(this,T,se.zoom+1,Ze,at,se.wrap,se.minZ,se.maxZ,this.projection),zoom:se.zoom+1,x:Ze,
15y:at,wrap:se.wrap,fullyVisible:ze,tileID:void 0,shouldSplit:void 0,minZ:se.minZ,maxZ:se.maxZ};f&&!M&&(dt.tileID=new o.aM(se.zoom+1===oe?Ie:se.zoom+1,se.wrap,se.zoom+1,Ze,at),Me(dt)),J.push(dt)}else{const Le=se.zoom===oe?Ie:se.zoom;if(t.minzoom&&t.minzoom>Le)continue;let Ze=0;if(!ze){let ht=N?se.aabb.intersectsPrecise(C):se.aabb.intersectsPreciseFlat(C);if(ht===0&&Re()){const lt=new o.cA(se.zoom,we,_e);ht=o.cB(this,T,lt,!0).intersectsPrecise(C)}if(ht===0)continue;if(t.calculateQuadrantVisibility)if(C.containsPoint(se.aabb.center))Ze=15;else for(let lt=0;lt<4;lt++)se.aabb.quadrant(lt).intersects(C)!==0&&(Ze|=1<<lt)}const at=S[0]-(.5+we+(se.wrap<<se.zoom))*(1<<n-se.zoom),dt=S[1]-.5-_e,Qe=se.tileID?se.tileID:new o.aM(Le,se.wrap,se.zoom,we,_e);t.calculateQuadrantVisibility&&(Qe.visibleQuadrants=Ze),pe.push({tileID:Qe,distanceSq:at*at+dt*dt})}}if(this.fogCullDistSq){const se=this.fogCullDistSq,we=this.horizonLineFromTop();pe=pe.filter((_e=>{const ze=[0,0,0,1],Re=[o.aj,o.aj,0,1],Le=this.calculateFogTileMatrix(_e.tileID.toUnwrapped());o.aA(ze,ze,Le),o.aA(Re,Re,Le);const Ze=o.cD([],ze,Re),at=o.cE([],ze,Re),dt=o.cY(Ze,at);if(dt===0)return!0;let Qe=!1;const ht=this._elevation;if(ht&&dt>se&&we!==0){const lt=this.calculateProjMatrix(_e.tileID.toUnwrapped());let wt;t.isTerrainDEM||(wt=ht.getMinMaxForTile(_e.tileID)),wt||(wt={min:ee,max:X});const At=o.cF(this.rotation),Ot=[At[0]*o.aj,At[1]*o.aj,wt.max];o.ad(Ot,Ot,lt),Qe=(1-Ot[1])*this.height*.5<we}return dt<se||Qe}))}return pe.sort(((se,we)=>se.distanceSq-we.distanceSq)).map((se=>se.tileID))}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=o.ay(t.lat,-o.cG,o.cG),c=this.projection.project(t.lng,n);return new o.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/o.cb(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let c,d;const f=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(n.x-f.x)/y,d=(n.y-f.y)/y}else{const y=this.pointCoordinate(n),x=this.pointCoordinate(f);c=y.x-x.x,d=y.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new o.ac(m.x-c,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,n){return this.projection.locationPoint(this,t,n)}locationPoint3D(t,n){return this.projection.locationPoint(this,t,n,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,n){return this.coordinateLocation(this.pointCoordinate3D(t,n))}locationCoordinate(t,n){const c=n?o.cb(n,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new o.ac(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,n){const c=n??this._centerAltitude,d=[t.x,t.y,0,1],f=[t.x,t.y,1,1];o.aA(d,d,this.pixelMatrixInverse),o.aA(f,f,this.pixelMatrixInverse);const m=f[3];o.cH(d,d,1/d[3]),o.cH(f,f,1/m);const y=d[2],x=f[2];return{p0:d,p1:f,t:y===x?0:(c-y)/(x-y)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return o.aA(n,n,this.pixelMatrixInverse),o.aA(c,c,this.pixelMatrixInverse),o.cH(n,n,1/n[3]),o.cH(c,c,1/c[3]),n[2]=o.cb(n[2],this._center.lat)*this.worldSize,c[2]=o.cb(c[2],this._center.lat)*this.worldSize,o.cH(n,n,1/this.worldSize),o.cH(c,c,1/this.worldSize),new o.av([n[0],n[1],n[2]],o.au([],o.at([],c,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:c,t:d}=t,f=o.cb(n[2],this._center.lat),m=o.cb(c[2],this._center.lat);return new o.ac(o.ai(n[0],c[0],d)/this.worldSize,o.ai(n[1],c[1],d)/this.worldSize,o.ai(f,m,d))}pointCoordinate(t,n=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,n)}pointCoordinate3D(t,n){if(!this.elevation)return this.pointCoordinate(t,n);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new o.ac(c[0],c[1],c[2]);let d=0,f=this.horizonLineFromTop();if(t.y>f)return this.pointCoordinate(t,n);const m=.02*f,y=t.clone();for(let x=0;x<10&&f-d>m;x++){y.y=o.ai(d,f,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(f=y.y,c=T):d=y.y}return c?new o.ac(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>=o.cI)return!this.isPointAboveHorizon(t);const n=this.pointCoordinate(t);return n.y>=0&&n.y<=1}_coordinatePoint(t,n){const c=n&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return o.aA(d,d,this.pixelMatrix),d[3]>0?new o.P(d[0]/d[3],d[1]/d[3]):new o.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,f=this.pointLocation3D(new o.P(n,t)),m=this.pointLocation3D(new o.P(d,t)),y=this.pointLocation3D(new o.P(d,c)),x=this.pointLocation3D(new o.P(n,c));let T=Math.min(f.lng,m.lng,y.lng,x.lng),S=Math.max(f.lng,m.lng,y.lng,x.lng),M=Math.min(f.lat,m.lat,y.lat,x.lat),E=Math.max(f.lat,m.lat,y.lat,x.lat);const C=Math.pow(2,-this.zoom)/16*270,D=this.projection.name==="globe"?1:4,z=(F,L,N,j,q)=>{const X=(F+N)/2,ee=(L+j)/2,ie=new o.P(X,ee),{lng:Y,lat:K}=this.pointLocation3D(ie),J=Math.max(0,T-Y,M-K,Y-S,K-E);T=Math.min(T,Y),S=Math.max(S,Y),M=Math.min(M,K),E=Math.max(E,K),(q<D||J>C)&&(z(F,L,X,ee,q+1),z(X,ee,N,j,q+1))};if(z(n,t,d,t,1),z(d,t,d,c,1),z(d,c,n,c,1),z(n,c,n,t,1),this.projection.name==="globe"){const[F,L]=o.cJ(this);F?(E=90,S=180,T=-180):L&&(M=-90,S=180,T=-180)}return new o.aG(new o.ci(T,M),new o.ci(S,E))}_getBoundsRectangular(t,n){const{top:c,left:d}=this._edgeInsets,f=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,y=new o.P(d,c),x=new o.P(m,c),T=new o.P(m,f),S=new o.P(d,f);let M=this.pointCoordinate(y,t),E=this.pointCoordinate(x,t);const C=this.pointCoordinate(T,n),D=this.pointCoordinate(S,n),z=(F,L)=>(L.y-F.y)/(L.x-F.x);return M.y>1&&E.y>=0?M=new o.ac((1-D.y)/z(D,M)+D.x,1):M.y<0&&E.y<=1&&(M=new o.ac(-D.y/z(D,M)+D.x,0)),E.y>1&&M.y>=0?E=new o.ac((1-C.y)/z(C,E)+C.x,1):E.y<0&&M.y<=1&&(E=new o.ac(-C.y/z(C,E)+C.x,0)),new o.aG().extend(this.coordinateLocation(M)).extend(this.coordinateLocation(E)).extend(this.coordinateLocation(D)).extend(this.coordinateLocation(C))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const n=t.visibleDemTiles.reduce(((c,d)=>
vendor: 4,707 bytes, line 15
15{if(d.dem){const f=d.dem.tree;c.min=Math.min(c.min,f.minimums[0]),c.max=Math.max(c.max,f.maximums[0])}return c}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(n.min*t.exaggeration(),n.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 n=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-n*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-o.cG,this.maxLat=o.cG,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=o.aD(this.minLng)*this.tileSize,this.worldMaxX=o.aD(this.maxLng)*this.tileSize,this.worldMinY=o.aH(this.maxLat)*this.tileSize,this.worldMaxY=o.aH(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,n){return this.projection.createTileMatrix(this,n,t)}calculateDistanceTileData(t){const n=t.key,c=this._distanceTileDataCache;if(c[n])return c[n];const d=t.canonical,f=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,S=this.point;S.x*=m/this.worldSize,S.y*=m/this.worldSize;const M=this.angle,E=Math.sin(-M),C=-Math.cos(-M);return c[n]={bearing:[E,C],center:[(S.x-x)*f,(S.y-T)*f],scale:y/o.aj*f},c[n]}calculateFogTileMatrix(t){const n=t.key,c=this._fogTileMatrixCache;if(c[n])return c[n];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return o.az(d,this.worldToFogMatrix,d),c[n]=new Float32Array(d),c[n]}calculateProjMatrix(t,n=!1,c=!1){const d=t.key;let f;if(f=c?this._expandedProjMatrixCache:n?this._alignedProjMatrixCache:this._projMatrixCache,f[d])return f[d];const m=this.calculatePosMatrix(t,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:n?this.alignedProjMatrix:this.projMatrix,o.az(m,y,m),f[d]=new Float32Array(m),f[d]}calculatePixelsToTileUnitsMatrix(t){const n=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[n])return c[n];const d=o.cK(t,this);return c[n]=d,c[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,n=o.bn([],[t,t,t]);return o.az(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const n=o.cb(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(n),d=this._camera.forward(),f=o.cb(1,this._center.lat);c[2]/=f,d[2]/=f,o.au(d,d);const m=t.raycast(c,d,t.exaggeration());if(m){const y=o.bE([],c,d,m),x=new o.ac(y[0],y[1],o.cb(y[2],o.aY(y[1]))),T=(x.z+o.ae([x.x-c[0],x.y-c[1],x.z-c[2]*f]))*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 n=this._elevation,c=o.cb(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),f=n.getAtPointOrZero(new o.ac(...d)),m=this.pixelsPerMeter/this.worldSize*f,y=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=y)if(x<0||t){const T=this.locationCoordinate(this._center,this._centerAltitude),S=[d[0],d[1],T.z-d[2]],M=o.ae(S);S[2]-=(y-x)/this._pixelsPerMercatorPixel;const E=o.ae(S);if(E===0)return;o.c1(S,S,M/E*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-S[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 E=this.center;return E.lat=o.ay(E.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(E.lng=o.ay(E.lng,this.minLng,this.maxLng)),this.center=E,void(this._constraining=!1)}const n=this._unmodified,{x:c,y:d}=this.point;let f=0,m=c,y=d;const x=this.width/2,T=this.height/2,S=this.worldMinY*this.scale,M=this.worldMaxY*this.scale;if(d-T<S&&(y=S+T),d+T>M&&(y=M-T),M-S<this.height&&(f=Math.max(f,this.height/(M-S)),y=(M+S)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const E=this.worldMinX*this.scale,C=this.worldMaxX*this.scale,D=this.worldSize/2-(E+C)/2;
15m=(c+D+this.worldSize)%this.worldSize-D,m-x<E&&(m=E+x),m+x>C&&(m=C-x),C-E<this.width&&(f=Math.max(f,this.width/(C-E)),m=(C+E)/2)}m===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new o.P(m,y))),f&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(f)),this._constrainCamera(),this._unmodified=n,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())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=o.cb(1,this.center.lat)/o.cb(1,o.c$));const d=o.cL(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 f=this.projection.zAxisUnit==="meters"?c:1,m=this._camera.getWorldToCamera(this.worldSize,f);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 K=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),J=K*this.aspect,pe=-J,oe=-K;J-=t.x,pe-=t.x,K+=t.y,oe+=t.y,y=this._camera.getCameraToClipOrthographic(pe,J,oe,K,this._nearZ,this._farZ),((Ie,xe,Me,Ue)=>{for(let me=0;me<16;me++)Ie[me]=o.ai(xe[me],Me[me],Ue)})(y,y,x,o.cZ(this.pitch>=Tr?1:this.pitch/Tr))}else y=x;const T=o.cM([],x,m);let S=o.cM([],y,m);if(this.projection.isReprojectedInTileSpace){const K=this.locationCoordinate(this.center),J=o.bx([]);o.bo(J,J,[K.x*this.worldSize,K.y*this.worldSize,0]),o.az(J,J,o.cN(this)),o.bo(J,J,[-K.x*this.worldSize,-K.y*this.worldSize,0]),o.az(S,S,J),o.az(T,T,J),this.inverseAdjustmentMatrix=o.cO(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=o.cP([],S,[this.worldSize,this.worldSize,this.worldSize/f,1]),this.projMatrix=S,this.invProjMatrix=o.bi(new Float64Array(16),this.projMatrix),n){const K=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);K[8]=2*-t.x/this.width,K[9]=2*t.y/this.height,this.expandedFarZProjMatrix=o.cM([],K,m)}else this.expandedFarZProjMatrix=this.projMatrix;const M=o.bi([],y);this.frustumCorners=o.cQ.fromInvProjectionMatrix(M,this.horizonLineFromTop(),this.height),this.cameraFrustum=o.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n);const E=new Float32Array(16);o.bx(E),o.cP(E,E,[1,-1,1]),o.cR(E,E,this._pitch),o.by(E,E,this.angle);const C=o.c9(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=o.bw(C);const D=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;C[8]=2*-t.x/this.width,C[9]=2*(t.y+D)/this.height,this.skyboxMatrix=o.az(E,C,E);const z=this.point,F=z.x,L=z.y,N=this.width%2/2,j=this.height%2/2,q=Math.cos(this.angle),X=Math.sin(this.angle),ee=F-Math.round(F)+q*N+X*j,ie=L-Math.round(L)+q*j+X*N,Y=new Float64Array(S);if(o.bo(Y,Y,[ee>.5?ee-1:ee,ie>.5?ie-1:ie,0]),this.alignedProjMatrix=Y,S=o.bz(),o.cP(S,S,[this.width/2,-this.height/2,1]),o.bo(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=o.bz(),o.cP(S,S,[1,-1,1]),o.bo(S,S,[-1,-1,0]),o.cP(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=o.az(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=o.bi(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=o.cS(this);const K=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=o.ad(K,K,m),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=S;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,n=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,f=[t,t,n];o.c1(f,f,d),o.c1(c,c,-1),o.cT(c,c,f);const m=o.bz();o.bo(m,m,c),o.cP(m,m,f),this.mercatorFogMatrix=m,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,n,d)}_computeCameraPosition(t){const n=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,f=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*n-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*f,d.y/this.worldSize-c[1]*f,t/this.worldSize*this._centerAltitude-c[2]*f]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let f=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(f=Math.min((n-c)/d,1)),this._camera.position=o.bE([],this._camera.position,t,f),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,n=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),f=o.cb(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(o.al(this._maxPitch)),y=Math.max((t[2]-f)/Math.cos(c),m),x=this._zoomFromMercatorZ(y);o.bE(t,t,n,y),this._pitch=o.ay(c,o.al(this.minPitch),o.al(this.maxPitch)),this.angle=o.bQ(d,-Math.PI,Math.PI),this._setZoom(o.ay(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new o.ac(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))}zoomFromMercatorZAdjusted(t){let n=0,c=o.cI,d=0,f=1/0;for(;c-n>1e-6&&c>n;){const m=n+.5*(c-n),y=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,y),T=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),S=Math.abs(m-T);S<f&&(f=S,d=m),m<T?n=m:c=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(o.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,n){const c=Math.min(t.x,n.x),d=Math.max(t.x,n.x),f=Math.min(t.y,n.y),m=Math.max(t.y,n.y);if(f<this.horizonLineFromTop(!1))return!0;
15if(this.projection.name!=="mercator")return!1;const y=[new o.P(c,f),new o.P(d,m),new o.P(c,m),new o.P(d,f)],x=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const S of y){const M=this.pointRayIntersection(S);if(M.t<0)return!0;const E=this.rayIntersectionCoordinate(M);if(E.x<x||E.y<0||E.x>T||E.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+o.cU(this.fovAboveCenter)>88||this.anyCornerOffEdge(new o.P(0,0),new o.P(this.width,this.height))}zoomDeltaToMovement(t,n){const c=o.ae(o.at([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+n;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=(function([n,c,d],f){const m=[n,c,d,1];o.aA(m,m,f);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 o.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(0,t))}}getCameraToCenterDistance(t,n=this.zoom,c=this.worldSize){const d=o.cL(t,n,this.width,this.height,1024),f=t.pixelSpaceConversion(this.center.lat,c,d);let m=.5/Math.tan(.5*this._fov)*this.height*f;return this.isOrthographic&&(m=o.ai(1,m,o.cZ(this.pitch>=Tr?1:this.pitch/Tr))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&o.az(t,t,this.globeMatrix),t}getFrustum(t){return o.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const Qn=(l,t)=>{if(t>0&&l.terrain&&o.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=l.transform,c=Math.max(Math.abs(n._zoom-(l.minCutoffZoom-1)),1),d=n.isLODDisabled(!1)?o.af(60,45,n.pitch):o.af(30,15,n.pitch),f=n._farZ-n._nearZ,m=t*n.height,y=((1-(x=d))*n.cameraToCenterDistance+x*(n._farZ+m))*c;var x;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(y-n._nearZ)/f,(y-m-n._nearZ)/f]}}},Nr={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class ul{constructor(t,n){this.aabb=t,this.lastCascade=n}}class mp{add(t,n){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],n.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],n.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],n.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],n.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],n.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],n.max[2])):this.receivers[t.key]=new ul(n,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,n,c){const d=o.d6.fromPoints(t.points);let f=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 S=!0;for(const M of x){const E=[M[0]*n,M[1]*n,M[2]];if(o.ad(E,E,c[T].matrix),E[0]<-1||E[0]>1||E[1]<-1||E[1]>1){S=!1;break}}if(y.lastCascade=T,f=Math.max(f,T),S)break}}return f+1}}class _p{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new mp,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,t.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},(()=>{this.painter.style.map.triggerRepaint()})),t.tp.registerParameter(Nr,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),t.tp.registerParameter(Nr,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),t.tp.registerParameter(Nr,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),t.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,n){const c=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!n||!n.properties)return;const d=n.properties.get("shadow-intensity");if(!n.shadowsEnabled()||d<=0||(this._shadowLayerCount=c.style.order.reduce(((D,z)=>{const F=c.style._mergedLayers[z];return D+(F.hasShadowPass()&&!F.isHidden(t.zoom)?1:0)}),0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const f=c.context,m=Nr.shadowMapResolution,y=Nr.shadowMapResolution;if(this._cascades.length===0||Nr.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let D=0;D<Nr.cascadeCount;++D){const z=c._shadowMapDebug,F=f.gl,L=f.createFramebuffer(m,y,z,"texture"),N=new o.T(f,{width:m,height:y,data:null},F.DEPTH_COMPONENT16);if(L.depthAttachment.set(N.texture),z){const j=new o.T(f,{width:m,height:y,data:null},F.RGBA8);L.colorAttachment.set(j.texture)}this._cascades.push({framebuffer:L,texture:N,matrix:[],far:0,boundingSphereRadius:0,frustum:new o.cy,scale:0})}}this.shadowDirection=ea(n);let x=0;if(t.elevation){const D=t.elevation,z=[1e4,-1e4];D.visibleDemTiles.filter((F=>
15F.dem)).forEach((F=>{const L=F.dem.tree;z[0]=Math.min(z[0],L.minimums[0]),z[1]=Math.max(z[1],L.maximums[0])})),z[0]!==1e4&&(x=(z[1]-z[0])*D.exaggeration())}const T=1.5*t.cameraToCenterDistance,S=3*T,M=new Float64Array(16);for(let D=0;D<this._cascades.length;++D){const z=this._cascades[D];let F=t.height/50,L=1;Nr.cascadeCount===1?L=S:D===0?L=T:(F=T,L=S);const[N,j]=ta(t,this.shadowDirection,F,L,Nr.shadowMapResolution,x);z.scale=t.scale,z.matrix=N,z.boundingSphereRadius=j,o.bi(M,z.matrix),z.frustum=o.cy.fromInvProjectionMatrix(M,1,0,!0),z.far=L}const E=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[E].far,this._cascades[E].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=1/Nr.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Nr.shadowMapResolution,this._uniformValues.u_shadowmap_0=Zr.ShadowMap0,this._uniformValues.u_shadowmap_1=Zr.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const C=c.transform.elevation;for(const D of this._groundShadowTiles){let z={min:0,max:0};if(C){const F=C.getMinMaxForTile(D);F&&(z=F)}this.addShadowReceiver(D.toUnwrapped(),z.min,z.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,n){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,Nr.shadowMapResolution,Nr.shadowMapResolution]);for(let f=0;f<this._numCascadesToRender;++f){c.currentShadowCascade=f,d.bindFramebuffer.set(this._cascades[f].framebuffer.framebuffer),d.clear({color:o.am.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?n[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,n=t.style,c=t.context,d=c.gl,f=n.directionalLight,m=n.ambientLight;if(!f||!m)return;const y=[],x=Qn(t,t.longestCutoffRange);x.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=wo(n,f,m),S=new it(d.LEQUAL,it.ReadOnly,t.depthRangeFor3D),M=new xt({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const E of this._groundShadowTiles){const C=E.toUnwrapped(),D=t.isTileAffectedByFog(E),z=t.getOrCreateProgram("groundShadow",{defines:y,overrideFog:D});this.setupShadows(C,z),t.uploadCommonUniforms(c,z,C,null,x);const F={u_matrix:t.transform.calculateProjMatrix(C),u_ground_shadow_factor:T};z.draw(t,d.TRIANGLES,S,M,Pt.multiply,mt.disabled,F,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Pt.unblended:Pt.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const n=this.painter.transform,c=n.calculatePosMatrix(t,n.worldSize);return o.az(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}calculateShadowPassMatrixFromMatrix(t){return o.az(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,n,c){if(!this.enabled)return;const d=this.painter.transform,f=this.painter.context,m=f.gl,y=this._uniformValues,x=new Float64Array(16),T=d.calculatePosMatrix(t,d.worldSize);for(let S=0;S<this._cascades.length;S++)o.az(x,this._cascades[S].matrix,T),y[S===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(x),f.activeTexture.set(m.TEXTURE0+Zr.ShadowMap0+S),this._cascades[S].texture.bindExtraParam(m.LINEAR,m.LINEAR,m.CLAMP_TO_EDGE,m.CLAMP_TO_EDGE,m.GREATER);if(this.useNormalOffset=!!c,this.useNormalOffset){const S=o.d4(t.canonical),M=2/d.tileSize*o.aj/Nr.shadowMapResolution,E=M*this._cascades[0].boundingSphereRadius,C=M*this._cascades[this._cascades.length-1].boundingSphereRadius,D=(c==="vector-tile"?1:3)*(function(z,F,L,N,j){const q=o.ay((z-22)/-22,0,1
15);return .125*(1-q)+4*q})(d.zoom);y.u_shadow_normal_offset=[S,E*D,C*D],y.u_shadow_bias=[1e-4,.0012,.012]}else y.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(f,y)}setupShadowsFromMatrix(t,n,c=!1){if(!this.enabled)return;const d=this.painter.context,f=d.gl,m=this._uniformValues,y=new Float64Array(16);for(let x=0;x<Nr.cascadeCount;x++)o.az(y,this._cascades[x].matrix,t),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(f.TEXTURE0+Zr.ShadowMap0+x),this._cascades[x].texture.bindExtraParam(f.LINEAR,f.LINEAR,f.CLAMP_TO_EDGE,f.CLAMP_TO_EDGE,f.GREATER);if(this.useNormalOffset=c,c){const x=Nr.normalOffset;m.u_shadow_normal_offset=[1,x,x],m.u_shadow_bias=[6e-5,.0012,.012]}else m.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(d,m)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,n,c,d){if(d[2]>=0)return{};const f=(function(x,T,S){const M=S/(1<<x.canonical.z);return new o.d6([x.canonical.x*M+x.wrap*S,x.canonical.y*M+x.wrap*S,0],[(x.canonical.x+1)*M+x.wrap*S,(x.canonical.y+1)*M+x.wrap*S,T])})(t,n,c).getCorners(),m=n/-d[2];d[0]<0?(o.d5(f[0],f[0],[d[0]*m,0,0]),o.d5(f[3],f[3],[d[0]*m,0,0])):d[0]>0&&(o.d5(f[1],f[1],[d[0]*m,0,0]),o.d5(f[2],f[2],[d[0]*m,0,0])),d[1]<0?(o.d5(f[0],f[0],[0,d[1]*m,0]),o.d5(f[1],f[1],[0,d[1]*m,0])):d[1]>0&&(o.d5(f[2],f[2],[0,d[1]*m,0]),o.d5(f[3],f[3],[0,d[1]*m,0]));const y={};return y.vertices=f,y.planes=[Us(f[1],f[0],f[4]),Us(f[2],f[1],f[5]),Us(f[3],f[2],f[6]),Us(f[0],f[3],f[7])],y}addShadowReceiver(t,n,c){this._receivers.add(t,o.d6.fromTileIdAndHeight(t,n,c))}getMaxCascadeForTile(t){const n=this._receivers.get(t);return n&&n.lastCascade?n.lastCascade:0}}function Us(l,t,n){const c=o.at([],n,t),d=o.at([],l,t),f=o.bF([],c,d),m=o.ae(f);return m===0?[0,0,1,0]:(o.c1(f,f,1/m),[f[0],f[1],f[2],-o.bG(f,t)])}function ea(l){const t=l.properties.get("direction"),n=o.d1(t.x,t.y,t.z);n[2]=o.ay(n[2],0,75);const c=o.d3([n[0],n[1],n[2]]);return o.d2(c.x,c.y,c.z)}function wo(l,t,n){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),f=t.properties.get("intensity"),m=t.properties.get("direction"),y=[m.x,m.y,m.z],x=n.properties.get("color-use-theme")==="none",T=n.properties.get("color"),S=n.properties.get("intensity"),M=Math.max(o.bG([0,0,1],y),0),E=[0,0,0];o.c1(E,T.toPremultipliedRenderColor(x?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),S);const C=[0,0,0];return o.c1(C,d.toPremultipliedRenderColor(c?null:l.getLut(n.scope)).toArray01Linear().slice(0,3),M*f),o.d8([E[0]>0?E[0]/(E[0]+C[0]):0,E[1]>0?E[1]/(E[1]+C[1]):0,E[2]>0?E[2]/(E[2]+C[2]):0])}function ta(l,t,n,c,d,f){const m=l.zoom,y=l.scale,x=l.worldSize,T=1/x,S=l.aspect,M=Math.sqrt(1+S*S)*Math.tan(.5*l.fovX),E=M*M,C=c-n,D=c+n;let z,F;E>C/D?(z=c,F=c*M):(z=.5*D*(1+E),F=.5*Math.sqrt(C*C+2*(c*c+n*n)*E+D*D*E*E));const L=l.projection.pixelsPerMeter(l.center.lat,x),N=l._camera.getCameraToWorldMercator(),j=[0,0,-z*T];o.ad(j,j,N);let q=F*T;const X=l._edgeInsets;if(!(X.left===0&&X.top===0&&X.right===0&&X.bottom===0||X.left===X.right&&X.top===X.bottom)){const ze=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?L:1),Re=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,n,c);Re[8]=2*-l.centerOffset.x/l.width,Re[9]=2*l.centerOffset.y/l.height;const Le=new Float64Array(16);o.cM(Le,Re,ze);const Ze=new Float64Array(16);o.bi(Ze,Le);const at=o.cy.fromInvProjectionMatrix(Ze,x,m,!0);for(const dt of at.points){const Qe=((ee=dt)[0]/=y,ee[1]/=y,ee[2]=o.cb(ee[2],l._center.lat),ee);q=Math.max(q,o.c2(o.d7([],j,Qe)))}}var ee;q*=d/(d-1);const ie=Math.acos(t[2]),Y=Math.atan2(-t[0],-t[1]),K=new Bn;K.position=j,K.setPitchBearing(ie,Y);const J=K.getWorldToCamera(x,L),pe=q*x,oe=Math.min(l._mercatorZfromZoom(17)*x*-2,-2*pe),Ie=K.getCameraToClipOrthographic(-pe,pe,-pe,pe,oe,(pe+f*L)/t[2]),xe=new Float64Array(16);o.az(xe,Ie,J);const Me=o.d2(Math.floor(1e6*j[0])/1e6*x,Math.floor(1e6*j[1])/1e6*x,0),Ue=.5*d,me=[0,0,0];o.ad(me,Me,xe),o.c1(me,me,Ue);const se=[Math.floor(me[0]),Math.floor(me[1]),Math.floor(me[2])],we=[0,0,0];
15o.at(we,me,se),o.c1(we,we,-1/Ue);const _e=new Float64Array(16);return o.bx(_e),o.bo(_e,_e,we),o.az(xe,_e,xe),[xe,pe]}class xd extends o.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,n){return o.aS(this.requestManager.transformRequest(n,o.R.Model).url).then((c=>{if(!c)return;const d=o.aT(c),f=new o.aU(t,void 0,void 0,d);return f.computeBoundsAndApplyParent(),f})).catch((c=>{if(c&&c.status===404)return null;this.fire(new o.z(new Error(`Could not load model ${t} from ${n}: ${c.message}`)))}))}load(t,n,c={forceReload:!1}){this.models[n]||(this.models[n]={});const d=Object.keys(t),f=[],m=[];for(const y of d){const x=t[y];this.hasURLBeenRequested(x)&&!c.forceReload||(this.modelByURL[x]={modelId:y,scope:n},f.push(this.loadModel(y,x)),m.push(y)),this.models[n][y]||(this.models[n][y]={model:null,numReferences:1})}this.numModelsLoading[n]=(this.numModelsLoading[n]||0)+m.length,Promise.allSettled(f).then((y=>{for(let x=0;x<y.length;x++){const{status:T}=y[x];if(T==="rejected")continue;const{value:S}=y[x];this.models[n][m[x]]||(this.models[n][m[x]]={model:null,numReferences:1}),this.models[n][m[x]].model=S}this.numModelsLoading[n]-=m.length,this.fire(new o.A("data",{dataType:"style"}))})).catch((y=>{this.fire(new o.z(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,n,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,n):this.getModelByURL(this.modelUris[n][t]))}getModel(t,n){return this.models[n]||(this.models[n]={}),this.models[n][t]?this.models[n][t].model:void 0}getModelByURL(t){if(!t)return null;const n=this.modelByURL[t];return n?this.models[n.scope][n.modelId].model:null}hasModelBeenAdded(t,n){return this.models[n]&&this.models[n][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,n,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(n);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:f,modelId:m}=this.modelByURL[d];this.models[f][m].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c=this.modelUris[n];for(const d in t)c[d]=this.requestManager.normalizeModelURL(t[d])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c={};for(const d of t)this.hasModel(d,n,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[n][d].numReferences++:this.modelUris[n][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[n][d]:!this.hasURLBeenRequested(d)&&o.d9(d,!1)&&(this.modelUris[n][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[n][d]);this.load(c,n)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,n,c=!1,d=!1){if(this.models[n]&&this.models[n][t]&&(this.models[n][t].numReferences--,this.models[n][t].numReferences===0||d)){const f=this.modelUris[n][t];c||delete this.modelUris[n][t],delete this.modelByURL[f];const m=this.models[n][t].model;if(!m)return;delete this.models[n][t],m.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const n of Object.keys(this.models[t])){const c=this.models[t][n].model;delete this.models[t][n],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,n){this.models[n]||(this.models[n]={});for(const c in this.models[n])this.models[n][c].model&&this.models[n][c].model.upload(t.context)}}const tc=new o.a7({data:new o.a8(o.a5.colorTheme.data)});class bh{constructor(t){this._scope=t,this._buildingQueryParams={target:{featuresetId:"building-outline",importId:this._scope}},this._floorQueryParams={target:{featuresetId:"floor-outline",importId:this._scope}}}execute(t){const n=this._makeBuildingsQueryArea(t),c=this._makeFloorsQueryArea(t),d=t.queryRenderedFeatures(n,this._buildingQueryParams).filter((y=>y.properties.shape_type==="building")).reduce(((y,x)=>{const T=x.properties.id;return x.properties.shape_type!=="building"||y.some((S=>S.properties.id===T))||y.push(x),y}),[]),f=t.queryRenderedFeatures(c,this._floorQueryParams).filter((y=>y.properties.shape_type==="floor")).reduce(((y,x)=>{const T=x.properties.id;return x.properties.shape_type!=="floor"||y.some((S=>S.properties.id===T))||y.push(x),y}),[]),m=[t.getCenter().lng,t.getCenter().lat];return{floors:f,building:this._findBuildingAtCenter(m,d)||(d.length>0?d[0]:null)}}_makeBuildingsQueryArea(t){const n=t.transform.width,c=t.transform.height,d=Math.min(n,c),f=d*(1/8),m=d*(1/8),y=.5*(n-f),x=.5*(c-m);return[new o.P(y,x),new o.P(y+f,x+m)]}_makeFloorsQueryArea(t){const n=t.transform.width,c=t.transform.height,d=n*(2/3),f=c*(2/3),m=.5*(n-d),y=.5*(c-f);return[new o.P(m,y),new o.P(m+d,y+f)]}_findBuildingAtCenter(t,n){for(const c of n)if(c.geometry.type==="Polygon"&&this._pointInPolygon(t,c.geometry.coordinates[0]))return c;return null}_pointInPolygon(t,n){let c=!1;for(let d=0,f=n.length-1;d<n.length;
15f=d++){const m=n[d][0],y=n[d][1],x=n[f][1];y>t[1]!=x>t[1]&&t[0]<(n[f][0]-m)*(t[1]-y)/(x-y)+m&&(c=!c)}return c}}class js{constructor(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}setBuildingId(t){this._selectedBuildingId=t}setFloors(t){if(this._floors=t.filter((n=>n.properties.building_id===this._selectedBuildingId)),!this._selectedFloorId||!this._floors.map((n=>n.properties.id)).includes(this._selectedFloorId)){const n=this._floors.map((c=>({id:c.properties.id,level:c.properties.floor_level}))).reduce(((c,d)=>{const f=Math.abs(c.level-1),m=Math.abs(d.level-1);return m<f||m===f&&d.level>c.level?d:c}));this._selectedFloorId=n.id}}setFloorId(t){this._selectedFloorId=t}getSelectedFloorId(){return this._selectedFloorId}getCurrentBuildingFloors(){return this._floors}reset(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}}const gp={"mbx-indoor-level-selected":{default:["literal",[]]}};function vd(l){return l=l||{},Object.assign(l,gp)}class yp extends o.E{constructor(t){super(),o.aV(["_onLoad","_onMove"],this),this._map=t,this._floorSelectionState=new js,this._queryIndoor(),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=null,this._floorSelectionState=null}_onLoad(){this._map.style.forEachFragmentStyle((t=>{t.stylesheet.indoor&&(this._indoorDataQuery?this.fire(new o.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._scope=t.scope,this._indoorDataQuery=new bh(this._scope)))})),this._map._addIndoorControl(),this._queryIndoor()}_onMove(){this._queryIndoor()}_queryIndoor(){if(!this._indoorDataQuery||!this._map.isStyleLoaded())return;if(this._map.transform.zoom<16)return void this._clearIndoorData();const t=this._indoorDataQuery.execute(this._map);t&&t.floors.length!==0?(this._floorSelectionState.getSelectedFloorId()||this._map._addIndoorControl(),this._selectFloors(t)):this._clearIndoorData()}
15_selectFloors(t){if(t.building)this._floorSelectionState.setBuildingId(t.building.properties.id),this._floorSelectionState.setFloors(t.floors),this._updateUI();else{const n=this._floorSelectionState.getSelectedFloorId();if(n&&t.floors.some((c=>c.properties.id===n)))return;this._clearIndoorData()}}_clearIndoorData(){this._floorSelectionState.reset(),this._map._removeIndoorControl(),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[]])}_updateUI(){const t=this._floorSelectionState.getCurrentBuildingFloors().map((c=>({id:c.properties.id,name:c.properties.name,shortName:c.properties.floor_level,levelOrder:c.properties.floor_level}))),n=this._floorSelectionState.getSelectedFloorId();n?(this._updateIndoorConfig(),this.fire(new o.A("indoorupdate",{selectedFloorId:n,floors:t}))):console.warn("IndoorManager: Selected floor is not set")}_updateIndoorConfig(){const t=this._floorSelectionState.getSelectedFloorId();t?this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[t]]):console.warn("IndoorManager: Selected floor is not set")}selectFloor(t){this._floorSelectionState.setFloorId(t),this._updateIndoorConfig()}}function bd(l){if(!l.metadata||!l.metadata.content_area)return;const t=o.q.devicePixelRatio,{left:n,top:c,width:d,height:f}=l.metadata.content_area,m=n*t,y=c*t;return[m,y,m+d*t,y+f*t]}function wd(l){if(l)return l.map((([t,n])=>[t*o.q.devicePixelRatio,n*o.q.devicePixelRatio]))}class wh{constructor(t,n,c){this.id=t,this.scope=n,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 n=this.sourceCache.getVisibleCoordinates();if(n.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof ks))return t;const d=n.map((m=>this.sourceCache.getTile(m))),f=c.getImages(d,Array.from(this.pendingRequests));for(const[m,y]of f)t.set(o.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}}const Gs=(l,t)=>W(l,t&&t.filter((n=>n.identifier!=="source.canvas"))),Td=o.aF(Xt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),Sd=o.aF(Xt,["setCenter","setZoom","setBearing","setPitch"]),ic=new Set(["background","sky","slot","custom"]),qs={version:8,layers:[],sources:{}},dl={duration:300,delay:0};class Nn extends o.E{constructor(t,n={}){super(),this.map=t,this.scope=n.scope||"",this.globalId=null,this.fragments=[],this.importDepth=n.importDepth||0,this.importsCache=n.importsCache||new Map,this.resolvedImports=n.resolvedImports||new Set,this.transition=o.h({},dl),this._buildingIndex=new ud(this),this.crossTileSymbolIndex=new sn,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=n.styleChanges||new Ba,this.dispatcher=n.dispatcher?n.dispatcher:new o.D(o.db(),this),n.imageManager?this.imageManager=n.imageManager:(this.imageManager=new ir(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=n.glyphManager?n.glyphManager:new o.dc(t._requestManager,n.localFontFamily?o.dd.all:n.localIdeographFontFamily?o.dd.ideographs:o.dd.none,n.localFontFamily||n.localIdeographFontFamily),n.modelManager?this.modelManager=n.modelManager:(this.modelManager=new xd(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={}
15,this._order=[],this._markersNeedUpdate=!1,this.options=n.configOptions?n.configOptions:new Map,this._configDependentLayers=n.configDependentLayers?n.configDependentLayers:new Set,this._config=n.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:n.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=n.initialConfig,this.dispatcher.broadcast("setReferrer",o.de());const c=this;this._rtlTextPluginCallback=Nn.registerForPluginStateChange((d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},((f,m)=>{if(o.df(f),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 f=this.getOwnSource(d.sourceId);if(f&&f.vectorLayerIds)for(const m in this._layers){const y=this._layers[m];y.source===f.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(o.j(t))return t;const n=o.dg(t);if(!n.startsWith("http"))try{return new URL(n,location.href).toString()}catch{return n}return n}return`json://${o.dh(JSON.stringify(t))}`}_diffStyle(t,n,c){this.globalId=this._getGlobalId(t);const d=(f,m)=>{try{m(null,this.setState(f,c))}catch(y){m(y,!1)}};if(typeof t=="string"){const f=this.map._requestManager.normalizeStyleURL(t),m=this.map._requestManager.transformRequest(f,o.R.Style);o.n(m,((y,x)=>{y?this.fire(new o.z(y)):x&&d(x,n)}))}else typeof t=="object"&&d(t,n)}loadURL(t,n={}){this.fire(new o.A("dataloading",{dataType:"style"}));const c=typeof n.validate=="boolean"?n.validate:!o.j(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,n.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const f=this.map._requestManager.transformRequest(t,o.R.Style);this._request=o.n(f,((m,y)=>{if(this._request=null,m)this.fire(new o.z(m));else if(y)return this.importsCache.set(t,y),this._load(y,c)}))}loadJSON(t,n={}){this.fire(new o.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=o.q.frame((()=>{this._request=null,this._load(t,n.validate!==!1)}))}loadEmpty(){this.fire(new o.A("dataloading",{dataType:"style"})),this._load(qs,!1)}_loadImports(t,n,c){if(this.importDepth>=4)return o.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const f of t){const m=this._createFragmentStyle(f),y=new Promise((S=>{m.once("style.import.load",S),m.once("error",S)})).then((()=>this.mergeAll()));if(d.push(y),this.resolvedImports.has(f.url)){m.loadEmpty();continue}const x=f.data||this.importsCache.get(f.url);x?(m.loadJSON(x,{validate:n}),this._isInternalStyle(x)&&(m.globalId=null)):f.url?m.loadURL(f.url,{validate:n}):m.loadEmpty();const T={style:m,id:f.id,config:f.config};if(c){const S=this.fragments.findIndex((({id:M})=>M===c));this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(t=this,n=new Set){for(const c of t.fragments)c.style.globalId&&n.add(c.style.globalId),this.getImportGlobalIds(c.style,n);return[...n.values()]}_createFragmentStyle(t){const n=this.scope?o.C(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[n];(t.config||d)&&(c=o.h({},t.config,d));const f=new Nn(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return f.setEventedParent(this.map,{style:f}),f}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,n){const c=t.indoor?vd(t.schema):t.schema;if(this._isInternalStyle(t)){const m=o.h({},qs,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(m,n)}if(this.updateConfig(this._config,c),n&&Gs(this,vn(t)))return;this._loaded=!0,this.stylesheet=o.di(t);const d=()=>{for(const T in t.sources)this.addSource(T,t.sources[T],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const T in t.iconsets)this.addIconset(T,t.iconsets[T]);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);
15const m=Ja(this.stylesheet.layers);if(this._order=m.map((T=>T.id)),this.stylesheet.light&&o.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 T=this.stylesheet.lights[0];this.light=new ve(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ve(this.stylesheet.light)),this._layers={};for(const T of m){const S=o.dn(T,this.scope,this._styleColorTheme.lut,this.options);S.configDependencies.size!==0&&this._configDependentLayers.add(S.fqid),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S;const M=this.getOwnLayerSourceCache(S),E=!!this.directionalLight&&this.directionalLight.shadowsEnabled();M&&S.canCastShadows()&&E&&(M.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const y=this.stylesheet.terrain;y&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(y,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 o.A("data",{dataType:"style"}));const x=this.isRootStyle();t.imports?this._loadImports(t.imports,n).then((()=>{this._reloadImports(),this.fire(new o.A(x?"style.load":"style.import.load"))})).catch((T=>{this.fire(new o.z(new Error("Failed to load imports",T))),this.fire(new o.A(x?"style.load":"style.import.load"))})):(this._reloadImports(),this.fire(new o.A(x?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const f=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(f){const m=this._evaluateColorThemeData(f);this._loadColorTheme(m).then((()=>{d()})).catch((y=>{o.w(`Couldn't load color theme from the stylesheet: ${y}`),d()}))}else this._styleColorTheme.lut=null,d()}isRootStyle(){return this.importDepth===0}mergeAll(){let t,n,c,d,f,m,y,x,T,S;const M={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((E=>{if(E.stylesheet){if(E.light!=null&&(t=E.light),E.stylesheet.lights)for(const C of E.stylesheet.lights)C.type==="ambient"&&E.ambientLight!=null&&(n=E.ambientLight),C.type==="directional"&&E.directionalLight!=null&&(c=E.directionalLight);d=this._prioritizeTerrain(d,E.terrain,E.stylesheet.terrain),E.stylesheet.fog&&E.fog!=null&&(f=E.fog),E.stylesheet.snow&&E.snow!=null&&(m=E.snow),E.stylesheet.rain&&E.rain!=null&&(y=E.rain),E.stylesheet.camera!=null&&(S=E.stylesheet.camera),E.stylesheet.projection!=null&&(x=E.stylesheet.projection),E.stylesheet.transition!=null&&(T=E.stylesheet.transition),M[E.scope]=E._styleColorTheme}})),this.light=t,this.ambientLight=n,this.directionalLight=c,this.fog=f,this.snow=m,this.rain=y,this._styleColorThemeForScope=M,d===null?delete this.terrain:this.terrain=d,this.camera=S||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition=o.h({},dl,T),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(t){const n=c=>{for(const d of c.fragments)n(d.style);t(c)};n(this)}_prioritizeTerrain(t,n,c){const d=t&&t.drapeRenderMode===0;return c===null?n&&n.drapeRenderMode===0?n:d?t:null:n!=null&&(!t||d||n&&n.drapeRenderMode===1)?n:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((n=>{t=this._prioritizeTerrain(t,n.terrain,n.stylesheet.terrain)})),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle((n=>{n.stylesheet.projection!=null&&(t=n.stylesheet.projection)})),this.projection=t||{name:"mercator"}}mergeSources(){const t={},n={},c={};this.forEachFragmentStyle((d=>{for(const f in d._sourceCaches){const m=o.C(f,d.scope);t[m]=d._sourceCaches[f]}for(const f in d._otherSourceCaches){const m=o.C(f,d.scope);n[m]=d._otherSourceCaches[f]}for(const f in d._symbolSourceCaches){const m=o.C(f,d.scope);c[m]=d._symbolSourceCaches[f]}})),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=n,this._mergedSymbolSourceCaches=c}mergeLayers(){const t={},n=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle((f=>{for(const m of f._order){const y=f._layers[m];if(y.type==="slot"){const x=o.dj(m);if(t[x])continue;t[x]=[]}y.slot&&t[y.slot]?t[y.slot].push(y):n.push(y)}})),this._mergedOrder=[];const d=(f=[])=>{for(const m of f)if(m.type==="slot"){const y=o.dj(m.id);t[y]&&d(t[y]),this._mergedSlots.push(y)}else{const y=o.C(m.id,m.scope);this._mergedOrder.push(y),c[y]=m,m.is3D(!!this.terrain)&&(this._has3DLayers=!0),m.type==="circle"&&(this._hasCircleLayers=!0),m.type==="symbol"&&(this._hasSymbolLayers=!0),m.type==="clip"&&(this._clipLayerPresent=!0)}};d(n),this._mergedOrder.sort(((f,m)=>{const y=c[f],x=c[m];return y.hasInitialOcclusionOpacityProperties?x.is3D(!!this.terrain)?1:0:y.is3D(!!this.terrain)&&x.hasInitialOcclusionOpacityProperties?-1:0})),this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=o.h({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?(function(n,c,d,f){const m=o.h({},c);for(const x of Object.keys(o.a5.colorTheme))m[x]===void 0&&(m[x]=o.a5.colorTheme[x].default);const y=new o.a6(tc,n,new Map(d));return y.setTransitionOrValue(m,d),y.untransitioned().possiblyEvaluate(new o.aa(0,{worldview:void 0}))})(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const n=this._styleColorTheme.lutLoadingCorrelationID;return new Promise(((c,d)=>{const f="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(f)||(m=f+m);const y=o.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=()=>
15{if(this._styleColorTheme.lutLoadingCorrelationID!==n)return void c();this._styleColorTheme.lutLoading=!1;const{width:T,height:S,data:M}=o.q.getImageData(x);if(S>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==S*S)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 o.r({width:T,height:S},M),pixelRatio:1,sdf:!1,usvg:!1,version:0});const E=this.imageManager.getImage(y,this.scope);E?(this._styleColorTheme.lut={image:E.data,data:t},c()):d(new Error("Missing LUT image."))}}))}getLut(t){const n=this._styleColorThemeForScope[t];return n?n.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(n,c,d){let f,m,y;const x=o.q.devicePixelRatio>1?"@2x":"";let T=o.n(c.transformRequest(c.normalizeSpriteURL(n,x,".json"),o.R.SpriteJSON),((E,C)=>{T=null,y||(y=E,f=C,M())})),S=o.o(c.transformRequest(c.normalizeSpriteURL(n,x,".png"),o.R.SpriteImage),((E,C)=>{S=null,y||(y=E,m=C,M())}));function M(){if(y)d(y);else if(f&&m){const E=o.q.getImageData(m),C={};for(const D in f){const{width:z,height:F,x:L,y:N,sdf:j,pixelRatio:q,stretchX:X,stretchY:ee,content:ie}=f[D],Y=new o.r({width:z,height:F});o.r.copy(E,Y,{x:L,y:N},{x:0,y:0},{width:z,height:F},null),C[D]={data:Y,pixelRatio:q,sdf:j,stretchX:X,stretchY:ee,content:ie,usvg:!1}}d(null,C)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}})(t,this.map._requestManager,((n,c)=>{if(this._spriteRequest=null,n)this.fire(new o.z(n));else if(c){const d=new Map;for(const f in c)d.set(o.I.from(f),c[f]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new o.A("data",{dataType:"style"}))}))}addIconset(t,n){if(n.type==="sprite")return void this._loadSprite(n.url);const c=this.getOwnSourceCache(n.source);if(!c)return void this.fire(new o.z(new Error(`Source "${n.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 o.z(new Error(`Source "${n.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const f=new wh(t,this.scope,c);this.imageManager.addImageProvider(f,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!o.j(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const n=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(f,m)=>{if(this._spriteRequest=null,f)n?this._loadSprite(t):this.fire(new o.z(f));else if(m){const y=new Map;for(const x in m)y.set(o.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 o.A("data",{dataType:"style"}))},o.br((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),o.R.Iconset),((f,m)=>{if(f)return void d(f);const y={},x=o.da(new o.bq(m));for(const T of x.icons){const S={version:1,pixelRatio:o.q.devicePixelRatio,content:bd(T),stretchX:T.metadata?wd(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?wd(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=S}d(null,y)})))}_validateLayer(t){const n=this.getOwnSource(t.source);if(!n)return;const c=t.sourceLayer;c&&(n.type==="geojson"||n.vectorLayerIds&&n.vectorLayerIds.indexOf(c)===-1)&&this.fire(new o.z(ne
15w Error(`Source layer "${c}" does not exist on source "${n.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,n)=>{const c=this.fragments[n];return c&&c.style&&(t.data=c.style.serialize()),t}))}_serializeSources(){const t={};for(const n in this._sourceCaches){const c=this._sourceCaches[n].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const n=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&n.push(d.serialize())}return n}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}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 n=this.getOwnLayer(t);if(n)return n;this.fire(new o.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const n=this.getOwnSource(t);if(n)return n;this.fire(new o.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,n){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const f=t.getProgramIds();if(f)for(const m of f){const y=t.getDefaultProgramParams(m,n.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 n=this.calculateLightsBrightness();t.brightness=n||0,n!==this._brightness&&(this._brightness=n,this.dispatcher.broadcast("setBrightness",n)),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:S}=y[x];(T||S)&&(this._updateWorkerLayers(x,T,S),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 f={};for(const y in this._mergedSourceCaches){const x=this._mergedSourceCaches[y];f[y]=x.used,x.used=!1,x.tileCoverLift=0}for(const y of this._mergedOrder){const x=this._mergedLayers[y];if(x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)){const T=this.getLayerSourceCache(x);T&&(T.used=!0,T.tileCoverLift=Math.max(T.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback((()=>
vendor: 4,127 bytes, line 15
15{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 f){const x=this._mergedSourceCaches[y];f[y]!==x.used&&x.getSource().fire(new o.A("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 o.A("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const n of t){const c=n.resolvePendingRequests(),d=this.getFragmentStyle(n.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const n in this._mergedSourceCaches){const c=this._mergedSourceCaches[n].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const n in t)this._changes.resetUpdatedImages(n)}_updateWorkerLayers(t,n,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:n?d._serializeLayers(n):[],scope:t,removedIds:c||[],options:d.options})}setState(t,n){if(this._checkLoaded(),Gs(this,vn(t)))return!1;(t=o.di(t)).layers=Ja(t.layers);const c=(function(m,y){if(!m)return[{command:Xt.setStyle,args:[y]}];let x=[];try{if(!o.bv(m.version,y.version))return[{command:Xt.setStyle,args:[y]}];if(o.bv(m.center,y.center)||x.push({command:Xt.setCenter,args:[y.center]}),o.bv(m.zoom,y.zoom)||x.push({command:Xt.setZoom,args:[y.zoom]}),o.bv(m.bearing,y.bearing)||x.push({command:Xt.setBearing,args:[y.bearing]}),o.bv(m.pitch,y.pitch)||x.push({command:Xt.setPitch,args:[y.pitch]}),o.bv(m.sprite,y.sprite)||x.push({command:Xt.setSprite,args:[y.sprite]}),o.bv(m.glyphs,y.glyphs)||x.push({command:Xt.setGlyphs,args:[y.glyphs]}),o.bv(m.imports,y.imports)||(function(C=[],D=[],z){D=D||[];const F=(C=C||[]).map(go),L=D.map(go),N=C.reduce(Bs,{}),j=D.reduce(Bs,{}),q=F.slice();let X,ee,ie,Y;for(X=0,ee=0;X<F.length;X++)ie=F[X],j.hasOwnProperty(ie)?ee++:(z.push({command:Xt.removeImport,args:[ie]}),q.splice(q.indexOf(ie,ee),1));for(X=0,ee=0;X<L.length;X++)ie=L[L.length-1-X],q[q.length-1-X]!==ie&&(N.hasOwnProperty(ie)?(z.push({command:Xt.removeImport,args:[ie]}),q.splice(q.lastIndexOf(ie,q.length-ee),1)):ee++,Y=q[q.length-X],z.push({command:Xt.addImport,args:[j[ie],Y]}),q.splice(q.length-X,0,ie));for(const K of D){const J=N[K.id];J&&(delete J.data,o.bv(J,K)||z.push({command:Xt.updateImport,args:[K.id,K]}))}})(m.imports,y.imports,x),o.bv(m.transition,y.transition)||x.push({command:Xt.setTransition,args:[y.transition]}),o.bv(m.light,y.light)||x.push({command:Xt.setLight,args:[y.light]}),o.bv(m.fog,y.fog)||x.push({command:Xt.setFog,args:[y.fog]}),o.bv(m.snow,y.snow)||x.push({command:Xt.setSnow,args:[y.snow]}),o.bv(m.rain,y.rain)||x.push({command:Xt.setRain,args:[y.rain]}),o.bv(m.projection,y.projection)||x.push({command:Xt.setProjection,args:[y.projection]}),o.bv(m.lights,y.lights)||x.push({command:Xt.setLights,args:[y.lights]}),o.bv(m.camera,y.camera)||x.push({command:Xt.setCamera,args:[y.camera]}),o.bv(m.iconsets,y.iconsets)||(function(C,D,z){let F;for(F in D=D||{},C=C||{})C.hasOwnProperty(F)&&(D.hasOwnProperty(F)||z.push({command:Xt.removeIconset,args:[F]}));for(F in D){if(!D.hasOwnProperty(F))continue;const L=D[F];C.hasOwnProperty(F)?o.bv(C[F],L)||(z.push({command:Xt.removeIconset,args:[F]}),z.push({command:Xt.addIconset,args:[F,L]})):z.push({command:Xt.addIconset,args:[F,L]})}})(m.iconsets,y.iconsets,x),!o.bv(m["color-theme"],y["color-theme"]))return[{command:Xt.setStyle,args:[y]}];const T={},S=[];(function(C,D,z,F){let L;for(L in D=D||{},C=C||{})C.hasOwnProperty(L)&&(D.hasOwnProperty(L)||$o(L,z,F));for(L in D){if(!D.hasOwnProperty(L))continue;const N=D[L];
15C.hasOwnProperty(L)?o.bv(C[L],N)||(C[L].type==="geojson"&&N.type==="geojson"&&fp(C,D,L)?z.push({command:Xt.setGeoJSONSourceData,args:[L,N.data]}):Qa(L,D,z,F)):Xl(L,D,z)}})(m.sources,y.sources,S,T);const M=[];m.layers&&m.layers.forEach((C=>{C.source&&T[C.source]?x.push({command:Xt.removeLayer,args:[C.id]}):M.push(C)}));let E=m.terrain;E&&T[E.source]&&(x.push({command:Xt.setTerrain,args:[void 0]}),E=void 0),x=x.concat(S),o.bv(E,y.terrain)||x.push({command:Xt.setTerrain,args:[y.terrain]}),(function(C,D,z){D=D||[];const F=(C=C||[]).map(go),L=D.map(go),N=C.reduce(Bs,{}),j=D.reduce(Bs,{}),q=F.slice(),X=Object.create(null);let ee,ie,Y,K,J,pe,oe;for(ee=0,ie=0;ee<F.length;ee++)Y=F[ee],j.hasOwnProperty(Y)?ie++:(z.push({command:Xt.removeLayer,args:[Y]}),q.splice(q.indexOf(Y,ie),1));for(ee=0,ie=0;ee<L.length;ee++)Y=L[L.length-1-ee],q[q.length-1-ee]!==Y&&(N.hasOwnProperty(Y)?(z.push({command:Xt.removeLayer,args:[Y]}),q.splice(q.lastIndexOf(Y,q.length-ie),1)):ie++,pe=q[q.length-ee],z.push({command:Xt.addLayer,args:[j[Y],pe]}),q.splice(q.length-ee,0,Y),X[Y]=!0);for(ee=0;ee<L.length;ee++)if(Y=L[ee],K=N[Y],J=j[Y],!X[Y]&&!o.bv(K,J))if(o.bv(K.source,J.source)&&o.bv(K["source-layer"],J["source-layer"])&&o.bv(K.type,J.type)){for(oe in el(K.layout,J.layout,z,Y,null,Xt.setLayoutProperty),el(K.paint,J.paint,z,Y,null,Xt.setPaintProperty),o.bv(K.slot,J.slot)||z.push({command:Xt.setSlot,args:[Y,J.slot]}),o.bv(K.filter,J.filter)||z.push({command:Xt.setFilter,args:[Y,J.filter]}),o.bv(K.minzoom,J.minzoom)&&o.bv(K.maxzoom,J.maxzoom)||z.push({command:Xt.setLayerZoomRange,args:[Y,J.minzoom,J.maxzoom]}),K)K.hasOwnProperty(oe)&&oe!=="layout"&&oe!=="paint"&&oe!=="filter"&&oe!=="metadata"&&oe!=="minzoom"&&oe!=="maxzoom"&&oe!=="slot"&&(oe.indexOf("paint.")===0?el(K[oe],J[oe],z,Y,oe.slice(6),Xt.setPaintProperty):o.bv(K[oe],J[oe])||z.push({command:Xt.setLayerProperty,args:[Y,oe,J[oe]]}));for(oe in J)J.hasOwnProperty(oe)&&!K.hasOwnProperty(oe)&&oe!=="layout"&&oe!=="paint"&&oe!=="filter"&&oe!=="metadata"&&oe!=="minzoom"&&oe!=="maxzoom"&&oe!=="slot"&&(oe.indexOf("paint.")===0?el(K[oe],J[oe],z,Y,oe.slice(6),Xt.setPaintProperty):o.bv(K[oe],J[oe])||z.push({command:Xt.setLayerProperty,args:[Y,oe,J[oe]]}))}else z.push({command:Xt.removeLayer,args:[Y]}),pe=q[q.lastIndexOf(Y)+1],z.push({command:Xt.addLayer,args:[J,pe]})})(M,y.layers,x)}catch(T){console.warn("Unable to compute style diff:",T),x=[{command:Xt.setStyle,args:[y]}]}return x})(this.serialize(),t).filter((m=>!(m.command in Sd)));if(c.length===0)return!1;const d=c.filter((m=>!(m.command in Td)));if(d.length>0)throw new Error(`Unimplemented: ${d.map((m=>m.command)).join(", ")}.`);const f=[];return c.forEach((m=>{f.push(this[m.command](...m.args))})),n&&Promise.all(f).then(n).catch(n),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[n,c]of t.entries()){if(this.getImage(n))return this.fire(new o.z(new Error(`An image with the name "${n.name}" already exists.`)));this.imageManager.addImage(n,this.scope,c),this._changes.updateImage(n,this.scope)}return this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this}addImage(t,n){return this.getImage(t)?this.fire(new o.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,n),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("data",{dataType:"style"})),this)}updateImage(t,n,c=!1){this.imageManager.updateImage(t,this.scope,n),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new o.A("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 o.A("data",{dataType:"style"}
vendor: 10,466 bytes, line 15
15)),this):this.fire(new o.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(t){return this.modelManager.addModelURLs(t,this.scope),this._updateWorkerModels(),this.fire(new o.A("data",{dataType:"style"})),this}addModel(t,n,c={}){return this._checkLoaded(),this._validate(Z,`models.${t}`,n,null,c)||(this.modelManager.addModel(t,n,this.scope),this.fire(new o.A("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope,!1,!0),this.fire(new o.A("data",{dataType:"style"})),this):this.fire(new o.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,n,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(Ga,`sources.${t}`,n,null,c))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=$a(t,n,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id})));const f=m=>{const y=(m?"symbol:":"other:")+d.id,x=o.C(y,this.scope),T=this._sourceCaches[y]=new nn(x,d,m);(m?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.onAdd(this.map)};f(!1),n.type!=="vector"&&n.type!=="geojson"||f(!0),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const n=this.getOwnSource(t);if(!n)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 o.z(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 o.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find((([f,m])=>m.type==="source"&&m.source===t));if(d)return this.fire(new o.z(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 f=o.dj(d.id);delete this._sourceCaches[f],this._changes.discardSourceCacheUpdate(d.id),d.fire(new o.A("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(),n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,n){this._checkLoaded(),this.getOwnSource(t).setData(n),this._changes.setDirty()}getOwnSource(t){const n=this.getOwnSourceCache(t);return n&&n.getSource()}getOwnSources(){const t=[];for(const n in this._otherSourceCaches){const c=this.getOwnSourceCache(n);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const n in t){const c=t[n]._tiles;for(const d in c){const f=c[d];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const n=this._getTransitionParameters();for(const f of t){if(this._validate(Go,"lights",f))return;switch(f.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(f),m.updateTransitions(n)}else this.ambientLight=new gi(f,Gt||(Gt=new o.a7({color:new o.a8(o.a5.properties_light_ambient.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(f),m.updateTransitions(n)}else this.directionalLight=new gi(f,Ki||(Ki=new o.a7({direction:new o.an(o.a5.properties_light_directional.direction),color:new o.a8(o.a5.properties_light_directional.color),"color-use-theme":new o.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new o.a8(o.a5.properties_light_directional.intensity),"cast-shadows":new o.a8(o.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new o.a8(o.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new o.a8(o.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=Object.assign(n,{worldview:this.map.getWorldview()}),d=new o.aa(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,n=this.ambientLight;if(!t||!n)return;const c=E=>.2126*(E[0]<=.03928?E[0]/12.92:Math.pow((E[0]+.055)/1.055,2.4))+.7152*(E[1]<=.03928?E[1]/12.92:Math.pow((E[1]+.055)/1.055,2.4))+.0722*(E[2]<=.03928?E[2]/12.92:Math.pow((E[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),f=t.properties.get("intensity"),m=t.properties.get("direction"),y=1-o.d1(m.x,m.y,m.z)[2]/90,x=c(d)*f*y,T=n.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),S=n.properties.get("intensity"),M=c(T)*S;return Number(((x+M)/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(o.dk(t)){const n=o.dl(t),c=this.fragments.find((({id:f})=>f===n));if(!c)return;const d=o.dj(t);return c.style.getFragmentStyle(d)}{const n=this.fragments.find((({id:c})=>c===t));return n?n.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const n={},c=(d,f="")=>`${d}::${f}`;this._featuresetSelectors={};for(const d in t){const f=this._featuresetSelectors[d]=[];for(const m of t[d].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){o.w(`Layer is undefined for selector: ${m.layer}`);continue}const T=c(x.source,x.sourceLayer);if(T in n&&n[T]!==m.featureNamespace){o.w(`"featureNamespace ${m.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}n[T]=m.featureNamespace}let y;if(m.properties)for(const x in m.properties){const T=o.X(m.properties[x]);T.result==="success"&&(y=y||{},y[x]=T.value)}f.push({layerId:m.layer,namespace:m.featureNamespace,properties:y,uniqueFeatureID:m._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const n=this.getFragmentStyle(t);if(!n||!n.stylesheet.featuresets)return[];const c=[];for(const d in n.stylesheet.featuresets)c.push({featuresetId:d,importId:n.scope?n.scope:void 0});return c}getFeaturesetLayers(t,n){const c=this.getFragmentStyle(n),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new o.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const f=[];for(const m of d[t].selectors){const y=c.getOwnLayer(m.layer);y&&f.push(y)}return f}getConfigProperty(t,n){const c=this.getFragmentStyle(t);if(!c)return null;const d=o.C(n,c.scope),f=c.options.get(d),m=f?f.value||f.default:null;return m?m.serialize():null}setConfigProperty(t,n,c){const d=this.getFragmentStyle(t);if(!d)return;const f=d.stylesheet.indoor?vd(d.stylesheet.schema):d.stylesheet.schema;if(!f||!f[n])return;const m=o.X(c);if(m.result!=="success")return void Gs(this,m.value);const y=m.value.expression,x=o.C(n,d.scope),T=d.options.get(x);if(!T)return;let S;const{minValue:M,maxValue:E,stepValue:C,type:D,values:z}=f[n],F=o.X(f[n].default);F.result==="success"&&(S=F.value.expression),S?(this.options.set(x,Object.assign({},T,{value:y,default:S,minValue:M,maxValue:E,stepValue:C,type:D,values:z})),this.updateConfigDependencies(n)):this.fire(new o.z(new Error(`No schema defined for the config option "${n}" in the "${t}" fragment.`)))}getConfig(t){const n=this.getFragmentStyle(t);if(!n)return null;const c=n.stylesheet.schema;if(!c)return null;const d={};for(const f in c){const m=o.C(f,n.scope),y=n.options.get(m),x=y?y.value||y.default:null;d[f]=x?x.serialize():null}return d}setConfig(t,n){const c=this.getFragmentStyle(t);c&&(c.updateConfig(n,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const n=this.getFragmentStyle(t);return n?n.stylesheet.schema:null}setSchema(t,n){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=n,c.updateConfig(c._config,n),this.updateConfigDependencies())}updateConfig(t,n){if(this._config=t,t||n)if(n)for(const c in n){let d,f;const m=o.X(n[c].default);if(m.result==="success"&&(d=m.value.expression),t&&t[c]!==void 0){const E=o.X(t[c]);E.result==="success"&&(f=E.value.expression)}const{minValue:y,maxValue:x,stepValue:T,type:S,values:M}=n[c];if(d){const E=o.C(c,this.scope);this.options.set(E,{default:d,value:f,minValue:y,maxValue:x,stepValue:T,type:S,values:M})}else this.fire(new o.z(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new o.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(t){for(const n of this._configDependentLayers){const c=this.getLayer(n);if(c){if(t&&!c.configDependencies.has(t))continue;c.possiblyEvaluateVisibility(),this._updateLayer(c)}}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((n=>{const c=n._styleColorTheme.colorThemeOverride?n._styleColorTheme.colorThemeOverride:n._styleColorTheme.colorTheme;if(c){const d=n._evaluateColorThemeData(c);(!n._styleColorTheme.lut&&d!==""||n._styleColorTheme.lut&&d!==n._styleColorTheme.lut.data)&&n.setColorTheme(c)}})),this._changes.setDirty()}addLayer(t,n,c={}){this._checkLoaded();const d=t.id;
15if(this._layers[d])return void this.fire(new o.z(new Error(`Layer with id "${d}" already exists on this map`)));let f;if(t.type==="custom"){if(Gs(this,o.dm(t)))return;f=o.dn(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=o.di(t),t=o.h(t,{source:d})),this._validate(ei,`layers.${d}`,t,{arrayIndex:-1},c))return;f=o.dn(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(f),f.setEventedParent(this,{layer:{id:d}})}f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid);let m=this._order.length;if(n){const S=this._order.indexOf(n);if(S===-1)return void this.fire(new o.z(new Error(`Layer with id "${n}" does not exist on this map.`)));f.slot===this._layers[n].slot?m=S:o.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(m,0,d),this._layerOrderChanged=!0,this._layers[d]=f;const y=this.getOwnLayerSourceCache(f),x=!!this.directionalLight&&this.directionalLight.shadowsEnabled();y&&f.canCastShadows()&&x&&(y.castsShadows=!0);const T=this._changes.getRemovedLayer(f);if(T&&f.source&&y&&f.type!=="custom"){this._changes.discardLayerRemoval(f);const S=o.C(f.source,f.scope);T.type!==f.type?this._changes.updateSourceCache(S,"clear"):(this._changes.updateSourceCache(S,"reload"),y.pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map),f.scope=this.scope,this.mergeLayers()}moveLayer(t,n){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===n)return;const d=this._order.indexOf(t);this._order.splice(d,1);let f=this._order.length;if(n){const m=this._order.indexOf(n);
15if(m===-1)return void this.fire(new o.z(new Error(`Layer with id "${n}" does not exist on this map.`)));c.slot===this._layers[n].slot?f=m:o.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(f,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(t){this._checkLoaded();const n=this._checkLayer(t);if(!n)return;n.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(n.fqid),this._changes.removeLayer(n);const d=this.getOwnLayerSourceCache(n);if(d&&d.castsShadows){let f=!1;for(const m in this._layers)if(this._layers[m].source===n.source&&this._layers[m].canCastShadows()){f=!0;break}d.castsShadows=f}n.onRemove&&n.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const n in this._layers)if(this._layers[n].type===t)return!0;return!1}setLayerZoomRange(t,n,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===n&&d.maxzoom===c||(n!=null&&(d.minzoom=n),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,n){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==n&&(c.slot=n,this._updateLayer(c))}setFilter(t,n,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!o.bv(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(ge,`layers.${d.id}.filter`,n,{layerType:d.type},c)||(d.filter=o.di(n),this._updateLayer(d)))}getFilter(t){const n=this._checkLayer(t);if(n)return o.di(n.filter)}setLayoutProperty(t,n,c,d={}){this._checkLoaded();const f=this._checkLayer(t);if(f&&!o.bv(f.getLayoutProperty(n),c)){if(c!=null&&(!d||d.validate!==!1)&&Gs(f,B.call(vn,{key:`layers.${t}.layout.${n}`,layerType:f.type,objectKey:n,value:c,styleSpec:o.a5,style:{glyphs:!0,sprite:!0}})))return;f.setLayoutProperty(n,c),f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid),this._updateLayer(f)}}getLayoutProperty(t,n){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(n)}setPaintProperty(t,n,c,d={}){this._checkLoaded();const f=this._checkLayer(t);if(!f||o.bv(f.getPaintProperty(n),c)||c!=null&&(!d||d.validate!==!1)&&Gs(f,k.call(vn,{key:`layers.${t}.paint.${n}`,layerType:f.type,objectKey:n,value:c,styleSpec:o.a5})))return;const m=f.setPaintProperty(n,c);f.configDependencies.size!==0&&this._configDependentLayers.add(f.fqid),m&&this._updateLayer(f),this._changes.updatePaintProperties(f)}getPaintProperty(t,n){const c=this._checkLayer(t);if(c)return c.getPaintProperty(n)}setFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:E,sourceLayer:C}of M)S.setFeatureState({id:t.id,source:E,sourceLayer:C},n)}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},n)}return}const c=t.source,d=t.sourceLayer,f=this._checkSource(c);if(!f)return;const m=f.type;if(m==="geojson"&&d)return void this.fire(new o.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.setFeatureState(d,t.id,n)}removeFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:E,sourceLayer:C}of M)S.removeFeatureState({id:t.id,source:E,sourceLayer:C},n)}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},n)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const f=d.type,m=f==="vector"?t.sourceLayer:void 0;
vendor: 9,168 bytes, line 15
15if(f==="vector"&&!m)return void this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new o.z(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,n)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let f;if("featuresetId"in t.target){const{featuresetId:m,importId:y}=t.target,x=this.getFragmentStyle(y),T=x.getFeaturesetLayers(m);for(const{source:S,sourceLayer:M}of T){const E=x.getFeatureState({id:t.id,source:S,sourceLayer:M});if(E&&!f)f=E;else if(!o.bv(f,E))return void this.fire(new o.z(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);f=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.sourceLayer})}return f}const n=t.source,c=t.sourceLayer,d=this._checkSource(n);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new o.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)[0].getFeatureState(c,t.id);this.fire(new o.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=o.h({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return o.h({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),n=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return o.dp({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:n,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},(c=>c!==void 0))}_updateFilteredLayers(t){for(const n of Object.values(this._mergedLayers))t(n)&&this._updateLayer(n)}_updateLayer(t){this._changes.updateLayer(t);const n=this.getLayerSourceCache(t),c=o.C(t.source,t.scope),d=this._changes.getUpdatedSourceCaches();t.source&&!d[c]&&n&&n.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),n.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const n=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},f=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x)){d[x]=y;for(const T of t){const S=T[x];if(S)for(const M of S)f.push(M)}}}f.sort(((y,x)=>x.intersectionZ-y.intersectionZ));const m=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x))for(let T=f.length-1;T>=0;T--){const S=f[T].feature;if(S.layer&&d[S.layer.id]<y)break;m.push(S),f.pop()}else for(const T of t){const S=T[x];if(S)for(const M of S)m.push(M.feature)}}return m}queryRenderedFeatures(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ge,"queryRenderedFeatures.filter",n.filter,null,n),d=o.b3(n.filter));const f={},m=S=>{if(ic.has(S.type))return;const M=this.getOwnLayerSourceCache(S),E=f[M.id]=f[M.id]||{sourceCache:M,layers:{},has3DLayers:!1};S.is3D(!!this.terrain)&&(E.has3DLayers=!0),E.layers[S.fqid]=E.layers[S.fqid]||{styleLayer:S,targets:[]},E.layers[S.fqid].targets.push({filter:d})};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new o.z(new Error("parameters.layers must be an Array."))),[];for(const S of n.layers){const M=this._layers[S];if(!M)return this.fire(new o.z(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];m(M)}}else for(const S in this._layers)m(this._layers[S]);const y=this._queryRenderedFeatures(t,f,c),x=this._flattenAndSortRenderedFeatures(y),T=[];for(const S of x)o.dq(S.layer.id)===this.scope&&T.push(S);return T}queryRenderedFeatureset(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ge,"queryRenderedFeatures.filter",n.filter,null,n),d=o.b3(n.filter));const f="mock",m=[];if(n&&n.target)m.push(Object.assign({},n,{targetId:f,filter:d}));else{const S=this.getFeaturesetDescriptors();for(const M of S)m.push({targetId:f,filter:d,target:M});for(const{style:M}of this.fragments){const E=M.getFeaturesetDescriptors();for(const C of E)m.push({targetId:f,filter:d,target:C})}}const y=this.queryRenderedTargets(t,m,c),x=[],T=new Set;for(const S of y)for(const M of S.variants[f])$l(M,S,T)||x.push(new o.dr(S,M));return x}queryRenderedTargets(t,n,c){const d={},f=(y,x,T,S)=>{const M=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(M.layers[y.fqid]=M.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(M.has3DLayers=!0),!S)return T.uniqueFeatureID=!1,void M.layers[y.fqid].targets.push(T);M.layers[y.fqid].targets.push(Object.assign({},T,{namespace:S.namespace,properties:S.properties,uniqueFeatureID:S.uniqueFeatureID}))};for(const y of n)if("featuresetId"in y.target){const{featuresetId:x,importId:T}=y.target,S=this.getFragmentStyle(T);if(!S||!S._featuresetSelectors)continue;const M=S._featuresetSelectors[x];if(!M){this.fire(new o.z(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const E of M){const C=S.getOwnLayer(E.layerId);C&&!ic.has(C.type)&&f(C,S.getOwnLayerSourceCache(C),y,E)}}else if("layerId"in y.target){const{layerId:x}=y.target,T=this.getLayer(x);if(!T||ic.has(T.type))continue;f(T,this.getLayerSourceCache(T),y)}const m=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,n,c){const d=[],f=!!this.map._showQueryGeometry,m=ri.createFromScreenPoints(t,c);for(const y in n){const x=Zl(m,n[y],this._availableImages,c,f);Object.keys(x).length&&d.push(x)}if(this.placement)for(const y in n){if(!n[y].sourceCache._onlySymbols)continue;const x=po(m.screenGeometry,n[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(x).length&&d.push(x)}return d}querySourceFeatures(t,n){const c=n&&n.filter;c&&this._validate(ge,"querySourceFeatures.filter",c,null,n);let d=[];const f=this.getOwnSourceCaches(t);for(const m of f)d=d.concat(Wa(m,n));return d}addSourceType(t,n,c){return Nn.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(Nn.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,n,c={}){this._checkLoaded();const d=this.light.getLight();let f=!1;for(const y in t)if(!o.bv(t[y],d[y])){f=!0;break}if(!f)return;const m=this._getTransitionParameters();this.light.setLight(t,n,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=o.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&o.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,n=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),n===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=t.source==null;if(n===1){if(this.disableElevatedTerrain)return;if(typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=o.di(c),c=o.h(c,{source:y})}const f=o.h({},c),m={};if(this.terrain&&d){f.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(m.style=y.serialize())}if(this._validate(ke,"terrain",f,m))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&n!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,n),this.fire(new o.A("data",{dataType:"style"}))}else{const f=this.terrain,m=f.get();for(const y of Object.keys(o.a5.terrain))!c.hasOwnProperty(y)&&o.a5.terrain[y].default&&(c[y]=o.a5.terrain[y].default);for(const y in t)if(!o.bv(t[y],m[y])){f.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});f.updateTransitions(x),this.fire(new o.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedU
15pdate=!0}_createFog(t){const n=this.fog=new Ft(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createSnow(t){const n=this.snow=new yr(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createRain(t){const n=this.rain=new dr(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.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 n=this.fog;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.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 n=this.snow;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.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 n=this.rain;if(!o.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createRain(t);this._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()},n=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!n)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(n);this._loadColorTheme(c).then((()=>{this.fire(new o.A("colorthemeset")),t()})).catch((d=>{o.w(`Couldn't set color theme: ${d}`)}))}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&o.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,n){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=n,c._reloadColorTheme())}_getTransitionParameters(t){return{now:o.q.now(),transition:o.h(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],n=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):n.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...n)}_createTerrain(t,n){const c=this.terrain=new he(t,n,this.scope,this.options,this.map.getWorldview());n===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 n=this._layers[t];n.type==="fill-extrusion"&&this._updateLayer(n)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="symbol"&&this._updateLayer(n)}}_validate(t,n,c,d,f={}){if(f&&f.validate===!1)return!1;const m=o.h({},this.serialize());return Gs(this,t.call(vn,o.h({key:n,style:m,value:c,styleSpec:o.a5},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),o.ds.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.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const n=this.getSourceCaches(t);for(const c of n)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const n=this._mergedLayers[t];n._clear&&n._clear()}}reloadSource(t){const n=this.getSourceCaches(t);for(const c of n)c.resume(),c.reload()}
15reloadSources(){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 n;this.directionalLight&&(n=ea(this.directionalLight));const c=new Set;for(const d in this._mergedLayers){const f=this._mergedLayers[d];f.hasElevation()&&!c.has(f.source)&&c.add(f.source)}for(const d in this._mergedSourceCaches){const f=this._mergedSourceCaches[d],m=c.has(f._source.id);f.update(t,void 0,void 0,n,m)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const n=this._sourceCaches[t];n.resume(),n.reload()}}_updatePlacement(t,n,c,d,f,m,y=!1){let x=!1,T=!1;const S={},M={};for(const E of this._mergedOrder){const C=this._mergedLayers[E];if(C.type!=="symbol")continue;const D=o.C(C.source,C.scope);let z=S[D];if(!z){const L=this.getLayerSourceCache(C);if(!L)continue;const N=L.getRenderableIds(!0).map((j=>L.getTileByID(j)));M[D]=N.slice(),z=S[D]=N.sort(((j,q)=>q.tileID.overscaledZ-j.tileID.overscaledZ||(j.tileID.isLessThan(q.tileID)?-1:1)))}const F=this.crossTileSymbolIndex.addLayer(C,z,n.center.lng,n.projection);x=x||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),y=y||this._layerOrderChanged||d===0,this._layerOrderChanged&&this.fire(new o.A("neworder")),(y||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.q.now(),n.zoom))&&(this.pauseablePlacement=new Ql(n,this._mergedOrder,y,c,d,f,this.placement,this.fog&&n.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,S,M,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(o.q.now()),T=!0),x&&this.pauseablePlacement.placement.setStale()),T||x){this._buildingIndex.onNewFrame(n.zoom);for(let E=0;E<this._mergedOrder.length;E++){const C=this._mergedLayers[this._mergedOrder[E]];if(C.type!=="symbol")continue;const D=this.isLayerClipped(C);this.placement.updateLayerOpacities(C,S[o.C(C.source,C.scope)],E,D?m:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.q.now())}}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,n){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex((({id:f})=>f===t.id))!==-1)return void this.fire(new o.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!n)return c.push(t),this._loadImports([t],!0);const d=c.findIndex((({id:f})=>f===n));return d===-1&&this.fire(new o.z(new Error(`Import with id "${n}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,n)}updateImport(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof n=="string"?(this.setImportUrl(t,n),this):(n.url&&n.url!==c[d].url&&this.setImportUrl(t,n.url),o.bv(n.config,c[d].config)||this.setImportConfig(t,n.config,n.data.schema),o.bv(n.data,c[d].data)||this.setImportData(t,n.data),this)}moveImport(t,n){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const f=this.getImportIndex(n);if(f===-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,f).concat(m).concat(c.slice(f)),this.fragments=this.fragments.slice(0,f).concat(y).concat(this.fragments.slice(f)),this.mergeLayers(),this}setImportUrl(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=n;const f=this.fragments[d];return f.style=this._createFragmentStyle(c[d]),f.style.on("style.import.load",(()=>this.mergeAll())),f.style.loadURL(n),this}setImportData(t,n){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:n?(this.fragments[c].style.setState(n),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,n,c){this._checkLoaded();const d=this.getImportIndex(t),f=this.stylesheet.imports||[];if(d===-1)return this;n?f[d].config=n:delete f[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=n,m.style.updateConfig(n,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const n=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(n.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const n=(this.stylesheet.imports||[]).findIndex((c=>c.id===t));
15return n===-1&&this.fire(new o.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),n}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const n in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[n];c&&t.push(c.getSource())}return t}getSource(t,n){const c=this.getSourceCache(t,n);return c&&c.getSource()}getLayerSource(t){const n=this.getLayerSourceCache(t);return n&&n.getSource()}getSourceCache(t,n){const c=o.C(t,n);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const n=o.C(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[n]:this._mergedOtherSourceCaches[n]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const n=[];return this._mergedOtherSourceCaches[t]&&n.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&n.push(this._mergedSymbolSourceCaches[t]),n}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const n in t){const c=t[n];c==="reload"?this.reloadSource(n):c==="clear"&&this.clearSource(n)}}updateLayers(t){const n=this._changes.getUpdatedPaintProperties();for(const c of n){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,n,c){this.imageManager.getImages(n.images,n.scope,c),this._updateTilesForChangedImages();const d=m=>{if(m){const y=n.images.map((x=>o.I.toString(x)));m.setDependencies(n.tileID.key,n.type,y)}},f=o.C(n.source,n.scope);d(this._mergedOtherSourceCaches[f]),d(this._mergedSymbolSourceCaches[f]),n.images.some((m=>m.iconsetId))&&this.fire(new o.A("data",{dataType:"style"}))}rasterizeImages(t,n,c){this.imageManager.rasterizeImages(n,c)}getGlyphs(t,n,c){this.glyphManager.getGlyphs(n.stacks,c)}getResource(t,n,c){return o.dt(n,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const n=[];return this._otherSourceCaches[t]&&n.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&n.push(this._symbolSourceCaches[t]),n}_isSourceCacheLoaded(t){const n=this.getOwnSourceCaches(t);return n.length===0?(this.fire(new o.z(new Error(`There is no source with ID '${t}'`))),!1):n.every((c=>c.loaded()))}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,n){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||n&&n.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)}}Nn.getSourceType=function(l){return Hl[l]},Nn.setSourceType=function(l,t){Hl[l]=t},Nn.registerForPluginStateChange=o.du;var Th=` 16#define EPSILON 0.0000001 17#define PI 3.141592653589793 18#ifdef RENDER_CUTOFF 19float 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);} 20#endif`,ia=` 21out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth) 22{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;} 23#ifdef INDICATOR_CUTOUT 24uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 25#endif 26vec4 applyCutout(vec4 color,float height) { 27#ifdef INDICATOR_CUTOUT 28float 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;
28float 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); 29#else 30return color; 31#endif 32} 33#ifdef DEBUG_WIREFRAME 34#define HANDLE_WIREFRAME_DEBUG \\ 35glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 36gl_FragDepth=gl_FragCoord.z-0.0001; 37#else 38#define HANDLE_WIREFRAME_DEBUG 39#endif 40#ifdef RENDER_CUTOFF 41uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 42#endif 43vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,ra=` 44#define EXTENT 8192.0 45#define RAD_TO_DEG 180.0/PI 46#define DEG_TO_RAD PI/180.0 47#define GLOBE_RADIUS EXTENT/PI/2.0 48float 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;} 49#ifdef PROJECTION_GLOBE_VIEW 50vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 51#ifndef PROJECTED_POS_ON_VIEWPORT 52float 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; 53#else 54return vec3(0.0); 55#endif 56}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);} 57#endif 58vec2 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( 59unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 60);}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);} 61#ifdef RENDER_CUTOFF 62uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 63#endif 64const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) 65{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,Sh="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
65void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",rc=` 66#define ELEVATION_SCALE 7.0 67#define ELEVATION_OFFSET 450.0 68#ifdef PROJECTION_GLOBE_VIEW 69uniform 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( 70mix(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;} 71#else 72vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 73#endif 74#ifdef TERRAIN 75uniform 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) { 76#ifdef TERRAIN_DEM_FLOAT_FORMAT 77vec2 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; 78#else 79float 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); 80#endif 81}float prevElevation(vec2 apos) { 82#ifdef TERRAIN_DEM_FLOAT_FORMAT 83vec2 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; 84#else 85float 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); 86#endif 87} 88#ifdef TERRAIN_VERTEX_MORPHING 89float elevation(vec2 apos) { 90#ifdef ZERO_EXAGGERATION 91return 0.0; 92#endif 93float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 94#else 95float elevation(vec2 apos) { 96#ifdef ZERO_EXAGGERATION 97return 0.0; 98#endif 99return currentElevation(apos);} 100#endif 101vec4 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);} 102#else 103float elevation(vec2 pos) { return 0.0; } 104#endif 105#ifdef DEPTH_OCCLUSION 106uniform 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; 107#ifdef DEPTH_D24 108float 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);} 109#else 110highp float unpack_depth_rgba(vec4 rgba_depth) 111{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;} 112#endif 113bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 114#ifdef DEPTH_D24 115float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 116#else 117float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 118#endif 119return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
119size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 120#ifdef DEPTH_D24 121highp vec4 depth=vec4( 122texture(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 123);depth=unpack_depth4(depth); 124#else 125highp vec4 depth=vec4( 126unpack_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)) 127); 128#endif 129return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { 130#ifdef DEPTH_D24 131highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 132#else 133highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 134#endif 135res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} 136#else 137bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 138#endif//DEPTH_OCCLUSION`,Sn=`#ifdef FOG 139uniform 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);} 140#endif`,nc=`#ifdef FOG 141uniform 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; 142#ifdef FLIP_Y 143uv.y=1.0-uv.y; 144#endif 145highp vec3 ray_dir=mix( 146mix(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;}
146vec3 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);} 147#endif`,We=`#ifdef RASTER_ARRAY 148uniform 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) 149);}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) 150);}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);} 151#endif`,Eh=`#ifdef RASTER_ARRAY 152uniform 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;} 153#endif 154uniform 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;}`,sc=`#ifdef RENDER_SHADOWS 155uniform 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];} 156#endif//RENDER_SHADOWS`,oc=`#ifdef RENDER_SHADOWS 157precision 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
157p float bias) { 158#ifdef CLIP_ZERO_TO_ONE 159highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias); 160#else 161highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias); 162#endif 163return 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; 164#ifdef SHADOWS_SINGLE_CASCADE 165vec2 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); 166#else 167light_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); 168#endif 169}highp float calculate_shadow_bias(float NDotL) { 170#ifdef NORMAL_OFFSET 171return 0.5*u_shadow_bias.x; 172#else 173return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 174#endif 175}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) 176{highp vec2 biasUV=vec2( 177pos_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);} 178#endif`;const fl=[];Zn(Th,fl),Zn(ra,fl),Zn(ia,fl);const To={"_prelude_fog.vertex.glsl":Sn,"_prelude_terrain.vertex.glsl":rc,"_prelude_shadow.vertex.glsl":sc,"_prelude_fog.fragment.glsl":nc,"_prelude_shadow.fragment.glsl":oc,"_prelude_lighting.glsl":` 179#ifdef LIGHTING_3D_MODE 180uniform 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
180));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);} 181#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":We,"_prelude_raster_particle.glsl":Eh},Vn={};Ht("",rc),Ht(nc,Sn),Ht(oc,sc),Ht(We,""),Ht(Eh,"");const ac=Ht(ia,ra),Hs=Th;var pl={background:Ht(`#include "_prelude_fog.fragment.glsl" 182#include "_prelude_lighting.glsl" 183uniform vec4 u_color;uniform float u_opacity; 184#ifdef LIGHTING_3D_MODE 185in vec4 v_color; 186#endif 187void main() {vec4 out_color; 188#ifdef LIGHTING_3D_MODE 189out_color=v_color; 190#else 191out_color=u_color; 192#endif 193#ifdef FOG 194out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 195#endif 196glFragColor=out_color*u_opacity; 197#ifdef OVERDRAW_INSPECTOR 198glFragColor=vec4(1.0); 199#endif 200HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 201#include "_prelude_lighting.glsl" 202in vec2 a_pos;uniform mat4 u_matrix; 203#ifdef LIGHTING_3D_MODE 204uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength; 205#endif 206void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 207#ifdef LIGHTING_3D_MODE 208v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 209#endif 210#ifdef FOG 211v_fog_pos=fog_position(a_pos); 212#endif 213}`),backgroundPattern:Ht(`#include "_prelude_fog.fragment.glsl" 214#include "_prelude_lighting.glsl" 215uniform 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); 216#ifdef LIGHTING_3D_MODE 217out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 218#endif 219#ifdef FOG 220out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 221#endif 222glFragColor=out_color*u_opacity; 223#ifdef OVERDRAW_INSPECTOR 224glFragColor=vec4(1.0); 225#endif 226HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 227uniform 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); 228#ifdef FOG 229v_fog_pos=fog_position(a_pos); 230#endif 231}`),building:Ht(`#include "_prelude_fog.fragment.glsl" 232#include "_prelude_shadow.fragment.glsl" 233#include "_prelude_lighting.glsl" 234const 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; 235#ifdef BUILDING_FAUX_FACADE 236in 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; 237#endif 238#ifdef RENDER_SHADOWS 239in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 240#endif 241uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));} 242#ifdef BUILDING_FAUX_FACADE 243float 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);}
243float 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; 244#if 0 245if (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; 246#else 247if (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; 248#endif 249return out_color;} 250#endif 251vec3 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; 252#ifdef BUILDING_FAUX_FACADE 253if (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);} 254#endif 255vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; 256#ifdef RENDER_SHADOWS 257shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 258#else 259shadowed_lighting_factor=dot(normal,u_lighting_directional_dir); 260#endif 261color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=mix(color.rgb,base_color.rgb,emissive); 262#ifdef FOG 263color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); 264#endif 265color.rgb=linearTosRGB(color.rgb);color*=u_opacity; 266#ifdef INDICATOR_CUTOUT 267color=applyCutout(color,v_pos.z); 268#endif 269glFragColor=color; 270#ifdef DEBUG_SHOW_NORMALS 271color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; 272#endif 273#ifdef OVERDRAW_INSPECTOR 274glFragColor=vec4(1.0); 275#endif 276HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 277#include "_prelude_shadow.vertex.glsl" 278in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;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; 279#ifdef BUILDING_FAUX_FACADE 280out 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; 281#endif 282#ifdef RENDER_SHADOWS 283uniform 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; 284#endif 285const 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;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 286#ifdef BUILDING_FAUX_FACADE 287mat3 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);} 288#endif 289#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 290#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive 291void main() { 292#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 293#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive 294vec4 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; 295#ifdef BUILDING_FAUX_FACADE 296v_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);} 297#endif 298v_pos=a_pos_3f; 299#ifdef RENDER_CUTOFF 300vec4 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; 301#endif 302#ifdef RENDER_SHADOWS 303vec3 shadow_pos=v_pos; 304#ifdef NORMAL_OFFSET 305vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); 306#endif 307v_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);v_depth_shadows=gl_Position.w; 308#endif 309#ifdef FOG 310v_fog_pos=fog_position(v_pos); 311#endif 312gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);}`),buildingBloom:Ht(`in vec4 v_color_emissive; 313#pragma mapbox: define-attribute highp vec4 bloom_attenuation 314#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 315float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; 316#ifdef HAS_ATTRIBUTE_a_bloom_attenuation 317float 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));
317opacity*=saturate(1.0-distance*distance); 318#endif 319glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; 320#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 321#pragma mapbox: define-attribute highp vec4 bloom_attenuation 322out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 323#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 324#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 325#ifdef HAS_ATTRIBUTE_a_part_color_emissive 326vec4 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); 327#else 328v_color_emissive=vec4(1.0); 329#endif 330gl_Position=u_matrix*vec4(a_pos_3f,1.0);}`),buildingDepth:Ht(`in highp float v_depth;void main() { 331#ifndef DEPTH_TEXTURE 332glFragColor=pack_depth(v_depth); 333#endif 334}`,"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:Ht(`#include "_prelude_fog.fragment.glsl" 335#include "_prelude_lighting.glsl" 336in vec3 v_data;in float v_visibility; 337#pragma mapbox: define highp vec4 color 338#pragma mapbox: define mediump float radius 339#pragma mapbox: define lowp float blur 340#pragma mapbox: define lowp float opacity 341#pragma mapbox: define highp vec4 stroke_color 342#pragma mapbox: define mediump float stroke_width 343#pragma mapbox: define lowp float stroke_opacity 344uniform float u_emissive_strength;void main() { 345#pragma mapbox: initialize highp vec4 color 346#pragma mapbox: initialize mediump float radius 347#pragma mapbox: initialize lowp float blur 348#pragma mapbox: initialize lowp float opacity 349#pragma mapbox: initialize highp vec4 stroke_color 350#pragma mapbox: initialize mediump float stroke_width 351#pragma mapbox: initialize lowp float stroke_opacity 352vec2 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 ? 353smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 354smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 355antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 356);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 357#ifdef LIGHTING_3D_MODE 358out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 359#endif 360#ifdef FOG 361out_color=fog_apply_premultiplied(out_color,v_fog_pos); 362#endif 363glFragColor=out_color*(v_visibility*opacity_t); 364#ifdef OVERDRAW_INSPECTOR 365glFragColor=vec4(1.0); 366#endif 367}`,`#include "_prelude_fog.vertex.glsl" 368#include "_prelude_terrain.vertex.glsl" 369#define NUM_VISIBILITY_RINGS 2 370#define INV_SQRT2 0.70710678 371#define ELEVATION_BIAS 0.0001 372#define NUM_SAMPLES_PER_RING 16 373uniform 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; 374#ifdef PROJECTION_GLOBE_VIEW 375in 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; 376#endif 377#ifdef ELEVATED_ROADS 378in float a_circle_z_offset; 379#endif 380out vec3 v_data;out float v_visibility; 381#pragma mapbox: define highp vec4 color 382#pragma mapbox: define mediump float radius 383#pragma mapbox: define lowp float blur 384#pragma mapbox: define lowp float opacity 385#pragma mapbox: define highp vec4 stroke_color 386#pragma mapbox: define mediump float stroke_width 387#pragma mapbox: define lowp float stroke_opacity 388vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { 389#if defined(TERRAIN) 390return elevation(pos)+ELEVATION_BIAS; 391#else 392return 0.0; 393#endif 394}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); 395#ifdef PITCH_WITH_MAP 396#ifdef PROJECTION_GLOBE_VIEW 397return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 398#else 399return u_matrix*( world_center+vec4(sample_offset,0,0) ); 400#endif 401#else 402return projected_center+vec4(sample_offset,0,0); 403#endif 404}float get_sample_step() { 405#ifdef PITCH_WITH_MAP 406return 2.0*PI/float(NUM_SAMPLES_PER_RING); 407#else 408return PI/float(NUM_SAMPLES_PER_RING); 409#endif 410}void main(void) { 411#pragma mapbox: initialize highp vec4 color 412#pragma mapbox: initialize mediump float radius 413#pragma mapbox: initialize lowp float blur 414#pragma mapbox: initialize lowp float opacity 415#pragma mapbox: initialize highp vec4 stroke_color 416#pragma mapbox: initialize mediump float stroke_width 417#pragma mapbox: initialize lowp float stroke_opacity 418vec2 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; 419#ifdef PROJECTION_GLOBE_VIEW 420vec3 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); 421#else
422surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); 423#endif 424#ifdef ELEVATED_ROADS 425world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 426#endif 427vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 428#ifdef PITCH_WITH_MAP 429#ifdef SCALE_WITH_MAP 430view_scale=1.0; 431#else 432view_scale=projected_center.w/u_camera_to_center_distance; 433#endif 434#else 435#ifdef SCALE_WITH_MAP 436view_scale=u_camera_to_center_distance; 437#else 438view_scale=projected_center.w; 439#endif 440#endif 441gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 442#ifdef TERRAIN 443float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 444#ifdef PITCH_WITH_MAP 445float 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; 446#else 447occlusion_world_center=world_center;occlusion_projected_center=projected_center; 448#endif 449for(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); 450#else 451visibility=1.0; 452#endif 453#ifdef PROJECTION_GLOBE_VIEW 454visibility=1.0; 455#endif 456v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 457#ifdef FOG 458v_fog_pos=fog_position(world_center.xyz); 459#endif 460}`),clippingMask:Ht("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:Ht(`#include "_prelude_fog.fragment.glsl" 461uniform highp float u_intensity;in vec2 v_extrude; 462#pragma mapbox: define highp float weight 463#define GAUSS_COEF 0.3989422804014327 464void main() { 465#pragma mapbox: initialize highp float weight 466float 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); 467#ifdef FOG 468if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 469#endif 470#ifdef OVERDRAW_INSPECTOR 471glFragColor=vec4(1.0); 472#endif 473HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 474#include "_prelude_fog.vertex.glsl" 475uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; 476#ifdef PROJECTION_GLOBE_VIEW 477in 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; 478#endif 479out vec2 v_extrude; 480#pragma mapbox: define highp float weight 481#pragma mapbox: define mediump float radius 482const highp float ZERO=1.0/255.0/16.0; 483#define GAUSS_COEF 0.3989422804014327 484void main(void) { 485#pragma mapbox: initialize highp float weight 486#pragma mapbox: initialize mediump float radius 487vec2 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; 488#ifdef PROJECTION_GLOBE_VIEW 489vec3 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); 490#else 491pos=vec3(tilePos+extrude,elevation(tilePos)); 492#endif 493gl_Position=u_matrix*vec4(pos,1); 494#ifdef FOG 495v_fog_pos=fog_position(pos); 496#endif 497}`),heatmapTexture:Ht(`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; 498#ifdef OVERDRAW_INSPECTOR 499glFragColor=vec4(0.0); 500#endif 501HANDLE_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:Ht("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" 502in 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; 503#ifdef PROJECTION_GLOBE_VIEW 504uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; 505#endif 506out 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); 507#ifdef PROJECTION_GLOBE_VIEW 508#ifndef PROJECTED_POS_ON_VIEWPORT 509vec3 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); 510#endif 511#endif 512vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 5130.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:Ht("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( 514mix(-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( 5150.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:Ht("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" 516in vec2 a_pos; 517#ifdef PROJECTION_GLOBE_VIEW 518in vec3 a_pos_3; 519#endif 520out 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; 521#ifdef PROJECTION_GLOBE_VIEW
522gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 523#else 524gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 525#endif 526}`),elevatedStructuresDepth:Ht(`void main() { 527#ifndef DEPTH_TEXTURE 528glFragColor=vec4(0.); 529#endif 530}`,"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:Ht(`#ifdef DEPTH_RECONSTRUCTION 531in float v_height; 532#endif 533void main() { 534#ifdef DEPTH_RECONSTRUCTION 535if (v_height >=0.0) 536discard; 537#endif 538glFragColor=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; 539#ifdef DEPTH_RECONSTRUCTION 540out float v_height; 541#endif 542void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 543#ifdef DEPTH_RECONSTRUCTION 544if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 545#endif 546gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Ht(`#include "_prelude_fog.fragment.glsl" 547#include "_prelude_lighting.glsl" 548#include "_prelude_shadow.fragment.glsl" 549in vec3 v_normal;in float v_height; 550#ifdef RENDER_SHADOWS 551in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 552#endif 553vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
553vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) 554{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; 555#pragma mapbox: define highp vec4 structure_color 556void main() { 557#pragma mapbox: initialize highp vec4 structure_color 558vec3 color=structure_color.xyz; 559#ifdef LIGHTING_3D_MODE 560vec3 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); 561#ifdef RENDER_SHADOWS 562float 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); 563#else 564color=apply_lighting(color,transformed_normal); 565#endif 566color=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);} 567#endif 568#ifdef FOG 569color=fog_apply(color,v_fog_pos); 570#endif 571vec4 out_color=vec4(color,1.0); 572#ifdef INDICATOR_CUTOUT 573out_color=applyCutout(out_color,v_height); 574#endif 575#ifdef FEATURE_CUTOUT 576out_color=apply_feature_cutout(out_color,gl_FragCoord); 577#endif 578glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 579#include "_prelude_shadow.vertex.glsl" 580in 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; 581#ifdef RENDER_SHADOWS 582uniform 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; 583#endif 584#pragma mapbox: define highp vec4 structure_color 585void main() { 586#pragma mapbox: initialize highp vec4 structure_color 587v_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); 588#ifdef RENDER_SHADOWS 589vec3 shd_pos0=pos;vec3 shd_pos1=pos; 590#ifdef NORMAL_OFFSET 591vec3 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(); 592#endif 593v_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; 594#endif 595#ifdef FOG 596v_fog_pos=fog_position(a_pos); 597#endif 598}`),fill:Ht(`#include "_prelude_fog.fragment.glsl" 599#include "_prelude_lighting.glsl" 600#include "_prelude_shadow.fragment.glsl" 601#pragma mapbox: define highp vec4 color 602#pragma mapbox: define lowp float opacity 603uniform float u_emissive_strength; 604#ifdef RENDER_SHADOWS 605uniform 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; 606#endif 607#ifdef ELEVATED_ROADS 608in highp float v_road_z_offset; 609#endif 610#ifdef INDICATOR_CUTOUT 611in highp float v_z_offset; 612#endif 613void main() { 614#pragma mapbox: initialize highp vec4 color 615#pragma mapbox: initialize lowp float opacity 616vec4 out_color=color; 617#ifdef LIGHTING_3D_MODE 618out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 619#ifdef RENDER_SHADOWS 620float 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); 621#endif 622#endif 623#ifdef FOG 624out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 625#endif 626out_color*=opacity; 627#ifdef INDICATOR_CUTOUT 628if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 629#endif 630#ifdef FEATURE_CUTOUT 631out_color=apply_feature_cutout(out_color,gl_FragCoord); 632#endif 633glFragColor=out_color; 634#ifdef OVERDRAW_INSPECTOR 635glFragColor=vec4(1.0); 636#endif 637HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 638#include "_prelude_shadow.vertex.glsl" 639in vec2 a_pos; 640#ifdef ELEVATED_ROADS 641in float a_road_z_offset;out highp float v_road_z_offset; 642#endif 643#ifdef RENDER_SHADOWS 644uniform 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; 645#endif 646#ifdef INDICATOR_CUTOUT 647out highp float v_z_offset; 648#endif 649uniform mat4 u_matrix; 650#pragma mapbox: define highp vec4 color 651#pragma mapbox: define lowp float opacity 652#pragma mapbox: define highp float z_offset 653void main() { 654#pragma mapbox: initialize highp vec4 color 655#pragma mapbox: initialize lowp float opacity 656#pragma mapbox: initialize highp float z_offset 657#ifdef ELEVATED_ROADS 658z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 659#endif 660float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 661#ifdef RENDER_SHADOWS 662vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 663#ifdef NORMAL_OFFSET 664vec3 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(); 665#endif 666v_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; 667#endif 668#ifdef FOG 669v_fog_pos=fog_position(a_pos); 670#endif 671#ifdef INDICATOR_CUTOUT 672v_z_offset=z_offset; 673#endif 674}`),fillOutline:Ht(`#include "_prelude_fog.fragment.glsl" 675#include "_prelude_lighting.glsl" 676#include "_prelude_shadow.fragment.glsl" 677in highp vec2 v_pos;uniform float u_emissive_strength; 678#ifdef RENDER_SHADOWS 679uniform 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; 680#endif 681#pragma mapbox: define highp vec4 outline_color 682#pragma mapbox: define lowp float opacity 683void main() { 684#pragma mapbox: initialize highp vec4 outline_color 685#pragma mapbox: initialize lowp float opacity 686float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 687#ifdef LIGHTING_3D_MODE 688out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 689#ifdef RENDER_SHADOWS 690float 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); 691#endif 692#endif 693#ifdef FOG 694out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 695#endif 696#ifdef FEATURE_CUTOUT 697out_color=apply_feature_cutout(out_color,gl_FragCoord); 698#endif 699glFragColor=out_color*(alpha*opacity); 700#ifdef OVERDRAW_INSPECTOR 701glFragColor=vec4(1.0); 702#endif 703HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 704#include "_prelude_shadow.vertex.glsl" 705in vec2 a_pos; 706#ifdef ELEVATED_ROADS 707in float a_road_z_offset; 708#endif 709#ifdef RENDER_SHADOWS 710uniform 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; 711#endif 712uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 713#pragma mapbox: define highp vec4 outline_color 714#pragma mapbox: define lowp float opacity 715#pragma mapbox: define highp float z_offset 716void main() { 717#pragma mapbox: initialize highp vec4 outline_color 718#pragma mapbox: initialize lowp float opacity 719#pragma mapbox: initialize highp float z_offset 720#ifdef ELEVATED_ROADS 721z_offset+=a_road_z_offset; 722#endif 723float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 724#ifdef FLIP_Y 725v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 726#else 727v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 728#endif 729#ifdef RENDER_SHADOWS 730vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 731#ifdef NORMAL_OFFSET 732vec3 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(); 733#endif 734v_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; 735#endif 736#ifdef FOG 737v_fog_pos=fog_position(a_pos); 738#endif 739}`),fillOutlinePattern:Ht(`#include "_prelude_fog.fragment.glsl" 740#include "_prelude_lighting.glsl" 741#include "_prelude_shadow.fragment.glsl" 742uniform vec2 u_texsize;uniform sampler2D u_image; 743#ifdef FILL_PATTERN_TRANSITION 744uniform float u_pattern_transition; 745#endif 746uniform float u_emissive_strength; 747#ifdef RENDER_SHADOWS 748uniform 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; 749#endif 750in highp vec2 v_pos;in highp vec2 v_pos_world; 751#pragma mapbox: define lowp float opacity 752#pragma mapbox: define lowp vec4 pattern 753#ifdef FILL_PATTERN_TRANSITION 754#pragma mapbox: define mediump vec4 pattern_b 755#endif 756void main() { 757#pragma mapbox: initialize lowp float opacity 758#pragma mapbox: initialize mediump vec4 pattern 759#ifdef FILL_PATTERN_TRANSITION 760#pragma mapbox: initialize mediump vec4 pattern_b 761#endif 762vec2 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); 763#ifdef FILL_PATTERN_TRANSITION 764vec2 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; 765#endif 766#ifdef LIGHTING_3D_MODE 767out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 768#ifdef RENDER_SHADOWS 769float 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); 770#endif 771#endif 772#ifdef FEATURE_CUTOUT 773out_color=apply_feature_cutout(out_color,gl_FragCoord); 774#endif 775#ifdef FOG 776out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 777#endif 778glFragColor=out_color*(alpha*opacity); 779#ifdef OVERDRAW_INSPECTOR 780glFragColor=vec4(1.0); 781#endif 782HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 783#include "_prelude_shadow.vertex.glsl" 784uniform 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; 785#ifdef ELEVATED_ROADS 786in float a_road_z_offset; 787#endif 788#ifdef RENDER_SHADOWS 789uniform 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; 790#endif 791out highp vec2 v_pos;out highp vec2 v_pos_world; 792#pragma mapbox: define lowp float opacity 793#pragma mapbox: define lowp vec4 pattern 794#ifdef FILL_PATTERN_TRANSITION 795#pragma mapbox: define mediump vec4 pattern_b 796#endif 797#pragma mapbox: define lowp float pixel_ratio 798#pragma mapbox: define highp float z_offset 799void main() { 800#pragma mapbox: initialize lowp float opacity 801#pragma mapbox: initialize mediump vec4 pattern 802#ifdef FILL_PATTERN_TRANSITION 803#pragma mapbox: initialize mediump vec4 pattern_b 804#endif 805#pragma mapbox: initialize lowp float pixel_ratio 806#pragma mapbox: initialize highp float z_offset 807vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; 808#ifdef ELEVATED_ROADS 809z_offset+=a_road_z_offset; 810#endif 811float 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); 812#ifdef FLIP_Y 813v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 814#else 815v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 816#endif 817#ifdef RENDER_SHADOWS 818vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 819#ifdef NORMAL_OFFSET 820vec3 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(); 821#endif 822v_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; 823#endif 824#ifdef FOG 825v_fog_pos=fog_position(a_pos); 826#endif 827}`),fillPattern:Ht(`#include "_prelude_fog.fragment.glsl" 828#include "_prelude_lighting.glsl" 829#include "_prelude_shadow.fragment.glsl" 830uniform vec2 u_texsize;uniform sampler2D u_image; 831#ifdef FILL_PATTERN_TRANSITION 832uniform float u_pattern_transition; 833#endif 834in highp vec2 v_pos;uniform float u_emissive_strength; 835#ifdef RENDER_SHADOWS 836uniform 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; 837#endif 838#ifdef ELEVATED_ROADS 839in highp float v_road_z_offset; 840#endif 841#pragma mapbox: define lowp float opacity 842#pragma mapbox: define lowp vec4 pattern 843#ifdef FILL_PATTERN_TRANSITION 844#pragma mapbox: define mediump vec4 pattern_b 845#endif 846void main() { 847#pragma mapbox: initialize lowp float opacity 848#pragma mapbox: initialize mediump vec4 pattern 849#ifdef FILL_PATTERN_TRANSITION 850#pragma mapbox: initialize mediump vec4 pattern_b 851#endif 852vec2 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); 853#ifdef FILL_PATTERN_TRANSITION 854vec2 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; 855#endif 856#ifdef LIGHTING_3D_MODE 857out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 858#ifdef RENDER_SHADOWS 859float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 860#ifdef ELEVATED_ROADS 861out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 862#else 863out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 864#endif 865#endif 866#endif 867#ifdef FEATURE_CUTOUT 868out_color=apply_feature_cutout(out_color,gl_FragCoord); 869#endif 870#ifdef FOG 871out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 872#endif 873glFragColor=out_color*opacity; 874#ifdef OVERDRAW_INSPECTOR 875glFragColor=vec4(1.0); 876#endif 877HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 878#include "_prelude_shadow.vertex.glsl" 879uniform 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; 880#ifdef ELEVATED_ROADS 881in float a_road_z_offset;out highp float v_road_z_offset; 882#endif 883#ifdef RENDER_SHADOWS 884uniform 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; 885#endif 886out highp vec2 v_pos; 887#pragma mapbox: define lowp float opacity 888#pragma mapbox: define lowp vec4 pattern 889#ifdef FILL_PATTERN_TRANSITION 890#pragma mapbox: define mediump vec4 pattern_b 891#endif 892#pragma mapbox: define lowp float pixel_ratio 893#pragma mapbox: define highp float z_offset 894void main() { 895#pragma mapbox: initialize lowp float opacity 896#pragma mapbox: initialize mediump vec4 pattern 897#pragma mapbox: initialize lowp float pixel_ratio 898#pragma mapbox: initialize highp float z_offset 899#ifdef FILL_PATTERN_TRANSITION 900#pragma mapbox: initialize mediump vec4 pattern_b 901#endif 902vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 903#ifdef ELEVATED_ROADS 904z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 905#endif 906float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); 907#ifdef RENDER_SHADOWS 908vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 909#ifdef NORMAL_OFFSET 910vec3 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(); 911#endif 912v_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; 913#endif 914#ifdef FOG 915v_fog_pos=fog_position(a_pos); 916#endif 917}`),fillExtrusion:Ht(`#include "_prelude_fog.fragment.glsl" 918#include "_prelude_shadow.fragment.glsl" 919#include "_prelude_lig
919hting.glsl" 920in vec4 v_color;in vec4 v_flat; 921#ifdef RENDER_SHADOWS 922in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 923#endif 924uniform lowp float u_opacity; 925#ifdef FAUX_AO 926uniform lowp vec2 u_ao;in vec2 v_ao; 927#endif 928#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 929in vec4 v_roof_color; 930#endif 931#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 932in highp vec3 v_normal; 933#endif 934uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 935#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 936in float v_flood_radius;in float v_has_floodlight; 937#endif 938in float v_height; 939#pragma mapbox: define highp float emissive_strength 940void main() { 941#pragma mapbox: initialize highp float emissive_strength 942#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 943vec3 normal=normalize(v_normal); 944#endif 945float z;vec4 color=v_color; 946#ifdef ZERO_ROOF_RADIUS 947z=float(normal.z > 0.00001); 948#ifdef LIGHTING_3D_MODE 949normal=mix(normal,vec3(0.0,0.0,1.0),z); 950#else 951color=mix(v_color,v_roof_color,z); 952#endif 953#endif 954float h=max(0.0,v_height);float ao_shade=1.0; 955#ifdef FAUX_AO 956float 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; 957#ifdef ZERO_ROOF_RADIUS 958concave*=(1.0-z); 959#endif 960float 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); 961#ifdef LIGHTING_3D_MODE 962#ifdef FLOOD_LIGHT 963color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 964#else 965color.rgb*=ao_shade; 966#endif 967#else 968color.rgb*=ao_shade; 969#endif 970#endif 971#ifdef LIGHTING_3D_MODE 972float flood_radiance=0.0; 973#ifdef FLOOD_LIGHT 974flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 975#endif 976#ifdef RENDER_SHADOWS 977#ifdef FLOOD_LIGHT 978float 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); 979#else 980float shadowed_lighting_factor; 981#ifdef RENDER_CUTOFF 982shadowed_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;} 983#else 984shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 985#endif 986color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 987#endif 988#else 989color.rgb=apply_lighting(color.rgb,normal); 990#ifdef FLOOD_LIGHT 991color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 992#endif 993#endif 994color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 995#endif 996#ifdef FOG 997color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 998#endif 999#ifdef INDICATOR_CUTOUT 1000color=applyCutout(color,h); 1001#endif 1002#ifdef FEATURE_CUTOUT 1003color=apply_feature_cutout(color,gl_FragCoord); 1004#endif 1005glFragColor=color; 1006#ifdef OVERDRAW_INSPECTOR 1007glFragColor=vec4(1.0); 1008#endif 1009HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1010#include "_prelude_terrain.vertex.glsl" 1011#include "_prelude_shadow.vertex.glsl" 1012#include "_prelude_lighting.glsl" 1013uniform 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; 1014#ifdef RENDER_WALL_MODE 1015in vec3 a_join_normal_inside; 1016#endif 1017#ifdef PROJECTION_GLOBE_VIEW 1018in 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; 1019#endif 1020#ifdef TERRAIN
1021uniform int u_height_type;uniform int u_base_type; 1022#endif 1023uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; 1024#ifdef RENDER_SHADOWS 1025uniform 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; 1026#endif 1027#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1028out vec4 v_roof_color; 1029#endif 1030#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1031out highp vec3 v_normal; 1032#endif 1033#ifdef FAUX_AO 1034uniform lowp vec2 u_ao;out vec2 v_ao; 1035#endif 1036#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 1037out float v_flood_radius;out float v_has_floodlight; 1038#endif 1039out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 1040#pragma mapbox: define highp float base 1041#pragma mapbox: define highp float height 1042#pragma mapbox: define highp vec4 color 1043#pragma mapbox: define highp float flood_light_wall_radius 1044#pragma mapbox: define highp float line_width 1045#pragma mapbox: define highp float emissive_strength 1046void main() { 1047#pragma mapbox: initialize highp float base 1048#pragma mapbox: initialize highp float height 1049#pragma mapbox: initialize highp vec4 color 1050#pragma mapbox: initialize highp float flood_light_wall_radius 1051#pragma mapbox: initialize highp float line_width 1052#pragma mapbox: initialize highp float emissive_strength 1053base*=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)); 1054#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1055v_normal=normal; 1056#endif 1057base=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); 1058#if defined(HAS_CENTROID) || defined(TERRAIN) 1059centroid_pos=a_centroid_pos; 1060#endif 1061float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 1062#ifdef TERRAIN 1063bool 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); 1064#else 1065h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); 1066#endif 1067#ifdef PROJECTION_GLOBE_VIEW 1068float 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); 1069#endif 1070float cutoff=1.0;vec3 scaled_pos=pos; 1071#ifdef RENDER_CUTOFF 1072vec3 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); 1073#ifdef CLIP_ZERO_TO_ONE 1074cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); 1075#else 1076cutoff=cutoff_opacity(u_cutoff_params,ground.z); 1077#endif 1078if (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); 1079#endif 1080float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 1081#ifdef RENDER_WALL_MODE 1082vec2 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; 1083#endif 1084gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 1085#ifdef RENDER_SHADOWS 1086vec3 shd_pos0=pos;vec3 shd_pos1=pos; 1087#ifdef NORMAL_OFFSET 1088vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 1089#endif 1090v_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); 1091#endif 1092float NdotL=0.0;float colorvalue=0.0; 1093#ifndef LIGHTING_3D_MODE 1094colorvalue=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*=( 1095(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1096#endif 1097#ifdef FAUX_AO
1098float 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; 1099#ifdef TERRAIN 1100top_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); 1101#endif 1102v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1103#ifdef PROJECTION_GLOBE_VIEW 1104top_height+=u_height_lift; 1105#endif 1106gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1107#endif 1108#ifdef LIGHTING_3D_MODE 1109#ifdef FLOOD_LIGHT 1110float 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; 1111#endif 1112v_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); 1113#else 1114v_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; 1115#endif 1116#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1117float 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; 1118#endif 1119#ifdef FOG 1120v_fog_pos=fog_position(pos); 1121#endif 1122}`),fillExtrusionDepth:Ht(`in highp float v_depth;void main() { 1123#ifndef DEPTH_TEXTURE 1124glFragColor=pack_depth(v_depth); 1125#endif 1126}`,`#include "_prelude_terrain.vertex.glsl" 1127uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 1128#ifdef TERRAIN 1129uniform int u_height_type;uniform int u_base_type; 1130#endif 1131in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1132#ifdef RENDER_WALL_MODE 1133in vec3 a_join_normal_inside; 1134#endif 1135#pragma mapbox: define highp float base 1136#pragma mapbox: define highp float height 1137#pragma mapbox: define highp float line_width 1138#pragma mapbox: define highp vec4 color 1139out highp float v_depth;void main() { 1140#pragma mapbox: initialize highp float base 1141#pragma mapbox: initialize highp float height 1142#pragma mapbox: initialize highp float line_width 1143#pragma mapbox: initialize highp vec4 color 1144base*=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); 1145#if defined(HAS_CENTROID) || defined(TERRAIN) 1146centroid_pos=a_centroid_pos; 1147#endif 1148vec3 pos; 1149#ifdef TERRAIN 1150bool 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); 1151#else 1152pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 1153#endif 1154#ifdef RENDER_WALL_MODE 1155vec2 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; 1156#endif 1157float 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:Ht(`#include "_prelude_fog.fragment.glsl" 1158#include "_prelude_lighting.glsl" 1159uniform vec2 u_texsize;uniform sampler2D u_image; 1160#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1161uniform float u_pattern_transition; 1162#endif 1163#ifdef FAUX_AO 1164uniform lowp vec2 u_ao;in vec3 v_ao; 1165#endif 1166#ifdef LIGHTING_3D_MODE 1167in vec3 v_normal; 1168#endif 1169in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 1170#pragma mapbox: define highp float base 1171#pragma mapbox: define highp float height 1172#pragma mapbox: define mediump vec4 pattern 1173#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1174#pragma mapbox: define mediump vec4 pattern_b 1175#endif 1176#pragma mapbox: define highp float pixel_ratio 1177void main() { 1178#pragma mapbox: initialize highp float base 1179#pragma mapbox: initialize highp float height 1180#pragma mapbox: initialize mediump vec4 pattern 1181#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1182#pragma mapbox: initialize mediump vec4 pattern_b 1183#endif 1184#pragma mapbox: initialize highp float pixel_ratio 1185vec2 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); 1186#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1187vec2 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; 1188#endif 1189#ifdef LIGHTING_3D_MODE 1190out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 1191#else 1192out_color=out_color*v_lighting; 1193#endif 1194#ifdef FAUX_AO 1195float 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
1195),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; 1196#endif 1197#ifdef FOG 1198out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1199#endif 1200#ifdef INDICATOR_CUTOUT 1201out_color=applyCutout(out_color,height); 1202#endif 1203glFragColor=out_color; 1204#ifdef OVERDRAW_INSPECTOR 1205glFragColor=vec4(1.0); 1206#endif 1207HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1208#include "_prelude_terrain.vertex.glsl" 1209#include "_prelude_lighting.glsl" 1210uniform 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; 1211#ifdef RENDER_WALL_MODE 1212in vec3 a_join_normal_inside; 1213#endif 1214#ifdef PROJECTION_GLOBE_VIEW 1215in 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; 1216#endif 1217#ifdef TERRAIN 1218uniform int u_height_type;uniform int u_base_type; 1219#endif 1220out highp vec2 v_pos;out vec4 v_lighting; 1221#ifdef FAUX_AO 1222uniform lowp vec2 u_ao;out vec3 v_ao; 1223#endif 1224#ifdef LIGHTING_3D_MODE 1225out vec3 v_normal; 1226#endif 1227#pragma mapbox: define highp float base 1228#pragma mapbox: define highp float height 1229#pragma mapbox: define highp vec4 color 1230#pragma mapbox: define mediump vec4 pattern 1231#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1232#pragma mapbox: define mediump vec4 pattern_b 1233#endif 1234#pragma mapbox: define highp float pixel_ratio 1235#pragma mapbox: define highp float line_width 1236void main() { 1237#pragma mapbox: initialize highp float base 1238#pragma mapbox: initialize highp float height 1239#pragma mapbox: initialize highp vec4 color 1240#pragma mapbox: initialize mediump vec4 pattern 1241#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1242#pragma mapbox: initialize mediump vec4 pattern_b 1243#endif 1244#pragma mapbox: initialize highp float pixel_ratio 1245#pragma mapbox: initialize highp float line_width 1246vec2 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); 1247#if defined(HAS_CENTROID) || defined(TERRAIN) 1248centroid_pos=a_centroid_pos; 1249#endif 1250float ele=0.0;float h=z;vec3 p;float c_ele; 1251#ifdef TERRAIN 1252bool 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); 1253#else 1254p=vec3(pos_nx.xy,z); 1255#endif 1256#ifdef PROJECTION_GLOBE_VIEW 1257float 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); 1258#endif 1259#ifdef RENDER_WALL_MODE 1260vec2 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; 1261#endif 1262float 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 1263? pos_nx.xy 1264: 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; 1265#ifdef LIGHTING_3D_MODE 1266NdotL=calculate_NdotL(normal); 1267#else 1268NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 1269#endif 1270if (normal.y !=0.0) {float r=0.84; 1271#ifndef LIGHTING_3D_MODE 1272r=mix(0.7,0.98,1.0-u_lightintensity); 1273#endif 1274NdotL*=( 1275(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1276#ifdef FAUX_AO
1277float 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; 1278#ifdef TERRAIN 1279top_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); 1280#endif 1281v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1282#ifdef PROJECTION_GLOBE_VIEW 1283top_height+=u_height_lift; 1284#endif 1285gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1286#endif 1287#ifdef LIGHTING_3D_MODE 1288v_normal=normal; 1289#else 1290v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 1291#endif 1292#ifdef FOG 1293v_fog_pos=fog_position(p); 1294#endif 1295}`),groundShadow:Ht(`#include "_prelude_shadow.fragment.glsl" 1296precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1297#ifdef FOG 1298in float v_fog_opacity; 1299#endif 1300void 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); 1301#ifdef RENDER_CUTOFF 1302shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 1303#endif 1304#ifdef FOG 1305shadow=mix(shadow,vec3(1.0),v_fog_opacity); 1306#endif 1307#ifdef INDICATOR_CUTOUT 1308shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 1309#endif 1310glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 1311uniform 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; 1312#ifdef FOG 1313out float v_fog_opacity; 1314#endif 1315void 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); 1316#ifdef FOG 1317v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); 1318#endif 1319}`),fillExtrusionGroundEffect:Ht(`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; 1320#ifdef SDF_SUBPASS 1321in 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);} 1322#ifdef FOG 1323in highp float v_fog; 1324#endif 1325#endif 1326void main() { 1327#ifdef CLEAR_SUBPASS 1328vec4 color=vec4(1.0); 1329#ifdef CLEAR_FROM_TEXTURE 1330color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 1331#endif 1332glFragColor=color; 1333#else 1334#ifdef SDF_SUBPASS 1335highp 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; 1336#ifdef FOG 1337fog=v_fog; 1338#endif 1339#ifdef RENDER_CUTOFF 1340fog*=v_cutoff_opacity; 1341#endif 1342glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 1343#else 1344vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 1345#ifdef OVERDRAW_INSPECTOR 1346color=vec4(1.0); 1347#endif 1348glFragColor=color; 1349#endif 1350HANDLE_WIREFRAME_DEBUG; 1351#endif 1352}`,`#include "_prelude_fog.vertex.glsl" 1353in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; 1354#ifdef SDF_SUBPASS 1355out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 1356#ifdef FOG 1357out highp float v_fog; 1358#endif 1359#endif 1360uniform 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; 1361#pragma mapbox: define highp float flood_light_ground_radius 1362const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1363#pragma mapbox: initialize highp float flood_light_ground_radius 1364vec2 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; 1365#ifdef SDF_SUBPASS 1366v_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); 1367#ifdef FOG 1368v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 1369#endif 1370#endif 1371float hidden_by_landmark=0.0; 1372#ifdef HAS_CENTROID 1373hidden_by_landmark=a_hidden_by_landmark; 1374#endif 1375float 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)); 1376#ifdef RENDER_CUTOFF 1377v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 1378#endif 1379}`),hillshadePrepare:Ht(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( 1380(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 1381)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 1382deriv.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:Ht(`#include "_prelude_fog.fragment.glsl" 1383#include "_prelude_lighting.glsl" 1384uniform 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; 1385#ifdef LIGHTING_3D_MODE 1386glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 1387#endif 1388#ifdef FOG 1389glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 1390#endif 1391#ifdef OVERDRAW_INSPECTOR 1392glFragColor=vec4(1.0); 1393#endif 1394HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1395uniform 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; 1396#ifdef FOG 1397v_fog_pos=fog_position(a_pos); 1398#endif 1399}`),line:Ht(`#include "_prelude_fog.fragment.glsl" 1400#include "_prelude_lighting.glsl" 1401#include "_prelude_shadow.fragment.glsl" 1402uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1402uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; 1403#ifdef ELEVATED_ROADS 1404in highp float v_road_z_offset; 1405#endif 1406#ifdef RENDER_LINE_DASH 1407uniform sampler2D u_dash_image;in vec2 v_tex; 1408#endif 1409#ifdef RENDER_LINE_GRADIENT 1410uniform sampler2D u_gradient_image; 1411#endif 1412#ifdef INDICATOR_CUTOUT 1413in highp float v_z_offset; 1414#endif 1415#ifdef RENDER_SHADOWS 1416uniform 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; 1417#endif 1418float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength; 1419#pragma mapbox: define highp vec4 color 1420#pragma mapbox: define lowp float floorwidth 1421#pragma mapbox: define lowp vec4 dash 1422#pragma mapbox: define lowp float blur 1423#pragma mapbox: define lowp float opacity 1424#pragma mapbox: define lowp float border_width 1425#pragma mapbox: define lowp vec4 border_color 1426float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 1427#pragma mapbox: initialize highp vec4 color 1428#pragma mapbox: initialize lowp float floorwidth 1429#pragma mapbox: initialize lowp vec4 dash 1430#pragma mapbox: initialize lowp float blur 1431#pragma mapbox: initialize lowp float opacity 1432#pragma mapbox: initialize lowp float border_width 1433#pragma mapbox: initialize lowp vec4 border_color 1434float 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); 1435#ifdef RENDER_LINE_DASH 1436float sdfdist=texture(u_dash_image,v_tex).r;
1436float 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); 1437#endif 1438highp vec4 out_color; 1439#ifdef RENDER_LINE_GRADIENT 1440out_color=texture(u_gradient_image,v_uv.xy); 1441#else 1442out_color=color; 1443#endif 1444float trim_alpha=1.0; 1445#ifdef RENDER_LINE_TRIM_OFFSET 1446highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;} 1447#endif 1448if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 1449#ifdef RENDER_LINE_BORDER 1450float 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);}} 1451#endif 1452#ifdef LIGHTING_3D_MODE 1453out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1454#ifdef RENDER_SHADOWS 1455float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1456#ifdef ELEVATED_ROADS 1457out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1458#else 1459out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1460#endif 1461#endif 1462#endif 1463#ifdef FOG 1464out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1465#endif 1466out_color*=(alpha*opacity); 1467#ifdef INDICATOR_CUTOUT 1468out_color=applyCutout(out_color,v_z_offset); 1469#endif 1470#ifdef FEATURE_CUTOUT 1471out_color=apply_feature_cutout(out_color,gl_FragCoord); 1472#endif 1473glFragColor=out_color; 1474#ifdef OVERDRAW_INSPECTOR 1475glFragColor=vec4(1.0); 1476#endif 1477HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1478#include "_prelude_shadow.vertex.glsl" 1479#include "_prelude_terrain.vertex.glsl" 1480#define EXTRUDE_SCALE 0.015873016 1481in vec2 a_pos_normal;in vec4 a_data; 1482#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) 1483in vec3 a_z_offset_width; 1484#endif 1485#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1486in highp vec3 a_packed; 1487#endif 1488#ifdef RENDER_LINE_DASH 1489in float a_linesofar; 1490#endif 1491uniform 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; 1492#ifdef ELEVATED 1493uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1494#ifdef ELEVATION_REFERENCE_SEA 1495return 0.0; 1496#else 1497return elevation(apos); 1498#endif 1499} 1500#endif 1501out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; 1502#ifdef ELEVATED_ROADS 1503out highp float v_road_z_offset; 1504#endif 1505#ifdef RENDER_LINE_DASH 1506uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 1507#endif 1508#ifdef RENDER_LINE_GRADIENT 1509uniform float u_image_height; 1510#endif 1511#ifdef INDICATOR_CUTOUT 1512out highp float v_z_offset; 1513#endif 1514#ifdef RENDER_SHADOWS 1515uniform 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; 1516#endif 1517#pragma mapbox: define highp vec4 color 1518#pragma mapbox: define lowp float floorwidth 1519#pragma mapbox: define lowp vec4 dash 1520#pragma mapbox: define lowp float blur 1521#pragma mapbox: define lowp float opacity 1522#pragma mapbox: define mediump float gapwidth 1523#pragma mapbox: define lowp float offset 1524#pragma mapbox: define mediump float width 1525#pragma mapbox: define lowp float border_width 1526#pragma mapbox: define lowp vec4 border_color 1527void main() { 1528#pragma mapbox: initialize highp vec4 color 1529#pragma mapbox: initialize lowp float floorwidth 1530#pragma mapbox: initialize lowp vec4 dash 1531#pragma mapbox: initialize lowp float blur 1532#pragma mapbox: initialize lowp float opacity 1533#pragma mapbox: initialize mediump float gapwidth 1534#pragma mapbox: initialize lowp float offset 1535#pragma mapbox: initialize mediump float width 1536#pragma mapbox: initialize lowp float border_width 1537#pragma mapbox: initialize lowp vec4 border_color 1538float a_z_offset; 1539#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1540a_z_offset=a_z_offset_width.x; 1541#endif 1542float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth; 1543#ifdef VARIABLE_LINE_WIDTH 1544float left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0; 1545#else 1546halfwidth=(u_width_scale*width)/2.0; 1547#endif 1548offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1548vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1549#ifdef ELEVATED_ROADS 1550v_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; 1551#else 1552#ifdef ELEVATED 1553vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1554#ifdef CROSS_SLOPE_VERTICAL 1555float 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); 1556#else 1557#ifdef CROSS_SLOPE_HORIZONTAL 1558float 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; 1559#else 1560float 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; 1561#endif 1562#endif 1563gl_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); 1564#else 1565gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1566#endif 1567#endif 1568#ifdef ELEVATED_ROADS 1569#ifdef RENDER_SHADOWS 1570vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1571#ifdef NORMAL_OFFSET 1572vec3 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(); 1573#endif 1574v_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; 1575#endif 1576#endif 1577#ifndef RENDER_TO_TEXTURE 1578float 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)); 1579#else 1580v_gamma_scale=1.0; 1581#endif 1582#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1583highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; 1584#ifdef RENDER_LINE_GRADIENT 1585highp 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); 1586#else 1587v_uv=vec3(a_uv_x,0.0,line_progress); 1588#endif 1589#endif 1590#ifdef RENDER_LINE_DASH 1591float 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); 1592#endif 1593v_width2=vec2(outset,inset); 1594#ifdef FOG 1595v_fog_pos=fog_position(pos); 1596#endif 1597#ifdef INDICATOR_CUTOUT 1598v_z_offset=a_z_offset; 1599#endif 1600}`),linePattern:Ht(`#include "_prelude_fog.fragment.glsl" 1601#include "_prelude_lighting.glsl" 1602#include "_prelude_shadow.fragment.glsl" 1603uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image; 1604#ifdef LINE_PATTERN_TRANSITION 1605uniform float u_pattern_transition; 1606#endif 1607in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 1608#ifdef RENDER_LINE_TRIM_OFFSET 1609in highp vec3 v_uv; 1610#endif 1611#ifdef ELEVATED_ROADS 1612in highp float v_road_z_offset; 1613#endif 1614#ifdef LINE_JOIN_NONE 1615in vec2 v_pattern_data; 1616#endif 1617#ifdef INDICATOR_CUTOUT 1618in highp float v_z_offset; 1619#endif 1620#ifdef RENDER_SHADOWS 1621uniform 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; 1622#endif 1623uniform float u_emissive_strength; 1624#pragma mapbox: define mediump vec4 pattern 1625#ifdef LINE_PATTERN_TRANSITION 1626#pragma mapbox: define mediump vec4 pattern_b 1627#endif 1628#pragma mapbox: define mediump float pixel_ratio 1629#pragma mapbox: define mediump float blur 1630#pragma mapbox: define mediump float opacity 1631void main() { 1632#pragma mapbox: initialize mediump vec4 pattern 1633#ifdef LINE_PATTERN_TRANSITION 1634#pragma mapbox: initialize mediump vec4 pattern_b 1635#endif 1636#pragma mapbox: initialize mediump float pixel_ratio 1637#pragma mapbox: initialize mediump float blur 1638#pragma mapbox: initialize mediump float opacity 1639vec2 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); 1640#ifdef LINE_PATTERN_TRANSITION 1641vec2 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; 1642#endif 1643#ifdef RENDER_LINE_TRIM_OFFSET 1644highp 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);} 1645#endif 1646#ifdef LINE_JOIN_NONE 1647highp 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);} 1648#endif 1649#ifdef LIGHTING_3D_MODE 1650color=apply_lighting_with_emission_ground(color,u_emissive_strength); 1651#ifdef RENDER_SHADOWS 1652float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1653#ifdef ELEVATED_ROADS 1654color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1655#else 1656color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1657#endif 1658#endif 1659#endif 1660#ifdef FOG 1661color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1662#endif 1663color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 1664#ifdef INDICATOR_CUTOUT 1665color=applyCutout(color,v_z_offset); 1666#endif 1667glFragColor=color; 1668#ifdef OVERDRAW_INSPECTOR 1669glFragColor=vec4(1.0); 1670#endif 1671HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1672#include "_prelude_shadow.vertex.glsl" 1673#include "_prelude_terrain.vertex.glsl" 1674#define scale 0.015873016 1675in vec2 a_pos_normal;in vec4 a_data; 1676#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1677in vec3 a_z_offset_width; 1678#endif 1679#ifdef RENDER_LINE_TRIM_OFFSET 1680in highp vec3 a_packed; 1681#endif 1682in highp float a_linesofar; 1683#ifdef LINE_JOIN_NONE 1684in highp vec3 a_pattern_data;out vec2 v_pattern_data; 1685#endif 1686#ifdef INDICATOR_CUTOUT 1687out highp float v_z_offset; 1688#endif 1689uniform 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; 1690#ifdef ELEVATED 1691uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1692#ifdef ELEVATION_REFERENCE_SEA 1693return 0.0; 1694#else 1695return elevation(apos); 1696#endif 1697} 1698#endif 1699out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 1700#ifdef RENDER_LINE_TRIM_OFFSET 1701out highp vec3 v_uv; 1702#endif 1703#ifdef ELEVATED_ROADS 1704out highp float v_road_z_offset; 1705#endif 1706#ifdef RENDER_SHADOWS 1707uniform 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; 1708#endif 1709#pragma mapbox: define mediump float blur 1710#pragma mapbox: define mediump float opacity 1711#pragma mapbox: define mediump float offset 1712#pragma mapbox: define mediump float gapwidth 1713#pragma mapbox: define mediump float width 1714#pragma mapbox: define mediump float floorwidth 1715#pragma mapbox: define mediump vec4 pattern 1716#ifdef LINE_PATTERN_TRANSITION 1717#pragma mapbox: define mediump vec4 pattern_b 1718#endif 1719#pragma mapbox: define mediump float pixel_ratio 1720void main() { 1721#pragma mapbox: initialize mediump float blur 1722#pragma mapbox: initialize mediump float opacity 1723#pragma mapbox: initialize mediump float offset 1724#pragma mapbox: initialize mediump float gapwidth 1725#pragma mapbox: initialize mediump float width 1726#pragma mapbox: initialize mediump float floorwidth 1727#pragma mapbox: initialize mediump vec4 pattern 1728#ifdef LINE_PATTERN_TRANSITION 1729#pragma mapbox: initialize mediump vec4 pattern_b 1730#endif 1731#pragma mapbox: initialize mediump float pixel_ratio 1732float a_z_offset; 1733#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1734a_z_offset=a_z_offset_width.x; 1735#endif 1736float 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;
1736vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1737#ifdef ELEVATED_ROADS 1738v_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; 1739#else 1740#ifdef ELEVATED 1741vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1742#ifdef CROSS_SLOPE_VERTICAL 1743float 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); 1744#else 1745#ifdef CROSS_SLOPE_HORIZONTAL 1746float 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; 1747#else 1748float 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; 1749#endif 1750#endif 1751gl_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); 1752#else 1753gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1754#endif 1755#endif 1756#ifdef ELEVATED_ROADS 1757#ifdef RENDER_SHADOWS 1758vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1759#ifdef NORMAL_OFFSET 1760vec3 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(); 1761#endif 1762v_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; 1763#endif 1764#endif 1765#ifndef RENDER_TO_TEXTURE 1766float 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)); 1767#else 1768v_gamma_scale=1.0; 1769#endif 1770#ifdef RENDER_LINE_TRIM_OFFSET 1771highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 1772#endif 1773v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 1774#ifdef LINE_JOIN_NONE 1775v_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); 1776#endif 1777#ifdef FOG 1778v_fog_pos=fog_position(pos); 1779#endif 1780#ifdef INDICATOR_CUTOUT 1781v_z_offset=a_z_offset; 1782#endif 1783}`),raster:Ht(`#include "_prelude_fog.fragment.glsl" 1784#include "_prelude_lighting.glsl" 1785#include "_prelude_raster_array.glsl" 1786uniform 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; 1787#ifdef PROJECTION_GLOBE_VIEW 1788in float v_split_fade; 1789#endif 1790uniform 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; 1791#ifndef RASTER_ARRAY 1792uniform highp sampler2D u_image0;uniform sampler2D u_image1; 1793#endif 1794#ifdef RASTER_COLOR 1795uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 1796#endif 1797void main() {vec4 color0,color1,color;vec2 value; 1798#ifdef RASTER_COLOR 1799#ifdef RASTER_ARRAY 1800#ifdef RASTER_ARRAY_LINEAR 1801value=mix( 1802raTexture2D_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 1803); 1804#else 1805value=mix( 1806raTexture2D_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 1807); 1808#endif 1809if (value.y > 0.0) value.x/=value.y; 1810#else 1811color=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); 1812#endif 1813color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 1814#else 1815color0=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); 1816#endif 1817color.a*=u_opacity; 1818#ifdef GLOBE_POLES 1819color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 1820#endif 1821vec3 rgb=color.rgb;rgb=vec3( 1822dot(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); 1823#ifdef LIGHTING_3D_MODE 1824out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 1825#endif 1826#ifdef FOG 1827highp 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)); 1828#endif 1829glFragColor=vec4(out_color*color.a,color.a); 1830#ifdef PROJECTION_GLOBE_VIEW 1831glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 1832#endif 1833#ifdef RENDER_CUTOFF 1834glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 1835#endif 1836#ifdef OVERDRAW_INSPECTOR 1837glFragColor=vec4(1.0); 1838#endif 1839HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1840uniform 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; 1841#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1842#ifdef GLOBE_POLES 1843in vec3 a_globe_pos;in vec2 a_uv; 1844#else 1845in vec2 a_pos;in vec2 a_texture_pos; 1846#endif 1847out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 1848#ifdef PROJECTION_GLOBE_VIEW 1849out float v_split_fade; 1850#endif 1851void main() {vec2 uv; 1852#ifdef GLOBE_POLES 1853vec3 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; 1854#ifdef FOG 1855v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 1856#endif 1857#else 1858float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; 1859#ifdef PROJECTION_GLOBE_VIEW 1860vec3 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]); 1861v_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];
1861if (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; 1862#ifdef FOG 1863v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1864#endif 1865#else 1866gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1867#ifdef FOG 1868v_fog_pos=fog_position(a_pos); 1869#endif 1870#endif 1871#endif 1872v_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; 1873#ifdef RENDER_CUTOFF 1874v_depth=gl_Position.z; 1875#endif 1876}`),rasterParticle:Ht(`#include "_prelude_fog.fragment.glsl" 1877#include "_prelude_lighting.glsl" 1878uniform 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; 1879#ifdef LIGHTING_3D_MODE 1880out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb; 1881#endif 1882#ifdef FOG 1883highp 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)); 1884#endif 1885glFragColor=vec4(out_color*color.a,color.a); 1886#ifdef OVERDRAW_INSPECTOR 1887glFragColor=vec4(1.0); 1888#endif 1889HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1890uniform 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; 1891#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1892in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 1893#ifdef PROJECTION_GLOBE_VIEW 1894vec3 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; 1895#ifdef FOG 1896v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 1897#endif 1898#else 1899uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 1900#ifdef FOG 1901v_fog_pos=fog_position(a_pos); 1902#endif 1903#endif 1904v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Ht("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" 1905in 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( 1906mod(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:Ht("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:Ht(`#include "_prelude_raster_particle.glsl" 1907uniform 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;
1907vec2 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( 1908linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 1909);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:Ht(`#include "_prelude_lighting.glsl" 1910#include "_prelude_shadow.fragment.glsl" 1911#define SDF_PX 8.0 1912#define SDF 1.0 1913#define ICON 0.0 1914uniform 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; 1915#ifdef ICON_TRANSITION 1916uniform float u_icon_transition; 1917#endif 1918#ifdef COLOR_ADJUSTMENT 1919uniform mat4 u_color_adj_mat; 1920#endif 1921#ifdef INDICATOR_CUTOUT 1922in highp float v_z_offset; 1923#else 1924#ifdef RENDER_SHADOWS 1925in highp float v_z_offset; 1926#endif 1927#endif 1928in vec2 v_tex_a; 1929#ifdef ICON_TRANSITION 1930in vec2 v_tex_b; 1931#endif 1932in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 1933#ifdef RENDER_TEXT_AND_SYMBOL 1934in float is_sdf;in vec2 v_tex_a_icon; 1935#endif 1936#ifdef RENDER_SHADOWS 1937uniform 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; 1938#endif 1939#pragma mapbox: define highp vec4 fill_color 1940#pragma mapbox: define highp vec4 halo_color 1941#pragma mapbox: define lowp float opacity 1942#pragma mapbox: define lowp float halo_width 1943#pragma mapbox: define lowp float halo_blur 1944#pragma mapbox: define lowp float emissive_strength 1945void main() { 1946#pragma mapbox: initialize highp vec4 fill_color 1947#pragma mapbox: initialize highp vec4 halo_color 1948#pragma mapbox: initialize lowp float opacity 1949#pragma mapbox: initialize lowp float halo_width 1950#pragma mapbox: initialize lowp float halo_blur 1951#pragma mapbox: initialize lowp float emissive_strength 1952vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 1953#ifdef RENDER_TEXT_AND_SYMBOL 1954if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; 1955#ifdef OVERDRAW_INSPECTOR 1956glFragColor=vec4(1.0); 1957#endif 1958return;} 1959#endif 1960#ifdef RENDER_SDF 1961float 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; 1962#else 1963#ifdef ICON_TRANSITION 1964vec4 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); 1965#else 1966out_color=texture(u_texture,v_tex_a); 1967#endif 1968#ifdef COLOR_ADJUSTMENT 1969out_color=u_color_adj_mat*out_color; 1970#endif 1971#endif 1972out_color*=opacity*fade_opacity; 1973#ifdef LIGHTING_3D_MODE 1974out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1975#ifdef RENDER_SHADOWS 1976float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1977#ifdef TERRAIN 1978out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1979#else 1980out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1981#endif 1982#endif 1983#endif 1984#ifdef INDICATOR_CUTOUT 1985out_color=applyCutout(out_color,v_z_offset); 1986#endif 1987#ifdef FEATURE_CUTOUT 1988out_color=apply_feature_cutout(out_color,gl_FragCoord); 1989#endif 1990glFragColor=out_color; 1991#ifdef OVERDRAW_INSPECTOR 1992glFragColor=vec4(1.0); 1993#endif 1994HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 1995#include "_prelude_shadow.vertex.glsl" 1996in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 1997#ifdef Z_OFFSET 1998in float a_auto_z_offset; 1999#endif 2000#ifdef PROJECTION_GLOBE_VIEW 2001in vec3 a_globe_anchor;in vec3 a_globe_normal; 2002#endif 2003#ifdef ICON_TRANSITION 2004in vec2 a_texb; 2005#endif 2006#ifdef OCCLUSION_QUERIES 2007in float a_occlusion_query_opacity; 2008#endif 2009#ifdef ELEVATED_ROADS 2010in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; 2011#endif 2012#ifdef INDICATOR_CUTOUT 2013out highp float v_z_offset; 2014#else 2015#ifdef RENDER_SHADOWS 2016out highp float v_z_offset; 2017#endif 2018#endif 2019uniform 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; 2020#ifdef PROJECTION_GLOBE_VIEW 2021uniform 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; 2022#endif 2023out vec2 v_tex_a; 2024#ifdef ICON_TRANSITION 2025out vec2 v_tex_b; 2026#endif 2027out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 2028#ifdef RENDER_TEXT_AND_SYMBOL 2029out float is_sdf;out vec2 v_tex_a_icon; 2030#endif 2031#ifdef RENDER_SHADOWS 2032uniform 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; 2033#endif 2034#pragma mapbox: define highp vec4 fill_color 2035#pragma mapbox: define highp vec4 halo_color 2036#pragma mapbox: define lowp float opacity 2037#pragma mapbox: define lowp float halo_width 2038#pragma mapbox: define lowp float halo_blur 2039#pragma mapbox: define lowp float emissive_strength 2040#pragma mapbox: define lowp float occlusion_opacity 2041#pragma mapbox: define lowp float z_offset 2042void main() { 2043#pragma mapbox: initialize highp vec4 fill_color 2044#pragma mapbox: initialize highp vec4 halo_color 2045#pragma mapbox: initialize lowp float opacity 2046#pragma mapbox: initialize lowp float halo_width 2047#pragma mapbox: initialize lowp float halo_blur 2048#pragma mapbox: initialize lowp float emissive_strength 2049#pragma mapbox: initialize lowp float occlusion_opacity 2050#pragma mapbox: initialize lowp float z_offset 2051vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); 2052#ifdef Z_OFFSET 2053e+=a_auto_z_offset; 2054#endif 2055vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 2056#ifdef PROJECTION_GLOBE_VIEW 2057mercator_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; 2058#else 2059world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 2060#endif 2061vec4 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 ? 2062camera_to_anchor_distance/u_camera_to_center_distance : 2063u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 20640.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; 2065#ifdef PROJECTION_GLOBE_VIEW 2066vec3 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; 2067#else 2068offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 2069#endif 2070vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 2071#ifdef PROJECTION_GLOBE_VIEW 2072#ifdef PROJECTED_POS_ON_VIEWPORT 2073projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 2074#else 2075vec3 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); 2076#endif 2077#else 2078projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 2079#endif 2080highp 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); 2081#ifdef TERRAIN 2082#ifdef PITCH_WITH_MAP_TERRAIN 2083vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 2084#endif 2085#endif 2086#ifdef Z_OFFSET 2087z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; 2088#else 2089z+=u_pitch_with_map ? z_offset : 0.0; 2090#endif 2091float 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)); 2092#ifdef DEPTH_OCCLUSION 2093float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 2094#endif 2095#ifdef OCCLUSION_QUERIES 2096float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 2097#endif 2098float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; 2099#ifdef PROJECTION_GLOBE_VIEW 2100vec3 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; 2101#else 2102#ifdef ELEVATED_ROADS 2103vec3 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; 2104#else 2105pos=vec3(projected_pos.xy/projected_pos.w+offset,z); 2106#endif 2107#endif 2108gl_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; 2109#ifdef RENDER_TEXT_AND_SYMBOL 2110is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 2111#endif 2112#ifdef ICON_TRANSITION 2113v_tex_b=a_texb/u_texsize; 2114#endif 2115#ifdef RENDER_SHADOWS 2116vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; 2117#ifdef NORMAL_OFFSET 2118vec3 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(); 2119#endif 2120v_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; 2121#endif 2122#ifdef INDICATOR_CUTOUT 2123v_z_offset=e; 2124#else 2125#ifdef RENDER_SHADOWS 2126v_z_offset=e; 2127#endif 2128#endif 2129}`),terrainRaster:Ht(`#include "_prelude_fog.fragment.glsl" 2130#include "_prelude_shadow.fragment.glsl" 2131#include "_prelude_lighting.glsl" 2132uniform sampler2D u_image0;in vec2 v_pos0; 2133#ifdef FOG 2134in float v_fog_opacity; 2135#endif 2136#ifdef RENDER_SHADOWS 2137in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 2138#endif 2139uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 2140#ifdef LIGHTING_3D_MODE 2141const vec3 normal=vec3(0.0,0.0,1.0); 2142#ifdef RENDER_SHADOWS 2143float cutoffOpacity=1.0; 2144#ifdef RENDER_CUTOFF 2145cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 2146#endif 2147#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2148vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; 2149#else 2150float 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)); 2151#endif 2152#else 2153float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 2154#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2155color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0; 2156#endif 2157#endif 2158#else 2159color=image_color; 2160#endif 2161#ifdef FOG 2162#ifdef ZERO_EXAGGERATION 2163color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2164#else 2165color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 2166#endif 2167#endif 2168glFragColor=color; 2169#ifdef OVERDRAW_INSPECTOR 2170glFragColor=vec4(1.0); 2171#endif 2172HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2173#include "_prelude_terrain.vertex.glsl" 2174uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; 2175#ifdef FOG 2176out float v_fog_opacity; 2177#endif 2178#ifdef RENDER_SHADOWS 2179uniform 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; 2180#endif 2181void 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); 2182#ifdef FOG 2183#ifdef ZERO_EXAGGERATION 2184v_fog_pos=fog_position(decodedPos); 2185#else 2186v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 2187#endif 2188#endif 2189#ifdef RENDER_SHADOWS 2190vec3 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.); 2191#endif 2192}`),terrainDepth:Ht("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 2193uniform 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:Ht(`#include "_prelude_fog.fragment.glsl" 2194in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_su
2194n_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( 2195cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; 2196#ifdef FOG 2197sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 2198#endif 2199sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 2200#ifdef OVERDRAW_INSPECTOR 2201glFragColor=vec4(1.0); 2202#endif 2203}`,Sh),skyboxGradient:Ht(`#include "_prelude_fog.fragment.glsl" 2204in 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)); 2205#ifdef FOG 2206color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 2207#endif 2208color*=u_opacity;glFragColor=color; 2209#ifdef OVERDRAW_INSPECTOR 2210glFragColor=vec4(1.0); 2211#endif 2212}`,Sh),skyboxCapture:Ht
vendor: 3,792 bytes, lines 2212-2223
2212(` 2213in 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; 2214#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 2215#define BETA_M vec3(21e-6,21e-6,21e-6) 2216#define MIE_G 0.76 2217#define DENSITY_HEIGHT_SCALE_R 8000.0 2218#define DENSITY_HEIGHT_SCALE_M 1200.0 2219#define PLANET_RADIUS 6360e3 2220#define ATMOSPHERE_RADIUS 6420e3 2221#define SAMPLE_STEPS 10 2222#define DENSITY_STEPS 4 2223float 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
2223Raster:Ht(`#include "_prelude_fog.fragment.glsl" 2224#include "_prelude_lighting.glsl" 2225uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0; 2226#ifndef FOG 2227uniform 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; 2228#endif 2229void main() {vec4 color; 2230#ifdef CUSTOM_ANTIALIASING 2231highp vec2 uv=gl_FragCoord.xy/u_viewport; 2232#ifdef FLIP_Y 2233uv.y=1.0-uv.y; 2234#endif 2235highp vec3 ray_dir=mix( 2236mix(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); 2237#ifdef LIGHTING_3D_MODE 2238#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2239raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); 2240#else 2241raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 2242#endif 2243#else 2244color=vec4(raster.rgb*antialias,raster.a*antialias); 2245#endif 2246#else 2247color=texture(u_image0,v_pos0); 2248#ifdef LIGHTING_3D_MODE 2249#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2250color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0; 2251#else 2252color=apply_lighting_ground(color); 2253#endif 2254#endif 2255#endif 2256#ifdef FOG 2257color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2258#endif 2259color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 2260#ifdef OVERDRAW_INSPECTOR 2261glFragColor=vec4(1.0); 2262#endif 2263HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2264#include "_prelude_terrain.vertex.glsl" 2265uniform 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; 2266#ifdef GLOBE_POLES 2267in vec3 a_globe_pos;in vec2 a_uv; 2268#else 2269in vec2 a_pos; 2270#endif 2271out vec2 v_pos0;void main() { 2272#ifdef GLOBE_POLES 2273vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 2274#else 2275float 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); 2276#endif 2277v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 2278#ifdef GLOBE_POLES 2279vec3 up_vector=globe_derived_up_vector; 2280#else 2281vec3 up_vector=elevationVector(tile_pos); 2282#endif 2283float height=elevation(tile_pos);globe_pos+=up_vector*height; 2284#ifndef GLOBE_POLES 2285globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 2286#endif 2287#ifdef GLOBE_POLES 2288vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 2289#else 2290vec4 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); 2291#endif 2292gl_Position=u_proj_matrix*interpolated_pos; 2293#ifdef FOG 2294v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2295#endif 2296}`),globeAtmosphere:Ht(`#include "_prelude_fog.fragment.glsl" 2297uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; 2298#ifdef PROJECTION_GLOBE_VIEW 2299globe_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) { 2300#ifdef ALPHA_PASS 2301glFragColor=vec4(0,0,0,0);return; 2302#else 2303#ifdef NATIVE 2304glFragColor=vec4(1,1,1,1); 2305#else 2306glFragColor=vec4(0,0,0,1); 2307#endif 2308return; 2309#endif 2310} 2311#endif 2312highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 23130.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 2314#ifdef PROJECTION_GLOBE_VIEW 2315highp 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 ? 2316PI-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); 2317#else 2318horizon_angle=horizon_angle_mercator; 2319#endif 2320horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2320vec3 color_stop_2=u_space_color.rgb; 2321#ifdef ALPHA_PASS 2322float 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); 2323#else 2324vec3 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); 2325#endif 2326}`,`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( 2327mix(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( 2328mix(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:Ht(`#include "_prelude_fog.fragment.glsl" 2329#include "_prelude_shadow.fragment.glsl" 2330#include "_prelude_lighting.glsl" 2331uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; 2332#ifdef RENDER_SHADOWS 2333in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 2334#endif 2335#ifdef OCCLUSION_TEXTURE_TRANSFORM 2336uniform vec4 u_occlusionTextureTransform; 2337#endif 2338#pragma mapbox: define-attribute highp vec3 normal_3f 2339#pragma mapbox: define-attribute highp vec3 color_3f 2340#pragma mapbox: define-attribute highp vec4 color_4f 2341#pragma mapbox: define-attribute highp vec2 uv_2f 2342#pragma mapbox: initialize-attribute highp vec3 normal_3f 2343#pragma mapbox: initialize-attribute highp vec3 color_3f 2344#pragma mapbox: initialize-attribute highp vec4 color_4f 2345#pragma mapbox: initialize-attribute highp vec2 uv_2f 2346#ifdef HAS_ATTRIBUTE_a_pbr 2347in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 2348#endif 2349#ifdef HAS_TEXTURE_u_baseColorTexture 2350uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 2351#endif 2352#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 2353uniform sampler2D u_metallicRoughnessTexture; 2354#endif 2355#ifdef HAS_TEXTURE_u_occlusionTexture 2356uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 2357#endif 2358#ifdef HAS_TEXTURE_u_normalTexture 2359uniform sampler2D u_normalTexture; 2360#endif 2361#ifdef HAS_TEXTURE_u_emissionTexture 2362uniform sampler2D u_emissionTexture; 2363#endif 2364#ifdef APPLY_LUT_ON_GPU 2365uniform highp sampler3D u_lutTexture; 2366#endif 2367#ifdef TERRAIN_FRAGMENT_OCCLUSION 2368in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 2369#ifdef DEPTH_D24 2370highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 2371#else 2372highp float unpack_depth_rgba(highp vec4 rgba_depth) 2373{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;} 2374#endif 2375bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 2376#ifdef DEPTH_D24 2377highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 2378#else 2379highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 2380#endif 2381return v_depth > depth+0.0005;} 2382#endif 2383#define saturate(_x) clamp(_x,0.,1.) 2384vec3 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) 2385{ 2386#ifdef LIGHTING_3D_MODE 2387vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 2388#ifdef RENDER_SHADOWS 2389lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2390#else 2391lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 2392#endif 2393return apply_lighting(albedo,transformed_normal,lighting_factor); 2394#else 2395vec3 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
2395Color),vec3(1.0));return c3; 2396#endif 2397}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 2398#ifdef HAS_ATTRIBUTE_a_color_3f 2399albedo*=vec4(color_3f,1.0); 2400#endif 2401#ifdef HAS_ATTRIBUTE_a_pbr 2402#else 2403#ifdef HAS_ATTRIBUTE_a_color_4f 2404albedo*=color_4f; 2405#endif 2406#endif 2407#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 2408vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 2409#ifdef UNPREMULT_TEXTURE_IN_SHADER 2410if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; 2411#endif 2412if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 2413#endif 2414vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 2415#ifdef APPLY_LUT_ON_GPU 2416color=applyLUT(u_lutTexture,color); 2417#endif 2418return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 2419#ifdef HAS_TEXTURE_u_normalTexture 2420highp 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; 2421#ifdef FLIP_Y 2422T=-T;B=-B; 2423#endif 2424highp 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; 2425#else 2426return mat3(1.0); 2427#endif 2428}highp vec3 getNormal(){highp vec3 n; 2429#ifdef HAS_ATTRIBUTE_a_normal_3f 2430n=normalize(normal_3f); 2431#else 2432highp 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)); 2433#ifdef FLIP_Y 2434n=normalize(cross(fdx,fdy)); 2435#else 2436n=normalize(cross(fdx,fdy))*-1.0; 2437#endif 2438#endif 2439#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2440vec3 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); 2441#endif 2442return 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; 2443#ifdef HAS_ATTRIBUTE_a_pbr 2444mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 2445#endif 2446#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2447vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 2448#endif 2449const 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) 2450{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) 2451{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 2452{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) 2453{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) 2454{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) 2455{ 2456#ifdef LIGHTING_3D_MODE 2457return mat.diffuseColor; 2458#else 2459return mat.diffuseColor/PI; 2460#endif 2461}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 2462{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) 2463{vec3 env_light=vec3(0.65,0.65,0.65); 2464#ifdef LIGHTING_3D_MODE 2465float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 2466#endif 2467vec3 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) 2468{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; 2469#ifdef RENDER_SHADOWS 2470lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2471#else 2472lighting_factor=NdotL; 2473#endif 2474vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2474Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 2475#if !defined(LIGHTING_3D_MODE) 2476const 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); 2477#endif 2478color*=intensityFactor;return color;}void main() { 2479#ifdef TERRAIN_FRAGMENT_OCCLUSION 2480if (isOccluded()) {discard;} 2481#endif 2482vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 2483#ifdef LIGHTING_3D_MODE 2484lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 2485#endif 2486vec4 finalColor; 2487#ifdef DIFFUSE_SHADED 2488vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 2489#ifdef HAS_TEXTURE_u_occlusionTexture 2490float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 2491#endif 2492finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 2493#else 2494Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 2495#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2496#ifdef OCCLUSION_TEXTURE_TRANSFORM 2497vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 2498#else 2499vec2 uv=uv_2f; 2500#endif 2501ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 2502#endif 2503vec4 emissive=u_emissiveFactor; 2504#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2505emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 2506#endif 2507#ifdef APPLY_LUT_ON_GPU 2508float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 2509#endif 2510color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 2511#ifdef HAS_ATTRIBUTE_a_pbr 2512float 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; 2513#ifdef APPLY_LUT_ON_GPU 2514color_mix=applyLUT(u_lutTexture,color_mix); 2515#endif 2516color=mix(color,color_mix,min(1.0,resEmission)); 2517#ifdef HAS_ATTRIBUTE_a_color_4f 2518float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2518y));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); 2519#endif 2520#endif 2521vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 2522#endif 2523#ifdef FOG 2524finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 2525#endif 2526#ifdef RENDER_CUTOFF 2527finalColor*=v_cutoff_opacity; 2528#endif 2529#ifdef INDICATOR_CUTOUT 2530finalColor=applyCutout(finalColor,v_position_height.w); 2531#endif 2532#ifdef FEATURE_CUTOUT 2533finalColor=apply_feature_cutout(finalColor,gl_FragCoord); 2534#endif 2535glFragColor=finalColor; 2536#ifdef OVERDRAW_INSPECTOR 2537glFragColor=vec4(1.0); 2538#endif 2539HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2540#include "_prelude_shadow.vertex.glsl" 2541in vec3 a_pos_3f; 2542#pragma mapbox: define-attribute highp vec3 normal_3f 2543#pragma mapbox: define-attribute highp vec2 uv_2f 2544#pragma mapbox: define-attribute highp vec3 color_3f 2545#pragma mapbox: define-attribute highp vec4 color_4f 2546#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr 2547#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 2548uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 2549#ifdef INSTANCED_ARRAYS 2550in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2551#else 2552uniform highp mat4 u_normal_matrix; 2553#endif 2554#ifdef RENDER_SHADOWS 2555uniform 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; 2556#endif 2557out vec4 v_position_height;out lowp vec4 v_color_mix; 2558#ifdef TERRAIN_FRAGMENT_OCCLUSION 2559out highp float v_depth; 2560#endif 2561#ifdef HAS_ATTRIBUTE_a_pbr 2562out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 2563#endif 2564vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 2565#pragma mapbox: initialize-attribute highp vec3 normal_3f 2566#pragma mapbox: initialize-attribute highp vec2 uv_2f 2567#pragma mapbox: initialize-attribute highp vec3 color_3f 2568#pragma mapbox: initialize-attribute highp vec4 color_4f 2569#pragma mapbox: initialize-attribute-custom highp vec4 pbr 2570#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 2571highp mat4 normal_matrix; 2572#ifdef INSTANCED_ARRAYS 2573normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2574#else 2575normal_matrix=u_normal_matrix; 2576#endif 2577vec3 local_pos;mat3 rs; 2578#ifdef MODEL_POSITION_ON_GPU 2579vec3 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; 2580#else 2581local_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); 2582#endif 2583v_position_height.w=a_pos_3f.z; 2584#ifdef HAS_ATTRIBUTE_a_pbr 2585vec4 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; 2586#endif 2587#ifdef FOG 2588v_fog_pos=fog_position(local_pos); 2589#endif 2590#ifdef RENDER_CUTOFF 2591v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2592#endif 2593#ifdef TERRAIN_FRAGMENT_OCCLUSION 2594v_depth=gl_Position.z/gl_Position.w; 2595#endif 2596#ifdef HAS_ATTRIBUTE_a_normal_3f 2597#ifdef MODEL_POSITION_ON_GPU 2598float 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); 2599#else
2600normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 2601#endif 2602#endif 2603#ifdef HAS_ATTRIBUTE_a_pbr 2604#ifdef HAS_ATTRIBUTE_a_color_4f 2605v_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); 2606#endif 2607#endif 2608#ifdef RENDER_SHADOWS 2609vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 2610#ifdef NORMAL_OFFSET 2611#ifdef HAS_ATTRIBUTE_a_normal_3f 2612#ifdef MODEL_POSITION_ON_GPU 2613vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2614#else 2615vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2616#endif 2617#endif 2618#endif 2619v_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; 2620#endif 2621}`),modelDepth:Ht(`in highp float v_depth;void main() { 2622#ifndef DEPTH_TEXTURE 2623glFragColor=pack_depth(v_depth); 2624#endif 2625}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; 2626#ifdef MODEL_POSITION_ON_GPU 2627#ifdef INSTANCED_ARRAYS 2628in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2629#else 2630uniform highp mat4 u_instance; 2631#endif 2632uniform highp mat4 u_node_matrix; 2633#endif 2634void main() { 2635#ifdef MODEL_POSITION_ON_GPU 2636highp mat4 instance; 2637#ifdef INSTANCED_ARRAYS 2638instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2639#else 2640instance=u_instance; 2641#endif 2642vec3 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;
2642rs[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); 2643#else 2644gl_Position=u_matrix*vec4(a_pos_3f,1); 2645#endif 2646v_depth=gl_Position.z/gl_Position.w;}`),stars:Ht(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2647{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;}`,` 2648in 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:Ht("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;}",` 2649in 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; 2650uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 2651uniform float u_horizontalOscillationRate; 2652uniform 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+ 2653localY*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:Ht("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;}",` 2654in 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; 2655uniform float u_velocity; 2656uniform 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;
2656pos*=halfBoxSize; 2657pos+=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+ 2658localY*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:Ht("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:Ht("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" 2659in 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; 2660#ifdef TERRAIN 2661float e=elevation(world_pos.xy);world_pos.z+=e; 2662#endif 2663vec4 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 Zn(l,t){const n=l.replace(/\s*\/\/[^\n]*\n/g,` 2664`).split(` 2665`);for(let c of n)if(c=c.trim(),c[0]==="#"&&c.includes("if")&&!c.includes("endif")){c=c.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const d=c.split(" ");for(const f of d)t.includes(f)||t.push(f)}}function Ht(l,t){const n=/#include\s+"([^"]+)"/g,c=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let d=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);d&&(d=d.map((T=>{const S=T.split(" ");return S[S.length-1]})),d=[...new Set(d)]);const f={},m=[],y=[];if(l=l.replace(n,((T,S)=>(y.push(S),""))),(t=t.replace(n,((T,S)=>(m.push(S),"")))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let x=[...fl];Zn(l,x),Zn(t,x);for(const T of[...m,...y])To[T]||console.error(`Undefined include: ${T}`),Vn[T]||(Vn[T]=[],Zn(To[T],Vn[T])),x=[...x,...Vn[T]];return{fragmentSource:l=l.replace(c,((T,S,M,E,C)=>(f[C]=!0,S==="define"?` 2666#ifndef HAS_UNIFORM_u_${C} 2667in ${M} ${E} ${C}; 2668#else 2669uniform ${M} ${E} u_${C}; 2670#endif 2671`:S==="initialize"?` 2672#ifdef HAS_UNIFORM_u_${C} 2673 ${M} ${E} ${C} = u_${C}; 2674#endif 2675`:S==="define-attribute"?` 2676#ifdef HAS_ATTRIBUTE_a_${C} 2677 in ${M} ${E} ${C}; 2678#endif 2679`:S==="initialize-attribute"?"":void 0))),vertexSource:t=t.replace(c,((T,S,M,E,C)=>{const D=E==="float"?"vec2":E,z=C.match(/color/)?"color":D;return S==="define-attribute-vertex-shader-only"?` 2680#ifdef HAS_ATTRIBUTE_a_${C} 2681in ${M} ${E} a_${C}; 2682#endif 2683`:f[C]?S==="define"?` 2684#ifndef HAS_UNIFORM_u_${C} 2685uniform lowp float u_${C}_t; 2686in ${M} ${D} a_${C}; 2687out ${M} ${E} ${C}; 2688#else 2689uniform ${M} ${E} u_${C}; 2690#endif 2691`:S==="initialize"?z==="vec4"?` 2692#ifndef HAS_UNIFORM_u_${C} 2693 ${C} = a_${C}; 2694#else 2695 ${M} ${E} ${C} = u_${C}; 2696#endif 2697`:` 2698#ifndef HAS_UNIFORM_u_${C} 2699 ${C} = unpack_mix_${z}(a_${C}, u_${C}_t); 2700#else 2701 ${M} ${E} ${C} = u_${C}; 2702#endif 2703`:S==="define-attribute"?` 2704#ifdef HAS_ATTRIBUTE_a_${C} 2705 in ${M} ${E} a_${C}; 2706 out ${M} ${E} ${C}; 2707#endif 2708`:S==="initialize-attribute"?` 2709#ifdef HAS_ATTRIBUTE_a_${C} 2710 ${C} = a_${C}; 2711#endif 2712`:void 0:S==="define"?` 2713#ifndef HAS_UNIFORM_u_${C} 2714uniform lowp float u_${C}_t; 2715in ${M} ${D} a_${C}; 2716#else 2717uniform ${M} ${E} u_${C}; 2718#endif 2719`:S==="define-instanced"?z==="mat4"?` 2720#ifdef INSTANCED_ARRAYS 2721in vec4 a_${C}0; 2722in vec4 a_${C}1; 2723in vec4 a_${C}2; 2724in vec4 a_${C}3; 2725#else 2726uniform ${M} ${E} u_${C}; 2727#endif 2728`:` 2729#ifdef INSTANCED_ARRAYS 2730in ${M} ${D} a_${C}; 2731#else 2732uniform ${M} ${E} u_${C}; 2733#endif 2734`:S==="initialize-attribute-custom"?` 2735#ifdef HAS_ATTRIBUTE_a_${C} 2736 ${M} ${E} ${C} = a_${C}; 2737#endif 2738`:z==="vec4"?` 2739#ifndef HAS_UNIFORM_u_${C} 2740 ${M} ${E} ${C} = a_${C}; 2741#else 2742 ${M} ${E} ${C} = u_${C}; 2743#endif 2744`:` 2745#ifndef HAS_UNIFORM_u_${C} 2746 ${M} ${E} ${C} = unpack_mix_${z}(a_${C}, u_${C}_t); 2747#else 2748 ${M} ${E} ${C} = u_${C}; 2749#endif 2750`})),staticAttributes:d,usedDefines:x,vertexIncludes:m,fragmentIncludes:y}}class xp{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,n,c,d,f,m,y,x){this.context=t;let T=this.boundPaintVertexBuffers.length!==d.length;for(let M=0;!T&&M<d.length;M++)this.boundPaintVertexBuffers[M]!==d[M]&&(T=!0);let S=this.boundDynamicVertexBuffers.length!==y.length;for(let M=0;!S&&M<y.length;M++)this.boundDynamicVertexBuffers[M]!==y[M]&&(S=!0);if(!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==c||T||S||this.boundIndexBuffer!==f||this.boundVertexOffset!==m)this.freshBind(n,c,d,f,m,y,x);else{t.bindVertexArrayOES.set(this.vao);for(const M of y)M&&(M.bind(),x&&M.instanceCount&&M.setVertexAttribDivisor(t.gl,n,x));f&&f.dynamicDraw&&f.bind()}}
vendor: 30,145 bytes, lines 2750-2751
2750freshBind(t,n,c,d,f,m,y){const x=t.numAttributes,T=this.context,S=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=f,this.boundDynamicVertexBuffers=m,n.enableAttributes(S,t),n.bind(),n.setVertexAttribPointers(S,t,f);for(const M of c)M.enableAttributes(S,t),M.bind(),M.setVertexAttribPointers(S,t,f);for(const M of m)M&&(M.enableAttributes(S,t),M.bind(),M.setVertexAttribPointers(S,t,f),y&&M.instanceCount&&M.setVertexAttribDivisor(S,t,y));d&&d.bind(),T.currentNumAttributes=x}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Ih(l,t){const n=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new o.ac(0,c/n).toLngLat().lat,new o.ac(0,(c+1)/n).toLngLat().lat]}function vp(l,t,n,c,d,f,m){const y=l.context,x=y.gl,T=n.hillshadeFBO;if(!T)return;l.prepareDrawTile();const S=l.isTileAffectedByFog(t),M=l.getOrCreateProgram("hillshade",{overrideFog:S});y.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,T.colorAttachment.get());const E=((F,L,N,j)=>{const q=N.paint.get("hillshade-shadow-color"),X=N.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ee=N.paint.get("hillshade-highlight-color"),ie=N.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",Y=N.paint.get("hillshade-accent-color"),K=N.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",J=N.paint.get("hillshade-emissive-strength");let pe=o.al(N.paint.get("hillshade-illumination-direction"));if(N.paint.get("hillshade-illumination-anchor")==="viewport")pe-=F.transform.angle;else if(F.style&&F.style.enable3dLights()&&F.style.directionalLight){const Ie=F.style.directionalLight.properties.get("direction"),xe=o.d1(Ie.x,Ie.y,Ie.z);pe=o.al(xe[1])}const oe=!F.options.moving;return{u_matrix:j||F.transform.calculateProjMatrix(L.tileID.toUnwrapped(),oe),u_image:0,u_latrange:Ih(0,L.tileID),u_light:[N.paint.get("hillshade-exaggeration"),pe],u_shadow:q.toPremultipliedRenderColor(X?null:N.lut),u_highlight:ee.toPremultipliedRenderColor(ie?null:N.lut),u_emissive_strength:J,u_accent:Y.toPremultipliedRenderColor(K?null:N.lut)}})(l,n,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(y,M,t.toUnwrapped());const{tileBoundsBuffer:C,tileBoundsIndexBuffer:D,tileBoundsSegments:z}=l.getTileBoundsBuffers(n);M.draw(l,x.TRIANGLES,d,f,m,mt.disabled,E,c.id,C,D,z)}function Ah(l,t,n){if(!t.needsDEMTextureUpload)return;const c=l.context,d=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(n.stride);const f=n.getPixels();t.demTexture?t.demTexture.update(f,{premultiply:!1}):t.demTexture=new o.T(c,f,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function Ed(l,t,n){const c=l.context,d=c.gl;if(!t.dem)return;const f=t.dem;if(c.activeTexture.set(d.TEXTURE1),Ah(l,t,f),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=f.dim;c.activeTexture.set(d.TEXTURE0);let y=t.hillshadeFBO;if(!y){const E=new o.T(c,{width:m,height:m,data:null},d.RGBA8);E.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=t.hillshadeFBO=c.createFramebuffer(m,m,!0,"renderbuffer"),y.colorAttachment.set(E.texture)}c.bindFramebuffer.set(y.framebuffer),c.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=l.getMercatorTileBoundsBuffers(),M=[];l.linearFloatFilteringSupported()&&M.push("TERRAIN_DEM_FLOAT_FORMAT"),l.getOrCreateProgram("hillshadePrepare",{defines:M}).draw(l,d.TRIANGLES,it.disabled,xt.disabled,Pt.unblended,mt.disabled,((E,C)=>{const D=C.stride,z=o.bz();return o.ca(z,0,o.aj,-o.aj,0,0,1),o.bo(z,z,[0,-o.aj,0]),{u_matrix:z,u_image:1,u_dimension:[D,D],u_zoom:E.overscaledZ}})(t.tileID,f),n.id,x,T,S),t.needsHillshadePrepare=!1}class Oi{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 bp extends Oi{getDefault(){return o.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class wp extends Oi{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Tp extends Oi{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Sp extends Oi{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Id extends Oi{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Ep extends Oi{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class lc extends Oi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Ip extends Oi{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Ad extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Mh extends Oi{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class cc extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Ch extends Oi{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class So extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class na extends Oi{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class hc extends Oi{getDefault(){return o.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class uc extends Oi{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 sa extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Md extends Oi{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ph extends Oi{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Cd=class extends Oi{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class oa extends Oi{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class dc extends Oi{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class fc extends Oi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class zh extends Oi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class pc extends Oi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class ml extends Oi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Pd extends Oi{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class zd extends Oi{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Rd extends Oi{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class aa extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Dd extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Rh extends Oi{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Ap extends Rh{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ld extends Rh{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,this.attachment(),n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Dh extends Rh{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,this.attachment(),n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Lh extends Ld{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Fh=(l,t,n)=>({u_matrix:l,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:n}),mc=(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:n,u_zoom_transition:d,u_merc_center:f,u_image0:0,u_frustum_tl:m,u_frustum_tr:y,u_frustum_br:x,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:M,u_viewport:E,u_grid_matrix:z?Float32Array.from(z):new Float32Array(9),u_skirt_height:C,u_far_z_cutoff:D});function Oh(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const Eo=new class{constructor(){this.operations={}}newMorphing(l,t,n,c,d){if(l in this.operations){const f=this.operations[l];f.to.tileID.key!==n.tileID.key&&(f.queued=n)}else this.operations[l]={startTime:c,phase:0,duration:d,from:t,to:n,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 n=this.operations[t];for(n.phase=(l-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,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()}},Fd={0:null,1:"TERRAIN_VERTEX_MORPHING"};function la(l,t,n){if(t===0)return 0;const c=t<1&&n===514?.25/t:1;return 6*Math.pow(1.5,22-l)*Math.max(t,1)*c}function _l(l,t){const n=1<<l.z;return!t&&(l.x===0||l.x===n-1)||l.y===0||l.y===n-1}const _c=l=>({u_matrix:l});function on(l,t,n,c,d){if(d>0){const f=o.q.now(),m=(f-l.timeAdded)/d,y=t?(f-t.timeAdded)/d:-1,x=n.getSource(),T=c.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),S=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),M=S&&l.refreshedUponExpiration?1:o.ay(S?m:1-y,0,1);return l.refreshedUponExpiration&&m>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-M}:{opacity:M,mix:0}}return{opacity:1,mix:0}}class kh extends nn{constructor(t){const n=$a("mock-dem",{type:"raster-dem",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,n){t.state="loaded",n(null)}}class gc extends nn{constructor(t){const n=$a("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("proxy",n,!1),n.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,n,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(((f,m)=>{if(f[m.key]="",!this._tiles[m.key]){const y=new mo(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[m.key]=y}return f}),{});for(const f in this._tiles)f in d||(this.freeFBO(f),this._tiles[f].unloadVectorData(),delete this._tiles[f])}freeFBO(t){const n=this.proxyCachedFBO[t];if(n!==void 0){const c=Object.values(n);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach((t=>t.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class gl extends o.aM{constructor(t,n,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=n,this.projMatrix=c}}class yc extends o.dF{constructor(t,n){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",(()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()})),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,f]=(function(x){const T=new o.ba,S=new o.a_,M=131;T.reserve(17161),S.reserve(33800);const E=o.aj/128,C=o.aj+E/2,D=C+E;for(let F=-E;F<D;F+=E)for(let L=-E;L<D;L+=E){const N=L<0||L>C||F<0||F>C?24575:0,j=o.ay(Math.round(L),0,o.aj),q=o.ay(Math.round(F),0,o.aj);T.emplaceBack(j+N,q)}const z=(F,L)=>{const N=L*M+F;S.emplaceBack(N+1,N,N+M),S.emplaceBack(N+M,N+M+1,N+1)};for(let F=1;F<129;F++)for(let L=1;L<129;L++)z(L,F);return[0,129].forEach((F=>{for(let L=0;L<130;L++)z(L,F),z(F,L)})),[T,S,32768]})(),m=t.context;this.gridBuffer=m.createVertexBuffer(c,o.bc.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=o.bd.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=o.bd.simpleSegment(0,0,c.length,f),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new gc(n.map),this.orthoMatrix=o.bz(),o.ca(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,o.aj,0,o.aj,0,1);const y=m.gl;this._overlapStencilMode=new xt({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=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new kh(n.map),this._pendingGroundEffectLayers=[]}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,n,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,f=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=o.q.now();const y=t.terrain&&t.terrain.scope,x=d.get("source"),T=f?this._mockSourceCache:t.getSourceCache(x,y);if(!T)return void o.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=T,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=m?this.calculateExaggeration(n):d.get("exaggeration"),!n.projection.requiresDraping&&m&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&o.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 2751This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const M=this.getScaledDemTileSize();this.sourceCache.update(n,M,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,S(),this._initializing=!0),S(),n.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0,this._previousZoom=n.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const n=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const d=n!=null?c-n:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const f=t.zoom,m=this._style.terrain;if(!this._previousUpdateTimestamp)return m.getExaggeration(f);let y=f-this._previousZoom;const x=this._previousUpdateTimestamp;let T=f;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(f-T)>.5&&(y=.5*(f-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const S=m.getExaggeration(T),M=S===m.getExaggeration(Math.max(0,T-.1));if(M&&Math.abs(S-this._exaggeration)<.01)return S;let E=Math.min(.1,.00375*(this._updateTimestamp-x));return(M||S<.1||Math.abs(y)<1e-4)&&(E=Math.min(.2,4*E)),o.ai(this._exaggeration,S,E)}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.coord&&t.dataType==="source"?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 n=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(o.ac.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=n.getIds().map((x=>{const T=n.getTileByID(x).tileID;return T.projMatrix=c.calculateProjMatrix(T.toUnwrapped()),T}));(function(x,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),M=new o.P(S.x,S.y);x.sort(((E,C)=>{if(C.overscaledZ-E.overscaledZ)return C.overscaledZ-E.overscaledZ;const D=new o.P(E.canonical.x+(1<<E.canonical.z)*E.wrap,E.canonical.y),z=new o.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),F=M.mult(1<<E.canonical.z);return F.x-=.5,F.y-=.5,F.distSqr(D)-F.distSqr(z)}))})(d,this.painter);const f=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],f),T.usedForTerrain))continue;const S=t[x];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[n.id]=d.map((x=>new gl(x,x.key,this.orthoMatrix))),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(f),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const T=this.terrainTileForTile[x.key];if(!T)continue;const S=T.tileID.key;S in y||(this._visibleDemTiles.push(T),y[S]=S)}}_assignTerrainTiles(t){this._initializing||t.forEach((n=>{if(this.terrainTileForTile[n.key])return;const c=this._findTileCoveringTileID(n,this.sourceCache);c&&(this.terrainTileForTile[n.key]=c)}))}_prepareDEMTextures(){const t=this.painter.context,n=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],f=d.dem;!f||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(n.TEXTURE1),Ah(this.painter,d,f))}}_prepareDemTileUniforms(t,n,c,d){if(!n||n.demTexture==null)return!1;const f=t.tileID.canonical,m=Math.pow(2,n.tileID.canonical.z-f.z),y=d||"";return c[`u_dem_tl${y}`]=[f.x*m%1,f.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 n=this._visibleDemTiles.reduce(((c,d)=>{if(!d.dem)return c;const f=d.dem.tree.minimums[0];return f>0&&t++,c+f}),0);return t?n/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,n=t.gl;t.activeTexture.set(n.TEXTURE2);const c=this._getLoadedAreaMinimum(),d=new o.dG({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let f=this._emptyDEMTexture;return f?f.update(d,{premultiply:!1}):f=this._emptyDEMTexture=new o.T(t,d,n.R32F,{premultiply:!1}),f}setupElevationDraw(t,n,c){const d=this.painter.context,f=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 C=c.morphing.srcDemTile,D=c.morphing.dstDemTile;T=c.morphing.phase,C&&D&&(this._prepareDemTileUniforms(t,C,m,"_prev")&&(x=C),this._prepareDemTileUniforms(t,D,m)&&(y=D))}const S=C=>C&&C.demTexture&&this.painter.linearFloatFilteringSupported()?f.LINEAR:f.NEAREST;let M=null;var E;if(this.enabled?x&&y?(M=y.demTexture,d.activeTexture.set(f.TEXTURE4),x.demTexture.bind(S(x),f.CLAMP_TO_EDGE),m.u_dem_lerp=T):(y=this.terrainTileForTile[t.tileID.key],M=this._prepareDemTileUniforms(t,y,m)?y.demTexture:this.emptyDEMTexture):M=this.emptyDEMTexture,d.activeTexture.set(f.TEXTURE2),M&&(m.u_dem_size=(E=M).size[0]===1?1:E.size[0]-2,M.bind(S(y),f.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,n,m),c&&c.useMeterToDem&&y){const C=(1<<y.tileID.canonical.z)*o.cb(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;m.u_meter_to_dem=C}if(c&&c.labelPlaneMatrixInv&&(m.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),n.setTerrainUniformValues(d,m),this.painter.transform.projection.name==="globe"){const C=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);n.setGlobeUniformValues(d,C)}}globeUniformValues(t,n,c){const d=t.projection;return{u_tile_tl_up:d.upVector(n,0,0),u_tile_tr_up:d.upVector(n,o.aj,0),u_tile_br_up:d.upVector(n,o.aj,o.aj),u_tile_bl_up:d.upVector(n,0,o.aj),u_tile_up_scale:c?o.dH(1):d.upVectorScale(n,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const n=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),n.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,(function(d,f,m,y,x){if(d.transform.projection.name==="globe")(function(T,S,M,E,C){const D=T.context,z=D.gl;let F,L;const N=T.transform,j=o.dy(T,D,N),q=(Ie,xe)=>{if(L===xe)return;const Me=[Fd[xe],"PROJECTION_GLOBE_VIEW"];j&&Me.push("CUSTOM_ANTIALIASING");const Ue=T.isTileAffectedByFog(Ie);F=T.getOrCreateProgram("globeRaster",{defines:Me,overrideFog:Ue}),L=xe},X=T.colorModeForRenderPass(),ee=new it(z.LEQUAL,it.ReadWrite,T.depthRangeFor3D);Eo.update(C);const ie=o.dz(N),Y=[o.aD(N.center.lng),o.aH(N.center.lat)],K=T.globeSharedBuffers,J=[N.width*o.q.devicePixelRatio,N.height*o.q.devicePixelRatio],pe=Float32Array.from(N.globeMatrix),oe={useDenormalizedUpVectorScale:!0};{const Ie=T.transform,xe=la(Ie.zoom,S.exaggeration(),S.sourceCache._source.tileSize);L=-1;const Me=z.TRIANGLES;for(const Ue of E){const me=M.getTile(Ue),se=xt.disabled,we=S.prevTerrainTileForTile[Ue.key],_e=S.terrainTileForTile[Ue.key];Oh(we,_e)&&Eo.newMorphing(Ue.key,we,_e,C,250),D.activeTexture.set(z.TEXTURE0),me.texture&&me.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const ze=Eo.getMorphValuesForProxy(Ue.key),Re=ze?1:0;ze&&o.L(oe,{morphing:{srcDemTile:ze.from,dstDemTile:ze.to,phase:o.dx(ze.phase)}});const Le=o.dA(Ue.canonical),Ze=o.dB(Le.getCenter().lat),at=o.dC(Ue.canonical,Le,Ze,Ie.worldSize/Ie._pixelsPerMercatorPixel),dt=o.bh(o.dD(Ue.canonical)),Qe=mc(Ie.expandedFarZProjMatrix,pe,ie,dt,o.ah(Ie.zoom),Y,Ie.frustumCorners.TL,Ie.frustumCorners.TR,Ie.frustumCorners.BR,Ie.frustumCorners.BL,Ie.globeCenterInViewSpace,Ie.globeRadius,J,xe,Ie._farZ,at);if(q(Ue,Re),F&&(S.setupElevationDraw(me,F,oe),T.uploadCommonUniforms(D,F,Ue.toUnwrapped()),K)){const[ht,lt,wt]=K.getGridBuffers(Ze,xe!==0);F.draw(T,Me,ee,se,X,mt.backCCW,Qe,"globe_raster",ht,lt,wt)}}}if(K&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const Ie=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];j&&Ie.push("CUSTOM_ANTIALIASING"),F=T.getOrCreateProgram("globeRaster",{defines:Ie});for(const xe of E){const{x:Me,y:Ue,z:me}=xe.canonical,se=Ue===0,we=Ue===(1<<me)-1,[_e,ze,Re,Le]=K.getPoleBuffers(me,!1);if(Le&&(se||we)){const Ze=M.getTile(xe);D.activeTexture.set(z.TEXTURE0),Ze.texture&&Ze.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);let at=o.dE(me,Me,N);const dt=o.bh(o.dD(xe.canonical)),Qe=(ht,lt)=>ht.draw(T,z.TRIANGLES,ee,xt.disabled,X,mt.disabled,mc(N.expandedFarZProjMatrix,at,at,dt,0,Y,N.frustumCorners.TL,N.frustumCorners.TR,N.frustumCorners.BR,N.frustumCorners.BL,N.globeCenterInViewSpace,N.globeRadius,J,0,N._farZ),"globe_pole_raster",lt,Re,Le);S.setupElevationDraw(Ze,F,oe),T.uploadCommonUniforms(D,F,xe.toUnwrapped()),se&&T.renderDefaultNorthPole&&Qe(F,_e),we&&T.renderDefaultSouthPole&&(at=o.cP(o.bz(),at,[1,-1,1]),Qe(F,ze))}}}})(d,f,m,y,x);else{const T=d.context,S=T.gl;let M,E;const C=d.shadowRenderer,D=Qn(d,d.longestCutoffRange),z=X=>{if(E===X)return;const ee=[];ee.push(Fd[X]),D.shouldRenderCutoff&&ee.push("RENDER_CUTOFF"),C&&(ee.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&ee.push("NORMAL_OFFSET")),M=d.getOrCreateProgram("terrainRaster",{defines:ee}),E=X},F=d.colorModeForRenderPass(),L=new it(S.LEQUAL,it.ReadWrite,d.depthRangeFor3D);Eo.update(x);const N=d.transform,j=la(N.zoom,f.exaggeration(),f.sourceCache._source.tileSize);let q=[0,0,0];if(C){const X=d.style.directionalLight,ee=d.style.ambientLight;X&&ee&&(q=wo(d.style,X,ee))}{E=-1;const X=S.TRIANGLES,[ee,ie]=[f.gridIndexBuffer,f.gridSegments];for(const Y of y){const K=m.getTile(Y),J=xt.disabled,pe=f.prevTerrainTileForTile[Y.key],oe=f.terrainTileForTile[Y.key];Oh(pe,oe)&&Eo.newMorphing(Y.key,pe,oe,x,250),T.activeTexture.set(S.TEXTURE0),K.texture&&K.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const Ie=Eo.getMorphValuesForProxy(Y.key),xe=Ie?1:0;let Me;Ie&&(Me={morphing:{srcDemTile:Ie.from,dstDemTile:Ie.to,phase:o.dx(Ie.phase)}});const Ue=Fh(Y.projMatrix,_l(Y.canonical,N.renderWorldCopies)?j/10:j,q);if(z(xe),!M)continue;f.setupElevationDraw(K,M,Me);const me=Y.toUnwrapped();C&&C.setupShadows(me,M),d.uploadCommonUniforms(T,M,me,null,D),M.draw(d,X,L,J,F,mt.backCCW,Ue,"terrain_raster",f.gridBuffer,ee,ie)}}}})(n,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,n.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const n=this.painter,c=this.painter.context,d=this.proxySourceCache,f=this.proxiedCoords[d.id],m=this._drapedRenderBatches.shift(),y=n.style.order,x=[];let T=0;for(const S of f){const M=d.getTileByID(S.proxyTileKey),E=d.proxyCachedFBO[S.key]?d.proxyCachedFBO[S.key][t]:void 0,C=E!==void 0?d.renderCache[E]:this.pool[T++],D=E!==void 0;if(M.texture=C.tex,D&&!C.dirty){x.push(M.tileID);continue}let z;c.bindFramebuffer.set(C.fb.framebuffer),this.renderedToTile=!1,C.dirty&&(c.clear({color:o.am.transparent,stencil:0}),C.dirty=!1);for(let F=m.start;F<=m.end;++F){const L=n.style._mergedLayers[y[F]];if(L.isHidden(n.transform.zoom))continue;const N=n.style.getLayerSourceCache(L),j=N?this.proxyToSource[S.key][N.id]:[S];if(!j)continue;const q=j;
2751c.viewport.set([0,0,C.fb.width,C.fb.height]),z!==(N?N.id:null)&&(this._setupStencil(C,j,L,N),z=N?N.id:null),n.renderLayer(n,N,L,q)}if(this._drapedRenderBatches.length===0)for(const F of this._pendingGroundEffectLayers){const L=n.style._mergedLayers[y[F]];if(L.isHidden(n.transform.zoom))continue;const N=n.style.getLayerSourceCache(L),j=N?this.proxyToSource[S.key][N.id]:[S];if(!j)continue;const q=j;c.viewport.set([0,0,C.fb.width,C.fb.height]),z!==(N?N.id:null)&&(this._setupStencil(C,j,L,N),z=N?N.id:null),n.renderLayer(n,N,L,q)}this.renderedToTile?(C.dirty=!0,x.push(M.tileID)):D||--T,T===5&&(T=0,this.renderToBackBuffer(x))}return this.renderToBackBuffer(x),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),m.end+1}postRender(){}isLayerOrderingCorrect(t){const n=t.order.length;let c=-1,d=n;for(let f=0;f<n;++f)this._style.isLayerDraped(t._mergedLayers[t.order[f]])?c=Math.max(c,f):d=Math.min(d,f);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter((n=>n.dem)).forEach((n=>{t=Math.min(t,n.dem.tree.minimums[0])})),t===0?t:(t-30)*this._exaggeration}raycast(t,n,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter((f=>f.dem)).map((f=>{const m=f.tileID,y=1<<m.overscaledZ,{x,y:T}=m.canonical,S=x/y,M=(x+1)/y,E=T/y,C=(T+1)/y;return{minx:S,miny:E,maxx:M,maxy:C,t:f.dem.tree.raycastRoot(S,E,M,C,t,n,c),tile:f}}));d.sort(((f,m)=>(f.t!==null?f.t:Number.MAX_VALUE)-(m.t!==null?m.t:Number.MAX_VALUE)));for(const f of d){if(f.t==null)return null;const m=f.tile.dem.tree.raycast(f.minx,f.miny,f.maxx,f.maxy,t,n,c);if(m!=null)return m}return null}_createFBO(){const t=this.painter.context,n=t.gl,c=this.drapeBufferSize;t.activeTexture.set(n.TEXTURE0);const d=new o.T(t,{width:c[0],height:c[1],data:null},n.RGBA8);d.bind(n.LINEAR,n.CLAMP_TO_EDGE);const f=t.createFramebuffer(c[0],c[1],!0,null);return f.colorAttachment.set(d.texture),f.depthAttachment=new Lh(t,f.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,f.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):f.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:f,tex:d,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some((t=>{const n=this._style._mergedLayers[t],c=n.isHidden(this.painter.transform.zoom);return n.type==="hillshade"||n.type==="custom"?!c&&n.shouldRedrape():!c&&n.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof Ha){t=!0;break}if(!t)return;const n={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],f=this._style.getLayerSourceCache(d);if(f&&!n[f.id]&&!d.isHidden(this.painter.transform.zoom)&&d.type==="line"&&d.widthExpression()instanceof o.ab){n[f.id]=!0;for(const m of this.proxyCoords){const y=this.proxyToSource[m.key][f.id];if(y)for(const x of y)this._clearRenderCacheForTile(f.id,x)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof Ar){t=!0;break}if(!t)return;const n={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],f=this._style.getLayerSourceCache(d);if(!f||n[f.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][f.id];if(x)for(const T of x){const S=on(f.getTile(T),f.findLoadedParent(T,0),f,this.painter.transform,m);
vendor: 7,114 bytes, line 2751
2751(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(f.id,T)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,n=t.length;if(n===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,f=0,m=this._style._mergedLayers[t[f]];for(;!this._style.isLayerDraped(m)&&m.isHidden(this.painter.transform.zoom)&&++f<n;)m=this._style._mergedLayers[t[f]];for(;f<n;++f){const y=this._style._mergedLayers[t[f]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=f):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(f),d!==void 0&&(c.push({start:d,end:f-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:f-1}),c.length!==0){const y=c[c.length-1];this._pendingGroundEffectLayers.every((x=>x>y.end))||o.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 n=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,n.renderCache.length>n.renderCachePool.length){const m=Object.values(n.proxyCachedFBO);n.proxyCachedFBO={};for(let y=0;y<m.length;++y){const x=Object.values(m[y]);n.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(n.getTileByID(y.key),n.proxyCachedFBO[y.key]!==void 0){const x=t[y.key],T=this.proxyToSource[y.key];let S=0;for(const M in T){const E=T[M],C=x[M];if(!C||C.length!==E.length||E.some(((D,z)=>D!==C[z]||d[M]&&d[M].hasOwnProperty(D.key)))){S=-1;break}++S}for(const M in n.proxyCachedFBO[y.key])n.renderCache[n.proxyCachedFBO[y.key][M]].dirty=S<0||S!==Object.values(x).length}}const f=[...this._drapedRenderBatches];f.sort(((m,y)=>y.end-y.start-(m.end-m.start)));for(const m of f)for(const y of c){if(n.proxyCachedFBO[y.key])continue;let x=n.renderCachePool.pop();x===void 0&&n.renderCache.length<50&&(x=n.renderCache.length,n.renderCache.push(this._createFBO())),x!==void 0&&(n.proxyCachedFBO[y.key]={},n.proxyCachedFBO[y.key][m.start]=x,n.renderCache[x].dirty=!0)}this._tilesDirty={}}_setupStencil(t,n,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const f=this.painter.context,m=f.gl;if(n.length<=1)return void(this._overlapStencilType=!1);let y;if(c.isTileClipped())y=n.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(n[0].overscaledZ>n[n.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&&(f.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(n,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):xt.disabled}_renderTileClippingMasks(t,n){const c=this.painter,d=this.painter.context,f=d.gl;c._tileClippingMaskIDs={},d.setColorMode(Pt.disabled),d.setDepthMode(it.disabled);const m=c.getOrCreateProgram("clippingMask");for(const y of t){const x=c._tileClippingMaskIDs[y.key]=--n;m.draw(c,f.TRIANGLES,it.disabled,new xt({func:f.ALWAYS,mask:0},x,255,f.KEEP,f.KEEP,f.REPLACE),Pt.disabled,mt.disabled,_c(y.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const n=this.painter.transform;if(t.x<0||t.x>n.width||t.y<0||t.y>n.height)return null;const c=[t.x,t.y,1,1];o.aA(c,c,n.pixelMatrixInverse),o.cH(c,c,1/c[3]),c[0]/=n.worldSize,c[1]/=n.worldSize;const d=n._camera.position,f=o.cb(1,n.center.lat),m=[d[0],d[1],d[2]/f,0],y=o.d7([],c.slice(0,3),m);o.au(y,y);const x=this.raycast(m,y,this._exaggeration);return x!==null&&x?(o.bE(m,m,y,x),m[3]=m[2],m[2]*=f,m):null}_setupProxiedCoordsForOrtho(t,n,c){if(t.getSource()instanceof o.aP)return this._setupProxiedCoordsForImageSource(t,n,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],f=this.proxyCoords;for(let x=0;x<f.length;x++){const T=f[x],S=this._findTileCoveringTileID(T,t);if(S){const M=this._createProxiedId(T,S,c[T.key]&&c[T.key][t.id]);d.push(M),this.proxyToSource[T.key][t.id]=[M]}}let m=!1;const y=new Set;for(let x=0;x<n.length;x++){const T=t.getTile(n[x]);if(!T||!T.hasData())continue;const S=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(S&&S.tileID.canonical.z!==T.tileID.canonical.z){const M=this.proxyToSource[S.tileID.key][t.id],E=this._createProxiedId(S.tileID,T,c[S.tileID.key]&&c[S.tileID.key][t.id]);M?M.splice(M.length-1,0,E):this.proxyToSource[S.tileID.key][t.id]=[E];const C=this.proxyToSource[S.tileID.key][t.id];y.has(C)||y.add(C),d.push(E),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m&&this._debugParams.sortTilesHiZFirst)for(const x of y)x.sort(((T,S)=>S.overscaledZ-T.overscaledZ))}_setupProxiedCoordsForImageSource(t,n,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],f=this.proxyCoords,m=t.getSource(),y=m.tileID;if(!y)return;const x=new o.P(y.x,y.y)._div(1<<y.z),T=m.coordinates.map(o.ac.fromLngLat).reduce(((M,E)=>(M.min.x=Math.min(M.min.x,E.x-x.x),M.min.y=Math.min(M.min.y,E.y-x.y),M.max.x=Math.max(M.max.x,E.x-x.x),M.max.y=Math.max(M.max.y,E.y-x.y),M)),{min:new o.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new o.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(M,E)=>{const C=M.wrap+M.canonical.x/(1<<M.canonical.z),D=M.canonical.y/(1<<M.canonical.z),z=o.aj/(1<<M.canonical.z),F=E.wrap+E.canonical.x/(1<<E.canonical.z),L=E.canonical.y/(1<<E.canonical.z);return C+z<F+T.min.x||C>F+T.max.x||D+z<L+T.min.y||D>L+T.max.y};for(let M=0;M<f.length;M++){const E=f[M];for(let C=0;C<n.length;C++){const D=t.getTile(n[C]);if(!D||!D.hasData()||S(E,D.tileID))continue;const z=this._createProxiedId(E,D,c[E.key]&&c[E.key][t.id]),F=this.proxyToSource[E.key][t.id];F?F.push(z):this.proxyToSource[E.key][t.id]=[z],d.push(z)}}}_createProxiedId(t,n,c){let d=this.orthoMatrix;if(c){const f=c.find((m=>m.key===n.tileID.key));if(f)return f}if(n.tileID.key!==t.key){const f=t.canonical.z-n.tileID.canonical.z;let m,y,x;d=o.bz();const T=n.tileID.wrap-t.wrap<<t.overscaledZ;f>0?(m=o.aj>>f,y=m*((n.tileID.canonical.x<<f)-t.canonical.x+T),x=m*((n.tileID.canonical.y<<f)-t.canonical.y)):(m=o.aj<<-f,y=o.aj*(n.tileID.canonical.x-(t.canonical.x+T<<-f)),x=o.aj*(n.tileID.canonical.y-(t.canonical.y<<-f))),o.ca(d,0,m,0,m,0,1),o.bo(d,d,[y,x,0])}return new gl(n.tileID,t.key,d)}_findTileCoveringTileID(t,n){let c=n.getTile(t);if(c&&c.hasData())return c;const d=this._findCoveringTileCache[n.id],f=d[t.key];if(c=f?n.getTileByID(f):null,c&&c.hasData()||f===null)return c;let m=c?c.tileID:t,y=m.overscaledZ;const x=n.getSource().minzoom,T=[];
2751if(!f){const M=n.getSource().maxzoom;if(t.canonical.z>=M){const E=t.canonical.z-M;n.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,n.transform.tileZoom),m=new o.aM(y,t.wrap,M,t.canonical.x>>E,t.canonical.y>>E)):E!==0&&(y=M,m=new o.aM(y,t.wrap,M,t.canonical.x>>E,t.canonical.y>>E))}m.key!==t.key&&(T.push(m.key),c=n.getTile(m))}const S=M=>{T.forEach((E=>{d[E]=M})),T.length=0};for(y-=1;y>=x&&(!c||!c.hasData());y--){c&&S(c.tileID.key);const M=m.calculateScaledKey(y);if(c=n.getTileByID(M),c&&c.hasData())break;const E=d[M];if(E===null)break;E===void 0?T.push(M):c=n.getTileByID(E)}return S(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,n){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[n.key]=!0}}function Bh(l,t,n){const c=(function(y,x,T){const S=o.bG(x,y),M=o.bG(T,[.2126,.7152,.0722]),E=(D,z,F)=>(1-F)*D+F*z,C=E(1-.3*Math.min(M,1),1,Math.min(S+1,1));return E(.92,1,Math.asin(o.ay(x[2],-1,1))/Math.PI+.5)*C})(l,[0,0,1],t),d=[0,0,0];o.c1(d,n.slice(0,3),c);const f=[0,0,0];o.c1(f,t.slice(0,3),l[2]);const m=[0,0,0];return o.d5(m,d,f),o.d8(m)}const Nh=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],xc=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class vc{static cacheKey(t,n,c,d){let f=`${n}${d?d.cacheKey:""}`;for(const m of c)t.usedDefines.includes(m)&&(f+=`/${m}`);return f}constructor(t,n,c,d,f,m){const y=t.gl;this.program=y.createProgram(),this.configuration=d,this.name=n,this.fixedDefines=[...m];const x=d?d.getBinderAttributes():[],T=(c.staticAttributes||[]).concat(x);let S=d?d.defines():[];S=S.concat(m.map((F=>`#define ${F}`)));const M=`#version 300 es 2752`;let E=M+S.concat("precision mediump float;",Hs,ac.fragmentSource).join(` 2753`);for(const F of c.fragmentIncludes)E+=` 2754${To[F]}`;E+=` 2755${c.fragmentSource}`;let C=M+S.concat("precision highp float;",Hs,ac.vertexSource).join(` 2756`);for(const F of c.vertexIncludes)C+=` 2757${To[F]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.indexOf("gl_InstanceID")!==-1,this.forceManualRenderingForInstanceIDShaders&&(C+=` 2758uniform int u_instanceID; 2759`),C+=` 2760${c.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(C=C.replaceAll("gl_InstanceID","u_instanceID"));const D=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(D,E),y.compileShader(D),y.attachShader(this.program,D);const z=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())this.failedToCreate=!0;else{y.shaderSource(z,C),y.compileShader(z),y.attachShader(this.program,z),this.attributes={},this.numAttributes=T.length;for(let F=0;F<this.numAttributes;F++)if(T[F]){const L=T[F].startsWith("a_")?T[F]:`a_${T[F]}`;y.bindAttribLocation(this.program,F,L),this.attributes[L]=F}y.linkProgram(this.program),y.deleteShader(z),y.deleteShader(D),this.fixedUniforms=f(t),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(F=>({u_instanceID:new o.cd(F)}))(t)),(m.includes("TERRAIN")||n.indexOf("symbol")!==-1||n.indexOf("circle")!==-1)&&(this.terrainUniforms=(F=>({u_dem:new o.cd(F),u_dem_prev:new o.cd(F),u_dem_tl:new o.cg(F),u_dem_scale:new o.cf(F),u_dem_tl_prev:new o.cg(F),u_dem_scale_prev:new o.cf(F),u_dem_size:new o.cf(F),u_dem_lerp:new o.cf(F),u_exaggeration:new o.cf(F),u_depth:new o.cd(F),u_depth_size_inv:new o.cg
vendor: 11,786 bytes, line 2760
2760(F),u_depth_range_unpack:new o.cg(F),u_occluder_half_size:new o.cf(F),u_occlusion_depth_offset:new o.cf(F),u_meter_to_dem:new o.cf(F),u_label_plane_matrix_inv:new o.ch(F)}))(t)),m.includes("GLOBE")&&(this.globeUniforms=(F=>({u_tile_tl_up:new o.ce(F),u_tile_tr_up:new o.ce(F),u_tile_br_up:new o.ce(F),u_tile_bl_up:new o.ce(F),u_tile_up_scale:new o.cf(F)}))(t)),m.includes("FOG")&&(this.fogUniforms=(F=>({u_fog_matrix:new o.ch(F),u_fog_range:new o.cg(F),u_fog_color:new o.d0(F),u_fog_horizon_blend:new o.cf(F),u_fog_vertical_limit:new o.cg(F),u_fog_temporal_offset:new o.cf(F),u_frustum_tl:new o.ce(F),u_frustum_tr:new o.ce(F),u_frustum_br:new o.ce(F),u_frustum_bl:new o.ce(F),u_globe_pos:new o.ce(F),u_globe_radius:new o.cf(F),u_globe_transition:new o.cf(F),u_is_globe:new o.cd(F),u_viewport:new o.cg(F)}))(t)),m.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(F=>({u_cutoff_params:new o.d0(F)}))(t)),m.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(F=>({u_lighting_ambient_color:new o.ce(F),u_lighting_directional_dir:new o.ce(F),u_lighting_directional_color:new o.ce(F),u_ground_radiance:new o.ce(F)}))(t)),m.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(F=>({u_light_matrix_0:new o.ch(F),u_light_matrix_1:new o.ch(F),u_fade_range:new o.cg(F),u_shadow_normal_offset:new o.ce(F),u_shadow_intensity:new o.cf(F),u_shadow_texel_size:new o.cf(F),u_shadow_map_resolution:new o.cf(F),u_shadow_direction:new o.ce(F),u_shadow_bias:new o.ce(F),u_shadowmap_0:new o.cd(F),u_shadowmap_1:new o.cd(F)}))(t))}}setTerrainUniformValues(t,n){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setGlobeUniformValues(t,n){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setFogUniformValues(t,n){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setCutoffUniformValues(t,n){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setLightsUniformValues(t,n){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setShadowUniformValues(t,n){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}_drawDebugWireframe(t,n,c,d,f,m,y,x,T,S){const M=t.options.wireframe;if(M.terrain===!1&&M.layers2D===!1&&M.layers3D===!1)return;const E=t.context;if(!(!(!M.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!M.layers2D||t._terrain&&t._terrain.renderingToTexture||!Nh.includes(this.name))||!(!M.layers3D||!xc.includes(this.name))))return;const C=E.gl,D=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,f,E);if(!D)return;const z=[...this.fixedDefines];z.push("DEBUG_WIREFRAME");const F=t.getOrCreateProgram(this.name,{config:this.configuration,defines:z});E.program.set(F.program);const L=(q,X,ee)=>{if(X[q]&&ee[q])for(const ie in X[q])ee[q][ie]&&ee[q][ie].set(ee.program,ie,X[q][ie].current)};T&&T.setUniforms(F.program,E,F.binderUniforms,y,{zoom:x}),L("fixedUniforms",this,F),L("terrainUniforms",this,F),L("globeUniforms",this,F),L("fogUniforms",this,F),L("lightsUniforms",this,F),L("shadowUniforms",this,F),D.bind(),E.setColorMode(new Pt([C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ZERO,C.ONE],o.am.transparent,[!0,!0,!0,!1])),E.setDepthMode(new it(n.func===C.LESS?C.LEQUAL:n.func,it.ReadOnly,n.range)),E.setStencilMode(xt.disabled);const N=3*m.primitiveLength*2,j=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const q=S||1;for(let X=0;X<q;++X)F.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",X),C.drawElements(C.LINES,N,C.UNSIGNED_SHORT,j)}else S&&S>1?C.drawElementsInstanced(C.LINES,N,C.UNSIGNED_SHORT,j,S):C.drawElements(C.LINES,N,C.UNSIGNED_SHORT,j);f.bind(),E.program.set(this.program),E.setDepthMode(n),E.setStencilMode(c),E.setColorMode(d)}checkUniforms(t,n,c){if(this.fixedDefines.includes(n)){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 ${n} being defined`)}}draw(t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F){const L=t.context,N=L.gl;if(this.failedToCreate)return;L.program.set(this.program),L.setDepthMode(c),L.setStencilMode(d),L.setColorMode(f),L.setCullFace(m);for(const X of Object.keys(this.fixedUniforms))this.fixedUniforms[X].set(this.program,X,y[X]);D&&D.setUniforms(this.program,L,this.binderUniforms,E,{zoom:C});const j={[N.POINTS]:1,[N.LINES]:2,[N.TRIANGLES]:3,[N.LINE_STRIP]:1}[n];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const q=F&&F>0?1:void 0;for(const X of M.get()){const ee=X.vaos||(X.vaos={});if((ee[x]||(ee[x]=new xp)).bind(L,this,T,D?D.getPaintVertexBuffers():[],S,X.vertexOffset,z||[],q),this.forceManualRenderingForInstanceIDShaders){const ie=F||1;for(let Y=0;Y<ie;++Y)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Y),S?N.drawElements(n,X.primitiveLength*j,N.UNSIGNED_SHORT,X.primitiveOffset*j*2):N.drawArrays(n,X.vertexOffset,X.vertexLength)}else F&&F>1?N.drawElementsInstanced(n,X.primitiveLength*j,N.UNSIGNED_SHORT,X.primitiveOffset*j*2,F):S?N.drawElements(n,X.primitiveLength*j,N.UNSIGNED_SHORT,X.primitiveOffset*j*2):N.drawArrays(n,X.vertexOffset,X.vertexLength);n===N.TRIANGLES&&S&&this._drawDebugWireframe(t,c,d,f,S,X,E,C,D,F)}}}function bc(l,t,n=0){const c=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,l.transform.tileZoom)/c,f=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/o.aw(t,1,l.transform.tileZoom),u_pixel_coord_upper:[f>>16,m>>16],u_pixel_coord_lower:[65535&f,65535&m],u_pattern_transition:n}}const Io={terrain:0,flat:1},Vh=o.bz(),Uh=(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F,L)=>{const N=t.style.light,j=N.properties.get("position"),q=[j.x,j.y,j.z],X=o.dJ();N.properties.get("anchor")==="viewport"&&(o.dK(X,-t.transform.angle),o.dL(q,q,X));const ee=N.properties.get("color").toPremultipliedRenderColor(null),ie=t.transform,Y={u_matrix:l,u_lightpos:q,u_lightintensity:N.properties.get("intensity"),u_lightcolor:[ee.r,ee.g,ee.b],u_vertical_gradient:+n,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Vh,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Io[T],u_base_type:Io[S],u_ao:d,u_edge_radius:f,u_width_scale:m,u_flood_light_color:D,u_vertical_scale:z,u_flood_light_intensity:F,u_ground_shadow_factor:L};return ie.projection.name==="globe"&&(Y.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],Y.u_zoom_transition=M,Y.u_inv_rot_matrix=C,Y.u_merc_center=E,Y.u_up_dir=ie.projection.upVector(new o.cA(0,0,0),E[0]*o.aj,E[1]*o.aj),Y.u_height_lift=x),Y},Od=(l,t,n,c,d,f)=>({u_matrix:l,u_edge_radius:t,u_width_scale:n,u_vertical_scale:c,u_height_type:Io[d],u_base_type:Io[f]}),ca=(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F,L)=>{const N=Uh(l,t,n,c,d,f,m,y,T,S,M,E,C,D,z,F,1,[0,0,0]),j={u_height_factor:-Math.pow(2,y.overscaledZ)/x.tileSize/8};return o.h(N,bc(t,x,L),j)},kd=(l,t,n)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:n}),Bd=(l,t,n,c,d,f=0)=>o.h(kd(l,t,d),bc(n,c,f)),Mp=(l,t,n,c)=>({u_matrix:l,u_world:n,u_emissive_strength:t,u_ground_shadow_factor:c}),Cp=(l,t,n,c,d,f,m=0)=>o.h(Bd(l,t,n,c,f,m),{u_world:d}),Pp=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),wc=(l,t,n,c,d)=>({u_matrix:l,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:n,u_height_scale:c,u_reset_depth:d}),jh=(l,t)=>({u_matrix:l,u_normal_matrix:t,u_opacity:1}),Gh=l=>({u_matrix:l}),Nd=l=>({u_matrix:l}),ha=(l,t,n,c,d,f,m,y)=>{const x=o.aj/f.tileSize;return{u_matrix:l,u_inv_rot_matrix:t,u_camera_to_center_distance:n.getCameraToCenterDistance(y),u_extrude_scale:[n.pixelsToGLUnits[0]/x,n.pixelsToGLUnits[1]/x],u_zoom_transition:c,u_tile_id:m,u_merc_center:d}},qh=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),Vd=o.bz(),Ud=(l,t,n,c,d,f,m)=>{const y=l.transform,x=y.projection.name==="globe",T=x?o.dM(y.zoom,t.canonical)*y._pixelsPerMercatorPixel:o.aw(n,1,f),S={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:m,u_inv_rot_matrix:Vd,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(x){S.u_inv_rot_matrix=c,S.u_merc_center=d,S.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],S.u_zoom_transition=o.ah(y.zoom);const M=d[0]*o.aj,E=d[1]*o.aj;S.u_up_dir=y.projection.upVector(new o.cA(0,0,0),M,E)}return S};function Tc(l,[t,n,c,d],[f,m]){if(f===m)return[0,0,0,0];const y=255*(l-1)/(l*(m-f));return[t*y,n*y,c*y,d*y]}function $s(l,t,[n,c]){return n===c?0:.5/l+(t-n)*(l-1)/(l*(c-n))}const Hh=(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F,L,N,j,q)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:f,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity*M.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:M.paint.get("raster-brightness-min"),u_brightness_high:M.paint.get("raster-brightness-max"),u_saturation_factor:o.dO(M.paint.get("raster-saturation")),u_contrast_factor:o.dN(M.paint.get("raster-contrast")),u_spin_weights:Zs(M.paint.get("raster-hue-rotate")),u_perspective_transform:E,u_raster_elevation:C,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x,u_colorization_mix:Tc(o.dP,z,L),u_colorization_offset:$s(o.dP,F,L),u_color_ramp:D,u_texture_offset:[j/(N+2*j),N/(N+2*j)],u_texture_res:[N+2*j,N+2*j],u_emissive_strength:q});function Zs(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Ws=.05,Sc=(l,t,n,c,d,f,m,y,x,T,S,M)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:f,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:M,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x}),jd=(l,t,n,c,d,f,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_tile_offset:n,u_velocity:c,u_color_ramp:f,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:[Ws,Ws]}),Gd=(l,t,n,c,d,f,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:n,u_velocity_res:c,u_max_speed:d,u_speed_factor:f,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:[Ws,Ws]}),Ec=o.bz(),Ic=(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F,L,N,j,q,X,ee,ie)=>{const Y=d.transform,K={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:Y.getCameraToCenterDistance(N),u_rotate_symbol:+n,u_aspect_ratio:Y.width/Y.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:f,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:S,u_texsize_icon:M,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ec,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Ec,u_up_vector:[0,-1,0],u_color_adj_mat:X,u_icon_transition:ee||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(N)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:o.q.devicePixelRatio,u_is_halo:1,u_scale_factor:ie||1,u_ground_shadow_factor:j,u_inv_matrix:o.bi(o.bz(),m),u_normal_scale:q};
2760return N.name==="globe"&&(K.u_tile_id=[C.canonical.x,C.canonical.y,1<<C.canonical.z],K.u_zoom_transition=D,K.u_inv_rot_matrix=F,K.u_merc_center=z,K.u_camera_forward=Y._camera.forward(),K.u_ecef_origin=o.dQ(Y.globeMatrix,C.toUnwrapped()),K.u_tile_matrix=Float32Array.from(Y.globeMatrix),K.u_up_vector=L),K},qd=(l,t,n,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:n,u_color:c}),$h=(l,t,n,c,d,f,m,y,x)=>o.h((function(T,S,M,E,C,D){const{width:z,height:F}=E.imageManager.getPixelSize(S),L=Math.pow(2,D.tileID.overscaledZ),N=D.tileSize*Math.pow(2,E.transform.tileZoom)/L,j=N*(D.tileID.canonical.x+D.tileID.wrap*L),q=N*D.tileID.canonical.y;return{u_image:0,u_pattern_tl:M.tl,u_pattern_br:M.br,u_texsize:[z,F],u_pattern_size:M.displaySize,u_pattern_units_to_pixels:C?[E.transform.width,-1*E.transform.height]:[1/o.aw(D,1,E.transform.tileZoom),1/o.aw(D,1,E.transform.tileZoom)],u_pixel_coord_upper:[j>>16,q>>16],u_pixel_coord_lower:[65535&j,65535&q]}})(0,f,m,c,y,x),{u_matrix:l,u_emissive_strength:t,u_opacity:n}),Ao=new Float32Array(o.bx([])),Zh=(l,t,n,c,d,f,m,y,x,T,S,M,E,C=[0,0,0],D)=>{const z=d.style.light,F=z.properties.get("position"),L=[-F.x,-F.y,F.z],N=o.dJ();z.properties.get("anchor")==="viewport"&&(o.dK(N,-d.transform.angle),o.dL(L,L,N));const j=S.alphaMode==="MASK",q=z.properties.get("color").toNonPremultipliedRenderColor(null),X=E.paint.get("model-ambient-occlusion-intensity"),ee=E.paint.get("model-color").constantOr(o.am.white).toNonPremultipliedRenderColor(null);return ee.a=E.paint.get("model-color-mix-intensity").constantOr(0),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:n,u_node_matrix:c||Ao,u_lightpos:L,u_lightintensity:z.properties.get("intensity"),u_lightcolor:[q.r,q.g,q.b],u_camera_pos:C,u_opacity:f,u_baseTextureIsAlpha:0,u_alphaMask:+j,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:T,u_baseColorTexture:Zr.BaseColor,u_metallicRoughnessTexture:Zr.MetallicRoughness,u_normalTexture:Zr.Normal,u_occlusionTexture:Zr.Occlusion,u_emissionTexture:Zr.Emission,u_lutTexture:Zr.LUT,u_color_mix:ee.toArray01(),u_aoIntensity:X,u_emissive_strength:M,u_occlusionTextureTransform:D||[0,0,0,0]}},Hd=(l,t=Ao,n=Ao)=>({u_matrix:l,u_instance:t,u_node_matrix:n}),$d={fillExtrusion:l=>({u_matrix:new o.ch(l),u_lightpos:new o.ce(l),u_lightintensity:new o.cf(l),u_lightcolor:new o.ce(l),u_vertical_gradient:new o.cf(l),u_opacity:new o.cf(l),u_edge_radius:new o.cf(l),u_width_scale:new o.cf(l),u_ao:new o.cg(l),u_height_type:new o.cd(l),u_base_type:new o.cd(l),u_tile_id:new o.ce(l),u_zoom_transition:new o.cf(l),u_inv_rot_matrix:new o.ch(l),u_merc_center:new o.cg(l),u_up_dir:new o.ce(l),u_height_lift:new o.cf(l),u_flood_light_color:new o.ce(l),u_vertical_scale:new o.cf(l),u_flood_light_intensity:new o.cf(l),u_ground_shadow_factor:new o.ce(l)}),fillExtrusionDepth:l=>({u_matrix:new o.ch(l),u_edge_radius:new o.cf(l),u_width_scale:new o.cf(l),u_vertical_scale:new o.cf(l),u_height_type:new o.cd(l),u_base_type:new o.cd(l)}),fillExtrusionPattern:l=>({u_matrix:new o.ch(l),u_lightpos:new o.ce(l),u_lightintensity:new o.cf(l),u_lightcolor:new o.ce(l),u_vertical_gradient:new o.cf(l),u_height_factor:new o.cf(l),u_edge_radius:new o.cf(l),u_width_scale:new o.cf(l),u_ao:new o.cg(l),u_height_type:new o.cd(l),u_base_type:new o.cd(l),u_tile_id:new o.ce(l),u_zoom_transition:new o.cf(l),u_inv_rot_matrix:new o.ch(l),u_merc_center:new o.cg(l),u_up_dir:new o.ce(l),u_height_lift:new o.cf(l),u_image:new o.cd(l),u_texsize:new o.cg(l),u_pixel_coord_upper:new o.cg(l),u_pixel_coord_lower:new o.cg(l),u_tile_units_to_pixels:new o.cf(l),u_opacity:new o.cf(l),u_pattern_transition:new o.cf(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new o.ch(l),u_opacity:new o.cf(l),u_ao_pass:new o.cf(l),u_meter_to_tile:new o.cf(l),u_ao:new o.cg(l),u_flood_light_intensity:new o.cf(l),u_flood_light_color:new o.ce(l),u_attenuation:new o.cf(l),u_edge_radius:new o.cf(l),u_fb:new o.cd(l),u_fb_size:new o.cf(l),u_dynamic_offset:new o.cf(l)}),fill:l=>({u_matrix:new o.ch(l),u_emissive_strength:new o.cf(l),u_ground_shadow_factor:new o.ce(l)}),fillPattern:l=>({u_matrix:new o.ch(l),u_emissive_strength:new o.cf(l),u_image:new o.cd(l),u_texsize:new o.cg
2760(l),u_pixel_coord_upper:new o.cg(l),u_pixel_coord_lower:new o.cg(l),u_tile_units_to_pixels:new o.cf(l),u_ground_shadow_factor:new o.ce(l),u_pattern_transition:new o.cf(l)}),fillOutline:l=>({u_matrix:new o.ch(l),u_emissive_strength:new o.cf(l),u_world:new o.cg(l),u_ground_shadow_factor:new o.ce(l)}),fillOutlinePattern:l=>({u_matrix:new o.ch(l),u_emissive_strength:new o.cf(l),u_world:new o.cg(l),u_image:new o.cd(l),u_texsize:new o.cg(l),u_pixel_coord_upper:new o.cg(l),u_pixel_coord_lower:new o.cg(l),u_tile_units_to_pixels:new o.cf(l),u_ground_shadow_factor:new o.ce(l),u_pattern_transition:new o.cf(l)}),building:l=>({u_matrix:new o.ch(l),u_normal_matrix:new o.ch(l),u_opacity:new o.cf(l)}),buildingBloom:l=>({u_matrix:new o.ch(l)}),buildingDepth:l=>({u_matrix:new o.ch(l)}),elevatedStructuresDepth:l=>({u_matrix:new o.ch(l),u_depth_bias:new o.cf(l)}),elevatedStructures:l=>({u_matrix:new o.ch(l),u_ground_shadow_factor:new o.ce(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new o.ch(l),u_camera_pos:new o.ce(l),u_depth_bias:new o.cf(l),u_height_scale:new o.cf(l),u_reset_depth:new o.cf(l)}),circle:o.dT,collisionBox:l=>({u_matrix:new o.ch(l),u_inv_rot_matrix:new o.ch(l),u_camera_to_center_distance:new o.cf(l),u_extrude_scale:new o.cg(l),u_zoom_transition:new o.cf(l),u_merc_center:new o.cg(l),u_tile_id:new o.ce(l)}),collisionCircle:l=>({u_matrix:new o.ch(l),u_inv_matrix:new o.ch(l),u_camera_to_center_distance:new o.cf(l),u_viewport_size:new o.cg(l)}),debug:l=>({u_color:new o.dv(l),u_matrix:new o.ch(l),u_overlay:new o.cd(l),u_overlay_scale:new o.cf(l)}),clippingMask:l=>({u_matrix:new o.ch(l)}),heatmap:l=>({u_extrude_scale:new o.cf(l),u_intensity:new o.cf(l),u_matrix:new o.ch(l),u_inv_rot_matrix:new o.ch(l),u_merc_center:new o.cg(l),u_tile_id:new o.ce(l),u_zoom_transition:new o.cf(l),u_up_dir:new o.ce(l)}),heatmapTexture:l=>({u_image:new o.cd(l),u_color_ramp:new o.cd(l),u_opacity:new o.cf(l)}),hillshade:l=>({u_matrix:new o.ch(l),u_image:new o.cd(l),u_latrange:new o.cg(l),u_light:new o.cg(l),u_shadow:new o.dv(l),u_highlight:new o.dv(l),u_emissive_strength:new o.cf(l),u_accent:new o.dv(l)}),hillshadePrepare:l=>({u_matrix:new o.ch(l),u_image:new o.cd(l),u_dimension:new o.cg(l),u_zoom:new o.cf(l)}),line:o.dS,linePattern:o.dR,raster:l=>({u_matrix:new o.ch(l),u_normalize_matrix:new o.ch(l),u_globe_matrix:new o.ch(l),u_merc_matrix:new o.ch(l),u_grid_matrix:new o.dw(l),u_tl_parent:new o.cg(l),u_scale_parent:new o.cf(l),u_fade_t:new o.cf(l),u_opacity:new o.cf(l),u_image0:new o.cd(l),u_image1:new o.cd(l),u_brightness_low:new o.cf(l),u_brightness_high:new o.cf(l),u_saturation_factor:new o.cf(l),u_contrast_factor:new o.cf(l),u_spin_weights:new o.ce(l),u_perspective_transform:new o.cg(l),u_raster_elevation:new o.cf(l),u_zoom_transition:new o.cf(l),u_merc_center:new o.cg(l),u_cutoff_params:new o.d0(l),u_colorization_mix:new o.d0(l),u_colorization_offset:new o.cf(l),u_color_ramp:new o.cd(l),u_texture_offset:new o.cg(l),u_texture_res:new o.cg(l),u_emissive_strength:new o.cf(l)}),rasterParticle:l=>({u_matrix:new o.ch(l),u_normalize_matrix:new o.ch(l),u_globe_matrix:new o.ch(l),u_merc_matrix:new o.ch(l),u_grid_matrix:new o.dw(l),u_tl_parent:new o.cg(l),u_scale_parent:new o.cf(l),u_fade_t:new o.cf(l),u_opacity:new o.cf(l),u_image0:new o.cd(l),u_image1:new o.cd(l),u_raster_elevation:new o.cf(l),u_zoom_transition:new o.cf(l),u_merc_center:new o.cg(l),u_cutoff_params:new o.d0(l)}),rasterParticleTexture:l=>({u_texture:new o.cd(l),u_opacity:new o.cf(l)}),rasterParticleDraw:l=>({u_particle_texture:new o.cd(l),u_particle_texture_side_len:new o.cf(l),u_tile_offset:new o.cg(l),u_velocity:new o.cd(l),u_color_ramp:new o.cd(l),u_velocity_res:new o.cg(l),u_max_speed:new o.cf(l),u_uv_offset:new o.cg(l),u_data_scale:new o.cg(l),u_data_offset:new o.cf(l),u_particle_pos_scale:new o.cf(l),u_particle_pos_offset:new o.cg(l)}),rasterParticleUpdate:l=>({u_particle_texture:new o.cd(l),u_particle_texture_side_len:new o.cf(l),u_velocity:new o.cd(l),u_velocity_res:new o.cg(l),u_max_speed:new o.cf(l),u_speed_factor:new o.cf(l),u_reset_rate:new o.cf(l),u_rand_seed:new o.cf(l),u_uv_offset:new o.cg
2760(l),u_data_scale:new o.cg(l),u_data_offset:new o.cf(l),u_particle_pos_scale:new o.cf(l),u_particle_pos_offset:new o.cg(l)}),symbol:l=>({u_is_size_zoom_constant:new o.cd(l),u_is_size_feature_constant:new o.cd(l),u_size_t:new o.cf(l),u_size:new o.cf(l),u_camera_to_center_distance:new o.cf(l),u_rotate_symbol:new o.cd(l),u_aspect_ratio:new o.cf(l),u_fade_change:new o.cf(l),u_matrix:new o.ch(l),u_label_plane_matrix:new o.ch(l),u_coord_matrix:new o.ch(l),u_is_text:new o.cd(l),u_elevation_from_sea:new o.cd(l),u_pitch_with_map:new o.cd(l),u_texsize:new o.cg(l),u_texsize_icon:new o.cg(l),u_texture:new o.cd(l),u_texture_icon:new o.cd(l),u_gamma_scale:new o.cf(l),u_device_pixel_ratio:new o.cf(l),u_tile_id:new o.ce(l),u_zoom_transition:new o.cf(l),u_inv_rot_matrix:new o.ch(l),u_merc_center:new o.cg(l),u_camera_forward:new o.ce(l),u_tile_matrix:new o.ch(l),u_up_vector:new o.ce(l),u_ecef_origin:new o.ce(l),u_is_halo:new o.cd(l),u_icon_transition:new o.cf(l),u_color_adj_mat:new o.ch(l),u_scale_factor:new o.cf(l),u_ground_shadow_factor:new o.ce(l),u_inv_matrix:new o.ch(l),u_normal_scale:new o.cf(l)}),background:l=>({u_matrix:new o.ch(l),u_emissive_strength:new o.cf(l),u_opacity:new o.cf(l),u_color:new o.dv(l)}),backgroundPattern:l=>({u_matrix:new o.ch(l),u_emissive_strength:new o.cf(l),u_opacity:new o.cf(l),u_image:new o.cd(l),u_pattern_tl:new o.cg(l),u_pattern_br:new o.cg(l),u_texsize:new o.cg(l),u_pattern_size:new o.cg(l),u_pixel_coord_upper:new o.cg(l),u_pixel_coord_lower:new o.cg(l),u_pattern_units_to_pixels:new o.cg(l)}),terrainRaster:l=>({u_matrix:new o.ch(l),u_image0:new o.cd(l),u_skirt_height:new o.cf(l),u_ground_shadow_factor:new o.ce(l)}),skybox:l=>({u_matrix:new o.ch(l),u_sun_direction:new o.ce(l),u_cubemap:new o.cd(l),u_opacity:new o.cf(l),u_temporal_offset:new o.cf(l)}),skyboxGradient:l=>({u_matrix:new o.ch(l),u_color_ramp:new o.cd(l),u_center_direction:new o.ce(l),u_radius:new o.cf(l),u_opacity:new o.cf(l),u_temporal_offset:new o.cf(l)}),skyboxCapture:l=>({u_matrix_3f:new o.dw(l),u_sun_direction:new o.ce(l),u_sun_intensity:new o.cf(l),u_color_tint_r:new o.d0(l),u_color_tint_m:new o.d0(l),u_luminance:new o.cf(l)}),globeRaster:l=>({u_proj_matrix:new o.ch(l),u_globe_matrix:new o.ch(l),u_normalize_matrix:new o.ch(l),u_merc_matrix:new o.ch(l),u_zoom_transition:new o.cf(l),u_merc_center:new o.cg(l),u_image0:new o.cd(l),u_grid_matrix:new o.dw(l),u_skirt_height:new o.cf(l),u_far_z_cutoff:new o.cf(l),u_frustum_tl:new o.ce(l),u_frustum_tr:new o.ce(l),u_frustum_br:new o.ce(l),u_frustum_bl:new o.ce(l),u_globe_pos:new o.ce(l),u_globe_radius:new o.cf(l),u_viewport:new o.cg(l)}),globeAtmosphere:l=>({u_frustum_tl:new o.ce(l),u_frustum_tr:new o.ce(l),u_frustum_br:new o.ce(l),u_frustum_bl:new o.ce(l),u_horizon:new o.cf(l),u_transition:new o.cf(l),u_fadeout_range:new o.cf(l),u_color:new o.d0(l),u_high_color:new o.d0(l),u_space_color:new o.d0(l),u_temporal_offset:new o.cf(l),u_horizon_angle:new o.cf(l)}),model:l=>({u_matrix:new o.ch(l),u_lighting_matrix:new o.ch(l),u_normal_matrix:new o.ch(l),u_node_matrix:new o.ch(l),u_lightpos:new o.ce(l),u_lightintensity:new o.cf(l),u_lightcolor:new o.ce(l),u_camera_pos:new o.ce(l),u_opacity:new o.cf(l),u_baseColorFactor:new o.d0(l),u_emissiveFactor:new o.d0(l),u_metallicFactor:new o.cf(l),u_roughnessFactor:new o.cf(l),u_baseTextureIsAlpha:new o.cd(l),u_alphaMask:new o.cd(l),u_alphaCutoff:new o.cf(l),u_baseColorTexture:new o.cd(l),u_metallicRoughnessTexture:new o.cd(l),u_normalTexture:new o.cd(l),u_occlusionTexture:new o.cd(l),u_emissionTexture:new o.cd(l),u_lutTexture:new o.cd(l),u_color_mix:new o.d0(l),u_aoIntensity:new o.cf(l),u_emissive_strength:new o.cf(l),u_occlusionTextureTransform:new o.d0(l)}),modelDepth:l=>({u_matrix:new o.ch(l),u_instance:new o.ch(l),u_node_matrix:new o.ch(l)}),groundShadow:l=>({u_matrix:new o.ch(l),u_ground_shadow_factor:new o.ce(l)}),stars:l=>({u_matrix:new o.ch(l),u_up:new o.ce(l),u_right:new o.ce(l),u_intensity_multiplier:new o.cf(l)}),snowParticle:l=>({u_modelview:new o.ch(l),u_projection:new o.ch(l),u_time:new o.cf(l),u_cam_pos:new o.ce(l),u_velocityConeAperture:new o.cf(l),u_velocity:new o.cf(l),u_horizontalOscillationRadius:new o.cf(l),u_horizontalOscillationRate:new o.cf(l),u_boxSize:new o.cf(l),u_billboardSize:new o.cf(l),u_simpleShapeParameters:new o.cg
2760(l),u_screenSize:new o.cg(l),u_thinningCenterPos:new o.cg(l),u_thinningShape:new o.ce(l),u_thinningAffectedRatio:new o.cf(l),u_thinningParticleOffset:new o.cf(l),u_particleColor:new o.d0(l),u_direction:new o.ce(l)}),rainParticle:l=>({u_modelview:new o.ch(l),u_projection:new o.ch(l),u_time:new o.cf(l),u_cam_pos:new o.ce(l),u_texScreen:new o.cd(l),u_velocityConeAperture:new o.cf(l),u_velocity:new o.cf(l),u_boxSize:new o.cf(l),u_rainDropletSize:new o.cg(l),u_distortionStrength:new o.cf(l),u_rainDirection:new o.ce(l),u_color:new o.d0(l),u_screenSize:new o.cg(l),u_thinningCenterPos:new o.cg(l),u_thinningShape:new o.ce(l),u_thinningAffectedRatio:new o.cf(l),u_thinningParticleOffset:new o.cf(l),u_shapeDirectionalPower:new o.cf(l),u_shapeNormalPower:new o.cf(l),u_mode:new o.cf(l)}),vignette:l=>({u_vignetteShape:new o.ce(l),u_vignetteColor:new o.d0(l)}),occlusion:l=>({u_matrix:new o.ch(l),u_anchorPos:new o.ce(l),u_screenSizePx:new o.cg(l),u_occluderSizePx:new o.cg(l),u_color:new o.d0(l)})};class Xs{constructor(t,n,c,d){this.id=Xs.uniqueIdxCounter,Xs.uniqueIdxCounter++,this.context=t;const f=t.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||d||n.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=Xs.uniqueIdxCounter,Xs.uniqueIdxCounter++;const n=this.context.gl;this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Xs.uniqueIdxCounter=0;const Wh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Xh{constructor(t,n,c,d,f,m){this.length=n.length,this.attributes=c,this.itemSize=n.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,n.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||f||n.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let c=0;c<this.attributes.length;c++){const d=n.attributes[this.attributes[c].name];d!==void 0&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,n,c){for(let d=0;d<this.attributes.length;d++){const f=this.attributes[d],m=n.attributes[f.name];m!==void 0&&t.vertexAttribPointer(m,f.components,t[Wh[f.type]],!1,this.itemSize,f.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,n,c){for(let d=0;d<this.attributes.length;d++){const f=n.attributes[this.attributes[d].name];f!==void 0&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(f,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Mo{constructor(t,n,c,d,f){this.context=t,this.width=n,this.height=c;const m=this.framebuffer=t.gl.createFramebuffer();d&&(this.colorAttachment=new Ap(t,m)),f&&(this.depthAttachmentType=f,this.depthAttachment=f==="renderbuffer"?new Ld(t,m):new D
vendor: 29,500 bytes, line 2760
2760h(t,m))}destroy(){const t=this.context.gl;if(this.colorAttachment){const n=this.colorAttachment.get();n&&t.deleteTexture(n)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n)}else{const n=this.depthAttachment.get();n&&t.deleteTexture(n)}t.deleteFramebuffer(this.framebuffer)}}class Ac{constructor(t,n){this.gl=t,this.clearColor=new bp(this),this.clearDepth=new wp(this),this.clearStencil=new Tp(this),this.colorMask=new Sp(this),this.depthMask=new Id(this),this.stencilMask=new Ep(this),this.stencilFunc=new lc(this),this.stencilOp=new Ip(this),this.stencilTest=new Ad(this),this.depthRange=new Mh(this),this.depthTest=new cc(this),this.depthFunc=new Ch(this),this.blend=new So(this),this.blendFunc=new na(this),this.blendColor=new hc(this),this.blendEquation=new uc(this),this.cullFace=new sa(this),this.cullFaceSide=new Md(this),this.frontFace=new Ph(this),this.program=new Cd(this),this.activeTexture=new oa(this),this.viewport=new dc(this),this.bindFramebuffer=new fc(this),this.bindRenderbuffer=new zh(this),this.bindTexture=new pc(this),this.bindVertexBuffer=new ml(this),this.bindElementBuffer=new Pd(this),this.bindVertexArrayOES=new zd(this),this.pixelStoreUnpack=new Rd(this),this.pixelStoreUnpackPremultiplyAlpha=new aa(this),this.pixelStoreUnpackFlipY=new Dd(this),this.options=n?Object.assign({},n):{},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=n&&!!n.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.maxPointSize=t.getParameter(t.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n,c){return new Xs(this,t,n,c)}createVertexBuffer(t,n,c,d,f){return new Xh(this,t,n,c,d,f)}createRenderbuffer(t,n,c){const d=this.gl,f=d.createRenderbuffer();return this.bindRenderbuffer.set(f),d.renderbufferStorage(d.RENDERBUFFER,t,n,c),this.bindRenderbuffer.set(null),f}createFramebuffer(t,n,c,d){return new Mo(this,t,n,c,d)}clear({color:t,depth:n,stencil:c,colorMask:d}){const f=this.gl;let m=0;t&&(m|=f.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),n!==void 0&&(m|=f.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),c!==void 0&&(m|=f.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),f.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){o.bv(t.blendFunction,Pt.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 Ys;function Yh(l,t,n,c,d,f,m){const y=l.context,x=y.gl,T=l.transform,S=[o.aD(T.center.lng),o.aH(T.center.lat)],M=n.layout.get("symbol-placement"),E=n.layout.get("text-variable-anchor"),C=n.layout.get("icon-rotation-alignment")==="map",D=n.layout.get("text-rotation-alignment")==="map",z=M!=="point",F=[];let L=0,N=0;for(let K=0;K<c.length;K++){const J=c[K],pe=t.getTile(J),oe=pe.getBucket(n);if(!oe)continue;const Ie=oe.getProjection().createInversionMatrix(T,J.canonical),xe=[],Me=fd(J,oe,T),Ue=!m&&C&&z,me=m&&D&&z,se=E&&oe.hasTextData(),we=oe.hasIconTextFit()&&se&&oe.hasIconData(),_e=Ue||me||m&&se||we,ze=oe.projection.name==="globe",Re=ze?o.ah(T.zoom):0;ze&&(xe.push("PROJECTION_GLOBE_VIEW"),_e&&xe.push("PROJECTED_POS_ON_VIEWPORT"));const Le=l.getOrCreateProgram("collisionBox",{defines:xe});let Ze=Me;d[0]===0&&d[1]===0||(Ze=l.translatePosMatrix(Me,pe,d,f));const at=m?oe.textCollisionBox:oe.iconCollisionBox,dt=oe.collisionCircleArray;if(dt.length>0){const ht=o.bz(),lt=Ze;o.cM(ht,oe.placementInvProjMatrix,T.glCoordMatrix),o.cM(ht,ht,oe.placementViewportMatrix),F.push({circleArray:dt,circleOffset:N,transform:lt,invTransform:ht,projection:oe.getProjection()}),L+=dt.length/4,N=L}if(!at)continue;l.terrain&&l.terrain.setupElevationDraw(pe,Le);const Qe=ze?[J.canonical.x,J.canonical.y,1<<J.canonical.z]:[0,0,0];Le.draw(l,x.LINES,it.disabled,xt.disabled,l.colorModeForRenderPass(),mt.disabled,ha(Ze,Ie,T,Re,S,pe,Qe,oe.getProjection()),n.id,at.layoutVertexBuffer,at.indexBuffer,at.segments,null,T.zoom,null,[at.collisionVertexBuffer,at.collisionVertexBufferExt])}if(!m||!F.length)return;const j=l.getOrCreateProgram("collisionCircle"),q=new o.dU;q.resize(4*L),q._trim();let X=0;for(const K of F)for(let J=0;J<K.circleArray.length/4;J++){const pe=4*J,oe=K.circleArray[pe+0],Ie=K.circleArray[pe+1],xe=K.circleArray[pe+2],Me=K.circleArray[pe+3];q.emplace(X++,oe,Ie,xe,Me,0),q.emplace(X++,oe,Ie,xe,Me,1),q.emplace(X++,oe,Ie,xe,Me,2),q.emplace(X++,oe,Ie,xe,Me,3)}(!Ys||Ys.length<2*L)&&(Ys=(function(K){const J=2*K,pe=new o.a_;pe.resize(J),pe._trim();for(let oe=0;oe<J;oe++){const Ie=6*oe;pe.uint16[Ie+0]=4*oe+0,pe.uint16[Ie+1]=4*oe+1,pe.uint16[Ie+2]=4*oe+2,pe.uint16[Ie+3]=4*oe+2,pe.uint16[Ie+4]=4*oe+3,pe.uint16[Ie+5]=4*oe+0}return pe})(L));const ee=y.createIndexBuffer(Ys,!0),ie=y.createVertexBuffer(q,o.dV.members,!0);for(const K of F){const J={u_matrix:K.transform,u_inv_matrix:K.invTransform,u_camera_to_center_distance:(Y=T).getCameraToCenterDistance(K.projection),u_viewport_size:[Y.width,Y.height]};j.draw(l,x.TRIANGLES,it.disabled,xt.disabled,l.colorModeForRenderPass(),mt.disabled,J,n.id,ie,ee,o.bd.simpleSegment(0,2*K.circleOffset,K.circleArray.length,K.circleArray.length/2),null,T.zoom)}var Y;ie.destroy(),ee.destroy()}const Co=o.bz();function yl(l){const t=l._camera.getWorldToCamera(l.worldSize,1),n=o.az([],t,l.globeMatrix);o.bi(n,n);const c=[0,0,0],d=[0,1,0,0];return o.aA(d,d,n),c[0]=d[0],c[1]=d[1],c[2]=d[2],o.au(c,c),c}function Kh({width:l,height:t,anchor:n,textOffset:c,textScale:d},f){const{horizontalAlign:m,verticalAlign:y}=o.bZ(n),x=-(m-.5)*l,T=-(y-.5)*t,S=o.b_(n,c);return new o.P((x/d+S[0])*f,(T/d+S[1])*f)}function Zd(l,t,n,c,d,f,m,y,x,T){const S=l.text.placedSymbolArray,M=l.text.dynamicLayoutVertexArray,E=l.icon.dynamicLayoutVertexArray,C={},D=l.getProjection(),z=Yl(m,D,d),F=d.elevation,L=D.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;M.clear();for(let N=0;N<S.length;N++){const j=S.get(N),{tileAnchorX:q,tileAnchorY:X,numGlyphs:ee}=j,ie=j.hidden||!j.crossTileID||l.allowVerticalPlacement&&!j.placedOrientation?null:c[j.crossTileID];if(ie){let Y=0,K=0,J=0;if(F){const we=F?F.getAtTileOffset(m,q,X):0,[_e,ze,Re]=D.upVector(m.canonical,q,X);Y=we*_e*L,K=we*ze*L,J=we*Re*L}let[pe,oe,Ie,xe]=wn(j.projectedAnchorX+Y,j.projectedAnchorY+K,j.projectedAnchorZ+J,n?z:f);const Me=mh(d.getCameraToCenterDistance(D),xe);let Ue=o.bJ(l.textSizeData,x,j)*Me/o.bU;n&&(Ue*=l.tilePixelRatio/y);const me=Kh(ie,Ue);n?({x:pe,y:oe,z:Ie}=D.projectTilePoint(q+me.x,X+me.y,m.canonical),[pe,oe,Ie]=wn(pe+Y,oe+K,Ie+J,f)):(t&&me._rotate(-d.angle),pe+=me.x,oe+=me.y,Ie=0);const se=l.allowVerticalPlacement&&j.placedOrientation===o.bI.vertical?Math.PI/2:0;for(let we=0;we<ee;we++)o.bL(M,pe,oe,Ie,se);T&&j.associatedIconIndex>=0&&(C[j.associatedIconIndex]={x:pe,y:oe,z:Ie,angle:se})}else Xo(ee,M)}if(T){E.clear();const N=l.icon.placedSymbolArray;for(let j=0;j<N.length;j++){const q=N.get(j),{numGlyphs:X}=q,ee=C[j];if(q.hidden||!ee)Xo(X,E);else{const{x:ie,y:Y,z:K,angle:J}=ee;for(let pe=0;pe<X;pe++)o.bL(E,ie,Y,K,J)}}l.icon.dynamicLayoutVertexBuffer.updateData(E)}l.text.dynamicLayoutVertexBuffer.updateData(M)}function Jh(l,t,n,c,d,f,m={}){const y=n.paint.get("icon-translate"),x=n.paint.get("text-translate"),T=n.paint.get("icon-translate-anchor"),S=n.paint.get("text-translate-anchor"),M=n.layout.get("icon-rotation-alignment"),E=n.layout.get("text-rotation-alignment"),C=n.layout.get("icon-pitch-alignment"),D=n.layout.get("text-pitch-alignment"),z=n.layout.get("icon-keep-upright"),F=n.layout.get("text-keep-upright"),L=n.paint.get("icon-color-saturation"),N=n.paint.get("icon-color-contrast"),j=n.paint.get("icon-color-brightness-min"),q=n.paint.get("icon-color-brightness-max"),X=n.layout.get("symbol-elevation-reference")==="sea",ee=l.context,ie=ee.gl,Y=l.transform,K=M==="map",J=E==="map",pe=C==="map",oe=D==="map",Ie=n.layout.get("symbol-sort-key").constantOr(1)!==void 0;let xe=!1;const Me=l.depthModeForSublayer(0,it.ReadOnly),Ue=new it(l.context.gl.LEQUAL,it.ReadOnly,l.depthRangeFor3D),me=[o.aD(Y.center.lng),o.aH(Y.center.lat)],se=n.layout.get("text-variable-anchor"),we=Y.projection.name==="globe",_e=[],ze=[0,-1,0];for(const Re of c){const Le=t.getTile(Re),Ze=Le.getBucket(n);if(!Ze||Ze.projection.name==="mercator"&&we||Ze.fullyClipped)continue;const at=Ze.projection.name==="globe",dt=at?o.ah(Y.zoom):0,Qe=Yl(Re,Ze.getProjection(),Y),ht=Y.calculatePixelsToTileUnitsMatrix(Le),lt=se&&Ze.hasTextData(),wt=Ze.hasIconTextFit()&<&&Ze.hasIconData(),At=Ze.getProjection().createInversionMatrix(Y,Re.canonical),Ot=(1<<Le.tileID.canonical.z)*o.aj/l.transform.worldSize,Yt=di=>{let ii=[0,0,0];if(di){const Vi=l.style.directionalLight,Wt=l.style.ambientLight;Vi&&Wt&&(ii=wo(l.style,Vi,Wt))}return ii},Et=di=>{Y.depthOcclusionForSymbolsAndCircles&&(n.hasInitialOcclusionOpacityProperties||l.terrain)&&(di.push("DEPTH_D24"),di.push("DEPTH_OCCLUSION"))},Kt=()=>{const di=K&&n.layout.get("symbol-placement")!=="point",ii=[];Et(ii);const Vi=di||wt,Wt=Ze.elevationType==="road",si=l.shadowRenderer,yi=Wt&&pe&&!!si&&si.enabled,or=Yt(yi),rr=Wt&&pe&&!l.terrain?Ue:Me,ar=n.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&pe&&ii.push("PITCH_WITH_MAP_TERRAIN"),at&&(ii.push("PROJECTION_GLOBE_VIEW"),Vi&&ii.push("PROJECTED_POS_ON_VIEWPORT")),ar>0&&Ze.hasAnySecondaryIcon&&ii.push("ICON_TRANSITION"),!Ze.icon.zOffsetVertexBuffer||Wt&&l.terrain||ii.push("Z_OFFSET"),L===0&&N===0&&j===0&&q===1||ii.push("COLOR_ADJUSTMENT"),Ze.sdfIcons&&ii.push("RENDER_SDF"),yi&&ii.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Wt&&pe&&!l.terrain&&Ze.icon.orientationVertexBuffer&&ii.push("ELEVATED_ROADS");const Sr=Ze.icon.programConfigurations.get(n.id),Xn=l.getOrCreateProgram("symbol",{config:Sr,defines:ii}),Yr=Le.imageAtlasTexture?Le.imageAtlasTexture.size:[0,0],pn=Ze.iconSizeData,Pr=o.bH(pn,Y.zoom),Mn=pe||!Y.isOrthographic,Gn=il(Qe,Le.tileID.canonical,pe,K,Y,Ze.getProjection(),ht),zr=ys(Qe,Le.tileID.canonical,pe,K,Y,Ze.getProjection(),ht),Ji=l.translatePosMatrix(zr,Le,y,T,!0),Zi=l.translatePosMatrix(Qe,Le,y,T),wi=Vi?Co:Gn,pr=K&&!pe&&!di;let Er=ze;!we&&!Y.mercatorFromTransition||K||(Er=yl(Y));const Qi=at?Er:ze,Cn=n.getColorAdjustmentMatrix(L,N,j,q),Do=Ic(pn.kind,Pr,pr,pe,l,Zi,wi,Ji,X,!1,Yr,[0,0],0,Re,dt,me,At,Qi,Ze.getProjection(),or,Ot,Cn,ar,null),ro=Le.imageAtlasTexture?Le.imageAtlasTexture:null,Ea=n.layout.get("icon-size").constantOr(0)!==1||Ze.iconsNeedLinear,Ia=Ze.sdfIcons||l.options.rotating||l.options.zooming||Ea||Mn?ie.LINEAR:ie.NEAREST,Pn=Ze.sdfIcons&&n.paint.get("icon-halo-width").constantOr(1)!==0,ns=l.terrain&&pe&&di?o.bi(o.bz(),Gn):Co;if(di&&Ze.icon){const mr=Y.elevation,zn=mr?mr.getAtTileOffsetFunc(Re,Y.center.lat,Y.worldSize,Ze.getProjection()):null,Lo=Wo(Qe,Le.tileID.canonical,pe,K,Y,Ze.getProjection(),ht);xo(Ze,Qe,l,!1,Lo,zr,pe,z,zn,Re)}return{program:Xn,buffers:Ze.icon,uniformValues:Do,atlasTexture:ro,atlasTextureIcon:null,atlasInterpolation:Ia,atlasInterpolationIcon:null,isSDF:Ze.sdfIcons,hasHalo:Pn,depthMode:rr,tile:Le,renderWithShadows:yi,labelPlaneMatrixInv:ns}},ti=()=>{const di=J&&n.layout.get("symbol-placement")!=="point",ii=[],Vi=di||se||wt,Wt=Ze.elevationType==="road",si=l.shadowRenderer,yi=Wt&&oe&&!!si&&si.enabled,or=Yt(yi),rr=Wt&&oe&&!l.terrain?Ue:Me;l.terrainRenderModeElevated()&&oe&&ii.push("PITCH_WITH_MAP_TERRAIN"),at&&(ii.push("PROJECTION_GLOBE_VIEW"),Vi&&ii.push("PROJECTED_POS_ON_VIEWPORT")),!Ze.text.zOffsetVertexBuffer||Wt&&l.terrain||ii.push("Z_OFFSET"),Ze.iconsInText&&ii.push("RENDER_TEXT_AND_SYMBOL"),ii.push("RENDER_SDF"),yi&&ii.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Wt&&oe&&!l.terrain&&Ze.text.orientationVertexBuffer&&ii.push("ELEVATED_ROADS"),Et(ii);const ar=Ze.text.programConfigurations.get(n.id),Sr=l.getOrCreateProgram("symbol",{config:ar,defines:ii});let Xn,Yr=[0,0],pn=null;const Pr=Ze.textSizeData;Ze.iconsInText&&(Yr=Le.imageAtlasTexture?Le.imageAtlasTexture.size:[0,0],pn=Le.imageAtlasTexture?Le.imageAtlasTexture:null,Xn=oe||!Y.isOrthographic||l.options.rotating||l.options.zooming||Pr.kind==="composite"||Pr.kind==="camera"?ie.LINEAR:ie.NEAREST);const Mn=Le.glyphAtlasTexture?Le.glyphAtlasTexture.size:[0,0],Gn=n.layout.get("text-size-scale-range"),zr=o.ay(l.scaleFactor,Gn[0],Gn[1]),Ji=o.bH(Pr,Y.zoom,zr),Zi=il(Qe,Le.tileID.canonical,oe,J,Y,Ze.getProjection(),ht),wi=ys(Qe,Le.tileID.canonical,oe,J,Y,Ze.getProjection(),ht),pr=l.translatePosMatrix(wi,Le,x,S,!0),Er=l.translatePosMatrix(Qe,Le,x,S),Qi=Vi?Co:Zi,Cn=J&&!oe&&!di;let Do=ze;!we&&!Y.mercatorFromTransition||J||(Do=yl(Y));const ro=Ic(Pr.kind,Ji,Cn,oe,l,Er,Qi,pr,X,!0,Mn,Yr,0,Re,dt,me,At,at?Do:ze,Ze.getProjection(),or,Ot,null,null,zr),Ea=Le.glyphAtlasTexture?Le.glyphAtlasTexture:null,Ia=ie.LINEAR,Pn=n.paint.get("text-halo-width").constantOr(1)!==0,ns=l.terrain&&oe&&di?o.bi(o.bz(),Zi):Co;if(di&&Ze.text){const mr=Y.elevation,zn=mr?mr.getAtTileOffsetFunc(Re,Y.center.lat,Y.worldSize,Ze.getProjection()):null,Lo=Wo(Qe,Le.tileID.canonical,oe,J,Y,Ze.getProjection(),ht);xo(Ze,Qe,l,!0,Lo,wi,oe,F,zn,Re)}return{program:Sr,buffers:Ze.text,uniformValues:ro,atlasTexture:Ea,atlasTextureIcon:pn,atlasInterpolation:Ia,atlasInterpolationIcon:Xn,isSDF:!0,hasHalo:Pn,depthMode:rr,tile:Le,renderWithShadows:yi,labelPlaneMatrixInv:ns}},vi=Ze.icon.segments.get().length,Dt=Ze.text.segments.get().length,Jt=vi&&!m.onlyText?Kt():null,Qt=Dt&&!m.onlyIcons?ti():null,ni=n.paint.get("icon-opacity").constantOr(1),kt=n.paint.get("text-opacity").constantOr(1);if(Ie&&Ze.canOverlap){xe=!0;const di=ni&&!m.onlyText?Ze.icon.segments.get():[],ii=kt&&!m.onlyIcons?Ze.text.segments.get():[];for(const Vi of di)_e.push({segments:new o.bd([Vi]),sortKey:Vi.sortKey,state:Jt});for(const Vi of ii)_e.push({segments:new o.bd([Vi]),sortKey:Vi.sortKey,state:Qt})}else m.onlyText||_e.push({segments:ni?Ze.icon.segments:new o.bd([]),sortKey:0,state:Jt}),m.onlyIcons||_e.push({segments:kt?Ze.text.segments:new o.bd([]),sortKey:0,state:Qt})}xe&&_e.sort(((Re,Le)=>Re.sortKey-Le.sortKey));for(const Re of _e){const Le=Re.state;if(Le)if(l.terrain?l.terrain.setupElevationDraw(Le.tile,Le.program,{useDepthForOcclusion:Y.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Le.labelPlaneMatrixInv}):l.setupDepthForOcclusion(Y.depthOcclusionForSymbolsAndCircles,Le.program),ee.activeTexture.set(ie.TEXTURE0),Le.atlasTexture&&Le.atlasTexture.bind(Le.atlasInterpolation,ie.CLAMP_TO_EDGE,!0),Le.atlasTextureIcon&&(ee.activeTexture.set(ie.TEXTURE1),Le.atlasTextureIcon&&Le.atlasTextureIcon.bind(Le.atlasInterpolationIcon,ie.CLAMP_TO_EDGE,!0)),Le.renderWithShadows&&l.shadowRenderer.setupShadows(Le.tile.tileID.toUnwrapped(),Le.program,"vector-tile"),l.uploadCommonLightUniforms(l.context,Le.program),Le.hasHalo){const Ze=Le.uniformValues;Ze.u_is_halo=1,Ks(Le.buffers,Re.segments,n,l,Le.program,Le.depthMode,d,f,Ze,2),Ze.u_is_halo=0}else{if(Le.isSDF){const Ze=Le.uniformValues;Le.hasHalo&&(Ze.u_is_halo=1,Ks(Le.buffers,Re.segments,n,l,Le.program,Le.depthMode,d,f,Ze,1)),Ze.u_is_halo=0}Ks(Le.buffers,Re.segments,n,l,Le.program,Le.depthMode,d,f,Le.uniformValues,1)}}}function Ks(l,t,n,c,d,f,m,y,x,T){const S=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,f,m,y,mt.disabled,x,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,c.transform.zoom,l.programConfigurations.get(n.id),S,T)}function xl(l,t){const n=1<<l.canonical.z,c=(t.x*n-l.canonical.x-l.wrap*n)*o.aj,d=(t.y*n-l.canonical.y)*o.aj,f=o.e2(t.z,t.y);return o.d2(c,d,f)}function rt(l,t,n,c,d){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const f=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(C){const D=o.cU(C.pitch);let z=.01;return C.isOrthographic&&(z=o.ai(1e-4,z,o.cZ(D>=Tr?1:D/Tr))),2*z})(l.transform),T=l.transform.getFreeCameraOptions().position,S="elevatedStructuresDepthReconstruct",M=l.getOrCreateProgram(S,{defines:["DEPTH_RECONSTRUCTION"]}),E=l.getOrCreateProgram(S);for(const C of c){const D=t.getTile(C),z=D.getBucket(n);if(!z)continue;const F=z.elevatedStructures;if(!F)continue;const L=z.elevationBufferData.heightRange,N=xl(C.toUnwrapped(),T),j=l.translatePosMatrix(C.projMatrix,D,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));let q,X,ee,ie;if(d==="initialize"){if(!L||L.min>=1||F.depthSegments.segments[0].primitiveLength===0)continue;q=wc(j,N,x,1,0),X=m,ee=F.depthSegments,ie=M}else if(d==="reset"){if(!L||L.min>=0||F.maskSegments.segments[0].primitiveLength===0)continue;q=wc(j,N,0,0,1),X=y,ee=F.maskSegments,ie=M}else if(d==="geometry"){if(F.depthSegments.segments[0].primitiveLength===0)continue;q=wc(j,N,x,1,0),X=m,ee=F.depthSegments,ie=E}ie.draw(l,f.TRIANGLES,X,xt.disabled,Pt.disabled,mt.disabled,q,n.id,F.vertexBuffer,F.indexBuffer,ee,n.paint,l.transform.zoom)}}function Mc(l,t,n){const{painter:c,sourceCache:d,layer:f,coords:m,colorMode:y,elevationType:x,terrainEnabled:T,pass:S}=l,M=c.context.gl,E=f.paint.get("fill-pattern"),C=f.paint.get("fill-pattern-cross-fade"),D=E.constantOr(null);let z=x;x!=="road"||t&&!T||(z="none");const F=z==="road",L=l.painter.shadowRenderer,N=F&&!!L&&L.enabled,j=new it(c.context.gl.LEQUAL,it.ReadOnly,c.depthRangeFor3D);let q=[0,0,0];if(N){const ie=c.style.directionalLight,Y=c.style.ambientLight;ie&&Y&&(q=wo(c.style,ie,Y))}const X=E&&E.constantOr(1),ee=(ie,Y)=>{let K,J,pe,oe,Ie;Y?(K=X&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",pe=M.LINES):(K=X?"fillPattern":"fill",pe=M.TRIANGLES);for(const xe of m){const Me=d.getTile(xe);if(X&&!Me.patternsLoaded())continue;const Ue=Me.getBucket(f);if(!Ue)continue;const me=t?Ue.elevationBufferData:Ue.bufferData;if(me.isEmpty())continue;c.prepareDrawTile();const se=me.programConfigurations.get(f.id),we=c.isTileAffectedByFog(xe),_e=[],ze=[];F&&(_e.push("ELEVATED_ROADS"),ze.push(me.elevatedLayoutVertexBuffer)),N&&_e.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),X&&(c.context.activeTexture.set(M.TEXTURE0),Me.imageAtlasTexture&&Me.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),se.updatePaintBuffers());let Re=!1;if(D&&Me.imageAtlas){const Qe=Me.imageAtlas,ht=o.dZ.from(D),lt=ht.getPrimary().scaleSelf(o.q.devicePixelRatio).toString(),wt=ht.getSecondary(),At=Qe.patternPositions.get(lt),Ot=wt?Qe.patternPositions.get(wt.scaleSelf(o.q.devicePixelRatio).toString()):null;Re=!!At&&!!Ot,At&&se.setConstantPatternPositions(At,Ot)}C>0&&(Re||se.getPatternTransitionVertexBuffer("fill-pattern"))&&_e.push("FILL_PATTERN_TRANSITION");const Le=c.getOrCreateProgram(K,{config:se,overrideFog:we,defines:_e}),Ze=c.translatePosMatrix(xe.projMatrix,Me,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));N&&L.setupShadows(Me.tileID.toUnwrapped(),Le,"vector-tile");const at=f.paint.get("fill-emissive-strength");if(Y){oe=me.lineIndexBuffer,Ie=me.lineSegments;const Qe=c.terrain&&c.terrain.renderingToTexture?c.terrain.drapeBufferSize:[M.drawingBufferWidth,M.drawingBufferHeight];J=K==="fillOutlinePattern"&&X?Cp(Ze,at,c,Me,Qe,q,C):Mp(Ze,at,Qe,q)}else oe=me.indexBuffer,Ie=me.triangleSegments,J=X?Bd(Ze,at,c,Me,q,C):kd(Ze,at,q);c.uploadCommonUniforms(c.context,Le,xe.toUnwrapped());let dt=ie;(x==="road"&&!T||x==="offset")&&(dt=j),Le.draw(c,pe,dt,n||c.stencilModeForClipping(xe),y,mt.disabled,J,f.id,me.layoutVertexBuffer,oe,Ie,f.paint,c.transform.zoom,se,ze)}};c.renderPass===S&&ee(c.depthModeForSublayer(1,c.renderPass==="opaque"?it.ReadWrite:it.ReadOnly),!1),z==="none"&&c.renderPass==="translucent"&&f.paint.get("fill-antialias")&&ee(c.depthModeForSublayer(f.getPaintProperty("fill-outline-color")?2:0,it.ReadOnly),!0)}function vl(l,t,n,c,d,f,m,y){n.resetLayerRenderingStats(l);const x=l.context,T=x.gl,S=l.transform,M=n.paint.get("fill-extrusion-pattern"),E=n.paint.get("fill-extrusion-pattern-cross-fade"),C=M.constantOr(null),D=M.constantOr(1),z=n.paint.get("fill-extrusion-opacity"),F=l.style.enable3dLights(),L=n.paint.get(F&&!D?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),N=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),L],j=n.layout.get("fill-extrusion-edge-radius"),q=j>0&&!n.paint.get("fill-extrusion-rounded-roof"),X=q?0:j,ee=S.projection.name==="globe"?o.e5():0,ie=S.projection.name==="globe",Y=ie?o.ah(S.zoom):0,K=[o.aD(S.center.lng),o.aH(S.center.lat)],J=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",pe=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(J?null:n.lut).toArray01().slice(0,3),oe=n.paint.get("fill-extrusion-flood-light-intensity"),Ie=n.paint.get("fill-extrusion-vertical-scale"),xe=n.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Me=n.paint.get("fill-extrusion-height-alignment"),Ue=n.paint.get("fill-extrusion-base-alignment"),me=Qn(l,n.paint.get("fill-extrusion-cutoff-fade-range")),se=[];let we;ie&&se.push("PROJECTION_GLOBE_VIEW"),N[0]>0&&se.push("FAUX_AO"),q&&se.push("ZERO_ROOF_RADIUS"),y&&se.push("HAS_CENTROID"),oe>0&&se.push("FLOOD_LIGHT"),me.shouldRenderCutoff&&se.push("RENDER_CUTOFF"),xe&&se.push("RENDER_WALL_MODE");const _e=l.renderPass==="shadow",ze=l.shadowRenderer,Re=_e&&!!ze,Le=_e?mt.disabled:mt.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let Ze=[0,0,0];if(ze){const Qe=l.style.directionalLight,ht=l.style.ambientLight;Qe&&ht&&(Ze=wo(l.style,Qe,ht)),_e||(se.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ze.useNormalOffset&&se.push("NORMAL_OFFSET")),we=se.concat(["SHADOWS_SINGLE_CASCADE"])}const at=Re?"fillExtrusionDepth":D?"fillExtrusionPattern":"fillExtrusion",dt=n.getLayerRenderingStats();for(const Qe of c){const ht=t.getTile(Qe),lt=ht.getBucket(n);if(!lt||lt.projection.name!==S.projection.name)continue;let wt=!1;ze&&(wt=ze.getMaxCascadeForTile(Qe.toUnwrapped())===0);const At=l.isTileAffectedByFog(Qe),Ot=lt.programConfigurations.get(n.id);let Yt=!1;if(C&&ht.imageAtlas){const Qt=ht.imageAtlas,ni=o.dZ.from(C),kt=ni.getPrimary().scaleSelf(o.q.devicePixelRatio).toString(),di=ni.getSecondary(),ii=Qt.patternPositions.get(kt),Vi=di?Qt.patternPositions.get(di.scaleSelf(o.q.devicePixelRatio).toString()):null;Yt=!!ii&&!!Vi,ii&&Ot.setConstantPatternPositions(ii,Vi)}E>0&&(Yt||Ot.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&se.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Et=l.getOrCreateProgram(at,{config:Ot,defines:wt?we:se,overrideFog:At});if(l.terrain&&l.terrain.setupElevationDraw(ht,Et,{useMeterToDem:!0}),!lt.centroidVertexBuffer){const Qt=Et.attributes.a_centroid_pos;Qt!==void 0&&T.vertexAttrib2f(Qt,0,0)}!_e&&ze&&ze.setupShadows(ht.tileID.toUnwrapped(),Et,"vector-tile"),D&&(l.context.activeTexture.set(T.TEXTURE0),ht.imageAtlasTexture&&ht.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Ot.updatePaintBuffers());const Kt=n.paint.get("fill-extrusion-vertical-gradient"),ti=1/lt.tileToMeter;let vi;if(_e&&ze){if(Cc(ht.tileID,lt.maxHeight,l))continue;const Qt=ze.calculateShadowPassMatrixFromTile(ht.tileID.toUnwrapped());vi=Od(Qt,X,ti,Ie,Me,Ue)}else{const Qt=l.translatePosMatrix(Qe.expandedProjMatrix,ht,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ni=S.projection.createInversionMatrix(S,Qe.canonical);vi=D?ca(Qt,l,Kt,z,N,X,ti,Qe,ht,ee,Me,Ue,Y,K,ni,pe,Ie,E):Uh(Qt,l,Kt,z,N,X,ti,Qe,ee,Me,Ue,Y,K,ni,pe,Ie,oe,Ze)}l.uploadCommonUniforms(x,Et,Qe.toUnwrapped(),null,me);let Dt=lt.segments;if(S.projection.name==="mercator"&&!_e&&(Dt=lt.getVisibleSegments(ht.tileID,l.terrain,l.transform.getFrustum(0)),!Dt.get().length))continue;if(dt)if(_e)for(const Qt of Dt.get())dt.numRenderedVerticesInShadowPass+=Qt.primitiveLength;else for(const Qt of Dt.get())dt.numRenderedVerticesInTransparentPass+=Qt.primitiveLength;const Jt=[];(l.terrain||y)&&Jt.push(lt.centroidVertexBuffer),ie&&Jt.push(lt.layoutVertexExtBuffer),xe&&Jt.push(lt.wallVertexBuffer),Et.draw(l,x.gl.TRIANGLES,d,f,m,Le,vi,n.id,lt.layoutVertexBuffer,lt.indexBuffer,Dt,n.paint,l.transform.zoom,Ot,Jt)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}class bs{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function an(l,t,n,c,d,f,m,y,x,T,S,M,E,C,D,z,F,L,N,j){const q=t.context,X=q.gl,ee=t.transform,ie=t.transform.zoom,Y=[],K=l.translate,J=l.translateAnchor,pe=l.edgeRadius,oe=Qn(t,l.cutoffFadeRange);S==="clear"?(Y.push("CLEAR_SUBPASS"),j&&(Y.push("CLEAR_FROM_TEXTURE"),q.activeTexture.set(X.TEXTURE0),j.bind(X.LINEAR,X.CLAMP_TO_EDGE))):S==="sdf"&&Y.push("SDF_SUBPASS"),L&&Y.push("HAS_CENTROID"),oe.shouldRenderCutoff&&Y.push("RENDER_CUTOFF");const Ie=(xe,Me,Ue,me,se)=>{const we=Me.programConfigurations.get(c.id),_e=t.isTileAffectedByFog(xe),ze=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:we,defines:Y,overrideFog:_e}),Re=((Ze,at,dt,Qe,ht,lt,wt,At,Ot,Yt,Et)=>({u_matrix:at,u_opacity:dt,u_ao_pass:Qe?1:0,u_meter_to_tile:ht,u_ao:lt,u_flood_light_intensity:wt,u_flood_light_color:At,u_attenuation:Ot,u_edge_radius:Yt,u_fb:0,u_fb_size:Et,u_dynamic_offset:1}))(0,me,M,T,se,[E,C*se],D,z,F,ie>=17?0:pe*se,j?j.size[0]:0),Le=[];L&&Le.push(Me.hiddenByLandmarkVertexBuffer),t.uploadCommonUniforms(q,ze,xe.toUnwrapped(),null,oe),ze.draw(t,q.gl.TRIANGLES,f,m,y,x,Re,c.id,Me.vertexBuffer,Me.indexBuffer,Ue,c.paint,ie,we,Le)};for(const xe of d){const Me=n.getTile(xe),Ue=Me.getBucket(c);if(!Ue||Ue.projection.name!==ee.projection.name||!Ue.groundEffect||Ue.groundEffect&&!Ue.groundEffect.hasData())continue;const me=Ue.groundEffect,se=1/Ue.tileToMeter;{const we=t.translatePosMatrix(xe.projMatrix,Me,K,J),_e=me.getDefaultSegment();Ie(xe,me,_e,we,se)}if(N)for(let we=0;we<4;we++){const _e=o.e3[we](xe),ze=n.getTile(_e);if(!ze)continue;const Re=ze.getBucket(c);if(!Re||Re.projection.name!==ee.projection.name||!Re.groundEffect||Re.groundEffect&&!Re.groundEffect.hasData())continue;const Le=Re.groundEffect;let Ze,at;we===0?(Ze=[-o.aj,0,0],at=1):we===1?(Ze=[o.aj,0,0],at=0):we===2?(Ze=[0,-o.aj,0],at=3):(Ze=[0,o.aj,0],at=2);const dt=Le.regionSegments[at];if(!dt)continue;const Qe=new Float32Array(16);o.bo(Qe,xe.projMatrix,Ze),Ie(xe,Le,dt,t.translatePosMatrix(Qe,Me,K,J),se)}}}
2760function gt(l,t,n,c,d,f,m){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const y=f?f.findDEMTileFor(n):null;if(!(y&&y.dem||m))return;f&&y&&y.dem&&c.selfDEMTileTimestamp!==y.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=y.dem._timestamp);const x=L=>new o.P(Math.ceil((L+o.e7)*o.e8),0),T=L=>{const N=t.getSource().minzoom,j=X=>{const ee=t.getTileByID(X);if(ee&&ee.hasData())return ee.getBucket(d)},q=[0,-1,1];for(const X of q){if(L.overscaledZ+X<N)continue;const ee=j(L.calculateScaledKey(L.overscaledZ+X));if(ee)return ee}},S=[0,0,0],M=(L,N)=>(S[0]=Math.min(L.min.y,N.min.y),S[1]=Math.max(L.max.y,N.max.y),S[2]=o.aj-N.min.x>L.max.x?N.min.x-o.aj:L.max.x,S),E=(L,N)=>(S[0]=Math.min(L.min.x,N.min.x),S[1]=Math.max(L.max.x,N.max.x),S[2]=o.aj-N.min.y>L.max.y?N.min.y-o.aj:L.max.y,S),C=[(L,N)=>M(L,N),(L,N)=>M(N,L),(L,N)=>E(L,N),(L,N)=>E(N,L)],D=(L,N,j,q,X,ee,ie)=>{if(!f)return 0;const Y=[[ee?j:L,ee?L:j,0],[ee?j:N,ee?N:j,0]],K=ie<0?o.aj+ie:ie,J=[ee?K:(L+N)/2,ee?(L+N)/2:K,0];return j===0&&ie<0||j!==0&&ie>0?f.getForTilePoints(X,[J],!0,q):Y.push(J),f.getForTilePoints(n,Y,!0,y),Math.max(Y[0][2],Y[1][2],J[2])/f.exaggeration()};for(let L=0;L<4;L++){const N=c.borderFeatureIndices[L];if(N.length===0)continue;const j=o.e3[L](n),q=T(j);if(!(q&&q instanceof o.e4))continue;const X=f?f.findDEMTileFor(j):null;if(!(X&&X.dem||m)||(f&&X&&X.dem&&c.borderDEMTileTimestamp[L]!==X.dem._timestamp&&(c.borderDoneWithNeighborZ[L]=-1,c.borderDEMTileTimestamp[L]=X.dem._timestamp),c.borderDoneWithNeighborZ[L]===q.canonical.z))continue;q.centroidVertexArray.length===0&&q.createCentroidsBuffer();const ee=(L<2?1:5)-L,ie=q.borderDoneWithNeighborZ[ee]!==c.canonical.z,Y=q.borderFeatureIndices[ee];let K=0;if(c.canonical.z!==q.canonical.z){for(const J of N)c.showCentroid(c.featuresOnBorder[J]);if(ie)for(const J of Y)q.showCentroid(q.featuresOnBorder[J]);c.borderDoneWithNeighborZ[L]=q.canonical.z,q.borderDoneWithNeighborZ[ee]=c.canonical.z}for(const J of N){const pe=c.featuresOnBorder[J],oe=c.centroidData[pe.centroidDataIndex],Ie=pe.borders[L];let xe;for(;K<Y.length;){xe=q.featuresOnBorder[Y[K]];const Me=xe.borders[ee];if(Me[1]>Ie[0]+3||Me[0]>Ie[0]-3)break;q.showCentroid(xe),K++}if(xe&&K<Y.length){const Me=K;let Ue=0;for(;!(xe.borders[ee][0]>Ie[1]-3)&&(Ue++,++K!==Y.length);)xe=q.featuresOnBorder[Y[K]];xe=q.featuresOnBorder[Y[Me]];let me=!1;if(Ue>=1){const _e=xe.borders[ee];Math.abs(Ie[0]-_e[0])<3&&Math.abs(Ie[1]-_e[1])<3&&(Ue=1,me=!0,K=Me+1)}else if(Ue===0){c.showCentroid(pe);continue}const se=q.centroidData[xe.centroidDataIndex];m&&me&&(((z=oe).flags|(F=se).flags)&o.e6?(z.flags|=o.e6,F.flags|=o.e6):(z.flags&=~o.e6,F.flags&=~o.e6));const we=pe.intersectsCount()>1||xe.intersectsCount()>1;if(Ue>1)K=Me,oe.centroidXY=se.centroidXY=new o.P(0,0);else if(X&&X.dem&&!we){const _e=C[L](oe,se),ze=L%2?o.aj-1:0,Re=D(_e[0],Math.min(o.aj-1,_e[1]),ze,X,j,L<2,_e[2]);oe.centroidXY=se.centroidXY=x(Re)}else we?oe.centroidXY=se.centroidXY=new o.P(0,0):(oe.centroidXY=c.encodeBorderCentroid(pe),se.centroidXY=q.encodeBorderCentroid(xe));c.writeCentroidToBuffer(oe),q.writeCentroidToBuffer(se)}else c.showCentroid(pe)}c.borderDoneWithNeighborZ[L]=q.canonical.z,q.borderDoneWithNeighborZ[ee]=c.canonical.z}var z,F;(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const Qh=[1,0,0],zp=[0,1,0],Rp=[0,0,1];function Cc(l,t,n){const c=n.transform,d=n.shadowRenderer;if(!d)return!0;const f=l.toUnwrapped(),m=c.tileSize*d._cascades[n.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(f,y,m,x);if(!T)return!1;const S=[Qh,zp,Rp,x,[x[0],0,x[2]],[0,x[1],x[2]]],M=c.projection.name==="globe",E=c.scaleZoom(m),C=o.cy.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,E,!M),D=d.getCurrentCascadeFrustum();return C.intersectsPrecise(T.vertices,T.planes,S)===0||D.intersectsPrecise(T.vertices,T.planes,S)===0}function Pc(l){const{painter:t,source:n,layer:c,coords:d}=l,f=l.defines,m=t.context,y=t.renderPass==="shadow",x=t.renderPass==="light-beam",T=t.shadowRenderer;let S;T&&(S=f.concat(["SHADOWS_SINGLE_CASCADE"]));const M=o.e9(t.transform.center.lat,t.transform.zoom);for(const E of d){const C=n.getTile(E),D=C.getBucket(c);if(!D)continue;let z=!1;T&&(z=T.getMaxCascadeForTile(E.toUnwrapped())===0);const F=D.programConfigurations.get(c.id);let L,N,j=t.translatePosMatrix(E.expandedProjMatrix,C,[0,0],"map");if(j=o.cP(o.bz(),j,[1,1,l.verticalScale]),y&&T){if(Cc(C.tileID,D.maxHeight*M,t))continue;let q=T.calculateShadowPassMatrixFromTile(C.tileID.toUnwrapped());q=o.cP(o.bz(),q,[1,1,l.verticalScale]),N=Nd(q),L=t.getOrCreateProgram("buildingDepth",{config:F,defines:z?S:f,overrideFog:!1})}else if(x)L=t.getOrCreateProgram("buildingBloom",{config:F,defines:z?S:f,overrideFog:!1}),N=Gh(j);else{const q=t.transform.calculatePosMatrix(E.toUnwrapped(),t.transform.worldSize);o.cP(q,q,[1,1,l.verticalScale]);const X=o.bz();o.cP(X,q,[1,-1,1/M]),o.bi(X,X),o.ea(X,X),N=jh(j,X),L=t.getOrCreateProgram("building",{config:F,defines:z?S:f,overrideFog:!1}
vendor: 16,756 bytes, line 2760
2760),T&&T.setupShadowsFromMatrix(q,L,!0)}if(t.uploadCommonUniforms(m,L,E.toUnwrapped(),null,null),x){const q=D.bloomGeometry;L.draw(t,m.gl.TRIANGLES,l.depthMode,xt.disabled,l.blendMode,mt.disabled,N,c.id,q.layoutVertexBuffer,q.indexBuffer,q.segmentsBucket,c.paint,t.transform.zoom,F,[q.layoutAttenuationBuffer,q.layoutColorBuffer])}else L.draw(t,m.gl.TRIANGLES,l.depthMode,xt.disabled,l.blendMode,y?mt.disabled:mt.backCW,N,c.id,D.layoutVertexBuffer,D.indexBuffer,D.segments,c.paint,t.transform.zoom,F,[D.layoutNormalBuffer,D.layoutColorBuffer])}}function Wd(l){return[l[0]*o.eb,l[1]*o.eb,l[2]*o.eb,0]}function zc(l,t,n,c,d,f,m,y,x){const T=c.getSource(),S=n.globeSharedBuffers;if(!S)return;let M,E,C;if(t&&(M=c.getTile(t)),T instanceof o.aP?(E=T.texture,C=o.dE(0,0,n.transform)):M&&t&&(E=M.texture,C=o.dE(t.canonical.z,t.canonical.x,n.transform)),!E||!C)return;l||(C=o.cP(o.bz(),C,[1,-1,1]));const D=n.context,z=D.gl,F=d.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,L=n.colorModeForDrapableLayerRenderPass(f),N=m.defines;N.push("GLOBE_POLES");const j=new it(z.LEQUAL,it.ReadWrite,n.depthRangeFor3D),q=Float32Array.from(n.transform.expandedFarZProjMatrix),X=Float32Array.from(o.bh(o.dD(new o.cA(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),D.activeTexture.set(z.TEXTURE0),E.bind(F,z.CLAMP_TO_EDGE),D.activeTexture.set(z.TEXTURE1),E.bind(F,z.CLAMP_TO_EDGE),"useMipmap"in E&&D.extTextureFilterAnisotropic&&n.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,D.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,D.extTextureFilterAnisotropicMax);const[ee,ie,Y,K]=t?S.getPoleBuffers(t.canonical.z,!1):S.getPoleBuffers(0,!0),J=d.paint.get("raster-elevation");let pe;l?(pe=ee,n.renderDefaultNorthPole=J!==0):(pe=ie,n.renderDefaultSouthPole=J!==0);const oe=Wd(m.mix),Ie=((Me,Ue,me,se,we,_e,ze,Re,Le,Ze,at,dt,Qe)=>Hh(Me,Ue,me,new Float32Array(16),new Float32Array(9),[0,0],se,[0,0],[0,0,0,0],1,{opacity:1,mix:0},_e,[0,0],Re,2,Ze,at,dt,1,0,Qe))(q,X,C,o.ah(n.transform.zoom),0,d,0,J,0,oe,m.offset,m.range,f),xe=n.getOrCreateProgram("raster",{defines:N});n.uploadCommonUniforms(D,xe,null),xe.draw(n,z.TRIANGLES,j,x,L,y,Ie,d.id,pe,Y,K)}function Dp(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,f=t+d;return[t,n,(f-d-t)/c,(f-t)/c]}function Lp(l,t,n,c){if(l)return t instanceof ks&&l instanceof qo?t.getTextureDescriptor(l,n,!0):{texture:l.texture,mix:Wd(c.mix),offset:c.offset,buffer:0,tileSize:1}}var fn=o.ec([{name:"a_index",type:"Int16",components:1}]);class eu{constructor(t,n,c,d){const f={width:c[0],height:c[1],data:null},m=t.gl;this.targetColorTexture=new o.T(t,f,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new o.T(t,f,m.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(n,d),this.lastInvalidatedAt=0}updateParticleTexture(t,n){if(this.particleTextureDimension===n.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=n.width*n.height;this.particleTexture0=new o.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new o.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1});const f=new o.ed;f.reserve(d);for(let m=0;m<d;m++)f.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(f,fn.members,!0),this.particleSegment=o.bd.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=n.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=o.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Wr(l,t,n){if(!l)return null;const c=t.getTextureDescriptor(l,n,!0);if(!c)return null;let{texture:d,mix:f,offset:m,tileSize:y,buffer:x,format:T}=c;if(!d||!T)return null;let S=!1;return T==="uint32"&&(S=!0,f[3]=0,f=Tc(o.ee,f,[0,n.paint.get("raster-particle-max-speed")]),m=$s(o.ee,m,[0,n.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(y+2*x),y/(y+2*x)],tileSize:y,scalarData:S,scale:f,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function Js(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,f=t+d;return[t,n,(f-d-t)/c,(f-t)/c]}const Xd=new o.am(1,0,0,1),tu=new o.am(0,1,0,1),iu=new o.am(0,0,1,1),ru=new o.am(1,0,1,1),Yd=new o.am(0,1,1,1);function es(l,t,n,c,d,f){for(let m=0;m<n.length;m++)if(d){const T=new o.am(c.r*.8,c.g*.8,c.b*.8,1);pi(l,t,n[m],c,-1,-1,f),pi(l,t,n[m],c,-1,1,f),pi(l,t,n[m],c,1,1,f),pi(l,t,n[m],c,1,-1,f),pi(l,t,n[m],T,0,0,f)}else pi(l,t,n[m],c,0,0,f)}function pi(l,t,n,c,d,f,m){const y=l.context,x=l.transform,T=y.gl,S=x.projection.name==="globe",M=S?["PROJECTION_GLOBE_VIEW"]:[];let E=o.bw(n.projMatrix);if(S&&o.ah(x.zoom)>0){const oe=o.bg(n.canonical,x),Ie=o.ef(oe);E=o.az(new Float32Array(16),x.globeMatrix,Ie),o.az(E,x.projMatrix,E)}const C=o.bz();C[12]+=2*d/(o.q.devicePixelRatio*x.width),C[13]+=2*f/(o.q.devicePixelRatio*x.height),o.az(E,C,E);const D=l.getOrCreateProgram("debug",{defines:M}),z=t.getTileByID(n.key);l.terrain&&l.terrain.setupElevationDraw(z,D);const F=it.disabled,L=xt.disabled,N=l.colorModeForRenderPass(),j="$debug";y.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?z._makeGlobeTileDebugBuffers(l.context,x):z._makeDebugTileBoundsBuffers(l.context,x.projection);const q=z._tileDebugBuffer||l.debugBuffer,X=z._tileDebugIndexBuffer||l.debugIndexBuffer,ee=z._tileDebugSegments||l.debugSegments;if(D.draw(l,T.LINE_STRIP,F,L,N,mt.disabled,qh(E,c.toPremultipliedRenderColor(null)),j,q,X,ee,null,null,null,[z._globeTileDebugBorderBuffer]),m){const oe=z.latestRawTileData,Ie=Math.floor((oe&&oe.byteLength||0)/1024);let xe=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(xe+=` => ${n.overscaledZ}`),xe+=` ${z.state}`,xe+=` ${Ie}kb`,(function(Me,Ue){Me.initDebugOverlayCanvas();const me=Me.debugOverlayCanvas,se=Me.context.gl,we=Me.debugOverlayCanvas.getContext("2d");we.clearRect(0,0,me.width,me.height),we.shadowColor="white",we.shadowBlur=2,we.lineWidth=1.5,we.strokeStyle="white",we.textBaseline="top",we.font="bold 36px Open Sans, sans-serif",we.fillText(Ue,5,5),we.strokeText(Ue,5,5),Me.debugOverlayTexture.update(me),Me.debugOverlayTexture.bind(se.LINEAR,se.CLAMP_TO_EDGE)})(l,xe)}const ie=t.getTile(n).tileSize,Y=512/Math.min(ie,512)*(n.overscaledZ/x.zoom)*.5,K=z._tileDebugTextBuffer||l.debugBuffer,J=z._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,pe=z._tileDebugTextSegments||l.debugSegments;D.draw(l,T.TRIANGLES,F,L,Pt.alphaBlended,mt.disabled,qh(E,o.am.transparent.toPremultipliedRenderColor(null),Y),j,K,J,pe,null,null,null,[z._globeTileDebugTextBuffer])}function bl(l,t,n,c){wl(l,0,t+n/2,l.transform.width,n,c)}function Rc(l,t,n,c){wl(l,t-n/2,0,n,l.transform.height,c)}function wl(l,t,n,c,d,f){const m=l.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*o.q.devicePixelRatio,n*o.q.devicePixelRatio,c*o.q.devicePixelRatio,d*o.q.devicePixelRatio),m.clear({color:f}),y.disable(y.SCISSOR_TEST)}const Kd=o.ec([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Jd}=Kd;function Qs(l,t,n,c){l.emplaceBack(t,n,c)}class Po{constructor(t){this.vertexArray=new o.eg,this.indices=new o.a_,Qs(this.vertexArray,-1,-1,1),Qs(this.vertexArray,1,-1,1),Qs(this.vertexArray,-1,1,1),Qs(this.vertexArray,1,1,1),Qs(this.vertexArray,-1,-1,-1),Qs(this.vertexArray,1,-1,-1),Qs(this.vertexArray,-1,1,-1),Qs(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,Jd),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=o.bd.simpleSegment(0,0,36,12)}}function Wn(l,t,n,c,d,f){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"),S=((M,E,C,D,z)=>({u_matrix_3f:M,u_sun_direction:E,u_sun_intensity:C,u_color_tint_r:[D.r,D.g,D.b,D.a],u_color_tint_m:[z.r,z.g,z.b,z.a],u_luminance:5e-5}))(o.ei(o.dJ(),c),d,T,y.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+f,t.skyboxTexture,0),n.draw(l,m.TRIANGLES,it.disabled,xt.disabled,Pt.unblended,mt.frontCW,S,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const Ge=o.ec([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Je{constructor(t){const n=new o.ej;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);const c=new o.a_;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(n,Ge.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=o.bd.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const ua=o.ec([{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 Yi{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ue{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Pt([1,bo,1,bo],o.am.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Pt([1,0,1,0],o.am.transparent,[!1,!1,!1,!0]),this.params=new Yi,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0}))}update(t){const n=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Je(n);const c=this.params.sizeRange,d=this.params.intensityRange,f=(function(S){const M=o.el(30),E=[];for(let C=0;C<S;++C){const D=2*Math.PI*M(),z=Math.acos(1-2*M())-.5*Math.PI;E.push(o.d2(Math.cos(z)*Math.cos(D),Math.cos(z)*Math.sin(D),Math.sin(z)))}return E})(this.params.starsCount),m=o.el(300),y=new o.ek,x=new o.a_;let T=0;for(let S=0;S<f.length;++S){const M=o.c1([],f[S],200),E=Math.max(0,1+.01*c*(1*m()-.5)),C=Math.max(0,1+.01*d*(1*m()-.5));y.emplaceBack(M[0],M[1],M[2],-1,-1,E,C),y.emplaceBack(M[0],M[1],M[2],1,-1,E,C),y.emplaceBack(M[0],M[1],M[2],1,1,E,C),y.emplaceBack(M[0],M[1],M[2],-1,1,E,C),x.emplaceBack(T+0,T+1,T+2),x.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=n.createVertexBuffer(y,ua.members),this.starsIdx=n.createIndexBuffer(x),this.starsSegments=o.bd.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,n){const c=t.context,d=c.gl,f=t.transform,m=new it(d.LEQUAL,it.ReadOnly,[0,1]),y=o.ah(f.zoom),x=t.style.getLut(n.scope),T=n.properties.get("color-use-theme")==="none",S=n.properties.get("color").toNonPremultipliedRenderColor(T?null:x).toArray01(),M=n.properties.get("high-color-use-theme")==="none",E=n.properties.get("high-color").toNonPremultipliedRenderColor(M?null:x).toArray01(),C=n.properties.get("space-color-use-theme")==="none",D=n.properties.get("space-color").toNonPremultipliedRenderColor(C?null:x).toArray01(),z=5e-4,F=o.em(n.properties.get("horizon-blend"),0,1,z,.25),L=o.dy(t,c,f)&&F===z?f.worldSize/(2*Math.PI*1.025)-1:f.globeRadius,N=t.frameCounter/1e3%1,j=o.ae(f.globeCenterInViewSpace),q=Math.sqrt(Math.pow(j,2)-Math.pow(L,2)),X=Math.acos(q/j),ee=ie=>{const Y=f.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ie&&Y.push("ALPHA_PASS");const K=t.getOrCreateProgram("globeAtmosphere",{defines:Y}),J=((oe,Ie,xe,Me,Ue,me,se,we,_e,ze,Re,Le)=>({u_frustum_tl:oe,u_frustum_tr:Ie,u_frustum_br:xe,u_frustum_bl:Me,u_horizon:Ue,u_transition:me,u_fadeout_range:se,u_color:we,u_high_color:_e,u_space_color:ze,u_temporal_offset:Re,u_horizon_angle:Le}))(f.frustumCorners.TL,f.frustumCorners.TR,f.frustumCorners.BR,f.frustumCorners.BL,f.frustumCorners.horizon,y,F,S,E,D,N,X);t.uploadCommonUniforms(c,K);const pe=this.atmosphereBuffer;pe&&K.draw(t,d.TRIANGLES,m,xt.disabled,ie?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,mt.backCW,J,ie?"atmosphere_glow_alpha":"atmosphere_glow",pe.vertexBuffer,pe.indexBuffer,pe.segments)};ee(!1),ee(!0)}drawStars(t,n){const c=o.ay(n.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,f=d.gl,m=t.transform,y=t.getOrCreateProgram("stars"),x=o.c3([]);o.c5(x,x,-m._pitch),o.c4(x,x,-m.angle),o.c5(x,x,o.al(m._center.lat)),o.en(x,x,-o.al(m._center.lng));const T=o.c8(new Float32Array(16),x),S=o.az([],m.starsProjMatrix,T),M=o.ei([],T),E=o.eo([],M),C=[0,1,0];o.dL(C,C,E),o.c1(C,C,this.params.sizeMultiplier);const D=[1,0,0];o.dL(D,D,E),o.c1(D,D,this.params.sizeMultiplier);const z=(F=C,L=D,N=c,{u_matrix:Float32Array.from(S),u_up:F,u_right:L,u_intensity_multiplier:N});var F,L,N;t.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(t,f.TRIANGLES,it.disabled,xt.disabled,this.colorModeAlphaBlendedWriteRGB,mt.disabled,z,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Qd{constructor(){this.visibleTiles=[]}updateBorders(t,n){const c=[],d=[],f=t._getRenderableCoordinates(!1,!0);for(const x of f){const T=t.getTile(x);if(!T.hasData())continue;const S=T.getBucket(n);S&&(S.isEmpty()||(c.push(x.key),d.push({bucket:S,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,S=new Array,M=x.bucket;for(const E of M.featuresOnBorder)y.has(E.featureId)?S.push(E.footprintIndex):(y.add(E.featureId),T.push(E.footprintIndex));M.updateFootprintHiddenFlags(T,o.ep,!1),M.updateFootprintHiddenFlags(S,o.ep,!0)}}}function Tl(l,t){const n=[...l],c=t.cameraWorldSizeForFog/t.worldSize,d=o.bx([]);return o.cP(d,d,[c,c,1]),o.az(n,d,n),o.az(n,t.worldToFogMatrix,n),n}function Sl(l,t,n,c,d){const f=n.material,m=c.context,{baseColorTexture:y,metallicRoughnessTexture:x}=f.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:S,emissionTexture:M}=f;function E(D,z,F){if(D&&(l.push(z),m.activeTexture.set(m.gl.TEXTURE0+F),D.gfxTexture)){const{minFilter:L,magFilter:N,wrapS:j,wrapT:q}=D.sampler;D.gfxTexture.bindExtraParam(L,N,j,q)}}E(y,"HAS_TEXTURE_u_baseColorTexture",Zr.BaseColor),E(x,"HAS_TEXTURE_u_metallicRoughnessTexture",Zr.MetallicRoughness),E(T,"HAS_TEXTURE_u_normalTexture",Zr.Normal),E(S,"HAS_TEXTURE_u_occlusionTexture",Zr.Occlusion),E(M,"HAS_TEXTURE_u_emissionTexture",Zr.Emission),d&&(d.texture||(d.texture=new o.et(c.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+Zr.LUT),d.texture&&d.texture.bind(m.gl.LINEAR,m.gl.CLAMP_TO_EDGE),l.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(l.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(n.texcoordBuffer)),n.colorBuffer&&(l.push(n.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(n.colorBuffer)),n.normalBuffer&&(l.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(n.normalBuffer)),n.pbrBuffer&&(l.push("HAS_ATTRIBUTE_a_pbr"),l.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(n.pbrBuffer)),f.alphaMode!=="OPAQUE"&&f.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),f.defined||l.push("DIFFUSE_SHADED");const C=c.shadowRenderer;C&&(l.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&l.push("NORMAL_OFFSET"))}function da(l,t,n,c,d,f){const m=n.paint.get("model-opacity").constantOr(1),y=t.context,x=new it(t.context.gl.LEQUAL,it.ReadWrite,t.depthRangeFor3D),T=t.transform,S=l.mesh,M=S.material,E=M.pbrMetallicRoughness,C=t.style.fog;let D;D=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:o.az([],c.zScaleMatrix,l.nodeModelMatrix),o.az(D,c.negCameraPosMatrix,D);const z=o.bi([],D);o.ea(z,z);
2760const F=n.paint.get("model-color-use-theme").constantOr("default")==="none",L=n.paint.get("model-emissive-strength").constantOr(0),N=Zh(new Float32Array(l.worldViewProjection),new Float32Array(D),new Float32Array(z),null,t,m,E.baseColorFactor,M.emissiveFactor,E.metallicFactor,E.roughnessFactor,M,L,n),j={defines:[]},q=[],X=t.shadowRenderer;X&&(X.useNormalOffset=!1),Sl(j.defines,q,S,t,F?null:n.lut);let ee=null;if(C){const K=Tl(l.nodeModelMatrix,t.transform);if(ee=new Float32Array(K),T.projection.name!=="globe"){const J=S.aabb.min,pe=S.aabb.max,[oe,Ie]=C.getOpacityForBounds(K,J[0],J[1],pe[0],pe[1]);j.overrideFog=oe>=Pe||Ie>=Pe}}const ie=Qn(t,n.paint.get("model-cutoff-fade-range"));ie.shouldRenderCutoff&&j.defines.push("RENDER_CUTOFF");const Y=t.getOrCreateProgram("model",j);t.uploadCommonUniforms(y,Y,null,ee,ie),t.renderPass!=="shadow"&&X&&X.setupShadowsFromMatrix(l.nodeModelMatrix,Y),Y.draw(t,y.gl.TRIANGLES,x,d,f,S.material.doubleSided?mt.disabled:mt.backCCW,N,n.id,S.vertexBuffer,S.indexBuffer,S.segments,n.paint,t.transform.zoom,void 0,q)}function nu(l,t,n,c,d,f,m){let y;y=l.projection.name==="globe"?o.er(n,l):[...n],o.az(y,y,t.matrix);const x=o.az([],c,y);if(t.meshes)for(const T of t.meshes){if(T.material.alphaMode!=="BLEND"){m.push({mesh:T,depth:0,modelIndex:d,worldViewProjection:x,nodeModelMatrix:y});continue}const S=o.ad([],T.centroid,x);!l.isOrthographic&&S[2]<=0||f.push({mesh:T,depth:S[2],modelIndex:d,worldViewProjection:x,nodeModelMatrix:y})}if(t.children)for(const T of t.children)nu(l,T,n,c,d,f,m)}function Dc(l,t,n,c){const d=n.shadowRenderer;if(!d)return;const f=d.getShadowPassDepthMode(),m=d.getShadowPassColorMode(),y=d.calculateShadowPassMatrixFromMatrix(t),x=Hd(y);n.getOrCreateProgram("modelDepth",{defines:n._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(n,n.context.gl.TRIANGLES,f,xt.disabled,m,mt.backCCW,x,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,n.transform.zoom,void 0,void 0)}function fa(l,t,n){const c=t.updateZoomBasedPaintProperties(),d=(function(f,m,y){let x,T,S,M=f.terrain?f.terrain.exaggeration():0;if(f.terrain&&M>0){const E=f.terrain,C=E.findDEMTileFor(y);C&&C.dem?x=o.eu.create(E,y,C):M=0}if(M===0&&(m.terrainElevationMin=0,m.terrainElevationMax=0),M===m.validForExaggeration&&(M===0||x&&x._demTile&&x._demTile.tileID===m.validForDEMTile.id&&x._dem._timestamp===m.validForDEMTile.timestamp))return!1;for(const E in m.instancesPerModel){const C=m.instancesPerModel[E];for(let D=0;D<C.instancedDataArray.length;++D){const z=(x?M*x.getElevationAt(0|C.instancedDataArray.float32[16*D],0|C.instancedDataArray.float32[16*D+1],!0,!0):0)+C.instancesEvaluatedElevation[D];C.instancedDataArray.float32[16*D+6]=z,T=T?Math.min(m.terrainElevationMin,z):z,S=S?Math.max(m.terrainElevationMax,z):z}}return m.terrainElevationMin=T||0,m.terrainElevationMax=S||0,m.validForExaggeration=M,m.validForDEMTile=x&&x._demTile?{id:x._demTile.tileID,timestamp:x._dem._timestamp}:{id:void 0,timestamp:0},!0})(l,t,n);(c||d)&&(t.uploaded=!1,t.upload(l.context))}const ts={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new o.d6([0,0,0],[o.aj,o.aj,0])};function Fp(l,t){const n=1<<l.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,f=l.canonical.x/n,m=(l.canonical.x+1)/n,y=l.canonical.y/n,x=(l.canonical.y+1)/n;let T=t._centerAltitude;if(d){const C=d.getMinMaxForTile(l);C&&C.max>T&&(T=C.max)}const S=o.ay(c.x,f,m)-c.x,M=o.ay(c.y,y,x)-c.y,E=o.cb(T,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(S*S+M*M+E*E))}function su(l,t,n,c,d,f,m){const y=l.context,x=l.renderPass==="shadow",T=l.shadowRenderer,S=x&&T?T.getShadowPassDepthMode():new it(y.gl.LEQUAL,it.ReadWrite,l.depthRangeFor3D),M=l.isTileAffectedByFog(f);if(n.meshes)for(const E of n.meshes){const C=["MODEL_POSITION_ON_GPU"],D=[];let z,F,L;c.instancedDataArray.length>20&&C.push("INSTANCED_ARRAYS");const N=Qn(l,t.paint.get("model-cutoff-fade-range"));if(N.shouldRenderCutoff&&C.push("RENDER_CUTOFF"),x&&T)z=l.getOrCreateProgram("modelDepth",{defines:C}),F=Hd(m.shadowTileMatrix,m.shadowTileMatrix,Float32Array.from(n.matrix
2760)),L=T.getShadowPassColorMode();else{Sl(C,D,E,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),z=l.getOrCreateProgram("model",{defines:C,overrideFog:M});const q=E.material,X=q.pbrMetallicRoughness,ee=t.paint.get("model-opacity").constantOr(1),ie=t.paint.get("model-emissive-strength").constantOr(0);F=Zh(f.expandedProjMatrix,Float32Array.from(n.matrix),new Float32Array(16),null,l,ee,X.baseColorFactor,q.emissiveFactor,X.metallicFactor,X.roughnessFactor,q,ie,t,d),T&&(m.shadowUniformsInitialized?z.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(f.toUnwrapped(),z,"model-tile"),m.shadowUniformsInitialized=!0)),L=N.shouldRenderCutoff||ee<1||q.alphaMode!=="OPAQUE"?Pt.alphaBlended:Pt.unblended}l.uploadCommonUniforms(y,z,f.toUnwrapped(),null,N);const j=E.material.doubleSided?mt.disabled:mt.backCCW;if(c.instancedDataArray.length>20)D.push(c.instancedDataBuffer),z.draw(l,y.gl.TRIANGLES,S,xt.disabled,L,j,F,t.id,E.vertexBuffer,E.indexBuffer,E.segments,t.paint,l.transform.zoom,void 0,D,c.instancedDataArray.length);else{const q=x?"u_instance":"u_normal_matrix";for(let X=0;X<c.instancedDataArray.length;++X)F[q]=new Float32Array(c.instancedDataArray.arrayBuffer,64*X,16),z.draw(l,y.gl.TRIANGLES,S,xt.disabled,L,j,F,t.id,E.vertexBuffer,E.indexBuffer,E.segments,t.paint,l.transform.zoom,void 0,D)}}if(n.children)for(const E of n.children)su(l,t,E,c,d,f,m)}const Lc=[1,-1,1];function ou(l,t,n,c){if(!n.modelManager)return!0;const d=n.modelManager;if(!n.shadowRenderer)return!0;const f=n.shadowRenderer,m=t.aabb;let y=!0,x=l.maxHeight;if(x===0){let S=0;for(const M in l.instancesPerModel){const E=d.getModel(M,c);E?S=Math.max(S,Math.max(Math.max(E.aabb.max[0],E.aabb.max[1]),E.aabb.max[2])):y=!1}x=l.maxScale*S*1.41+l.maxVerticalOffset,y&&(l.maxHeight=x)}m.max[2]=x,m.min[2]+=l.terrainElevationMin,m.max[2]+=l.terrainElevationMax,o.ad(m.min,m.min,t.tileMatrix),o.ad(m.max,m.max,t.tileMatrix);const T=m.intersects(f.getCurrentCascadeFrustum());return n.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=T===2),T===0}function ef(l,t){const n=l.uniformValues.u_cutoff_params[0],c=l.uniformValues.u_cutoff_params[1],d=l.uniformValues.u_cutoff_params[2],f=l.uniformValues.u_cutoff_params[3];return c===n||f===d?1:o.ay(((t-n)/(c-n)-d)/(f-d),0,1)}function tf(l,t,n,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();o.az(d,d,l);const f=o.bR(n.min[0],n.min[1],n.min[2],1);let m=o.aA(o.ev(),f,d),y=m,x=m;f[1]=n.max[1],m=o.aA(o.ev(),f,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,f[0]=n.max[0],m=o.aA(o.ev(),f,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,f[1]=n.min[1],m=o.aA(o.ev(),f,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x;const T=o.ay(c[0],0,1),S=100*t.pixelsPerMeter*o.ay(c[1],0,1),M=o.ay(c[2],0,1),E=o.ew(o.ev(),y,x,T),C=Math.tan(.5*t.fovX),D=-E[2]*C;if(S===0)return E[1]<-Math.abs(D)?M:1;const z=(-Math.abs(D)-E[1])/S,F=(N,j,q)=>(1-q)*N+q*j,L=o.ay(F(1,M,z),M,1);return F(1,L,o.ay((t.pitch-20)/20,0,1))}class Fc{}class El{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,n,c){{const M=this._storage.get(n.id);if(M)return M.lastUsedFrameIdx=t,M.buf}const d=c.gl,f=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),m=new ArrayBuffer(f),y=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new o.ey;for(let M=0;M<f/2;M+=3){const E=y[M],C=y[M+1],D=y[M+2];x.emplaceBack(E,C),x.emplaceBack(C,D),x.emplaceBack(D,E)}const T=c.bindVertexArrayOES.current,S=new Fc;return S.buf=new Xs(c,x),S.lastUsedFrameIdx=t,this._storage.set(n.id,S),c.bindVertexArrayOES.set(T),S.buf}update(t){for(const[n,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(n))}destroy(){for(const[t,n]of this._storage)n.buf.destroy(),this._storage.delete(t)}}class pa{constructor(t){this.occluderSize=30,this.depthOffset=-1e-4,t.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),t.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const rf=o.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Op{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class Vr{constructor(t,n){this.revealStart=11,this.revealRange=2,t.registerParameter(this,[...n,"Reveal"],"revealStart",{min:0,max:17,step:.05}
vendor: 8,772 bytes, line 2760
2760),t.registerParameter(this,[...n,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const kp=o.ec([{type:"Float32",name:"a_pos_2f",components:2}]);class Il{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,n){const c=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const m=new o.ez,y=new o.a_;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,kp.members),this.vignetteIdx=t.context.createIndexBuffer(y)}const d=o.bd.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const m={u_vignetteShape:(f={vignetteShape:[n.start,n.range,Math.pow(10,n.fadePower)],vignetteColor:[n.color.r,n.color.g,n.color.b,n.color.a*n.strength]}).vignetteShape,u_vignetteColor:f.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var f}}class Ci{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,n){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),f=c.toLngLat(),m=o.al(f.lng),y=o.al(f.lat),x=t.pixelsPerMeter/n,T=m*o.eB,S=o.eB*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 M=-this._offsetYPrev+S,E=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*x,this._accumulatedOffsetY+=M*x,this._accumulatedElevation+=E*x,this._offsetXPrev=T,this._offsetYPrev=S,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function $t(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 au(l){const t=o.el(1323123451230),n=[];for(let c=0;c<l;++c){const d=2*t()-1,f=2*t()-1,m=2*t()-1;n.push(o.d2(d,f,m))}return n}function ln(l,t,n,c,d){const f=o.ay((d-n)/(c-n),0,1);return(1-f)*l+f*t}class ma{constructor(t){this._movement=new Ci,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Il,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,n){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const d=c.starsProjMatrix,f=o.c3([]);o.c5(f,f,o.al(90)-c._pitch),o.c4(f,f,-c.angle);const m=o.c8(new Float32Array(16),f),y=o.eA(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),x=o.ea([],y),T=o.az([],x,m),S=Date.now()/1e3;return this._accumulatedTimeFromStart+=(S-this._prevTime)*n,this._prevTime=S,{projectionMatrix:d,modelviewMatrix:T}}}class _a extends ma{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 Vr(t.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=au(this.particlesCount),d=new o.eC,f=new o.a_;let m=0;const y=o.el(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=[2*y()-1,y(),y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,1,...S),d.emplaceBack(T[0],T[1],T[2],-1,1,...S),f.emplaceBack(m+0,m+1,m+2),f.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=n.createVertexBuffer(d,rf.members),this.particlesIdx=n.createIndexBuffer(f)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const n=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},c=t.transform.zoom;if(n.revealStart>c)return;const d=ln(0,1,n.revealStart,n.revealStart+n.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const f=structuredClone(this._params);let m=[-f.direction.x,f.direction.y,-100];o.au(m,m);const y=structuredClone(this._vignetteParams);y.strength*=d,f.overrideStyleParameters||(f.intensity=t.style.rain.state.density,f.timeFactor=t.style.rain.state.intensity,f.color=structuredClone(t.style.rain.state.color),m=structuredClone(t.style.rain.state.direction),f.screenThinning.intensity=t.style.rain.state.centerThinning,f.dropletSizeX=t.style.rain.state.dropletSize[0],f.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],f.distortionStrength=100*t.style.rain.state.distortionStrength,y.strength=1,y.color=structuredClone(t.style.rain.state.vignetteColor));const x=this.updateOnRender(t,f.timeFactor),T=t.context,S=T.gl,M=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new o.T(T,{width:t.width,height:t.height,data:null},S.RGBA8)),f.distortionStrength>0&&(T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),S.copyTexSubImage2D(S.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const E=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(T,E),T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const C=[f.color.r,f.color.g,f.color.b,f.color.a],D=(z,F)=>{const L=$t(this._movement.getPosition(),z),N=f.dropletSizeX,j=f.dropletSizeX*f.dropletSizeYScale,q=t.width/2,X=t.height/2,ee=ln(0,f.screenThinning.start,0,1,f.screenThinning.intensity),ie=ln(.001,f.screenThinning.range,0,1,f.screenThinning.intensity),Y=ln(0,f.screenThinning.particleOffset,0,1,f.screenThinning.intensity),K=(J={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:L,velocityConeAperture:f.velocityConeAperture,velocity:f.velocity,boxSize:z,rainDropletSize:[N,j],distortionStrength:f.distortionStrength,rainDirection:m,color:C,screenSize:[M.width,M.height],thinningCenterPos:[q,X],thinningShape:[ee,ie,Math.pow(10,f.screenThinning.fadePower)],thinningAffectedRatio:f.screenThinning.affectedRatio,thinningParticleOffset:Y,shapeDirectionalPower:f.shapeDirPower,shapeNormalPower:f.shapeNormalPower,mode:F?0:1},{u_modelview:Float32Array.from(J.modelview),u_projection:Float32Array.from(J.projection),u_time:J.time,u_cam_pos:J.camPos,u_texScreen:0,u_velocityConeAperture:J.velocityConeAperture,u_velocity:J.velocity,u_boxSize:J.boxSize,u_rainDropletSize:J.rainDropletSize,u_distortionStrength:J.distortionStrength,u_rainDirection:J.rainDirection,u_color:J.color,u_screenSize:J.screenSize,u_thinningCenterPos:J.thinningCenterPos,u_thinningShape:J.thinningShape,u_thinningAffectedRatio:J.thinningAffectedRatio,u_thinningParticleOffset:J.thinningParticleOffset,u_shapeDirectionalPower:J.shapeDirectionalPower,u_shapeNormalPower:J.shapeNormalPower,u_mode:J.mode});var J;const pe=Math.round(f.intensity*this.particlesCount),oe=o.bd.simpleSegment(0,0,4*pe,2*pe);E.draw(t,S.TRIANGLES,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,K,"rain_particles",this.particlesVx,this.particlesIdx,oe)};f.distortionStrength>0&&D(f.boxSize,!0),D(f.boxSize,!1),this._vignette.draw(t,y)}}const zo=o.ec([{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 lu extends ma{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 Vr(t.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=au(this.particlesCount),d=new o.eD,f=new o.a_;let m=0;const y=o.el(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=y(),M=y(),E=y(),C=[x/c.length,S,M,E],D=[y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...C,...D),d.emplaceBack(T[0],T[1],T[2],1,-1,...C,...D),d.emplaceBack(T[0],T[1],T[2],1,1,...C,...D),d.emplaceBack(T[0],T[1],T[2],-1,1,...C,...D),f.emplaceBack(m+0,m+1,m+2),f.emplaceBack(m+0,m+2,m+3),m
2760+=4}this.particlesVx=n.createVertexBuffer(d,zo.members),this.particlesIdx=n.createIndexBuffer(f)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const n=structuredClone(this._params);let c=[-n.direction.x,n.direction.y,-100];o.au(c,c);const d=structuredClone(this._vignetteParams),f=n.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},m=t.transform.zoom;if(f.revealStart>m)return;const y=ln(0,1,f.revealStart,f.revealStart+f.revealRange,m);d.strength*=y,n.overrideStyleParameters||(n.intensity=t.style.snow.state.density,n.timeFactor=t.style.snow.state.intensity,n.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),n.screenThinning.intensity=t.style.snow.state.centerThinning,n.billboardSize=2.79*t.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(t.style.snow.state.vignetteColor));const x=this.updateOnRender(t,n.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=t.context,S=T.gl,M=t.transform,E=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(T,E),((C,D,z)=>{const F=$t(this._movement.getPosition(),C),L=M.width/2,N=M.height/2,j=ln(0,z.screenThinning.start,0,1,z.screenThinning.intensity),q=ln(.001,z.screenThinning.range,0,1,z.screenThinning.intensity),X=ln(0,z.screenThinning.particleOffset,0,1,z.screenThinning.intensity),ee=(ie={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:F,velocityConeAperture:z.velocityConeAperture,velocity:z.velocity,horizontalOscillationRadius:z.horizontalOscillationRadius,horizontalOscillationRate:z.horizontalOscillationRate,boxSize:C,billboardSize:1*z.billboardSize,simpleShapeParameters:[z.shapeFadeStart,z.shapeFadePower],screenSize:[M.width,M.height],thinningCenterPos:[L,N],thinningShape:[j,q,Math.pow(10,z.screenThinning.fadePower)],thinningAffectedRatio:z.screenThinning.affectedRatio,thinningParticleOffset:X,color:[z.color.r,z.color.g,z.color.b,z.color.a],direction:c},{u_modelview:Float32Array.from(ie.modelview),u_projection:Float32Array.from(ie.projection),u_time:ie.time,u_cam_pos:ie.camPos,u_velocityConeAperture:ie.velocityConeAperture,u_velocity:ie.velocity,u_horizontalOscillationRadius:ie.horizontalOscillationRadius,u_horizontalOscillationRate:ie.horizontalOscillationRate,u_boxSize:ie.boxSize,u_billboardSize:ie.billboardSize,u_simpleShapeParameters:ie.simpleShapeParameters,u_screenSize:ie.screenSize,u_thinningCenterPos:ie.thinningCenterPos,u_thinningShape:ie.thinningShape,u_thinningAffectedRatio:ie.thinningAffectedRatio,u_thinningParticleOffset:ie.thinningParticleOffset,u_particleColor:ie.color,u_direction:ie.direction});var ie;const Y=Math.round(z.intensity*this.particlesCount),K=o.bd.simpleSegment(0,0,4*Y,2*Y);this.particlesVx&&this.particlesIdx&&E.draw(t,S.TRIANGLES,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,ee,"snow_particles",this.particlesVx,this.particlesIdx,K)})(n.boxSize,0,n),this._vignette.draw(t,d)}}const cu={symbol:function(l,t,n,c,d){if(l.renderPass!=="translucent")return;const f=xt.disabled,m=l.colorModeForRenderPass(),y=n.layout.get("text-variable-anchor"),x=n.layout.get("text-size-scale-range"),T=o.ay(l.scaleFactor,x[0],x[1]);y&&(function(E,C,D,z,F,L,N,j){const q=C.transform,X=F==="map",ee=L==="map";for(const ie of E){const Y=z.getTile(ie),K=Y.getBucket(D);if(!K||!K.text||!K.text.segments.get().length)continue;const J=o.bH(K.textSizeData,q.zoom,j),pe=Yl(ie,K.getProjection(),q),oe=q.calculatePixelsToTileUnitsMatrix(Y),Ie=il(pe,Y.tileID.canonical,ee,X,q,K.getProjection(),oe),xe=K.hasIconTextFit()&&K.hasIconData();J&&Zd(K,X,ee,N,q,Ie,ie,Math.pow(2,q.zoom-Y.tileID.overscaledZ),J,xe)}})(c,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d,T);const S=n.paint.get("icon-opacity").constantOr(1)!==0,M=n.paint.get("text-opacity").constantOr(1)!==0;n.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(S||M)?Jh(l,t,n,c,f,m):(S&&Jh(l,t,n,c,f,m,{onlyIcons:!0}),M&&Jh(l,t,n,c,f,m,{onlyText:!0})),t.map.showCollisionBoxes&&(Yh(l,t,n,c,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Yh(l,t,n,c,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("circle-opacity"),f=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),y=n.layout.get("
vendor: 7,193 bytes, line 2760
2760circle-sort-key").constantOr(1)!==void 0,x=n.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(f.constantOr(1)===0||m.constantOr(1)===0))return;const T=l.context,S=T.gl,M=l.transform,E=!(!l.terrain||!l.terrain.enabled),C=n.layout.get("circle-elevation-reference"),D=l.depthModeForSublayer(0,it.ReadOnly),z=new it(l.context.gl.LEQUAL,it.ReadOnly,l.depthRangeFor3D),F=C==="none"||E?D:z,L=xt.disabled,N=l.colorModeForDrapableLayerRenderPass(x),j=M.projection.name==="globe",q=[o.aD(M.center.lng),o.aH(M.center.lat)],X=[];for(let ie=0;ie<c.length;ie++){const Y=c[ie],K=t.getTile(Y),J=K.getBucket(n);if(!J||J.projection.name!==M.projection.name)continue;const pe=J.programConfigurations.get(n.id),oe=J.layoutVertexBuffer,Ie=J.globeExtVertexBuffer,xe=J.indexBuffer,Me=o.dW(n),Ue=[Ie],me=l.isTileAffectedByFog(Y);j&&Me.push("PROJECTION_GLOBE_VIEW"),Me.push("DEPTH_D24"),l.terrain&&M.depthOcclusionForSymbolsAndCircles&&Me.push("DEPTH_OCCLUSION"),J.hasElevation&&!l.terrain&&(Me.push("ELEVATED_ROADS"),Ue.push(J.elevatedLayoutVertexBuffer));const se=l.getOrCreateProgram("circle",{config:pe,defines:Me,overrideFog:me}),we=M.projection.createInversionMatrix(M,Y.canonical),_e={programConfiguration:pe,program:se,layoutVertexBuffer:oe,dynamicBuffers:Ue,indexBuffer:xe,uniformValues:o.dX(l,Y,K,we,q,n),tile:K};if(y){const ze=J.segments.get();for(const Re of ze)X.push({segments:new o.bd([Re]),sortKey:Re.sortKey,state:_e})}else X.push({segments:J.segments,sortKey:0,state:_e})}y&&X.sort(((ie,Y)=>ie.sortKey-Y.sortKey));const ee={useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles};for(const ie of X){const{programConfiguration:Y,program:K,layoutVertexBuffer:J,dynamicBuffers:pe,indexBuffer:oe,uniformValues:Ie,tile:xe}=ie.state,Me=ie.segments;l.terrain&&l.terrain.setupElevationDraw(xe,K,ee),l.uploadCommonUniforms(T,K,xe.tileID.toUnwrapped()),K.draw(l,S.TRIANGLES,F,L,N,mt.disabled,Ie,n.id,J,oe,Me,n.paint,M.zoom,Y,pe)}},heatmap:function(l,t,n,c){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const d=l.context,f=d.gl,m=xt.disabled,y=new Pt([f.ONE,f.ONE,f.ONE,f.ONE],o.am.transparent,[!0,!0,!0,!0]);(function(C,D,z,F){const L=C.gl,N=D.width*F,j=D.height*F;C.activeTexture.set(L.TEXTURE1),C.viewport.set([0,0,N,j]);let q=z.heatmapFbo;if(!q||q&&(q.width!==N||q.height!==j)){q&&q.destroy();const X=L.createTexture();L.bindTexture(L.TEXTURE_2D,X),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,L.LINEAR),q=z.heatmapFbo=C.createFramebuffer(N,j,!0,null),(function(ee,ie,Y,K,J,pe){const oe=ee.gl;oe.texImage2D(oe.TEXTURE_2D,0,ee.extRenderToTextureHalfFloat?oe.RGBA16F:oe.RGBA,J,pe,0,oe.RGBA,ee.extRenderToTextureHalfFloat?oe.HALF_FLOAT:oe.UNSIGNED_BYTE,null),K.colorAttachment.set(Y)})(C,0,X,q,N,j)}else L.bindTexture(L.TEXTURE_2D,q.colorAttachment.get()),C.bindFramebuffer.set(q.framebuffer)})(d,l,n,l.transform.projection.name==="globe"?.5:.25),d.clear({color:o.am.transparent});const x=l.transform,T=x.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],M=T?mt.frontCCW:mt.disabled,E=[o.aD(x.center.lng),o.aH(x.center.lat)];for(let C=0;C<c.length;C++){const D=c[C];if(t.hasRenderableParent(D))continue;const z=t.getTile(D),F=z.getBucket(n);if(!F||F.projection.name!==x.projection.name)continue;const L=l.isTileAffectedByFog(D),N=F.programConfigurations.get(n.id),j=l.getOrCreateProgram("heatmap",{config:N,defines:S,overrideFog:L}),{zoom:q}=l.transform;l.terrain&&l.terrain.setupElevationDraw(z,j),l.uploadCommonUniforms(d,j,D.toUnwrapped());const X=x.projection.createInversionMatrix(x,D.canonical);j.draw(l,f.TRIANGLES,it.disabled,m,y,M,Ud(l,D,z,X,E,q,n.paint.get("heatmap-intensity")),n.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,n.paint,l.transform.zoom,N,T?[F.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),(function(d,f){const m=d.context,y=m.gl,x=f.heatmapFbo;if(!x)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,x.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1);let T=f.colorRampTexture;T||(T=f.colorRampTexture=new o.T(m,f.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,it.disabled,xt.disabled,d.colorModeForRenderPass(),mt.disabled,((S,M,E,C)=>({u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}))(0,f),f.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,f.paint,d.transform.zoom)})(l,n))},line:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("line-opacity"),f=n.paint.get("line-width");if(d.constantOr(1)===0||f.constantOr(1)===0)return;const m=n.paint.get("line-emissive-strength"),y=n.paint.get("line-occlusion-opacity"),x=n.layout.get("line-elevation-reference"),T=n.layout.get("line-width-unit")==="meters",S=x==="sea",M=!(!l.terrain||!l.terrain.enabled),E=l.context,C=E.gl;if(n.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const D=n.layout.get("line-cross-slope"),z=D!==void 0,F=D<1,L=l.colorModeForDrapableLayerRenderPass(m),N=l.terrain&&l.terrain.renderingToTexture,j=N?1:o.q.devicePixelRatio,q=n.paint.get("line-dasharray"),X=q.constantOr(1),ee=n.layout.get("line-cap"),ie=q.constantOr(null),Y=ee.constantOr(null),K=n.paint.get("line-pattern"),J=K.constantOr(1),pe=n.paint.get("line-pattern-cross-fade"),oe=K.constantOr(null),Ie=n.paint.get("line-opacity").constantOr(1);let xe=!J&&Ie!==1||l.depthOcclusion&&y>0&&y<1;const Me=n.paint.get("line-gradient"),Ue=J?"linePattern":"line",me=o.dY(n);let se;if(N&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(xe=!1),y!==0&&l.depthOcclusion){const Re=n.paint._values["line-opacity"];Re&&Re.value&&Re.value.kind==="constant"?se=Re.value:o.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}f.value.kind!=="constant"&&f.value.isLineProgressConstant===!1&&me.push("VARIABLE_LINE_WIDTH");const we=(Re,Le,Ze,at,dt,Qe)=>{for(const ht of Re){const lt=t.getTile(ht);if(J&&!lt.patternsLoaded())continue;const wt=lt.getBucket(n);if(!wt||wt.elevationType!=="none"&&!dt||wt.elevationType==="none"&&dt)continue;l.prepareDrawTile();const At=[...Le],Ot=l.shadowRenderer,Yt=wt.elevationType==="road"&&!!Ot&&Ot.enabled;let Et=[0,0,0];if(Yt){const Wt=l.style.directionalLight,si=l.style.ambientLight;Wt&&si&&(Et=wo(l.style,Wt,si)),At.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Kt=wt.programConfigurations.get(n.id);let ti=!1;if(oe&<.imageAtlas){const Wt=o.dZ.from(oe),si=Wt.getPrimary().scaleSelf(j).toString(),yi=lt.imageAtlas.patternPositions.get(si),or=Wt.getSecondary(),rr=or?lt.imageAtlas.patternPositions.get(or.scaleSelf(j).toString()):null;ti=!!yi&&!!rr,yi&&Kt.setConstantPatternPositions(yi,rr)}pe>0&&(ti||Kt.getPatternTransitionVertexBuffer("line-pattern"))&&At.push("LINE_PATTERN_TRANSITION");const vi=l.isTileAffectedByFog(ht),Dt=l.getOrCreateProgram(Ue,{config:Kt,defines:At,overrideFog:vi});if(!J&&ie&&Y&<.lineAtlas){const Wt=lt.lineAtlas.getDash(ie,Y);
2760Wt&&Kt.setConstantPatternPositions(Wt)}Yt&&Ot.setupShadows(lt.tileID.toUnwrapped(),Dt,"vector-tile");let[Jt,Qt]=n.paint.get("line-trim-offset");(Y==="round"||Y==="square")&&Jt!==Qt&&(Jt===0&&(Jt-=1),Qt===1&&(Qt+=1));const ni=N?ht.projMatrix:null,kt=T?1/wt.tileToMeter/o.aw(lt,1,l.transform.zoom):1,di=T?1/wt.tileToMeter/o.aw(lt,1,Math.floor(l.transform.zoom)):1,ii=J?o.d_(l,lt,n,ni,j,kt,di,[Jt,Qt],Et,pe):o.d$(l,lt,n,ni,wt.lineClipsArray.length,j,kt,di,[Jt,Qt],Et);if(Me){const Wt=wt.gradients[n.id];let si=Wt.texture;if(n.gradientVersion!==Wt.version){let yi=256;if(n.stepInterpolant){const or=t.getSource().maxzoom,rr=ht.canonical.z===or?Math.ceil(1<<l.transform.maxZoom-ht.canonical.z):1;yi=o.ay(o.e0(wt.maxLineLength/o.aj*1024*rr),256,E.maxTextureSize)}Wt.gradient=o.e1({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:yi,image:Wt.gradient||void 0,clips:wt.lineClipsArray}),Wt.texture?Wt.texture.update(Wt.gradient):Wt.texture=new o.T(E,Wt.gradient,C.RGBA8),Wt.version=n.gradientVersion,si=Wt.texture}E.activeTexture.set(C.TEXTURE1),si.bind(n.stepInterpolant?C.NEAREST:C.LINEAR,C.CLAMP_TO_EDGE)}X&&(E.activeTexture.set(C.TEXTURE0),lt.lineAtlasTexture&<.lineAtlasTexture.bind(C.LINEAR,C.REPEAT),Kt.updatePaintBuffers()),J&&(E.activeTexture.set(C.TEXTURE0),lt.imageAtlasTexture&<.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Kt.updatePaintBuffers()),dt&&!S&&l.terrain.setupElevationDraw(lt,Dt),l.uploadCommonUniforms(E,Dt,ht.toUnwrapped());const Vi=Wt=>{se!=null&&(se.value=Ie*y),Dt.draw(l,C.TRIANGLES,Ze,Wt,L,mt.disabled,ii,n.id,wt.layoutVertexBuffer,wt.indexBuffer,wt.segments,n.paint,l.transform.zoom,Kt,[wt.layoutVertexBuffer2,wt.patternVertexBuffer,wt.zOffsetVertexBuffer]),se!=null&&(se.value=Ie)};if(xe&&!dt){const Wt=l.stencilModeForClipping(ht).ref;Wt===0&&N&&E.clear({stencil:0});const si={func:C.EQUAL,mask:255};ii.u_alpha_discard_threshold=.8,Vi(new xt(si,Wt,255,C.KEEP,C.KEEP,C.INVERT)),ii.u_alpha_discard_threshold=0,Vi(new xt(si,Wt,255,C.KEEP,C.KEEP,C.KEEP))}else ii.u_alpha_discard_threshold=xe&&dt&&Qe?.8:0,Vi(dt?at:l.stencilModeForClipping(ht))}};let _e=l.depthModeForSublayer(0,it.ReadOnly);const ze=new it(l.depthOcclusion?C.GREATER:C.LEQUAL,it.ReadOnly,l.depthRangeFor3D);if(n.hasNonElevatedBuckets){const Re=!N&&l.terrain;y!==0&&Re?o.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):Re?o.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):we(c,me,_e,xt.disabled,!1,!0)}if(n.hasElevatedBuckets){x==="hd-road-markup"?M||(_e=ze,me.push("ELEVATED_ROADS")):(me.push("ELEVATED"),_e=ze,z&&me.push(F?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),S&&me.push("ELEVATION_REFERENCE_SEA"));const Re=xe?l.stencilModeFor3D():xt.disabled;l.forceTerrainMode=!0,we(c,me,_e,Re,!0,!0),xe&&we(c,me,_e,Re,!0,!1),l.forceTerrainMode=!1}xe&&(l.resetStencilClippingMasks(),N&&E.clear({stencil:0})),y===0||l.depthOcclusion||N||l.layersWithOcclusionOpacity.push(l.currentLayer)},fill:function(l,t,n,c){const d=n.paint.get("fill-color"),f=n.paint.get("fill-opacity");if(f.constantOr(1)===0)return;const m=n.paint.get("fill-emissive-strength"),y=l.colorModeForDrapableLayerRenderPass(m),x=n.paint.get("fill-pattern"),T=l.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(o.am.transparent).a===1&&f.constantOr(0)===1?"opaque":"translucent";let S="none";n.layout.get("fill-elevation-reference")!=="none"?S="road":n.paint.get("fill-z-offset").constantOr(1)!==0&&(S="offset");const M=!(!l.terrain||!l.terrain.enabled),E={painter:l,sourceCache:t,layer:n,coords:c,colorMode:y,elevationType:S,terrainEnabled:M,pass:T};if(l.renderPass!=="shadow")if(S!=="offset"){if(Mc(E,!1),S==="road"){const C=!M&&l.renderPass==="translucent";C&&rt(l,t,n,c,"geometry"),Mc(E,!0,xt.disabled),C&&(function(D){const{painter:z,sourceCache:F,layer:L,coords:N,colorMode:j}=D,q=z.context.gl,X=D.painter.shadowRenderer,ee=!!X&&X.enabled,ie=new it(z.context.gl.LEQUAL,it.ReadOnly,z.depthRangeFor3D);let Y=[0,0,0];if(ee){const J=z.style.directionalLight,pe=z.style.ambientLight;J&&pe&&(Y=wo(z.style,J,pe))}const K=J=>{for(const pe of N){const oe=F.getTile(pe),Ie=oe.getBucket(L);if(!Ie)continue;const xe=Ie.elevatedStructures;if(!xe)continue;
2760let Me,Ue;if(J?(Me=xe.renderableBridgeSegments,Ue=xe.bridgeProgramConfigurations.get(L.id)):(Me=xe.renderableTunnelSegments,Ue=xe.tunnelProgramConfigurations.get(L.id)),!Me||Me.segments[0].primitiveLength===0)continue;Ue.updatePaintBuffers(),z.prepareDrawTile();const me=z.isTileAffectedByFog(pe),se=[];ee&&se.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const we=z.getOrCreateProgram("elevatedStructures",{config:Ue,overrideFog:me,defines:se}),_e=z.translatePosMatrix(pe.projMatrix,oe,L.paint.get("fill-translate"),L.paint.get("fill-translate-anchor"));ee&&X.setupShadows(oe.tileID.toUnwrapped(),we,"vector-tile");const ze=Pp(_e,Y);z.uploadCommonUniforms(z.context,we,pe.toUnwrapped()),we.draw(z,q.TRIANGLES,ie,xt.disabled,j,mt.backCCW,ze,L.id,xe.vertexBuffer,xe.indexBuffer,Me,L.paint,z.transform.zoom,Ue,[xe.vertexBufferNormal])}};K(!0),K(!1)})(E)}}else Mc(E,!1,l.stencilModeFor3D());else l.shadowRenderer&&S==="road"&&!M&&(function(C){const{painter:D,sourceCache:z,layer:F,coords:L}=C,N=D.context.gl,j=C.painter.shadowRenderer;for(const q of L){const X=z.getTile(q),ee=X.getBucket(F);if(!ee)continue;const ie=ee.elevatedStructures;if(!ie||!ie.shadowCasterSegments||ie.shadowCasterSegments.segments[0].primitiveLength===0)continue;D.prepareDrawTile();const Y=ee.bufferData.programConfigurations.get(F.id),K=D.isTileAffectedByFog(q),J=D.getOrCreateProgram("elevatedStructuresDepth",{config:Y,overrideFog:K}),pe=j.calculateShadowPassMatrixFromTile(X.tileID.toUnwrapped());D.uploadCommonUniforms(D.context,J,q.toUnwrapped());const oe={u_matrix:pe,u_depth_bias:0};J.draw(D,N.TRIANGLES,j.getShadowPassDepthMode(),xt.disabled,j.getShadowPassColorMode(),mt.disabled,oe,F.id,ie.vertexBuffer,ie.indexBuffer,ie.shadowCasterSegments,F.paint,D.transform.zoom,Y)}})(E)},"fill-extrusion":function(l,t,n,c){const d=n.paint.get("fill-extrusion-opacity"),f=l.context,m=f.gl,y=l.terrain,x=y&&y.renderingToTexture;if(d===0)return;const T=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),S=l.style.order.indexOf(n.fqid);if(T&&(function(M,E,C,D,z){for(const F of D){const L=E.getTile(F).getBucket(C);L&&(L.updateReplacement(F,M.replacementSource,z),L.uploadCentroid(M.context))}})(l,t,n,c,S),y||T)for(const M of c){const E=t.getTile(M).getBucket(n);E&>(l.context,t,M,E,n,y,T)}if(l.renderPass==="shadow"&&l.shadowRenderer){const M=l.shadowRenderer;if(y&&d<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof o.ab)return;const E=M.getShadowPassDepthMode(),C=M.getShadowPassColorMode();vl(l,t,n,c,E,xt.disabled,C,T)}else if(l.renderPass==="translucent"){const M=!n.paint.get("fill-extrusion-pattern").constantOr(1),E=n.paint.get("fill-extrusion-color").constantOr(o.am.white);if(!x&&E.a!==0){const C=new it(l.context.gl.LEQUAL,it.ReadWrite,l.depthRangeFor3D);d===1&&M?vl(l,t,n,c,C,xt.disabled,Pt.unblended,T):(vl(l,t,n,c,C,xt.disabled,Pt.disabled,T),vl(l,t,n,c,C,l.stencilModeFor3D(),l.colorModeForRenderPass(),T),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&M&&(!y&&l.transform.projection.name!=="globe"||x)){const C=n.paint.get("fill-extrusion-opacity"),D=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),z=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),F=n.paint.get("fill-extrusion-flood-light-intensity"),L=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",N=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(L?null:n.lut).toArray01().slice(0,3),j=D>0&&z>0,q=F>0,X=(Y,K,J)=>(1-J)*Y+J*K,ee=new bs;ee.translate=n.paint.get("fill-extrusion-translate"),ee.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),ee.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),ee.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");const ie=Y=>{const K=l.depthModeForSublayer(1,it.ReadOnly,m.LEQUAL,!0),J=n.paint.get(Y?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),pe=X(.1,3,J),oe=l._showOverdrawInspector;if(!oe){const Ie=new xt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),xe=new Pt([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0],m.MIN);an(ee,l,t,n,c,K,Ie,xe,mt.disabled,Y,"sdf",C,D,z,F,N,pe,T,!1)}{const Ie=oe?xt.disabled:new xt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),xe=oe?l.colorModeForRenderPass():new Pt([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],o.am.transparent,[!0,!0,!0,!0]);an(ee,l,t,n,c,K,Ie,xe,mt.disabled,Y,"color",C,D,z,F,N,pe,T,!1)}};if(x){const Y=(K,J,pe)=>{const oe=l.depthModeForSublayer(1,it.ReadOnly,m.LEQUAL,!1),Ie=n.paint.get(K?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),xe=X(.1,3,Ie);{const Me=new Pt([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0]);an(ee,l,t,n,c,oe,xt.disabled,Me,mt.disabled,K,"clear",C,D,z,F,N,xe,T,J)}{const Me=new xt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Ue=new Pt([m.ONE,m.ONE,m.ONE,m.ONE],o.am.transparent,[!1,!1,!1,!0],m.MIN);an(ee,l,t,n,c,oe,Me,Ue,mt.disabled,K,"sdf",C,D,z,F,N,xe,T,J)}{const Me=K?m.ZERO:m.ONE_MINUS_DST_ALPHA,Ue=new xt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),me=new Pt([Me,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],o.am.transparent,[!0,!0,!0,!0]);an(ee,l,t,n,c,oe,Ue,me,mt.disabled,K,"color",C,D,z,F,N,xe,T,J)}{const Me=new Pt([m.ONE,m.ONE,m.ONE,K?m.ZERO:m.ONE],o.am.transparent,[!1,!1,!1,!0],K?m.FUNC_ADD:m.MAX);an(ee,l,t,n,c,oe,xt.disabled,Me,mt.disabled,K,"clear",C,D,z,F,N,xe,T,J,pe)}};if(j||q){let K;if(l.prepareDrawTile(),y){const J=y.drapeBufferSize[0],pe=y.drapeBufferSize[1];K=y.framebufferCopyTexture,K&&(!K||K.size[0]===J&&K.size[1]===pe)||(K&&K.destroy(),K=y.framebufferCopyTexture=new o.T(f,new o.r({width:J,height:pe}),m.RGBA8)),K.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,J,pe)}j&&Y(!0,!1,K),q&&Y(!1,!0,K)}}else j&&ie(!0),q&&ie(!1),(j||q)&&l.resetStencilClippingMasks()}}},building:function(l,t,n,c){l.currentLayer<l.firstLightBeamLayer&&(l.firstLightBeamLayer=l.currentLayer);const d=n.paint.get("building-ambient-occlusion-ground-intensity"),f=n.paint.get("building-ambient-occlusion-ground-radius"),m=n.paint.get("building-ambient-occlusion-ground-attenuation");let y=d>0&&f>0,x=!0;const T=n.paint.get("building-vertical-scale");T<1&&(x=!1);const S=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),M=l.style.order.indexOf(n.fqid);if((function(E,C,D,z,F,L){for(const N of L){const j=C.getTile(N).getBucket(D);j&&(F&&j.updateReplacement(N,E.replacementSource,z),j.uploadUpdatedIndexBuffer(E.context))}})(l,t,n,M,S,c),(function(E,C,D,z){for(const F of z){const L=C.getTile(F).getBucket(D);L&&L.needsEvaluation(E,D)&&(L.evaluate(D),L.uploadUpdatedColorBuffer(E.context))}})(l,t,n,c),n.resetLayerRenderingStats(l),l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0),l.renderPass==="shadow"&&l.shadowRenderer){const E=l.shadowRenderer,C=[],D=E.getShadowPassDepthMode();Pc({painter:l,source:t,layer:n,coords:c,defines:C,blendMode:E.getShadowPassColorMode(),depthMode:D,verticalScale:T})}else if(l.renderPass==="translucent"){y&&(function(z,F,L,N,j,q,X,ee,ie,Y,K,J,pe){const oe=z.context.gl,Ie=z.depthModeForSublayer(1,it.ReadOnly,oe.LEQUAL,!0),xe=.1*(1-(Me=K))+3*Me;var Me;const Ue=z._showOverdrawInspector,me=J,se=new bs;Ue||an(se,z,F,L,N,Ie,new xt({func:oe.ALWAYS,mask:255},255,255,oe.KEEP,oe.KEEP,oe.REPLACE),new Pt([oe.ONE,oe.ONE,oe.ONE,oe.ONE],o.am.transparent,[!1,!1,!1,!0],oe.MIN),mt.disabled,j,"sdf",1,X,ee,0,Y,xe,me,!1);{const we=Ue?xt.disabled:new xt({func:oe.EQUAL,mask:255},255,255,oe.KEEP,oe.DECR,oe.DECR),_e=Ue?z.colorModeForRenderPass():new Pt([oe.ONE_MINUS_DST_ALPHA,oe.DST_ALPHA,oe.ONE,oe.ONE],o.am.transparent,[!0,!0,!0,!0]);an(se,z,F,L,N,Ie,we,_e,mt.disabled,j,"color",1,X,ee,0,Y,xe,me,!1)}})(l,t,n,c,!0,0,d,f,0,[0,0,0],m,S);let E=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];x&&(E=E.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),l.shadowRenderer.useNormalOffset&&(E=E.concat("NORMAL_OFFSET"));const C=new it(l.context.gl.LEQUAL,it.ReadWrite,l.depthRangeFor3D),D=l.colorModeForRenderPass();Pc({painter:l,source:t,layer:n,coords:c,defines:E,blendMode:D,depthMode:C,verticalScale:T})}else if(l.renderPass==="light-beam"){const E=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],C=new it(l.context.gl.LEQUAL,it.ReadOnly,l.depthRangeFor3D);Pc({painter:l,source:t,layer:n,coords:c,defines:E,blendMode:Pt.alphaBlended,depthMode:C,verticalScale:T})}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1),l.resetStencilClippingMasks()},hillshade:function(l,t,n,c){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent"||l.style.disableElevatedTerrain)return;
2760const d=l.context,f=l.terrain&&l.terrain.renderingToTexture,[m,y]=l.renderPass!=="translucent"||f?[{},c]:l.stencilConfigForOverlap(c);for(const x of y){const T=t.getTile(x);if(T.needsHillshadePrepare&&l.renderPass==="offscreen")Ed(l,T,n);else if(l.renderPass==="translucent"){const S=l.depthModeForSublayer(0,it.ReadOnly),M=n.paint.get("hillshade-emissive-strength"),E=l.colorModeForDrapableLayerRenderPass(M),C=f&&l.terrain?l.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];vp(l,x,T,n,S,C,E)}}d.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,n,c,d,f){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0)return;const m=l.transform.projection.name==="globe",y=n.paint.get("raster-elevation")!==0,x=y&&m;if(l.renderElevatedRasterBackface&&!x)return;const T=l.context,S=T.gl,M=t.getSource(),E=(function(ee,ie,Y,K){const J=ie.paint.get("raster-color"),pe=ee.type==="raster-array",oe=[],Ie=ie.paint.get("raster-resampling"),xe=ie.paint.get("raster-color-mix");let Me=ie.paint.get("raster-color-range");const Ue=[xe[0],xe[1],xe[2],0],me=xe[3];let se=Ie==="nearest"?K.NEAREST:K.LINEAR;if(pe&&(oe.push("RASTER_ARRAY"),J||oe.push("RASTER_COLOR"),Ie==="linear"&&oe.push("RASTER_ARRAY_LINEAR"),se=K.NEAREST,!Me&&ee.rasterLayers)){const we=ee.rasterLayers.find((({id:_e})=>_e===ie.sourceLayer));we&&we.fields&&we.fields.range&&(Me=we.fields.range)}if(Me=Me||[0,1],J){oe.push("RASTER_COLOR"),Y.activeTexture.set(K.TEXTURE2),ie.updateColorRamp(Me);let we=ie.colorRampTexture;we||(we=ie.colorRampTexture=new o.T(Y,ie.colorRamp,K.RGBA8)),we.bind(K.LINEAR,K.CLAMP_TO_EDGE)}return{mix:Ue,range:Me,offset:me,defines:oe,resampling:se}})(M,n,T,S);if(M instanceof o.aP&&!c.length&&!m)return;const C=n.paint.get("raster-emissive-strength"),D=l.colorModeForDrapableLayerRenderPass(C),z=l.terrain&&l.terrain.renderingToTexture,F=!l.options.moving,L=n.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(M instanceof o.aP&&!c.length&&(M.onNorthPole||M.onSouthPole)){const ee=y?l.stencilModeFor3D():xt.disabled;return void zc(!!M.onNorthPole,null,l,t,n,C,E,mt.disabled,ee)}if(!c.length)return;const[N,j]=M instanceof o.aP||z?[{},c]:l.stencilConfigForOverlap(c),q=j[j.length-1].overscaledZ;x&&E.defines.push("PROJECTION_GLOBE_VIEW"),y&&E.defines.push("RENDER_CUTOFF");const X=(ee,ie,Y)=>{for(const K of ee){const J=K.toUnwrapped(),pe=t.getTile(K);if(z&&(!pe||!pe.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const oe=Lp(pe,M,n,E);if(!oe||!oe.texture)continue;const{texture:Ie,mix:xe,offset:Me,tileSize:Ue,buffer:me}=oe;let se,we;z?(se=it.disabled,we=K.projMatrix):y?(se=new it(S.LEQUAL,it.ReadWrite,l.depthRangeFor3D),we=m?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(J,F)):(se=l.depthModeForSublayer(K.overscaledZ-q,n.paint.get("raster-opacity")===1?it.ReadWrite:it.ReadOnly,S.LESS),we=l.transform.calculateProjMatrix(J,F));const _e=l.terrain&&z?l.terrain.stencilModeForRTTOverlap(K):N[K.overscaledZ],ze=f?0:n.paint.get("raster-fade-duration");pe.registerFadeDuration(ze);const Re=t.findLoadedParent(K,0),Le=on(pe,Re,t,l.transform,ze);let Ze,at;l.terrain&&l.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),Ie.bind(L,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),Re?(Re.texture&&Re.texture.bind(L,S.CLAMP_TO_EDGE),Ze=Math.pow(2,Re.tileID.overscaledZ-pe.tileID.overscaledZ),at=[pe.tileID.canonical.x*Ze%1,pe.tileID.canonical.y*Ze%1]):Ie.bind(L,S.CLAMP_TO_EDGE),"useMipmap"in Ie&&T.extTextureFilterAnisotropic&&l.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const dt=l.transform;let Qe;const ht=y?Dp(dt):[0,0,0,0];let lt,wt,At,Ot,Yt,Et=0;if(x&&M instanceof o.aP&&M.coordinates.length>3)lt=Float32Array.from(o.bh(o.dD(new o.cA(0,0,0)))),wt=Float32Array.from(dt.globeMatrix),At=Float32Array.from(o.dz(dt)),Ot=[o.aD(dt.center.lng),o.aH(dt.center.lat)],Qe=M.elevatedGlobePerspectiveTransform,Yt=M.elevatedGlobeGridMatrix||new Float32Array(9);else if(x){const Dt=o.dA(K.canonical);Et=o.dB(Dt.getCenter().lat),lt=Float32Array.from(o.bh(o.dD(K.canonical))),wt=Float32Array.from(dt.globeMatrix),At=Float32Array.from(o.dz(dt)),Ot=[o.aD(dt.center.lng),o.aH(dt.center.lat)],Qe=[0,0],Yt=Float32Array.from(o.dC(K.canonical,Dt,Et,dt.worldSize/dt._pixelsPerMercatorPixel))}else Qe=M instanceof o.aP?M.perspectiveTransform:[0,0],lt=new Float32Array(16),wt=new Float32Array(9),At=new Float32Array(16),Ot=[0,0],Yt=new Float32Array(9);const Kt=Hh(we,lt,wt,At,Yt,at||[0,0],o.ah(l.transform.zoom),Ot,ht,Ze||1,Le,n,Qe,y?n.paint.get("raster-elevation"):0,2,xe,Me,E.range,Ue,me,C),ti=l.isTileAffectedByFog(K),vi=l.getOrCreateProgram("raster",{defines:E.defines,overrideFog:ti});if(l.uploadCommonUniforms(T,vi,J),M instanceof o.aP){const Dt=M.elevatedGlobeVertexBuffer,Jt=M.elevatedGlobeIndexBuffer;if(z||!m)M.boundsBuffer&&M.boundsSegments&&vi.draw(l,S.TRIANGLES,se,xt.disabled,D,mt.disabled,Kt,n.id,M.boundsBuffer,l.quadTriangleIndexBuffer,M.boundsSegments);else if(Dt&&Jt){const Qt=dt.zoom<=o.cX?M.elevatedGlobeSegments:M.getSegmentsForLongitude(dt.center.lng);Qt&&vi.draw(l,S.TRIANGLES,se,xt.disabled,D,ie,Kt,n.id,Dt,Jt,Qt)}}else if(x){se=new it(S.LEQUAL,it.ReadOnly,l.depthRangeFor3D);const Dt=l.globeSharedBuffers;if(Dt){const[Jt,Qt,ni]=Dt.getGridBuffers(Et,!1);vi.draw(l,S.TRIANGLES,se,Y||_e,l.colorModeForRenderPass(),ie,Kt,n.id,Jt,Qt,ni)}}else{const{tileBoundsBuffer:Dt,tileBoundsIndexBuffer:Jt,tileBoundsSegments:Qt}=l.getTileBoundsBuffers(pe);vi.draw(l,S.TRIANGLES,se,_e,D,mt.disabled,Kt,n.id,Dt,Jt,Qt)}}if(!(M instanceof o.aP)&&x)for(const K of ee){const J=K.canonical.y===(1<<K.canonical.z)-1;K.canonical.y===0&&zc(!0,K,l,t,n,C,E,ie,Y||xt.disabled),J&&zc(!1,K,l,t,n,C,E,ie===mt.frontCW?mt.backCW:mt.frontCW,Y||xt.disabled)}};x?X(j,l.renderElevatedRasterBackface?mt.backCW:mt.frontCW,l.stencilModeFor3D()):X(j,mt.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,n,c,d,f){l.renderPass==="offscreen"&&(function(m,y,x,T){if(!T.length)return;
vendor: 14,998 bytes, line 2760
2760const S=m.context,M=S.gl,E=y.getSource();if(!(E instanceof ks))return;const C=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let D=x.particlePositionRGBAImage;if(!D||D.width!==C){const j=(function(q){const X=q*q,ee=new Uint8Array(4*X),ie=function(K){return K|=0,K=Math.imul(2747636419^K,2654435769),K=Math.imul(K^K>>>16,2654435769),((K=Math.imul(K^K>>>16,2654435769))>>>0)/4294967296},Y=1/1.1;for(let K=0;K<X;K++){const J=Y*(ie(2*K+0)+Ws),pe=Y*(ie(2*K+1)+Ws),oe=255*J%1,Ie=255*pe%1,xe=oe,Me=pe-Ie/255,Ue=Ie;ee[4*K+0]=255*(J-oe/255),ee[4*K+1]=255*xe,ee[4*K+2]=255*Me,ee[4*K+3]=255*Ue}return ee})(C);D=x.particlePositionRGBAImage=new o.r({width:C,height:C},j)}let z=x.particleFramebuffer;z?z.width!==C&&(z.destroy(),z=x.particleFramebuffer=S.createFramebuffer(C,C,!0,null)):z=x.particleFramebuffer=S.createFramebuffer(C,C,!0,null);const F=[];for(const j of T){const q=y.getTile(j);if(!(q instanceof qo))continue;const X=Wr(q,E,x);if(!X)continue;const ee=[q.tileSize,q.tileSize];let ie=x.tileFramebuffer;ie||(ie=x.tileFramebuffer=S.createFramebuffer(ee[0],ee[1],!0,null));let Y=q.rasterParticleState;Y||(Y=q.rasterParticleState=new eu(S,j,ee,D));const K=Y.update(x.lastInvalidatedAt);Y.particleTextureDimension!==C&&Y.updateParticleTexture(j,D);const J=Y.targetColorTexture;Y.targetColorTexture=Y.backgroundColorTexture,Y.backgroundColorTexture=J;const pe=Y.particleTexture0;Y.particleTexture0=Y.particleTexture1,Y.particleTexture1=pe,F.push([j,X,Y,K])}if(F.length===0)return;const L=o.q.now(),N=x.previousDrawTimestamp?.001*(L-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=L,x.hasColorMap()){S.activeTexture.set(M.TEXTURE0+2);let j=x.colorRampTexture;j||(j=x.colorRampTexture=new o.T(S,x.colorRamp,M.RGBA8)),j.bind(M.LINEAR,M.CLAMP_TO_EDGE)}S.bindFramebuffer.set(x.tileFramebuffer.framebuffer),(function(j,q,X){const ee=j.context,ie=ee.gl,Y=q.tileFramebuffer;ee.activeTexture.set(ie.TEXTURE0);const K={u_texture:0,u_opacity:1.05*(pe=q.paint.get("raster-particle-fade-opacity-factor"))/(pe+.05)},J=j.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var pe;for(const oe of X){const[,,Ie,xe]=oe;Y.colorAttachment.set(Ie.targetColorTexture.texture),ee.viewport.set([0,0,Y.width,Y.height]),ee.clear({color:o.am.transparent}),xe&&(Ie.backgroundColorTexture.bind(ie.NEAREST,ie.CLAMP_TO_EDGE),J.draw(j,ie.TRIANGLES,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,K,q.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments))}})(m,x,F),(function(j,q,X,ee){const ie=j.context,Y=ie.gl,K=X.tileFramebuffer,J=j.transform.projection.name==="globe",pe=X.paint.get("raster-particle-max-speed");for(const oe of ee){const[Ie,xe,Me]=oe;ie.activeTexture.set(Y.TEXTURE0+0),xe.texture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),K.colorAttachment.set(Me.targetColorTexture.texture);const Ue=j.getOrCreateProgram("rasterParticleDraw",{defines:xe.defines,overrideFog:!1});ie.activeTexture.set(Y.TEXTURE0+1);const me=xe.scalarData?[]:[0,1,2,3].map((_e=>o.e3[_e](Ie)));me.push(Ie);const se=Ie.canonical.x,we=Ie.canonical.y;for(const _e of me){const ze=q.getTile(J?_e.wrapped():_e);if(!ze)continue;const Re=ze.rasterParticleState;if(!Re)continue;const Le=_e.canonical.x+(1<<_e.canonical.z)*(_e.wrap-Ie.wrap),Ze=_e.canonical.y;Re.particleTexture0.bind(Y.NEAREST,Y.CLAMP_TO_EDGE);const at=jd(1,Re.particleTexture0.size[0],[Le-se,Ze-we],0,xe.texture.size,2,pe,xe.textureOffset,xe.scale,xe.offset);Ue.draw(j,Y.POINTS,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,at,X.id,Re.particleIndexBuffer,void 0,Re.particleSegment)}}})(m,y,x,F),S.bindFramebuffer.set(x.particleFramebuffer.framebuffer),(function(j,q,X,ee){const ie=j.context,Y=ie.gl,K=q.paint.get("raster-particle-max-speed"),J=ee*q.paint.get("raster-particle-speed-factor")*.15,pe=(function(Ie){return Math.pow(Ie,6)})(.01+1*q.paint.get("raster-particle-reset-rate-factor")),oe=q.particleFramebuffer;ie.viewport.set([0,0,oe.width,oe.height]);for(const Ie of X){const[,xe,Me]=Ie;ie.activeTexture.set(Y.TEXTURE0+0),xe.texture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),ie.activeTexture.set(Y.TEXTURE0+1);const Ue=Me.particleTexture0;Ue.bind(Y.NEAREST,Y.CLAMP_TO_EDGE);const me=Gd(1,Ue.size[0],0,xe.texture.size,K,J,pe,xe.textureOffset,xe.scale,xe.offset);oe.colorAttachment.set(Me.particleTexture1.texture),ie.clear({color:o.am.transparent}),j.getOrCreateProgram("rasterParticleUpdate",{defines:xe.defines}).draw(j,Y.TRIANGLES,it.disabled,xt.disabled,Pt.unblended,mt.disabled,me,q.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments)}})(m,x,F,N)})(l,t,n,c),l.renderPass==="translucent"&&((function(m,y,x,T,S){const M=m.context,E=M.gl,C=y.getSource().tileSize,D=5*(1-o.af(o.cI,o.cI+1,m.transform.zoom))*C+x.paint.get("raster-particle-elevation"),z=!m.options.moving,F=m.transform.projection.name==="globe";if(!T.length)return;const[L,N]=m.stencilConfigForOverlap(T),j=[];F&&j.push("PROJECTION_GLOBE_VIEW");const q=m.stencilModeFor3D();for(const X of N){const ee=X.toUnwrapped(),ie=y.getTile(X);if(!ie.rasterParticleState)continue;const Y=ie.rasterParticleState,K=100;ie.registerFadeDuration(K);const J=y.findLoadedParent(X,0),pe=on(ie,J,y,m.transform,K);let oe,Ie;m.terrain&&m.terrain.prepareDrawTile(),M.activeTexture.set(E.TEXTURE0),Y.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),M.activeTexture.set(E.TEXTURE1),J&&J.rasterParticleState?(J.rasterParticleState.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),oe=Math.pow(2,J.tileID.overscaledZ-ie.tileID.overscaledZ),Ie=[ie.tileID.canonical.x*oe%1,ie.tileID.canonical.y*oe%1]):Y.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE);const xe=F?Float32Array.from(m.transform.expandedFarZProjMatrix):m.transform.calculateProjMatrix(ee,z),Me=m.transform,Ue=Js(Me),me=o.dA(X.canonical),se=o.dB(me.getCenter().lat);let we,_e,ze,Re,Le;F?(we=Float32Array.from(o.bh(o.dD(X.canonical))),_e=Float32Array.from(Me.globeMatrix),ze=Float32Array.from(o.dz(Me)),Re=[o.aD(Me.center.lng),o.aH(Me.center.lat)],Le=Float32Array.from(o.dC(X.canonical,me,se,Me.worldSize/Me._pixelsPerMercatorPixel))):(we=new Float32Array(16),_e=new Float32Array(9),ze=new Float32Array(16),Re=[0,0],Le=new Float32Array(9));const Ze=Sc(xe,we,_e,ze,Le,Ie||[0,0],o.ah(m.transform.zoom),Re,Ue,oe||1,pe,D),at=m.isTileAffectedByFog(X),dt=m.getOrCreateProgram("rasterParticle",{defines:j,overrideFog:at});if(m.uploadCommonUniforms(M,dt,ee),F){const Qe=new it(E.LEQUAL,it.ReadOnly,m.depthRangeFor3D),ht=0,lt=m.globeSharedBuffers;if(lt){const[wt,At,Ot]=lt.getGridBuffers(se,ht!==0);dt.draw(m,E.TRIANGLES,Qe,q,Pt.alphaBlended,m.renderElevatedRasterBackface?mt.frontCCW:mt.backCCW,Ze,x.id,wt,At,Ot)}}else{const Qe=m.depthModeForSublayer(0,it.ReadOnly),ht=L[X.overscaledZ],{tileBoundsBuffer:lt,tileBoundsIndexBuffer:wt,tileBoundsSegments:At}=m.getTileBoundsBuffers(ie);dt.draw(m,E.TRIANGLES,Qe,ht,Pt.alphaBlended,mt.disabled,Ze,x.id,lt,wt,At)}}m.resetStencilClippingMasks()})(l,t,n,c),l.style.map.triggerRepaint())},background:function(l,t,n,c){const d=n.paint.get("background-color"),f=n.paint.get("background-color-use-theme").constantOr("default")==="none",m=n.paint.get("background-opacity"),y=n.paint.get("background-emissive-strength"),x=n.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const T=l.context,S=T.gl,M=l.transform,E=M.tileSize,C=n.paint.get("background-pattern");let D;if(C!==void 0&&(C===null||(D=l.imageManager.getPattern(o.I.from(C.toString()),n.scope,l.style.getLut(n.scope)),!D)))return;const z=!C&&d.a===1&&m===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==z)return;const F=xt.disabled,L=l.depthModeForSublayer(0,z==="opaque"?it.ReadWrite:it.ReadOnly),N=l.colorModeForDrapableLayerRenderPass(y),j=C?"backgroundPattern":"background";let q,X=c;if(X||(q=l.getBackgroundTiles(),X=Object.values(q).map((ee=>ee.tileID))),C&&(T.activeTexture.set(S.TEXTURE0),l.imageManager.bind(l.context,n.scope)),x){const ee=l.getOrCreateProgram(j,{overrideFog:!1,overrideRtt:!0}),ie=new Float32Array(o.bx([])),Y=new o.aM(0,0,0,0,0),K=C?$h(ie,y,m,l,0,n.scope,D,x,{tileID:Y,tileSize:E}):qd(ie,y,m,d.toPremultipliedRenderColor(f?null:n.lut));ee.draw(l,S.TRIANGLES,L,F,N,mt.disabled,K,n.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}else for(const ee of X){const ie=l.isTileAffectedByFog(ee),Y=l.getOrCreateProgram(j,{overrideFog:ie}),K=ee.toUnwrapped(),J=c?ee.projMatrix:l.transform.calculateProjMatrix(K);l.prepareDrawTile();const pe=t?t.getTile(ee):q?q[ee.key]:new mo(ee,E,M.zoom,l),oe=C?$h(J,y,m,l,0,n.scope,D,x,{tileID:ee,tileSize:E}):qd(J,y,m,d.toPremultipliedRenderColor(f?null:n.lut));l.uploadCommonUniforms(T,Y,K);const{tileBoundsBuffer:Ie,tileBoundsIndexBuffer:xe,tileBoundsSegments:Me}=l.getTileBoundsBuffers(pe);Y.draw(l,S.TRIANGLES,L,F,N,mt.disabled,oe,n.id,Ie,xe,Me)}},sky:function(l,t,n){const c=l._atmosphere?o.ah(l.transform.zoom):1,d=n.paint.get("sky-opacity")*c;if(d===0)return;const f=l.context,m=n.paint.get("sky-type"),y=new it(f.gl.LEQUAL,it.ReadOnly,[0,1]),x=l.frameCounter/1e3%1;m==="atmosphere"?l.renderPass==="offscreen"?n.needsSkyboxCapture(l)&&((function(T,S,M,E){const C=T.context,D=C.gl;let z=S.skyboxFbo;if(!z){z=S.skyboxFbo=C.createFramebuffer(32,32,!0,null),S.skyboxGeometry=new Po(C),S.skyboxTexture=C.gl.createTexture(),D.bindTexture(D.TEXTURE_CUBE_MAP,S.skyboxTexture),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_MIN_FILTER,D.LINEAR),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_MAG_FILTER,D.LINEAR);for(let j=0;j<6;++j)D.texImage2D(D.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,D.RGBA,32,32,0,D.RGBA,D.UNSIGNED_BYTE,null)}C.bindFramebuffer.set(z.framebuffer),C.viewport.set([0,0,32,32]);const F=S.getCenter(T,!0),L=T.getOrCreateProgram("skyboxCapture"),N=new Float64Array(16);o.bx(N),o.eh(N,N,.5*-Math.PI),Wn(T,S,L,N,F,0),o.bx(N),o.eh(N,N,.5*Math.PI),Wn(T,S,L,N,F,1),o.bx(N),o.cR(N,N,.5*-Math.PI),Wn(T,S,L,N,F,2),o.bx(N),o.cR(N,N,.5*Math.PI),Wn(T,S,L,N,F,3),o.bx(N),Wn(T,S,L,N,F,4),o.bx(N),o.eh(N,N,Math.PI),Wn(T,S,L,N,F,5),C.viewport.set([0,0,T.width,T.height])})(l,n),n.markSkyboxValid(l)):l.renderPass==="sky"&&(function(T,S,M,E,C){const D=T.context,z=D.gl,F=T.transform,L=T.getOrCreateProgram("skybox");D.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_CUBE_MAP,S.skyboxTexture);const N=((j,q,X,ee,ie)=>({u_matrix:j,u_sun_direction:q,u_cubemap:0,u_opacity:ee,u_temporal_offset:ie}))(F.skyboxMatrix,S.getCenter(T,!1),0,E,C);T.uploadCommonUniforms(D,L),L.draw(T,z.TRIANGLES,M,xt.disabled,T.colorModeForRenderPass(),mt.backCW,N,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)})(l,n,y,d,x):m==="gradient"&&l.renderPass==="sky"&&(function(T,S,M,E,C){const D=T.context,z=D.gl,F=T.transform,L=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new Po(D)),D.activeTexture.set(z.TEXTURE0);let N=S.colorRampTexture;N||(N=S.colorRampTexture=new o.T(D,S.colorRamp,z.RGBA8)),N.bind(z.LINEAR,z.CLAMP_TO_EDGE);const j=((q,X,ee,ie,Y)=>({u_matrix:q,u_color_ramp:0,u_center_direction:X,u_radius:o.al(ee),u_opacity:ie,u_temporal_offset:Y}))(F.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),E,C);T.uploadCommonUniforms(D,L),L.draw(T,z.TRIANGLES,M,xt.disabled,T.colorModeForRenderPass(),mt.backCW,j,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)})(l,n,y,d,x)},custom:function(l,t,n,c){const d=l.context,f=n.implementation;if(!l.transform.projection.unsupportedLayers||!l.transform.projection.unsupportedLayers.includes("custom")||l.terrain&&(l.terrain.renderingToTexture||l.renderPass==="offscreen")&&n.isDraped(t)){if(l.renderPass==="offscreen"){const m=f.prerender;if(m){if(l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;m.call(f,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),o.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else m.call(f,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const y=f.renderToTile;if(y){const x=c[0].canonical,T={x:x.x+c[0].wrap*(f.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(it.disabled),d.setStencilMode(xt.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),y.call(f,d.gl,T),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode(xt.disabled);const m=f.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;f.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),o.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else f.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else o.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,n,c){if(l.renderPass==="opaque")return;const d=n.paint.get("model-opacity").constantOr(1);if(d===0)return;const f=n.paint.get("model-cast-shadows");if(l.renderPass==="shadow"&&(!f||l.terrain&&d<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof o.ab))return;const m=l.shadowRenderer,y=n.paint.get("model-receive-shadows");m&&(m.useNormalOffset=!0,y||(m.enabled=!1));const x=()=>{m&&(m.useNormalOffset=!0,y||(m.enabled=!0))},T=t.getSource();if(l.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return(function(L,N,j,q,X){const ee=L.transform;if(ee.projection.name!=="mercator")return void o.w(`Drawing 3D models for ${ee.projection.name} projection is not yet implemented`);const ie=ee.getFreeCameraOptions().position;if(!L.modelManager)return;const Y=L.modelManager;j.modelManager=Y;const K=L.shadowRenderer;if(!j._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const J=j._unevaluatedLayout._values["model-id"],pe=Object.assign({},j.layout.get("model-id").parameters),oe=L.style.order.indexOf(j.fqid);for(const Ie of q){const xe=N.getTile(Ie).getBucket(j);if(!xe||xe.projection.name!==ee.projection.name)continue;const Me=xe.getModelUris();Me&&!xe.modelsRequested&&(Y.addModelsFromBucket(Me,X),xe.modelsRequested=!0);const Ue=Fp(Ie,ee);pe.zoom=Ue;const me=J.possiblyEvaluate(pe);if(fa(L,xe,Ie),ts.shadowUniformsInitialized=!1,ts.useSingleShadowCascade=!!K&&K.getMaxCascadeForTile(Ie.toUnwrapped())===0,L.renderPass==="shadow"&&K){if(L.currentShadowCascade===1&&xe.isInsideFirstShadowMapFrustum)continue;const _e=ee.calculatePosMatrix(Ie.toUnwrapped(),ee.worldSize);if(ts.tileMatrix.set(_e),ts.shadowTileMatrix=Float32Array.from(K.calculateShadowPassMatrixFromMatr
2760ix(_e)),ts.aabb.min.fill(0),ts.aabb.max[0]=ts.aabb.max[1]=o.aj,ts.aabb.max[2]=0,ou(xe,ts,L,j.scope))continue}const se=1<<Ie.canonical.z,we=[((ie.x-Ie.wrap)*se-Ie.canonical.x)*o.aj,(ie.y*se-Ie.canonical.y)*o.aj,ie.z*se*o.aj];L.conflationActive&&Object.keys(xe.instancesPerModel).length>0&&L.style.isLayerClipped(j,N.getSource())&&xe.updateReplacement(Ie,L.replacementSource,oe,X)&&(xe.uploaded=!1,xe.upload(L.context));for(let _e in xe.instancesPerModel){const ze=xe.instancesPerModel[_e];ze.features.length>0&&(_e=me.evaluate(ze.features[0].feature,{}));const Re=Y.getModel(_e,X);if(Re||Y.hasURLBeenRequested(_e)||xe.modelUris.includes(_e)||(xe.modelUris.push(_e),xe.modelsRequested=!1),Re&&Re.uploaded)for(const Le of Re.nodes)su(L,j,Le,ze,we,Ie,ts)}}})(l,t,n,c,T.type==="vector"?n.scope:""),void x();if(!T.loaded())return;if(T.type==="batched-model")return(function(L,N,j,q){j.resetLayerRenderingStats(L);const X=L.context,ee=L.transform,ie=L.style.fog,Y=L.shadowRenderer;if(ee.projection.name!=="mercator")return void o.w(`Drawing 3D landmark models for ${ee.projection.name} projection is not yet implemented`);const K=L.transform.getFreeCameraOptions().position,J=o.c1([],[K.x,K.y,K.z],L.transform.worldSize),pe=o.eq([],J),oe=o.bx([]),Ie=o.e9(ee.center.lat,ee.zoom),xe=o.bn([],[1,1,1/Ie]);o.bo(oe,oe,pe);const Me=j.paint.get("model-opacity").constantOr(1),Ue=new it(X.gl.LEQUAL,it.ReadWrite,L.depthRangeFor3D),me=new it(X.gl.LEQUAL,it.ReadOnly,L.depthRangeFor3D),se=new o.d6([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),we=L.renderPass==="shadow",_e=we&&Y?Y.getCurrentCascadeFrustum():ee.getFrustum(ee.scaleZoom(ee.worldSize)),ze=j.paint.get("model-front-cutoff"),Re=ze[2]<1,Le=Qn(L,j.paint.get("model-cutoff-fade-range")),Ze=j.getLayerRenderingStats();(function(at,dt,Qe,ht){const lt=at.terrain?at.terrain.exaggeration():0,wt=at.transform.zoom;for(const At of ht){const Ot=dt.getTile(At).getBucket(Qe);Ot&&(Ot.setFilter(Qe.filter),at.conflationActive&&Ot.updateReplacement(At,at.replacementSource),Ot.evaluateTransform(at,Qe),at.terrain&<>0&&Ot.elevationUpdate(at.terrain,lt,At,Qe.source),Ot.needsReEvaluation(at,wt,Qe)&&Ot.evaluate(Qe))}})(L,N,j,q),(function(){let at,dt,Qe;Re?(at=q.length-1,dt=-1,Qe=-1):(at=0,dt=q.length,Qe=1);const ht=new Float64Array(16),lt=o.cx(),wt=new o.P(0,0);for(let At=at;At!==dt;At+=Qe){const Ot=q[At],Yt=N.getTile(Ot).getBucket(j);if(!Yt||!Yt.uploaded)continue;let Et=!1;Y&&(Et=Y.getMaxCascadeForTile(Ot.toUnwrapped())===0);const Kt=ee.calculatePosMatrix(Ot.toUnwrapped(),ee.worldSize),ti=Yt.modelTraits;!we&&Re&&(o.bi(ht,Kt),o.ad(lt,J,ht),wt.x=lt[0],wt.y=lt[1]);const vi=[];Yt.setFilter(j.filter);for(const Dt of Yt.getNodesInfo()){if(Dt.hiddenByReplacement||!Dt.node.meshes)continue;const Jt=Dt.node;let Qt=0;L.terrain&&Jt.elevation&&(Qt=Jt.elevation*L.terrain.exaggeration());const ni=(()=>{const Sr=Dt.aabb;return se.min=[...Sr.min],se.max=[...Sr.max],se.min[2]+=Qt,se.max[2]+=Qt,o.ad(se.min,se.min,Kt),o.ad(se.max,se.max,Kt),se})(),kt=Dt.evaluatedScale;if(kt[0]<=1&&kt[1]<=1&&kt[2]<=1&&ni.intersects(_e)===0)continue;if(!we&&Re){const Sr=.16666666666666666;Dt.cameraCollisionOpacity=J[0]>ni.min[0]&&J[0]<ni.max[0]&&J[1]>ni.min[1]&&J[1]<ni.max[1]&&J[2]*Ie<ni.max[2]&&Jt.footprint&&o.bY(wt,Jt.footprint)?Math.max(Dt.cameraCollisionOpacity-Sr,0):Math.min(1,Dt.cameraCollisionOpacity+Sr)}const di=[...Kt],ii=1/o.d4(Ot.canonical),Vi=Jt.anchor?Jt.anchor[0]:0,Wt=Jt.anchor?Jt.anchor[1]:0;o.bo(di,di,[Vi*(kt[0]-1)+Dt.evaluatedTranslation[0]*ii,Wt*(kt[1]-1)+Dt.evaluatedTranslation[1]*ii,Qt+Dt.evaluatedTranslation[2]]),o.cn(kt,o.es)||o.cP(di,di,kt);const si=o.az([],di,Jt.matrix),yi=o.az([],ee.expandedFarZProjMatrix,si),or=o.az([],ee.expandedFarZProjMatrix,di),rr=o.aA([],[Vi,Wt,Qt,1],yi)[2];Jt.hidden=!1;let ar=Me;we||(Re&&(ar*=Dt.cameraCollisionOpacity,ar*=tf(di,ee,Dt.aabb,ze)),ar*=ef(Le,rr)),ar!==0?vi.push({nodeInfo:Dt,depth:rr,opacity:ar,wvpForNode:yi,wvpForTile:or,nodeModelMatrix:si,tileModelMatrix:di}):Jt.hidden=!0}we||vi.sort(((Dt,Jt)=>!Re||Dt.opacity===1&&Jt.opacity===1?Dt.depth<Jt.depth?-1:1:Dt.opacity===1?-1:Jt.opacity===1?1:Dt.depth>Jt.depth?-1:1));
2760for(const Dt of vi){const Jt=Dt.nodeInfo,Qt=Jt.node;let ni=o.az([],xe,Dt.tileModelMatrix);o.az(ni,oe,ni);const kt=o.bi([],ni);o.ea(kt,kt),o.cP(kt,kt,Lc),ni=o.az(ni,ni,Qt.matrix);const di=L.renderPass==="light-beam",ii=j.paint.get("model-color-use-theme").constantOr("default")==="none",Vi=ti&o.ex.HasMapboxMeshFeatures,Wt=Vi?0:Jt.evaluatedRMEA[0][2];for(let si=0;si<Qt.meshes.length;++si){const yi=Qt.meshes[si],or=si===Qt.lightMeshIndex;let rr=Dt.wvpForNode;if(or){if(!di&&!L.terrain&&L.shadowRenderer){L.currentLayer<L.firstLightBeamLayer&&(L.firstLightBeamLayer=L.currentLayer);continue}rr=Dt.wvpForTile}else if(di)continue;const ar={defines:[]},Sr=[];if(!we&&Y&&(Y.useNormalOffset=!!yi.normalBuffer),Sl(ar.defines,Sr,yi,L,ii?null:j.lut),Vi||ar.defines.push("DIFFUSE_SHADED"),Et&&ar.defines.push("SHADOWS_SINGLE_CASCADE"),Ze&&(we?Ze.numRenderedVerticesInShadowPass+=yi.vertexArray.length:Ze.numRenderedVerticesInTransparentPass+=yi.vertexArray.length),we){Dc(yi,Dt.nodeModelMatrix,L,j);continue}let Xn=null;if(ie){const zr=Tl(Dt.nodeModelMatrix,L.transform);if(Xn=new Float32Array(zr),ee.projection.name!=="globe"){const Ji=yi.aabb.min,Zi=yi.aabb.max,[wi,pr]=ie.getOpacityForBounds(zr,Ji[0],Ji[1],Zi[0],Zi[1]);ar.overrideFog=wi>=Pe||pr>=Pe}}const Yr=yi.material;let pn;Yr.occlusionTexture&&Yr.occlusionTexture.offsetScale&&(pn=Yr.occlusionTexture.offsetScale,ar.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const Pr=L.getOrCreateProgram("model",ar);!we&&Y&&Y.setupShadowsFromMatrix(Dt.tileModelMatrix,Pr,Y.useNormalOffset),L.uploadCommonUniforms(X,Pr,null,Xn);const Mn=Yr.pbrMetallicRoughness;Mn.metallicFactor=.9,Mn.roughnessFactor=.5;const Gn=Zh(new Float32Array(rr),new Float32Array(ni),new Float32Array(kt),new Float32Array(Qt.matrix),L,Dt.opacity,Mn.baseColorFactor,Yr.emissiveFactor,Mn.metallicFactor,Mn.roughnessFactor,Yr,Wt,j,[0,0,0],pn);!or&&(Jt.hasTranslucentParts||Dt.opacity<1)&&Pr.draw(L,X.gl.TRIANGLES,Ue,xt.disabled,Pt.disabled,mt.backCCW,Gn,j.id,yi.vertexBuffer,yi.indexBuffer,yi.segments,j.paint,L.transform.zoom,void 0,Sr),Pr.draw(L,X.gl.TRIANGLES,or?me:Ue,xt.disabled,or||Dt.opacity<1||Jt.hasTranslucentParts?Pt.alphaBlended:Pt.unblended,mt.backCCW,Gn,j.id,yi.vertexBuffer,yi.indexBuffer,yi.segments,j.paint,L.transform.zoom,void 0,Sr)}}}})()})(l,t,n,c),void x();if(T.type!=="model")return;const S=T.getModels(),M=[],E=l.transform.getFreeCameraOptions().position,C=o.c1([],[E.x,E.y,E.z],l.transform.worldSize);o.eq(C,C);const D=[],z=[];let F=0;for(const L of S){const N=n.paint.get("model-rotation").constantOr(null),j=n.paint.get("model-scale").constantOr(null),q=n.paint.get("model-translation").constantOr(null);L.computeModelMatrix(l,N,j,q,!0,!0,!1);const X=o.bx([]),ee=o.e9(L.position.lat,l.transform.zoom),ie=o.bn([],[1,1,1/ee]);o.bo(X,X,C),M.push({zScaleMatrix:ie,negCameraPosMatrix:X});for(const Y of L.nodes)nu(l.transform,Y,L.matrix,l.transform.expandedFarZProjMatrix,F,D,z);F++}if(D.sort(((L,N)=>N.depth-L.depth)),l.renderPass!=="shadow"){if(d===1)for(const L of z)da(L,l,n,M[L.modelIndex],xt.disabled,l.colorModeForRenderPass());else{for(const L of z)da(L,l,n,M[L.modelIndex],xt.disabled,Pt.disabled);for(const L of z)da(L,l,n,M[L.modelIndex],l.stencilModeFor3D(),l.colorModeForRenderPass());l.resetStencilClippingMasks()}for(const L of D)da(L,l,n,M[L.modelIndex],xt.disabled,l.colorModeForRenderPass());x()}else{for(const L of z)Dc(L.mesh,L.nodeModelMatrix,l,n);for(const L of D)Dc(L.mesh,L.nodeModelMatrix,l,n);x()}}},Oc={line:function(l,t,n){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 f=t.getTile(d).getBucket(l);if(f&&(f.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,t,n){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(n.modelManager&&n.modelManager.upload(n,c.type==="vector"?l.scope:""));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const f of d)f.upload(n.context)},raster:function(l,t,n){const c=t.getSource();if(!(c instanceof ks&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const f=l.paint.get("raster-array-band")||c.getInitialBand(d);if(f==null)return;const m=t.getIds().map((y=>t.getTileByID(y)));for(const y of m)y.updateNeeded(l.id,f)&&c.prepareTile(y,d,l.id,f)},"raster-particle":function(l,t,n){const c=t.getSource();if(!(c instanceof ks&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const f=l.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(f==null)return;const m=t.getIds().map((y=>t.getTileByID(y)));for(const y of m)y.updateNeeded(l.id,f)&&c.prepareTile(y,d,l.id,f)}},kc={fill:rt},En={fill:function(l,t,n,c){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const d=l.context.gl,f=new it(d.LEQUAL,it.ReadOnly,l.depthRangeFor3D),m=new xt({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 S=t.getTile(T),M=S.getBucket(n);if(!M)continue;const E=M.elevatedStructures;if(!E||E.depthSegments.segments[0].primitiveLength===0)continue;const C=xl(T.toUnwrapped(),y),D=l.translatePosMatrix(T.projMatrix,S,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor")),z=wc(D,C,0,1,0);x.draw(l,d.TRIANGLES,f,m,Pt.disabled,mt.disabled,z,n.id,E.vertexBuffer,E.indexBuffer,E.depthSegments,n.paint,l.transform.zoom)}}};class eo{constructor(t,n,c,d,f,m){this.context=new Ac(t,n),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=f,this._timeStamp=o.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const y=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const T of y)this._debugParams.enabledLayers[T]=!0;f.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},(()=>{this.style.map.triggerRepaint()})),f.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),f.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),f.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),f.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),f.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const T of y)f.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],T);this.occlusionParams=new pa(f),this.setup(),this.numSublayers=nn.maxUnderzooming+nn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new o.eE,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new _p(this),this._wireframeDebugCache=new El,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const x=new o.r({width:1,height:1},Uint8Array.of(0,0,0,0));
vendor: 4,087 bytes, line 2760
2760this.emptyDepthTexture=new o.T(this.context,x,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.worldview=m}updateTerrain(t,n){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new yc(this,t));const d=this._terrain;this.transform.elevation=c?d:null,d.update(t,this.transform,n),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const n=t.fog;if(!n||this.transform.projection.name==="globe"||n.getOpacity(this.transform.pitch)<1||n.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,d]=n.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const f=c+.78*(d-c);this.transform.fogCullDistSq=f*f}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 yc(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,n){if(this.width=t*o.q.devicePixelRatio,this.height=n*o.q.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,n=new o.ba;n.emplaceBack(0,0),n.emplaceBack(o.aj,0),n.emplaceBack(0,o.aj),n.emplaceBack(o.aj,o.aj),this.tileExtentBuffer=t.createVertexBuffer(n,o.bc.members),this.tileExtentSegments=o.bd.simpleSegment(0,0,4,2);const c=new o.ba;c.emplaceBack(0,0),c.emplaceBack(o.aj,0),c.emplaceBack(0,o.aj),c.emplaceBack(o.aj,o.aj),this.debugBuffer=t.createVertexBuffer(c,o.bc.members),this.debugSegments=o.bd.simpleSegment(0,0,4,5);const d=new o.ba;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,o.bc.members),this.viewportSegments=o.bd.simpleSegment(0,0,4,2);const f=new o.aZ;f.emplaceBack(0,0,0,0),f.emplaceBack(o.aj,0,o.aj,0),f.emplaceBack(0,o.aj,0,o.aj),f.emplaceBack(o.aj,o.aj,o.aj,o.aj),this.mercatorBoundsBuffer=t.createVertexBuffer(f,o.bf.members),this.mercatorBoundsSegments=o.bd.simpleSegment(0,0,4,2);const m=new o.a_;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const y=new o.bb;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new o.T(t,new o.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=o.bz();const x=this.context.gl;this.stencilClearMode=new xt({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,Pt.disabled,mt.disabled,_c(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,n,c){if(!n||this.currentStencilSource===n.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=n.id;
2760const d=this.context,f=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(Pt.disabled),d.setDepthMode(it.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of c){const x=n.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:M,tileBoundsSegments:E}=this.getTileBoundsBuffers(x);m.draw(this,f.TRIANGLES,it.disabled,new xt({func:f.ALWAYS,mask:0},T,255,f.KEEP,f.KEEP,f.REPLACE),Pt.disabled,mt.disabled,_c(y.projMatrix),"$clipping",S,M,E)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new xt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const n=this.context.gl;return new xt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,c=t.sort(((m,y)=>y.overscaledZ-m.overscaledZ)),d=c[c.length-1].overscaledZ,f=c[0].overscaledZ-d+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const m={};for(let y=0;y<f;y++)m[y+d]=new xt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=f,[m,c]}return[{[d]:xt.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Pt([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new o.am(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Pt.unblended:Pt.alphaBlended}colorModeForDrapableLayerRenderPass(t){const n=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new Pt([n.ONE,n.ONE_MINUS_SRC_ALPHA,n.CONSTANT_ALPHA,n.ONE_MINUS_SRC_ALPHA],new o.am(0,0,0,t===void 0?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(t,n,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 f=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new it(c||this.context.gl.LEQUAL,n,[f,f])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,n=Math.ceil(this.width),c=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),f=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===n&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),n!==0&&c!==0&&(this.depthFBO=new Mo(this.context,n,c,!1,"texture"),this.depthTexture=new o.T(this.context,{width:n,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,f),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,n,c,0,0,n,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,n)=>t+n/this._fpsHistory.length),0))}render(t,n){const c=o.q.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=n;const d=this.style._mergedLayers,f=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(f).filter((me=>{const se=d[me];return!(se.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[se.type]}));let y=m(),x=!1,T=!1,S=null;for(const me of y){const se=d[me];se.type==="circle"?x=!0:se.type==="building"?S=se:se.type==="symbol"&&(se.hasInitialOcclusionOpacityProperties?T=!0:x=!0)}let M=y.map((me=>d[me]));const E=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(o.q.now()),this.imageManager.beginFrame();let C=0,D=!1;for(const me in E){const se=E[me];
vendor: 55,315 bytes, line 2760
2760se.used&&(se.prepare(this.context),se.getSource().usedInConflation&&++C)}let z=!1;for(const me of M)me.isHidden(this.transform.zoom)||(me.type==="clip"&&(z=!0),this.prepareLayer(me));const F={},L={},N={},j={},q={};for(const me in E){const se=E[me];F[me]=se.getVisibleCoordinates(),L[me]=F[me].slice().reverse(),N[me]=se.getVisibleCoordinates(!0).reverse(),j[me]=se.getShadowCasterCoordinates(),q[me]=se.sortCoordinatesByDistance(F[me])}const X=me=>{const se=this.style.getLayerSourceCache(me);return se&&se.used?se.getSource():null};if(C||z||this._clippingActiveLastFrame){const me=[],se=[];let we=0;for(const _e of M)this.isSourceForClippingOrConflation(_e,X(_e))&&(me.push(_e),se.push(we)),we++;if(me&&(z||me.length>1)||this._clippingActiveLastFrame){z=!1;const _e=[];for(let ze=0;ze<me.length;ze++){const Re=me[ze],Le=se[ze],Ze=this.style.getLayerSourceCache(Re);if(!Ze||!Ze.used||!Ze.getSource().usedInConflation&&Re.type!=="clip"&&Re.type!=="building")continue;let at=o.eF,dt=o.bW.None;const Qe=[];let ht=!0;if(Re.type==="building")at=o.eH;else if(Re.type==="clip"){at=Le;for(const lt of Re.layout.get("clip-layer-types"))dt|=lt==="model"?o.bW.Model:lt==="symbol"?o.bW.Symbol:o.bW.FillExtrusion;for(const lt of Re.layout.get("clip-layer-scope"))Qe.push(lt);Re.isHidden(this.transform.zoom)?ht=!1:z=!0}ht&&_e.push({layer:Re.fqid,cache:Ze,order:at,clipMask:dt,clipScope:Qe})}this.replacementSource.setSources(_e),D=!0}}this._clippingActiveLastFrame=z,D||this.replacementSource.clear(),this.conflationActive=D,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let me=0;me<M.length;me++){const se=M[me],we=se.cutoffRange();if(this.longestCutoffRange=Math.max(we,this.longestCutoffRange),we>0){const _e=X(se);_e&&(this.minCutoffZoom=Math.max(_e.minzoom,this.minCutoffZoom)),se.minzoom&&(this.minCutoffZoom=Math.max(se.minzoom,this.minCutoffZoom))}se.is3D(f)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=me),this._lastOcclusionLayer=me)}const ee=this.style&&this.style.fog;ee?(this._fogVisible=ee.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ee.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(N),this.opaquePassCutoff=0,y=m(),M=y.map((me=>d[me])));const ie=this._shadowRenderer;if(ie){ie.updateShadowParameters(this.transform,this.style.directionalLight);for(const me in E)for(const se of F[me]){let we={min:0,max:0};this.terrain&&(we=this.terrain.getMinMaxForTile(se)||we),ie.addShadowReceiver(se.toUnwrapped(),we.min,we.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new o.eG(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ue(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const Y=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),K=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(Y&&!this._snow&&(this._snow=new lu(this)),!Y&&this._snow&&(this._snow.destroy(),delete this._snow),K&&!this._rain&&(this._rain=new _a(this)),!K&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),S){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Qd);const me=this.style.getLayerSourceCache(S);this.buildingTileBorderManager.updateBorders(me,S)}if(!zs.has(this.context.gl))return;this.renderPass="offscreen";for(const me of M){const se=t.getLayerSourceCache(me);if(!me.hasOffscreenPass()||me.isHidden(this.transform.zoom))continue;const we=se?L[se.id]:void 0;(me.type==="custom"||me.type==="raster"||me.type==="raster-particle"||me.isSky()||we&&we.length)&&this.renderLayer(this,se,me,we)}this.depthRangeFor3D=[0,1-(M.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,j)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const J=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),pe=(()=>{if(n.showOverdrawInspector)return o.am.black;const me=this.style.fog;if(me&&this.transform.projection.supportsFog){const se=this.style.getLut(me.scope);if(!J){const we=me.properties.get("color-use-theme")==="none",_e=me.properties.get("color").toNonPremultipliedRenderColor(we?null:se).toArray01();return new o.am(..._e)}if(J){const we=me.properties.get("space-color-use-theme")==="none",_e=me.properties.get("space-color").toNonPremultipliedRenderColor(we?null:se).toArray01();return new o.am(..._e)}}return o.am.transparent})();if(this.context.clear({color:pe,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=y.length-1;this.currentLayer>=0;this.currentLayer--){const me=M[this.currentLayer],se=t.getLayerSourceCache(me);if(me.isSky())continue;const we=se?(me.is3D(f)?q:L)[se.id]:void 0;this._renderTileClippingMasks(me,se,we),this.renderLayer(this,se,me,we)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||o.ah(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const me=M[this.currentLayer],se=t.getLayerSourceCache(me);me.isSky()&&this.renderLayer(this,se,me,se?L[se.id]:void 0)}function oe(me,se){let we;return se&&(we=(me.type==="symbol"?N:me.is3D(f)?q:L)[se.id]),we}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<y.length;){const me=M[this.currentLayer];if(me.type==="raster"||me.type==="raster-particle"){const se=t.getLayerSourceCache(me);this.renderLayer(this,se,me,oe(me,se))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Ie=0;ie&&(Ie=ie.getShadowCastingLayerCount());let xe=!1,Me=-1;for(let me=0;me<y.length;++me){const se=M[me];se.isHidden(this.transform.zoom)||se.is3D(f)&&(Me=me)}T&&Me===-1&&(x=!0);let Ue=!1;for(;this.currentLayer<y.length;){const me=M[this.currentLayer],se=t.getLayerSourceCache(me);if(me.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(me)){if(me.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Ue&&me.is3D(f)&&!f){const we=this.currentLayer,_e=ze=>{for(this.currentLayer=0;this.currentLayer<M.length;this.currentLayer++){const Re=M[this.currentLayer];if(kc[Re.type]){const Le=this.style.getLayerSourceCache(Re);kc[Re.type](this,Le,Re,oe(Re,Le),ze)}}};_e("initialize"),_e("reset"),this.currentLayer=we,Ue=!0}if(x&&!xe&&this.terrain&&!this.transform.isOrthographic&&(xe=!0,this.blitDepth()),T&&Me!==-1&&this.currentLayer===Me+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(me,se,se?F[se.id]:void 0),this.renderLayer(this,se,me,oe(me,se)),!this.terrain&&ie&&Ie>0&&me.hasShadowPass()&&--Ie==0){{this.clearStencil(),this.resetStencilClippingMasks();const we=this.currentLayer;for(this.currentLayer=0;this.currentLayer<M.length;this.currentLayer++){const _e=M[this.currentLayer];if(En[_e.type]){const ze=this.style.getLayerSourceCache(_e);En[_e.type](this,ze,_e,oe(_e,ze))}}this.currentLayer=we}if(ie.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const we=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=we;this.currentLayer++){const _e=M[this.currentLayer];if(!_e.hasLightBeamPass())continue;const ze=t.getLayerSourceCache(_e);this.renderLayer(this,ze,_e,ze?L[ze.id]:void 0)}this.currentLayer=we,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const we=this.currentLayer;this.depthOcclusion=!0;for(const _e of this.layersWithOcclusionOpacity){this.currentLayer=_e;const ze=M[this.currentLayer],Re=t.getLayerSourceCache(ze),Le=Re?L[Re.id]:void 0;this.terrain||this._renderTileClippingMasks(ze,Re,Re?F[Re.id]:void 0),this.renderLayer(this,Re,ze,Le)}this.depthOcclusion=!1,this.currentLayer=we,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 me=null;M.forEach((se=>{const we=t.getLayerSourceCache(se);we&&!se.isHidden(this.transform.zoom)&&we.getVisibleCoordinates().length&&(!me||me.getSource().maxzoom<we.getSource().maxzoom)&&(me=we)})),me&&this.options.showTileBoundaries&&es(this,me,me.getVisibleCoordinates(),o.am.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&es(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new o.am(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&(function(me){const se=me.transform.padding;bl(me,me.transform.height-(se.top||0),3,Xd),bl(me,se.bottom||0,3,tu),Rc(me,se.left||0,3,iu),Rc(me,me.transform.width-(se.right||0),3,ru);const we=me.transform.centerPoint;(function(_e,ze,Re,Le){wl(_e,ze-1,Re-10,2,20,Le),wl(_e,ze-10,Re-1,20,2,Le)})(me,we.x,me.transform.height-we.y,Yd)})(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),D||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:n}=this.transform.projection,c=!n||!n.includes(t.type);if(Oc[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);Oc[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,n,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"||cu[c.type](t,n,c,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=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(n.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,n=this.context.gl,c=n.createQuery();this.deferredRenderGpuTimeQueries.push(c),n.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 n={};for(const c in t){const d=t[c],f=this.context.extTimerQuery,m=f.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;f.deleteQueryEXT(d.query),n[c]=m}return n}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const n=this.context.gl;let c=0;for(const d of t)c+=n.getQueryParameter(d,n.QUERY_RESULT)/1e6,n.deleteQuery(d);return c}translatePosMatrix(t,n,c,d,f){if(!c[0]&&!c[1])return t;const m=f?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(m){const T=Math.sin(m),S=Math.cos(m);c=[c[0]*S-c[1]*T,c[0]*T+c[1]*S]}const y=[f?c[0]:o.aw(n,c[0],this.transform.zoom),f?c[1]:o.aw(n,c[1],this.transform.zoom),0],x=new Float32Array(16);return o.bo(x,t,y),x}saveTileTexture(t){if(t.context!==this.context)return;const n=t.size[0],c=this._tileTextures[n];c?c.push(t):this._tileTextures[n]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,n,c){const d=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,f=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(f.push("LIGHTING_3D_MODE"),f.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||f.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||f.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(f.push("TERRAIN"),this.linearFloatFilteringSupported()&&f.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&f.push("GLOBE"),!this._fogVisible||d||n!==void 0&&!n||f.push("FOG","FOG_DITHERING"),d&&f.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&f.push("OVERDRAW_INSPECTOR"),f}getOrCreateProgram(t,n){this.cache=this.cache||{};const c=n&&n.defines||[],d=n&&n.config,f=this.currentGlobalDefines(t,n&&n.overrideFog,n&&n.overrideRtt).concat(c),m=vc.cacheKey(pl[t],t,f,d);return this.cache[m]||(this.cache[m]=new vc(this.context,t,pl[t],d,$d[t],f)),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 o.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,n){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const f=((m,y,x)=>{const T=m.properties.get("direction"),S=m.properties.get("color-use-theme")==="none",M=m.properties.get("color").toNonPremultipliedRenderColor(S?null:x.getLut(m.scope)).toArray01(),E=m.properties.get("intensity"),C=y.properties.get("color-use-theme")==="none",D=y.properties.get("color").toNonPremultipliedRenderColor(C?null:x.getLut(y.scope)).toArray01(),z=y.properties.get("intensity"),F=[T.x,T.y,T.z],L=o.dI(D,z),N=o.dI(M,E);return{u_lighting_ambient_color:L,u_lighting_directional_dir:F,u_lighting_directional_color:N,u_ground_radiance:Bh(F,N,L)}})(c,d,this.style);n.setLightsUniformValues(t,f)}}}uploadCommonUniforms(t,n,c,d,f){if(this.uploadCommonLightUniforms(t,n),this.terrain&&this.terrain.renderingToTexture)return;const m=this.style.fog;if(m){const y=m.getOpacity(this.transform.pitch),x=((T,S,M,E,C,D,z,F,L,N,j,q)=>{const X=T.transform,ee=S.properties.get("color-use-theme")==="none",ie=S.properties.get("color").toNonPremultipliedRenderColor(ee?null:T.style.getLut(S.scope)).toArray01();ie[3]=E;const Y=T.frameCounter/1e3%1,[K,J]=S.properties.get("vertical-range");return{u_fog_matrix:M?X.calculateFogTileMatrix(M):q||T.identityMat,u_fog_range:S.getFovAdjustedRange(X._fov),u_fog_color:ie,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(K,J),J],u_fog_temporal_offset:Y,u_frustum_tl:C,u_frustum_tr:D,u_frustum_br:z,u_frustum_bl:F,u_globe_pos:L,u_globe_radius:N,u_viewport:j,u_globe_transition:o.ah(X.zoom),u_is_globe:+(X.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*o.q.devicePixelRatio,this.transform.height*o.q.devicePixelRatio],d);n.setFogUniformValues(t,x)}f&&n.setCutoffUniformValues(t,f.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,n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),n}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}getBackgroundTiles(){const t=this._backgroundTiles,n=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const d of c)n[d.key]=t[d.key]||new mo(d,512,this.transform.tileZoom,this,void 0,this.worldview);return n}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,n){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")&&(!n||n.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let n=this._cachedTileFogOpacities[t.key];return n||(this._cachedTileFogOpacities[t.key]=n=this.style.fog.getOpacityForTile(t)),n[0]>=Pe||n[1]>=Pe}setupDepthForOcclusion(t,n,c){const d=this.context,f=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(f.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(f.NEAREST,f.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(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE0),m||n.setTerrainUniformValues(d,c)}}function ga(l,t){let n=!1,c=null;const d=()=>{c=null,n&&(l(),c=setTimeout(d,t),n=!1)};return()=>(n=!0,c||d(),c)}class Bc{constructor(t){this._hashName=t&&encodeURIComponent(t),o.aV(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ga(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 n=Nc(t);if(this._hashName){const c=this._hashName;let d=!1;const f=location.hash.slice(1).split("&").map((m=>{const y=m.split("=")[0];return y===c?(d=!0,`${y}=${n}`):m})).filter((m=>m));return d||f.push(`${c}=${n}`),`#${f.join("&")}`}return`#${n}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map((c=>c.split("="))).forEach((c=>{c[0]===this._hashName&&(n=c)})),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const n=this._getCurrentHash();if(n.length>=3&&!n.some((c=>isNaN(Number(c))))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(n[3]||0):t.getBearing();return t.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:c,pitch:+(n[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Nc(l,t){const n=l.getCenter(),c=Math.round(100*l.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),f=Math.pow(10,d),m=Math.round(n.lng*f)/f,y=Math.round(n.lat*f)/f,x=l.getBearing(),T=l.getPitch();let S=t?`/${m}/${y}/${c}`:`${c}/${y}/${m}`;return(x||T)&&(S+="/"+Math.round(10*x)/10),T&&(S+=`/${Math.round(T)}`),S}const ya={linearity:.3,easing:o.eI(0,0,.3,1)},to=o.h({deceleration:2500,maxSpeed:1400},ya),hu=o.h({deceleration:20,maxSpeed:1400},ya),is=o.h({deceleration:1e3,maxSpeed:360},ya),uu=o.h({deceleration:1e3,maxSpeed:90},ya);class Vc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=o.q.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const n={zoom:0,bearing:0,pitch:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:f}of this._inertiaBuffer)n.zoom+=f.zoomDelta||0,n.bearing+=f.bearingDelta||0,n.pitch+=f.pitchDelta||0,f.panDelta&&n.pan._add(f.panDelta),f.around&&(n.around=f.around),f.pinchAround&&(n.pinchAround=f.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){const f=va(n.pan.mag(),c,o.h({},to,t||{}));d.offset=n.pan.mult(f.amount/n.pan.mag()),d.center=this._map.transform.center,xa(d,f)}if(n.zoom){const f=va(n.zoom,c,hu);d.zoom=this._map.transform.zoom+f.amount,xa(d,f)}if(n.bearing){const f=va(n.bearing,c,is);d.bearing=this._map.transform.bearing+o.ay(f.amount,-179,179),xa(d,f)}if(n.pitch){const f=va(n.pitch,c,uu);d.pitch=this._map.transform.pitch+f.amount,xa(d,f)}if(d.zoom||d.bearing){const f=n.pinchAround===void 0?n.around:n.pinchAround;d.around=f?this._map.unproject(f):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function xa(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function va(l,t,n){const{maxSpeed:c,linearity:d,deceleration:f}=n,m=o.ay(l*d/(t/1e3),-c,c),y=Math.abs(m)/(f*d);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class Li extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c,d={}){const f=qn(n.getCanvasContainer(),c),m=n.unproject(f);super(t,o.h({point:f,lngLat:m,originalEvent:c},d)),this._defaultPrevented=!1,this.target=n}}class ba extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c){const d=t==="touchend"?c.changedTouches:c.touches,f=Cs(n.getCanvasContainer(),d),m=f.map((x=>n.unproject(x))),y=f.reduce(((x,T,S,M)=>x.add(T.div(M.length))),new o.P(0,0));super(t,{points:f,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:c}),this._defaultPrevented=!1}}class du extends o.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n){super("wheel",{originalEvent:n}),this._defaultPrevented=!1}}class fu{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new du(this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Li(t.type,this._map,t))}mouseup(t){this._map.fire(new Li(t.type,this._map,t))}preclick(t){const n=o.h({},t);n.type="preclick",this._map.fire(new Li(n.type,this._map,n))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Li(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Li(t.type,this._map,t))}mouseover(t){this._map.fire(new Li(t.type,this._map,t))}mouseout(t){this._map.fire(new Li(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ba(t.type,this._map,t))}touchmove(t){this._map.fire(new ba(t.type,this._map,t))}touchend(t){this._map.fire(new ba(t.type,this._map,t))}touchcancel(t){this._map.fire(new ba(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ro{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Li(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Li("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Li(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pu{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(As(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const c=n,d=this._startPos,f=this._lastPos;if(!d||!f||f.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=Bt("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,n){if(!this._active)return;const c=this._startPos,d=n;if(c&&t.button===0){if(this.reset(),ko(),c.x!==d.x||c.y!==d.y)return this._map.fire(new o.A("boxzoomend",{originalEvent:t})),{cameraAnimation:f=>f.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),ls(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new o.A(t,{originalEvent:n}))}}function Al(l,t){const n={};for(let c=0;c<l.length;c++)n[l[c].identifier]=t[c];return n}class mu{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,n,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 f=new o.P(0,0);for(const m of d)f._add(m);return f.div(d.length)})(n),this.touches=Al(c,n)))}touchmove(t,n,c){if(this.aborted||!this.centroid)return;const d=Al(c,n);for(const f in this.touches){const m=d[f];(!m||m.dist(this.touches[f])>30)&&(this.aborted=!0)}}touchend(t,n,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 io{constructor(t){this.singleTap=new mu(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,n,c){this.singleTap.touchstart(t,n,c)}touchmove(t,n,c){this.singleTap.touchmove(t,n,c)}touchend(t,n,c){const d=this.singleTap.touchend(t,n,c);if(d){const f=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(d)<30;if(f&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class _u{constructor(){this._zoomIn=new io({numTouches:1,numTaps:2}),this._zoomOut=new io({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,c){this._zoomIn.touchstart(t,n,c),this._zoomOut.touchstart(t,n,c)}touchmove(t,n,c){this._zoomIn.touchmove(t,n,c),this._zoomOut.touchmove(t,n,c)}touchend(t,n,c){const d=this._zoomIn.touchend(t,n,c),f=this._zoomOut.touchend(t,n,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})}):f?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(f)},{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 gu={0:1,2:2},Uc={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class wa{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,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const c=Gl(t);this._correctButton(t,c)&&(this._lastPoint=n,this._eventButton=c)}mousemoveWindow(t,n){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&(function(d,f){const m=gu[f];return d.buttons===void 0||(d.buttons&m)!==m})(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(c,n)}}mouseupWindow(t){this._lastPoint&&Gl(t)===this._eventButton&&(this._moved&&ko(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class yu extends wa{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class jc extends wa{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Uc[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const c=.8*(n.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class xu extends wa{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Uc[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const c=-.5*(n.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class nf{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),o.aV(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}touchstart(t,n,c){return this._calculateTransform(t,n,c)}touchmove(t,n,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!o.eJ())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,n,c)}}touchend(t,n,c){this._calculateTransform(t,n,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,c){c.length>0&&(this._active=!0);const d=Al(c,n),f=new o.P(0,0),m=new o.P(0,0);let y=0;for(const T in d){const S=d[T],M=this._touches[T];M&&(f._add(S),m._add(S.sub(M)),y++,d[T]=S)}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:f.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=Bt("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 Gc{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,n,c){return{}}touchstart(t,n,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,c){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[f,m]=d,y=Ml(c,n,f),x=Ml(c,n,m);if(!y||!x)return;const T=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],T,t)}touchend(t,n,c){if(!this._firstTwoTouches)return;const[d,f]=this._firstTwoTouches,m=Ml(c,n,d),y=Ml(c,n,f);m&&y||(this._active&&ko(),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 Ml(l,t,n){for(let c=0;c<l.length;c++)if(l[c].identifier===n)return t[c]}function vu(l,t){return Math.log(l/t)/Math.LN2}class sf extends Gc{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(vu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:vu(this._distance,c),pinchAround:n}}}function bu(l,t){return 180*l.angleWith(t)/Math.PI}class of extends Gc{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,n){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:bu(this._vector,c),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const d=bu(t,c);return Math.abs(d)<n}}function qc(l){return Math.abs(l.y)>Math.abs(l.x)}class af extends Gc{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,qc(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,c){const d=this._lastPoints;if(!d)return;const f=t[0].sub(d[0]),m=t[1].sub(d[1]);return this._map._cooperativeGestures&&!o.eJ()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(f,m,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(f.y+m.y)/2*-.5})}gestureBeginsVertically(t,n,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,f=n.mag()>=2;if(!d&&!f)return;if(!d||!f)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return qc(t)&&qc(n)&&m}}const lf={panStep:100,bearingStep:15,pitchStep:10};class cf{constructor(){const t=lf;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 n=0,c=0,d=0,f=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),f=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),f=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:hf,zoom:n?Math.round(x)+n*(t.shiftKey?2:1):x,bearing:y.getBearing()+c*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-f*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 hf(l){return l*(2-l)}const uf=4.000244140625,Bp=1/450;class Np{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Bp,o.aV(["_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()||o.eJ()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=o.q.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,n!==0&&n%uf==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=n,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,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 n=qn(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:n,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 n=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>uf?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const M=n(),E=Math.pow(2,M),C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):E;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(C*S))),this._type==="wheel"&&(this._startZoom=M,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:n(),d=this._startZoom,f=this._easing;let m,y=!1;if(this._type==="wheel"&&d&&f){const T=Math.min((o.q.now()-this._lastWheelEventTime)/200,1),S=f(T);m=o.ai(d,c,S),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-n();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 n=o.eK;if(this._prevEase){const c=this._prevEase,d=(o.q.now()-c.start)/c.duration,f=c.easing(d+.01)-c.easing(d),m=.27/Math.sqrt(f*f+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=o.eI(m,y,.25,1)}return this._prevEase={start:o.q.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Bt("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 Ni{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 df{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,n){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vp{constructor(){this._tap=new io({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,n,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=n[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,n,c))}touchmove(t,n,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=n[0],f=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(t,n,c)}touchend(t,n,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,n,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 wu{constructor(t,n,c){this._el=t,this._mousePan=n,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 Up{constructor(t,n,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,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 Cl{constructor(t,n,c,d){this._el=t,this._touchZoom=n,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 Pl=l=>l.zoom||l.drag||l.pitch||l.rotate;class Tu extends o.A{}class Hc{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,n){const c=o.at([],n,t);this.radius=o.ae(c[2]<0?o.eM([],c,this.constants):[c[0],c[1],0])}projectRay(t){o.eM(t,t,this.constants),o.au(t,t),o.eN(t,t,this.constants);const n=o.c1([],t,this.radius);if(n[2]>0){const c=o.c1([],[0,0,1],o.bG(n,[0,0,1])),d=o.c1([],o.au([],[n[0],n[1],0]),this.radius),f=o.d5([],n,o.c1([],o.at([],o.d5([],d,c),n),2));n[0]=f[0],n[1]=f[1]}return n}}function Un(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class $c{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Vc(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Hc,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),o.aV(["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,f,m]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(f,y,m)}}destroy(){for(const[t,n,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(n,d,c)}}_addDefaultHandlers(t){const n=this._map,c=n.getCanvasContainer();this._add("mapEvent",new fu(n,t));const d=n.boxZoom=new pu(n,t);this._add("boxZoom",d);const f=new _u,m=new df;n.doubleClickZoom=new Ni(m,f),this._add("tapZoom",f),this._add("clickZoom",m);const y=new Vp;this._add("tapDragZoom",y);const x=n.touchPitch=new af(n);this._add("touchPitch",x);const T=new jc(t),S=new xu(t);n.dragRotate=new Up(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const M=new yu(t),E=new nf(n,t);n.dragPan=new wu(c,M,E),this._add("mousePan",M),this._add("touchPan",E,["touchZoom","touchRotate"]);const C=new of,D=new sf;n.touchZoomRotate=new Cl(c,D,C,y),this._add("touchRotate",C,["touchPan","touchZoom"]),this._add("touchZoom",D,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Ro(n));const z=n.scrollZoom=new Np(n,this);this._add("scrollZoom",z,["mousePan"]);const F=n.keyboard=new cf;this._add("keyboard",F);for(const L of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[L]&&n[L].enable(t[L])}_add(t,n,c){this._handlers.push({handlerName:t,handler:n,allowed:c}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.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!!Pl(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,n,c){for(const d in t)if(d!==c&&(!n||n.indexOf(d)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const c of t)this._el.contains(c.target)&&n.push(c);return n}handleEvent(t,n){this._updatingCamera=!0;const c=t.type==="renderFrame",d=c?void 0:t,f={needsRenderFrame:!1},m={},y={},x=t.touches?this._getMapTouches(t.touches):void 0,T=x?Cs(this._el,x):c?void 0:qn(this._el,t);for(const{handlerName:E,handler:C,allowed:D}of this._handlers){if(!C.isEnabled())continue;let z;this._blockedByActive(y,D,E)?C.reset():C[n||t.type]&&(z=C[n||t.type](t,T,x),this.mergeHandlerResult(f,m,z,E,d),z&&z.needsRenderFrame&&this._triggerRenderFrame()),(z||C.isActive())&&(y[E]=C)}const S={};for(const E in this._previousActiveHandlers)y[E]||(S[E]=d);this._previousActiveHandlers=y,(Object.keys(S).length||Un(f))&&(this._changes.push([f,m,S]),this._triggerRenderFrame()),(Object.keys(y).length||Un(f))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=f;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,c,d,f){if(!c)return;o.h(t,c);const m={handlerName:d,originalEvent:c.originalEvent||f};c.zoomDelta!==void 0&&(n.zoom=m),c.panDelta!==void 0&&(n.drag=m),c.pitchDelta!==void 0&&(n.pitch=m),c.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},c={};for(const[d,f,m]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new o.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),o.h(n,f),o.h(c,m);this._updateMapTransform(t,n,c),this._changes=[]}_updateMapTransform(t,n,c){const d=this._map,f=d.transform,m=N=>[N.x,N.y,N.z];if((N=>{const j=this._eventsInProgress.drag;return j&&!this._handlersById[j.handlerName].isActive()})()&&!Un(t)){const N=f.zoom;f.cameraElevationReference="sea",this._originalZoom!=null&&f._orthographicProjectionAtLowPitch&&f.projection.name!=="globe"&&f.pitch===0?(f.cameraElevationReference="ground",f.zoom=this._originalZoom):(f.recenterOnTerrain(),f.cameraElevationReference="ground"),N!==f.zoom&&this._map._update(!0)}if(f._isCameraConstrained&&d._stop(!0),!Un(t))return void this._fireEvents(n,c,!0);let{panDelta:y,zoomDelta:x,bearingDelta:T,pitchDelta:S,around:M,aroundCoord:E,pinchAround:C}=t;f._isCameraConstrained&&(x>0&&(x=0),f._isCameraConstrained=!1),C!==void 0&&(M=C),(x||(N=>n[N]&&!this._eventsInProgress[N])("drag"))&&M&&(this._dragOrigin=m(f.pointCoordinate3D(M)),this._originalZoom=f.zoom,this._trackingEllipsoid.setup(f._camera.position,this._dragOrigin)),f.cameraElevationReference="sea",d._stop(!0),M=M||d.transform.centerPoint,T&&(f.bearing+=T),S&&(f.pitch+=S),f._updateCameraState();const D=[0,0,0];if(y)if(f.projection.name==="mercator"){const N=this._trackingEllipsoid.projectRay(f.screenPointToMercatorRay(M).dir),j=this._trackingEllipsoid.projectRay(f.screenPointToMercatorRay(M.sub(y)).dir);D[0]=j[0]-N[0],D[1]=j[1]-N[1]}else{const N=f.pointCoordinate(M);if(f.projection.name==="globe"){y=y.rotate(-f.angle);const j=f._pixelsPerMercatorPixel/f.worldSize;D[0]=-y.x*o.eL(o.aY(N.y))*j,D[1]=-y.y*o.eL(f.center.lat)*j}else{const j=f.pointCoordinate(M.sub(y));N&&j&&(D[0]=j.x-N.x,D[1]=j.y-N.y)}}const z=f.zoom,F=[0,0,0];if(x){const N=m(E||f.pointCoordinate3D(M)),j={dir:o.au([],o.at([],N,f._camera.position))};if(j.dir[2]<0){const q=f.zoomDeltaToMovement(N,x);o.c1(F,j.dir,q)}}const L=o.d5(D,D,F);f._translateCameraConstrained(L),x&&Math.abs(f.zoom-z)>1e-4&&f.recenterOnTerrain(),f.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,c,!0)}_fireEvents(t,n,c){const d=Pl(this._eventsInProgress),f=Pl(t),m={};for(const S in t){const{originalEvent:M}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=M),this._eventsInProgress[S]=t[S]}!d&&f&&this._fireEvent("movestart",f.originalEvent);for(const S in m)this._fireEvent(S,m[S]);f&&this._fireEvent("move",f.originalEvent);for(const S in t){const{originalEvent:M}=t[S];this._fireEvent(S,M)}const y={};let x;for(const S in this._eventsInProgress){const{handlerName:M,originalEvent:E}=this._eventsInProgress[S];this._handlersById[M].isActive()||(delete this._eventsInProgress[S],x=n[M]||E,y[`${S}end`]=x)}for(const S in y)this._fireEvent(S,y[S]);const T=Pl(this._eventsInProgress);if(c&&(d||f)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=E=>E!==0&&-this._bearingSnap<E&&E<this._bearingSnap;S?(M(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:x})):(this._map.fire(new o.A("moveend",{originalEvent:x})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new o.A(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{this._frameId=void 0,this.handleEvent(new Tu("renderFrame",{timeStamp:t})),this._applyChanges()}))}
2760_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const sr="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class rs extends o.E{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this._respectPrefersReducedMotion=n.respectPrefersReducedMotion!==!1,o.aV(["_renderFrameCallback"],this)}getCenter(){return new o.ci(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,c){return t=o.P.convert(t).mult(-1),this.panTo(this.transform.center,o.h({offset:t},n),c)}panTo(t,n,c){return this.easeTo(o.h({center:t},n),c)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,c){return this.easeTo(o.h({zoom:t},n),c)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,c){return this.easeTo(o.h({bearing:t},n),c)}resetNorth(t,n){return this.rotateTo(0,o.h({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(o.h({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=o.aG.convert(t);const c=n&&n.bearing||0,d=n&&n.pitch||0,f=t.getNorthWest(),m=t.getSouthEast();return this._cameraForBounds(this.transform,f,m,c,d,n)}_extendPadding(t){const n={top:0,right:0,bottom:0,left:0};return t==null?o.h({},n,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:o.h({},n,t)}_extendCameraOptions(t){return(t=o.h({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,n){const c=n.max[0]-n.min[0],d=n.max[1]-n.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,n,c,d,f,m){const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=f;const T=o.ci.convert(n),S=o.ci.convert(c),M=.5*(T.lat+S.lat),E=.5*(T.lng+S.lng),C=o.eO(M,E),D=o.au([],C),z=o.au([],o.bF([],D,[0,1,0])),F=o.bF([],z,D),L=[z[0],z[1],z[2],0,F[0],F[1],F[2],0,D[0],D[1],D[2],0,0,0,0,1],N=[C,o.eO(T.lat,T.lng),o.eO(S.lat,T.lng),o.eO(S.lat,S.lng),o.eO(T.lat,S.lng),o.eO(M,T.lng),o.eO(M,S.lng),o.eO(T.lat,E),o.eO(S.lat,E)];let j=o.d6.fromPoints(N.map((_e=>[o.bG(z,_e),o.bG(F,_e),o.bG(D,_e)])));const q=o.ad([],j.center,L);o.eP(q)===0&&o.eQ(q,0,0,1),o.au(q,q),o.c1(q,q,o.aB),y.center=o.eR(q);const X=y.getWorldToCameraMatrix(),ee=o.bi(new Float64Array(16),X);j=o.d6.applyTransform(j,o.az([],X,L));const ie=this._extendAABB(j,y,x,d);if(!ie)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");j=ie,o.ad(q,q,X);const Y=.5*(j.max[2]-j.min[2]),K=this._minimumAABBFrustumDistance(y,j),J=o.c1([],[0,0,1],Y),pe=o.d5(J,q,J),oe=K+(y.pitch===0?0:o.bD(q,pe)),Ie=y.globeCenterInViewSpace,xe=o.at([],q,[Ie[0],Ie[1],Ie[2]]);o.au(xe,xe),o.c1(xe,xe,oe);const Me=o.d5([],q,xe);o.ad(Me,Me,ee);
vendor: 13,270 bytes, line 2760
2760const Ue=o.eB/o.aB,me=o.ae(Me),se=o.cb(Math.max(me*Ue-o.eB,Number.EPSILON),0),we=Math.min(y.zoomFromMercatorZAdjusted(se),x.maxZoom);return we>.5*(o.cX+o.cI)?(y.setProjection({name:"mercator"}),y.zoom=we,this._cameraForBounds(y,n,c,d,f,m)):{center:y.center,zoom:we,bearing:d,pitch:f}}_extendAABB(t,n,c,d){const f=.5*((c.padding.left||0)+(c.padding.right||0)),m=.5*((c.padding.top||0)+(c.padding.bottom||0)),y=m,x=f,T=f,S=m,M=n.width-(x+T),E=n.height-(y+S),C=o.at([],t.max,t.min),D=Math.min(M/C[0],E/C[1]),z=Math.min(n.scaleZoom(n.scale*D),c.maxZoom);if(isNaN(z))return null;const F=n.scale/n.zoomScale(z),L=new o.d6([t.min[0]-x*F,t.min[1]-S*F,t.min[2]],[t.max[0]+T*F,t.max[1]+y*F,t.max[2]]),N=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new o.P(c.offset.x,c.offset.y):o.P.convert(c.offset)).rotate(-o.al(d));return L.center[0]-=N.x*F,L.center[1]+=N.y*F,L}queryTerrainElevation(t,n){const c=this.transform.elevation;return c?(n=o.h({},{exaggerated:!0},n),c.getAtPoint(o.ac.fromLngLat(t),null,n.exaggerated)):null}_cameraForBounds(t,n,c,d,f,m){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,n,c,d,f,m);const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=f;const T=o.ci.convert(n),S=o.ci.convert(c),M=new o.ci(T.lng,S.lat),E=new o.ci(S.lng,T.lat),C=y.project(T),D=y.project(S),z=this.queryTerrainElevation(T),F=this.queryTerrainElevation(S),L=this.queryTerrainElevation(M),N=this.queryTerrainElevation(E),j=[[C.x,C.y,Math.min(z||0,F||0,L||0,N||0)],[D.x,D.y,Math.max(z||0,F||0,L||0,N||0)]];let q=o.d6.fromPoints(j);const X=y.getWorldToCameraMatrix(),ee=o.bi(new Float64Array(16),X);q=o.d6.applyTransform(q,X);const ie=this._extendAABB(q,y,x,d);if(!ie)return void o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");q=ie;const Y=.5*o.at([],q.max,q.min)[2],K=this._minimumAABBFrustumDistance(y,q),J=[0,0,1,0];o.aA(J,J,X),o.eS(J,J);const pe=o.c1([],J,K+Y),oe=o.d5([],q.center,pe);o.ad(q.center,q.center,ee),o.ad(oe,oe,ee);const Ie=y.unproject(new o.P(q.center[0],q.center[1])),xe=o.eT(y.projection,Ie),Me=Math.pow(2,xe),Ue=Math.min(y._zoomFromMercatorZ(oe[2]*y.pixelsPerMeter*Me/y.worldSize),x.maxZoom);return y.mercatorFromTransition&&Ue<.5*(o.cX+o.cI)?(y.setProjection({name:"globe"}),y.zoom=Ue,this._cameraForBounds(y,n,c,d,f,m)):{center:Ie,zoom:Ue,bearing:d,pitch:f}}fitBounds(t,n,c){const d=this.cameraForBounds(t,n);return this._fitInternal(d,n,c)}fitScreenCoordinates(t,n,c,d,f){const m=o.P.convert(t),y=o.P.convert(n),x=new o.P(Math.min(m.x,y.x),Math.min(m.y,y.y)),T=new o.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 S=this.transform.pointLocation3D(x),M=this.transform.pointLocation3D(T),E=this.transform.pointLocation3D(new o.P(x.x,T.y)),C=this.transform.pointLocation3D(new o.P(T.x,x.y)),D=[Math.min(S.lng,M.lng,E.lng,C.lng),Math.min(S.lat,M.lat,E.lat,C.lat)],z=[Math.max(S.lng,M.lng,E.lng,C.lng),Math.max(S.lat,M.lat,E.lat,C.lat)],F=d&&d.pitch?d.pitch:this.getPitch(),L=this._cameraForBounds(this.transform,D,z,c,F,d);return this._fitInternal(L,d,f)}_fitInternal(t,n,c){return t?(n=o.h(t,n)).linear?this.easeTo(n,c):this.flyTo(n,c):this}jumpTo(t,n){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,f=!1,m=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=o.ci.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(f=!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 o.A("movestart",n)).fire(new o.A("move",n)),d&&this.fire(new o.A("zoomstart",n)).fire(new o.A("zoom",n)).fire(new o.A("zoomend",n)),f&&this.fire(new o.A("rotatestart",n)).fire(new o.A("rotate",n)).fire(new o.A("rotateend",n)),m&&this.fire(new o.A("pitchstart",n)).fire(new o.A("pitch",n)).fire(new o.A("pitchend",n)),this.fire(new o.A("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||o.w(sr),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,n){const c=this.transform;if(!c.projection.supportsFreeCamera)return o.w(sr),this;this.stop();const d=c.zoom,f=c.pitch,m=c.bearing;c.setFreeCameraOptions(t);const y=d!==c.zoom,x=f!==c.pitch,T=m!==c.bearing;return this.fire(new o.A("movestart",n)).fire(new o.A("move",n)),y&&this.fire(new o.A("zoomstart",n)).fire(new o.A("zoom",n)).fire(new o.A("zoomend",n)),T&&this.fire(new o.A("rotatestart",n)).fire(new o.A("rotate",n)).fire(new o.A("rotateend",n)),x&&this.fire(new o.A("pitchstart",n)).fire(new o.A("pitch",n)).fire(new o.A("pitchend",n)),this.fire(new o.A("moveend",n)),this}easeTo(t,n){this._stop(!1,t.easeId),((t=o.h({offset:[0,0],duration:500,easing:o.eK},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),f=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?+t.zoom:d,T="bearing"in t?this._normalizeBearing(t.bearing,f):f,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),E=o.P.convert(t.offset);let C,D,z;if(c.projection.name==="globe"){const J=o.ac.fromLngLat(c.center),pe=E.rotate(-c.angle);J.x+=pe.x/c.worldSize,J.y+=pe.y/c.worldSize;const oe=J.toLngLat(),Ie=o.ci.convert(t.center||oe);this._normalizeCenter(Ie),C=c.centerPoint.add(pe),D=new o.P(J.x,J.y).mult(c.worldSize),z=new o.P(o.aD(Ie.lng),o.aH(Ie.lat)).mult(c.worldSize).sub(D)}else{C=c.centerPoint.add(E);const J=c.pointLocation(C),pe=o.ci.convert(t.center||J);this._normalizeCenter(pe),D=c.project(J),z=c.project(pe).sub(D)}const F=c.zoomScale(x-d);let L,N;t.around&&(L=o.ci.convert(t.around),N=c.locationPoint(L));const j=this._zooming||x!==d,q=this._rotating||f!==T,X=this._pitching||S!==m,ee=!c.isPaddingEqual(M),ie=t.retainPadding===!1?c.clone():c,Y=J=>pe=>{if(j&&(J.zoom=o.ai(d,x,pe)),q&&(J.bearing=o.ai(f,T,pe)),X&&(J.pitch=o.ai(m,S,pe)),ee&&(ie.interpolatePadding(y,M,pe),C=ie.centerPoint.add(E)),L)J.setLocationAtPoint(L,N);else{const oe=J.zoomScale(J.zoom-d),Ie=x>d?Math.min(2,F):Math.max(.5,F),xe=Math.pow(Ie,1-pe),Me=J.unproject(D.add(z.mult(pe*xe)).mult(oe));J.setLocationAtPoint(J.renderWorldCopies?Me.wrap():Me,C)}return t.preloadOnly||this._fireMoveEvents(n),J};if(t.preloadOnly){const J=this._emulate(Y,t.duration,c);return this._preloadTiles(J),this}const K={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=j,this._rotating=q,this._pitching=X,this._padding=ee,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,K),this._ease(Y(c),(J=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(n,J)}),t),this}_prepareEase(t,n,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),n||c.moving||this.fire(new o.A("movestart",t)),this._zooming&&!c.zooming&&this.fire(new o.A("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new o.A("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new o.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new o.A("move",t)),this._zooming&&this.fire(new o.A("zoom",t)),this._rotating&&this.fire(new o.A("rotate",t)),this._pitching&&this.fire(new o.A("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,f=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new o.A("zoomend",t)),d&&this.fire(new o.A("rotateend",t)),f&&this.fire(new o.A("pitchend",t)),this.fire(new o.A("moveend",t))}flyTo(t,n){if(this._prefersReducedMotion(t)){const _e=o.aF(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(_e,n)}this.stop(),t=o.h({offset:[0,0],speed:1.2,curve:1.42,easing:o.eK},t);const c=this.transform,d=this.getZoom(),f=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?o.ay(+t.zoom,c.minZoom,c.maxZoom):d,T="bearing"in t?this._normalizeBearing(t.bearing,f):f,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),E=c.zoomScale(x-d),C=o.P.convert(t.offset);let D=c.centerPoint.add(C);const z=c.pointLocation(D),F=o.ci.convert(t.center||z);this._normalizeCenter(F);const L=c.project(z),N=c.project(F).sub(L);let j=t.curve;const q=Math.max(c.width,c.height),X=q/E,ee=N.mag();if("minZoom"in t){const _e=o.ay(Math.min(t.minZoom,d,x),c.minZoom,c.maxZoom),ze=q/c.zoomScale(_e-d);j=Math.sqrt(ze/ee*2)}const ie=j*j;function Y(_e){const ze=(X*X-q*q+(_e?-1:1)*ie*ie*ee*ee)/(2*(_e?X:q)*ie*ee);return Math.log(Math.sqrt(ze*ze+1)-ze)}function K(_e){return(Math.exp(_e)-Math.exp(-_e))/2}function J(_e){return(Math.exp(_e)+Math.exp(-_e))/2}const pe=Y(0);let oe=function(_e){return J(pe)/J(pe+j*_e)},Ie=function(_e){return q*((J(pe)*(K(ze=pe+j*_e)/J(ze))-K(pe))/ie)/ee;var ze},xe=(Y(1)-pe)/j;if(Math.abs(ee)<1e-6||!isFinite(xe)){if(Math.abs(q-X)<1e-6)return this.easeTo(t,n);const _e=X<q?-1:1;xe=Math.abs(Math.log(X/q))/j,Ie=function(){return 0},oe=function(ze){return Math.exp(_e*j*ze)}}t.duration="duration"in t?+t.duration:1e3*xe/("screenSpeed"in t?+t.screenSpeed/j:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Me=f!==T,Ue=S!==m,me=!c.isPaddingEqual(M),se=t.retainPadding===!1?c.clone():c,we=_e=>ze=>{const Re=ze*xe,Le=1/oe(Re);_e.zoom=ze===1?x:d+_e.scaleZoom(Le),Me&&(_e.bearing=o.ai(f,T,ze)),Ue&&(_e.pitch=o.ai(m,S,ze)),me&&(se.interpolatePadding(y,M,ze),D=se.centerPoint.add(C));const Ze=ze===1?F:_e.unproject(L.add(N.mult(Ie(Re))).mult(Le));return _e.setLocationAtPoint(_e.renderWorldCopies?Ze.wrap():Ze,D),_e._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(n),_e};if(t.preloadOnly){const _e=this._emulate(we,t.duration,c);return this._preloadTiles(_e),this}return this._zooming=!0,this._rotating=Me,this._pitching=Ue,this._padding=me,this._prepareEase(n,!1),this._ease(we(c),(()=>this._afterEase(n)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,n){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,n)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,n,c){c.animate===!1||c.duration===0?(t(1),n()):(this._easeStart=o.q.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((o.q.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=o.bQ(t,-180,180);const c=Math.abs(t-n);return Math.abs(t-360-n)<c&&(t-=360),Math.abs(t+360-n)<c&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(n.maxBounds||n.projection.name!=="globe"&&!n.renderWorldCopies)return;const c=t.lng-n.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&o.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,n,c){const d=Math.ceil(15*n/1e3),f=[],m=t(c.clone());for(let y=0;y<=d;y++){const x=m(y/d);f.push(x.clone())}return f}_preloadTiles(t,n){}}class Ta{constructor(t={}){this.options=t,o.aV(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const n=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Bt("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=Bt("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=Bt("div","mapboxgl-ctrl-attrib-inner",this._container),n&&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),n===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","fal
2760se")):(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 n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||o.e.ACCESS_TOKEN}];if(t){const c=n.reduce(((d,f,m)=>(f.value&&(d+=`${f.key}=${f.value}${m<n.length-1?"&":""}`),d)),"?");t.href=`${o.e.FEEDBACK_URL}/${c}#${Nc(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||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 n=this._map.style._mergedSourceCaches;for(const d in n){const f=n[d];if(f.used){const m=f.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t.sort(((d,f)=>d.length-f.length)),t=t.filter(((d,f)=>{for(let m=f+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.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 zl{constructor(){o.aV(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=Bt("div","mapboxgl-ctrl");const n=Bt("a","mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://www.mapbox.com/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),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 n in t){const c=t[n].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<250?n.classList.add("mapboxgl-compact"):n.classList.remove("mapboxgl-compact")}}}class Su{constructor(){o.aV(["_onIndoorUpdate"],this)}onAdd(t){return this._map=t,this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("indoorupdate",(n=>this._onIndoorUpdate({selectedFloorId:n.selectedFloorId,floors:n.floors}))),this._container}_createButton(t,n){const c=Bt("button",t,this._container);return c.type="button",c.addEventListener("click",n),c}_setButtonTitle(t,n){this._map&&(t.setAttribute("aria-label",n),t.innerHTML=`<strong>${n}</strong>`,t.firstElementChild&&t.firstElementChild.setAttribute("title",n))}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("indoorupdate",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(t){if(!t||!t.floors)return void(this._container.style.display="none");const n=this._model;this._model=t,this._container.style.display="inline-block";const c=t.floors.sort(((d,f)=>d.levelOrder-f.levelOrder));
vendor: 9,464 bytes, line 2760
2760n?(Array.from(this._container.children).forEach((d=>d.remove())),this.addCurrentFloors(c)):this.addCurrentFloors(c)}addCurrentFloors(t){for(const n of t){const c=this._createButton("mapboxgl-ctrl-level-button",(()=>{this._map._selectIndoorFloor(n.id),Array.from(this._container.children).forEach((d=>{d.classList.remove("mapboxgl-ctrl-level-button-selected")})),c.classList.add("mapboxgl-ctrl-level-button-selected")}));this._setButtonTitle(c,n.shortName),this._model&&n.id===this._model.selectedFloorId&&(this._map._selectIndoorFloor(n.id),c.classList.add("mapboxgl-ctrl-level-button-selected")),this._container.append(c)}}}class ff{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,c=n?this._queue.concat(n):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const n=this._currentlyRunning=this._queue;this._queue=[];for(const c of n)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Rl{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const n=o.dx((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}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,n,c){this._start=this.getValue(n),this._end=t,this._startTime=n,this._endTime=n+c}}const jp={"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 pf extends o.A{constructor(t,n,c,d){const{point:f,lngLat:m,originalEvent:y,target:x}=t;super(t.type,{point:f,lngLat:m,originalEvent:y,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=n,this.interaction=c,this.feature=d}}class Eu{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,n){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=n.filter;let d=n.type;c&&this.filters.set(t,o.b3(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const f=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,n)):f.size===0&&this.map.on(d,this.handleType),f.size===0&&this.interactionsByType.set(d,f),f.set(t,n),this.typeById.set(t,d)}get(t){const n=this.typeById.get(t);if(!n)return;const c=this.interactionsByType.get(n);return c?c.get(t):void 0}remove(t){const n=this.typeById.get(t);if(!n)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(n);c&&(c.delete(t),n==="mouseenter"||n==="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(n,this.handleType))}queryTargets(t,n){const c=[];for(const[d,f]of n)f.target&&c.push({targetId:d,target:f.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 n=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());n.length&&(t.type="mouseenter",this.handleType(t,n));const c=new Map;for(const[d,{feature:f}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(f.id,f);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const n=Array.from(this.hoveredFeatures.values()).map((({feature:c})=>c));n.length&&(t.type="mouseleave",this.handleType(t,n)),this.hoveredFeatures.clear()}handleType(t,n){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void o.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),f=!!n;n=n||this.queryTargets(t.point,d);let m=!1;const y=new Set;for(const x of n){for(const[T,S]of d){if(!S.target)continue;const M=x.variants?x.variants[T]:null;if(M){for(const E of M){if($l(E,x,y,T))continue;const C=new o.dr(x,E),D=Za(E,x,T);f&&(C.state=this.map.getFeatureState(C));const z=c?this.prevHoveredFeatures.get(D):null,F=new pf(t,T,S,C),L=z?z.stop:S.handler(F);if(c&&this.hoveredFeatures.set(D,{feature:x,stop:L}),L!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,T]of d){const{handler:S,target:M}=T;if(!M&&S(new pf(t,x,T,null))!==!1)break}}}function Iu(l,t){if(Array.isArray(l)&&Array.isArray(t)){const n=new Set(l),c=new Set(t);return n.size===c.size&&l.every((d=>c.has(d)))}return o.bv(l,t)}const Dl={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"},Sa={showCompass:!0,showZoom:!0,visualizePitch:!1};class ws{constructor(t,n,c=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new jc({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new xu({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),o.aV(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),As()}move(t,n){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,n),f=d&&d.bearingDelta;if(f&&c.setBearing(c.getBearing()+f),this.mousePitch){const m=this.mousePitch.mousemoveWindow(t,n),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(){ls(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(o.h({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),qn(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,qn(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=Cs(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=Cs(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 jn(l,t,n){if(l=new o.ci(l.lng,l.lat),t){const c=new o.ci(l.lng-360,l.lat),d=new o.ci(l.lng+360,l.lat),f=360*Math.ceil(Math.abs(l.lng-n.center.lng)/360),m=n.locationPoint3D(l).distSqr(t),y=t.x<0||t.y<0||t.x>n.width||t.y>n.height;n.locationPoint3D(c).distSqr(t)<m&&(y||Math.abs(c.lng-n.center.lng)<f)?l=c:n.locationPoint3D(d).distSqr(t)<m&&(y||Math.abs(d.lng-n.center.lng)<f)&&(l=d)}for(;Math.abs(l.lng-n.center.lng)>180;){const c=n.locationPoint3D(l);if(c.x>=0&&c.y>=0&&c.x<=n.width&&c.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}
2760const In={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%)"},Xr={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class An extends o.E{constructor(t,n){super(),(t instanceof HTMLElement||n)&&(t=o.h({element:t},n)),o.aV(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:f=1,draggable:m=!1,clickTolerance:y=0,rotation:x=Xr.rotation,rotationAlignment:T=Xr.rotationAlignment,pitchAlignment:S=Xr.pitchAlignment,occludedOpacity:M=Xr.occludedOpacity,altitude:E=Xr.altitude}=t||{};this._anchor=c,this._color=d,this._scale=f,this._draggable=m,this._clickTolerance=y,this._rotation=x,this._rotationAlignment=T,this._pitchAlignment=S,this._occludedOpacity=M,this._altitude=E,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=o.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=o.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 C=this._element.classList;for(const z in In)C.remove(`mapboxgl-marker-anchor-${z}`);C.add(`mapboxgl-marker-anchor-${this._anchor}`);const D=t&&t.className?t.className.trim().split(/\s+/):[];C.add(...D),this._popup=null}_createDefaultMarker(){const t=Bt("div"),n=Jr("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=Jr("radialGradient",{id:"shadowGradient"},Jr("defs",{},n));Jr("stop",{offset:"10%","stop-opacity":.4},c),Jr("stop",{offset:"100%","stop-opacity":.05},c),Jr("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n)}return Jr("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"},n),Jr("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"},n),Jr("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),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=o.ci.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||Xr.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,442 bytes, lines 2760-2765
27600,-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 n=t.code,c=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,c=this._element;this._popup&&(n===c||c.contains(n))&&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,n=this._pos;if(!t||!n)return!1;const c=t.unproject(n,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const f=d.position.toLngLat();return f.distanceTo(c)<.9*f.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const n=this._pos;if(!n||n.x<0||n.x>t.transform.width||n.y<0||n.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(n,this._altitude);let d;t._showingGlobe()&&o.eW(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 n=this._offset.mult(this._scale);this._element.style.transform=` 2761 translate(${t.x}px,${t.y}px) 2762 ${In[this._anchor]} 2763 ${this._calculateXYTransform()} ${this._calculateZTransform()} 2764 translate(${n.x}px,${n.y}px) 2765 `}_calculateXYTransform(){const t=this._pos,n=this._map,c=this.getPitchAlignment();if(!n||!t||c!=="map")return"";if(!n._showingGlobe()){const x=n.getPitch();return x?`rotateX(${x}deg)`:""}const d=o.cU(o.eX(n.transform,this._lngLat)),f=t.sub(o.eY(n.transform)),m=Math.abs(f.x)+Math.abs(f.y);if(m===0)return"";const y=d/m;return`rotateX(${-f.y*y}deg) rotateY(${f.x*y}deg)`}_calculateZTransform(){const t=this._pos,n=this._map;if(!n||!t)return"";let c=0;const d=this.getRotationAlignment();if(d==="map")if(n._showingGlobe()){const f=n.project(new o.ci(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=n.project(new o.ci(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(f);c=o.cU(Math.atan2(m.y,m.x))-90}else c=-n.getBearing();else if(d==="horizon"){const f=o.af(4,6,n.getZoom()),m=o.eY(n.transform);m.y+=f*n.transform.height;const y=t.sub(m),x=o.cU(Math.atan2(y.y,y.x));c=(x>90?x-270:x+90)*(1-f)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const n=this._map;n&&(n.transform.renderWorldCopies&&(this._lngLat=jn(this._lngLat,this._pos,n.transform)),this._pos=n.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(),n._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.getTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=o.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 n=this._map;if(!n)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const f=this._clickTolerance||n._clickTolerance;if(t.point.dist(c)<f)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=n.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.A("dragstart"))),this.fire(new o.A("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 o.A("dragend")),this._state="inactive"}_addDragHandler(t){const n=this._map,c=this._pos;n&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",n.on("mousemove",this._onMove),n.on("touchmove",this._onMove),n.once("mouseup",this._onUp),n.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const n=this._map;return n&&(t?(n.on("mousedown",this._addDragHandler),n.on("touchstart",this._addDragHandler)):(n.off("mousedown",this._addDragHandler),n.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||Xr.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||Xr.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||Xr.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||Xr.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Gp={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},qp={maxWidth:100,unit:"metric"},Hp={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},$p={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},mf=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ur(l=new o.P(0,0),t="bottom"){if(typeof l=="number"){const n=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new o.P(0,l);case"top-left":return new o.P(n,n);case"top-right":return new o.P(-n,n);case"bottom":return new o.P(0,-l);case"bottom-left":return new o.P(n,-n);case"bottom-right":return new o.P(-n,-n);case"left":return new o.P(l,0);case"right":return new o.P(-l,0)}return new o.P(0,0)}return l instanceof o.P||Array.isArray(l)?o.P.convert(l):o.P.convert(l[t]||[0,0])}return{version:Gr,supported:uo.supported,setRTLTextPlugin:o.f0,getRTLTextPluginStatus:o.e$,Map:class extends rs{constructor(l){as.mark($i.create);const t=l;if((l=o.h({}
2765,Dl,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&&o.eU(window)&&(l.antialias=!1,o.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new vh(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 ff,this._domRenderTaskQueue=new ff,this._controls=[],this._markers=[],this._popups=[],this._mapId=o.a$(),this._locale=o.h({},jp,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._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Rl(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new lr(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const n=document.getElementById(l.container);if(!n)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=n}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&&o.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,o.aV(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Op),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},(()=>{this._update()})),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},(()=>{this.setScaleFactor(this._scaleFactor)})),this._setupPainter(),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 $c(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||o.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),this.indoor=new yp(this),l.hash&&(this._hash=new Bc(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 n=l.bounds;n&&(this.resize(),this.fitBounds(n,o.h({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new Ta({customAttribution:l.customAttribution}
vendor: 21,345 bytes, lines 2765-2767
2765)),this._logoControl=new zl,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()})),this.on("data",(n=>{this._update(n.dataType==="style"),this.fire(new o.A(`${n.dataType}data`,n))})),this.on("dataloading",(n=>{this.fire(new o.A(`${n.dataType}dataloading`,n))})),this._interactions=new Eu(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 o.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(n,c.firstChild):c.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new o.z(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 o.A("movestart",l)).fire(new o.A("move",l)),this.fire(new o.A("resize",l)),t&&this.fire(new o.A("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(o.aG.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 o.A("zoomstart")).fire(new o.A("zoom")).fire(new o.A("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 o.A("zoomstart")).fire(new o.A("zoom")).fire(new o.A("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 o.A("pitchstart")).fire(new o.A("pitch")).fire(new o.A("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 o.A("pitchstart")).fire(new o.A("pitch")).fire(new o.A("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._tp.refreshUI(),this._scaleFactorChanged=!0,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 n of this._controls)n._setLanguage&&n._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 n;t==="globe"&&l.zoom>=o.cI?(l.setMercatorFromTransition(),n=!0):t==="mercator"&&l.zoom<o.cI&&(l.setProjection({name:"globe"}),n=!0),n&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;return t=l.name==="globe"&&this.transform.zoom>=o.cI?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate(),t&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(o.ci.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(o.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,n){const c=d=>{let f=[];if(Array.isArray(t)){const m=t.filter((y=>this.getLayer(y)));f=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else f=this.queryRenderedFeatures(d,{target:t});return f};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:m=>{const y=c(m.point);y.length?d||(d=!0,n.call(this,new Li(l,this,m.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:y=>{c(y.point).length?d=!0:d&&(d=!1,n.call(this,new Li(l,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,n.call(this,new Li(l,this,y.originalEvent)))}}}}{const d=f=>{const m=c(f.point);m.length&&(f.features=m,n.call(this,f),delete f.features)};return{listener:n,targets:t,delegates:{[l]:d}}}}on(l,t,n){if(typeof t=="function"||n===void 0)return super.on(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,n);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,n){if(typeof t=="function"||n===void 0)return super.once(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,n);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(l,t,n){if(typeof t=="function"||n===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 f=0;f<d.length;f++){const m=d[f];if(m.listener===n&&Iu(m.targets,t)){for(const y in m.delegates)this.off(y,m.delegates[y]);return d.splice(f,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof o.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const f=this.style.queryRenderedFeatures(l,void 0,this.transform),m=this.style.queryRenderedFeatureset(l,void 0,this.transform);return f.concat(m)}let n=!0;if(t.target&&(n=this._isTargetValid(t.target),n&&!t.layers))return this.style.queryRenderedFeatureset(l,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const f of t.layers)if(!this._isValidId(f)){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))),n&&(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)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&o.w(`${t} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(o.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=o.h({},{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,((n,c)=>{if(n){const d=typeof n=="string"?n:n instanceof Error?n.message:n.error;o.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 n=o.h({},t);t&&t.config&&(n.initialConfig=t.config,delete n.config),this.style=new Nn(this,n).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Nn(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():(o.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new o.z(new Error("IDs can't be empty."))),!1):!o.dk(l)||(this.fire(new o.z(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,n){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}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:n=1,sdf:c=!1,stretchX:d,stretchY:f,content:m}={}){this._lazyInitEmptyStyle();const y=o.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:T,data:S}=o.q.getImageData(t);this.style.addImage(y,{data:new o.r({width:x,height:T},S),pixelRatio:n,stretchX:d,stretchY:f,content:m,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new o.z(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,S=t;this.style.addImage(y,{data:new o.r({width:x,height:T},new Uint8Array(S.data)),pixelRatio:n,stretchX:d,stretchY:f,content:m,sdf:c,usvg:!1,version:0,userImage:S}),S.onAdd&&S.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const n=o.I.from(l),c=this.style.getImage(n);if(!c)return void this.fire(new o.z(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?o.q.getImageData(t):t,{width:f,height:m,data:y}=d;if(f===void 0||m===void 0)return void this.fire(new o.z(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(f!==(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 o.z(new Error(`The width and height of the updated image (${f}, ${m}) 2766 must be that same as the previous version of the image 2767 (${c.data.width}, ${c.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let T=!1;c.usvg?(c.data=new o.r({width:f,height:m},new Uint8Array(y)),c.usvg=!1,c.icon=void 0,T=!0):c.data.replace(y,x),this.style.updateImage(n,c,T)}hasImage(l){return l?!!this.style&&!!this.style.getImage(o.I.from(l)):(this.fire(new o.z(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(o.I.from(l))}loadImage(l,t){o.o(this._requestManager.transformRequest(l,o.R.Image),((n,c)=>{t(n,c instanceof HTMLImageElement?o.q.getImageData(c):c)}))}listImages(){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 o.z(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((n=>this.fire(new o.z(new Error("Failed to add import",n))))),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,n){return this._isValidId(l)?(this.style.setLayerZoomRange(l,t,n),this._update(!0)):this}setFilter(l,t,n={}){return this._isValidId(l)?(this.style.setFilter(l,t,n),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setPaintProperty(l,t,n,c),this._update(!0)):this}getPaintProperty(l,t){return this._isValidId(l)?this.style.getPaintProperty(l,t):null}setLayoutProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,t,n,c),this._update(!0)):this}getLayoutProperty(l,t){return this._isValidId(l)?this.style.getLayoutProperty(l,t):null}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,n){return this.style.setConfigProperty(l,t,n),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(o.ci.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.indoor.selectFloor(l)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Su),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let n,c,d,f=this._container;for(;f&&(!c||!d);){const m=window.getComputedStyle(f).transform;m&&m!=="none"&&(n=m.match(/matrix.*\((.+)\)/)[1].split(", "),n[0]&&n[0]!=="0"&&n[0]!=="1"&&(c=n[0]),n[3]&&n[3]!=="0"&&n[3]!=="1"&&(d=n[3])),f=f.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)"&&o.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=Bt("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=Bt("div","mapboxgl-canvas-container",l);this._canvas=Bt("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 n=this._controlContainer=Bt("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach((d=>{c[d]=Bt("div",`mapboxgl-ctrl-${d}`,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const n=o.q.devicePixelRatio||1;
2767this._canvas.width=n*Math.ceil(l),this._canvas.height=n*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=o.h({},uo.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(Rs(t,!0),this.painter=new eo(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp,this._worldview),this.on("data",(n=>{n.dataType==="source"&&this.painter.setTileLoadedFlag(!0)})),o.l.testSupport(t)):this.fire(new o.z(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new o.A("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 o.A("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 o.A("renderstart")),++this._frameId;const n=this.painter.context.extTimerQuery,c=o.q.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(n.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 f=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,S=this.transform.pitch,M=o.q.now(),E=new o.aa(T,{now:M,fadeDuration:f,pitch:S,transition:this.style.transition,worldview:this._worldview});this.style.update(E)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let m=!1;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);const y=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),y&&(this._placementDirty=y.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,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 o.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,as.mark($i.load),this.fire(new o.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const T=o.q.now()-c;d.endQuery(n.TIME_ELAPSED_EXT),setTimeout((()=>{const S=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new o.A("gpu-timing-frame",{cpuTime:T,gpuTime:S}))}),50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout((()=>{const S=this.painter.queryGpuTimers(T);this.fire(new o.A("gpu-timing-layer",{layerTimes:S}))}),50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const S=this.painter.queryGpuTimeDeferredRender(T);this.fire(new o.A("gpu-timing-deferred-render",{gpuTime:S}))}),50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(x||this._repaint)this.triggerRepaint();else{const T=this.idle();if(T&&(m=this._updateAverageElevation(c,!0)),m)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new o.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const S=this._calculateSpeedIndex();this.fire(new o.A("speedindexcompleted",{speedIndex:S})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,as.mark($i.fullLoad),this._performanceMetricsCollection&&cr(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())}
2767_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 n=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&n(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 f=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(f)?f=0:this._averageElevationLastSampledAt=l;const m=Math.abs(d-f);if(m>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(f),n(f);this._averageElevation.easeTo(f,l,300)}else if(m>1e-4)return this._averageElevation.jumpTo(f),n(f)}return!!this._averageElevation.isEasing(l)&&n(this._averageElevation.getValue(l))}_authenticate(){tr(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(l=>{if(l&&(l.message===Cr||l.status===401)){const t=this.painter.context.gl;Rs(t,!1),this._logoControl instanceof zl&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new o.z(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/")))}})),ql(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_postStyleLoadEvent(){this.style.globalId&&Ri(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_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 n=this.painter.context.gl,c=n.createFramebuffer();function d(f){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,f,0);const m=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,m),m}return n.bindFramebuffer(n.FRAMEBUFFER,c),this._canvasPixelComparison(d(l),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(l,t,n){let c=n[1]-n[0];const d=l.length/4;for(let f=0;f<t.length;f++){const m=t[f];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+=(n[f+2]-n[f+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.indoor.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);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),zs.delete(this.painter.context.gl),Qr.remove(),No.remove(),this._removed=!0,this.fire(new o.A("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=o.q.frame((t=>{const n=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,n&&this._render(t)})))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return o.bt(t,((n,c)=>n._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._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._tp.refreshUI(),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._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this._tp.refreshUI(),l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this._tp.refreshUI(),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,this._tp.refreshUI(),l&&this._update())}_setCacheLimits(l,t){o.eV(l,t)}get version(){return Gr}},NavigationControl:class{constructor(l={}){this.options=o.h({},Sa,l),this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(o.aV(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(t=>{this._map&&this._map.zoomIn({},{originalEvent:t})})),Bt("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})})),Bt("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(o.aV(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(t=>{const n=this._map;n&&(this.options.visualizePitch?n.resetNorthPitch({},{originalEvent:t}):n.resetNorth({},{originalEvent:t}))})),this._compassIcon=Bt("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;
vendor: 1,463 bytes, line 2767
2767const t=l.getZoom(),n=t===l.getMaxZoom(),c=t===l.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",n.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 ws(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)}
2767_createButton(l,t){const n=Bt("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){if(!this._map)return;const n=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",n),l.firstElementChild&&l.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends o.E{constructor(l={}){super();const t=navigator.geolocation;this.options=o.h({geolocation:t},Gp,l),o.aV(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ga(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){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=(n=!!this.options.geolocation)=>{this._supportsGeolocation=n,l(n)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then((n=>t(n.state!=="denied"))).catch((()=>t())):t()}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.coords;return!!t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.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._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new o.A("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_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new o.A("geolocate",l)),this._finish()}}_updateCamera(l){const t=new o.ci(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,c=this._map.getBearing(),d=o.h({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),d,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new o.ci(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=o.cb(1,l._center.lat)*l.worldSize,n=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}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.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 o.A("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=Bt("button","mapboxgl-ctrl-geolocate",this._container),Bt("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){o.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
2767se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Bt("div","mapboxgl-user-location"),this._dotElement.appendChild(Bt("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Bt("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new An({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Bt("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new An({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(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 o.A("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 o.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 o.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new o.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(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.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const l=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then((t=>{t==="granted"&&l()})).catch(console.error):l()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2767se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Ta,ScaleControl:class{constructor(l={}){this.options=o.h({},qp,l),this._isNumberFormatSupported=(function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}})(),o.aV(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,n=t._containerHeight/2,c=t._containerWidth/2-l/2,d=t.unproject([c,n]),f=t.unproject([c+l,n]),m=d.distanceTo(f);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,n){this._map._requestDomTask((()=>{const c=(function(f){const m=Math.pow(10,`${Math.floor(f)}`.length-1);let y=f/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=this._isNumberFormatSupported&&n!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:n}).format(c):`${c} ${Hp[n]}`,this._container.style.width=l*d+"px"}))}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=Bt("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:o.w("Full screen control 'container' must be a DOM element.")),o.aV(["_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=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",o.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=Bt("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Bt("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:Su,Popup:class extends o.E{constructor(l){super(),this.options=o.h(Object.create($p),l),this._altitude=this.options.altitude,o.aV(["_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 o.A("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 o.A("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=o.ci.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(),n=document.createElement("body");let c;for(n.innerHTML=l;c=n.firstChild,c;
vendor: 4,039 bytes, line 2767
2767)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=Bt("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const n=this._closeButton=Bt("button","mapboxgl-popup-close-button",t);n.type="button",n.setAttribute("aria-label","Close popup"),n.innerHTML='<span aria-hidden="true">×</span>',n.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,n=this._container,c=this._pos;if(!t||!n||!c)return"bottom";const d=n.offsetWidth,f=n.offsetHeight,m=c.x<d/2,y=c.x>t.transform.width-d/2;if(c.y+l<f)return m?"top-left":y?"top-right":"top";if(c.y>t.transform.height-f){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,n=this._content;if(!t||!this._lngLat&&!this._trackPointer||!n)return;let c=this._container;if(c||(c=this._container=Bt("div","mapboxgl-popup",t.getContainer()),this._tip=Bt("div","mapboxgl-popup-tip",c),c.appendChild(n)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=jn(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof o.P?l:t.project(this._lngLat,this._altitude),f=Ur(this.options.offset),m=this._anchor=this._getAnchor(f.y),y=Ur(this.options.offset,m),x=d.add(y).round();t._requestDomTask((()=>{this._container&&m&&(this._container.style.transform=`${In[m]} translate(${x.x}px,${x.y}px)`)}))}if(!this._marker&&t._showingGlobe()){const d=o.eW(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(mf);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:An,Style:Nn,LngLat:o.ci,LngLatBounds:o.aG,Point:o.P,MercatorCoordinate:o.ac,FreeCameraOptions:yd,Evented:o.E,config:o.e,prewarm:o.e_,clearPrewarmedResources:o.eZ,get accessToken(){return o.e.ACCESS_TOKEN},set accessToken(l){o.e.ACCESS_TOKEN=l},get baseApiUrl(){return o.e.API_URL},set baseApiUrl(l){o.e.API_URL=l},get workerCount(){return o.f7.workerCount},set workerCount(l){o.f7.workerCount=l},get maxParallelImageRequests(){return o.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){o.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){o.f6(l)},get workerUrl(){return o.f5.workerUrl},set workerUrl(l){o.f5.workerUrl=l},get workerClass(){return o.f5.workerClass},set workerClass(l){o.f5.workerClass=l},get workerParams(){return o.f5.workerParams},set workerParams(l){o.f5.workerParams=l},get dracoUrl(){return o.f4()},set dracoUrl(l){o.f3(l)},get meshoptUrl(){return o.f2()},set meshoptUrl(l){o.f1(l)},setNow:o.q.setNow,restoreNow:o.q.restoreNow}}));var ev=co;return ev}))})(up)),up.exports}var Qx=zb();const Rb=Mb(Qx),Fb=Cb({__proto__:null,default:Rb},[Qx]);export{Fb as m};
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.