1import{p as $w,a as Ma,h as Zw,o as Ww,_ as t0,l as i0,$ as Xw,a0 as Yw,n as r0,q as n0,r as ig,v as Kw,j as Kp,G as Jw,d as Jp,e as Qw,z as eT,D as rg,F as o0,I as tT,J as iT,N as em}from"./index-DCc5aoCU.js";var Qp={exports:{}},rT=Qp.exports,s0;function nT(){return s0||(s0=1,(function(tm,Go){(function($s,Zs){tm.exports=Zs()})(rT,(function(){var $s,Zs,fl;function pl(s,Wr){if(!$s)$s=Wr;else if(!Zs)Zs=Wr;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 = {}; ("+$s+")(sharedChunk); ("+Zs+")(sharedChunk); self.onerror = null;",so={};$s(so),fl=Wr(so),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(fl.workerUrl=window.URL.createObjectURL(new Blob([$i],{type:"text/javascript"})))}}pl(["exports"],(function(s){var Wr=1e-6,$i=typeof Float32Array<"u"?Float32Array:Array;function so(r,e){var i=e[0],o=e[1],a=e[2],u=e[3],h=i*u-a*o;return h?(r[0]=u*(h=1/h),r[1]=-o*h,r[2]=-a*h,r[3]=i*h,r):null}function Ca(){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 ao(r,e){var i=e[0],o=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],y=e[7],v=e[8];return r[0]=h*v-f*y,r[1]=a*y-o*v,r[2]=o*f-a*h,r[3]=f*_-u*v,r[4]=i*v-a*_,r[5]=a*u-i*f,r[6]=u*y-h*_,r[7]=o*_-i*y,r[8]=i*h-o*u,r}function rr(r,e,i){var o=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],y=e[6],v=e[7],b=e[8],T=i[0],E=i[1],I=i[2],P=i[3],L=i[4],D=i[5],B=i[6],V=i[7],G=i[8];return r[0]=T*o+E*h+I*y,r[1]=T*a+E*f+I*v,r[2]=T*u+E*_+I*b,r[3]=P*o+L*h+D*y,r[4]=P*a+L*f+D*v,r[5]=P*u+L*_+D*b,r[6]=B*o+V*h+G*y,r[7]=B*a+V*f+G*v,r[8]=B*u+V*_+G*b,r}function lo(){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 mi(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}function Ni(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 Xr(r,e){var i=e[0],o=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=e[9],T=e[10],E=e[11],I=e[12],P=e[13],L=e[14],D=e[15],B=i*f-o*h,V=i*_-a*h,G=i*y-u*h,K=o*_-a*f,Z=o*y-u*f,ee=a*y-u*_,ne=v*P-b*I,ae=v*L-T*I,be=v*D-E*I,he=b*L-T*P,Ee=b*D-E*P,Ce=T*D-E*L,Pe=B*Ce-V*Ee+G*he+K*be-Z*ae+ee*ne;return Pe?(r[0]=(f*Ce-_*Ee+y*he)*(Pe=1/Pe),r[1]=(a*Ee-o*Ce-u*he)*Pe,r[2]=(P*ee-L*Z+D*K)*Pe,r[3]=(T*Z-b*ee-E*K)*Pe,r[4]=(_*be-h*Ce-y*ae)*Pe,r[5]=(i*Ce-a*be+u*ae)*Pe,r[6]=(L*G-I*ee-D*V)*Pe,r[7]=(v*ee-T*G+E*V)*Pe,r[8]=(h*Ee-f*be+y*ne)*Pe,r[9]=(o*be-i*Ee-u*ne)*Pe,r[10]=(I*Z-P*G+D*B)*Pe,r[11]=(b*G-v*Z-E*B)*Pe,r[12]=(f*ae-h*he-_*ne)*Pe,r[13]=(i*he-o*ae+a*ne)*Pe,r[14]=(P*V-I*K-L*B)*Pe,r[15]=(v*K-b*V+T*B)*Pe,r):null}function Gi(r,e,i){var o=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],y=e[6],v=e[7],b=e[8],T=e[9],E=e[10],I=e[11],P=e[12],L=e[13],D=e[14],B=e[15],V=i[0],G=i[1],K=i[2],Z=i[3];return r[0]=V*o+G*f+K*b+Z*P,r[1]=V*a+G*_+K*T+Z*L,r[2]=V*u+G*y+K*E+Z*D,r[3]=V*h+G*v+K*I+Z*B,r[4]=(V=i[4])*o+(G=i[5])*f+(K=i[6])*b+(Z=i[7])*P,r[5]=V*a+G*_+K*T+Z*L,r[6]=V*u+G*y+K*E+Z*D,r[7]=V*h+G*v+K*I+Z*B,r[8]=(V=i[8])*o+(G=i[9])*f+(K=i[10])*b+(Z=i[11])*P,r[9]=V*a+G*_+K*T+Z*L,r[10]=V*u+G*y+K*E+Z*D,r[11]=V*h+G*v+K*I+Z*B,r[12]=(V=i[12])*o+(G=i[13])*f+(K=i[14])*b+(Z=i[15])*P,r[13]=V*a+G*_+K*T+Z*L,r[14]=V*u+G*y+K*E+Z*D,r[15]=V*h+G*v+K*I+Z*B,r}function Qr(r,e,i){var o,a,u,h,f,_,y,v,b,T,E,I,P=i[0],L=i[1],D=i[2];return e===r?(r[12]=e[0]*P+e[4]*L+e[8]*D+e[12],r[13]=e[1]*P+e[5]*L+e[9]*D+e[13],r[14]=e[2]*P+e[6]*L+e[10]*D+e[14],r[15]=e[3]*P+e[7]*L+e[11]*D+e[15]):(a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],y=e[6],v=e[7],b=e[8],T=e[9],E=e[10],I=e[11],r[0]=o=e[0],r[1]=a,r[2]=u,r[3]=h,r[4]=f,r[5]=_,r[6]=y,r[7]=v,r[8]=b,r[9]=T,r[10]=E,r[11]=I,r[12]=o*P+f*L+b*D+e[12],r[13]=a*P+_*L+T*D+e[13],r[14]=u*P+y*L+E*D+e[14],r[15]=h*P+v*L+I*D+e[15]),r}function Hr(r,e,i){var o=i[0],a=i[1],u=i[2];return r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r[3]=e[3]*o,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*u,r[9]=e[9]*u,r[10]=e[10]*u,r[11]=e[11]*u,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Wn(r,e,i){var o=Math.sin(i),a=Math.cos(i),u=e[4],h=e[5],f=e[6],_=e[7],y=e[8],v=e[9],b=e[10],T=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=u*a+y*o,r[5]=h*a+v*o,r[6]=f*a+b*o,r[7]=_*a+T*o,r[8]=y*a-u*o,r[9]=v*a-h*o,r[10]=b*a-f*o,r[11]=T*a-_*o,r}function wn(r,e,i){var o=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],y=e[8],v=e[9],b=e[10],T=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a-y*o,r[1]=h*a-v*o,r[2]=f*a-b*o,r[3]=_*a-T*o,r[8]=u*o+y*a,r[9]=h*o+v*a,r[10]=f*o+b*a,r[11]=_*o+T*a,r}function kn(r,e,i){var o=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],y=e[4],v=e[5],b=e[6],T=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a+y*o,r[1]=h*a+v*o,r[2]=f*a+b*o,r[3]=_*a+T*o,r[4]=y*a-u*o,r[5]=v*a-h*o,r[6]=b*a-f*o,r[7]=T*a-_*o,r}function So(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 ki(r,e,i){var o,a,u,h=i[0],f=i[1],_=i[2],y=Math.sqrt(h*h+f*f+_*_);return y<Wr?null:(h*=y=1/y,f*=y,_*=y,o=Math.sin(e),a=Math.cos(e),r[0]=h*h*(u=1-a)+a,r[1]=f*h*u+_*o,r[2]=_*h*u-f*o,r[3]=0,r[4]=h*f*u-_*o,r[5]=f*f*u+a,r[6]=_*f*u+h*o,r[7]=0,r[8]=h*_*u+f*o,r[9]=f*_*u-h*o,r[10]=_*_*u+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function Sr(r,e){var i=e[0],o=e[1],a=e[2],u=e[4],h=e[5],f=e[6],_=e[8],y=e[9],v=e[10];return r[0]=Math.sqrt(i*i+o*o+a*a),r[1]=Math.sqrt(u*u+h*h+f*f),r[2]=Math.sqrt(_*_+y*y+v*v),r}function dr(r,e){var i=e[0],o=e[1],a=e[2],u=e[3],h=i+i,f=o+o,_=a+a,y=i*h,v=o*h,b=o*f,T=a*h,E=a*f,I=a*_,P=u*h,L=u*f,D=u*_;return r[0]=1-b-I,r[1]=v+D,r[2]=T-L,r[3]=0,r[4]=v-D,r[5]=1-y-I,r[6]=E+P,r[7]=0,r[8]=T+L,r[9]=E-P,r[10]=1-y-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}var Bn=Gi;function ei(){var r=new $i(3);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Eo(r){var e=new $i(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Ir(r){var e=r[0],i=r[1],o=r[2];return Math.sqrt(e*e+i*i+o*o)}function nr(r,e,i){var o=new $i(3);return o[0]=r,o[1]=e,o[2]=i,o}function Vt(r,e,i,o){return r[0]=e,r[1]=i,r[2]=o,r}function gi(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function Or(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 Rn(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 zn(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 Zi(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function qr(r,e,i,o){return r[0]=e[0]+i[0]*o,r[1]=e[1]+i[1]*o,r[2]=e[2]+i[2]*o,r}function fc(r,e){var i=e[0]-r[0],o=e[1]-r[1],a=e[2]-r[2];return Math.sqrt(i*i+o*o+a*a)}function ml(r,e){var i=e[0]-r[0],o=e[1]-r[1],a=e[2]-r[2];return i*i+o*o+a*a}function pc(r){var e=r[0],i=r[1],o=r[2];return e*e+i*i+o*o}function ys(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function Bi(r,e){var i=e[0],o=e[1],a=e[2],u=i*i+o*o+a*a;return u>0&&(u=1/Math.sqrt(u)),r[0]=e[0]*u,r[1]=e[1]*u,r[2]=e[2]*u,r}function fr(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function en(r,e,i){var o=e[0],a=e[1],u=e[2],h=i[0],f=i[1],_=i[2];return r[0]=a*_-u*f,r[1]=u*h-o*_,r[2]=o*f-a*h,r}function Ws(r,e,i,o){var a=e[0],u=e[1],h=e[2];return r[0]=a+o*(i[0]-a),r[1]=u+o*(i[1]-u),r[2]=h+o*(i[2]-h),r}function gr(r,e,i){var o=e[0],a=e[1],u=e[2],h=i[3]*o+i[7]*a+i[11]*u+i[15];return r[0]=(i[0]*o+i[4]*a+i[8]*u+i[12])/(h=h||1),r[1]=(i[1]*o+i[5]*a+i[9]*u+i[13])/h,r[2]=(i[2]*o+i[6]*a+i[10]*u+i[14])/h,r}function xs(r,e,i){var o=e[0],a=e[1],u=e[2];return r[0]=o*i[0]+a*i[3]+u*i[6],r[1]=o*i[1]+a*i[4]+u*i[7],r[2]=o*i[2]+a*i[5]+u*i[8],r}function vs(r,e,i){var o=i[0],a=i[1],u=i[2],h=i[3],f=e[0],_=e[1],y=e[2],v=a*y-u*_,b=u*f-o*y,T=o*_-a*f;return r[0]=f+h*(v+=v)+a*(T+=T)-u*(b+=b),r[1]=_+h*b+u*v-o*T,r[2]=y+h*T+o*b-a*v,r}function Dn(r){return r[0]=0,r[1]=0,r[2]=0,r}function un(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var xr=Or,ih=cn,Pa=Ir;function Xs(){var r=new $i(4);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function bs(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 ws(r,e){var i=e[0],o=e[1],a=e[2],u=e[3],h=i*i+o*o+a*a+u*u;return h>0&&(h=1/Math.sqrt(h)),r[0]=i*h,r[1]=o*h,r[2]=a*h,r[3]=u*h,r}function tn(r,e,i){var o=e[0],a=e[1],u=e[2],h=e[3];return r[0]=i[0]*o+i[4]*a+i[8]*u+i[12]*h,r[1]=i[1]*o+i[5]*a+i[9]*u+i[13]*h,r[2]=i[2]*o+i[6]*a+i[10]*u+i[14]*h,r[3]=i[3]*o+i[7]*a+i[11]*u+i[15]*h,r}function Ho(){var r=new $i(4);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ra(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function co(r,e,i){i*=.5;var o=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+h*f,r[1]=a*_+u*f,r[2]=u*_-a*f,r[3]=h*_-o*f,r}function qo(r,e,i){i*=.5;var o=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_-u*f,r[1]=a*_+h*f,r[2]=u*_+o*f,r[3]=h*_-a*f,r}ei(),Xs();var pn,Ys,Ks,Js=ws,za=(pn=ei(),Ys=nr(1,0,0),Ks=nr(0,1,0),function(r,e,i){var o=fr(e,i);return o<-.999999?(en(pn,Ys,e),Pa(pn)<1e-6&&en(pn,Ks,e),Bi(pn,pn),(function(a,u,h){h*=.5;var f=Math.sin(h);a[0]=f*u[0],a[1]=f*u[1],a[2]=f*u[2],a[3]=Math.cos(h)})(r,pn,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(en(pn,e,i),r[0]=pn[0],r[1]=pn[1],r[2]=pn[2],r[3]=1+o,Js(r,r))});function Vr(){var r=new $i(2);return $i!=Float32Array&&(r[0]=0,r[1]=0),r}function Tn(r,e){var i=new $i(2);return i[0]=r,i[1]=e,i}function _l(r,e,i){return r[0]=e,r[1]=i,r}function Ts(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function Io(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function $o(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function uo(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)}function gl(r,e){var i=e[0],o=e[1],a=i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function Qs(r,e){return r[0]*e[0]+r[1]*e[1]}Ho(),Ho(),Ca();var Ji,$r,mc=Io;function ea(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Vr();var ho=(function(){if($r)return Ji;function r(e,i,o,a){this.cx=3*e,this.bx=3*(o-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=o,this.p2y=a}return $r=1,Ji=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 o=e,a=0;a<8;a++){var u=this.sampleCurveX(o)-e;if(Math.abs(u)<i)return o;var h=this.sampleCurveDerivativeX(o);if(Math.abs(h)<1e-6)break;o-=u/h}var f=0,_=1;for(o=e,a=0;a<20&&(u=this.sampleCurveX(o),!(Math.abs(u-e)<i));a++)e>u?f=o:_=o,o=.5*(_-f)+f;return o}
vendor: 2,112 bytes, line 1
1,solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Ji})(),_c=ea(ho);function Oe(r,e){this.x=r,this.y=e}function Zo(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(!Zo(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(!Zo(r[i],e[i]))return!1;return!0}return r===e}Oe.prototype={clone(){return new Oe(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),o=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=o,this},_rotateAround(r,e){const i=Math.cos(r),o=Math.sin(r),a=e.y+o*(this.x-e.x)+i*(this.y-e.y);
1return this.x=e.x+i*(this.x-e.x)-o*(this.y-e.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Oe},Oe.convert=function(r){if(r instanceof Oe)return r;if(Array.isArray(r))return new Oe(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Oe(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};const rh=Math.PI/180,ta=180/Math.PI;function oi(r){return r*rh}function hn(r){return r*ta}const nh=[[0,0],[1,0],[1,1],[0,1]];function ia(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 yl(r,e,i,o){const a=new _c(r,e,i,o);return function(u){return a.solve(u)}}const pe=yl(.25,.1,.25,1);function O(r,e,i){return Math.min(i,Math.max(e,r))}function N(r,e,i){return(i=O((i-r)/(e-r),0,1))*i*(3-2*i)}function q(r,e,i){const o=i-e,a=((r-e)%o+o)%o+e;return a===e?i:a}function oe(r,e,i){if(!r.length)return i(null,[]);let o=r.length;const a=new Array(r.length);let u=null;r.forEach(((h,f)=>{e(h,((_,y)=>{_&&(u=_),a[f]=y,--o==0&&i(u,a)}))}))}let re=1;function ce(){return re++}function ye(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log2(r)))}function de(r,e){r.forEach((i=>{e[i]&&(e[i]=e[i].bind(e))}))}function ge(r,e,i){const o={};for(const a in r)o[a]=e.call(this,r[a],a,r);return o}function Ne(r,e,i){const o={};for(const a in r)e.call(this,r[a],a,r)&&(o[a]=r[a]);return o}function Me(r){return Array.isArray(r)?r.map(Me):typeof r=="object"&&r?ge(r,Me):r}function nt(r,e){for(let i=0;i<r.length;i++)if(e.indexOf(r[i])>=0)return!0;return!1}const _t={};function tt(r){_t[r]||(typeof console<"u"&&console.warn(r),_t[r]=!0)}function Lt(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function zt(r){let e=0;for(let i,o,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],o=r[h],e+=(o.x-i.x)*(i.y+o.y);return e}function Pt([r,e,i]){const o=oi(e+90),a=oi(i);return{x:r*Math.cos(o)*Math.sin(a),y:r*Math.sin(o)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function Kt(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function or(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,o,a,u)=>{const h=a||u;return e[o]=!h||h.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let vr=null;function lr(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function Er(r,e,i,o){for(;e<i;){const a=e+i>>1;r[a]<o?e=a+1:i=a}return e}function Qi(r,e,i,o){for(;e<i;){const a=e+i>>1;r[a]<=o?e=a+1:i=a}return e}function ii(r){return r>0?1/(1.001-r):1+r}function er(r){return r>0?1-1/(1.001-r):-r}function Pi(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const qt={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(!qt.API_URL)return null;try{const r=new URL(qt.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",MES
1HOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function cr(r){return qt.API_URL_REGEX.test(r)}function Yr(r){return qt.API_SPRITE_REGEX.test(r)}let rn,Sn,ra,Ur,Nn,dn;function Ao(){return rn==null&&(rn=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),rn}const Fr={now:()=>Ur!==void 0?Ur:performance.now(),setNow(r){Ur=r},restoreNow(){Ur=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:o}=r;Nn||(Nn=document.createElement("canvas"));const a=Nn.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>Nn.width||o>Nn.height)&&(Nn.width=i,Nn.height=o),a.clearRect(-e,-e,i+2*e,o+2*e),a.drawImage(r,0,0,i,o),a.getImageData(-e,-e,i+2*e,o+2*e)},resolveURL:r=>(Sn||(Sn=document.createElement("a")),Sn.href=r,Sn.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(ra==null&&(ra=window.matchMedia("(prefers-reduced-motion: reduce)")),ra.matches)},hasCanvasFingerprintNoise(){if(dn!==void 0)return dn;if(!Ao())return dn=!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 o=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<o.data.length;++a)if(a%4!=3&&i++!==o.data[a])return dn=!0,!0;return dn=!1,!1}};function na(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
1const o=new URLSearchParams(r.slice(i));for(const a in e)o.set(a,e[a]);return`${r.slice(0,i)}?${o.toString()}`}function Da(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const o=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const h of e.persistentParams){const f=a.get(h);f&&o.set(h,f)}const u=o.toString();return`${r.slice(0,i)}${u.length>0?`?${u}`:""}`}const gc="mapbox-tiles";let yc=500,xc=50;const xl=["language","worldview","jobid"];let Mo,En;function fo(){try{return caches}catch{}}function po(){const r=fo();r&&Mo==null&&(Mo=r.open(gc))}let Xn=1/0;const Co={supported:!1,testSupport:function(r){!vc&&oa&&(sa?Qd(r):Ss=r)}};let Ss,oa,vc=!1,sa=!1;const bc=typeof self<"u"?self:{};function Qd(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,oa),r.isContextLost())return;Co.supported=!0}catch{}r.deleteTexture(e),vc=!0}bc.document&&(oa=bc.document.createElement("img"),oa.onload=function(){Ss&&Qd(Ss),Ss=null,sa=!0},oa.onerror=function(){vc=!0,Ss=null},oa.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const vl={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(vl);
1class Ln extends Error{constructor(e,i,o){i===401&&cr(o)&&(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=o}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const wc=Kt()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,aa=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(wc())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return(function(o,a){const u=new AbortController,h=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,referrer:wc(),referrerPolicy:o.referrerPolicy,signal:u.signal});let f=!1,_=!1;const y=(v=h.url).indexOf("sku=")>0&&cr(v);var v;o.type==="json"&&h.headers.set("Accept","application/json");const b=(E,I,P)=>{if(_)return;if(E&&E.message!=="SecurityError"&&tt(E.toString()),I&&P)return T(I);const L=Date.now();fetch(h).then((D=>{if(D.ok){const B=y?D.clone():null;return T(D,B,L)}return a(new Ln(D.statusText,D.status,o.url))})).catch((D=>{D.name!=="AbortError"&&a(new Error(`${D.message} ${o.url}`))}))},T=(E,I,P)=>{(o.type==="arrayBuffer"?E.arrayBuffer():o.type==="json"?E.json():E.text()).then((L=>{_||(I&&P&&(function(D,B,V){if(po(),Mo==null)return;const G=or(B.headers.get("Cache-Control")||"");if(G["no-store"])return;const K={status:B.status,statusText:B.statusText,headers:new Headers};B.headers.forEach(((ne,ae)=>K.headers.set(ae,ne))),G["max-age"]&&K.headers.set("Expires",new Date(V+1e3*G["max-age"]).toUTCString());const Z=K.headers.get("Expires");if(!Z||new Date(Z).getTime()-V<42e4)return;
1let ee=Da(D.url,{persistentParams:xl});if(B.status===206){const ne=D.headers.get("Range");if(!ne)return;K.status=200,ee=na(ee,{range:ne})}(function(ne,ae){if(En===void 0)try{new Response(new ReadableStream),En=!0}catch{En=!1}En?ae(ne.body):ne.blob().then(ae).catch((be=>tt(be.message)))})(B,(ne=>{const ae=new Response((be=B.status)!==200&&be!==404&&[101,103,204,205,304].includes(be)?null:ne,K);var be;po(),Mo?.then((he=>he.put(ee,ae))).catch((he=>tt(he.message)))}))})(h,I,P),f=!0,a(null,L,E.headers))})).catch((L=>{_||a(new Error(L.message))}))};return y?(function(E,I){if(po(),Mo==null)return I(null);Mo.then((P=>{let L=Da(E.url,{persistentParams:xl});const D=E.headers.get("Range");D&&(L=na(L,{range:D})),P.match(L).then((B=>{const V=(function(G){if(!G)return!1;const K=new Date(G.headers.get("Expires")||0),Z=or(G.headers.get("Cache-Control")||"");return Number(K)>Date.now()&&!Z["no-cache"]})(B);P.delete(L).catch(I),V&&P.put(L,B.clone()).catch(I),I(null,B,V)})).catch(I)})).catch(I)})(h,b):b(null,null),{cancel:()=>{_=!0,f||u.abort()}}})(r,e);if(Kt(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return(function(o,a){const u=new XMLHttpRequest;u.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const h in o.headers)u.setRequestHeader(h,o.headers[h]);return o.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=o.credentials==="include",u.onerror=()=>{a(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let h=u.response;if(o.type==="json")try{h=JSON.parse(u.response)}catch(_){return a(_)}const f=new Headers;u.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((_=>{const y=_.split(": "),v=y.shift(),b=y.join(": ");f.append(v,b)})),a(null,h,f)}else a(new Ln(u.statusText,u.status,o.url))},u.send(o.body),{cancel:()=>u.abort()}})(r,e)},Wo=function(r,e){return aa(Object.assign(r,{type:"arrayBuffer"}),e)};function rm(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const ef="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let bl,ri;bl=[],ri=0;const Tc=function(r,e){if(Co.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),ri>=qt.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return bl.push(u),u}ri++;let i=!1;const o=()=>{if(!i)for(i=!0,ri--;bl.length&&ri<qt.MAX_PARALLEL_IMAGE_REQUESTS;){const u=bl.shift(),{requestParameters:h,callback:f,cancelled:_}=u;_||(u.cancel=Tc(h,f).cancel)}},a=Wo(r,((u,h,f)=>{o(),u?e(u):h&&(self.createImageBitmap?(function(_,y){const v=new Blob([new Uint8Array(_)],{type:"image/png"});createImageBitmap(v).then((b=>{y(null,b)})).catch((b=>{y(new Error(`Could not load image because of ${b.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))})(h,((_,y)=>e(_,y,f))):(function(_,y){const v=new Image;v.onload=()=>{y(null,v),URL.revokeObjectURL(v.src),v.onload=null,requestAnimationFrame((()=>{v.src=ef}))},v.onerror=()=>y(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const b=new Blob([new Uint8Array(_)],{type:"image/png"});v.src=_.byteLength?URL.createObjectURL(b):ef})(h,((_,y)=>e(_,y,f))))}));return{cancel:()=>{a.cancel(),o()}}};var oh,tf,rf,Es={exports:{}},wl={exports:{}},Tl={exports:{}},sh=(function(){if(rf)return Es.exports;rf=1;var r=(oh||(oh=1,wl.exports=function(i,o){var a,u,h,f,_,y,v,b;for(u=i.length-(a=3&i.length),h=o,_=3432918353,y=461845907,b=0;b<u;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,h=27492+(65535&(f=5*(65535&(h=(h^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);
1switch(v=0,a){case 3:v^=(255&i.charCodeAt(b+2))<<16;case 2:v^=(255&i.charCodeAt(b+1))<<8;case 1:h^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(b)))*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),wl.exports),e=(tf||(tf=1,Tl.exports=function(i,o){for(var a,u=i.length,h=o^u,f=0;u>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(a>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),u-=4,++f;switch(u){case 3:h^=(255&i.charCodeAt(f+2))<<16;case 2:h^=(255&i.charCodeAt(f+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(f)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),Tl.exports);return Es.exports=r,Es.exports.murmur3=r,Es.exports.murmur2=e,Es.exports})(),Sc=ea(sh);class Po{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class Sl extends Po{constructor(e,i={}){super("error",Object.assign({error:e},i))}}function ah(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function Is(r,e,i){if(i&&i[r]){const o=i[r].indexOf(e);o!==-1&&i[r].splice(o,1)}}class la{on(e,i){return this._listeners=this._listeners||{},ah(e,i,this._listeners),this}off(e,i){return Is(e,i,this._listeners),Is(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},ah(e,i,this._oneTimeListeners),this):new Promise((o=>{this.once(e,o)}))}fire(e,i){const o=typeof e=="string"?new Po(e,i):e,a=o.type;if(this.listens(a)){o.target=this;const u=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of u)_.call(this,o);const h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of h)Is(a,_,this._oneTimeListeners),_.call(this,o);const f=this._eventedParent;if(f){const _=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(o,_),f.fire(o)}}else o instanceof Sl&&console.error(o.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 fn{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new fn(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,o]=e.split("�");return new fn({name:i,iconsetId:o})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return fn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Ec,El={},Yn=(function(){if(Ec)return El;Ec=1;var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(u){return(u=Math.round(u))<0?0:u>255?255:u}function i(u){return e(u[u.length-1]==="%"?parseFloat(u)/100*255:parseInt(u))}
1function o(u){return(h=u[u.length-1]==="%"?parseFloat(u)/100:parseFloat(u))<0?0:h>1?1:h;var h}function a(u,h,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?u+(h-u)*f*6:2*f<1?h:3*f<2?u+(h-u)*(2/3-f)*6:u}try{El.parseCSSColor=function(u){var h,f=u.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(h=parseInt(f.substr(1),16))>=0&&h<=4095?[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]:null:f.length===7&&(h=parseInt(f.substr(1),16))>=0&&h<=16777215?[(16711680&h)>>16,(65280&h)>>8,255&h,1]:null;var _=f.indexOf("("),y=f.indexOf(")");if(_!==-1&&y+1===f.length){var v=f.substr(0,_),b=f.substr(_+1,y-(_+1)).split(","),T=1;switch(v){case"rgba":if(b.length!==4)return null;T=o(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),T];case"hsla":if(b.length!==4)return null;T=o(b.pop());case"hsl":if(b.length!==3)return null;var E=(parseFloat(b[0])%360+360)%360/360,I=o(b[1]),P=o(b[2]),L=P<=.5?P*(I+1):P+I-P*I,D=2*P-L;return[e(255*a(D,L,E+1/3)),e(255*a(D,L,E)),e(255*a(D,L,E-1/3)),T];default:return null}}return null}}catch{}return El})();class yi{constructor(e,i,o,a=1){this.r=e,this.g=i,this.b=o,this.a=a}static parse(e){if(!e)return;if(e instanceof yi)return e;if(typeof e!="string")return;const i=Yn.parseCSSColor(e);return i?new yi(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,o,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*o)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:u}=this;return new of(e,i,o,a,u)}toPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:u}=this;return new sf(e,i*u,o*u,a*u,u)}clone(){return new yi(this.r,this.g,this.b,this.a)}}class nf{constructor(e,i,o,a,u,h=!1){if(this.premultiplied=!1,this.premultiplied=h,e){const f=e.image.height,_=f*f;this.premultiplied?(i=u===0?0:i/u*(f-1),o=u===0?0:o/u*(f-1),a=u===0?0:a/u*(f-1)):(i*=f-1,o*=f-1,a*=f-1);const y=Math.floor(i),v=Math.floor(o),b=Math.floor(a),T=Math.ceil(i),E=Math.ceil(o),I=Math.ceil(a),P=i-y,L=o-v,D=a-b,B=e.image.data,V=4*(y+v*_+b*f),G=4*(y+v*_+I*f),K=4*(y+E*_+b*f),Z=4*(y+E*_+I*f),ee=4*(T+v*_+b*f),ne=4*(T+v*_+I*f),ae=4*(T+E*_+b*f),be=4*(T+E*_+I*f);if(V<0||be>=B.length)throw new Error("out of range");this.r=wt(wt(wt(B[V],B[G],D),wt(B[K],B[Z],D),L),wt(wt(B[ee],B[ne],D),wt(B[ae],B[be],D),L),P)/255*(this.premultiplied?u:1),this.g=wt(wt(wt(B[V+1],B[G+1],D),wt(B[K+1],B[Z+1],D),L),wt(wt(B[ee+1],B[ne+1],D),wt(B[ae+1],B[be+1],D),L),P)/255*(this.premultiplied?u:1),this.b=wt(wt(wt(B[V+2],B[G+2],D),wt(B[K+2],B[Z+2],D),L),wt(wt(B[ee+2],B[ne+2],D),wt(B[ae+2],B[be+2],D),L),P)/255*(this.premultiplied?u:1),this.a=u}else this.r=i,this.g=o,this.b=a,this.a=u}toArray(){const{r:e,g:i,b:o,a}=this;return[255*e,255*i,255*o,a]}toHslaArray(){let{r:e,g:i,b:o,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];const I=1/a;e*=I,i*=I,o*=I}const u=Math.min(Math.max(e,0),1),h=Math.min(Math.max(i,0),1),f=Math.min(Math.max(o,0),1),_=Math.min(u,h,f),y=Math.max(u,h,f),v=y-_,b=.5*(_+y);if(v===0)return[0,0,100*b,a];const T=b>.5?v/(2-y-_):v/(y+_);let E;switch(y){case u:E=60*((h-f)/v+(h<f?6:0));break;case h:E=60*((f-u)/v+2);break;default:E=60*((u-h)/v+4)}return[E,100*T,100*b,a]}toArray01(){const{r:e,g:i,b:o,a}=this;return[e,i,o,a]}toArray01Scaled(e){const{r:i,g:o,b:a}=this;return[i*e,o*e,a*e]}toArray01Linear(){const{r:e,g:i,b:o,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(o,2.2),a]}}class of extends nf{constructor(e,i,o,a,u){super(e,i,o,a,u,!1)}}class sf extends nf{constructor(e,i,o,a,u){super(e,i,o,a,u,!0)}}function wt(r,e,i){return r*(1-i)+e*i}function lh(r,e,i){return r.map(((o,a)=>wt(o,e[a],i)))}yi.black=new yi(0,0,0,1),yi.white=new yi(1,1,1,1),yi.transparent=new yi(0,0,0,0),yi.red=new yi(1,0,0,1),yi.blue=new yi(0,0,1,1);var Il=Object.freeze({__proto__:null,array:lh,color:function(r,e,i){return new yi(wt(r.r,e.r,i),wt(r.g,e.g,i),wt(r.b,e.b,i),wt(r.a,e.a,i))},number:wt});
1class Kn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class La{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[o,a]of i)this.bindings[o]=a}concat(e){return new La(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 mo={kind:"null"},pt={kind:"number"},Yt={kind:"string"},wi={kind:"boolean"},In={kind:"color"},Ro={kind:"object"},_i={kind:"value"},Ic={kind:"collator"},Al={kind:"formatted"},Ml={kind:"resolvedImage"};function nn(r,e){return{kind:"array",itemType:r,N:e}}function br(r){if(r.kind==="array"){const e=br(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const nm=[mo,pt,Yt,wi,In,Al,Ro,nn(_i),Ml];function As(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!As(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 nm)if(!As(i,e))return null}}return`Expected ${br(r)} but found ${br(e)} instead.`}function ch(r,e){return e.some((i=>i.kind===r.kind))}function Cl(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 Ac(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&Ac(r.itemType,e.itemType):r.kind===e.kind}class uh{constructor(e,i,o){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=o,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 Mc{constructor(e,i,o,a,u){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=o,this.fontStack=a,this.textColor=u}}class mn{constructor(e){this.sections=e}static fromString(e){return new mn([new Mc(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 mn?e:mn.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 o={};i.fontStack&&(o["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(o["font-scale"]=i.scale),i.textColor&&(o["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(o)}return e}}class Xo{constructor(e,i={}){this.id=fn.from(e),this.params=i.params,this.sx=i.sx||1,this.sy=i.sy||1}toString(){return JSON.stringify(this)}static parse(e){let i,o,a,u;try{({id:i,params:o,sx:a,sy:u}=JSON.parse(e)||{})}catch{return null}return i?new Xo(i,{params:o,sx:a,sy:u}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class _n{constructor(e,i,o,a,u=!1){this.primaryId=fn.from(e),this.primaryOptions=i,o&&(this.secondaryId=fn.from(o)),this.secondaryOptions=a,this.available=u}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Xo(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Xo(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?_n.build({name:e}):e}static build(e,i,o,a){return!e||typeof e=="object"&&!("name"in e)?null:new _n(e,o,i,a)}}function ca(r,e,i,o){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[r,e,i,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[r,e,i,o]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Oa(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof yi||r instanceof uh||r instanceof mn||r instanceof _n)return!0;
1if(Array.isArray(r)){for(const e of r)if(!Oa(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Oa(r[e]))return!1;return!0}return!1}function kr(r){if(r===null)return mo;if(typeof r=="string")return Yt;if(typeof r=="boolean")return wi;if(typeof r=="number")return pt;if(r instanceof yi)return In;if(r instanceof uh)return Ic;if(r instanceof mn)return Al;if(r instanceof _n)return Ml;if(Array.isArray(r)){const e=r.length;let i;for(const o of r){const a=kr(o);if(i){if(i===a)continue;i=_i;break}i=a}return nn(i||_i,e)}return Ro}function Jn(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof mn||r instanceof _n||r instanceof yi?r.toString():JSON.stringify(r)}class Yo{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(!Oa(e[1]))return i.error("invalid value");const o=e[1];let a=kr(o);const u=i.expectedType;return a.kind!=="array"||a.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(a=u),new Yo(a,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof yi?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof mn?this.value.serialize():this.value}}class zr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const hh={string:Yt,number:pt,boolean:wi,object:Ro};class _o{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 o,a=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const y=e[1];if(typeof y!="string"||!(y in hh)||y==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=hh[y],a++}else f=_i;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++}o=nn(f,_)}else o=hh[u];const h=[];for(;a<e.length;a++){const f=i.parse(e[a],a,_i);if(!f)return null;h.push(f)}return new _o(o,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const o=this.args[i].evaluate(e);if(!As(this.type,kr(o)))return o;if(i===this.args.length-1)throw new zr(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${br(kr(o))} but was expected to be of type ${br(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 o=e.itemType;if(o.kind==="string"||o.kind==="number"||o.kind==="boolean"){i.push(o.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map((o=>o.serialize())))}}class zo{constructor(e){this.type=Al,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return i.error("First argument must be an image or text section.");const a=[];let u=!1;for(let h=1;h<=e.length-1;++h){const f=e[h];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=i.parseObjectValue(f["font-scale"],h,"font-scale",pt),!_))return null;let y=null;if(f["text-font"]&&(y=i.parseObjectValue(f["text-font"],h,"text-font",nn(Yt)),!y))return null;let v=null;if(f["text-color"]&&(v=i.parseObjectValue(f["text-color"],h,"text-color",In),!v))return null;const b=a[a.length-1];b.scale=_,b.font=y,b.textColor=v}else{const _=i.parse(e[h],h,_i);if(!_)return null;const y=_.type.kind;if(y!=="string"&&y!=="value"&&y!=="null"&&y!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new zo(a)}evaluate(e){return new mn(this.sections.map((i=>{const o=i.content.evaluate(e);return Ac(kr(o),Ml)?new Mc("",o,null,null,null):new Mc(Jn(o),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 o={};i.scale&&(o["font-scale"]=i.scale.serialize()),i.font&&(o["text-font"]=i.font.serialize()),i.textColor&&(o["text-color"]=i.textColor.serialize()),e.push(o)}return e}}class Dt{constructor(e,i,o,a){this._imageWarnHistory={},this.type=Ml,this.namePrimary=e,this.nameSecondary=i,o&&(this.paramsPrimary=o.params,this.iconsetIdPrimary=o.iconset?o.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 o=1;const a=[];function u(){if(o<e.length){const f=i.parse(e[o],o++,Yt);return f?(a.push({image:f,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function h(){if(o<e.length){const _=e[o];if((f=_)===null||typeof f!="object"||Array.isArray(f))return!0;const y=_.params,v=_.iconset,b=i.concat(o);if(!y&&!v)return o++,!0;if(y){if(typeof y!="object"||y.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const T={},E=b.concat(void 0,"params");for(const I in y){if(!I)return E.error("Image parameter name should be non-empty"),!1;const P=E.concat(void 0,I).parse(y[I],void 0,In,void 0,{typeAnnotation:"coerce"});if(!P)return!1;T[I]=P}a[a.length-1].options.params=T}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 o++,!0}var f;return!0}for(let f=0;f<2;f++)if(!u()||!h())return;return new Dt(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const o={};if(i){for(const a in i)if(i[a])try{o[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(o).length!==0)return{params:o}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},o=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=_n.build(i,o,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const u=a.getPrimary().id;if(a.available=e.availableImages.some((h=>fn.isEqual(h,u))),a.available){const h=a.getSecondary()?a.getSecondary().id:null;h&&(a.available=e.availableImages.some((f=>fn.isEqual(f,h))))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const o={};if(i&&(o.iconset={id:i}),e){o.params={};for(const a in e)e[a]&&(o.params[a]=e[a].serialize())}return Object.keys(o).length>0?o: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 ht(r){return St(r)?"string":Fa(r)?"number":Pc(r)?"boolean":Array.isArray(r)?"array":r===null?"null":Cc(r)?"object":typeof r}function Cc(r){return r!=null&&!Array.isArray(r)&&typeof r!="function"&&!(r instanceof String||r instanceof Number||r instanceof Boolean)&&typeof r=="object"}function St(r){return typeof r=="string"||r instanceof String}function Fa(r){return typeof r=="number"||r instanceof Number}function Pc(r){return typeof r=="boolean"||r instanceof Boolean}const Tt={"to-boolean":wi,"to-color":In,"to-number":pt,"to-string":Yt};class Do{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 o=e[0],a=[];let u=mo;
1if(o==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);u=nn(i.expectedType.itemType,h)}else{if(!(h>0&&Oa(e[1][0])))return null;u=nn(kr(e[1][0]),h)}for(let f=0;f<h;f++){const _=e[1][f];let y;if(Array.isArray(_))y=i.parse(_,void 0,u.itemType);else{const v=ht(_);if(v!==u.itemType.kind)return i.error(`Expected ${u.itemType.kind} but found ${v}.`);y=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!y)return null;a.push(y)}}else{if((o==="to-boolean"||o==="to-string")&&e.length!==2)return i.error("Expected one argument.");u=Tt[o];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,_i);if(!f)return null;a.push(f)}}return new Do(u,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,o;for(const a of this.args){if(i=a.evaluate(e),o=null,i instanceof yi)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(o=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ca(i[0],i[1],i[2],i[3]),!o))return new yi(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new zr(o||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const o of this.args){if(i=o.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new zr(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?mn.fromString(Jn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?_n.build(Jn(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map((i=>i.evaluate(e))):Jn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if(this.type.kind==="formatted")return new zo([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Dt(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild((i=>{e.push(i.serialize())})),e}}const dh=["Unknown","Point","LineString","Polygon"];class Rc{constructor(e,i,o){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i,this.iconImageUseTheme=o}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?dh[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:o,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*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]=yi.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class gn{constructor(e,i,o,a,u){this.name=e,this.type=i,this._evaluate=o,this.args=a,this._overloadIndex=u}evaluate(e){if(!this._evaluate){const i=gn.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 o=e[0],a=gn.definitions[o];if(!a)return i.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=[];let _=null,y=-1;for(const[v,b]of h){if(Array.isArray(v)&&v.length!==e.length-1)continue;f.push(v),y++,_=new Gc(i.registry,i.path,null,i.scope,void 0,i._scope,i.options,i.iconImageUseTheme);const T=[];let E=!1;for(let I=1;I<e.length;I++){const P=e[I],L=Array.isArray(v)?v[I-1]:v.type,D=_.parse(P,1+T.length,L);if(!D){E=!0;break}
1T.push(D)}if(!E)if(Array.isArray(v)&&v.length!==T.length)_.error(`Expected ${v.length} arguments, but found ${T.length} instead.`);else{for(let I=0;I<T.length;I++){const P=Array.isArray(v)?v[I]:v.type,L=T[I];_.concat(I+1).checkSubtype(P,L.type)}if(_.errors.length===0)return new gn(o,u,b,T,y)}}if(f.length===1)i.errors.push(..._.errors);else{const v=(f.length?f:h.map((([T])=>T))).map(zc).join(" | "),b=[];for(let T=1;T<e.length;T++){const E=i.parse(e[T],1+b.length);if(!E)return null;b.push(br(E.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){gn.definitions=i;for(const o in i)e[o]=gn}}function zc(r){return Array.isArray(r)?`(${r.map(br).join(", ")})`:`(${br(r.type)}...)`}class jr{constructor(e,i,o){this.type=Ic,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return i.error("Collator options argument must be an object.");const a=o["case-sensitive"]===void 0?i.parse(!1,1,wi):i.parseObjectValue(o["case-sensitive"],1,"case-sensitive",wi);if(!a)return null;const u=o["diacritic-sensitive"]===void 0?i.parse(!1,1,wi):i.parseObjectValue(o["diacritic-sensitive"],1,"diacritic-sensitive",wi);if(!u)return null;let h=null;return o.locale&&(h=i.parseObjectValue(o.locale,1,"locale",Yt),!h)?null:new jr(a,u,h)}evaluate(e){return new uh(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 Dc(r,e,i=0,o=r.length-1,a=fh){for(;o>i;){if(o-i>600){const _=o-i+1,y=e-i+1,v=Math.log(_),b=.5*Math.exp(2*v/3),T=.5*Math.sqrt(v*b*(_-b)/_)*(y-_/2<0?-1:1);Dc(r,e,Math.max(i,Math.floor(e-y*b/_+T)),Math.min(o,Math.floor(e+(_-y)*b/_+T)),a)}const u=r[e];let h=i,f=o;for(go(r,i,e),a(r[o],u)>0&&go(r,i,o);h<f;){for(go(r,h,f),h++,f--;a(r[h],u)<0;)h++;for(;a(r[f],u)>0;)f--}a(r[i],u)===0?go(r,i,f):(f++,go(r,f,o)),f<=e&&(i=f+1),e<=f&&(o=f-1)}}function go(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}function fh(r,e){return r<e?-1:r>e?1:0}function Ms(r){let e=0;for(let i,o,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],o=r[h],e+=(o.x-i.x)*(i.y+o.y);return e}function Qn(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 Pl(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function om(r,e,i){const o=r[0]-e[0],a=r[1]-e[1],u=r[0]-i[0],h=r[1]-i[1];return o*h-u*a==0&&o*u<=0&&a*h<=0}function ka(r,e,i=!1){let o=!1;for(let f=0,_=e.length;f<_;f++){const y=e[f];for(let v=0,b=y.length,T=b-1;v<b;T=v++){const E=y[T],I=y[v];if(om(r,E,I))return i;(u=E)[1]>(a=r)[1]!=(h=I)[1]>a[1]&&a[0]<(h[0]-u[0])*(a[1]-u[1])/(h[1]-u[1])+u[0]&&(o=!o)}}var a,u,h;return o}function Rl(r,e,i,o){const a=o[0]-i[0],u=o[1]-i[1],h=(r[0]-i[0])*u-a*(r[1]-i[1]),f=(e[0]-i[0])*u-a*(e[1]-i[1]);return h>0&&f<0||h<0&&f>0}function zl(r,e,i,o){return(a=[o[0]-i[0],o[1]-i[1]])[0]*(u=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*u[0]!=0&&!(!Rl(r,e,i,o)||!Rl(i,o,r,e));var a,u}function Ko(r){const e=new Oe(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Oe(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const o of r[0])e.x>o.x&&(e.x=o.x),e.y>o.y&&(e.y=o.y),i.x<o.x&&(i.x=o.x),i.y<o.y&&(i.y=o.y);return{min:e,max:i}}const Cs=8192;function sm(r,e){const i=(180+r[0])/360,o=(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*Cs),Math.round(o*a*Cs)]}function ph(r,e){for(let i=0;i<e.length;i++)if(ka(r,e[i]))return!0;return!1}function am(r,e,i){for(const o of i)for(let a=0,u=o.length,h=u-1;a<u;h=a++)if(zl(r,e,o[h],o[a]))return!0;return!1}function af(r,e){for(let i=0;i<r.length;++i)if(!ka(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(am(r[i],r[i+1],e))return!1;return!0}function lf(r,e){for(let i=0;i<e.length;
1i++)if(af(r,e[i]))return!0;return!1}function mh(r,e,i){const o=[];for(let a=0;a<r.length;a++){const u=[];for(let h=0;h<r[a].length;h++){const f=sm(r[a][h],i);Qn(e,f),u.push(f)}o.push(u)}return o}function Ps(r,e,i){const o=[];for(let a=0;a<r.length;a++){const u=mh(r[a],e,i);o.push(u)}return o}function cf(r,e,i,o){if(r[0]<i[0]||r[0]>i[2]){const a=.5*o;let u=r[0]-i[0]>a?-o:i[0]-r[0]>a?o:0;u===0&&(u=r[0]-i[2]>a?-o:i[2]-r[0]>a?o:0),r[0]+=u}Qn(e,r)}function uf(r,e,i,o){const a=Math.pow(2,o.z)*Cs,u=[o.x*Cs,o.y*Cs],h=[];if(!r)return h;for(const f of r)for(const _ of f){const y=[_.x+u[0],_.y+u[1]];cf(y,e,i,a),h.push(y)}return h}function Lc(r,e,i,o){const a=Math.pow(2,o.z)*Cs,u=[o.x*Cs,o.y*Cs],h=[];if(!r)return h;for(const _ of r){const y=[];for(const v of _){const b=[v.x+u[0],v.y+u[1]];Qn(e,b),y.push(b)}h.push(y)}if(e[2]-e[0]<=a/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of h)for(const y of _)cf(y,e,i,a)}var f;return h}class Rs{constructor(e,i){this.type=wi,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(Oa(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let a=0;a<o.features.length;++a){const u=o.features[a].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Rs(o,o.features[a].geometry)}else if(o.type==="Feature"){const a=o.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new Rs(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Rs(o,o)}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,o){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(o.type==="Polygon"){const f=mh(o.coordinates,u,h),_=uf(i.geometry(),a,u,h);if(!Pl(a,u))return!1;for(const y of _)if(!ka(y,f))return!1}if(o.type==="MultiPolygon"){const f=Ps(o.coordinates,u,h),_=uf(i.geometry(),a,u,h);if(!Pl(a,u))return!1;for(const y of _)if(!ph(y,f))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,o){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(o.type==="Polygon"){const f=mh(o.coordinates,u,h),_=Lc(i.geometry(),a,u,h);if(!Pl(a,u))return!1;for(const y of _)if(!af(y,f))return!1}if(o.type==="MultiPolygon"){const f=Ps(o.coordinates,u,h),_=Lc(i.geometry(),a,u,h);if(!Pl(a,u))return!1;for(const y of _)if(!lf(y,f))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},eo=1/298.257223563,hf=eo*(2-eo),Ba=Math.PI/180;class Na{static fromTile(e,i,o){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),u=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/Ba;return new Na(u,o)}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 o=6378.137*Ba*(i?Dl[i]:1),a=Math.cos(e*Ba),u=1/(1-hf*(1-a*a)),h=Math.sqrt(u);this.kx=o*h*a,this.ky=o*h*u*(1-hf)}distance(e,i){const o=Vn(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(o*o+a*a)}bearing(e,i){const o=Vn(i[0]-e[0])*this.kx;return Math.atan2(o,(i[1]-e[1])*this.ky)/Ba}destination(e,i,o){const a=o*Ba;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,o){return[e[0]+i/this.kx,e[1]+o/this.ky]}lineDistance(e){let i=0;for(let o=0;o<e.length-1;o++)i+=this.distance(e[o],e[o+1]);return i}area(e){let i=0;for(let o=0;o<e.length;o++){const a=e[o];for(let u=0,h=a.length,f=h-1;u<h;f=u++)i+=Vn(a[u][0]-a[f][0])*(a[u][1]+a[f][1])*(o?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let o=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const u=e[a],h=e[a+1],f=this.distance(u,h);if(o+=f,o>i)return Oc(u,h,(i-(o-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,i,o){let[a,u]=i,h=Vn(o[0]-a)*this.kx,f=(o[1]-u)*this.ky;if(h!==0||f!==0){const _=(Vn(e[0]-a)*this.kx*h+(e[1]-u)*this.ky*f)/(h*h+f*f);_>1?(a=o[0],u=o[1]):_>0&&(a+=h/this.kx*_,u+=f/this.ky*_)}return h=Vn(e[0]-a)*this.kx,f=(e[1]-u)*this.ky,Math.sqrt(h*h+f*f)}pointOnLine(e,i){let o=1/0,a=e[0][0],u=e[0][1],h=0,f=0;for(let _=0;_<e.length-1;_++){let y=e[_][0],v=e[_][1],b=Vn(e[_+1][0]-y)*this.kx,T=(e[_+1][1]-v)*this.ky,E=0;b===0&&T===0||(E=(Vn(i[0]-y)*this.kx*b+(i[1]-v)*this.ky*T)/(b*b+T*T),E>1?(y=e[_+1][0],v=e[_+1][1]):E>0&&(y+=b/this.kx*E,v+=T/this.ky*E)),b=Vn(i[0]-y)*this.kx,T=(i[1]-v)*this.ky;const I=b*b+T*T;I<o&&(o=I,a=y,u=v,h=_,f=E)}return{point:[a,u],index:h,t:Math.max(0,Math.min(1,f))}}lineSlice(e,i,o){let a=this.pointOnLine(o,e),u=this.pointOnLine(o,i);if(a.index>u.index||a.index===u.index&&a.t>u.t){const y=a;a=u,u=y}const h=[a.point],f=a.index+1,_=u.index;!_h(o[f],h[0])&&f<=_&&h.push(o[f]);for(let y=f+1;y<=_;y++)h.push(o[y]);return _h(o[_],u.point)||h.push(u.point),h}lineSliceAlong(e,i,o){let a=0;const u=[];for(let h=0;h<o.length-1;
1h++){const f=o[h],_=o[h+1],y=this.distance(f,_);if(a+=y,a>e&&u.length===0&&u.push(Oc(f,_,(e-(a-y))/y)),a>=i)return u.push(Oc(f,_,(i-(a-y))/y)),u;a>e&&u.push(_)}return u}bufferPoint(e,i){const o=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-o,e[0]+a,e[1]+o]}bufferBBox(e,i){const o=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-o,e[2]+a,e[3]+o]}insideBBox(e,i){return Vn(e[0]-i[0])>=0&&Vn(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function _h(r,e){return r[0]===e[0]&&r[1]===e[1]}function Oc(r,e,i){const o=Vn(e[0]-r[0]);return[r[0]+o*i,r[1]+(e[1]-r[1])*i]}function Vn(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class Fc{constructor(e=[],i=((o,a)=>o<a?-1:o>a?1:0)){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}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:o}=this,a=i[e];for(;e>0;){const u=e-1>>1,h=i[u];if(o(a,h)>=0)break;i[e]=h,e=u}i[e]=a}_down(e){const{data:i,compare:o}=this,a=this.length>>1,u=i[e];for(;e<a;){let h=1+(e<<1);const f=h+1;if(f<this.length&&o(i[f],i[h])<0&&(h=f),o(i[h],u)>=0)break;i[e]=i[h],e=h}i[e]=u}}var $e=8192;function gh(r,e){return e.dist-r.dist}const kc=100,Bc=50;function yh(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 Ll(r){return r[1]-r[0]+1}function Lo(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function xh(r,e){if(r[0]>r[1])return[null,null];const i=Ll(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}{if(i===1)return[r,null];const o=Math.floor(i/2)-1;return[[r[0],r[0]+o],[r[0]+o+1,r[1]]]}}function ua(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!Lo(e,r.length))return i;for(let o=e[0];o<=e[1];++o)Qn(i,r[o]);return i}function ha(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let o=0;o<r[i].length;++o)Qn(e,r[i][o]);return e}function zs(r,e,i){if(yh(r)||yh(e))return NaN;let o=0,a=0;return r[2]<e[0]&&(o=e[0]-r[2]),r[0]>e[2]&&(o=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],[o,a])}function Nc(r){return 360*r-180}function df(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Vc(r,e){const i=Math.pow(2,e.z),o=(r.y/$e+e.y)/i;return[Nc((r.x/$e+e.x)/i),df(o)]}function lm(r,e){const i=[];for(let o=0;o<r.length;++o)i.push(Vc(r[o],e));return i}function ff(r,e,i){const o=i.pointOnLine(e,r).point;return i.distance(r,o)}function vh(r,e,i,o,a){const u=i.slice(o[0],o[1]+1);let h=1/0;for(let f=e[0];f<=e[1];++f)if((h=Math.min(h,ff(r[f],u,a)))===0)return 0;return h}function Ds(r,e,i,o,a){const u=Math.min(a.pointToSegmentDistance(r,i,o),a.pointToSegmentDistance(e,i,o)),h=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(o,r,e));return Math.min(u,h)}function Jt(r,e,i,o,a){if(!Lo(e,r.length)||!Lo(o,i.length))return NaN;let u=1/0;for(let h=e[0];h<e[1];++h)for(let f=o[0];f<o[1];++f){if(zl(r[h],r[h+1],i[f],i[f+1]))return 0;u=Math.min(u,Ds(r[h],r[h+1],i[f],i[f+1],a))}return u}function cm(r,e,i,o,a){if(!Lo(e,r.length)||!Lo(o,i.length))return NaN;let u=1/0;for(let h=e[0];h<=e[1];++h)for(let f=o[0];f<=o[1];++f)if((u=Math.min(u,a.distance(r[h],i[f])))===0)return u;return u}function um(r,e,i){if(ka(r,e,!0))return 0;let o=1/0;for(const a of e){const u=a.length;if(u<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[u-1]&&(o=Math.min(o,i.pointToSegmentDistance(r,a[u-1],a[0])))===0||(o=Math.min(o,ff(r,a,i)))===0)return o}return o}function hm(r,e,i,o){if(!Lo(e,r.length))return NaN;for(let u=e[0];u<=e[1];++u)if(ka(r[u],i,!0))return 0;let a=1/0;for(let u=e[0];u<e[1];++u)for(const h of i)for(let f=0,_=h.length,y=_-1;f<_;y=f++){if(zl(r[u],r[u+1],h[y],h[f]))return 0;a=Math.min(a,Ds(r[u],r[u+1],h[y],h[f],o))}return a}function bh(r,e){for(const i of r)for(let o=0;o<=i.length-1;++o)if(ka(i[o],e,!0))return!0;return!1}
1function dm(r,e,i,o=1/0){const a=ha(r),u=ha(e);if(o!==1/0&&zs(a,u,i)>=o)return o;if(Pl(a,u)){if(bh(r,e))return 0}else if(bh(e,r))return 0;let h=o;for(const f of r)for(let _=0,y=f.length,v=y-1;_<y;v=_++)for(const b of e)for(let T=0,E=b.length,I=E-1;T<E;I=T++){if(zl(f[v],f[_],b[I],b[T]))return 0;h=Math.min(h,Ds(f[v],f[_],b[I],b[T],i))}return h}function Hi(r,e,i,o,a,u,h){if(u===null||h===null)return;const f=zs(ua(o,u),ua(a,h),i);f<e&&r.push({dist:f,range1:u,range2:h})}function fm(r,e,i,o,a=1/0){let u=Math.min(o.distance(r[0],i[0][0]),a);if(u===0)return u;const h=new Fc([{dist:0,range1:[0,r.length-1],range2:[0,0]}],gh),f=e?Bc:kc,_=ha(i);for(;h.length;){const y=h.pop();if(y.dist>=u)continue;const v=y.range1;if(Ll(v)<=f){if(!Lo(v,r.length))return NaN;if(e){const b=hm(r,v,i,o);if((u=Math.min(u,b))===0)return u}else for(let b=v[0];b<=v[1];++b){const T=um(r[b],i,o);if((u=Math.min(u,T))===0)return u}}else{const b=xh(v,e);if(b[0]!==null){const T=zs(ua(r,b[0]),_,o);T<u&&h.push({dist:T,range1:b[0],range2:[0,0]})}if(b[1]!==null){const T=zs(ua(r,b[1]),_,o);T<u&&h.push({dist:T,range1:b[1],range2:[0,0]})}}}return u}function pf(r,e,i,o,a,u=1/0){let h=Math.min(u,a.distance(r[0],i[0]));if(h===0)return h;const f=new Fc([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],gh),_=e?Bc:kc,y=o?Bc:kc;for(;f.length;){const v=f.pop();if(v.dist>=h)continue;const b=v.range1,T=v.range2;if(Ll(b)<=_&&Ll(T)<=y){if(!Lo(b,r.length)||!Lo(T,i.length))return NaN;if(e&&o?h=Math.min(h,Jt(r,b,i,T,a)):e||o?e&&!o?h=Math.min(h,vh(i,T,r,b,a)):!e&&o&&(h=Math.min(h,vh(r,b,i,T,a))):h=Math.min(h,cm(r,b,i,T,a)),h===0)return h}else{const E=xh(b,e),I=xh(T,o);Hi(f,h,a,r,i,E[0],I[0]),Hi(f,h,a,r,i,E[0],I[1]),Hi(f,h,a,r,i,E[1],I[0]),Hi(f,h,a,r,i,E[1],I[1])}}return h}function wh(r,e,i,o,a=1/0){let u=a;const h=ua(r,[0,r.length-1]);for(const f of i)if(!(u!==1/0&&zs(h,ua(f,[0,f.length-1]),o)>=u)&&(u=Math.min(u,pf(r,e,f,!0,o,u)),u===0))return u;return u}function Uc(r,e,i,o,a=1/0){let u=a;const h=ua(r,[0,r.length-1]);for(const f of i){if(u!==1/0&&zs(h,ha(f),o)>=u)continue;const _=fm(r,e,f,o,u);if(isNaN(_))return _;if((u=Math.min(u,_))===0)return u}return u}function Th(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class da{constructor(e,i){this.type=pt,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(Oa(e[1])){const o=e[1];if(o.type==="FeatureCollection"){for(let a=0;a<o.features.length;++a)if(Th(o.features[a].geometry.type))return new da(o,o.features[a].geometry)}else if(o.type==="Feature"){if(Th(o.geometry.type))return new da(o,o.geometry)}else if(Th(o.type))return new da(o,o)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),o=e.canonicalID();if(i!=null&&o!=null){if(e.geometryType()==="Point")return(function(a,u,h){const f=[];for(const y of a)for(const v of y)f.push(Vc(v,u));const _=new Na(f[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?pf(f,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",_):h.type==="MultiLineString"?wh(f,!1,h.coordinates,_):h.type==="Polygon"||h.type==="MultiPolygon"?Uc(f,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,_):null})(i,o,this.geometries);if(e.geometryType()==="LineString")return(function(a,u,h){const f=[];for(const y of a){const v=[];for(const b of y)v.push(Vc(b,u));f.push(v)}const _=new Na(f[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return wh(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let y=1/0;for(let v=0;v<h.coordinates.length;v++){const b=wh(h.coordinates[v],!0,f,_,y);if(isNaN(b))return b;if((y=Math.min(y,b))===0)return y}return y}if(h.type==="Polygon"||h.type==="MultiPolygon"){let y=1/0;for(let v=0;v<f.length;v++){const b=Uc(f[v],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,_,y);if(isNaN(b))return b;if((y=Math.min(y,b))===0)return y}return y}return null})(i,o,this.geometries);if(e.geometryType()==="Polygon")return(function(a,u,h){const f=[];for(const y of(function(v,b){const T=v.length;if(T<=1)return[v];const E=[];let I,P;for(let L=0;L<T;L++){const D=Ms(v[L]);
1D!==0&&(v[L].area=Math.abs(D),P===void 0&&(P=D<0),P===D<0?(I&&E.push(I),I=[v[L]]):I.push(v[L]))}return I&&E.push(I),E})(a)){const v=[];for(let b=0;b<y.length;++b)v.push(lm(y[b],u));f.push(v)}const _=new Na(f[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Uc(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let y=1/0;for(let v=0;v<h.coordinates.length;v++){const b=Uc(h.coordinates[v],!0,f,_,y);if(isNaN(b))return b;if((y=Math.min(y,b))===0)return y}return y}return h.type==="Polygon"||h.type==="MultiPolygon"?(function(y,v,b){let T=1/0;for(const E of y)for(const I of v){const P=dm(E,I,b,T);if(isNaN(P))return P;if((T=Math.min(T,P))===0)return T}return T})(h.type==="Polygon"?[h.coordinates]:h.coordinates,f,_):null})(i,o,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 Va(r){if(r instanceof gn&&(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 Rs||r instanceof da)return!1;if(r instanceof ja)return r.featureConstant;let e=!0;return r.eachChild((i=>{e&&!Va(i)&&(e=!1)})),e}function Ol(r){if(r instanceof gn&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!Ol(i)&&(e=!1)})),e}function Ua(r,e){if(r instanceof gn&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((o=>{i&&!Ua(o,e)&&(i=!1)})),i}function mf(r,e,i){return[r,e,i].filter(Boolean).join("�")}function Sh(r,e){switch(r){case"string":return Jn(e);case"number":return+e;case"boolean":return!!e;case"color":return yi.parse(e);case"formatted":return mn.fromString(Jn(e));case"resolvedImage":return _n.build(Jn(e))}return e}function _f(r,e,i,o){return o!==void 0&&(r=o*Math.round(r/o)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class ja{constructor(e,i,o,a=!1){this.type=e,this.key=i,this.scope=o,this.featureConstant=a}static parse(e,i){let o=i.expectedType;if(o==null&&(o=_i),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 Yo))return i.error("Key name of 'config' expression must be a string literal.");let u,h=!0;const f=Jn(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof Yo))return i.error("Scope of 'config' expression must be a string literal.");u=Jn(_.value)}if(i.options){const _=mf(f,u,i._scope),y=i.options.get(_);y&&(h=Va(y.value||y.default))}return new ja(o,f,u,h)}evaluate(e){const i=mf(this.key,this.scope,e.scope),o=e.getConfig(i);if(!o)return null;const{type:a,value:u,values:h,minValue:f,maxValue:_,stepValue:y}=o,v=o.default.evaluate(e);let b=v;if(u){const T=e.scope;e.scope=(T||"").split("�").slice(1).join("�"),b=u.evaluate(e),e.scope=T}return a&&(b=Sh(a,b)),b===void 0||f===void 0&&_===void 0&&y===void 0||(typeof b=="number"?b=_f(b,f,_,y):Array.isArray(b)&&(b=b.map((T=>typeof T=="number"?_f(T,f,_,y):T)))),u!==void 0&&b!==void 0&&h&&!h.includes(b)&&(b=v,a&&(b=Sh(a,b))),(a&&a!==this.type||b!==void 0&&!Ac(kr(b),this.type))&&(b=Sh(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class jc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const o=e[1];return i.scope.has(o)?new jc(o,i.scope.get(o)):i.error(`Unknown variable "${o}". Make sure "${o}" 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 Gc{constructor(e,i=[],o,a=new La,u=[],h,f,_){this.registry=e,this.path=i,this.key=i.map((y=>typeof y=="string"?`['${y}']`:`[${y}]`)).join(""),this.scope=a,this.errors=u,this.expectedType=o,this._scope=h,this.options=f,this.iconImageUseTheme=_}parse(e,i,o,a,u={}){return i||o?this.concat(i,null,o,a)._parse(e,u):this._parse(e,u)}parseObjectValue(e,i,o,a,u,h={}){return this.concat(i,o,a,u)._parse(e,h)}_parse(e,i){function o(a,u,h){return h==="assert"?new _o(u,[a]):h==="coerce"?new Do(u,[a]):a}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let u=a.parse(e,this);if(!u)return null;if(this.expectedType){const h=this.expectedType,f=u.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||f.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(h,f))return null}else u=o(u,h,i.typeAnnotation||"coerce");else u=o(u,h,i.typeAnnotation||"assert")}if(!(u instanceof Yo)&&u.type.kind!=="resolvedImage"&&Eh(u)){const h=new Rc(this._scope,this.options,this.iconImageUseTheme);try{u=new Yo(u.type,u.evaluate(h))}catch(f){return this.error(f.message),null}}return u}return Do.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,o,a){let u=typeof e=="number"?this.path.concat(e):this.path;u=typeof i=="string"?u.concat(i):u;const h=a?this.scope.concat(a):this.scope;return new Gc(this.registry,u,o||null,h,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...i){const o=`${this.key}${i.map((a=>`[${a}]`)).join("")}`;this.errors.push(new Kn(o,e))}checkSubtype(e,i){const o=As(e,i);return o&&this.error(o),o}}function Eh(r){if(r instanceof jc)return Eh(r.boundExpression);if(r instanceof gn&&r.name==="error"||r instanceof jr||r instanceof Rs||r instanceof da||r instanceof ja)return!1;const e=r instanceof Do||r instanceof _o;let i=!0;return r.eachChild((o=>{i=e?i&&Eh(o):i&&o instanceof Yo})),!!i&&Va(r)&&Ua(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 Hc(r,e){const i=r.length-1;let o,a,u=0,h=i,f=0;for(;u<=h;)if(f=Math.floor((u+h)/2),o=r[f],a=r[f+1],o<=e){if(f===i||e<a)return f;u=f+1}else{if(!(o>e))throw new zr("Input is not a number.");h=f-1}return 0}class Fl{constructor(e,i,o){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,u]of o)this.labels.push(a),this.outputs.push(u)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const o=i.parse(e[1],1,pt);if(!o)return null;const a=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],_=e[h+1],y=h,v=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',y);if(a.length&&a[a.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',y);const b=i.parse(_,v,u);if(!b)return null;u=u||b.type,a.push([f,b])}return new Fl(u,o,a)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const u=i.length;return a>=i[u-1]?o[u-1].evaluate(e):o[Hc(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 gf=.95047,yf=1.08883,xf=4/29,Ga=6/29,vf=3*Ga*Ga,pm=Ga*Ga*Ga,mm=Math.PI/180,_m=180/Math.PI;function Ih(r){return r>pm?Math.pow(r,1/3):r/vf+xf}function Ah(r){return r>Ga?r*r*r:vf*(r-xf)}function Mh(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function Ch(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function bf(r){const e=Ch(r.r),i=Ch(r.g),o=Ch(r.b),a=Ih((.4124564*e+.3575761*i+.1804375*o)/gf),u=Ih((.2126729*e+.7151522*i+.072175*o)/1);return{l:116*u-16,a:500*(a-u),b:200*(u-Ih((.0193339*e+.119192*i+.9503041*o)/yf)),alpha:r.a}}function qc(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,o=isNaN(r.b)?e:e-r.b/200;return e=1*Ah(e),i=gf*Ah(i),o=yf*Ah(o),new yi(Mh(3.2404542*i-1.5371385*e-.4985314*o),Mh(-.969266*i+1.8760108*e+.041556*o),Mh(.0556434*i-.2040259*e+1.0572252*o),r.alpha)}function $c(r,e,i){const o=e-r;return r+i*(o>180||o<-180?o-360*Math.round(o/360):o)}const Ha={forward:bf,reverse:qc,interpolate:function(r,e,i){return{l:wt(r.l,e.l,i),a:wt(r.a,e.a,i),b:wt(r.b,e.b,i),alpha:wt(r.alpha,e.alpha,i)}}},kl={forward:function(r){const{l:e,a:i,b:o}=bf(r),a=Math.atan2(o,i)*_m;return{h:a<0?a+360:a,c:Math.sqrt(i*i+o*o),l:e,alpha:r.a}},reverse:function(r){const e=r.h*mm,i=r.c;return qc({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:$c(r.h,e.h,i),c:wt(r.c,e.c,i),l:wt(r.l,e.l,i),alpha:wt(r.alpha,e.alpha,i)}}};var wf=Object.freeze({__proto__:null,hcl:kl,lab:Ha});class Un{constructor(e,i,o,a,u){this.type=e,this.operator=i,this.interpolation=o,this.input=a,this.labels=[],this.outputs=[];for(const[h,f]of u)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,i,o,a){let u=0;if(e.name==="exponential")u=Zc(i,e.base,o,a);else if(e.name==="linear")u=Zc(i,1,o,a);else if(e.name==="cubic-bezier"){const h=e.controlPoints;u=new _c(h[0],h[1],h[2],h[3]).solve(Zc(i,1,o,a))}return u}static parse(e,i){let[o,a,u,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const y=a[1];if(typeof y!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:y}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const y=a.slice(1);if(y.length!==4||y.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:y}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,pt),!u)return null;const f=[];let _=null;o==="interpolate-hcl"||o==="interpolate-lab"?_=In:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let y=0;y<h.length;y+=2){const v=h[y],b=h[y+1],T=y+3,E=y+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',T);const I=i.parse(b,E,_);if(!I)return null;_=_||I.type,f.push([v,I])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new Un(_,o,a,u,f):i.error(`Type ${br(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const u=i.length;if(a>=i[u-1])return o[u-1].evaluate(e);const h=Hc(i,a),f=Un.interpolationFactor(this.interpolation,a,i[h],i[h+1]),_=o[h].evaluate(e),y=o[h+1].evaluate(e);return this.operator==="interpolate"?Il[this.type.kind.toLowerCase()](_,y,f):this.operator==="interpolate-hcl"?kl.reverse(kl.interpolate(kl.forward(_),kl.forward(y),f)):H
1a.reverse(Ha.interpolate(Ha.forward(_),Ha.forward(y),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let o=0;o<this.labels.length;o++)i.push(this.labels[o],this.outputs[o].serialize());return i}}function Zc(r,e,i,o){const a=o-i,u=r-i;return a===0?0:e===1?u/a:(Math.pow(e,u)-1)/(Math.pow(e,a)-1)}class Bl{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 o=null;const a=i.expectedType;a&&a.kind!=="value"&&(o=a);const u=[];for(const f of e.slice(1)){const _=i.parse(f,1+u.length,o,void 0,{typeAnnotation:"omit"});if(!_)return null;o=o||_.type,u.push(_)}const h=a&&u.some((f=>As(a,f.type)));return new Bl(h?_i:o,u)}evaluate(e){let i,o=null,a=0;for(const u of this.args){if(a++,o=u.evaluate(e),o&&o instanceof _n&&!o.available&&(i||(i=o),o=null,a===this.args.length))return i;if(o!==null)break}return o}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 Jo{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 o=[];for(let u=1;u<e.length-1;u+=2){const h=e[u];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,u);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=i.parse(e[u+1],u+1);if(!f)return null;o.push([h,f])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,o);return a?new Jo(o,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,o]of this.bindings)e.push(i,o.serialize());return e.push(this.result.serialize()),e}}class Wc{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,pt),a=i.parse(e[2],2,nn(i.expectedType||_i));return o&&a?new Wc(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new zr("Array index out of bounds: negative index");if(i>=o.length)throw new zr("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new zr("Array index must be an integer. Use at-interpolated for fractional indices");return o[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Xc{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,pt),a=i.parse(e[2],2,nn(i.expectedType||_i));return o&&a?new Xc(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new zr(`Array index out of bounds: ${i} < 0.`);if(i>o.length-1)throw new zr(`Array index out of bounds: ${i} > ${o.length-1}.`);if(i===Math.floor(i))return o[i];const a=Math.floor(i),u=Math.ceil(i),h=o[a],f=o[u];if(typeof h!="number"||typeof f!="number")throw new zr(`Cannot interpolate between non-number values at index ${i}.`);const _=i-a;return h*(1-_)+f*_}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Ph{constructor(e,i){this.type=wi,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 o=i.parse(e[1],1,_i),a=i.parse(e[2],2,_i);return o&&a?ch(o.type,[wi,Yt,pt,mo,_i])?new Ph(o,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${br(o.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(o==null)return!1;if(!Cl(i,["boolean","string","number","null"]))throw new zr(`Expected first argument to be of type boolean, string, number or null, but found ${br(kr(i))} instead.`);if(!Cl(o,["string","array"]))throw new zr(`Expected second argument to be of type array or string, but found ${br(kr(o))} instead.`);return o.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class qa{constructor(e,i,o){this.type=pt,this.needle=e,this.haystack=i,this.fromIndex=o}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 o=i.parse(e[1],1,_i),a=i.parse(e[2],2,_i);if(!o||!a)return null;if(!ch(o.type,[wi,Yt,pt,mo,_i]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${br(o.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,pt);return u?new qa(o,a,u):null}return new qa(o,a)}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Cl(i,["boolean","string","number","null"]))throw new zr(`Expected first argument to be of type boolean, string, number or null, but found ${br(kr(i))} instead.`);if(!Cl(o,["string","array"]))throw new zr(`Expected second argument to be of type array or string, but found ${br(kr(o))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return o.indexOf(i,a)}return o.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 Nl{constructor(e,i,o,a,u,h){this.inputType=e,this.type=i,this.input=o,this.cases=a,this.outputs=u,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let o,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const u={},h=[];for(let y=2;y<e.length-1;y+=2){let v=e[y];const b=e[y+1];Array.isArray(v)||(v=[v]);const T=i.concat(y);if(v.length===0)return T.error("Expected at least one branch label.");for(const I of v){if(typeof I!="number"&&typeof I!="string")return T.error("Branch labels must be numbers or strings.");if(typeof I=="number"&&Math.abs(I)>Number.MAX_SAFE_INTEGER)return T.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof I=="number"&&Math.floor(I)!==I)return T.error("Numeric branch labels must be integer values.");if(o){if(T.checkSubtype(o,kr(I)))return null}else o=kr(I);if(u[String(I)]!==void 0)return T.error("Branch labels must be unique.");u[String(I)]=h.length}const E=i.parse(b,y,a);if(!E)return null;a=a||E.type,h.push(E)}const f=i.parse(e[1],1,_i);if(!f)return null;const _=i.parse(e[e.length-1],e.length-1,a);return _?f.type.kind!=="value"&&i.concat(1).checkSubtype(o,f.type)?null:new Nl(o,a,f,u,h,_):null}evaluate(e){const i=this.input.evaluate(e);return(Ac(kr(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
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(),o=[],a={};for(const h of i){const f=a[this.cases[h]];f===void 0?(a[this.cases[h]]=o.length,o.push([this.cases[h],[h]])):o[f][1].push(h)}const u=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,f]of o)e.push(f.length===1?u(f[0]):f.map(u)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}class Vl{constructor(e,i,o){this.type=e,this.branches=i,this.otherwise=o}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 o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const a=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,wi);if(!f)return null;const _=i.parse(e[h+1],h+1,o);if(!_)return null;a.push([f,_]),o=o||_.type}const u=i.parse(e[e.length-1],e.length-1,o);return u?new Vl(o,a,u):null}evaluate(e){for(const[i,o]of this.branches)if(i.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,o]of this.branches)e(i),e(o);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 Yc{constructor(e,i,o,a){this.type=e,this.input=i,this.beginIndex=o,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 o=i.parse(e[1],1,_i),a=i.parse(e[2],2,pt);if(!o||!a)return null;if(!ch(o.type,[nn(_i),Yt,_i]))return i.error(`Expected first argument to be of type array or string, but found ${br(o.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,pt);return u?new Yc(o.type,o,a,u):null}return new Yc(o.type,o,a)}evaluate(e){const i=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Cl(i,["string","array"]))throw new zr(`Expected first argument to be of type array or string, but found ${br(kr(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(o,a)}return i.slice(o)}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 Rh{constructor(e,i){this.type=nn(Yt),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 o=i.parse(e[1],1,Yt),a=i.parse(e[2],2,Yt);return o&&a?new Rh(o,a):void 0}evaluate(e){const i=this.str.evaluate(e),o=this.delimiter.evaluate(e);return i.split(o)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function zh(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 Dh(r,e,i,o){return o.compare(e,i)===0}function $a(r,e,i){const o=r!=="=="&&r!=="!=";return class a0{constructor(u,h,f){this.type=wi,this.lhs=u,this.rhs=h,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||h.type.kind==="value"}static parse(u,h){if(u.length!==3&&u.length!==4)return h.error("Expected two or three arguments.");const f=u[0];let _=h.parse(u[1],1,_i);if(!_)return null;if(!zh(f,_.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${br(_.type)}'.`);let y=h.parse(u[2],2,_i);if(!y)return null;if(!zh(f,y.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${br(y.type)}'.`);if(_.type.kind!==y.type.kind&&_.type.kind!=="value"&&y.type.kind!=="value")return h.error(`Cannot compare types '${br(_.type)}' and '${br(y.type)}'.`);o&&(_.type.kind==="value"&&y.type.kind!=="value"?_=new _o(y.type,[_]):_.type.kind!=="value"&&y.type.kind==="value"&&(y=new _o(_.type,[y])));let v=null;if(u.length===4){if(_.type.kind!=="string"&&y.type.kind!=="string"&&_.type.kind!=="value"&&y.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(v=h.parse(u[3],3,Ic),!v)return null}return new a0(_,y,v)}evaluate(u){const h=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(o&&this.hasUntypedArgument){const _=kr(h),y=kr(f);if(_.kind!==y.kind||_.kind!=="string"&&_.kind!=="number")throw new zr(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${y.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const _=kr(h),y=kr(f);if(_.kind!=="string"||y.kind!=="string")return e(u,h,f)}return this.collator?i(u,h,f,this.collator.evaluate(u)):e(u,h,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}serialize(){const u=[r];return this.eachChild((h=>{u.push(h.serialize())})),u}}}const gm=$a("==",(function(r,e,i){return e===i}),Dh),ym=$a("!=",(function(r,e,i){return e!==i}),(function(r,e,i,o){return!Dh(0,e,i,o)})),Tf=$a("<",(function(r,e,i){return e<i}),(function(r,e,i,o){return o.compare(e,i)<0})),Sf=$a(">",(function(r,e,i){return e>i}),(function(r,e,i,o){return o.compare(e,i)>0})),Kc=$a("<=",(function(r,e,i){return e<=i}
1),(function(r,e,i,o){return o.compare(e,i)<=0})),xm=$a(">=",(function(r,e,i){return e>=i}),(function(r,e,i,o){return o.compare(e,i)>=0}));class Jc{constructor(e,i,o,a,u,h){this.type=Yt,this.number=e,this.locale=i,this.currency=o,this.unit=a,this.minFractionDigits=u,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const o=i.parse(e[1],1,pt);if(!o)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let u=null;if(a.locale&&(u=i.parseObjectValue(a.locale,2,"locale",Yt),!u))return null;let h=null;if(a.currency&&(h=i.parseObjectValue(a.currency,2,"currency",Yt),!h))return null;let f=null;if(a.unit&&(f=i.parseObjectValue(a.unit,2,"unit",Yt),!f))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",pt),!_))return null;let y=null;return a["max-fraction-digits"]&&(y=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",pt),!y)?null:new Jc(o,u,h,f,_,y)}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 Lh{constructor(e){this.type=pt,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=i.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${br(o.type)} instead.`):new Lh(o):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new zr(`Expected value to be of type string or array, but found ${br(kr(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((i=>{e.push(i.serialize())})),e}}function Ef(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 Za={"==":gm,"!=":ym,">":Sf,"<":Tf,">=":xm,"<=":Kc,array:_o,at:Wc,"at-interpolated":Xc,boolean:_o,case:Vl,coalesce:Bl,collator:jr,format:zo,image:Dt,in:Ph,"index-of":qa,interpolate:Un,"interpolate-hcl":Un,"interpolate-lab":Un,length:Lh,let:Jo,literal:Yo,match:Nl,number:_o,"number-format":Jc,object:_o,slice:Yc,step:Fl,string:_o,"to-boolean":Do,"to-color":Do,"to-number":Do,"to-string":Do,var:jc,within:Rs,distance:da,config:ja,split:Rh};function Oh(r,[e,i,o,a]){e=e.evaluate(r),i=i.evaluate(r),o=o.evaluate(r);const u=a?a.evaluate(r):1,h=ca(e,i,o,u);if(h)throw new zr(h);return new yi(e/255,i/255,o/255,u)}function Fh(r,[e,i,o,a]){e=e.evaluate(r),i=i.evaluate(r),o=o.evaluate(r);const u=a?a.evaluate(r):1,h=(function(y,v,b,T){return typeof y=="number"&&y>=0&&y<=360?typeof v=="number"&&v>=0&&v<=100&&typeof b=="number"&&b>=0&&b<=100?T===void 0||typeof T=="number"&&T>=0&&T<=1?null:`Invalid hsla value [${[y,v,b,T].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof T=="number"?[y,v,b,T]:[y,v,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof T=="number"?[y,v,b,T]:[y,v,b]).join(", ")}]: 'h' must be between 0 and 360.`})(e,i,o,u);if(h)throw new zr(h);const f=`hsla(${e}, ${i}%, ${o}%, ${u})`,_=yi.parse(f);if(!_)throw new zr(`Failed to parse HSLA color: ${f}`);return _}function If(r,e){return r in e}function kh(r,e){const i=e[r];return i===void 0?null:i}function Ls(r){return{type:r}}function fa(r){if(r instanceof ja)return new Set([r.key]);let e=new Set;return r.eachChild((i=>{e=new Set([...e,...fa(i)])})),e}function Qc(r){if(r instanceof gn&&r.name==="is-active-floor")return!0;let e=!1;return r.eachChild((i=>{!e&&Qc(i)&&(e=!0)})),e}function Af(r){return{result:"success",value:r}}function Os(r){return{result:"error",value:r}}function Bh(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function Ul(r){return r["property-type"]==="data-driven"}function Mf(r){return Bh(r.expression,"measure-light")}function Cf(r){return Bh(r.expression,"zoom")}function eu(r){return!!r.expression&&r.expression.interpolated}function tu(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Pf(r){return r}function Rf(r,e){const i=e.type==="color",o=r.stops&&typeof r.stops[0][0]=="object",a=o||!(o||r.property!==void 0),u=r.type||(eu(e)?"exponential":"interval");if(i&&((r=Object.assign({},r)).stops&&(r.stops=r.stops.map((y=>[y[0],yi.parse(y[1])]))),r.default=yi.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!wf[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let h,f,_;if(u==="exponential")h=zf;else if(u==="interval")h=bm;else if(u==="categorical"){h=vm,f=Object.create(null);for(const y of r.stops)f[y[0]]=y[1];_=typeof r.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);h=Df}if(o){const y={},v=[];for(let E=0;E<r.stops.length;E++){const I=r.stops[E],P=I[0].zoom;y[P]===void 0&&(y[P]={zoom:P,type:r.type,property:r.property,default:r.default,stops:[]},v.push(P)),y[P].stops.push([I[0].value,I[1]])}const b=[];for(const E of v)b.push([y[E].zoom,Rf(y[E],e)]);const T={name:"linear"};return{kind:"composite",interpolationType:T,interpolationFactor:Un.interpolationFactor.bind(void 0,T),zoomStops:b.map((E=>E[0])),evaluate:({zoom:E},I)=>zf({stops:b,base:r.base},e,E).evaluate(E,I)}}if(a){const y=u==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:y,interpolationFactor:Un.interpolationFactor.bind(void 0,y),zoomStops:r.stops.map((v=>v[0])),evaluate:({zoom:v})=>h(r,e,v,f,_)}}return{kind:"source",evaluate(y,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?Oo(r.default,e.default):h(r,e,b,f,_)}}}function Oo(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function vm(r,e,i,o,a){return Oo(typeof i===a?o[i]:void 0,r.default,e.default)}function bm(r,e,i){if(!Fa(i))return Oo(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const a=Hc(r.stops.map((u=>u[0])),i);return r.stops[a][1]}function zf(r,e,i){const o=r.base!==void 0?r.base:1;if(!Fa(i))return Oo(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const u=Hc(r.stops.map((v=>v[0])),i),h=(function(v,b,T,E){const I=E-T,P=v-T;return I===0?0:b===1?P/I:(Math.pow(b,P)-1)/(Math.pow(b,I)-1)})(i,o,r.stops[u][0],r.stops[u+1][0]),f=r.stops[u][1],_=r.stops[u+1][1];let y=Il[e.type]||Pf;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=wf[r.colorSpace];y=(b,T)=>v.reverse(v.interpolate(v.forward(b),v.forward(T),h))}return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),T=_.evaluate.apply(void 0,v);if(b!==void 0&&T!==void 0)return y(b,T,h)}}:y(f,_,h)}function Df(r,e,i){return e.type==="color"?i=yi.parse(i):e.type==="formatted"?i=mn.fromString(i.toString()):e.type==="resolvedImage"?i=_n.build(i.toString()):ht(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Oo(i,r.default,e.default)}gn.register(Za,{error:[{kind:"error"},[Yt],(r,[e])=>{throw new zr(e.evaluate(r))}],typeof:[Yt,[_i],(r,[e])=>br(kr(e.evaluate(r)))],"to-rgba":[nn(pt,4),[In],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[nn(pt,4),[In],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[In,[pt,pt,pt],Oh],rgba:[In,[pt,pt,pt,pt],Oh],hsl:[In,[pt,pt,pt],Fh],hsla:[In,[pt,pt,pt,pt],Fh],has:{type:wi,overloads:[[[Yt],(r,[e])=>If(e.evaluate(r),r.properties())],[[Yt,Ro],(r,[e,i])=>If(e.evaluate(r),i.evaluate(r))]]},get:{type:_i,overloads:[[[Yt],(r,[e])=>kh(e.evaluate(r),r.properties())],[[Yt,Ro],(r,[e,i])=>kh(e.evaluate(r),i.evaluate(r))]]},"feature-state":[_i,[Yt],(r,[e])=>kh(e.evaluate(r),r.featureState||{})],properties:[Ro,[],r=>r.properties()],"geometry-type":[Yt,[],r=>r.geometryType()],worldview:[Yt,[],r=>r.globals.worldview||""],"is-active-floor":[wi,Ls(Yt),(r,e)=>{if(!(r.globals.activeFloors&&r.globals.activeFloors.size>0))return!1;const i=r.globals.activeFloors;return e.some((o=>{const a=o.evaluate(r);return i.has(a)}))}],id:[_i,[],r=>r.id()],zoom:[pt,[],r=>r.globals.zoom],pitch:[pt,[],r=>r.globals.pitch||0],"distance-from-center":[pt,[],r=>r.distanceFromCenter()],"measure-light":[pt,[Yt],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[pt,[],r=>r.globals.heatmapDensity||0],"line-progress":[pt,[],r=>r.globals.lineProgress||0],"raster-value":[pt,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[pt,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[pt,[],r=>r.globals.skyRadialProgress||0],accumulated:[_i,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[pt,Ls(pt),(r,e)=>{let i=0;for(const o of e)i+=o.evaluate(r);return i}],"*":[pt,Ls(pt),(r,e)=>{let i=1;for(const o of e)i*=o.evaluate(r);return i}],"-":{type:pt,overloads:[[[pt,pt],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[pt],(r,[e])=>-e.evaluate(r)]]},"/":[pt,[pt,pt],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[pt,[pt,pt],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[pt,[],()=>Math.LN2],pi:[pt,[],()=>Math.PI],e:[pt,[],()=>Math.E],"^":[pt,[pt,pt],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[pt,[pt],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[pt,[pt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[pt,[pt],(r,[e])=>Math.log(e.evaluate(r))],log2:[pt,[pt],(r,[e])=>Math.log2(e.evaluate(r))],sin:[pt,[pt],(r,[e])=>Math.sin(e.evaluate(r))],cos:[pt,[pt],(r,[e])=>Math.cos(e.evaluate(r))],tan:[pt,[pt],(r,[e])=>Math.tan(e.evaluate(r))],asin:[pt,[pt],(r,[e])=>Math.asin(e.evaluate(r))],acos:[pt,[pt],(r,[e])=>Math.acos(e.evaluate(r))],atan:[pt,[pt],(r,[e])=>Math.atan(e.evaluate(r))],min:[pt,Ls(pt),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[pt,Ls(pt),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[pt,[pt],(r,[e])=>Math.abs(e.evaluate(r))],round:[pt,[pt],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[pt,[pt],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[pt,[pt],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[wi,[Yt,_i],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[wi,[_i],(r,[e])=>r.id()===e.value],"filter-type-==":[wi,[Yt],(r,[e])=>r.geometryType()===e.value],"filter-<":[wi,[Yt,_i],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o<a}],"filter-id-<":[wi,[_i],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i<o}],"filter->":[wi,[Yt,_i],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o>a}],"filter-id->":[wi,[_i],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i>o}],"filter-<=":[wi,[Yt,_i],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o<=a}],"filter-id-<=":[wi,[_i],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i<=o}],"filter->=":[wi,[Yt,_i],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o>=a}],"filter-id->=":[wi,[_i],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i>=o}],"filter-has":[wi,[_i],(r,[e])=>e.value in r.properties()],"filter-has-id":[wi,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[wi,[nn(Yt)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[wi,[nn(_i)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[wi,[Yt,nn(_i)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[wi,[Yt,nn(_i)],(r,[e,i])=>(function(o,a,u,h){for(;u<=h;){const f=u+h>>1;if(a[f]===o)return!0;a[f]>o?h=f-1:u=f+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:wi,overloads:[[[wi,wi],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[Ls(wi),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:wi,overloads:[[[wi,wi],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[Ls(wi),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[wi,[wi],(r,[e])=>!e.evaluate(r)],"is-supported-script":[wi,[Yt],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[Yt,[Yt],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[Yt,[Yt],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[Yt,Ls(_i),(r,e)=>e.map((i=>Jn(i.evaluate(r)))).join("")],"resolved-locale":[Yt,[Ic],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[pt,[pt,pt,_i],(r,e)=>{const[i,o,a]=e.map((h=>h.evaluate(r)));if(i>o||i===o)return i;let u;
1if(typeof a=="string")u=(function(h){let f=0;if(h.length===0)return f;for(let _=0;_<h.length;_++)f=(f<<5)-f+h.charCodeAt(_),f|=0;return f})(a);else{if(typeof a!="number")throw new zr(`Invalid seed input: ${a}`);u=a}return i+Ef(u)()*(o-i)}]});class iu{constructor(e,i,o,a,u){this.expression=e,this._warningHistory={},this._scope=o,this._options=a,this._iconImageUseTheme=u,this._evaluator=new Rc(o,a,u),this._defaultValue=i?(function(h){return h.type==="color"&&(tu(h.default)||Array.isArray(h.default))?new yi(0,0,0,0):h.type==="color"?yi.parse(h.default)||null:h.default===void 0?null:h.default})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=fa(e),this.isIndoorDependent=Qc(e)}evaluateWithoutErrorHandling(e,i,o,a,u,h,f,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=o,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,o,a,u,h,f,_,y){this._evaluator||(this._evaluator=new Rc(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=o||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this._evaluator.iconImageUseTheme=y||null;try{const v=this.expression.evaluate(this._evaluator);if(v==null||typeof v=="number"&&v!=v)return this._defaultValue;if(this._enumValues&&!(v in this._enumValues))throw new zr(`Expected value to be one of ${Object.keys(this._enumValues).map((b=>JSON.stringify(b))).join(", ")}, but found ${JSON.stringify(v)} instead.`);return v}catch(v){const b=v;return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${b.message}`)),this._defaultValue}}}function jl(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Za}function Fs(r,e,i,o,a){const u=new Gc(Za,[],e?(function(f){const _={color:In,string:Yt,number:pt,enum:Yt,boolean:wi,formatted:Al,resolvedImage:Ml};return f.type==="array"?nn(_[f.value]||_i,f.length):_[f.type]})(e):void 0,void 0,void 0,i,o,a),h=u.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?Af(new iu(h,e,i,o,a)):Os(u.errors)}class Wa{constructor(e,i,o,a){this.kind=e,this._styleExpression=i,this.isLightConstant=o,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!Ol(i.expression),this.configDependencies=fa(i.expression),this.isIndoorDependent=Qc(i.expression)}evaluateWithoutErrorHandling(e,i,o,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,u,h)}evaluate(e,i,o,a,u,h,f){return this._styleExpression.evaluate(e,i,o,a,u,h,void 0,void 0,f)}}class pa{constructor(e,i,o,a,u,h){this.kind=e,this.zoomStops=o,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Ol(i.expression),this.isIndoorDependent=Qc(i.expression),this.isLightConstant=u,this.isLineProgressConstant=h,this.configDependencies=fa(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,o,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,u,h)}evaluate(e,i,o,a,u,h){return this._styleExpression.evaluate(e,i,o,a,u,h)}interpolationFactor(e,i,o){return this.interpolationType?Un.interpolationFactor(this.interpolationType,e,i,o):0}}function Nh(r,e,i,o,a){if((r=Fs(r,e,i,o,a)).result==="error")return r;const u=r.value.expression,h=Va(u);if(!h&&!Ul(e))return Os([new Kn("","data expressions not supported")]);const f=Ua(u,["zoom","pitch","distance-from-center"]);if(!f&&!Cf(e))return Os([new Kn("","zoom expressions not supported")]);const _=Ua(u,["measure-light"]);if(!_&&!Mf(e))return Os([new Kn("","measure-light expression not supported")]);const y=Ua(u,["line-progress"]);if(!y&&!(function(T){return Bh(T.expression,"line-progress")})(e))return Os([new Kn("","line-progress expression not supported")]);const v=e.expression&&e.expression.relaxZoomRestriction,b=yo(u);return b||f||v?b instanceof Kn?Os([b]):b instanceof Un&&!eu(e)?Os([new Kn("",'"interpolate" expressions cannot be used with this property')]):Af(b?new pa(h&&y?"camera":"composite",r.value,b.labels,b instanceof Un?b.interpolation:void 0,_,y):new Wa(h&&y?"constant":"source",r.value,_,y)):Os([new Kn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ru{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,Rf(this._parameters,this._specification))}static deserialize(e){return new ru(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function yo(r){let e=null;if(r instanceof Jo)e=yo(r.result);else if(r instanceof Bl){for(const i of r.args)if(e=yo(i),e)break}else(r instanceof Fl||r instanceof Un)&&r.input instanceof gn&&r.input.name==="zoom"&&(e=r);return e instanceof Kn||r.eachChild((i=>{const o=yo(i);o instanceof Kn?e=o:e&&o&&e!==o&&(e=new Kn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}var Vh,Lf,Of=(function(){if(Lf)return Vh;Lf=1,Vh=e;var r=3;function e(i,o,a){var u=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var h=new Int32Array(this.arrayBuffer);i=h[0],this.d=(o=h[1])+2*(a=h[2]);for(var f=0;f<this.d*this.d;f++){var _=h[r+f],y=h[r+f+1];u.push(_===y?null:h.subarray(_,y))}var v=h[r+u.length+1];this.keys=h.subarray(h[r+u.length],v),this.bboxes=h.subarray(v),this.insert=this._insertReadonly}else{this.d=o+2*a;for(var b=0;b<this.d*this.d;b++)u.push([]);this.keys=[],this.bboxes=[]}this.n=o,this.extent=i,this.padding=a,this.scale=o/i,this.uid=0;var T=a/o*i;this.min=-T,this.max=i+T}
1return e.prototype.insert=function(i,o,a,u,h){this._forEachCell(o,a,u,h,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(h)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,o,a,u,h,f){this.cells[h].push(f)},e.prototype.query=function(i,o,a,u,h){var f=this.min,_=this.max;if(i<=f&&o<=f&&_<=a&&_<=u&&!h)return Array.prototype.slice.call(this.keys);var y=[];return this._forEachCell(i,o,a,u,this._queryCell,y,{},h),y},e.prototype._queryCell=function(i,o,a,u,h,f,_,y){var v=this.cells[h];if(v!==null)for(var b=this.keys,T=this.bboxes,E=0;E<v.length;E++){var I=v[E];if(_[I]===void 0){var P=4*I;(y?y(T[P+0],T[P+1],T[P+2],T[P+3]):i<=T[P+2]&&o<=T[P+3]&&a>=T[P+0]&&u>=T[P+1])?(_[I]=!0,f.push(b[I])):_[I]=!1}}},e.prototype._forEachCell=function(i,o,a,u,h,f,_,y){for(var v=this._convertToCellCoord(i),b=this._convertToCellCoord(o),T=this._convertToCellCoord(a),E=this._convertToCellCoord(u),I=v;I<=T;I++)for(var P=b;P<=E;P++){var L=this.d*P+I;if((!y||y(this._convertFromCellCoord(I),this._convertFromCellCoord(P),this._convertFromCellCoord(I+1),this._convertFromCellCoord(P+1)))&&h.call(this,i,o,a,u,L,f,_,y))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,o=r+this.cells.length+1+1,a=0,u=0;u<this.cells.length;u++)a+=this.cells[u].length;var h=new Int32Array(o+a+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;for(var f=o,_=0;_<i.length;_++){var y=i[_];h[r+_]=f,h.set(y,f),f+=y.length}return h[r+i.length]=f,h.set(this.keys,f),h[r+i.length+1]=f+=this.keys.length,h.set(this.bboxes,f),f+=this.bboxes.length,h.buffer},Vh})(),Xa=ea(Of);const ma={};function ot(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),ma[e]={klass:r,omit:i.omit||[]}}ot(Object,"Object"),Xa.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},Xa.deserialize=function(r){return new Xa(r.buffer)},Object.defineProperty(Xa,"name",{value:"Grid"}),ot(Xa,"Grid"),delete Oe.prototype.constructor,ot(yi,"Color"),ot(Error,"Error"),ot(mn,"Formatted"),ot(Mc,"FormattedSection"),ot(Ln,"AJAXError"),ot(_n,"ResolvedImage"),ot(ru,"StylePropertyFunction"),ot(iu,"StyleExpression",{omit:["_evaluator"]}),ot(fn,"ImageId"),ot(Xo,"ImageVariant"),ot(pa,"ZoomDependentExpression"),ot(Wa,"ZoomConstantExpression"),ot(gn,"CompoundExpression",{omit:["_evaluate"]});for(const r in Za)ma[Za[r]._classRegistryKey]||ot(Za[r],`Expression${r}`);function Gl(r){return r&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Qo(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(Gl(r)||r instanceof ImageBitmap)return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const i=[];for(const o of r)i.push(Qo(o,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[o,a]of r.entries())i.entries.push(Qo(o),Qo(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let o=0;for(const a of r.values())i[++o]=Qo(a);return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,o=i._classRegistryKey;if(!o)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(r,e):{};if(!i.serialize){for(const u in r)r.hasOwnProperty(u)&&(ma[o].omit.indexOf(u)>=0||(a[u]=Qo(r[u],e)));r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(a.$name=o),a}throw new Error("can't serialize object of type "+typeof r)}function ks(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||Gl(r)||r instanceof ImageBitmap||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(ks);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const a=r.entries||[],u=new Map;for(let h=0;h<a.length;h+=2)u.set(ks(a[h]),ks(a[h+1]));return u}if(e==="Set"){const a=new Set;for(const u of Object.keys(r))u!=="$name"&&a.add(ks(r[u]));return a}if(e==="BigInt")return BigInt(r.value);const{klass:i}=ma[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const o=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(o[a]=ks(r[a]));return o}throw new Error("can't deserialize object of type "+typeof r)}const yt={"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 Hl(r){for(const e of r)if(nu(e.charCodeAt(0)))return!0;return!1}function Uh(r){for(const e of r)if(!Ff(e.charCodeAt(0)))return!1;return!0}function Ff(r){return!(yt.Arabic(r)||yt["Arabic Supplement"](r)||yt["Arabic Extended-A"](r)||yt["Arabic Presentation Forms-A"](r)||yt["Arabic Presentation Forms-B"](r))}function nu(r){return!(r!==746&&r!==747&&(r<4352||!(yt["Bopomofo Extended"](r)||yt.Bopomofo(r)||yt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||yt["CJK Compatibility Ideographs"](r)||yt["CJK Compatibility"](r)||yt["CJK Radicals Supplement"](r)||yt["CJK Strokes"](r)||!(!yt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||yt["CJK Unified Ideographs Extension A"](r)||yt["CJK Unified Ideographs"](r)||yt["Enclosed CJK Letters and Months"](r)||yt["Hangul Compatibility Jamo"](r)||yt["Hangul Jamo Extended-A"](r)||yt["Hangul Jamo Extended-B"](r)||yt["Hangul Jamo"](r)||yt["Hangul Syllables"](r)||yt.Hiragana(r)||yt["Ideographic Description Characters"](r)||yt.Kanbun(r)||yt["Kangxi Radicals"](r)||yt["Katakana Phonetic Extensions"](r)||yt.Katakana(r)&&r!==12540||!(!yt["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)||!(!yt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||yt["Unified Canadian Aboriginal Syllabics"](r)||yt["Unified Canadian Aboriginal Syllabics Extended"](r)||yt["Vertical Forms"](r)||yt["Yijing Hexagram Symbols"](r)||yt["Yi Syllables"](r)||yt["Yi Radicals"](r))))}function ou(r){return!(nu(r)||(function(e){return!!(yt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||yt["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)||yt["Letterlike Symbols"](e)||yt["Number Forms"](e)||yt["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)||yt["Control Pictures"](e)&&e!==9251||yt["Optical Character Recognition"](e)||yt["Enclosed Alphanumerics"](e)||yt["Geometric Shapes"](e)||yt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||yt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||yt["CJK Symbols and Punctuation"](e)||yt.Katakana(e)||yt["Private Use Area"](e)||yt["CJK Compatibility Forms"](e)||yt["Small Form Variants"](e)||yt["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 su(r){return yt.Arabic(r)||yt["Arabic Supplement"](r)||yt["Arabic Extended-A"](r)||yt["Arabic Presentation Forms-A"](r)||yt["Arabic Presentation Forms-B"](r)}function jh(r){return r>=1424&&r<=2303||yt["Arabic Presentation Forms-A"](r)||yt["Arabic Presentation Forms-B"](r)}function es(r,e){return!(!e&&jh(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||yt.Khmer(r))}function wm(r){for(const e of r)if(jh(e.charCodeAt(0)))return!0;return!1}
1const On={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Gh=null,yn=On.unavailable,ts=null;const ql=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(yn=On.error),Gh&&Gh(r)};function au(){lu.fire(new Po("pluginStateChange",{pluginStatus:yn,pluginURL:ts}))}const lu=new la,$l=function(){return yn},kf=function(){if(yn!==On.deferred||!ts)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");yn=On.loading,au(),ts&&Wo({url:ts},(r=>{r?ql(r):(yn=On.loaded,au())}))},is={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>yn===On.loaded||is.applyArabicShaping!=null,isLoading:()=>yn===On.loading,setState(r){yn=r.pluginStatus,ts=r.pluginURL},isParsing:()=>yn===On.parsing,isParsed:()=>yn===On.parsed,getPluginURL:()=>ts};class Li{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview,this.activeFloors=i.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return(function(i,o){for(const a of i)if(!es(a.charCodeAt(0),o))return!1;return!0})(e,is.isLoaded())}}class cu{constructor(e,i,o,a,u){this.property=e,this.value=i,this.expression=(function(h,f,_,y,v){if(tu(h))return new ru(h,f);if(jl(h)||Array.isArray(h)&&h.length>0){const b=Nh(h,f,_,y,v);if(b.result==="error")throw new Error(b.value.map((T=>`${T.key}: ${T.message}`)).join(", "));return b.value}{let b=h;return typeof h=="string"&&f.type==="color"&&(b=yi.parse(h)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>b}}})(i===void 0?e.specification.default:i,e.specification,o,a,u)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,o,a){return this.property.possiblyEvaluate(this,e,i,o,a)}}class Hh{constructor(e,i,o,a){this.property=e,this.value=new cu(e,void 0,i,o,a)}transitioned(e,i){return new Nf(this.property,this.value,i,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new Nf(this.property,this.value,null,{},0)}}class Bf{constructor(e,i,o,a){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=o,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Me(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Hh(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new cu(this._values[e].property,i===null?void 0:Me(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,i){i&&(this._options=i);const o=this._properties.properties;if(e)for(const a in e){const u=e[a];if(a.endsWith("-transition")){const h=a.slice(0,-11);o[h]&&this.setTransition(h,u)}else o.hasOwnProperty(a)&&this.setValue(a,u)}}getTransition(e){return Me(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Hh(this._values[e].property)),this._values[e].transition=Me(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const o=new Vf(this._properties);for(const a of Object.keys(this._values))o._values[a]=this._values[a].transitioned(e,i._values[a]);return o}untransitioned(){const e=new Vf(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class Nf{constructor(e,i,o,a,u){const h=a.delay||0,f=a.duration||0;u=u||0,this.property=e,this.value=i,this.begin=u+h,this.end=this.begin+f,e.specification.transition&&(a.delay||a.duration)&&(this.prior=o)}possiblyEvaluate(e,i,o){const a=e.now||0,u=this.value.possiblyEvaluate(e,i,o),h=this.prior;if(h){if(a>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(a<this.begin)return h.possiblyEvaluate(e,i,o);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,o),u,ia(f))}}return u}}class Vf{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,o){const a=new ga(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,o);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Uf{constructor(e,i,o,a){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=o,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Me(this._values[e].value)}setValue(e,i){this._values[e]=new cu(this._values[e].property,i===null?void 0:Me(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndo
1orDependent())}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o)}return e}possiblyEvaluate(e,i,o,a){const u=new ga(this._properties);for(const h of Object.keys(this._values))u._values[h]=this._values[h].possiblyEvaluate(e,i,o,a);return u}isIndoorDependent(){return this._isIndoorDependent}}class _a{constructor(e,i,o,a){this.property=e,this.value=i,this.parameters=o,this.iconImageUseTheme=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,o,a){return this.property.evaluate(this.value,this.parameters,e,i,o,a,this.iconImageUseTheme)}}class ga{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class He{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,o){const a=Il[this.specification.type];return a?a(e,i,o):e}}class Xe{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,o,a,u){return e.expression.kind==="constant"||e.expression.kind==="camera"?new _a(this,{kind:"constant",value:e.expression.evaluate(i,null,{},o,a,void 0,u)},i):new _a(this,e.expression,i,u)}interpolate(e,i,o){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new _a(this,{kind:"constant",value:void 0},e.parameters);const a=Il[this.specification.type];return a?new _a(this,{kind:"constant",value:a(e.value.value,i.value.value,o)},e.parameters):e}evaluate(e,i,o,a,u,h,f){return e.kind==="constant"?e.value:e.evaluate(i,o,a,u,h,void 0,f)}}class ya{constructor(e){this.specification=e}possiblyEvaluate(e,i,o,a){return!!e.expression.evaluate(i,null,{},o,a)}interpolate(){return!1}}class sr{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Li(0,{});for(const o in e){const a=e[o];a.specification.overridable&&this.overridableProperties.push(o);const u=this.defaultPropertyValues[o]=new cu(a,void 0),h=this.defaultTransitionablePropertyValues[o]=new Hh(a);this.defaultTransitioningPropertyValues[o]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[o]=u.possiblyEvaluate(i)}}}ot(Xe,"DataDrivenProperty"),ot(He,"DataConstantProperty"),ot(ya,"ColorRampProperty");var fe=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"}}
1,"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}},"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}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"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-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
1ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default
1":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function jf(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function uu(r){if(Array.isArray(r))return r.map(uu);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=uu(r[i]);return e}return jf(r)}function Fo(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(!Fo(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function hu(r,e="",i=null,o="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Fo(r)||(r=du(r));const a=r;let u=!0;try{u=(function(v){if(!Ya(v))return v;let b=uu(v);return Gf(b),b=xa(b),b})(a)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(a,null,2)} 7 `)}let h=null,f=null;if(o!=="background"&&o!=="sky"&&o!=="slot"){f=fe[`filter_${o}`];const v=Fs(u,f,e,i);if(v.result==="error")throw new Error(v.value.map((b=>`${b.key}: ${b.message}`)).join(", "));h=(b,T,E)=>v.value.evaluate(b,T,{},E)}let _=null,y=null;if(u!==a){const v=Fs(a,f,e,i);if(v.result==="error")throw new Error(v.value.map((b=>`${b.key}: ${b.message}`)).join(", "));_=(b,T,E,I,P)=>v.value.evaluate(b,T,{},E,void 0,void 0,I,P),y=!Va(v.value.expression)}return{filter:h,dynamicFilter:_||void 0,needGeometry:Hf(u),needFeature:!!y}}function xa(r){if(!Array.isArray(r))return r;const e=(function(i){if(Tm.has(i[0])){for(let o=1;o<i.length;o++)if(Ya(i[o]))return!0}return i})(r);return e===!0?e:e.map((i=>xa(i)))}function Gf(r){let e=!1;const i=[];if(r[0]==="case"){for(let o=1;o<r.length-1;o+=2)e=e||Ya(r[o]),i.push(r[o+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||Ya(r[1]);for(let o=2;o<r.length-1;o+=2)i.push(r[o+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||Ya(r[1]);for(let o=1;o<r.length-1;o+=2)i.push(r[o+1])}e&&(r.length=0,r.push("any",...i));for(let o=1;o<r.length;o++)Gf(r[o])}function Ya(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
7for(let i=1;i<r.length;i++)if(Ya(r[i]))return!0;return!1}const Tm=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Sm(r,e){return r<e?-1:r>e?1:0}function Hf(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(Hf(r[e]))return!0;return!1}function du(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?fu(r[1],r[2],"=="):e==="!="?Zl(fu(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?fu(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(du))):e==="all"?["all"].concat(r.slice(1).map(du)):e==="none"?["all"].concat(r.slice(1).map(du).map(Zl)):e==="in"?pu(r[1],r.slice(2)):e==="!in"?Zl(pu(r[1],r.slice(2))):e==="has"?mu(r[1]):e!=="!has"||Zl(mu(r[1]));var i}function fu(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 pu(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(Sm)]]:["filter-in-small",r,["literal",e]]}}function mu(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Zl(r){return["!",r]}const va="�";function xo(r,e){return e?`${r}${va}${e}`:r}let qf;const $f=()=>qf||(qf=new sr({"icon-size":new Xe(fe.layout_symbol["icon-size"]),"icon-image":new Xe(fe.layout_symbol["icon-image"]),"icon-rotate":new Xe(fe.layout_symbol["icon-rotate"]),"icon-offset":new Xe(fe.layout_symbol["icon-offset"]),"text-size":new Xe(fe.layout_symbol["text-size"]),"text-rotate":new Xe(fe.layout_symbol["text-rotate"]),"text-offset":new Xe(fe.layout_symbol["text-offset"])}));class Zf{constructor(e,i,o,a,u,h){const f=Fs(e,fe.appearance.condition);if(f.result==="success"&&(this.condition=f.value),this.name=i,o){this.properties=new ga($f()),this.unevaluatedLayout=new Uf($f(),a,u,h);for(const _ in o)this.unevaluatedLayout.setValue(_,o[_])}}isActive(e){return!(this.condition||!e.isHidden||this.name!=="hidden")||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(e){return this.properties.get(e)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(e){return this.unevaluatedLayout._values[e]}recalculate(e,i,o){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,o))}serialize(){const e={};return e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name),this.unevaluatedLayout&&(e.properties=this.unevaluatedLayout.serialize()),e}hasIconProperties(){const e=this.hasProperty("icon-image"),i=this.hasProperty("icon-size"),o=this.hasProperty("icon-offset"),a=this.hasProperty("icon-rotate");return e||i||o||a}hasTextProperties(){const e=this.hasProperty("text-size"),i=this.hasProperty("text-offset"),o=this.hasProperty("text-rotate");return e||i||o}hasProperty(e){return this.getUnevaluatedProperty(e).value!==void 0}}const Wf="-transition",ko=new Set(["fill","line","background","hillshade","raster"]);class xn extends la{constructor(e,i,o,a,u,h){if(super(),this.id=e.id,this.fqid=xo(this.id,o),this.type=e.type,this.scope=o,this.lut=a,this.options=u,this.iconImageUseTheme=h,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const f=Fs(this.filter,fe[`filter_${e.type}`]);f.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...f.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||f.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new
7Uf(i.layout,this.scope,u,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),i.paint){this._transitionablePaint=new Bf(i.paint,this.scope,u);for(const f in e.paint)this.setPaintProperty(f,e.paint[f]);for(const f in e.layout)this.setLayoutProperty(f,e.layout[f]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ga(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&ko.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 o=this._unevaluatedLayout;o._properties.properties[e]&&(o.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...o.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||o.isIndoorDependent(),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach((i=>{this.appearances.push(new Zf(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))}))}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Wf)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){const o=this._transitionablePaint,a=o._properties.properties;if(e.endsWith(Wf)){const b=e.slice(0,-11);return a[b]&&o.setTransition(b,i||void 0),!1}if(!a[e])return!1;const u=o._values[e],h=u.value.isDataDriven(),f=u.value;o.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...o.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||o.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const _=o._values[e].value,y=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return y||h||v||this._handleOverridablePaintPropertyUpdate(e,f,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,o){return null}_handleOverridablePaintPropertyUpdate(e,i,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
vendor: 16,384 bytes, line 7
7serialize(){const e={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.appearances.length!==0&&(e.appearances=this.appearances.map((i=>i.serialize()))),Ne(e,((i,o)=>!(i===void 0||o==="layout"&&!Object.keys(i).length||o==="paint"&&!Object.keys(i).length)))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof _a&&Ul(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const e of this.appearances)if(!Ol(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=hu(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,i,o){return{}}queryRadius(e){}queryIntersectsFeature(e,i,o,a,u,h,f,_,y){}}const Xf={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Wl{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const Em=new ArrayBuffer(0);class Vi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,i){return e._trim(),i&&e.arrayBuffer&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,e.arrayBuffer?i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement:(i.capacity=0,i.arrayBuffer=Em),i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this._reallocCount++,this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function jt(r,e=1){let i=0,o=0;return{members:r.map((a=>{const u=Xf[a.type].BYTES_PER_ELEMENT,h=i=Yf(i,Math.max(e,u)),f=a.components||1;return o=Math.max(o,u),i+=u*f,{name:a.name,type:a.type,components:f,offset:h}})),size:Yf(i,Math.max(o,e)),alignment:e}}function Yf(r,e){return Math.ceil(r/e)*e}class Bs extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=o,e}}Bs.prototype.bytesPerElement=4,ot(Bs,"StructArrayLayout2i4");class Ka extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=o,this.int16[u+2]=a,e}}Ka.prototype.bytesPerElement=6,ot(Ka,"StructArrayLayout3i6");class Ja extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a)}emplace(e,i,o,a,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.int16[h+2]=a,this.int16[h+3]=u,e}}Ja.prototype.bytesPerElement=8,ot(Ja,"StructArrayLayout4i8");class rs extends Vi{_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}}rs.prototype.bytesPerElement=4,ot(rs,"StructArrayLayout1f4");class qh extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=4*e,h=2*e;return this.int16[u+0]=i,this.int16[u+1]=o,this.float32[h+1]=a,e}}qh.prototype.bytesPerElement=8,ot(qh,"StructArrayLayout2i1f8");class $h extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=o,this.int16[u+2]=a,e}}$h.prototype.bytesPerElement=8,ot($h,"StructArrayLayout3i8");class Zh extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a,u)}emplace(e,i,o,a,u,h){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=o,this.int16[f+2]=a,this.int16[f+3]=u,this.int16[f+4]=h,e}}Zh.prototype.bytesPerElement=10,ot(Zh,"StructArrayLayout5i10");class _u extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,u,h,f)}emplace(e,i,o,a,u,h,f,_){const y=6*e,v=12*e,b=3*e;return this.int16[y+0]=i,this.int16[y+1]=o,this.uint8[v+4]=a,this.uint8[v+5]=u,this.uint8[v+6]=h,this.uint8[v+7]=f,this.float32[b+2]=_,e}}_u.prototype.bytesPerElement=12,ot(_u,"StructArrayLayout2i4ub1f12");class jn extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=o,this.float32[u+2]=a,e}}jn.prototype.bytesPerElement=12,ot(jn,"StructArrayLayout3f12");class An extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a,u)}emplace(e,i,o,a,u,h){const f=6*e,_=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=o,this.uint16[f+2]=a,this.uint16[f+3]=u,this.float32[_+2]=h,e}}An.prototype.bytesPerElement=12,ot(An,"StructArrayLayout4ui1f12");class ba extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a)}emplace(e,i,o,a,u){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=o,this.uint16[h+2]=a,this.uint16[h+3]=u,e}}ba.prototype.bytesPerElement=8,ot(ba,"StructArrayLayout4ui8");class gu extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,u,h)}emplace(e,i,o,a,u,h,f){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=o,this.int16[_+2]=a,this.int16[_+3]=u,this.int16[_+4]=h,this.int16[_+5]=f,e}}gu.prototype.bytesPerElement=12,ot(gu,"StructArrayLayout6i12");class Wh extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h,f,_,y,v,b,T){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,o,a,u,h,f,_,y,v,b,T)}emplace(e,i,o,a,u,h,f,_,y,v,b,T,E){const I=12*e;return this.int16[I+0]=i,this.int16[I+1]=o,this.int16[I+2]=a,this.int16[I+3]=u,this.uint16[I+4]=h,this.uint16[I+5]=f,this.uint16[I+6]=_,this.uint16[I+7]=y,this.int16[I+8]=v,this.int16[I+9]=b,this.int16[I+10]=T,this.int16[I+11]=E,e}}Wh.prototype.bytesPerElement=24,ot(Wh,"StructArrayLayout4i4ui4i24");class Xh extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,u,h)}emplace(e,i,o,a,u,h,f){const _=10*e,y=5*e;return this.int16[_+0]=i,this.int16[_+1]=o,this.int16[_+2]=a,this.float32[y+2]=u,this.float32[y+3]=h,this.float32[y+4]=f,e}}Xh.prototype.bytesPerElement=20,ot(Xh,"StructArrayLayout3i3f20");class Ns extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a)}emplace(e,i,o,a,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=o,this.float32[h+2]=a,this.float32[h+3]=u,e}}Ns.prototype.bytesPerElement=16,ot(Ns,"StructArrayLayout4f16");class yu extends Vi{_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}}yu.prototype.bytesPerElement=4,ot(yu,"StructArrayLayout1ul4");class Gn extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=o,e}}Gn.prototype.bytesPerElement=4,ot(Gn,"StructArrayLayout2ui4");class xu extends Vi{_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,o,a,u,h,f,_,y,v,b,T,E){const I=this.length;return this.resize(I+1),this.emplace(I,e,i,o,a,u,h,f,_,y,v,b,T,E)}emplace(e,i,o,a,u,h,f,_,y,v,b,T,E,I){const P=20*e,L=10*e;return this.int16[P+0]=i,this.int16[P+1]=o,this.int16[P+2]=a,this.int16[P+3]=u,this.int16[P+4]=h,this.float32[L+3]=f,this.float32[L+4]=_,this.float32[L+5]=y,this.float32[L+6]=v,this.int16[P+14]=b,this.uint32[L+8]=T,this.uint16[P+18]=E,this.uint16[P+19]=I,e}}xu.prototype.bytesPerElement=40,ot(xu,"StructArrayLayout5i4f1i1ul2ui40");class vu extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,u,h,f)}emplace(e,i,o,a,u,h,f,_){const y=8*e;return this.int16[y+0]=i,this.int16[y+1]=o,this.int16[y+2]=a,this.int16[y+4]=u,this.int16[y+5]=h,this.int16[y+6]=f,this.int16[y+7]=_,e}}vu.prototype.bytesPerElement=16,ot(vu,"StructArrayLayout3i2i2i16");class bu extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a,u)}emplace(e,i,o,a,u,h){const f=4*e,_=8*e;return this.float32[f+0]=i,this.float32[f+1]=o,this.float32[f+2]=a,this.int16[_+6]=u,this.int16[_+7]=h,e}}bu.prototype.bytesPerElement=16,ot(bu,"StructArrayLayout2f1f2i16");class Yh extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,u,h)}emplace(e,i,o,a,u,h,f){const _=20*e,y=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=o,this.float32[y+1]=a,this.float32[y+2]=u,this.float32[y+3]=h,this.float32[y+4]=f,e}}Yh.prototype.bytesPerElement=20,ot(Yh,"StructArrayLayout2ub4f20");class Ar extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=o,this.uint16[u+2]=a,e}}Ar.prototype.bytesPerElement=6,ot(Ar,"StructArrayLayout3ui6");class Qa extends Vi{_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,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B,V,G,K){const Z=this.length;return this.resize(Z+1),this.emplace(Z,e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B,V,G,K)}emplace(e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B,V,G,K,Z){const ee=30*e,ne=15*e,ae=60*e;return this.int16[ee+0]=i,this.int16[ee+1]=o,this.int16[ee+2]=a,this.float32[ne+2]=u,this.float32[ne+3]=h,this.uint16[ee+8]=f,this.uint16[ee+9]=_,this.uint32[ne+5]=y,this.uint32[ne+6]=v,this.uint32[ne+7]=b,this.uint16[ee+16]=T,this.uint16[ee+17]=E,this.uint16[ee+18]=I,this.float32[ne+10]=P,this.float32[ne+11]=L,this.uint8[ae+48]=D,this.uint8[ae+49]=B,this.uint8[ae+50]=V,this.uint32[ne+13]=G,this.int16[ee+28]=K,this.uint8[ae+58]=Z,e}}Qa.prototype.bytesPerElement=60,ot(Qa,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Kh extends Vi{_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,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B,V,G,K,Z,ee,ne,ae,be,he,Ee,Ce,Pe,Fe,Be,ze){const De=this.length;return this.resize(De+1),this.emplace(De,e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B,V,G,K,Z,ee,ne,ae,be,he,Ee,Ce,Pe,Fe,Be,ze)}emplace(e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B,V,G,K,Z,ee,ne,ae,be,he,Ee,Ce,Pe,Fe,Be,ze,De){const Se=20*e,we=40*e,Le=80*e;return this.float32[Se+0]=i,this.float32[Se+1]=o,this.int16[we+4]=a,this.int16[we+5]=u,this.int16[we+6]=h,this.int16[we+7]=f,this.int16[we+8]=_,this.int16[we+9]=y,this.int16[we+10]=v,this.int16[we+11]=b,this.int16[we+12]=T,this.uint16[we+13]=E,this.uint16[we+14]=I,this.uint16[we+15]=P,this.uint16[we+16]=L,this.uint16[we+17]=D,this.uint16[we+18]=B,this.uint16[we+19]=V,this.uint16[we+20]=G,this.uint16[we+21]=K,this.uint16[we+22]=Z,this.uint16[we+23]=ee,this.uint16[we+24]=ne,this.uint16[we+25]=ae,this.uint16[we+26]=be,this.uint16[we+27]=he,this.uint32[Se+14]=Ee,this.float32[Se+15]=Ce,this.float32[Se+16]=Pe,this.float32[Se+17]=Fe,this.float32[Se+18]=Be,this.uint8[Le+76]=ze,this.uint16[we+39]=De,e}}Kh.prototype.bytesPerElement=80,ot(Kh,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Jh extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,u,h)}emplace(e,i,o,a,u,h,f){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=o,this.float32[_+2]=a,this.float32[_+3]=u,this.float32[_+4]=h,this.float32[_+5]=f,e}}Jh.prototype.bytesPerElement=24,ot(Jh,"StructArrayLayout6f24");class wa extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,
vendor: 11,042 bytes, line 7
7o,a,u)}emplace(e,i,o,a,u,h){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=o,this.float32[f+2]=a,this.float32[f+3]=u,this.float32[f+4]=h,e}}wa.prototype.bytesPerElement=20,ot(wa,"StructArrayLayout5f20");class Qh extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,u,h,f)}emplace(e,i,o,a,u,h,f,_){const y=7*e;return this.float32[y+0]=i,this.float32[y+1]=o,this.float32[y+2]=a,this.float32[y+3]=u,this.float32[y+4]=h,this.float32[y+5]=f,this.float32[y+6]=_,e}}Qh.prototype.bytesPerElement=28,ot(Qh,"StructArrayLayout7f28");class ed extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h,f,_,y,v,b){const T=this.length;return this.resize(T+1),this.emplace(T,e,i,o,a,u,h,f,_,y,v,b)}emplace(e,i,o,a,u,h,f,_,y,v,b,T){const E=11*e;return this.float32[E+0]=i,this.float32[E+1]=o,this.float32[E+2]=a,this.float32[E+3]=u,this.float32[E+4]=h,this.float32[E+5]=f,this.float32[E+6]=_,this.float32[E+7]=y,this.float32[E+8]=v,this.float32[E+9]=b,this.float32[E+10]=T,e}}ed.prototype.bytesPerElement=44,ot(ed,"StructArrayLayout11f44");class el extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h,f,_,y){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,o,a,u,h,f,_,y)}emplace(e,i,o,a,u,h,f,_,y,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=o,this.float32[b+2]=a,this.float32[b+3]=u,this.float32[b+4]=h,this.float32[b+5]=f,this.float32[b+6]=_,this.float32[b+7]=y,this.float32[b+8]=v,e}}el.prototype.bytesPerElement=36,ot(el,"StructArrayLayout9f36");class Bo extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=o,e}}Bo.prototype.bytesPerElement=8,ot(Bo,"StructArrayLayout2f8");class Mn extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a)}emplace(e,i,o,a,u){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=o,this.uint16[h+3]=a,this.uint16[h+4]=u,e}}Mn.prototype.bytesPerElement=12,ot(Mn,"StructArrayLayout1ul3ui12");class Vs extends Vi{_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}}Vs.prototype.bytesPerElement=2,ot(Vs,"StructArrayLayout1ui2");class td extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L)}emplace(e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D){const B=16*e;return this.float32[B+0]=i,this.float32[B+1]=o,this.float32[B+2]=a,this.float32[B+3]=u,this.float32[B+4]=h,this.float32[B+5]=f,this.float32[B+6]=_,this.float32[B+7]=y,this.float32[B+8]=v,this.float32[B+9]=b,this.float32[B+10]=T,this.float32[B+11]=E,this.float32[B+12]=I,this.float32[B+13]=P,this.float32[B+14]=L,this.float32[B+15]=D,e}}td.prototype.bytesPerElement=64,ot(td,"StructArrayLayout16f64");class wu extends Vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,u,h,f)}emplace(e,i,o,a,u,h,f,_){const y=10*e,v=5*e;return this.uint16[y+0]=i,this.uint16[y+1]=o,this.uint16[y+2]=a,this.uint16[y+3]=u,this.float32[v+2]=h,this.float32[v+3]=f,this.float32[v+4]=_,e}}wu.prototype.bytesPerElement=20,ot(wu,"StructArrayLayout4ui3f20");class id extends Vi{_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}}id.prototype.bytesPerElement=2,ot(id,"StructArrayLayout1i2");class Tu extends Vi{_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}}Tu.prototype.bytesPerElement=1,ot(Tu,"StructArrayLayout1ub1");class Su extends Wl{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]}}Su.prototype.size=40;class Kf extends xu{get(e){return new Su(this,e)}}ot(Kf,"CollisionBoxArray");class Eu extends Wl{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}}Eu.prototype.size=60;class Jf extends Qa{get(e){return new Eu(this,e)}}ot(Jf,"PlacedSymbolArray");class Qf extends Wl{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]}}Qf.prototype.size=80;class rd extends Kh{get(e){return new Qf(this,e)}}ot(rd,"SymbolInstanceArray");class Iu extends rs{getoffsetX(e){return this.float32[1*e+0]}}ot(Iu,"GlyphOffsetArray");class ep extends Bs{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}ot(ep,"SymbolLineVertexArray");class nd extends Wl{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]}}nd.prototype.size=12;class od extends Mn{get(e){return new nd(this,e)}}ot(od,"FeatureIndexArray");class tp extends Gn{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}ot(tp,"FillExtrusionCentroidArray");class Au extends Wl{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]}}Au.prototype.size=6;
7class Xl extends Ka{get(e){return new Au(this,e)}}ot(Xl,"FillExtrusionWallArray");const ip=jt([{name:"a_pos",components:2,type:"Int16"}],4),Im=jt([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),rp=jt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Wi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,o,a){let u=this.segments[this.segments.length-1];return e>Wi.MAX_VERTEX_ARRAY_LENGTH&&tt(`Max vertices per segment is ${Wi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Wi.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==a)&&(u={vertexOffset:i,primitiveOffset:o,vertexLength:0,primitiveLength:0},a!==void 0&&(u.sortKey=a),this.segments.push(u)),u}prepareSegment(e,i,o,a){return this._prepareSegment(e,i.length,o.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,o,a){return new Wi([{vertexOffset:e,primitiveOffset:i,vertexLength:o,primitiveLength:a,vaos:{},sortKey:0}])}}function Mu(r,e){return 256*(r=O(Math.floor(r),0,255))+O(Math.floor(e),0,255)}Wi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ot(Wi,"SegmentVector");const Am=jt([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Mm=jt([{name:"a_pattern_b",components:4,type:"Uint16"}]),Cm=jt([{name:"a_dash",components:4,type:"Uint16"}]);class Yl{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,o,a){this.ids.push(sd(e)),this.positions.push(i,o,a)}eachPosition(e,i){const o=sd(e);let a=0,u=this.ids.length-1;for(;a<u;){const h=a+u>>1;this.ids[h]>=o?u=h:a=h+1}for(;this.ids[a]===o;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const o=new Float64Array(e.ids),a=new Uint32Array(e.positions);return ad(o,a,0,o.length-1),i&&(i.add(o.buffer),i.add(a.buffer)),{ids:o,positions:a}}static deserialize(e){const i=new Yl;let o;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==o&&i.uniqueIds.push(a),o=a;return i.indexed=!0,i}}function sd(r){const e=+r;return Number.isSafeInteger(e)?e:Sc(String(r))}function ad(r,e,i,o){for(;i<o;){const a=r[i+o>>1];let u=i-1,h=o+1;for(;;){do u++;while(r[u]<a);do h--;while(r[h]>a);if(u>=h)break;Cu(r,u,h),Cu(e,3*u,3*h),Cu(e,3*u+1,3*h+1),Cu(e,3*u+2,3*h+2)}h-i<o-h?(ad(r,e,i,h),i=h+1):(ad(r,e,h+1,o),o=h)}}function Cu(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}ot(Yl,"FeaturePositionMap");class ns{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,o){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Pu extends ns{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}}class Mr extends ns{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))}}class No extends ns{constructor(e){super(e),this.current=[0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}}class Kl extends ns{constructor(e){super(e),this.current=[0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}}class Ru extends ns{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3])))}}class Jl extends ns{constructor(e){super(e),this.current=yi.transparent.toPremultipliedRenderColor(null)}set(e,i,o){this.fetchUniformLocation(e,i)&&(o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a)))}}const Pm=new Float32Array(16);class Ql extends ns{constructor(e){super(e),this.current=Pm}set(e,i,o){if(this.fetchUniformLocation(e,i)){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(let a=1;a<16;a++)if(o[a]!==this.current[a]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}}}}const zu=new Float32Array(9),Rm=new Float32Array(4);class Du extends ns{constructor(e){super(e),this.current=Rm}set(e,i,o){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(o[a]!==this.current[a]){this.current=o,this.gl.uniformMatrix2fv(this.location,!1,o);break}}}}function ld(r){return[Mu(255*r.r,255*r.g),Mu(255*r.b,255*r.a)]}function ec(r,e,i,o,a,u,h,f){return!!r&&(r.kind==="composite"||r.kind==="source"?r.evaluate(new Li(0,{brightness:u,worldview:f}),e,i,a,o,h)==="none":r.value==="none")}class tc{constructor(e,i,o,a){this.value=e,this.uniformNames=i.map((u=>`u_${u}`)),this.type=o,this.context=a}setUniform(e,i,o,a,u){const h=a.constantOr(this.value);i.set(e,u,h instanceof yi?h.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new Jl(e):new Mr(e)}}class tl{constructor(e,i){this.uniformNames=i.map((o=>`u_${o}`)),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,o,a,u){let h=null;u!=="u_pattern"&&u!=="u_dash"||(h=this.pattern),u==="u_pattern_b"&&(h=this.patternTransition),u==="u_pixel_ratio"&&(h=this.pixelRatio),h&&i.set(e,u,h)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new Ru(e):new Mr(e)}}class os{constructor(e,i,o,a){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=i.map((u=>({name:`a_${u}`,type:"Float32",components:o==="color"?2:1,offset:0}))),this.paintVertexArray=new a}populatePaintArray(e,i,o,a,u,h,f,_){const y=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Li(0,{brightness:h,worldview:_}),i,{},u,a,f):this.expression.kind==="constant"&&this.expression.value,b=ec(this.lutExpression,i,{},a,u,h,f,_);this.paintVertexArray.resize(e),this._setPaintValue(y,e,v,b?null:this.context.lut)}updatePaintArray(e,i,o,a,u,h,f,_){const y=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:_},o,a,void 0,u):this.expression.kind==="constant"&&this.expression.value,v=ec(this.lutExpression,o,a,u,void 0,f,void 0,_);this._setPaintValue(e,i,y,v?null:this.context.lut)}
7_setPaintValue(e,i,o,a){if(this.type==="color"){const u=ld(o.toPremultipliedRenderColor(a));for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,u[0],u[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}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 ss{constructor(e,i,o,a,u,h){this.expression=e,this.uniformNames=i.map((f=>`u_${f}_t`)),this.type=o,this.useIntegerZoom=a,this.context=u,this.maxValue=0,this.paintVertexAttributes=i.map((f=>({name:`a_${f}`,type:"Float32",components:o==="color"?4:2,offset:0}))),this.paintVertexArray=new h}populatePaintArray(e,i,o,a,u,h,f,_){const y=this.expression.evaluate(new Li(this.context.zoom,{brightness:h,worldview:_}),i,{},u,a,f),v=this.expression.evaluate(new Li(this.context.zoom+1,{brightness:h,worldview:_}),i,{},u,a,f),b=ec(this.lutExpression,i,{},a,u,h,f,_),T=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(T,e,y,v,b?null:this.context.lut)}updatePaintArray(e,i,o,a,u,h,f,_){const y=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:_},o,a,void 0,u),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:_},o,a,void 0,u),b=ec(this.lutExpression,o,a,u,void 0,f,void 0,_);this._setPaintValue(e,i,y,v,b?null:this.context.lut)}_setPaintValue(e,i,o,a,u){if(this.type==="color"){const h=ld(o.toPremultipliedRenderColor(u)),f=ld(o.toPremultipliedRenderColor(u));for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,h[0],h[1],f[0],f[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,o,a);this.maxValue=Math.max(this.maxValue,Math.abs(o),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,o,a,u){const h=this.useIntegerZoom?Math.floor(o.zoom):o.zoom,f=O(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,u,f)}getBinding(e,i){return new Mr(e)}}class as{constructor(e,i,o,a,u){this.expression=e,this.layerId=u,this.paintVertexAttributes=(o==="array"?Cm:Am).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a,this.paintTransitionVertexArray=new ba}populatePaintArray(e,i,o,a){const u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(u,e,i.patterns&&i.patterns[this.layerId],o)}updatePaintArray(e,i,o,a,u,h,f){this._setPaintValues(e,i,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,i,o,a){if(!a||!o)return;const u=a[o[0]],h=a[o[1]];if(u){if(u){const{tl:f,br:_,pixelRatio:y}=u;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,f[0],f[1],_[0],_[1],y)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:_}=h;for(let y=e;y<i;y++)this.paintTransitionVertexArray.emplace(y,f[0],f[1],_[0],_[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Mm.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Us{constructor(e,i,o=(()=>!0)){this.binders={},this._buffers=[],this.context=i;const a=[];for(const u in e.paint._values){const h=e.paint.get(u);if(u.endsWith("-use-theme")||!o(u)||!(h instanceof _a&&Ul(h.property.specification)))continue;const f=Dm(u,e.type),_=h.value,y=h.property.specification.type,v=!!h.property.useIntegerZoom,b=u==="line-dasharray"||u.endsWith("pattern"),T=e.paint.get(`${u}-use-theme`),E=u==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||T&&T.value.kind!=="constant";if(_.kind!=="constant"||E)if(_.kind==="source"||E||b){const I=cd(u,y,"source");this.binders[u]=b?new as(_,f,y,I,e.id):new os(_,f,y,I),a.push(`/a_${u}`)}else{const I=cd(u,y,"composite");this.binders[u]=new ss(_,f,y,v,i,I),a.push(`/z_${u}`)}else this.binders[u]=b?new tl(_.value,f):new tc(_.value,f,y,i),a.push(`/u_${u}`);T&&(this.binders[u].lutExpression=T.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof os||i instanceof ss?i.maxValue:0}populatePaintArrays(e,i,o,a,u,h,f,_){for(const y in this.binders){const v=this.binders[y];v.context=this.context,(v instanceof os||v instanceof ss||v instanceof as)&&v.populatePaintArray(e,i,o,a,u,h,f,_)}}setConstantPatternPositions(e,i){for(const o in this.binders){const a=this.binders[o];a instanceof tl&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof as?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,o,a,u,h,f,_,y,v){let b=!1;const T=Object.keys(e),E=T.length!==0&&!_,I=E?T:i.uniqueIds;this.context.lut=u.lut;for(const P in this.binders){const L=this.binders[P];if(L.context=this.context,(L instanceof os||L instanceof ss||L instanceof as)&&L.expression&&L.expression.kind&&L.expression.kind!=="constant"&&(L.expression.isStateDependent===!0||L.expression.isLightConstant===!1)){const D=u.paint.get(P);L.expression=D.value;for(const B of I){const V=e[B.toString()];i.eachPosition(B,((G,K,Z)=>{const ee=a.feature(G);L.updatePaintArray(K,Z,ee,V,h,f,y,v)}))}if(!E)for(const B of o.uniqueIds){const V=e[B.toString()];o.eachPosition(B,((G,K,Z)=>{const ee=a.feature(G);L.updatePaintArray(K,Z,ee,V,h,f,y,v)}))}b=!0}}return b}
vendor: 4,501 bytes, line 7
7defines(){const e=[];for(const i in this.binders){const o=this.binders[i];(o instanceof tc||o instanceof tl)&&e.push(...o.uniformNames.map((a=>`#define HAS_UNIFORM_${a}`)))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const o in this.binders){const a=this.binders[o];if(a instanceof tc||a instanceof tl||a instanceof ss)for(const u of a.uniformNames)i.push({name:u,property:o,binding:a.getBinding(e,u)})}return i}setUniforms(e,i,o,a,u){for(const{name:h,property:f,binding:_}of o)this.binders[f].setUniform(e,_,u,a.get(f),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof os||i instanceof ss||i instanceof as)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof as&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const o=this.binders[i];(o instanceof os||o instanceof ss||o instanceof as)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof os||i instanceof ss||i instanceof as)&&i.destroy()}}}class vo{constructor(e,i,o=(()=>!0)){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Us(a,i,o);this.needsUpload=!1,this._featureMap=new Yl,this._featureMapWithoutIds=new Yl,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,o,a,u,h,f,_,y){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,u,h,f,_,y);i.id!==void 0?this._featureMap.add(i.id,o,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,o,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,o,a,u,h,f,_){for(const y of o)this.needsUpload=this.programConfigurations[y.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,y,a,u,h,f||0,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const zm={"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 Dm(r,e){return zm[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const Lm={"line-pattern":{source:An,composite:An},"fill-pattern":{source:An,composite:An},"fill-extrusion-pattern":{source:An,composite:An},"line-dasharray":{source:ba,composite:ba}},Om={color:{source:Bo,composite:Ns},number:{source:rs,composite:Bo}};function cd(r,e,i){const o=Lm[r];return o&&o[i]||Om[e][i]}ot(tc,"ConstantBinder"),ot(tl,"PatternConstantBinder"),ot(os,"SourceExpressionBinder"),ot(as,"PatternCompositeBinder"),ot(ss,"CompositeExpressionBinder"),ot(Us,"ProgramConfiguration",{omit:["_buffers"]}),ot(vo,"ProgramConfigurationSet");const on=$e/Math.PI/2,to=5,Lu=6,Fm=16383,il=64,ud=[il,32,16],io=-on,ro=on;function Ta(r,e,i,o=on){return i=oi(i),[r*Math.sin(i)*o,-e*o,r*Math.cos(i)*o]}function rl(r,e,i){return Ta(Math.cos(oi(r)),Math.sin(oi(r)),e,i)}const l=63710088e-1,t=2*Math.PI*l;class n{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 n(q(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,o=this.lat*i,a=e.lat*i,u=Math.sin(o)*Math.sin(a)+Math.cos(o)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return l*Math.acos(Math.min(u,1))}
7toBounds(e=0){const i=360*e/40075017,o=i/Math.cos(Math.PI/180*this.lat);return new c({lng:this.lng-o,lat:this.lat-i},{lng:this.lng+o,lat:this.lat+i})}toEcef(e){return rl(this.lat,this.lng,on+e*on/l)}static convert(e){if(e instanceof n)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new n(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new n(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 c{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof n?new n(e.lng,e.lat):n.convert(e),this}setSouthWest(e){return this._sw=e instanceof n?new n(e.lng,e.lat):n.convert(e),this}extend(e){const i=this._sw,o=this._ne;let a,u;if(e instanceof n)a=e,u=e;else{if(!(e instanceof c))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(c.convert(e)):this.extend(n.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(n.convert(e)):this;if(a=e._sw,u=e._ne,!a||!u)return this}return i||o?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),o.lng=Math.max(u.lng,o.lng),o.lat=Math.max(u.lat,o.lat)):(this._sw=new n(a.lng,a.lat),this._ne=new n(u.lng,u.lat)),this}getCenter(){return new n((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 n(this.getWest(),this.getNorth())}getSouthEast(){return new n(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:o}=n.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<=o&&o<=this._ne.lat&&a}static convert(e){if(e)return e instanceof c?e:new c(e)}}const d=0,p=25.5;function m(r){return t*Math.cos(r*Math.PI/180)}function g(r){return(180+r)/360}function x(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function w(r,e){return r/m(e)}function S(r){return 360*r-180}function M(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function A(r,e){return r*m(M(e))}const C=85.051129;function z(r){return Math.cos(oi(O(r,-C,C)))}function R(r,e){const i=O(e,d,p),o=Math.pow(2,i);return z(r)*t/(512*o)}function k(r){return 1/Math.cos(r*Math.PI/180)}function F(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/$e)/(1<<r.z)*2));return 80150034*i/(i*i+1)/$e/(1<<r.z)}class U{constructor(e,i,o=0){this.x=+e,this.y=+i,this.z=+o}static fromLngLat(e,i=0){const o=n.convert(e);return new U(g(o.lng),x(o.lat),w(i,o.lat))}toLngLat(){return new n(S(this.x),M(this.y))}toAltitude(){return A(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/t*k(M(this.y))}}function H(r,e,i,o,a,u,h,f,_){const y=(e+o)/2,v=(i+a)/2,b=new Oe(y,v);f(b),(function(T,E,I,P,L,D){const B=I-L,V=P-D;return Math.abs((P-E)*B-(I-T)*V)/Math.hypot(B,V)})(b.x,b.y,u.x,u.y,h.x,h.y)>=_?(H(r,e,i,y,v,u,b,f,_),H(r,y,v,o,a,b,h,f,_)):r.push(h)}function j(r,e,i){let o=r[0],a=o.x,u=o.y;e(o);const h=[o];for(let f=1;f<r.length;f++){const _=r[f],{x:y,y:v}=_;e(_),H(h,a,u,y,v,o,_,e,i),a=y,u=v,o=_}return h}function te(r,e,i,o){if(o(e,i)){const a=e.add(i)._mult(.5);te(r,e,a,o),te(r,a,i,o)}else r.push(i)}function Y(r,e){let i=r[0];const o=[i];for(let a=1;a<r.length;a++){const u=r[a];te(o,i,u,e),i=u}return o}const Q=Math.pow(2,14)-1,X=-Q-1;function $(r,e){const i=Math.round(r.x*e),o=Math.round(r.y*e);return r.x=O(i,X,Q),r.y=O(o,X,Q),(i<r.x||i>r.x+1||o<r.y||o>r.y+1)&&tt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function ie(r,e,i){const o=r.loadGeometry(),a=r.extent,u=$e/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:f,x:_,y,projection:v}=i,b=T=>{const E=S((e.x+T.x/a)/h),I=M((e.y+T.y/a)/h),P=v.project(E,I);T.x=(P.x*f-_)*a,T.y=(P.y*f-y)*a};for(let T=0;T<o.length;T++)if(r.type!==1)o[T]=j(o[T],b,1);else{const E=[];for(const I of o[T])I.x<0||I.x>=a||I.y<0||I.y>=a||(b(I),E.push(I));o[T]=E}}for(const h of o)for(const f of h)$(f,u);return o}function ue(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?ie(r):[]}}class le{constructor(e,i,o,a,u){this.properties={},this.extent=o,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=u,e.readFields(xe,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,o=[];let a,u=1,h=0,f=0,_=0;for(;e.pos<i;){if(h<=0){const y=e.readVarint();u=7&y,h=y>>3}if(h--,u===1||u===2)f+=e.readSVarint(),_+=e.readSVarint(),u===1&&(a&&o.push(a),a=[]),a&&a.push(new Oe(f,_));else{if(u!==7)throw new Error(`unknown command ${u}`);a&&a.push(a[0].clone())}}return a&&o.push(a),o}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let o=1,a=0,u=0,h=0,f=1/0,_=-1/0,y=1/0,v=-1/0;for(;e.pos<i;){if(a<=0){const b=e.readVarint();o=7&b,a=b>>3}if(a--,o===1||o===2)u+=e.readSVarint(),h+=e.readSVarint(),u<f&&(f=u),u>_&&(_=u),h<y&&(y=h),h>v&&(v=h);else if(o!==7)throw new Error(`unknown command ${o}`)}return[f,y,_,v]}toGeoJSON(e,i,o){const a=this.extent*Math.pow(2,o),u=this.extent*e,h=this.extent*i,f=this.loadGeometry();function _(T){return[360*(T.x+u)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(T.y+h)/a)*Math.PI))-90]}function y(T){return T.map(_)}let v;
7if(this.type===1){const T=[];for(const I of f)T.push(I[0]);const E=y(T);v=T.length===1?{type:"Point",coordinates:E[0]}:{type:"MultiPoint",coordinates:E}}else if(this.type===2){const T=f.map(y);v=T.length===1?{type:"LineString",coordinates:T[0]}:{type:"MultiLineString",coordinates:T}}else{if(this.type!==3)throw new Error("unknown feature type");{const T=(function(I){const P=I.length;if(P<=1)return[I];const L=[];let D,B;for(let V=0;V<P;V++){const G=ve(I[V]);G!==0&&(B===void 0&&(B=G<0),B===G<0?(D&&L.push(D),D=[I[V]]):D&&D.push(I[V]))}return D&&L.push(D),L})(f),E=[];for(const I of T)E.push(I.map(y));v=E.length===1?{type:"Polygon",coordinates:E[0]}:{type:"MultiPolygon",coordinates:E}}}const b={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function xe(r,e,i){r===1?e.id=i.readVarint():r===2?(function(o,a){const u=o.readVarint()+o.pos;for(;o.pos<u;){const h=a._keys[o.readVarint()],f=a._values[o.readVarint()];a.properties[h]=f}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function ve(r){let e=0;for(let i,o,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],o=r[h],e+=(o.x-i.x)*(i.y+o.y);return e}le.types=["Unknown","Point","LineString","Polygon"];class Ae{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(Ve,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 le(this._pbf,i,this.extent,this._keys,this._values)}}function Ve(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(o){let a=null;const u=o.readVarint()+o.pos;for(;o.pos<u;){const h=o.readVarint()>>3;a=h===1?o.readString():h===2?o.readFloat():h===3?o.readDouble():h===4?o.readVarint64():h===5?o.readVarint():h===6?o.readSVarint():h===7?o.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a})(i))}class me{constructor(e,i){this.layers=e.readFields(se,{},i)}}function se(r,e,i){if(r===3){const o=new Ae(i,i.readVarint()+i.pos);o.length&&(e[o.name]=o)}}const Te="3d_elevation_id",_e="level";class Re{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,o){return this.get(e,!0,i,o)}optional(e,i,o){return this.get(e,!1,i,o)}success(){return this._valid}get(e,i,o,a){const u=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&u!==void 0&&!Number.isNaN(u)?o(a?a(u):u):i&&(this._valid=!1),this}}class We{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,o){return this.featureFunc(e,i,o)}parseVertex(e,i,o){return this.vertexFunc(e,i,o)}}const et=new We(((r,e,i)=>r.reset(e).require(Te,(o=>{i.id=o})).optional("fixed_height_relative",(o=>{i.constantHeight=o}),Ue.decodeRelativeHeight).geometry((o=>{i.bounds=o}),Ko).success()),((r,e,i)=>r.reset(e).require(Te,(o=>{i.id=o})).require("elevation_idx",(o=>{i.idx=o})).require("extent",(o=>{i.extent=o})).require("height_relative",(o=>{i.height=o}),Ue.decodeRelativeHeight).geometry((o=>{i.position=o}),Ue.getPoint).success())),qe=new We(((r,e,i)=>r.reset(e).require(Te,(o=>{i.id=o})).optional("fixed_height",(o=>{i.constantHeight=o}),Ue.decodeMetricHeight).geometry((o=>{i.bounds=o}),Ko).success()),((r,e,i)=>r.reset(e).require(Te,(o=>{i.id=o})).require("elevation_idx",(o=>{i.idx=o})).require("extent",(o=>{i.extent=o})).require("height",(o=>{i.height=o}),Ue.decodeMetricHeight).geometry((o=>{i.position=o}),Ue.getPoint).success()));class Ue{static getPoint(e){return Tn(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?e==="1.0.1"?qe:void 0:et}static parse(e){const i=[],o=[],a=e.length,u=new Re;for(let h=0;h<a;h++){const f=e.feature(h),_=f.properties.version,y=Ue.getVersionSchema(_);if(y===void 0){tt(`Unknown elevation feature version number ${_||"(unknown)"}`);continue}const v=f.properties.type;if(!v)continue;const b=le.types[f.type];if(b==="Point"&&v==="curve_point"){const T={};y.parseVertex(u,f,T)&&i.push(T)}else if(b==="Polygon"&&v==="curve_meta"){const T={};y.parseFeature(u,f,T)&&o.push(T)}}return{vertices:i,features:o}}}class ct{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=Qs(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return o[0]=this.pos[0]+this.dir[0]*u,o[1]=this.pos[1]+this.dir[1]*u,!0}}class st{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=fr(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return o[0]=this.pos[0]+this.dir[0]*u,o[1]=this.pos[1]+this.dir[1]*u,o[2]=this.pos[2]+this.dir[2]*u,!0}closestPointOnSphere(e,i,o){if((function(E,I){var P=E[0],L=E[1],D=E[2],B=I[0],V=I[1],G=I[2];return Math.abs(P-B)<=Wr*Math.max(1,Math.abs(P),Math.abs(B))&&Math.abs(L-V)<=Wr*Math.max(1,Math.abs(L),Math.abs(V))&&Math.abs(D-G)<=Wr*Math.max(1,Math.abs(D),Math.abs(G))})(this.pos,e)||i===0)return o[0]=o[1]=o[2]=0,!1;const[a,u,h]=this.dir,f=this.pos[0]-e[0],_=this.pos[1]-e[1],y=this.pos[2]-e[2],v=a*
7a+u*u+h*h,b=2*(f*a+_*u+y*h),T=b*b-4*v*(f*f+_*_+y*y-i*i);if(T<0){const E=Math.max(-b/2,0),I=f+a*E,P=_+u*E,L=y+h*E,D=Math.hypot(I,P,L);return o[0]=I*i/D,o[1]=P*i/D,o[2]=L*i/D,!1}{const E=(-b-Math.sqrt(T))/(2*v);if(E<0){const I=Math.hypot(f,_,y);return o[0]=f*i/I,o[1]=_*i/I,o[2]=y*i/I,!1}return o[0]=f+a*E,o[1]=_+u*E,o[2]=y+h*E,!0}}}class Je{constructor(e,i,o,a,u){this.TL=e,this.TR=i,this.BR=o,this.BL=a,this.horizon=u}static fromInvProjectionMatrix(e,i,o){const a=[-1,1,1],u=[1,1,1],h=[1,-1,1],f=[-1,-1,1],_=gr(a,a,e),y=gr(u,u,e),v=gr(h,h,e),b=gr(f,f,e);return new Je(_,y,v,b,i/o)}}function it(r,e,i){let o=1/0,a=-1/0;const u=[];for(const h of r){xr(u,h,e);const f=fr(u,i);o=Math.min(o,f),a=Math.max(a,f)}return[o,a]}function gt(r,e){let i=!0;for(let o=0;o<r.planes.length;o++){const a=r.planes[o];let u=0;for(let h=0;h<e.length;h++)u+=+(fr(a,e[h])+a[3]>=0);if(u===0)return 0;u!==e.length&&(i=!1)}return i?2:1}function Mt(r,e){for(const i of r.projections){const o=it(e,r.points[0],i.axis);if(i.projection[1]<o[0]||i.projection[0]>o[1])return 0}return 1}function $t(r,e){let i=0;const o=[0,0,0,0];for(let h=0;h<r.length;h++)o[0]=r[h][0],o[1]=r[h][1],o[2]=r[h][2],o[3]=1,(a=o)[0]*(u=e)[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3]>=0&&i++;var a,u;return i}class ci{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=ut.fromPoints(this.points),this.projections=[],this.frustumEdges=[xr([],this.points[2],this.points[3]),xr([],this.points[0],this.points[3]),xr([],this.points[4],this.points[0]),xr([],this.points[5],this.points[1]),xr([],this.points[6],this.points[2]),xr([],this.points[7],this.points[3])];for(const o of this.frustumEdges){const a=[0,-o[2],o[1]],u=[o[2],0,-o[0]];this.projections.push({axis:a,projection:it(this.points,this.points[0],a)}),this.projections.push({axis:u,projection:it(this.points,this.points[0],u)})}}static fromInvProjectionMatrix(e,i,o,a){const u=Math.pow(2,o),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((y=>{const v=tn([],y,e),b=1/v[3]/i*u;return(T=v)[0]=(E=v)[0]*(I=[b,b,a?1/v[3]:b,b])[0],T[1]=E[1]*I[1],T[2]=E[2]*I[2],T[3]=E[3]*I[3],T;var T,E,I})),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((y=>{const v=Bi([],en([],xr([],h[y[0]],h[y[1]]),xr([],h[y[2]],h[y[1]]))),b=-fr(v,h[y[1]]);return v.concat(b)})),_=[];for(let y=0;y<h.length;y++)_.push([h[y][0],h[y][1],h[y][2]]);return new ci(_,f)}intersectsPrecise(e,i,o){for(let a=0;a<i.length;a++)if(!$t(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!$t(e,this.planes[a]))return 0;for(const a of o)for(const u of this.frustumEdges){const h=en([],a,u),f=Ir(h);if(f===0)continue;Zi(h,h,1/f);const _=it(this.points,this.points[0],h),y=it(e,this.points[0],h);if(_[0]>y[1]||y[0]>_[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const o=i[3];if(fr([i[0],i[1],i[2]],e)+o<0)return!1}return!0}}class ut{static fromPoints(e){const i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(const a of e)Rn(i,i,a),zn(o,o,a);return new ut(i,o)}static fromTileIdAndHeight(e,i,o){const a=1<<e.canonical.z,u=e.canonical.x,h=e.canonical.y;return new ut([u/a,h/a,i],[(u+1)/a,(h+1)/a,o])}static applyTransform(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)gr(o[a],o[a],i);return ut.fromPoints(o)}static applyTransformFast(e,i){const o=[i[12],i[13],i[14]],a=[...o];for(let u=0;u<3;u++)for(let h=0;h<3;h++){const f=i[4*h+u],_=f*e.min[h],y=f*e.max[h];o[u]+=Math.min(_,y),a[u]+=Math.max(_,y)}return new ut(o,a)}static projectAabbCorners(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)gr(o[a],o[a],i);return o}constructor(e,i){this.min=e,this.max=i,this.center=Zi([],gi([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],o=Eo(this.min),a=Eo(this.max);for(let u=0;u<i.length;u++)o[u]=i[u]?this.min[u]:this.center[u],a[u]=i[u]?this.center[u]:this.max[u];return a[2]=this.max[2],new ut(o,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)?gt(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?gt(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)?Mt(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?Mt(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])]}}ot(ut,"Aabb");class si{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,o=i[1],a=-i[0],u=(e.extent+1)*this.metersToTile;return[new Oe(Math.trunc(e.position[0]+o*u),Math.trunc(e.position[1]+a*u)),new Oe(Math.trunc(e.position[0]-o*u),Math.trunc(e.position[1]-a*u))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class At{constructor(e,i,o,a,u,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[Vr(
7),Vr(),Vr(),Vr(),Vr(),Vr(),Vr()],this.id=e,this.heightRange={min:o,max:o},this.safeArea=i,this.constantHeight=o,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=u,this.edges=this.edges.filter((f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((_=this.vertices[f.a].position)[0]===(y=this.vertices[f.b].position)[0]&&_[1]===y[1]);var _,y})),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:Tn(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const _=this.vertices[f.a].position,y=this.vertices[f.b].position,v=Io(Vr(),y,_),b=uo(v),T=$o(Vr(),v,1/b);this.edgeProps.push({vec:v,dir:T,len:b});const E=this.vertexProps[f.a].dir,I=this.vertexProps[f.b].dir;Ts(E,E,T),Ts(I,I,T)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||gl(f.dir,f.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[o,a]=i;return wt(this.vertices[this.edges[o].a].height,this.vertices[this.edges[o].b].height,a)}computeSlopeNormal(e,i){const o=this.getClosestEdge(e);if(!o)return nr(0,0,1);const a=o[0],u=this.edges[a],h=this.edgeProps[a].vec,f=nr(h[0],h[1],(this.vertices[u.b].height-this.vertices[u.a].height)*i),_=nr(f[1],-f[0],0);en(_,_,f);const y=Ir(_);return y>0?Zi(_,_,1/y):Vt(_,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,o=Number.POSITIVE_INFINITY,a=0;const[u,h,f,_,y,v,b]=this._tmpVec2;_l(b,e.x,e.y);const T=new ct(b,null);for(let E=0;E<this.edges.length;E++){const I=this.edges[E],P=this.edgeProps[E].dir;T.dir=P;const L=this.vertices[I.a].position,D=this.vertices[I.b].position,B=T.intersectsPlane(L,this.vertexProps[I.a].dir,u),V=T.intersectsPlane(D,this.vertexProps[I.b].dir,h);if(!B||!V)continue;Io(f,h,u),Io(_,b,u);const G=Qs(f,f),K=G>0?Qs(_,f)/G:0,Z=O(K,0,1),ee=Math.abs((K-Z)*this.edgeProps[E].len);Io(y,b,L),_l(v,P[1],-P[0]);const ne=ee+Math.abs(Qs(y,v));ne<o&&(i=E,o=ne,a=Z)}return[i,a]}tessellate(e){const i=ei(),o=ei(),a=ei(),u=ei();for(let h=this.edges.length-1;h>=0;--h){const f=this.edges[h].a,_=this.edges[h].b,{position:y,height:v,extent:b}=this.vertices[f],{position:T,height:E,extent:I}=this.vertices[_],P=this.vertexProps[f].dir,L=this.vertexProps[_].dir;if(Vt(i,y[0]/e,y[1]/e,v),Vt(o,T[0]/e,T[1]/e,E),Vt(a,P[1],-P[0],0),Zi(a,a,b),Vt(u,L[1],-L[0],0),Zi(u,u,I),this.distSqLines(nr(i[0]+.5*a[0],i[1]+.5*a[1],i[2]+.5*a[2]),nr(o[0]-.5*u[0],o[1]-.5*u[1],o[2]-.5*u[2]),nr(i[0]-.5*a[0],i[1]-.5*a[1],i[2]-.5*a[2]),nr(o[0]+.5*u[0],o[1]+.5*u[1],o[2]+.5*u[2]))<=.0025000000000000005)continue;const D=this.vertices.length,B=Ts(Vr(),y,T);this.vertices.push({position:$o(B,B,.5),height:.5*(v+E),extent:.5*(b+I)});const V=Ts(Vr(),P,L);this.vertexProps.push({dir:gl(V,V)}),this.edges.splice(h,1),this.edgeProps.splice(h,1),this.edges.push({a:f,b:D}),this.edges.push({a:D,b:_});const G=Io(Vr(),this.vertices[D].position,y),K=uo(G),Z={vec:G,dir:$o(Vr(),G,1/K),len:K};this.edgeProps.push(Z),this.edgeProps.push(Z)}}distSqLines(e,i,o,a){const u=Or(ei(),i,e),h=Or(ei(),a,o),f=Or(ei(),e,o),_=fr(u,u),y=fr(u,h),v=fr(u,f),b=fr(h,h),T=fr(h,f),E=_*b-y*y;if(E===0)return ml(Ws(u,o,a,fr(f,h)/fr(h,h)),e);const I=(_*T-y*v)/E;return ml(Ws(u,e,i,(y*T-v*b)/E),Ws(h,o,a,I))}}class di{static parseFrom(e,i){const o=Ue.parse(e);if(!o)return[];let{vertices:a,features:u}=o;const h=1/F(i);u.sort(((v,b)=>v.id-b.id)),a.sort(((v,b)=>v.id-b.id||v.idx-b.idx)),a=a.filter(((v,b,T)=>b===T.findIndex((E=>E.id===v.id&&E.idx===v.idx))));const f=new Array;let _=0;const y=a.length;for(const v of u){if(v.constantHeight){f.push(new At(v.id,v.bounds,v.constantHeight));continue}for(;_!==y&&a[_].id<v.id;)_++;if(_===y||a[_].id!==v.id)continue;const b=new Array,T=new Array,E=_;for(;_!==y&&a[_].id===v.id;){const I=a[_];if(b.push({position:I.position,height:I.height,extent:I.extent}),_!==E&&a[_-1].idx===I.idx-1){const P=_-E;T.push({a:P-1,b:P})}_++}f.push(new At(v.id,v.bounds,void 0,b,T,h))}return f}static getElevationFeature(e,i){if(!i)return;const o=+e.properties[Te];return Number.isNaN(o)?void 0:i.find((a=>a.id===o))}}class Ti{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)*$e,this.yOffset=(e.y*this.zScale-i.y)*$e)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,o){const a=this.constantElevation(i,o);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),o))}computeBiasedHeight(e,i){return i<=0?e:e+i*N(0,i,e>=0?e:Math.abs(.5*e))}}ot(At,"ElevationFeature");class xi{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 Bs,this.indexArray=new Ar,this.segments=new Wi,this.programConfigurations=new vo(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>
7i.id)),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new rs),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){const u=this.layers[0],h=[];let f=null;u.type==="circle"&&(f=u.layout.get("circle-sort-key"));for(const{feature:y,id:v,index:b,sourceLayerIndex:T}of e){const E=this.layers[0]._featureFilter.needGeometry,I=ue(y,E);if(!this.layers[0]._featureFilter.filter(new Li(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),I,o))continue;const P=f?f.evaluate(I,{},o):void 0,L={id:v,properties:y.properties,type:y.type,sourceLayerIndex:T,index:b,geometry:E?I.geometry:ie(y,o,a),patterns:{},sortKey:P};h.push(L)}f&&h.sort(((y,v)=>y.sortKey-v.sortKey));let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new gu,_=a.projection);for(const y of h){const{geometry:v,index:b,sourceLayerIndex:T}=y,E=e[b].feature;this.addFeature(y,v,b,i.availableImages,o,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(E,v,b,T,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,o,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,o,a,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ip.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,rp.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Im.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,o,a,u,h,f,_){let y;this.elevationMode!=="none"&&(y=di.getElevationFeature(e,_));for(const v of i)for(const b of v){const T=b.x,E=b.y;if(T<0||T>=$e||E<0||E>=$e)continue;if(h){const L=h.projectTilePoint(T,E,u),D=h.upVector(u,T,E);this.addGlobeExtVertex(L,D),this.addGlobeExtVertex(L,D),this.addGlobeExtVertex(L,D),this.addGlobeExtVertex(L,D)}const I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),P=I.vertexLength;if(this.addCircleVertex(T,E,-1,-1),this.addCircleVertex(T,E,1,-1),this.addCircleVertex(T,E,1,1),this.addCircleVertex(T,E,-1,1),this.elevationMode!=="none"){const L=y?y.pointElevation(new Oe(T,E)):0;this.hasElevation=this.hasElevation||L!==0;for(let D=0;D<4;D++)this.elevatedLayoutVertexArray.emplaceBack(L)}this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+2,P+3),I.vertexLength+=4,I.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},a,u,f,void 0,this.worldview)}addCircleVertex(e,i,o,a){this.layoutVertexArray.emplaceBack(2*e+(o+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 ni(r,e){for(let i=0;i<r.length;i++)if(Ai(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Ai(r,e[i]))return!0;return!!Ui(r,e)}function Ot(r,e,i){return!!Ai(r,e)||!!Fi(e,r,i)}function hi(r,e){if(r.length===1)return Xi(e,r[0]);for(let i=0;i<e.length;i++){const o=e[i];for(let a=0;a<o.length;a++)if(Ai(r,o[a]))return!0}for(let i=0;i<r.length;i++)if(Xi(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Ui(r,e[i]))return!0;return!1}function tr(r,e,i){if(r.length>1){if(Ui(r,e))return!0;for(let o=0;o<e.length;o++)if(Fi(e[o],r,i))return!0}for(let o=0;o<r.length;o++)if(Fi(r[o],e,i))return!0;return!1}function Ui(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const o=r[i],a=r[i+1];for(let u=0;u<e.length-1;u++)if(fi(o,a,e[u],e[u+1]))return!0}return!1}function fi(r,e,i,o){return Lt(r,i,o)!==Lt(e,i,o)&&Lt(r,e,i)!==Lt(r,e,o)}function Qt(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function Ft(r,e,i,o){const a=Qt(r,e,o),u=Qt(r,e,i);if(Math.sign(a)===Math.sign(u))return;const h=Qt(i,o,r),f=h+u-a;return Math.sign(h)!==Math.sign(f)?[h/(h-f),u/(u-a)]:void 0}function Fi(r,e,i){const o=i*i;if(e.length===1)return r.distSqr(e[0])<o;for(let a=1;a<e.length;a++)if(ur(r,e[a-1],e[a])<o)return!0;return!1}
7function ur(r,e,i){const o=e.distSqr(i);if(o===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/o;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function Xi(r,e){let i,o,a,u=!1;for(let h=0;h<r.length;h++){i=r[h];for(let f=0,_=i.length-1;f<i.length;_=f++)o=i[f],a=i[_],o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(u=!u)}return u}function Ai(r,e){let i=!1;for(let o=0,a=r.length-1;o<r.length;a=o++){const u=r[o],h=r[a];u.y>e.y!=h.y>e.y&&e.x<(h.x-u.x)*(e.y-u.y)/(h.y-u.y)+u.x&&(i=!i)}return i}function vn(r,e,i,o,a){for(const h of r)if(e<=h.x&&i<=h.y&&o>=h.x&&a>=h.y)return!0;const u=[new Oe(e,i),new Oe(e,a),new Oe(o,a),new Oe(o,i)];if(r.length>2){for(const h of u)if(Ai(r,h))return!0}for(let h=0;h<r.length-1;h++)if(Kr(r[h],r[h+1],u))return!0;return!1}function Kr(r,e,i){const o=i[0],a=i[2];if(r.x<o.x&&e.x<o.x||r.x>a.x&&e.x>a.x||r.y<o.y&&e.y<o.y||r.y>a.y&&e.y>a.y)return!1;const u=Lt(r,e,i[0]);return u!==Lt(r,e,i[1])||u!==Lt(r,e,i[2])||u!==Lt(r,e,i[3])}function Cr(r,e,i,o,a,u){let h=e.y-r.y,f=r.x-e.x;if(u=u||0){const _=h*h+f*f;if(_===0)return!0;const y=Math.sqrt(_);h/=y,f/=y}return!((i.x-r.x)*h+(i.y-r.y)*f-u<0||(o.x-r.x)*h+(o.y-r.y)*f-u<0||(a.x-r.x)*h+(a.y-r.y)*f-u<0)}function sn(r,e,i,o,a,u,h){return!(Cr(r,e,o,a,u,h)||Cr(e,i,o,a,u,h)||Cr(i,r,o,a,u,h)||Cr(o,a,r,e,i,h)||Cr(a,u,r,e,i,h)||Cr(u,o,r,e,i,h))}function an(r,e,i){const o=e.paint.get(r).value;return o.kind==="constant"?o.value:i.programConfigurations.get(e.id).getMaxValue(r)}function Zr(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Hn(r,e,i,o,a){if(!e[0]&&!e[1])return r;const u=Oe.convert(e)._mult(a);i==="viewport"&&u._rotate(-o);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(u));return h}function no(r,e,i,o){const a=Oe.convert(r)._mult(o);return e==="viewport"&&a._rotate(-i),a}let Cn,ar;function pr(r,e,i){var o=2*Math.PI*6378137/256/Math.pow(2,i);return[r*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}ot(xi,"CircleBucket",{omit:["layers"]});class Mi{constructor(e,i,o){this.z=e,this.x=i,this.y=o,this.key=Yi(0,e,e,i,o)}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 o=(function(u,h,f){var _=pr(256*u,256*(h=Math.pow(2,f)-h-1),f),y=pr(256*(u+1),256*(h+1),f);return _[0]+","+_[1]+","+y[0]+","+y[1]})(this.x,this.y,this.z),a=(function(u,h,f){let _,y="";for(let v=u;v>0;v--)_=1<<v-1,y+=(h&_?1:0)+(f&_?2:0);return y})(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}",o)}toString(){return`${this.z}/${this.x}/${this.y}`}}class yr{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Yi(e,i.z,i.z,i.x,i.y)}}class ir{constructor(e,i,o,a,u){this.overscaledZ=e,this.wrap=i,this.canonical=new Mi(o,+a,+u),this.key=i===0&&e===o?this.canonical.key:Yi(i,e,o,a,u)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new ir(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ir(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 Yi(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const o=this.canonical.z-e;return Yi(this.wrap*+i,e,e,this.canonical.x>>o,this.canonical.y>>o)}}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 ir(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,o=2*this.canonical.x,a=2*this.canonical.y;return[new ir(i,this.wrap,i,o,a),new ir(i,this.wrap,i,o+1,a),new ir(i,this.wrap,i,o,a+1),new ir(i,this.wrap,i,o+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>
vendor: 7,089 bytes, line 7
7e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new ir(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ir(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 yr(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Yi(r,e,i,o,a){const u=1<<Math.min(i,22);let h=u*(a%u)+o%u;return r&&i<22&&(h+=u*u*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const oo=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new ir(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 ir(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new ir(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new ir(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];ot(Mi,"CanonicalTileID"),ot(ir,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const ic=jt([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:bo}=ic,rc=jt([{name:"a_pos_3",components:3,type:"Int16"}]);var nl=jt([{name:"a_pos",type:"Int16",components:2}]);function Vo(r){return r*on/l}const ls=[new ut([io,io,io],[ro,ro,ro]),new ut([io,io,io],[0,0,ro]),new ut([0,io,io],[ro,0,ro]),new ut([io,0,io],[0,ro,ro]),new ut([0,0,io],[ro,ro,ro])];function ol(r,e,i,o=!0){const a=Zi([],r._camera.position,r.worldSize),u=[e,i,1,1];tn(u,u,r.pixelMatrixInverse),bs(u,u,1/u[3]);const h=Bi([],xr([],u,a)),f=r.globeMatrix,_=[f[12],f[13],f[14]],y=xr([],_,a),v=Ir(y),b=Bi([],y),T=r.worldSize/(2*Math.PI),E=fr(b,h),I=Math.asin(T/v);if(I<Math.acos(E)){if(!o)return null;const be=[],he=[];Zi(be,h,v/E),Bi(he,xr(he,be,y)),Bi(h,gi(h,y,Zi(h,he,Math.tan(I)*v)))}const P=[];new st(a,h).closestPointOnSphere(_,T,P);const L=Bi([],lr(f,0)),D=Bi([],lr(f,1)),B=Bi([],lr(f,2)),V=fr(L,P),G=fr(D,P),K=fr(B,P),Z=hn(Math.asin(-G/T));let ee=hn(Math.atan2(V,K));ee=r.center.lng+(function(be,he){const Ee=(he-be+180)%360-180;return Ee<-180?Ee+360:Ee})(r.center.lng,ee);const ne=g(ee),ae=O(x(Z),0,1);return new U(ne,ae)}class js{constructor(e,i,o){this.a=xr([],e,o),this.b=xr([],i,o),this.center=o;const a=Bi([],this.a),u=Bi([],this.b);this.angle=Math.acos(fr(a,u))}}function cs(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(o,a,u,h){const f=Math.sin(u);return o*(Math.sin((1-h)*u)/f)+a*(Math.sin(h*u)/f)})(r.a[e],r.b[e],r.angle,O(i,0,1))+r.center[e]}function wo(r){if(r.z<=1)return ls[r.z+2*r.y+r.x];const e=km(np(r));return ut.fromPoints(e)}function us(r,e,i){return Zi(r,r,1-i),qr(r,r,e,i)}function og(r,e,i){for(const o of r)gr(o,o,e),Zi(o,o,i)}function sg(r,e,i,o){const a=e/r.worldSize,u=r.globeMatrix;if(i.z<=1){const ae=wo(i).getCorners();return og(ae,u,a),ut.fromPoints(ae)}const h=np(i,o),f=km(h,on+Vo(r._tileCoverLift));og(f,u,a);const _=Number.MAX_VALUE,y=[-_,-_,-_],v=[_,_,_];if(h.contains(r.center)){for(const he of f)Rn(v,v,he),zn(y,y,he);y[2]=0;const ae=r.point,be=[ae.x*a,ae.y*a,0];return Rn(v,v,be),zn(y,y,be),new ut(v,y)}if(r._tileCoverLift>0){for(const ae of f)Rn(v,v,ae),zn(y,y,ae);return new ut(v,y)}const b=[u[12]*a,u[13]*a,u[14]*a],T=h.getCenter(),E=O(r.center.lat,-C,C),I=O(T.lat,-C,C),P=g(r.center.lng),L=x(E);let D=P-g(T.lng);const B=L-x(I);D>.5?D-=1:D<-.5&&(D+=1);let V=0;Math.abs(D)>Math.abs(B)?V=D>=0?1:3:(V=B>=0?0:2,qr(b,b,[u[4]*a,u[5]*a,u[6]*a],-Math.sin(oi(B>=0?h.getSouth():h.getNorth()))*on));const G=f[V],K=f[(V+1)%4],Z=new js(G,K,b),ee=[cs(Z,0)||G[0],cs(Z,1)||G[1],cs(Z,2)||G[2]],ne=sl(r.zoom);if(ne>0){const ae=(function({x:he,y:Ee,z:Ce},Pe,Fe,Be,ze){const De=1/(1<<Ce);let Se=he*De,we=Se+De,Le=Ee*De,Ze=Le+De,je=0;const dt=(Se+we)/2-Be;return dt>.5?je=-1:dt<-.5&&(je=1),Se=((Se+je)*Pe-(Be*=Pe))*Fe+Be,we=((we+je)*Pe-Be)*Fe+Be,Le=(Le*Pe-(ze*=Pe))*Fe+ze,Ze=(Ze*Pe-ze)*Fe+ze,[[Se,Ze,0],[we,Ze,0],[we,Le,0],[Se,Le,0]]})(i,e,r._pixelsPerMercatorPixel,P,L);for(let he=0;he<f.length;he++)us(f[he],ae[he],ne);const be=gi([],ae[V],ae[(V+1)%4]);Zi(be,be,.5),us(ee,be,ne)}for(const ae of f)Rn(v,v,ae),zn(y,y,ae);return v[2]=Math.min(G[2],K[2]),Rn(v,v,ee),zn(y,y,ee),new ut(v,y)}function np({x:r,y:e,z:i},o=!1){const a=1/(1<<i),u=new n(S(r*a),e===(1<<i)-1&&o?-90:M((e+1)*a)),h=new n(S((r+1)*a),e===0&&o?90:M(e*a));return new c(u,h)}function km(r,e=on){const i=oi(r.getNorth()),o=oi(r.getSouth()),a=Math.cos(i),u=Math.cos(o),h=Math.sin(i),f=Math.sin(o),_=r.getWest(),y=r.getEast();return[Ta(u,f,_,e),Ta(u,f,y,e),Ta(a,h,y,e),Ta(a,h,_,e)]}function hd(r,e,i,o){const a=1<<i.z,u=(r/$e+i.x)/a;return rl(M((e/$e+i.y)/a),S(u),o)}function op({min:r,max:e}){return Fm/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const ag=new Float64Array(16);function sp(r){const e=op(r),i=So(ag,[e,e,e]);return Qr(i,i,ys([],r.min))}function Bm(r){const e=(o=r.min,(i=ag)[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]=o[0],i[13]=o[1],i[14]=o[2],i[15]=1,i);var i,o;const a=1/op(r);return Hr(e,e,[a,a,a])}function Nm(r){const e=$e/(2*Math.PI);return r/(2*Math.PI)/e}function lg(r,e){return $e/(512*Math.pow(2,r))*op(wo(e))}function cg(r,e,i,o,a){const u=Nm(i),h=[r,e,-i/(2*Math.PI)],f=Ni(new Float64Array(16));return Qr(f,f,h),Hr(f,f,[u,u,u]),Wn(f,f,oi(-a)),wn(f,f,oi(-o)),f}function sl(r){return N(to,Lu,r)}function ug(r,e){const i=rl(e.lat,e.lng),o=(function(I){const P=rl(I._center.lat,I._center.lng);let L=en([],nr(0,1,0),P);const D=ki([],-I.angle,P);L=gr(L,L,D),ki(D,-I._pitch,L);const B=Bi([],P);return Zi(B,B,Vo(I.cameraToCenterDistance/I.pixelsPerMeter)),gr(B,B,D),gi([],P,B)})(r);return h=(a=Or([],o,i))[0],f=a[1],_=a[2],y=(u=i)[0],v=u[1],b=u[2],E=(T=Math.sqrt((h*h+f*f+_*_)*(y*y+v*v+b*b)))&&fr(a,u)/T,Math.acos(Math.min(Math.max(E,-1),1));var a,u,h,f,_,y,v,b,T,E}function Vm(r,e){return ug(r,e)>Math.PI/2*1.01}const hg=oi(85),l0=Math.cos(hg),c0=Math.sin(hg),u0=lo(),dg=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 fg(r,e,i,o,a,u,h,f,_){if(u&&r.queryGeometry.isAboveHorizon)return!1;u&&(_*=r.pixelToTileUnitsFactor);const y=r.tileID.canonical,v=i.projection.upVectorScale(y,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const T of b){const E=T.add(f),I=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(E.x,E.y,!0):0,P=i.projection.projectTilePoint(E.x,E.y,y);if(I>0){const V=i.projection.upVector(y,E.x,E.y);P.x+=V[0]*v*I,P.y+=V[1]*v*I,P.z+=V[2]*v*I}const L=u?E:h0(P.x,P.y,P.z,o),D=u?r.tilespaceRays.map((V=>f0(V,I))):r.queryGeometry.screenGeometry,B=tn([],[P.x,P.y,P.z,1],o);if(!h&&u?_*=B[3]/i.cameraToCenterDistance:h&&!u&&(_*=i.cameraToCenterDistance/B[3]),u){const V=M((T.y
7/$e+y.y)/(1<<y.z));_/=i.projection.pixelsPerMeter(V,1)/w(1,V)}if(Ot(D,L,_))return!0}return!1}function h0(r,e,i,o){const a=tn([],[r,e,i,1],o);return new Oe(a[0]/a[3],a[1]/a[3])}const pg=nr(0,0,0),d0=nr(0,0,1);function f0(r,e){const i=ei();return pg[2]=e,r.intersectsPlane(pg,d0,i),new Oe(i[0],i[1])}class mg extends xi{}let _g,gg,yg,xg;function vg(r,{width:e,height:i},o,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*o)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*o);return r.width=e,r.height=i,r.data=a,r}function bg(r,e,i){const{width:o,height:a}=e;o===r.width&&a===r.height||(Um(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,o),height:Math.min(r.height,a)},i,null),r.width=o,r.height=a,r.data=e.data)}function Um(r,e,i,o,a,u,h,f){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||o.x>e.width-a.width||o.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,y=e.data,v=u===4&&f;for(let b=0;b<a.height;b++){const T=((i.y+b)*r.width+i.x)*u,E=((o.y+b)*e.width+o.x)*u;if(v)for(let I=0;I<a.width;I++){const P=T+I*u+3,L=E+I*u;y[L+0]=255,y[L+1]=255,y[L+2]=255,y[L+3]=_[P]}else if(h)for(let I=0;I<a.width;I++){const P=T+I*u,L=E+I*u,D=new yi(_[P+0]/255,_[P+1]/255,_[P+2]/255,_[P+3]).toNonPremultipliedRenderColor(h).toArray();y[L+0]=D[0],y[L+1]=D[1],y[L+2]=D[2],y[L+3]=D[3]}else for(let I=0;I<a.width*u;I++)y[E+I]=_[T+I]}return e}ot(mg,"HeatmapBucket",{omit:["layers"]});class al{constructor(e,i){vg(this,e,1,i)}resize(e){bg(this,new al(e),1)}clone(){return new al({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,u){Um(e,i,o,a,u,1,null)}}class ln{constructor(e,i){vg(this,e,4,i)}resize(e){bg(this,new ln(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new ln({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,u,h,f){Um(e,i,o,a,u,4,h,f)}}class wg{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function dd(r){const e={},i=r.resolution||256,o=r.clips?r.clips.length:1,a=r.image||new ln({width:i,height:o}),u=(h,f,_)=>{e[r.evaluationKey]=_;const y=r.expression.evaluate(e),v=y?y.toNonPremultipliedRenderColor(null):null;v&&(a.data[h+f+0]=Math.floor(255*v.r),a.data[h+f+1]=Math.floor(255*v.g),a.data[h+f+2]=Math.floor(255*v.b),a.data[h+f+3]=Math.floor(255*v.a))};if(r.clips)for(let h=0,f=0;h<o;++h,f+=4*i)for(let _=0,y=0;_<i;_++,y+=4){const v=_/(i-1),{start:b,end:T}=r.clips[h];u(f,y,b*(1-v)+T*v)}else for(let h=0,f=0;h<i;h++,f+=4)u(0,f,h/(i-1));return a}ot(al,"AlphaImage"),ot(ln,"RGBAImage");const p0=jt([{name:"a_pos",components:2,type:"Int16"}],4),m0=jt([{name:"a_road_z_offset",components:1,type:"Float32"}],4),_0=jt([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),g0=jt([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Ou(r,e,i=2){const o=e&&e.length,a=o?e[0]*i:r.length;let u=Tg(r,0,a,i,!0);const h=[];if(!u||u.next===u.prev)return h;let f,_,y;if(o&&(u=(function(v,b,T,E){const I=[];for(let P=0,L=b.length;P<L;P++){const D=Tg(v,b[P]*E,P<L-1?b[P+1]*E:v.length,E,!1);D===D.next&&(D.steiner=!0),I.push(E0(D))}I.sort(w0);for(let P=0;P<I.length;P++)T=T0(I[P],T);return T})(r,e,u,i)),r.length>80*i){f=r[0],_=r[1];let v=f,b=_;for(let T=i;T<a;T+=i){const E=r[T],I=r[T+1];E<f&&(f=E),I<_&&(_=I),E>v&&(v=E),I>b&&(b=I)}y=Math.max(v-f,b-_),y=y!==0?32767/y:0}return fd(u,h,i,f,_,y,0),h}function Tg(r,e,i,o,a){let u;if(a===(function(h,f,_,y){let v=0;for(let b=f,T=_-y;b<_;b+=y)v+=(h[T]-h[b])*(h[b+1]+h[T+1]),T=b;return v})(r,e,i,o)>0)for(let h=e;h<i;h+=o)u=Ag(h/o|0,r[h],r[h+1],u);else for(let h=i-o;h>=e;h-=o)u=Ag(h/o|0,r[h],r[h+1],u);return u&&Fu(u,u.next)&&(_d(u),u=u.next),u}function nc(r,e){if(!r)return r;e||(e=r);let i,o=r;do if(i=!1,o.steiner||!Fu(o,o.next)&&Gr(o.prev,o,o.next)!==0)o=o.next;else{if(_d(o),o=e=o.prev,o===o.next)break;
vendor: 2,272 bytes, line 7
7i=!0}while(i||o!==e);return e}function fd(r,e,i,o,a,u,h){if(!r)return;!h&&u&&(function(_,y,v,b){let T=_;do T.z===0&&(T.z=jm(T.x,T.y,y,v,b)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==_);T.prevZ.nextZ=null,T.prevZ=null,(function(E){let I,P=1;do{let L,D=E;E=null;let B=null;for(I=0;D;){I++;let V=D,G=0;for(let Z=0;Z<P&&(G++,V=V.nextZ,V);Z++);let K=P;for(;G>0||K>0&&V;)G!==0&&(K===0||!V||D.z<=V.z)?(L=D,D=D.nextZ,G--):(L=V,V=V.nextZ,K--),B?B.nextZ=L:E=L,L.prevZ=B,B=L;D=V}B.nextZ=null,P*=2}while(I>1)})(T)})(r,o,a,u);let f=r;for(;r.prev!==r.next;){const _=r.prev,y=r.next;if(u?x0(r,o,a,u):y0(r))e.push(_.i,r.i,y.i),_d(r),r=y.next,f=y.next;else if((r=y)===f){h?h===1?fd(r=v0(nc(r),e),e,i,o,a,u,2):h===2&&b0(r,e,i,o,a,u):fd(nc(r),e,i,o,a,u,1);break}}}function y0(r){const e=r.prev,i=r,o=r.next;if(Gr(e,i,o)>=0)return!1;const a=e.x,u=i.x,h=o.x,f=e.y,_=i.y,y=o.y,v=Math.min(a,u,h),b=Math.min(f,_,y),T=Math.max(a,u,h),E=Math.max(f,_,y);let I=o.next;for(;I!==e;){if(I.x>=v&&I.x<=T&&I.y>=b&&I.y<=E&&pd(a,f,u,_,h,y,I.x,I.y)&&Gr(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function x0(r,e,i,o){const a=r.prev,u=r,h=r.next;if(Gr(a,u,h)>=0)return!1;const f=a.x,_=u.x,y=h.x,v=a.y,b=u.y,T=h.y,E=Math.min(f,_,y),I=Math.min(v,b,T),P=Math.max(f,_,y),L=Math.max(v,b,T),D=jm(E,I,e,i,o),B=jm(P,L,e,i,o);let V=r.prevZ,G=r.nextZ;for(;V&&V.z>=D&&G&&G.z<=B;){if(V.x>=E&&V.x<=P&&V.y>=I&&V.y<=L&&V!==a&&V!==h&&pd(f,v,_,b,y,T,V.x,V.y)&&Gr(V.prev,V,V.next)>=0||(V=V.prevZ,G.x>=E&&G.x<=P&&G.y>=I&&G.y<=L&&G!==a&&G!==h&&pd(f,v,_,b,y,T,G.x,G.y)&&Gr(G.prev,G,G.next)>=0))return!1;G=G.nextZ}for(;V&&V.z>=D;){if(V.x>=E&&V.x<=P&&V.y>=I&&V.y<=L&&V!==a&&V!==h&&pd(f,v,_,b,y,T,V.x,V.y)&&Gr(V.prev,V,V.next)>=0)return!1;V=V.prevZ}for(;G&&G.z<=B;){if(G.x>=E&&G.x<=P&&G.y>=I&&G.y<=L&&G!==a&&G!==h&&pd(f,v,_,b,y,T,G.x,G.y)&&Gr(G.prev,G,G.next)>=0)return!1;G=G.nextZ}return!0}function v0(r,e){let i=r;do{const o=i.prev,a=i.next.next;!Fu(o,a)&&Eg(o,i,i.next,a)&&md(o,a)&&md(a,o)&&(e.push(o.i,i.i,a.i),_d(i),_d(i.next),i=r=a),i=i.next}while(i!==r);return nc(i)}function b0(r,e,i,o,a,u){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&I0(h,f)){let _=Ig(h,f);return h=nc(h,h.next),_=nc(_,_.next),fd(h,e,i,o,a,u,0),void fd(_,e,i,o,a,u,0)}f=f.next}h=h.next}while(h!==r)}function w0(r,e){let i=r.x-e.x;
7return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function T0(r,e){const i=(function(a,u){let h=u;const f=a.x,_=a.y;let y,v=-1/0;if(Fu(a,h))return h;do{if(Fu(a,h.next))return h.next;if(_<=h.y&&_>=h.next.y&&h.next.y!==h.y){const P=h.x+(_-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(P<=f&&P>v&&(v=P,y=h.x<h.next.x?h:h.next,P===f))return y}h=h.next}while(h!==u);if(!y)return null;const b=y,T=y.x,E=y.y;let I=1/0;h=y;do{if(f>=h.x&&h.x>=T&&f!==h.x&&Sg(_<E?f:v,_,T,E,_<E?v:f,_,h.x,h.y)){const P=Math.abs(_-h.y)/(f-h.x);md(h,a)&&(P<I||P===I&&(h.x>y.x||h.x===y.x&&S0(y,h)))&&(y=h,I=P)}h=h.next}while(h!==b);return y})(r,e);if(!i)return e;const o=Ig(i,r);return nc(o,o.next),nc(i,i.next)}function S0(r,e){return Gr(r.prev,r,e.prev)<0&&Gr(e.next,r,r.next)<0}function jm(r,e,i,o,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-o)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function E0(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 Sg(r,e,i,o,a,u,h,f){return(a-h)*(e-f)>=(r-h)*(u-f)&&(r-h)*(o-f)>=(i-h)*(e-f)&&(i-h)*(u-f)>=(a-h)*(o-f)}function pd(r,e,i,o,a,u,h,f){return!(r===h&&e===f)&&Sg(r,e,i,o,a,u,h,f)}function I0(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,o){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==o.i&&a.next.i!==o.i&&Eg(a,a.next,i,o))return!0;a=a.next}while(a!==i);return!1})(r,e)&&(md(r,e)&&md(e,r)&&(function(i,o){let a=i,u=!1;const h=(i.x+o.x)/2,f=(i.y+o.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&h<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(u=!u),a=a.next;while(a!==i);return u})(r,e)&&(Gr(r.prev,r,e.prev)||Gr(r,e.prev,e))||Fu(r,e)&&Gr(r.prev,r,r.next)>0&&Gr(e.prev,e,e.next)>0)}function Gr(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Fu(r,e){return r.x===e.x&&r.y===e.y}function Eg(r,e,i,o){const a=lp(Gr(r,e,i)),u=lp(Gr(r,e,o)),h=lp(Gr(i,o,r)),f=lp(Gr(i,o,e));return a!==u&&h!==f||!(a!==0||!ap(r,i,e))||!(u!==0||!ap(r,o,e))||!(h!==0||!ap(i,r,o))||!(f!==0||!ap(i,e,o))}function ap(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 lp(r){return r>0?1:r<0?-1:0}function md(r,e){return Gr(r.prev,r,r.next)<0?Gr(r,e,r.next)>=0&&Gr(r,r.prev,e)>=0:Gr(r,e,r.prev)<0||Gr(r,r.next,e)<0}function Ig(r,e){const i=Gm(r.i,r.x,r.y),o=Gm(e.i,e.x,e.y),a=r.next,u=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,o.next=i,i.prev=o,u.next=o,o.prev=u,o}function Ag(r,e,i,o){const a=Gm(r,e,i);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function _d(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 Gm(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function gd(r,e){const i=r.length;if(i<=1)return[r];const o=[];let a,u;for(let h=0;h<i;h++){const f=zt(r[h]);f!==0&&(r[h].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(a&&o.push(a),a=[r[h]]):a.push(r[h]))}if(a&&o.push(a),e>1)for(let h=0;h<o.length;h++)o[h].length<=e||(Dc(o[h],e,1,o[h].length-1,A0),o[h]=o[h].slice(0,e));return o}function A0(r,e){return e.area-r.area}function Mg(r,e,i=1){if(!r)return null;const o=typeof r=="string"?_n.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const u of[o,a]){if(!u)continue;const h=u.id.toString();e.has(h)||e.set(h,[]),u.scaleSelf(i),e.get(h).push(u)}return{primary:o.toString(),secondary:a?a.toString():null}}function Hm(r,e,i,o){const a=o.patternDependencies;let u=!1;for(const h of e){const f=h.paint.get(`${r}-pattern`);f.isConstant()||(u=!0),Mg(f.constantOr(null),a,i)&&(u=!0)}return u}function qm(r,e,i,o,a,u){const h=u.patternDependencies;for(const f of e){const _=f.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let y=_.evaluate({zoom:o},i,{},u.availableImages);y=y&&y.name?y.name:y;const v=Mg(y,h,a);if(!v)continue;const{primary:b,secondary:T}=v;
7b&&(i.patterns[f.id]=[b,T].filter(Boolean))}}return i}class Cg{constructor(){this.polygons=new Map}add(e,...i){const o=this.polygons.get(e);o?o.push(...i):this.polygons.set(e,i)}merge(e){for(const[i,o]of e.polygons)this.add(i,...o)}}class Sa{constructor(){this.portals=[]}static isOnBorder(e,i){return e<=0&&i<=0||e>=$e&&i>=$e}static evaluate(e){if(e.length===0)return new Sa;let i=[];for(const _ of e)i.push(..._.portals);if(i.length===0)return new Sa;for(const _ of i){const y=_.va,v=_.vb;(Sa.isOnBorder(y.x,v.x)||Sa.isOnBorder(y.y,v.y))&&(_.type="border")}const o=i.filter((_=>_.type!=="unevaluated")),a=i.filter((_=>_.type==="unevaluated"));if(a.length===0)return new Sa;a.sort(((_,y)=>_.hash===y.hash?_.isTunnel===y.isTunnel?0:_.isTunnel?-1:1:_.hash<y.hash?1:-1)),i=o.concat(a);let u=o.length,h=u,f=u;do if(h++,h===i.length||i[u].hash!==i[h].hash){if(h-u==2){f<u&&(i[f]=i[u],i[u]=null);const _=i[f],y=i[h-1];_.type=_.isTunnel!==y.isTunnel?"tunnel":"polygon",_.connection={a:_.connection.a,b:y.connection.a},f++}u=h}while(u!==i.length);return i.splice(f),i.sort(((_,y)=>_.hash<y.hash?1:-1)),{portals:i}}}ot(Sa,"ElevationPortalGraph"),ot(Cg,"ElevationPolygons");class M0{constructor(e,i,o){this.outPositions=e,this.outNormals=i,this.outIndices=o,this.vertexLookup=new Map}addVertex(e,i,o){let a=e[2];o!=null&&(a*=o);const u=`${e[0]},${e[1]},${e[2]},${i[0]},${i[1]},${i[2]}`,h=this.vertexLookup.get(u);if(h!=null)return h;const f=this.outPositions.length;this.vertexLookup.set(u,f);const _=Math.trunc(16384*i[0]),y=Math.trunc(16384*i[1]),v=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(_,y,v),f}addTriangle(e,i,o){this.outIndices.emplaceBack(e,i,o)}addTriangles(e,i,o){if(e.length===0)return;const a=o.length===1,u=ei(),h=ei();for(let f=0;f<e.length;f+=3){const _=i[e[f+0]],y=i[e[f+1]],v=i[e[f+2]],b=a?o[0]:o[e[f+1]],T=a?o[0]:o[e[f+2]];Vt(u,_.x,_.y,a?o[0]:o[e[f+0]]);const E=this.addVertex(u,h);Vt(u,y.x,y.y,b);const I=this.addVertex(u,h);Vt(u,v.x,v.y,T);const P=this.addVertex(u,h);this.outIndices.emplaceBack(E,I,P)}}addQuad(e,i,o,a,u,h){const f=this.addVertex(e,u,h),_=this.addVertex(i,u,h),y=this.addVertex(o,u,h),v=this.addVertex(a,u,h);this.addTriangle(f,_,y),this.addTriangle(y,v,f)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class qn{constructor(e,i,o,a){this.unevaluatedPortals=new Sa,this.portalPolygons=new Cg,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new qh,this.vertexNormals=new $h,this.indexArray=new Ar,this.tileToMeters=F(e),this.bridgeProgramConfigurations=new vo(i,{zoom:o,lut:a},(u=>u!=="fill-tunnel-structure-color")),this.tunnelProgramConfigurations=new vo(i,{zoom:o,lut:a},(u=>u!=="fill-bridge-guard-rail-color"))}addVertices(e,i){const o=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return o}addTriangles(e,i,o){const a=o?this.unevalTunnelTriangles:this.unevalTriangles;for(const u of e)a.push(u+i)}addRenderableRing(e,i,o,a,u,h){const f=[new Oe(u.min.x,u.min.y),new Oe(u.max.x,u.min.y),new Oe(u.max.x,u.max.y),new Oe(u.min.x,u.max.y)];for(let _=0;_<o-1;_++){const y=i+_,v=y+1,b=this.unevalVertices[y],T=this.unevalVertices[v];if(!(b.x>=u.min.x&&b.x<=u.max.x&&b.y>=u.min.y&&b.y<=u.max.y||T.x>=u.min.x&&T.x<=u.max.x&&T.y>=u.min.y&&T.y<=u.max.y||Kr(b,T,f))||this.isOnBorder(b.x,T.x)||this.isOnBorder(b.y,T.y))continue;const E=qn.computeEdgeHash(this.unevalVertices[y],this.unevalVertices[v]);let I,P=this.vertexHashLookup.get(qn.computePosHash(b));P!=null?I=P.next:(P=this.vertexHashLookup.get(qn.computePosHash(T)),I=P!=null?P.prev:E),this.unevalEdges.push({polygonIdx:e,a:y,b:v,hash:E,portalHash:I,isTunnel:a,type:"unevaluated",featureInfo:h})}}addPortalCandidates(e,i,o,a,u){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:u});const h=i[0];this.vertexHashLookup.clear();let f=qn.computeEdgeHash(h[h.length-2],h[h.length-1]);for(let _=0;_<h.length-1;_++){const y=h[_+0],v=h[_+1],b=Tn(v.x-y.x,v.y-y.y),T=uo(b);if(T===0)continue;let E="unevaluated";const I=a.pointElevation(y),P=a.pointElevation(v);Math.abs(I)<.01&&Math.abs(P)<.01?E="entrance":(this.isOnBorder(y.x,v.x)||this.isOnBorder(y.y,v.y))&&(E="border");const L=qn.computeEdgeHash(y,v);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:y,vb:v,vab:b,length:T,hash:L,isTunnel:o,type:E});const D=qn.computePosHash(y);this.vertexHashLookup.set(D,{prev:f,next:L}),f=L}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),o=T=>{T.primitiveLength=this.indexArray.length-T.primitiveOffset},a=new M0(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const u=i(),h=i(),f=i(),_=(T,E)=>{T.sort(((P,L)=>P.type===E&&L.type!==E?-1:P.type!==E&&L.type===E?1:0));const I=T.findIndex((P=>P.type!==E));return I>=0?I:T.length};let y=0;this.unevalEdges.length>0&&(y=_(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:y},this.tileToMeters)),o(f);const v=i(),b=i();if(this.unevalEdges.length>0){const T=this.unevalEdges.splice(y),E=_(T,"tunnel")+y;this.unevalEdges.push(...T),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:y},{min:y,max:E})}o(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),o(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),o(h),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),o(u),this.maskSegments=Wi.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=Wi.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableBridgeSegments=Wi.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=Wi.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=Wi.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength)}update(e,i,o,a,u,h,f,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,u,o,a,h,f,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,u,o,a,h,f,_)}
vendor: 5,754 bytes, line 7
7upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,_0.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,g0.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,o,a,u){const h=(f,_)=>{for(let y=0;y<_.length-1;y++){const v=_[y].featureIndex,b=_[y+1].vertexStart,T=e.feature(v);f.populatePaintArrays(b,T,v,{},o,i,a,void 0,u)}};h(this.bridgeProgramConfigurations,this.bridgeFeatureSections),h(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,o,a,u){const h=new Map;for(let f=a;f<u;f++){const _=o[f],y=_.a,v=_.b,b=qn.computePosHash(e[y]),T=qn.computePosHash(e[v]);let E=h.get(b);E||(E={},h.set(b,E));let I=h.get(T);I||(I={},h.set(T,I)),i[y]<=0&&i[v]<=0||(E.to=v,I.from=y)}return h}isTerminalVertex(e,i){const o=qn.computePosHash(this.unevalVertices[e]),a=i.get(o);return!a||!a.from||!a.to}constructBridgeStructures(e,i,o,a,u,h){e.clearVertexLookup();const f=this.computeVertexConnections(i,o,a,u.min,u.max),_=1/h,y=.5*_,v=(Fe,Be)=>Vt(Fe,i[Be].x,i[Be].y,o[Be]*_),b=ei(),T=ei(),E=ei(),I=ei(),P=ei(),L=(Fe,Be)=>{const ze=f.get(qn.computePosHash(i[Be])),De=ze.from,Se=ze.to;if(!De||!Se)return;v(b,De),v(T,Be),v(E,Se),Dn(I),un(b,T)||(xr(P,T,b),Bi(I,P)),un(E,T)||(xr(P,E,T),gi(I,I,Bi(P,P)));const we=Pa(I);return we>0?Zi(Fe,I,1/we):void 0};let D=Number.POSITIVE_INFINITY;this.sortSubarray(a,u.min,u.max,((Fe,Be)=>Fe.featureInfo.featureIndex-Be.featureInfo.featureIndex));const B=ei(),V=ei(),G=ei(),K=ei(),Z=ei(),ee=ei(),ne=ei(),ae=ei(),be=ei(),he=[ei(),ei(),ei(),ei()],Ee=[ei(),ei(),ei(),ei()],Ce=[{coord:new Oe(0,0),height:0},{coord:new Oe(0,0),height:0}],Pe=(Fe,Be)=>Fe>Be;for(let Fe=u.min;Fe<u.max;Fe++){const Be=a[Fe];if(!Be.featureInfo.guardRailEnabled||!this.prepareEdgePoints(Ce,i,o,Be,Pe))continue;const[ze,De]=Ce;if(Vt(B,ze.coord.x,ze.coord.y,_*ze.height),Vt(V,De.coord.x,De.coord.y,_*De.height),un(B,V))continue;xr(G,V,B),Bi(G,G);const Se=L(ae,Be.a)||G,we=L(be,Be.b)||G;Vt(K,Se[1],-Se[0],0),Bi(K,K),Vt(Z,we[1],-we[0],0),Bi(Z,Z),en(ae,K,Se),Bi(ee,ae),en(ae,Z,we),Bi(ne,ae),gi(he[0],B,Zi(ae,xr(ae,K,ee),y)),gi(he[1],B,Zi(ae,gi(ae,K,ee),y)),gi(he[2],B,Zi(ae,ee,y)),he[3]=B,gi(Ee[0],V,Zi(ae,xr(ae,Z,ne),y)),gi(Ee[1],V,Zi(ae,gi(ae,Z,ne),y)),gi(Ee[2],V,Zi(ae,ne,y)),Ee[3]=V,D=this.addFeatureSection(Be.featureInfo.featureIndex,D,this.bridgeFeatureSections,e);const Le=e.addVertex(he[0],K,h),Ze=e.addVertex(he[1],K,h),je=e.addVertex(Ee[0],Z,h),dt=e.addVertex(Ee[1],Z,h);e.addTriangle(Le,Ze,je),e.addTriangle(Ze,dt,je);const Qe=e.addVertex(he[1],ee,h),rt=e.addVertex(he[2],ee,h),at=e.addVertex(Ee[1],ne,h),Ut=e.addVertex(Ee[2],ne,h);e.addTriangle(Qe,rt,at),e.addTriangle(rt,Ut,at),ys(K,K),ys(Z,Z);const Ge=e.addVertex(he[2],K,h),lt=e.addVertex(he[3],K,h),It=e.addVertex(Ee[2],Z,h),Zt=e.addVertex(Ee[3],Z,h);e.addTriangle(Ge,lt,It),e.addTriangle(lt,Zt,It);const Xt=this.isTerminalVertex(Be.a,f),Rt=this.isTerminalVertex(Be.b,f);ze.height<.01&&Xt&&e.addQuad(he[3],he[2],he[1],he[0],ys(Se,Se),h),De.height<.01&&Rt&&e.addQuad(Ee[0],Ee[1],Ee[2],Ee[3],we,h)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,o,a,u,h){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const _=(D,B)=>D.featureInfo.featureIndex-B.featureInfo.featureIndex;this.sortSubarray(a,u.min,u.max,_),this.sortSubarray(a,h.min,h.max,_);const y=D=>Bi(D,D),v=[{coord:new Oe(0,0),height:0},{coord:new Oe(0,0),height:0}],b=(D,B)=>D<B,T=ei(),E=ei(),I=ei(),P=ei(),L=ei();for(let D=u.min;D<u.max;D++){if(!this.prepareEdgePoints(v,i,o,a[D],b))continue;const[B,V]=v,G=y(Vt(L,-(V.coord.y-B.coord.y),V.coord.x-B.coord.x,0));f=this.addFeatureSection(a[D].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(Vt(T,B.coord.x,B.coord.y,B.height),Vt(E,V.coord.x,V.coord.y,V.height),Vt(I,V.coord.x,V.coord.y,a[D].isTunnel?-.1:0),Vt(P,B.coord.x,B.coord.y,a[D].isTunnel?-.1:0),G)}for(let D=h.min;D<h.max;D++){const B=a[D];B.isTunnel&&([B.a,B.b]=[B.b,B.a]);const V=i[B.a],G=i[B.b],K=y(Vt(L,-(G.y-V.y),G.x-V.x,0));f=this.addFeatureSection(B.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(Vt(T,G.x,G.y,0),Vt(E,V.x,V.y,0),Vt(I,V.x,V.y,o[B.a]+4),Vt(P,G.x,G.y,o[B.b]+4),K),e.addQuad(Vt(T,V.x,V.y,0),Vt(E,G.x,G.y,0),Vt(I,G.x,G.y,o[B.b]+4),Vt(P,V.x,V.y,o[B.a]+4),K)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,o,a){e.coord.x=i,e.coord.y=o,e.height=a}prepareEdgePoints(e,i,o,a,u){let h=i[a.a].x,f=i[a.a].y,_=i[a.b].x,y=i[a.b].y,v=o[a.a],b=o[a.b];const T=u(v,0),E=u(b,0);if(T&&E)return this.setElevatedPoint(e[0],h,f,v),this.setElevatedPoint(e[1],_,y,b),!0;if(!T&&!E)return!1;if(T){if(!E){const I=b/(b-v);_=wt(_,h,I),y=wt(y,f,I),b=wt(b,v,I)}}else{const I=v/(v-b);h=wt(h,_,I),f=wt(f,y,I),v=wt(v,b,I)}return this.setElevatedPoint(e[0],h,f,v),this.setElevatedPoint(e[1],_,y,b),!0}prepareEdges(e,i){if(i.length===0)return;i.sort(((f,_)=>f.hash===_.hash?_.polygonIdx-f.polygonIdx:_.hash>f.hash?1:-1));let o=0,a=0,u=0,h=i[o].polygonIdx;do a++,(a===i.length||i[o].hash!==i[a].hash)&&((a-o==1||i[a-1].polygonIdx!==h)&&
7(u<o&&(i[u]=i[o],i[o]=null),i[u].type="none",u++),o=a,o!==i.length&&(h=i[o].polygonIdx));while(o!==i.length);if(i.splice(u),i.length!==0&&e.length!==0){i.sort(((y,v)=>y.portalHash<v.portalHash?1:-1));let f=0,_=0;for(;f!==i.length&&_!==e.length;){const y=i[f],v=e[_];y.portalHash>v.hash?f++:v.hash>y.portalHash?_++:(y.type=v.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=$e&&i>=$e}addFeatureSection(e,i,o,a){return e!==i&&(i=e,o.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,o,a){const u=e.slice(i,o);u.sort(a),e.splice(i,u.length,...u)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(qn.computePosHash(e))<<32n|BigInt(qn.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var Pg,Rg={exports:{}},zg=(Pg||(Pg=1,(function(r){function e(W,J){return W>J?1:W<J?-1:0}var i=function(W,J){W===void 0&&(W=e),J===void 0&&(J=!1),this._compare=W,this._root=null,this._size=0,this._noDuplicates=!!J},o={size:{configurable:!0}};function a(W,J,Ie,ke,Ye){var Ke=Ye-ke;if(Ke>0){var ft=ke+Math.floor(Ke/2),mt={key:J[ft],data:Ie[ft],parent:W};return mt.left=a(mt,J,Ie,ke,ft),mt.right=a(mt,J,Ie,ft+1,Ye),mt}return null}function u(W,J,Ie,ke,Ye){if(!(Ie>=ke)){for(var Ke=W[Ie+ke>>1],ft=Ie-1,mt=ke+1;;){do ft++;while(Ye(W[ft],Ke)<0);do mt--;while(Ye(W[mt],Ke)>0);if(ft>=mt)break;var Ct=W[ft];W[ft]=W[mt],W[mt]=Ct,Ct=J[ft],J[ft]=J[mt],J[mt]=Ct}u(W,J,Ie,mt,Ye),u(W,J,mt+1,ke,Ye)}}i.prototype.rotateLeft=function(W){var J=W.right;J&&(W.right=J.left,J.left&&(J.left.parent=W),J.parent=W.parent),W.parent?W===W.parent.left?W.parent.left=J:W.parent.right=J:this._root=J,J&&(J.left=W),W.parent=J},i.prototype.rotateRight=function(W){var J=W.left;J&&(W.left=J.right,J.right&&(J.right.parent=W),J.parent=W.parent),W.parent?W===W.parent.left?W.parent.left=J:W.parent.right=J:this._root=J,J&&(J.right=W),W.parent=J},i.prototype._splay=function(W){for(;W.parent;){var J=W.parent;J.parent?J.left===W&&J.parent.left===J?(this.rotateRight(J.parent),this.rotateRight(J)):J.right===W&&J.parent.right===J?(this.rotateLeft(J.parent),this.rotateLeft(J)):J.left===W&&J.parent.right===J?(this.rotateRight(J),this.rotateLeft(J)):(this.rotateLeft(J),this.rotateRight(J)):J.left===W?this.rotateRight(J):this.rotateLeft(J)}},i.prototype.splay=function(W){for(var J,Ie,ke,Ye,Ke;W.parent;)(Ie=(J=W.parent).parent)&&Ie.parent?((ke=Ie.parent).left===Ie?ke.left=W:ke.right=W,W.parent=ke):(W.parent=null,this._root=W),Ye=W.left,Ke=W.right,W===J.left?(Ie&&(Ie.left===J?(J.right?(Ie.left=J.right,Ie.left.parent=Ie):Ie.left=null,J.right=Ie,Ie.parent=J):(Ye?(Ie.right=Ye,Ye.parent=Ie):Ie.right=null,W.left=Ie,Ie.parent=W)),Ke?(J.left=Ke,Ke.parent=J):J.left=null,W.right=J,J.parent=W):(Ie&&(Ie.right===J?(J.left?(Ie.right=J.left,Ie.right.parent=Ie):Ie.right=null,J.left=Ie,Ie.parent=J):(Ke?(Ie.left=Ke,Ke.parent=Ie):Ie.left=null,W.right=Ie,Ie.parent=W)),Ye?(J.right=Ye,Ye.parent=J):J.right=null,W.left=J,J.parent=W)},i.prototype.replace=function(W,J){W.parent?W===W.parent.left?W.parent.left=J:W.parent.right=J:this._root=J,J&&(J.parent=W.parent)},i.prototype.minNode=function(W){if(W===void 0&&(W=this._root),W)for(;W.left;)W=W.left;return W},i.prototype.maxNode=function(W){if(W===void 0&&(W=this._root),W)for(;W.right;)W=W.right;return W},i.prototype.insert=function(W,J){var Ie=this._root,ke=null,Ye=this._compare;if(this._noDuplicates)for(;Ie;){if(ke=Ie,Ye(Ie.key,W)===0)return;Ie=Ye(Ie.key,W)<0?Ie.right:Ie.left}else for(;Ie;)ke=Ie,Ie=Ye(Ie.key,W)<0?Ie.right:Ie.left;return Ie={key:W,data:J,left:null,right:null,parent:ke},ke?Ye(ke.key,Ie.key)<0?ke.right=Ie:ke.left=Ie:this._root=Ie,this.splay(Ie),this._size++,Ie},i.prototype.find=function(W){for(var J=this._root,Ie=this._compare;J;){var ke=Ie(J.key,W);if(ke<0)J=J.right;else{if(!(ke>0))return J;J=J.left}}return null},i.prototype.contains=function(W){for(var J=this._root,Ie=this._compare;J;){var ke=Ie(W,J.key);if(ke===0)return!0;J=ke<0?J.left:J.right}return!1},i.prototype.remove=function(W){var J=this.find(W);if(!J)return!1;if(this.splay(J),J.left)if(J.right){var Ie=this.minNode(J.right);Ie.parent!==J&&(this.replace(Ie,Ie.right),Ie.right=J.right,Ie.right.parent=Ie),this.replace(J,Ie),Ie.left=J.left,Ie.left.parent=Ie}else this.replace(J,J.left);else this.replace(J,J.right);return this._size--,!0},i.prototype.removeNode=function(W){if(!W)return!1;if(this.splay(W),W.left)if(W.right){var J=this.minNode(W.right);J.parent!==W&&(this.replace(J,J.right),J.right=W.right,J.right.parent=J),this.replace(W,J),J.left=W.left,J.left.parent=J}else this.replace(W,W.left);else this.replace(W,W.right);return this._size--,!0}
7,i.prototype.erase=function(W){var J=this.find(W);if(J){this.splay(J);var Ie=J.left,ke=J.right,Ye=null;Ie&&(Ie.parent=null,Ye=this.maxNode(Ie),this.splay(Ye),this._root=Ye),ke&&(Ie?Ye.right=ke:this._root=ke,ke.parent=Ye),this._size--}},i.prototype.pop=function(){var W=this._root,J=null;if(W){for(;W.left;)W=W.left;J={key:W.key,data:W.data},this.remove(W.key)}return J},i.prototype.next=function(W){var J=W;if(J)if(J.right)for(J=J.right;J&&J.left;)J=J.left;else for(J=W.parent;J&&J.right===W;)W=J,J=J.parent;return J},i.prototype.prev=function(W){var J=W;if(J)if(J.left)for(J=J.left;J&&J.right;)J=J.right;else for(J=W.parent;J&&J.left===W;)W=J,J=J.parent;return J},i.prototype.forEach=function(W){for(var J=this._root,Ie=[],ke=!1,Ye=0;!ke;)J?(Ie.push(J),J=J.left):Ie.length>0?(W(J=Ie.pop(),Ye++),J=J.right):ke=!0;return this},i.prototype.range=function(W,J,Ie,ke){for(var Ye=[],Ke=this._compare,ft=this._root;Ye.length!==0||ft;)if(ft)Ye.push(ft),ft=ft.left;else{if(Ke((ft=Ye.pop()).key,J)>0)break;if(Ke(ft.key,W)>=0&&Ie.call(ke,ft))return this;ft=ft.right}return this},i.prototype.keys=function(){for(var W=this._root,J=[],Ie=[],ke=!1;!ke;)W?(J.push(W),W=W.left):J.length>0?(W=J.pop(),Ie.push(W.key),W=W.right):ke=!0;return Ie},i.prototype.values=function(){for(var W=this._root,J=[],Ie=[],ke=!1;!ke;)W?(J.push(W),W=W.left):J.length>0?(W=J.pop(),Ie.push(W.data),W=W.right):ke=!0;return Ie},i.prototype.at=function(W){for(var J=this._root,Ie=[],ke=!1,Ye=0;!ke;)if(J)Ie.push(J),J=J.left;else if(Ie.length>0){if(J=Ie.pop(),Ye===W)return J;Ye++,J=J.right}else ke=!0;return null},i.prototype.load=function(W,J,Ie){if(W===void 0&&(W=[]),J===void 0&&(J=[]),Ie===void 0&&(Ie=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var ke=W.length;return Ie&&u(W,J,0,ke-1,this._compare),this._root=a(null,W,J,0,ke),this._size=ke,this},i.prototype.min=function(){var W=this.minNode(this._root);return W?W.key:null},i.prototype.max=function(){var W=this.maxNode(this._root);return W?W.key:null},i.prototype.isEmpty=function(){return this._root===null},o.size.get=function(){return this._size},i.createTree=function(W,J,Ie,ke,Ye){return new i(Ie,Ye).load(W,J,ke)},Object.defineProperties(i.prototype,o);var h=0,f=1,_=2,y=3,v=0,b=1,T=2,E=3;function I(W,J,Ie){J===null?(W.inOut=!1,W.otherInOut=!0):(W.isSubject===J.isSubject?(W.inOut=!J.inOut,W.otherInOut=J.otherInOut):(W.inOut=!J.otherInOut,W.otherInOut=J.isVertical()?!J.inOut:J.inOut),J&&(W.prevInResult=!P(J,Ie)||J.isVertical()?J.prevInResult:J));var ke=P(W,Ie);W.resultTransition=ke?(function(Ye,Ke){var ft,mt=!Ye.inOut,Ct=!Ye.otherInOut;switch(Ke){case v:ft=mt&&Ct;break;case b:ft=mt||Ct;break;case E:ft=mt^Ct;break;case T:ft=Ye.isSubject?mt&&!Ct:Ct&&!mt}return ft?1:-1})(W,Ie):0}function P(W,J){switch(W.type){case h:switch(J){case v:return!W.otherInOut;case b:return W.otherInOut;case T:return W.isSubject&&W.otherInOut||!W.isSubject&&!W.otherInOut;case E:return!0}break;case _:return J===v||J===b;case y:return J===T;case f:return!1}return!1}var L=function(W,J,Ie,ke,Ye){this.left=J,this.point=W,this.otherEvent=Ie,this.isSubject=ke,this.type=Ye||h,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},D={inResult:{configurable:!0}};function B(W,J){return W[0]===J[0]&&W[1]===J[1]}L.prototype.isBelow=function(W){var J=this.point,Ie=this.otherEvent.point;return this.left?(J[0]-W[0])*(Ie[1]-W[1])-(Ie[0]-W[0])*(J[1]-W[1])>0:(Ie[0]-W[0])*(J[1]-W[1])-(J[0]-W[0])*(Ie[1]-W[1])>0},L.prototype.isAbove=function(W){return!this.isBelow(W)},L.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},D.inResult.get=function(){return this.resultTransition!==0},L.prototype.clone=function(){var W=new L(this.point,this.left,this.otherEvent,this.isSubject,this.type);return W.contourId=this.contourId,W.resultTransition=this.resultTransition,W.prevInResult=this.prevInResult,W.isExteriorRing=this.isExteriorRing,W.inOut=this.inOut,W.otherInOut=this.otherInOut,W},Object.defineProperties(L.prototype,D);var V=11102230246251565e-32,G=134217729,K=(3+8*V)*V;function Z(W,J,Ie,ke,Ye){var Ke,ft,mt,Ct,kt=J[0],Nt=ke[0],Gt=0,bt=0;Nt>kt==Nt>-kt?(Ke=kt,kt=J[++Gt]):(Ke=Nt,Nt=ke[++bt]);var Et=0;
7if(Gt<W&&bt<Ie)for(Nt>kt==Nt>-kt?(mt=Ke-((ft=kt+Ke)-kt),kt=J[++Gt]):(mt=Ke-((ft=Nt+Ke)-Nt),Nt=ke[++bt]),Ke=ft,mt!==0&&(Ye[Et++]=mt);Gt<W&&bt<Ie;)Nt>kt==Nt>-kt?(mt=Ke-((ft=Ke+kt)-(Ct=ft-Ke))+(kt-Ct),kt=J[++Gt]):(mt=Ke-((ft=Ke+Nt)-(Ct=ft-Ke))+(Nt-Ct),Nt=ke[++bt]),Ke=ft,mt!==0&&(Ye[Et++]=mt);for(;Gt<W;)mt=Ke-((ft=Ke+kt)-(Ct=ft-Ke))+(kt-Ct),kt=J[++Gt],Ke=ft,mt!==0&&(Ye[Et++]=mt);for(;bt<Ie;)mt=Ke-((ft=Ke+Nt)-(Ct=ft-Ke))+(Nt-Ct),Nt=ke[++bt],Ke=ft,mt!==0&&(Ye[Et++]=mt);return Ke===0&&Et!==0||(Ye[Et++]=Ke),Et}function ee(W){return new Float64Array(W)}var ne=33306690738754716e-32,ae=22204460492503146e-32,be=11093356479670487e-47,he=ee(4),Ee=ee(8),Ce=ee(12),Pe=ee(16),Fe=ee(4);function Be(W,J,Ie){var ke=(function(Ye,Ke,ft,mt,Ct,kt){var Nt=(Ke-kt)*(ft-Ct),Gt=(Ye-Ct)*(mt-kt),bt=Nt-Gt;if(Nt===0||Gt===0||Nt>0!=Gt>0)return bt;var Et=Math.abs(Nt+Gt);return Math.abs(bt)>=ne*Et?bt:-(function(ti,ai,li,vi,Ci,Ei,ui){var pi,Bt,Wt,qi,xt,Ht,Ii,Ri,Oi,mr,zi,vt,Ki,bi,ji,Pr,Nr,wr,Tr=ti-Ci,Lr=li-Ci,Pn=ai-Ei,Di=vi-Ei;he[0]=(ji=(Ri=Tr-(Ii=(Ht=G*Tr)-(Ht-Tr)))*(mr=Di-(Oi=(Ht=G*Di)-(Ht-Di)))-((bi=Tr*Di)-Ii*Oi-Ri*Oi-Ii*mr))-((zi=ji-(Nr=(Ri=Pn-(Ii=(Ht=G*Pn)-(Ht-Pn)))*(mr=Lr-(Oi=(Ht=G*Lr)-(Ht-Lr)))-((Pr=Pn*Lr)-Ii*Oi-Ri*Oi-Ii*mr)))+(xt=ji-zi))+(xt-Nr),he[1]=(Ki=bi-((vt=bi+zi)-(xt=vt-bi))+(zi-xt))-((zi=Ki-Pr)+(xt=Ki-zi))+(xt-Pr),he[2]=vt-((wr=vt+zi)-(xt=wr-vt))+(zi-xt),he[3]=wr;var hr=(function(qs,Jr){for(var bn=Jr[0],Zn=1;Zn<4;Zn++)bn+=Jr[Zn];return bn})(0,he),_r=ae*ui;if(hr>=_r||-hr>=_r||(pi=ti-(Tr+(xt=ti-Tr))+(xt-Ci),Wt=li-(Lr+(xt=li-Lr))+(xt-Ci),Bt=ai-(Pn+(xt=ai-Pn))+(xt-Ei),qi=v
7i-(Di+(xt=vi-Di))+(xt-Ei),pi===0&&Bt===0&&Wt===0&&qi===0)||(_r=be*ui+K*Math.abs(hr),(hr+=Tr*qi+Di*pi-(Pn*Wt+Lr*Bt))>=_r||-hr>=_r))return hr;Fe[0]=(ji=(Ri=pi-(Ii=(Ht=G*pi)-(Ht-pi)))*(mr=Di-(Oi=(Ht=G*Di)-(Ht-Di)))-((bi=pi*Di)-Ii*Oi-Ri*Oi-Ii*mr))-((zi=ji-(Nr=(Ri=Bt-(Ii=(Ht=G*Bt)-(Ht-Bt)))*(mr=Lr-(Oi=(Ht=G*Lr)-(Ht-Lr)))-((Pr=Bt*Lr)-Ii*Oi-Ri*Oi-Ii*mr)))+(xt=ji-zi))+(xt-Nr),Fe[1]=(Ki=bi-((vt=bi+zi)-(xt=vt-bi))+(zi-xt))-((zi=Ki-Pr)+(xt=Ki-zi))+(xt-Pr),Fe[2]=vt-((wr=vt+zi)-(xt=wr-vt))+(zi-xt),Fe[3]=wr;var Fn=Z(4,he,4,Fe,Ee);Fe[0]=(ji=(Ri=Tr-(Ii=(Ht=G*Tr)-(Ht-Tr)))*(mr=qi-(Oi=(Ht=G*qi)-(Ht-qi)))-((bi=Tr*qi)-Ii*Oi-Ri*Oi-Ii*mr))-((zi=ji-(Nr=(Ri=Pn-(Ii=(Ht=G*Pn)-(Ht-Pn)))*(mr=Wt-(Oi=(Ht=G*Wt)-(Ht-Wt)))-((Pr=Pn*Wt)-Ii*Oi-Ri*Oi-Ii*mr)))+(xt=ji-zi))+(xt-Nr),Fe[1]=(Ki=bi-((vt=bi+zi)-(xt=vt-bi))+(zi-xt))-((zi=Ki-Pr)+(xt=Ki-zi))+(xt-Pr),Fe[2]=vt-((wr=vt+zi)-(xt=wr-vt))+(zi-xt),Fe[3]=wr;var Rr=Z(Fn,Ee,4,Fe,Ce);Fe[0]=(ji=(Ri=pi-(Ii=(Ht=G*pi)-(Ht-pi)))*(mr=qi-(Oi=(Ht=G*qi)-(Ht-qi)))-((bi=pi*qi)-Ii*Oi-Ri*Oi-Ii*mr))-((zi=ji-(Nr=(Ri=Bt-(Ii=(Ht=G*Bt)-(Ht-Bt)))*(mr=Wt-(Oi=(Ht=G*Wt)-(Ht-Wt)))-((Pr=Bt*Wt)-Ii*Oi-Ri*Oi-Ii*mr)))+(xt=ji-zi))+(xt-Nr),Fe[1]=(Ki=bi-((vt=bi+zi)-(xt=vt-bi))+(zi-xt))-((zi=Ki-Pr)+(xt=Ki-zi))+(xt-Pr),Fe[2]=vt-((wr=vt+zi)-(xt=wr-vt))+(zi-xt),Fe[3]=wr;var jo=Z(Rr,Ce,4,Fe,Pe);return Pe[jo-1]})(Ye,Ke,ft,mt,Ct,kt,Et)})(W[0],W[1],J[0],J[1],Ie[0],Ie[1]);return ke>0?-1:ke<0?1:0}function ze(W,J){var Ie=W.point,ke=J.point;return Ie[0]>ke[0]?1:Ie[0]<ke[0]?-1:Ie[1]!==ke[1]?Ie[1]>ke[1]?1:-1:(function(Ye,Ke,ft,mt){return Ye.left!==Ke.left?Ye.left?1:-1:Be(ft,Ye.otherEvent.point,Ke.otherEvent.point)!==0?Ye.isBelow(Ke.otherEvent.point)?-1:1:!Ye.isSubject&&Ke.isSubject?1:-1})(W,J,Ie)}function De(W,J,Ie){var ke=new L(J,!1,W,W.isSubject),Ye=new L(J,!0,W.otherEvent,W.isSubject);return B(W.point,W.otherEvent.point)&&console.warn("what is that, a collapsed segment?",W),ke.contourId=Ye.contourId=W.contourId,ze(Ye,W.otherEvent)>0&&(W.otherEvent.left=!0,Ye.left=!1),W.otherEvent.otherEvent=Ye,W.otherEvent=ke,Ie.push(Ye),Ie.push(ke),Ie}function Se(W,J){return W[0]*J[1]-W[1]*J[0]}function we(W,J){return W[0]*J[0]+W[1]*J[1]}function Le(W,J,Ie){var ke=(function(Ct,kt,Nt,Gt,bt){var Et=[kt[0]-Ct[0],kt[1]-Ct[1]],ti=[Gt[0]-Nt[0],Gt[1]-Nt[1]];function ai(Ht,Ii,Ri){return[Ht[0]+Ii*Ri[0],Ht[1]+Ii*Ri[1]]}var li=[Nt[0]-Ct[0],Nt[1]-Ct[1]],vi=Se(Et,ti),Ci=vi*vi,Ei=we(Et,Et);if(Ci>0){var ui=Se(li,ti)/vi;if(ui<0||ui>1)return null;var pi=Se(li,Et)/vi;return pi<0||pi>1?null:ui===0||ui===1?[ai(Ct,ui,Et)]:pi===0||pi===1?[ai(Nt,pi,ti)]:[ai(Ct,ui,Et)]}if((Ci=(vi=Se(li,Et))*vi)>0)return null;var Bt=we(Et,li)/Ei,Wt=Bt+we(Et,ti)/Ei,qi=Math.min(Bt,Wt),xt=Math.max(Bt,Wt);return qi<=1&&xt>=0?qi===1?[ai(Ct,qi>0?qi:0,Et)]:xt===0?[ai(Ct,xt<1?xt:1,Et)]:[ai(Ct,qi>0?qi:0,Et),ai(Ct,xt<1?xt:1,Et)]:null})(W.point,W.otherEvent.point,J.point,J.otherEvent.point),Ye=ke?ke.length:0;if(Ye===0||Ye===1&&(B(W.point,J.point)||B(W.otherEvent.point,J.otherEvent.point))||Ye===2&&W.isSubject===J.isSubject)return 0;if(Ye===1)return B(W.point,ke[0])||B(W.otherEvent.point,ke[0])||De(W,ke[0],Ie),B(J.point,ke[0])||B(J.otherEvent.point,ke[0])||De(J,ke[0],Ie),1;var Ke=[],ft=!1,mt=!1;return B(W.point,J.point)?ft=!0:ze(W,J)===1?Ke.push(J,W):Ke.push(W,J),B(W.otherEvent.point,J.otherEvent.point)?mt=!0:ze(W.otherEvent,J.otherEvent)===1?Ke.push(J.otherEvent,W.otherEvent):Ke.push(W.otherEvent,J.otherEvent),ft&&mt||ft?(J.type=f,W.type=J.inOut===W.inOut?_:y,ft&&!mt&&De(Ke[1].otherEvent,Ke[0].point,Ie),2):mt?(De(Ke[0],Ke[1].point,Ie),3):Ke[0]!==Ke[3].otherEvent?(De(Ke[0],Ke[1].point,Ie),De(Ke[1],Ke[2].point,Ie),3):(De(Ke[0],Ke[1].point,Ie),De(Ke[3].otherEvent,Ke[2].point,Ie),3)}function Ze(W,J){if(W===J)return 0;if(Be(W.point,W.otherEvent.point,J.point)!==0||Be(W.point,W.otherEvent.point,J.otherEvent.point)!==0)return B(W.point,J.point)?W.isBelow(J.otherEvent.point)?-1:1:W.point[0]===J.point[0]?W.point[1]<J.point[1]?-1:1:ze(W,J)===1?J.isAbove(W.point)?-1:1:W.isBelow(J.point)?-1:1;if(W.isSubject!==J.isSubject)return W.isSubject?-1:1;var Ie=W.point,ke=J.point;return Ie[0]===ke[0]&&Ie[1]===ke[1]?(Ie=W.otherEvent.point)[0]===(ke=J.otherEvent.point)[0]&&Ie[1]===ke[1]?0:W.contourId>J.contourId?1:-1:ze(W,J)===1?1:-1}var je=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function dt(W,J,Ie,ke){var Ye,Ke=W+1,ft=J[W].point,mt=J.length;for(Ke<mt&&(Ye=J[Ke].point);Ke<mt&&Ye[0]===ft[0]&&Ye[1]===ft[1];){if(!Ie[Ke])return Ke;++Ke<mt&&(Ye=J[Ke].point)}for(Ke=W-1;Ie[Ke]&&Ke>ke;)Ke--;return Ke}je.prototype.isExterior=function(){return this.holeOf==null};var Qe=at,rt=at;function at(W,J){if(!(this instanceof at))return new at(W,J);if(this.data=W||[],this.length=this.data.length,this.compare=J||Ut,this.length>0)for(var Ie=(this.length>>1)-1;Ie>=0;Ie--)this._down(Ie)}function Ut(W,J){return W<J?-1:W>J?1:0}at.prototype={push:function(W){this.data.push(W),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var W=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),W}},peek:function(){return this.data[0]},_up:function(W){for(var J=this.data,Ie=this.compare,ke=J[W];W>0;){var Ye=W-1>>1,Ke=J[Ye];if(Ie(ke,Ke)>=0)break;J[W]=Ke,W=Ye}J[W]=ke},_down:function(W){for(var J=this.data,Ie=this.compare,ke=this.length>>1,Ye=J[W];W<ke;){var Ke=1+(W<<1),ft=Ke+1,mt=J[Ke];if(ft<this.length&&Ie(J[ft],mt)<0&&(Ke=ft,mt=J[ft]),Ie(mt,Ye)>=0)break;J[W]=mt,W=Ke}J[W]=Ye}},Qe.default=rt;var Ge=Math.max,lt=Math.min,It=0;function Zt(W,J,Ie,ke,Ye,Ke){var ft,mt,Ct,kt,Nt,Gt;for(ft=0,mt=W.length-1;ft<mt;ft++)if(kt=W[ft+1],Nt=new L(Ct=W[ft],!1,void 0,J),Gt=new L(kt,!1,Nt,J),Nt.otherEvent=Gt,Ct[0]!==kt[0]||Ct[1]!==kt[1]){Nt.contourId=Gt.contourId=Ie,Ke||(Nt.isExteriorRing=!1,Gt.isExteriorRing=!1),ze(Nt,Gt)>0?Gt.left=!0:Nt.left=!0;var bt=Ct[0],Et=Ct[1];Ye[0]=lt(Ye[0],bt),Ye[1]=lt(Ye[1],Et),Ye[2]=Ge(Ye[2],bt),Ye[3]=Ge(Ye[3],Et),ke.push(Nt),ke.push(Gt)}}var Xt=[];function Rt(W,J,Ie){typeof W[0][0][0]=="number"&&(W=[W]),typeof J[0][0][0]=="number"&&(J=[J]);var ke=(function(Et,ti,ai){var li=null;return Et.length*ti.length==0&&(ai===v?li=Xt:ai===T?li=Et:ai!==b&&ai!==E||(li=Et.length===0?ti:Et)),li})(W,J,Ie);if(ke)return ke===Xt?null:ke;
7var Ye=[1/0,1/0,-1/0,-1/0],Ke=[1/0,1/0,-1/0,-1/0],ft=(function(Et,ti,ai,li,vi){var Ci,Ei,ui,pi,Bt,Wt,qi=new Qe(null,ze);for(ui=0,pi=Et.length;ui<pi;ui++)for(Bt=0,Wt=(Ci=Et[ui]).length;Bt<Wt;Bt++)(Ei=Bt===0)&&It++,Zt(Ci[Bt],!0,It,qi,ai,Ei);for(ui=0,pi=ti.length;ui<pi;ui++)for(Bt=0,Wt=(Ci=ti[ui]).length;Bt<Wt;Bt++)Ei=Bt===0,vi===T&&(Ei=!1),Ei&&It++,Zt(Ci[Bt],!1,It,qi,li,Ei);return qi})(W,J,Ye,Ke,Ie);if(ke=(function(Et,ti,ai,li,vi){var Ci=null;return(ai[0]>li[2]||li[0]>ai[2]||ai[1]>li[3]||li[1]>ai[3])&&(vi===v?Ci=Xt:vi===T?Ci=Et:vi!==b&&vi!==E||(Ci=Et.concat(ti))),Ci})(W,J,Ye,Ke,Ie))return ke===Xt?null:ke;for(var mt=(function(Et){var ti,ai,li=(function(ui){var pi,Bt,Wt,qi,xt=[];for(Bt=0,Wt=ui.length;Bt<Wt;Bt++)((pi=ui[Bt]).left&&pi.inResult||!pi.left&&pi.otherEvent.inResult)&&xt.push(pi);for(var Ht=!1;!Ht;)for(Ht=!0,Bt=0,Wt=xt.length;Bt<Wt;Bt++)Bt+1<Wt&&ze(xt[Bt],xt[Bt+1])===1&&(qi=xt[Bt],xt[Bt]=xt[Bt+1],xt[Bt+1]=qi,Ht=!1);for(Bt=0,Wt=xt.length;Bt<Wt;Bt++)(pi=xt[Bt]).otherPos=Bt;for(Bt=0,Wt=xt.length;Bt<Wt;Bt++)(pi=xt[Bt]).left||(qi=pi.otherPos,pi.otherPos=pi.otherEvent.otherPos,pi.otherEvent.otherPos=qi);return xt})(Et),vi={},Ci=[],Ei=function(){if(!vi[ti]){var ui=Ci.length,pi=(function(xt,Ht,Ii){var Ri=new je;if(xt.prevInResult!=null){var Oi=xt.prevInResult,mr=Oi.outputContourId;if(Oi.resultTransition>0){var zi=Ht[mr];if(zi.holeOf!=null){var vt=zi.holeOf;Ht[vt].holeIds.push(Ii),Ri.holeOf=vt,Ri.depth=Ht[mr].depth}else Ht[mr].holeIds.push(Ii),Ri.holeOf=mr,Ri.depth=Ht[mr].depth+1}else Ri.holeOf=null,Ri.depth=Ht[mr].depth}else Ri.holeOf=null,Ri.depth=0;return Ri})(li[ti],Ci,ui),Bt=function(xt){vi[xt]=!0,xt<li.length&&li[xt]&&(li[xt].outputContourId=ui)},Wt=ti,qi=ti;for(pi.points.push(li[ti].point);Bt(Wt),Bt(Wt=li[Wt].otherPos),pi.points.push(li[Wt].point),!((Wt=dt(Wt,li,vi,qi))==qi||Wt>=li.length)&&li[Wt];);Ci.push(pi)}};for(ti=0,ai=li.length;ti<ai;ti++)Ei();return Ci})((function(Et,ti,ai,li,vi,Ci){for(var Ei,ui,pi,Bt=new i(Ze),Wt=[],qi=Math.min(li[2],vi[2]);Et.length!==0;){var xt=Et.pop();if(Wt.push(xt),Ci===v&&xt.point[0]>qi||Ci===T&&xt.point[0]>li[2])break;if(xt.left){ui=Ei=Bt.insert(xt),Ei=Ei!==(pi=Bt.minNode())?Bt.prev(Ei):null,ui=Bt.next(ui);var Ht=Ei?Ei.key:null;if(I(xt,Ht,Ci),ui&&Le(xt,ui.key,Et)===2&&(I(xt,Ht,Ci),I(ui.key,xt,Ci)),Ei&&Le(Ei.key,xt,Et)===2){var Ii=Ei;I(Ht,(Ii=Ii!==pi?Bt.prev(Ii):null)?Ii.key:null,Ci),I(xt,Ht,Ci)}}else ui=Ei=Bt.find(xt=xt.otherEvent),Ei&&ui&&(Ei=Ei!==pi?Bt.prev(Ei):null,ui=Bt.next(ui),Bt.remove(xt),ui&&Ei&&Le(Ei.key,ui.key,Et))}return Wt})(ft,0,0,Ye,Ke,Ie)),Ct=[],kt=0;kt<mt.length;kt++){var Nt=mt[kt];if(Nt.isExterior()){for(var Gt=[Nt.points],bt=0;bt<Nt.holeIds.length;bt++)Gt.push(mt[Nt.holeIds[bt]].points);Ct.push(Gt)}}return Ct}var Si={UNION:b,DIFFERENCE:T,INTERSECTION:v,XOR:E};r.diff=function(W,J){return Rt(W,J,T)},r.intersection=function(W,J){return Rt(W,J,v)},r.operations=Si,r.union=function(W,J){return Rt(W,J,b)},r.xor=function(W,J){return Rt(W,J,E)},Object.defineProperty(r,"__esModule",{value:!0})})(Rg.exports)),Rg.exports);function cp(r,e,i,o){const a=[],u=o===0?(h,f,_,y,v,b)=>{h.push(new Oe(b,_+(b-f)/(y-f)*(v-_)))}:(h,f,_,y,v,b)=>{h.push(new Oe(f+(b-_)/(v-_)*(y-f),b))};for(const h of r){const f=[];for(const _ of h){if(_.length<=2)continue;const y=[];for(let T=0;T<_.length-1;T++){const E=_[T].x,I=_[T].y,P=_[T+1].x,L=_[T+1].y,D=o===0?E:I,B=o===0?P:L;D<e?B>e&&u(y,E,I,P,L,e):D>i?B<i&&u(y,E,I,P,L,i):y.push(_[T]),B<e&&D>=e&&u(y,E,I,P,L,e),B>i&&D<=i&&u(y,E,I,P,L,i)}let v=_[_.length-1];const b=o===0?v.x:v.y;b>=e&&b<=i&&y.push(v),y.length&&(v=y[y.length-1],y[0].x===v.x&&y[0].y===v.y||y.push(y[0]),f.push(y))}f.length&&a.push(f)}return a}function C0(r,e){const i=$m(r),o=$m([e]),a=zg.intersection(i,o);return a==null?[]:Dg(a)}function P0(r,e){let o=$m(r,65536);const a=[];for(;e.valid();e.next()){const[u,h]=e.get(),f=u.x*65536,_=u.y*65536,y=h.x*65536,v=h.y*65536,b=y-f,T=v-_,E=Math.hypot(b,T);if(E===0)continue;const I=Math.trunc(T/E*3),P=-Math.trunc(b/E*3);a.push([[[f,_],[y,v],[y+I,v+P],[f+I,_+P],[f,_]]])}return a.length>0&&(o=zg.diff(o,a)),Dg(o,1/65536)}function $m(r,e=1){return[r.map((i=>i.map((o=>[o.x*e,o.y*e]))))]}function Dg(r,e=1){return r.map((i=>i.map(((o,a)=>{const u=o.map((h=>new Oe(h[0]*e,h[1]*e).round()));return a>0&&u.reverse(),u}))))}class Zm{constructor(e,i){this.layoutVertexArray=new Bs,this.indexArray=new Ar,this.lineIndexArray=new Gn,this.triangleSegments=new Wi,this.lineSegments=new Wi,this.programConfigurations=new vo(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new rs)}update(e,i,o,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,o,a,h,f,_)}
7isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,p0.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,m0.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,o,a,u,h,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,a,u,h,void 0,f)}}class Wm{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 Zm(e,!1),this.elevationBufferData=new Zm(e,!0),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){this.hasPattern=Hm("fill",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:f,id:_,index:y,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,T=ue(f,b);if(!this.layers[0]._featureFilter.filter(new Li(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),T,o))continue;const E=u?u.evaluate(T,{},o,i.availableImages):void 0,I={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:y,geometry:b?T.geometry:ie(f,o,a),patterns:{},sortKey:E};h.push(I)}u&&h.sort(((f,_)=>f.sortKey-_.sortKey));for(const f of h){const{geometry:_,index:y,sourceLayerIndex:v}=f;if(this.hasPattern){const b=qm("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,_,y,o,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[y].feature,_,y,v,this.index)}}update(e,i,o,a,u,h,f){this.bufferData.update(e,i,o,a,u,h,f,this.worldview),this.elevationBufferData.update(e,i,o,a,u,h,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,o,a,u,h,f,this.worldview)}addFeatures(e,i,o,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,o,a,h,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,i,o,a,u,h=[],f,_){const y=gd(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,y,a,o,_):this.addGeometry(y,this.bufferData),this.bufferData.populatePaintArrays(e,o,u,h,a,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,o,u,h,a,f,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e,i,o,a,u){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,o,a,u,this.worldview))}addElevatedRoadFeature(e,i,o,a,u){const h=new Array,f=di.getElevationFeature(e,u);if(!f)return void this.addGeometry(i,this.bufferData);{const y=this.clipPolygonsToTile(i,1);y.length>0&&h.push({polygons:y,elevationFeature:f,elevationTileID:o})}const _={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},o),featureIndex:a};for(const y of h)if(y.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new qn(y.elevationTileID,this.layers,this.zoom,this.lut));const b=y.elevationFeature.isTunnel();let T=0;e.properties.hasOwnProperty(_e)&&(T=+e.properties[_e]);for(const E of y.polygons)this.elevatedStructures.addPortalCandidates(y.elevationFeature.i
7d,E,b,y.elevationFeature,T)}y.elevationFeature.constantHeight==null&&(y.polygons=this.prepareElevatedPolygons(y.polygons,y.elevationFeature,y.elevationTileID));const v=new Ti(o,y.elevationTileID);this.addElevatedGeometry(y.polygons,v,y.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,_)}}addElevatedGeometry(e,i,o,a,u,h){const f={elevation:o,elevationSampler:i,bias:a,index:u,featureInfo:h},[_,y]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:_,max:y}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,_),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,y))}addGeometry(e,i,o){let a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,h=null;o&&(h=o.elevationSampler.constantElevation(o.elevation,o.bias),h!=null&&(a=h,u=h));const f=(_,y,v)=>{if(o!=null)if(y.push(_),h!=null)i.elevatedLayoutVertexArray.emplaceBack(h),v.push(h);else{const b=o.elevationSampler.pointElevation(_,o.elevation,o.bias);i.elevatedLayoutVertexArray.emplaceBack(b),v.push(b),a=Math.min(a,b),u=Math.max(u,b)}};for(const _ of e){let y=0;for(const V of _)y+=V.length;const v=i.triangleSegments.prepareSegment(y,i.layoutVertexArray,i.indexArray),b=v.vertexLength,T=[],E=[],I=[],P=[],L=[],D=i.layoutVertexArray.length;for(const V of _){if(V.length===0)continue;V!==_[0]&&E.push(T.length/2);const G=i.lineSegments.prepareSegment(V.length,i.layoutVertexArray,i.lineIndexArray),K=G.vertexLength;o&&L.push(i.layoutVertexArray.length-D),f(V[0],I,P),i.layoutVertexArray.emplaceBack(V[0].x,V[0].y),i.lineIndexArray.emplaceBack(K+V.length-1,K),T.push(V[0].x),T.push(V[0].y);for(let Z=1;Z<V.length;Z++)f(V[Z],I,P),i.layoutVertexArray.emplaceBack(V[Z].x,V[Z].y),i.lineIndexArray.emplaceBack(K+Z-1,K+Z),T.push(V[Z].x),T.push(V[Z].y);G.vertexLength+=V.length,G.primitiveLength+=V.length}const B=Ou(T,E);for(let V=0;V<B.length;V+=3)i.indexArray.emplaceBack(b+B[V],b+B[V+1],b+B[V+2]);if(B.length>0&&o&&this.elevationMode==="hd-road-base"){const V=o.elevation.isTunnel(),G=o.elevation.safeArea,K=this.elevatedStructures.addVertices(I,P);this.elevatedStructures.addTriangles(B,K,V);const Z=L.length;if(Z>0){for(let ee=0;ee<Z-1;ee++)this.elevatedStructures.addRenderableRing(o.index,L[ee]+K,L[ee+1]-L[ee],V,G,o.featureInfo);this.elevatedStructures.addRenderableRing(o.index,L[Z-1]+K,I.length-L[Z-1],V,G,o.featureInfo)}}v.vertexLength+=y,v.primitiveLength+=B.length/3}return[a,u]}prepareElevatedPolygons(e,i,o){const a=1/F(o),u=[];for(const h of e){const f=P0(h,new si(i,a));u.push(...f)}return u}clipPolygonsToTile(e,i){const o=-i,a=-i,u=$e+i,h=$e+i;let f=0;const _=[],y=[];for(;f<e.length;f++){const T=e[f],E=Ko(T);(E.min.x>=o&&E.max.x<=u&&E.min.y>=a&&E.max.y<=h?_:y).push(T)}if(_.length===e.length)return e;const v=[new Oe(o,a),new Oe(u,a),new Oe(u,h),new Oe(o,h),new Oe(o,a)],b=_;for(const T of y)b.push(...C0(T,v));return b}}let Lg,Og,Fg,kg;ot(Wm,"FillBucket",{omit:["layers","patternFeatures"]}),ot(Zm,"FillBufferData"),ot(qn,"ElevatedStructures");class up{constructor(e,i,o,a){if(this.triangleCount=i.length/3,this.min=new Oe(0,0),this.max=new Oe(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[u,h]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const T=e[b];u.x=Math.min(u.x,T.x),u.y=Math.min(u.y,T.y),h.x=Math.max(h.x,T.x),h.y=Math.max(h.y,T.y)}if(a){const b=Math.ceil(Math.max(h.x-u.x,h.y-u.y)/a);o=Math.max(o,b)}if(o===0)return;this.min=u,this.max=h;const f=this.max.sub(this.min);f.x=Math.max(f.x,1),f.y=Math.max(f.y,1);const _=Math.max(f.x,f.y)/o;this.cellsX=Math.max(1,Math.ceil(f.x/_)),this.cellsY=Math.max(1,Math.ceil(f.y/_)),this.xScale=1/_,this.yScale=1/_;const y=[];for(let b=0;b<this.triangleCount;b++){const T=e[i[3*b+0]].sub(this.min),E=e[i[3*b+1]].sub(this.min),I=e[i[3*b+2]].sub(this.min),P=Gs(Math.floor(Math.min(T.x,E.x,I.x)),this.xScale,this.cellsX),L=Gs(Math.floor(Math.max(T.x,E.x,I.x)),this.xScale,this.cellsX),D=Gs(Math.floor(Math.min(T.y,E.y,I.y)),this.yScale,this.cellsY),B=Gs(Math.floor(Math.max(T.y,E.y,I.y)),this.yScale,this.cellsY),V=new Oe(0,0),G=new Oe(0,0),K=new Oe(0,0),Z=new Oe(0,0);for(let ee=D;ee<=B;++ee){V.y=G.y=ee*_,K.y=Z.y=(ee+1)*_;for(let ne=P;ne<=L;++ne)V.x=K.x=ne*_,G.x=Z.x=(ne+1)*_,(sn(T,E,I,V,G,Z)||sn(T,E,I,V,Z,K))&&y.push({cellIdx:ee*this.cellsX+ne,triIdx:b})}}if(y.length===0)return;y.sort(((b,T)=>b.cellIdx-T.cellIdx||b.triIdx-T.triIdx));let v=0;for(;v<y.length;){const b=y[v].cellIdx,T={start:this.payload.length,len:0};for(;
7v<y.length&&y[v].cellIdx===b;)++T.len,this.payload.push(y[v++].triIdx);this.cells[b]=T}}_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 o=Gs(e.x-this.min.x,this.xScale,this.cellsX),a=Gs(e.y-this.min.y,this.yScale,this.cellsY),u=this.cells[a*this.cellsX+o];if(u){this._lazyInitLookup();for(let h=0;h<u.len;h++){const f=this.payload[u.start+h],_=Math.floor(f/8),y=1<<f%8;if(!(this.lookup[_]&y)&&(this.lookup[_]|=y,i.push(f),i.length===this.triangleCount))return}}}query(e,i,o){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=Gs(e.x-this.min.x,this.xScale,this.cellsX),u=Gs(i.x-this.min.x,this.xScale,this.cellsX),h=Gs(e.y-this.min.y,this.yScale,this.cellsY),f=Gs(i.y-this.min.y,this.yScale,this.cellsY);for(let _=h;_<=f;_++)for(let y=a;y<=u;y++){const v=this.cells[_*this.cellsX+y];if(v)for(let b=0;b<v.len;b++){const T=this.payload[v.start+b],E=Math.floor(T/8),I=1<<T%8;if(!(this.lookup[E]&I)&&(this.lookup[E]|=I,o.push(T),o.length===this.triangleCount))return}}}}function Gs(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}ot(up,"TriangleGridIndex");class Bg{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.fqid)),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){for(const o of this.footprints)i.push({footprint:o,id:e})}updateAppearances(e,i,o,a){}populate(e,i,o,a){const u=[];for(const{feature:h,id:f,index:_,sourceLayerIndex:y}of e){const v=this.layers[0]._featureFilter.needGeometry,b=ue(h,v);if(!this.layers[0]._featureFilter.filter(new Li(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),b,o))continue;const T={id:f,properties:h.properties,type:h.type,sourceLayerIndex:y,index:_,geometry:v?b.geometry:ie(h,o,a),patterns:{}};u.push(T)}for(const h of u){const{geometry:f,index:_,sourceLayerIndex:y}=h;this.addFeature(h,f,_,o,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,f,_,y,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,o,a,u,h,f){}destroy(){}addFeature(e,i,o,a,u,h=[],f){for(const _ of gd(i,2)){const y=[],v=[],b=[],T=new Oe(1/0,1/0),E=new Oe(-1/0,-1/0);for(const L of _)if(L.length!==0){L!==_[0]&&b.push(v.length/2);for(let D=0;D<L.length;D++)v.push(L[D].x),v.push(L[D].y),y.push(L[D]),T.x=Math.min(T.x,L[D].x),T.y=Math.min(T.y,L[D].y),E.x=Math.max(E.x,L[D].x),E.y=Math.max(E.y,L[D].y)}const I=Ou(v,b),P=new up(y,I,8,256);this.footprints.push({vertices:y,indices:I,grid:P,min:T,max:E})}}}ot(Bg,"ClipBucket",{omit:["layers"]});const R0=jt([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),z0=jt([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),D0=jt([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),L0=jt([{name:"a_centroid_pos",components:2,type:"Uint16"}]),O0=jt([{name:"a_join_normal_inside",components:3,type:"Int16"}]),F0=jt([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),k0=jt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:B0}=R0,yd=Number.MAX_SAFE_INTEGER,Ng=yd-1;function Vg(r,e,i,o){return r.order<e||r.order===yd||!(r.clipMask&i)||(function(a,u){return u.length!==0&&u.find((h=>h===a))===void 0})(o,r.clipScope)}function hp(r,e){return r.x-e.x||r.y-e.y}function Ug(r,e){return hp(r.min,e.min)===0&&hp(r.max,e.max)===0}function Xm(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 dp(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!Ug(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!Zo(r[i].clipScope,e[i].clipScope))return!1;return!0}function jg(r,e,i){const o=1/$e,a=1/(1<<i.canonical.z),u=(e.x*o+i.canonical.x)*a+i.wrap,h=(e.y*o+i.canonical.y)*a;return{min:new Oe((r.x*o+i.canonical.x)*a+i.wrap,(r.y*o+i.canonical.y)*a),max:new Oe(u,h)}}function N0(r,e,i){const o=1<<i.canonical.z,a=((e.x-i.wrap)*o-i.canonical.x)*$e,u=(e.
7y*o-i.canonical.y)*$e;return{min:new Oe(((r.x-i.wrap)*o-i.canonical.x)*$e,(r.y*o-i.canonical.y)*$e),max:new Oe(a,u)}}function Ym(r,e,i,o,a,u,h){const f=r.indices,_=r.vertices,y=[];for(let v=o;v<o+a;v+=3){const b=e[i[v+0]+u],T=e[i[v+1]+u],E=e[i[v+2]+u],I=Math.min(b.x,T.x,E.x),P=Math.max(b.x,T.x,E.x),L=Math.min(b.y,T.y,E.y),D=Math.max(b.y,T.y,E.y);y.length=0,r.grid.query(new Oe(I,L),new Oe(P,D),y);for(let B=0;B<y.length;B++){const V=y[B];if(sn(_[f[3*V+0]],_[f[3*V+1]],_[f[3*V+2]],b,T,E,h))return!0}}return!1}function Gg(r,e,i,o){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(o.canonical)||e.wrap!==o.wrap){if(i.vertices.length<r.vertices.length)return Gg(i,o,r,e);const u=e.canonical,h=o.canonical,f=Math.pow(2,h.z-u.z);a=r.vertices.map((_=>new Oe((_.x+u.x*$e)*f-h.x*$e,(_.y+u.y*$e)*f-h.y*$e)))}return Ym(i,a,r.indices,0,r.indices.length,0,0)}function Hg(r,e,i,o){const a=Math.pow(2,o.z-i.z);return new Oe((r+i.x*$e)*a-o.x*$e,(e+i.y*$e)*a-o.y*$e)}function qg(r,e){const i=[];e.grid.queryPoint(r,i);const o=e.indices,a=e.vertices;for(let u=0;u<i.length;u++){const h=i[u];if(Ai([a[o[3*h+0]],a[o[3*h+1]],a[o[3*h+2]]],r))return!0}return!1}const Km=[new Oe(0,0),new Oe($e,0),new Oe($e,$e),new Oe(0,$e)];function $g(r,e){const i=[];let o=[];if(!e||r.length<2)return[r];if(r.length===2)return Kr(r[0],r[1],Km)?[r]:[];for(let a=0;a<r.length+2;a++){const u=r[a%r.length],h=r[(a+1)%r.length],f=Kr(a===0?r[r.length-1]:r[(a-1)%r.length],u,Km),_=Kr(u,h,Km),y=f||_;y&&o.push(u),y&&_||o.length>0&&(o.length>1&&i.push(o),o=[])}return o.length>1&&i.push(o),i}const Jm=le.types,V0=["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"],U0=["fill-extrusion-flood-light-ground-radius"],j0=Math.pow(2,13),G0=Math.pow(2,15)-1,Zg=new Oe(0,1),Ea=2147483648,Wg=7,Xg=450;function xd(r,e,i,o,a,u,h,f){r.emplaceBack((e<<1)+h,(i<<1)+u,(Math.floor(o*j0)<<1)+a,Math.round(f))}function vd(r,e,i){r.emplaceBack(e.x*$e,e.y*$e,i?1:0)}function fp(r,e,i,o,a,u){r.emplaceBack(e.x,e.y,(i.x<<1)+o,(i.y<<1)+a,u)}function bd(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Yg{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Kg{constructor(){this.centroidXY=new Oe(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 Oe(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Oe(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Oe(this.max.x-this.min.x,this.max.y-this.min.y)}}class Jg{constructor(){this.acc=new Oe(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,o){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===$e)&&i.x===o.x)!=((i.y===0||i.y===$e)&&i.y===o.y)&&this.processBorderOverlap(i,o),a&&this.checkBorderIntersection(i,o)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,wt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>$e!=e.x>$e&&this.addBorderIntersection(1,wt(i.y,e.y,($e-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,wt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>$e!=e.y>$e&&this.addBorderIntersection(3,wt(i.x,e.x,($e-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 o=this.borders[e];i<o[0]&&(o[0]=i),i>o[1]&&(o[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const o=e.x===0?0:1;this.addBorderIntersection(o,i.y),this.addBorderIntersection(o,e.y)}else{const o=e.y===0?2:3;this.addBorderIntersection(o,i.x),this.addBorderIntersection(o,e.x)}}centroid(){return this.accCount===0?new Oe(0,0):new Oe(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 Qg(r,e){const i=r.add(e)._unit(),o=O(r.x*i.x+r.y*i.y,-1,1);var a,u,h;return a=Math.acos(o),Math.min(4,Math.max(-4,Math.tan(a)))/4*G0*((u=r).x*(h=e).y-u.y*h.x<0?-1:1)}const H0=[r=>r.x<0,r=>r.x>$e,r=>r.y<0,r=>r.y>$e];function q0(r,e,i,o){const a=[4];if(o===0)return a;i._mult(o);const u=r.sub(i),h=e.sub(i),f=[r,e,u,h];for(let _=0;_<4;_++)for(const y of f)if(H0[_](y)){a.push(_);break}return a}class Qm{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new Zh,this.indexArray=new Ar,this.programConfigurations=new vo(e.layers,{zoom:e.zoom,lut:e.lut},(i=>U0.includes(i))),this._segments=new Wi,this.hiddenByLandmarkVertexArray=new Tu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Wi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}
7addData(e,i,o,a=!1){const u=e.length;if(u>2){let h=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*u,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let _;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const y=e[0],v=e[1];_=Qg(y.sub(e[u-1])._perp()._unit(),v.sub(y)._perp()._unit())}for(let y=0;y<u;y++){const v=y===u-1?0:y+1,b=e[y],T=e[v],E=e[v===u-1?0:v+1],I=T.sub(b)._perp()._unit(),P=Qg(I,E.sub(T)._perp()._unit()),L=_,D=P;if(e_(b,T,i)||a&&iy(b,i)&&iy(T,i)){_=P;continue}const B=f.vertexLength;fp(this.vertexArray,b,T,1,1,L),fp(this.vertexArray,b,T,1,0,L),fp(this.vertexArray,b,T,0,1,D),fp(this.vertexArray,b,T,0,0,D),f.vertexLength+=4;const V=q0(b,T,I,o);for(const G of V)this._segmentToGroundQuads[h].push({id:B,region:G}),this._segmentToRegionTriCounts[h][G]+=2,f.primitiveLength+=2;_=P}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let o=0;o<i;o++)this._segmentToGroundQuads[o].sort(((a,u)=>a.region-u.region));for(let o=0;o<i;o++){const a=this._segmentToGroundQuads[o],u=e[o],h=this._segmentToRegionTriCounts[o];h.reduce(((_,y)=>_+y),0);let f=0;for(let _=0;_<=4;_++){const y=h[_];if(y!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new Wi);const b={vertexOffset:u.vertexOffset,primitiveOffset:u.primitiveOffset+f,vertexLength:u.vertexLength,primitiveLength:y};v.get().push(b)}f+=y}for(let _=0;_<a.length;_++){const y=a[_].id;this.indexArray.emplaceBack(y,y+1,y+3),this.indexArray.emplaceBack(y,y+3,y+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,o,a,u,h,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,o,a,u,h,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,z0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,D0.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,o,a,u,h,f,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,o,a,u,h,f,_)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Ea))}updateHiddenByLandmarkRange(e,i,o){if(!this.hasData())return;const a=i+e;if(i!==0){for(let u=e;u<a;++u)this.hiddenByLandmarkVertexArray.emplace(u,o?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,F0.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class pp{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 Ar,this.footprintVertices=new Bs,this.footprintSegments=[],this.layoutVertexArray=new Ja,this.centroidVertexArray=new tp,this.wallVertexArray=new Xl,this.indexArray=new Ar,this.programConfigurations=new vo(e.layers,{zoom:e.zoom,lut:e.lut},(i=>V0.includes(i))),this.segments=new Wi,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.groundEffect=new Qm(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){this.features=[],this.hasPattern=Hm("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=F(o),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:u,id:h,index:f,sourceLayerIndex:_}of e){const y=this.layers[0]._featureFilter.needGeometry,v=ue(u,y);if(!this.layers[0]._featureFilter.filter(new Li(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),v,o))continue;const b={id:h,sourceLayerIndex:_,index:f,geometry:y?v.geometry:ie(u,o,a),properties:u.properties,type:u.type,patterns:{}},T=this.layoutVertexArray.length,E=Jm[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:u.id,feature:qm("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const I of b.geometry)for(const P of $g(I,E)
7)this.addFeature(u.id,b,[P],f,o,{},i.availableImages,a,i.brightness);else this.addFeature(u.id,b,b.geometry,f,o,{},i.availableImages,a,i.brightness);i.featureIndex.insert(u,b.geometry,f,_,this.index,T)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,o,a,u,h){for(const{featureId:f,feature:_}of this.features){const y=Jm[_.type]==="Polygon",{geometry:v}=_;if(this.wallMode)for(const b of v)for(const T of $g(b,y))this.addFeature(f,_,[T],_.index,i,o,a,u,h);else this.addFeature(f,_,v,_.index,i,o,a,u,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,o,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,o,a,h,f,this.worldview),this.groundEffect.update(e,i,u,o,a,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,B0),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,O0.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,k0.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,L0.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,o,a,u,h,f,_,y){const v=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,b=[new Oe(0,0),new Oe($e,$e)],T=_.projection,E=T.name==="globe",I=this.wallMode||Jm[i.type]==="Polygon",P=new Jg;P.centroidDataIndex=this.centroidData.length;const L=new Kg;L.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(L.buildingId=i.properties.building_id);const D=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},u)<=0,B=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},u);let V;if(L.height=B,L.vertexArrayOffset=this.layoutVertexArray.length,L.groundVertexArrayOffset=this.groundEffect.vertexArray.length,E&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new gu),this.wallMode){if(E)return void tt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(o.length!==1)return;V=(function(he){const Ee=he[0].x===he[he.length-1].x&&he[0].y===he[he.length-1].y;(function(rt){let at=0;const Ut=rt.length;for(let Ge=0;Ge<Ut;Ge++)at+=(rt[(Ge+1)%Ut].x-rt[Ge].x)*(rt[(Ge+1)%Ut].y+rt[Ge].y);return at>=0})(he)||(he=he.reverse());const Pe={geometry:[],joinNormals:[],indices:[]},Fe=[],Be=[],ze=[];let De=he.length;for(;De>=2&&he[De-1].equals(he[De-2]);)De--;if(De<(Ee?3:2))return Pe;let Se,we,Le,Ze,je,dt=0;for(;dt<De-1&&he[dt].equals(he[dt+1]);)dt++;Ee&&(Se=he[De-2],je=he[dt].sub(Se)._unit()._perp());for(let rt=dt;rt<De;rt++){if(Le=rt===De-1?Ee?he[dt+1]:void 0:he[rt+1],Le&&he[rt].equals(Le))continue;je&&(Ze=je),Se&&(we=Se),Se=he[rt],je=Le?Le.sub(Se)._unit()._perp():Ze,Ze=Ze||je;let at=Ze.add(je);at.x===0&&at.y===0||at._unit();const Ut=at.x*je.x+at.y*je.y,Ge=Ut!==0?1/Ut:1/0,lt=Ze.x*je.y-Ze.y*je.x>0;let It="miter";const Zt=2;It==="miter"&&Ge>Zt&&(It="bevel"),It==="bevel"&&(Ge>100&&(It="flipbevel"),Ge<Zt&&(It="miter"));const Xt=(Rt,Si,W,J)=>{const Ie=new Oe(Rt.x,Rt.y),ke=new Oe(Rt.x,Rt.y);Ie.x+=Si.x*J,Ie.y+=Si.y*J,ke.x-=Si.x*Math.max(W,1),ke.y-=Si.y*Math.max(W,1),ze.push(Si),Fe.push(Ie),Be.push(ke)};if(It==="miter")at._mult(Ge),Xt(Se,at,0,0);else if(It==="flipbevel")at=je.mult(-1),Xt(Se,at,0,0),Xt(Se,at.mult(-1),0,0);else{const Rt=-Math.sqrt(Ge*Ge-1),Si=lt?Rt:0,W=lt?0:Rt;we&&Xt(Se,Ze,Si,W),Le&&Xt(Se,je,Si,W)}}Pe.geometry=[...Fe,...Be.reverse(),Fe[0]],Pe.joinNormals=[...ze,...ze.reverse(),ze[ze.length-1]];const Qe=Pe.geometry.length-1;for(let rt=0;rt<Qe/2;rt++)if(rt+1<Qe/2){let at=rt,Ut=rt+1,Ge=Qe-1-rt,lt=Qe-2-rt;at=at===0?Qe-1:at-1,Ut=Ut===0?Qe-1:Ut-1,Ge=Ge===0?Qe-1:Ge-1,lt=lt===0?Qe-1:lt-1,Pe.indices.push(Ge),Pe.indices.push(Ut),Pe.indices.push(at),Pe.indices.push(Ge),Pe.indices.push(lt),Pe.indices.push(Ut)}return Pe})(o[0]),o=[V.geometry]}const G=(he,Ee)=>he<(Ee.length-1)/2||he===Ee.length-1,K=this.wallMode?[o]:gd(o,500);for(let he=K.length-1;he>=0;he--){const Ee=K[he];(Ee.length===0||(Z=Ee[0]).every((Ce=>Ce.x<=0))||Z.every((Ce=>Ce.x>=$e))||Z.every((Ce=>Ce.y<=0))||Z.every((Ce=>Ce.y>=$e)))&&K.splice(he,1)}var Z;let ee;if(E)ee=sy(K,b,u);else{ee=[];for(const he of K)ee.push({polygon:he,bounds:b})}const ne=I?this.edgeRadius:0,ae=ne>0&&this.zoom<17,be=(he,Ee)=>{if(he.length===0)return!1;const Ce=he[he.length-1];return Ee.x===Ce.x&&Ee.y===Ce.y};for(const{polygon:he,bounds:Ee}of ee){let Ce=0,Pe=0;for(const De of he)I&&!De[0].equals(De[De.length-1])&&De.push(De[0]),Pe+=I?De.length-1:De.length;const Fe=this.segments.prepareSegment((I?5:4)*Pe,this.layoutVertexArray,this.indexArray);L.footprintSegIdx<0&&(L.footprintSegIdx=this.footprintSegments.length),L.polygonSegIdx<0&&(L.polygonSegIdx=this.polygonSegments.length);const Be={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},ze=new Yg;if(ze.vertexOffset=this.footprintVertices.length,ze.indexOffset=3*this.footprintIndices.length,ze.ringIndices=[],I){const De=[],Se=[];Ce=Fe.vertexLength;for(let Le=0;Le<he.length;Le++){const Ze=he[Le];Ze.length&&Le!==0&&Se.push(De.length/2);const je=[];let dt,Qe;dt=Ze[1].sub(Ze[0])._perp()._unit(),ze.ringIndices.push(Ze.length-1);for(let rt=1;rt<Ze.length;rt++){const at=Ze[rt],Ut=Ze[rt===Ze.length-1?1:rt+1],Ge=at.clone();if(ne){Qe=Ut.sub(at)._perp()._unit();const lt=dt.add(Qe)._unit(),It=ne*Math.min(4,1/(dt.x*lt.x+dt.y*lt.y));Ge.x+=It*lt.x,Ge.y+=It*lt.y,Ge.x=Math.round(Ge.x),Ge.y=Math.round(Ge.y),dt=Qe}if(!D||ne!==0&&!ae||be(je,Ge)||je.push(Ge),xd(this.layoutVertexArray,Ge.x,Ge.y,0,0,1,1,0),this.wallMode){const lt=G(rt,Ze);vd(this.wallVertexArray,V.joinNormals[rt],!lt)}Fe.vertexLength++,this.footprintVertices.emplaceBack(at.x,at.y),De.push(at.x,at.y),E&&bd(this.layoutVertexExtArray,T.projectTilePoint(Ge.x,Ge.y,u),T.upVector(u,Ge.x,Ge.y))}D&&(ne===0||ae)&&(je.length!==0&&be(je,je[0])&&je.pop(),this.groundEffect.addData(je,Ee,v))}const we=this.wallMode?V.indices:Ou(De,Se);for(let Le=0;Le<we.length;Le+=3)this.footprintIndices.emplaceBack(ze.vertexOffset+we[Le+0],ze.vertexOffset+we[Le+1],ze.vertexOffset+we[Le+2]),this.indexArray.emplaceBack(Ce+we[Le],Ce+we[Le+2],Ce+we[Le+1]),Fe.primitiveLength++;ze.indexCount+=we.length,ze.vertexCount+=this.footprintVertices.length-ze.vertexOffset}for(let De=0;De<he.length;De++){const Se=he[De];P.startRing(L,Se[0]);let we=Se.length>4&&ry(Se[Se.length-2],Se[0],Se[1]),Le=ne?$0(Se[Se.length-2],Se[0],Se[1],ne):0;const Ze=[];let je,dt,Qe;dt=Se[1].sub(Se[0])._perp()._unit();let rt=!0;for(let at=1,Ut=0;at<Se.length;at++){let Ge=Se[at-1],lt=Se[at];const It=Se[at===Se.length-1?1:at+1];if(P.appendEdge(L,lt,Ge),e_(lt,Ge,Ee)){ne&&(dt=It.sub(lt)._perp()._unit(),rt=!rt);continue}const Zt=lt.sub(Ge)._perp(),Xt=Zt.x/(Math.abs(Zt.x)+Math.abs(Zt.y)),Rt=Zt.y>0?1:0,Si=Ge.dist(lt);if(Ut+Si>32768&&(Ut=0),ne){Qe=It.sub(lt)._perp()._unit();let ke=ty(Ge,lt,It,ey(dt,Qe),ne);isNaN(ke)&&(ke=0);const Ye=lt.sub(Ge)._unit();Ge=Ge.add(Ye.mult(Le))._round(),lt=lt.add(Ye.mult(-ke))._round(),Le=ke,dt=Qe,D&&this.zoom>=17&&(be(Ze,Ge)||Ze.push(Ge),be(Ze,lt)||Ze.push(lt))}const W=Fe.vertexLength,J=Se.length>4&&ry(Ge,lt,It);let Ie=ny(Ut,we,rt);if(xd(this.layoutVertexArray,Ge.x,Ge.y,Xt,Rt,0,0,Ie),xd(this.layoutVertexArray,Ge.x,Ge.y,Xt,Rt,0,1,Ie),this.wallMode){const ke=G(at-1,Se),Ye=V.joinNormals[at-1];vd(this.wallVertexArray,Ye,ke),vd(this.wallVertexArray,Ye,ke)}if(Ut+=Si,Ie=ny(Ut,J,!rt),we=J,xd(this.layoutVertexArray,lt.x,lt.y,Xt,Rt,0,0,Ie),xd(this.layoutVertexArray,lt.x,lt.y,Xt,Rt,0,1,Ie),this.wallMode){const ke=G(at,Se),Ye=V.joinNormals[at];vd(this.wallVertexArray,Ye,ke),vd(this.wallVertexArray,Ye,ke)}if(Fe.vertexLength+=4,this.indexArray.emplaceBack(W+0,W+1,W+2),this.indexArray.emplaceBack(W+1,W+3,W+2),Fe.primitiveLength+=2,ne){const ke=Ce+(at===1?Se.length-2:at-2),Ye=at===1?Ce:ke+1;
7if(this.indexArray.emplaceBack(W+1,ke,W+3),this.indexArray.emplaceBack(ke,Ye,W+3),Fe.primitiveLength+=2,je===void 0&&(je=W),!e_(It,Se[at],Ee)){const Ke=at===Se.length-1?je:Fe.vertexLength;this.indexArray.emplaceBack(W+2,W+3,Ke),this.indexArray.emplaceBack(W+3,Ke+1,Ke),this.indexArray.emplaceBack(W+3,Ye,Ke+1),Fe.primitiveLength+=3}rt=!rt}if(E){const ke=this.layoutVertexExtArray,Ye=T.projectTilePoint(Ge.x,Ge.y,u),Ke=T.projectTilePoint(lt.x,lt.y,u),ft=T.upVector(u,Ge.x,Ge.y),mt=T.upVector(u,lt.x,lt.y);bd(ke,Ye,ft),bd(ke,Ye,ft),bd(ke,Ke,mt),bd(ke,Ke,mt)}}I&&(Ce+=Se.length-1),D&&ne&&this.zoom>=17&&(Ze.length!==0&&be(Ze,Ze[0])&&Ze.pop(),this.groundEffect.addData(Ze,Ee,v,ne>0))}this.footprintSegments.push(ze),Be.triangleCount=this.indexArray.length-Be.triangleArrayOffset,this.polygonSegments.push(Be),++L.footprintSegLen,++L.polygonSegLen}if(L.vertexCount=this.layoutVertexArray.length-L.vertexArrayOffset,L.groundVertexCount=this.groundEffect.vertexArray.length-L.groundVertexArrayOffset,L.vertexCount!==0){if(L.centroidXY=P.borders?Zg:this.encodeCentroid(P,L),this.centroidData.push(L),P.borders){this.featuresOnBorder.push(P);const he=this.featuresOnBorder.length-1;for(let Ee=0;Ee<P.borders.length;Ee++)P.borders[Ee][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Ee].push(he)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,h,f,u,y,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,a,h,f,u,y,this.worldview),this.maxHeight=Math.max(this.maxHeight,B)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort(((i,o)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[o].borders[e][0]))}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const _=this.centroidData[f],y=+(_.min.y+_.max.y>$e),v=2*y+(+(_.min.x+_.max.x>$e)^y);for(let b=0;b<_.polygonSegLen;b++){const T=_.polygonSegIdx+b;e.push({centroidIdx:f,subtile:v,polygonSegmentIdx:T,triangleSegmentIdx:this.polygonSegments[T].triangleSegIdx})}}const i=new Ar;e.sort(((f,_)=>f.triangleSegmentIdx===_.triangleSegmentIdx?f.subtile-_.subtile:f.triangleSegmentIdx-_.triangleSegmentIdx));let o=0,a=0,u=0;for(const f of e){if(f.triangleSegmentIdx!==o)break;u++}const h=e.length;for(;a!==e.length;){o=e[a].triangleSegmentIdx;let f=0,_=a,y=a;for(let v=_;v<u&&e[v].subtile===f;v++)y++;for(;_!==u;){const v=e[_];f=v.subtile;const b=this.centroidData[v.centroidIdx].min.clone(),T=this.centroidData[v.centroidIdx].max.clone(),E={vertexOffset:this.segments.segments[o].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[o].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let I=_;I<y;I++){const P=e[I],L=this.polygonSegments[P.polygonSegmentIdx],D=this.centroidData[P.centroidIdx].min,B=this.centroidData[P.centroidIdx].max,V=this.indexArray.uint16;for(let G=L.triangleArrayOffset;G<L.triangleArrayOffset+L.triangleCount;G++)i.emplaceBack(V[3*G],V[3*G+1],V[3*G+2]);E.primitiveLength+=L.triangleCount,b.x=Math.min(b.x,D.x),b.y=Math.min(b.y,D.y),T.x=Math.max(T.x,B.x),T.y=Math.max(T.y,B.y)}E.primitiveLength>0&&this.triangleSubSegments.push({segment:E,min:b,max:T}),_=y;for(let I=_;I<u&&e[I].subtile===e[_].subtile;I++)y++}a=u;for(let v=a;v<h&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)u++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,o){const a=new Wi;if(this.wallMode){for(const P of this.triangleSubSegments)a.segments.push(P.segment);return a}let u=0,h=0;const f=1<<e.canonical.z;if(i){const P=i.getMinMaxForTile(e);P&&(u=P.min,h=P.max)}h+=this.maxHeight;const _=e.toUnwrapped();let y;const v=[_.canonical.x/f+_.wrap,_.canonical.y/f],b=[(_.canonical.x+1)/f+_.wrap,(_.canonical.y+1)/f],T=(P,L,D)=>[P[0]*(1-D[0])+L[0]*D[0],P[1]*(1-D[1])+L[1]*D[1]],E=[],I=[];for(const P of this.triangleSubSegments){E[0]=P.min.x/$e,E[1]=P.min.y/$e,I[0]=P.max.x/$e,I[1]=P.max.y/$e;const L=T(v,b,E),D=T(v,b,I);if(new ut([L[0],L[1],u],[D[0],D[1],h]).intersectsPrecise(o)===0){y&&(a.segments.push(y),y=void 0);continue}const B=P.segment;y&&y.vertexOffset!==B.vertexOffset&&(a.segments.push(y),y=void 0),y?(y.vertexLength+=B.vertexLength,y.primitiveLength+=B.primitiveLength):y={vertexOffset:B.vertexOffset,primitiveLength:B.primitiveLength,vertexLength:B.vertexLength,primitiveOffset:B.primitiveOffset,sortKey:void 0,vaos:{}}}return y&&a.segments.push(y),a}encodeCentroid(e,i){const o=e.centroid(),a=i.span(),u=Math.min(7,Math.round(a.x*this.tileToMeter/10)),h=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new Oe(O(o.x,1,$e-1)<<3|u,O(o.y,1,$e-1)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new Oe(0,0);const i=e.borders,o=Number.MAX_VALUE;if(i[0][0]!==o||i[1][0]!==o){const a=i[0][0]!==o?0:1;return new Oe(6|(i[0][0]!==o?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==o?2:3;return new Oe((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==o?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,o=e.vertexCount+e.vertexArrayOffset,a=e.flags&Ea?Zg:e.centroidXY,u=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||u!==a.x){for(let h=i;h<o;++h)this.centroidVertexArray.emplace(h,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(dp(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const h of this.centroidData)h.flags&=2147483647;const u=[];for(const h of this.activeReplacements){if(h.order<o)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));if(h.footprint.buildingIds)for(const _ of this.centroidData)_.flags&Ea||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y||h.footprint.buildingIds.has(_.buildingId)&&(_.flags|=Ea);else for(const _ of this.centroidData)if(!(_.flags&Ea||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y))for(let y=0;y<_.footprintSegLen;y++){const v=this.footprintSegments[_.footprintSegIdx+y];if(u.length=0,Z0(this.footprintVertices,v.vertexOffset,v.vertexCount,h.footprintTileId.canonical,e.canonical,u),Ym(h.footprint,u,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,
7-f)){_.flags|=Ea;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,o){let a=!1;for(let u=0;u<o.footprintSegLen;u++){const h=this.footprintSegments[o.footprintSegIdx+u];let f=0;for(const _ of h.ringIndices){for(let y=f,v=_+f-1;y<_+f;v=y++){const b=this.footprintVertices.int16[2*(y+h.vertexOffset)+0],T=this.footprintVertices.int16[2*(y+h.vertexOffset)+1],E=this.footprintVertices.int16[2*(v+h.vertexOffset)+1];T>i!=E>i&&e<(this.footprintVertices.int16[2*(v+h.vertexOffset)+0]-b)*(i-T)/(E-T)+b&&(a=!a)}f=_}}return a}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+$e)*$e+(i+$e);if(this.partLookup.hasOwnProperty(u)){const h=this.partLookup[u];return h?{height:h.height,hidden:!!(h.flags&Ea)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||h.height<=o||this.footprintContainsPoint(e,i,h)&&(o=h.height,this.partLookup[u]=h,a=!!(h.flags&Ea));if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.partLookup[u]=void 0}}function ey(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function $0(r,e,i,o){const a=e.sub(r)._perp()._unit(),u=i.sub(e)._perp()._unit();return ty(r,e,i,ey(a,u),o)}function ty(r,e,i,o,a){const u=Math.sqrt(1-o*o);return Math.min(r.dist(e)/3,e.dist(i)/3,a*u/o)}function e_(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 iy(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function ry(r,e,i){if(r.x<0||r.x>=$e||e.x<0||e.x>=$e||i.x<0||i.x>=$e)return!1;const o=i.sub(e),a=o.perp(),u=r.sub(e);return(o.x*u.x+o.y*u.y)/Math.sqrt((o.x*o.x+o.y*o.y)*(u.x*u.x+u.y*u.y))>-.866&&a.x*u.x+a.y*u.y<0}function ny(r,e,i){const o=e?2|r:-3&r;return i?1|o:-2&o}function oy(){const r=Math.PI/32,e=Math.tan(r),i=l;return i*Math.sqrt(1+2*e*e)-i}function sy(r,e,i){const o=1<<i.z,a=S(i.x/o),u=S((i.x+1)/o),h=M(i.y/o),f=M((i.y+1)/o);return(function(_,y,v,b,T=0,E){const I=[];if(!_.length||!v||!b)return I;const P=(Z,ee)=>{for(const ne of Z)I.push({polygon:ne,bounds:ee})},L=Math.ceil(Math.log2(v)),D=Math.ceil(Math.log2(b)),B=L-D,V=[];for(let Z=0;Z<Math.abs(B);Z++)V.push(B>0?0:1);for(let Z=0;Z<Math.min(L,D);Z++)V.push(0),V.push(1);let G=_;if(G=cp(G,y[0].y-T,y[1].y+T,1),G=cp(G,y[0].x-T,y[1].x+T,0),!G.length)return I;const K=[];for(V.length?K.push({polygons:G,bounds:y,depth:0}):P(G,y);K.length;){const Z=K.pop(),ee=Z.depth,ne=V[ee],ae=Z.bounds[0],be=Z.bounds[1],he=ne===0?ae.x:ae.y,Ee=ne===0?be.x:be.y,Ce=E?E(ne,he,Ee):.5*(he+Ee),Pe=cp(Z.polygons,he-T,Ce+T,ne),Fe=cp(Z.polygons,Ce-T,Ee+T,ne);if(Pe.length){const Be=[ae,new Oe(ne===0?Ce:be.x,ne===1?Ce:be.y)];V.length>ee+1?K.push({polygons:Pe,bounds:Be,depth:ee+1}):P(Pe,Be)}if(Fe.length){const Be=[new Oe(ne===0?Ce:ae.x,ne===1?Ce:ae.y),be];V.length>ee+1?K.push({polygons:Fe,bounds:Be,depth:ee+1}):P(Fe,Be)}}return I})(r,e,Math.ceil((u-a)/11.25),Math.ceil((h-f)/11.25),1,((_,y,v)=>{if(_===0)return .5*(y+v);{const b=M((i.y+y/$e)/o);return(x(.5*(M((i.y+v/$e)/o)+b))*o-i.y)*$e}}))}function Z0(r,e,i,o,a,u){const h=Math.pow(2,o.z-a.z);for(let f=0;f<i;f++){let _=r.int16[2*(f+e)+0],y=r.int16[2*(f+e)+1];_=(_+a.x*$e)*h-o.x*$e,y=(y+a.y*$e)*h-o.y*$e,u.push(new Oe(_,y))}}let ay,ly;ot(pp,"FillExtrusionBucket",{omit:["layers","features"]}),ot(Kg,"PartData"),ot(Yg,"FootprintSegment"),ot(Jg,"BorderCentroidData"),ot(Qm,"GroundEffect");class oc extends Oe{constructor(e,i,o){super(e,i),this.z=o}}class cy extends oc{constructor(e,i,o,a){super(e,i,o),this.w=a}}function uy(r,e,i,o){const a=i==="x"?"y":"x",u=(o-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*u),r[i]=o,r.hasOwnProperty("z")&&(r.z=wt(r.z,e.z,u)),r.hasOwnProperty("w")&&(r.w=wt(r.w,e.w,u))}function hy(r,e,i,o){const a=i,u=o;for(const h of["x","y"]){let f=r,_=e;f[h]>=_[h]&&(f=e,_=r),f[h]<a&&_[h]>a&&uy(f,_,h,a),f[h]<u&&_[h]>u&&uy(_,f,h,u)}}function mp(r,e,i,o,a,u){const h=[];for(let f=0;f<r.length;f++){const _=r[f];let y;const v=h.length;let b=0;for(let T=0;T<_.length-1;T++){let E=_[T],I=_[T+1],P=0;const L=b;let D,B;u&&(P=Math.hypot(I.x-E.x,I.y-E.y),b+=P,D=E,B=I),E.x<e&&I.x<e||(E.x<e?E=new Oe(e,E.y+(e-E.x)/(I.x-E.x)*(I.y-E.y))._round():I.x<e&&(I=new Oe(e,E.y+(e-E.x)/(I.x-E.x)*(I.y-E.y))._round()),E.y<i&&I.y<i||(E.y<i?E=new Oe(E.x+(i-E.y)/(I.y-E.y)*(I.x-E.x),i)._round():I.y<i&&(I=new Oe(E.x+(i-E.y)/(I.y-E.y)*(I.x-E.x),i)._round()),E.x>=o&&I.x>=o||(E.x>=o?E=new Oe(o,E.y+(o-E.x)/(I.x-E.x)*(I.y-E.y))._round():I.x>=o&&(I=new Oe(o,E.y+(o-E.x)/(I.x-E.x)*(I.y-E.y))._round()),E.y>=a&&I.y>=a||(E.y>=a?E=new Oe(E.x+(a-E.y)/(I.y-E.y)*(I.x-E.x),a)._round():I.y>=a&&(I=new Oe(E.x+(a-E.y)/(I.y-E.y)*(I.x-E.x),a)._round()),y&&E.equals(y[y.length-1])||(y=[E],h.push(y),u&&u.push({progress:{min:L+dy(D,B,E)*P,max:1},parentIndex:f,prevPoint:D,nextPoint:B})),y.push(I),u&&(u[u.length-1].progress.max=L+dy(D,B,I)*P,u[u.length-1].nextPoint=B)))))}if(u&&b>0)for(let T=v;T<h.length;T++)u[T].progress.min/=b,u[T].progress.max/=b}return h}function W0(r,e,i,o,a){if(r.length<2)return void o.push(r);const u=[];for(;e.valid();){const[y,v]=e.get();for(let b=0;b<r.length-1;b++){const T=r[b],E=r[b+1],I=Ft(T,E,y,v);if(I){const[P]=I,L=new Oe(wt(T.x,E.x,P),wt(T.y,E.y,P));u.push({t:b+P,distance:0,point:L})}}e.next()}if(u.length===0)return void o.push(r);u.sort(((y,v)=>y.t-v.t));let h=0,f=0,_=[];for(o.push(_);h!==r.length;){if(f===u.length){for(;h!==r.length;)_.length!==0&&_[_.length-1].equals(r[h])||_.push(r[h]),h++;break}u[f].t<=h?(_.length!==0&&_[_.length-1].equals(u[f].point)||_.push(u[f].point),Math.trunc(u[f].t),f++):(_.length!==0&&_[_.length-1].equals(r[h])||_.push(r[h]),h++)}}function dy(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 wd(r,e){return r.x*e.x+r.y*e.y}function fy(r,e){if(r.length===1){let i=0;const o=e[i++];let a;for(;!a||o.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],f=a.sub(o),_=u.sub(o),y=h.sub(o),v=wd(f,f),b=wd(f,_),T=wd(_,_),E=wd(y,f),I=wd(y,_),P=v*T-b*b,L=(T*E-b*I)/P,D=(v*I-b*E)/P,B=o.z*(1-L-D)+a.z*L+u.z*D;if(isFinite(B))return B}return 1/0}{let i=1/0;for(const o of e)i=Math.min(i,o.z);return i}}function py(r,e,i){let o=1/0;hi(i,e)&&(o=fy(i,e[0]));for(let a=0;a<e.length;a++){const u=e[a],h=r[a];for(let f=0;f<u.length-1;f++){const _=u[f],y=[_,u[f+1],h[f+1],h[f],_];ni(i,y)&&(o=Math.min(o,fy(i,y)))}}return o!==1/0&&o}function my(r,e,i,o,a,u,h,f,_,y,v){return r.projection.name==="globe"?(function(b,T,E,I,P,L,D,B,V,G,K){const Z=[],ee=[],ne=b.projection.upVectorScale(K,b.center.lat,b.worldSize).metersToTile,ae=[0,0,0,1],be=[0,0,0,1],he=(Ce,Pe,Fe,Be)=>{Ce[0]=Pe,Ce[1]=Fe,Ce[2]=Be,Ce[3]=1},Ee=oy();E>0&&(E+=Ee),I+=Ee;for(const Ce of T){const Pe=[],Fe=[];for(const Be of Ce){const ze=Be.x+P.x,De=Be.y+P.y,Se=b.projection.projectTilePoint(ze,De,K),we=b.projection.upVector(K,Be.x,Be.y);let Le=E,Ze=I;if(D){const je=_y(ze,De,E,I,D,B,V,G);Le+=je.base,Ze+=je.top}E!==0?he(ae,Se.x+we[0]*ne*Le,Se.y+we[1]*ne*Le,Se.z+we[2]*ne*Le):he(ae,Se.x,Se.y,Se.z),he(be,Se.x+we[0]*ne*Ze,Se.y+we[1]*ne*Ze,Se.z+we[2]*ne*Ze),gr(ae,ae,L),gr(be,be,L),Pe.push(new oc(ae[0],ae[1],ae[2])),Fe.push(new oc(be[0],be[1],be[2]))}Z.push(Pe),ee.push(Fe)}return[Z,ee]})(r,e,i,o,a,u,h,f,_,y,v):h?(function(b,T,E,I,P,L,D,B,V){const G=[],K=[],Z=[0,0,0,1];for(const ee of b){const ne=[],ae=[];
7for(const be of ee){const he=be.x+I.x,Ee=be.y+I.y,Ce=_y(he,Ee,T,E,L,D,B,V);Z[0]=he,Z[1]=Ee,Z[2]=Ce.base,Z[3]=1,tn(Z,Z,P),Z[3]=Math.max(Z[3],1e-5);const Pe=new oc(Z[0]/Z[3],Z[1]/Z[3],Z[2]/Z[3]);Z[0]=he,Z[1]=Ee,Z[2]=Ce.top,Z[3]=1,tn(Z,Z,P),Z[3]=Math.max(Z[3],1e-5);const Fe=new oc(Z[0]/Z[3],Z[1]/Z[3],Z[2]/Z[3]);ne.push(Pe),ae.push(Fe)}G.push(ne),K.push(ae)}return[G,K]})(e,i,o,a,u,h,f,_,y):(function(b,T,E,I,P){const L=[],D=[],B=P[8]*T,V=P[9]*T,G=P[10]*T,K=P[11]*T,Z=P[8]*E,ee=P[9]*E,ne=P[10]*E,ae=P[11]*E;for(const be of b){const he=[],Ee=[];for(const Ce of be){const Pe=Ce.x+I.x,Fe=Ce.y+I.y,Be=P[0]*Pe+P[4]*Fe+P[12],ze=P[1]*Pe+P[5]*Fe+P[13],De=P[2]*Pe+P[6]*Fe+P[14],Se=P[3]*Pe+P[7]*Fe+P[15],we=Be+B,Le=ze+V,Ze=De+G,je=Math.max(Se+K,1e-5),dt=Be+Z,Qe=ze+ee,rt=De+ne,at=Math.max(Se+ae,1e-5);he.push(new oc(we/je,Le/je,Ze/je)),Ee.push(new oc(dt/at,Qe/at,rt/at))}L.push(he),D.push(Ee)}return[L,D]})(e,i,o,a,u)}function _y(r,e,i,o,a,u,h,f){const _=h*a.getElevationAt(r,e,!0,!0),y=u[0]!==0,v=y?u[1]===0?h*(u[0]/Wg-Xg):h*(function(b,T,E){const I=Math.floor(T[0]/8),P=Math.floor(T[1]/8),L=10*(T[0]-8*I),D=10*(T[1]-8*P),B=b.getElevationAt(I,P,!0,!0),V=b.getMeterToDEM(E),G=Math.floor(.5*(L*V-1)),K=Math.floor(.5*(D*V-1)),Z=b.tileCoordToPixel(I,P),ee=2*G+1,ne=2*K+1,ae=(function(Fe,Be,ze,De,Se){return[Fe.getElevationAtPixel(Be,ze,!0),Fe.getElevationAtPixel(Be+Se,ze,!0),Fe.getElevationAtPixel(Be,ze+Se,!0),Fe.getElevationAtPixel(Be+De,ze+Se,!0)]})(b,Z.x-G,Z.y-K,ee,ne),be=Math.abs(ae[0]-ae[1]),he=Math.abs(ae[2]-ae[3]),Ee=Math.abs(ae[0]-ae[2])+Math.abs(ae[1]-ae[3]),Ce=Math.min(.25,.5*V*(be+he)/ee),Pe=Math.min(.25,.5*V*Ee/ne);return B+Math.max(Ce*L,Pe*D)})(a,u,f):_;return{base:_+(i===0?-1:i),top:y?Math.max(v+o,_+i+2):_+o}}class X0{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 Y0{constructor(){this.tasks={},this.taskQueue=[],de(["process"],this),this.invoker=new X0(this.process),this.nextId=0}add(e,i){const o=this.nextId++,a=(function({type:u,isSymbolTile:h,zoom:f}){return f=f||0,u==="message"?0:u!=="maybePrepare"||h?u!=="parseTile"||h?u==="parseTile"&&h?300-f:u==="maybePrepare"&&h?400-f:500:200-f:100-f})(i);return a===0?(e(),null):(this.tasks[o]={fn:e,metadata:i,priority:a,id:o},this.taskQueue.push(o),this.invoker.trigger(),{cancel:()=>{delete this.tasks[o]}})}process(){{if(this.taskQueue=this.taskQueue.filter((o=>!!this.tasks[o])),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const u=this.tasks[this.taskQueue[a]];u.priority<i&&(i=u.priority,e=a)}if(e===null)return null;const o=this.taskQueue[e];return this.taskQueue.splice(e,1),o}remove(){this.invoker.remove()}}class gy{constructor(e,i,o){this.target=e,this.parent=i,this.mapId=o,this.callbacks={},this.cancelCallbacks={},de(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new Y0}send(e,i,o,a,u=!1,h){const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(o.metadata=h,this.callbacks[f]=o);const _=new Set;return this.target.postMessage({id:f,type:e,hasCallback:!!o,targetMapId:a,mustQueue:u,sourceMapId:this.mapId,data:Qo(i,_)},_),{cancel:()=>{o&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const o=i.id;if(o&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[o];delete this.cancelCallbacks[o],a&&a.cancel()}else if(i.mustQueue||Kt(self)){const a=this.callbacks[o],u=this.scheduler.add((()=>this.processTask(o,i)),a&&a.metadata||{type:"message"});u&&(this.cancelCallbacks[o]=u)}else this.processTask(o,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const o=this.callbacks[e];delete this.callbacks[e],o&&(i.error?o(ks(i.error)):o(null,ks(i.data)))}else{const o=new Set,a=i.hasCallback?(h,f)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?Qo(h):null,data:Qo(f,o)},o)}:()=>{},u=ks(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,u,a);else if(this.parent.getWorkerSource){const h=i.type.split("."),{source:f,scope:_}=u;this.parent.getWorkerSource(i.sourceMapId,h[0],f,_)[h[1]](u,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Td={workerUrl:"",workerClass:null,workerParams:void 0};const t_="mapboxgl_preloaded_worker_pool";class sc{constructor(e){this.active={},this.name=e}acquire(e,i=sc.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;){const a=(o=`${this.name||""}WorkerPool: ${e}-${this.workers.length}`,Td.workerClass!=null?new Td.workerClass:new self.Worker(Td.workerUrl,Object.assign({name:o},Td.workerParams)));this.workers.push(a)}var o;return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEac
7h((i=>{i.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[t_]}numActive(){return Object.keys(this.active).length}}sc.workerCount=2;class ku{constructor(e,i,o="Worker",a=sc.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=ce();const u=this.workerPool.acquire(this.id,a);for(let h=0;h<u.length;h++){const f=new ku.Actor(u[h],i,this.id);f.name=`${o} ${h}`,this.actors.push(f)}this.ready=!1,this.broadcast("checkIfReady",null,(()=>{this.ready=!0}))}broadcast(e,i,o){oe(this.actors,((a,u)=>{a.send(e,i,u)}),o=o||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 Sd,i_;function _p(){return Sd||(Sd=new sc),Sd}ku.Actor=gy;const r_=4096;class K0{constructor(e){this.module=e,this.memoryStack=this.module.malloc(r_),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>r_?-1:(new Int32Array(this.module.heap32.buffer,i,e.length).set(e),i)}createFloatArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>r_?-1:(new Float32Array(this.module.heapF32.buffer,i,e.length).set(e),i)}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.normalScale;this.module.setStyle(i[0],i[1],i[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,i?1:0)}setFauxFacadeOptions(e,i,o){this.module.setFauxFacadeOptions(e?1:0,i?1:0,o)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){this.memoryStackNextFree=this.memoryStack;for(const f of e){const _=this.createIntArray(f.ringIndices),y=this.createFloatArray(f.coordinates);if(_===-1||y===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,f.roofType,y,_,f.ringIndices.length-1)}for(const f of i){let _;_=f.entrances?JSON.parse(f.entrances):[];const y=this.createFloatArray(_),v=this.createFloatArray(f.coordinates);if(y===-1||v===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,y,_.length,v,f.coordinates.length)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}const o=this.module.getMeshCount(),a=new Array(o);for(let f=0;f<o;f++){const _=this.module.getPositionsPtr(f),y=this.module.getPositionsLength(f),v=new Float32Array(this.module.heapF32.buffer,_,y),b=this.module.getNormalsPtr(f),T=this.module.getNormalsLength(f),E=new Float32Array(this.module.heapF32.buffer,b,T),I=this.module.getAOPtr(f),P=this.module.getAOLength(f),L=new Float32Array(this.module.heapF32.buffer,I,P),D=this.module.getUVPtr(f),B=this.module.getUVLength(f),V=new Float32Array(this.module.heapF32.buffer,D,B),G=this.module.getFauxFacadePtr(f),K=this.module.getFauxFacadeLength(f),Z=new Uint8Array(this.module.heapU8.buffer,G,K),ee=this.module.getIndicesPtr(f),ne=this.module.getIndicesLength(f),ae=new Int16Array(this.module.heap16.buffer,ee,ne),be=this.module.getBuildingPart(f);a[f]={positions:v,normals:E,ao:L,uv:V,isFauxFacade:Z,indices:ae,buildingPart:be}}const u=this.module.getRingCount(),h=[];for(let f=0;f<u;f++){const _=this.module.getRingPtr(f),y=this.module.getRingLength(f),v=new Float32Array(this.module.heapF32.buffer,_,y);h.push(v)}return{meshes:a,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:h}}}let Ed,n_,hs,Bu,o_,Nu=null,Vu=null,yy=null,gp=null;function xy(){return Kt(self)&&self.worker.dracoUrl?self.worker.dracoUrl:n_||qt.DRACO_URL}function vy(){if(Kt(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Bu)return Bu;
7const r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Bu=WebAssembly.validate(r)?qt.MESHOPT_SIMD_URL:qt.MESHOPT_URL,Bu}function J0(){return gp}const yp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Q0={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Id={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function by(r,e,i){const o=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=o,i.json.bufferViews[o]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const s_="KHR_draco_mesh_compression";function e1(r,e){const i=r.extensions&&r.extensions[s_];if(!i)return;const o=new hs.Decoder,a=Ey(e,i.bufferView),u=new hs.Mesh;if(!o.DecodeArrayToMesh(a,a.byteLength,u))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],f=yp[h.componentType],_=h.count*f.BYTES_PER_ELEMENT,y=hs._malloc(_);f===Uint16Array?o.GetTrianglesUInt16Array(u,_,y):o.GetTrianglesUInt32Array(u,_,y),by(hs.memory.buffer.slice(y,y+_),h,e),hs._free(y);for(const v of Object.keys(i.attributes)){const b=o.GetAttributeByUniqueId(u,i.attributes[v]),T=e.json.accessors[r.attributes[v]],E=Q0[T.componentType],I=T.count*Id[T.type]*yp[T.componentType].BYTES_PER_ELEMENT,P=hs._malloc(I);o.GetAttributeDataArrayForAllPoints(u,b,hs[E],I,P),by(hs.memory.buffer.slice(P,P+I),T,e),hs._free(P)}o.destroy(),u.destroy(),delete r.extensions[s_]}const xp="EXT_meshopt_compression";function t1(r,e){if(!r.extensions||!r.extensions[xp])return;const i=r.extensions[xp],o=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);o_.decodeGltfBuffer(a,i.count,i.byteStride,o,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[xp]}const wy=1179937895,Ty=new TextDecoder("utf8");function Sy(r,e){return new URL(r,e).href}function i1(r,e,i,o){return fetch(Sy(r.uri,o)).then((a=>a.arrayBuffer())).then((a=>{e.buffers[i]=a}))}function Ey(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function r1(r,e,i,o){if(r.uri){const a=Sy(r.uri,o);return fetch(a).then((u=>u.blob())).then((u=>createImageBitmap(u))).then((u=>{e.images[i]=u}))}if(r.bufferView!==void 0){const a=Ey(e,r.bufferView),u=new Blob([a],{type:r.mimeType});return createImageBitmap(u).then((h=>{e.images[i]=h}))}}function Iy(r,e=0,i){const o={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===wy){const v=new Uint32Array(r,e);let b=2;const T=(v[b++]>>2)-3,E=v[b++]>>2;if(b++,o.json=JSON.parse(Ty.decode(v.subarray(b,b+E))),b+=E,b<T){const I=v[b++];b++;const P=e+(b<<2);o.buffers[0]=r.slice(P,P+I)}}else o.json=JSON.parse(Ty.decode(new Uint8Array(r,e)));const{buffers:a,images:u,meshes:h,extensionsUsed:f,bufferViews:_}=o.json;let y=Promise.resolve();if(a){const v=[];for(let b=0;b<a.length;b++){const T=a[b];T.uri?v.push(i1(T,o,b,i)):o.buffers[b]||(o.buffers[b]=null)}y=Promise.all(v)}return y.then((()=>{const v=[],b=f&&f.includes(s_),T=f&&f.includes(xp);if(b&&v.push((function(){if(!hs)return Ed??(Ed=(function(E){let I,P=null;function L(){I=new Uint8Array(P.buffer)}function D(){throw new Error("Unexpected Draco error.")}const B={a:{a:D,d:function(V,G,K){return I.copyWithin(V,G,G+K)},c:function(V){const G=I.length,K=Math.max(V>>>0,Math.ceil(1.2*G)),Z=Math.ceil((K-G)/65536);try{return P.grow(Z),L(),!0}catch{return!1}},b:D}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,B):E.then((V=>V.arrayBuffer())).then((V=>WebAssembly.instantiate(V,B)))).then((V=>{const{Rb:G,Qb:K,P:Z,T:ee,X:ne,Ja:ae,La:be,Qa:he,Va:Ee,Wa:Ce,eb:Pe,jb:Fe,f:Be,e:ze,yb:De,zb:Se,Ab:we,Bb:Le,Db:Ze,Gb:je}=V.instance.exports;P=ze;const dt=(()=>{let Qe=0,rt=0,at=0,Ut=0;return Ge=>{at&&(G(Ut),G(Qe),rt+=at,at=Qe=0),Qe||(rt+=128,Qe=K(rt));const lt=Ge.length+7&-8;let It=Qe;lt>=rt&&(at=lt,It=Ut=K(lt));for(let Zt=0;Zt<Ge.length;Zt++)I[It+Zt]=Ge[Zt];return It}})();return L(),Be(),{memory:ze,_free:G,_malloc:K,Mesh:class{constructor(){this.ptr=Z()}destroy(){ee(this.ptr)}},Decoder:class{constructor(){this.ptr=ae()}destroy(){Fe(this.ptr)}DecodeArrayToMesh(Qe,rt,at){const Ut=dt(Qe),Ge=be(this.ptr,Ut,rt,at.ptr);return!!ne(Ge)}GetAttributeByUniqueId(Qe,rt){return{ptr:he(this.ptr,Qe.ptr,rt)}}GetTrianglesUInt16Array(Qe,rt,at){Ee(this.ptr,Qe.ptr,rt,at)}GetTrianglesUInt32Array(Qe,rt,at){Ce(this.ptr,Qe.ptr,rt,at)}GetAttributeDataArrayForAllPoints(Qe,rt,at,Ut,Ge){Pe(this.ptr,Qe.ptr,rt.ptr,at,Ut,Ge)}},DT_INT8:De(),DT_UINT8:Se(),DT_INT16:we(),DT_UINT16:Le(),DT_UINT32:Ze(),DT_FLOAT32:je()}}))})(fetch(xy())),Ed.then((E=>{hs=E,Ed=void 0})))})()),T&&v.push((function(){if(o_)return;const E=(function(I){let P;const L=WebAssembly.instantiateStreaming(I,{}).then((V=>{P=V.instance,P.exports.__wasm_call_ctors()})),D={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},B={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:L,supported:!0,decodeGltfBuffer(V,G,K,Z,ee,ne){(function(ae,be,he,Ee,Ce,Pe,Fe){const Be=ae.exports.sbrk,ze=Ee+3&-4,De=Be(ze*Ce),Se=Be(Pe.length),we=new Uint8Array(ae.exports.memory.buffer);we.set(Pe,Se);const Le=be(De,Ee,Ce,Se,Pe.length);if(Le===0&&Fe&&Fe(De,ze,Ce),he.set(we.subarray(De,De+Ee*Ce)),Be(De-Be(0)),Le!==0)throw new Error(`Malformed buffer data: ${Le}`)}
7)(P,P.exports[B[ee]],V,G,K,Z,P.exports[D[ne]])}}})(fetch(vy()));return E.ready.then((()=>{o_=E}))})()),u)for(let E=0;E<u.length;E++)v.push(r1(u[E],o,E,i));return(v.length?Promise.all(v):Promise.resolve()).then((()=>{if(b&&h)for(const{primitives:E}of h)for(const I of E)e1(I,o);if(T&&h&&_)for(const E of _)t1(E,o);return o}))}))}function Ay(r){return fetch(r).then((e=>e.arrayBuffer())).then((e=>Iy(e,0,r)))}function a_(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 l_(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 c_{constructor(e,i,o,a){this.context=e,this.format=o,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const o=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:u}=this,{gl:h}=u,{x:f,y:_}=i&&i.position?i.position:{x:0,y:0},y=f+o,v=_+a;!this.size||this.size[0]===y&&this.size[1]===v||(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.RGBA8&&(!i||i.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&y>0&&v>0){const T=this.useMipmap?Math.floor(Math.log2(Math.max(y,v)))+1:1;h.texStorage2D(h.TEXTURE_2D,T,this.format,y,v),this.size=[y,v]}this.size&&(b?h.texSubImage2D(h.TEXTURE_2D,0,f,_,a_(this.format),l_(this.format),e):"data"in e&&e.data&&h.texSubImage2D(h.TEXTURE_2D,0,f,_,o,a,a_(this.format),l_(this.format),e.data)),this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,o=!1){const{context:a}=this,{gl:u}=a;u.bindTexture(u.TEXTURE_2D,this.texture),e!==this.minFilter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,this.useMipmap&&!o?e===u.NEAREST?u.NEAREST_MIPMAP_NEAREST:u.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,o,a,u){const{context:h}=this,{gl:f}=h;f.bindTexture(f.TEXTURE_2D,this.texture),i!==this.magFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this.useMipmap?e===f.NEAREST?f.NEAREST_MIPMAP_NEAREST:f.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),o!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,o),this.wrapS=o),a!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,a),this.wrapT=a),u!==this.compareMode&&(u?(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.COMPARE_REF_TO_TEXTURE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_FUNC,u)):f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.NONE),this.compareMode=u)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Ad{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:o}=this,{gl:a}=o;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 n1=jt([{name:"a_pos_3f",components:3,type:"Float32"}]),o1=jt([{name:"a_color_3f",components:3,type:"Float32"}]),s1=jt([{name:"a_color_4f",components:4,type:"Float32"}]),a1=jt([{name:"a_uv_2f",components:2,type:"Float32"}]),l1=jt([{name:"a_normal_3f",components:3,type:"Float32"}]),c1=jt([{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"}]),u1=jt([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function My(r,e){const i=vp(r.projection,r.zoom,r.width,r.height),o=(function(u,h,f,_,y){const v=new n(f.lng-180*ll,f.lat),b=new n(f.lng+180*ll,f.lat),T=u.project(v.lng,v.lat),E=u.project(b.lng,b.lat),I=-Math.atan2(E.y-T.y,E.x-T.x),P=U.fromLngLat(f);P.y=O(P.y,-1+ll,1-ll);const L=P.toLngLat(),D=u.project(L.lng,L.lat),B=U.fromLngLat(L);B.x+=ll;const V=B.toLngLat(),G=u.project(V.lng,V.lat),K=Py(G.x-D.x,G.y-D.y,I),Z=U.fromLngLat(L);Z.y+=ll;const ee=Z.toLngLat(),ne=u.project(ee.lng,ee.lat),ae=Py(ne.x-D.x,ne.y-D.y,I),be=Math.abs(K.x)/Math.abs(ae.y),he=Ni([]);kn(he,he,-I*(1-(y?0:_)));const Ee=Ni([]);return Hr(Ee,Ee,[1,1-(1-be)*_,1]),Ee[4]=-ae.x/ae.y*_,kn(Ee,Ee,I),Gi(Ee,he,Ee),Ee}
vendor: 6,979 bytes, line 7
7)(r.projection,0,r.center,i,e),a=Cy(r);return Hr(o,o,[a,a,1]),o}function Cy(r){const e=r.projection,i=vp(r.projection,r.zoom,r.width,r.height),o=u_(e,r.center),a=u_(e,n.convert(e.center));return Math.pow(2,o*i+(1-i)*a)}function vp(r,e,i,o,a=1/0){const u=r.range;if(!u)return 0;const h=Math.min(a,Math.max(i,o)),f=Math.log2(h/1024);return N(u[0]+f,u[1]+f,e)}const ll=1/4e4;function u_(r,e){const i=O(e.lat,-C,C),o=new n(e.lng-180*ll,i),a=new n(e.lng+180*ll,i),u=r.project(o.lng,i),h=r.project(a.lng,i),f=U.fromLngLat(o),_=U.fromLngLat(a),y=h.x-u.x,v=h.y-u.y,b=_.x-f.x,T=_.y-f.y,E=Math.sqrt((b*b+T*T)/(y*y+v*v));return Math.log2(E)}function Py(r,e,i){const o=Math.cos(i),a=Math.sin(i);return{x:r*o-e*a,y:r*a+e*o}}function Ry(r,e,i){Ni(r),kn(r,r,oi(e[2])),Wn(r,r,oi(e[0])),wn(r,r,oi(e[1])),Hr(r,r,i),Gi(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function bp(r,e,i,o,a,u,h,f){const _=[i[0]-e[0],i[1]-e[1],0],y=[o[0]-e[0],o[1]-e[1],0];if(Ir(_)<1e-12||Ir(y)<1e-12)return Ra(r);const v=en([],_,y);Bi(v,v),Or(y,o,e),_[2]=(u-a)*f,y[2]=(h-a)*f;const b=_;return en(b,_,y),Bi(b,b),za(r,v,b)}function wp(r,e,i=!1){const o=sl(e.zoom),a=(function(u,h,f){const _=h.worldSize,y=[u[12],u[13],u[14]],v=M(y[1]/_),b=S(y[0]/_),T=Ni([]),E=w(1,v)*_,I=w(1,0)*_*R(v,h.zoom),P=1/Nm(_);let L=I*P;if(f){const G=vp(h.projection,h.zoom,h.width,h.height,1024);L=P*h.projection.pixelSpaceConversion(h.center.lat,_,G)}const D=rl(v,b);gi(D,D,Zi([],Bi([],D),E*L*y[2]));const B=(function(G){const K=[G[0],G[1],G[2]];let Z=[0,1,0];const ee=en([],Z,K);return en(Z,K,ee),pc(Z)===0&&(Z=[0,1,0],en(ee,K,Z)),Bi(ee,ee),Bi(Z,Z),Bi(K,K),[ee[0],ee[1],ee[2],0,Z[0],Z[1],Z[2],0,K[0],K[1],K[2],0,G[0],G[1],G[2],1]})(D);Hr(T,T,[L,L,L*E]),Qr(T,T,[-y[0],-y[1],-y[2]]);const V=Gi([],h.globeMatrix,B);return Gi(V,V,T),Gi(V,V,u),V})(r,e,i);if(o>0){const u=(function(h,f){const _=f.worldSize,y=w(1,0)*_*R(f.center.lat,f.zoom)/Nm(_),v=w(1,f.center.lat)*_,b=Ni([]);wn(b,b,oi(f.center.lng)),Wn(b,b,oi(f.center.lat)),Qr(b,b,[0,0,on]),Hr(b,b,[y,y,y*v]);const T=f.point;return Qr(b,b,[-T.x,-T.y,0]),Gi(b,b,h),Gi(b,f.globeMatrix,b)})(r,e);return(function(h,f,_){const y=(I,P,L)=>{const D=Ir(I),B=Ir(P),V=us(I,P,L);return Zi(V,V,1/Ir(V)*wt(D,B,L))},v=y([h[0],h[1],h[2]],[f[0],f[1],f[2]],_),b=y([h[4],h[5],h[6]],[f[4],f[5],f[6]],_),T=y([h[8],h[9],h[10]],[f[8],f[9],f[10]],_),E=us([h[12],h[13],h[14]],[f[12],f[13],f[14]],_);return[v[0],v[1],v[2],0,b[0],b[1],b[2],0,T[0],T[1],T[2],0,E[0],E[1],E[2],1]})(a,u,o)}return a}function h_(r,e,i,o){const a=ut.projectAabbCorners(o,i);let u=Number.MAX_VALUE;for(let f=0;f<a.length;++f){const _=a[f];_[0]=(.5*_[0]+.5)*e.width,_[1]=(.5-.5*_[1])*e.height,_[2]<u&&(u=_[2])}const h=(function(f){const _=[];let y=0;for(let E=1;E<f.length;E++)(f[E][0]<f[y][0]||f[E][0]===f[y][0]&&f[E][1]<f[y][1])&&(y=E);let v,b=y;const T=new Uint8Array(f.length);do{if(T[b])break;_.push(new Oe(f[b][0],f[b][1])),T[b]=1,v=(b+1)%f.length;for(let E=0;E<f.length;E++){if(f[E][0]===f[v][0]&&f[E][1]===f[v][1]||f[E][0]===f[b][0]&&f[E][1]===f[b][1])continue;const I=[f[E][0]-f[b][0],f[E][1]-f[b][1]],P=[f[v][0]-f[b][0],f[v][1]-f[b][1]],L=I[0]*P[1]-I[1]*P[0];(L>0||L===0&&I[0]*P[0]+I[1]*P[1]>=0&&I[0]*I[0]+I[1]*I[1]>P[0]*P[0]+P[1]*P[1])&&(v=E)}b=v}while(b!==y);return _.length>0&&_.push(_[0]),_})(a);if(ni(r,h))return u}const ac=64,Uu={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Tp(r,e,i,o,a,u,h,f,_,y=!1){const v=i.zoom,b=i.project(o),T=R(o.lat,v),E=1/T;Ni(r),Qr(r,r,[b.x+h[0]*E,b.y+h[1]*E,h[2]]);let I=1,P=1;const L=i.worldSize;if(y){if(i.projection.name==="mercator"){let G=0;i.elevation&&(G=i.elevation.getAtPointOrZero(new U(b.x/L,b.y/L),0));const K=tn([],[b.x,b.y,G,1],i.projMatrix)[3]/i.cameraToCenterDistance;I=K,P=K*R(i.center.lat,v)}else if(i.projection.name==="globe"){const G=wp(r,i),K=[0,0,0,1];tn(K,K,Gi([],i.projMatrix,G));const Z=K[3]/i.cameraToCenterDistance,ee=sl(v),ne=i.projection.pixelsPerMeter(o.lat,L)*R(o.lat,v),ae=i.projection.pixelsPerMeter(i.center.lat,L)*R(i.center.lat,v);I=Z/wt(ne,z(i.center.lat),ee),P=Z*T/ne,I*=ae,P*=ae}}else I=E;Hr(r,r,[I,I,P]);const D=[...r],B=e.orientation,V=[];if(Ry(V,[B[0]+(a?a[0]:0),B[1]+(a?a[1]:0),B[2]+(a?a[2]:0)],u),Gi(r,D,V),f&&i.elevation){let G=0;const K=[];if(_&&i.elevation){G=(function(ee,ne,ae,be,he){const Ee=ne.elevation;if(!Ee)return 0;const Ce=ut.projectAabbCorners(ae,be),Pe=w(1,he.lat)*ne.worldSize,Fe=(function(rt,at){const Ut=[0,0,1],Ge=[{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 lt of Ge){const It=rt[lt.corners[0]],Zt=rt[lt.corners[1]],Xt=rt[lt.corners[2]],Rt=[Zt[0]-It[0],Zt[1]-It[1],at*(Zt[2]-It[2])],Si=en(Rt,Rt,[Xt[0]-It[0],Xt[1]-It[1],at*(Xt[2]-It[2])]);Bi(Si,Si),lt.dotProductWithUp=fr(Si,Ut)}return Ge.sort(((lt,It)=>lt.dotProductWithUp-It.dotProductWithUp)),Ge[0].corners})(Ce,Pe),Be=Ce[Fe[0]],ze=Ce[Fe[1]],De=Ce[Fe[2]],Se=Ce[Fe[3]],we=Ee.getAtPointOrZero(new U(Be[0]/ne.worldSize,Be[1]/ne.worldSize),0),Le=Ee.getAtPointOrZero(new U(ze[0]/ne.worldSize,ze[1]/ne.worldSize),0),Ze=Ee.getAtPointOrZero(new U(De[0]/ne.worldSize,De[1]/ne.worldSize),0),je=Ee.getAtPointOrZero(new U(Se[0]/ne.worldSize,Se[1]/ne.worldSize),0),dt=(we+je)/2,Qe=(Le+Ze)/2;return dt>Qe?Le<Ze?bp(ee,ze,Se,Be,Le,je,we,Pe):bp(ee,De,Be,Se,Ze,we,je,Pe):we<je?bp(ee,Be,ze,De,we,Le,Ze,Pe):bp(ee,Se,De,ze,je,Ze,Le,Pe),Math.max(dt,Qe)})(K,i,e.aabb,r,o);const Z=Gi([],dr([],K),V);Gi(r,D,Z)}else G=i.elevation.getAtPointOrZero(new U(b.x/L,b.y/L),0);G!==0&&(r[14]+=G)}}class zy{constructor(e,i,o,a,u){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=i,this.position=o!=null?new n(o[0],o[1]):new n(0,0),this.orientation=a??[0,0,0],this.nodes=u,this.uploaded=!1,this.aabb=new ut([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){Gi(e.globalMatrix,i,e.localMatrix);const o=this.nodeOverrides.get(e.name);if(o!==void 0){const h=[];u=o.orientation,Ni(a=h),wn(a,a,oi(u[1])),kn(a,a,oi(u[2])),Wn(a,a,oi(u[0])),Gi(e.globalMatrix,e.globalMatrix,h)}var a,u;if(e.meshes)for(const h of e.meshes){const f=ut.applyTransformFast(h.aabb,e.globalMatrix);this.aabb.encapsulate(f)}if(e.children)for(const h of e.children)this._applyTransformations(h,e.globalMatrix)}computeBoundsAndApplyParent(){const e=Ni([]);this.aabb=new ut([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,o,a,u,h,f=!1){Tp(this.matrix,this,e.transform,this.position,i,o,a,u,h,f)}upload(e){if(!this.uploaded){for(const i of this.nodes)d_(i,e);for(const i of this.nodes)Sp(i);this.uploaded=!0}}destroy(){for(const e of this.nodes)f_(e)}}function Md(r,e,i=!1){r.uploaded||(r.gfxTexture=new c_(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}
7function h1(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,n1.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,l1.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,a1.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?o1:s1).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,u1.members,!0)),r.segments=Wi.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const o=r.material;o.pbrMetallicRoughness.baseColorTexture&&Md(o.pbrMetallicRoughness.baseColorTexture,e),o.pbrMetallicRoughness.metallicRoughnessTexture&&Md(o.pbrMetallicRoughness.metallicRoughnessTexture,e),o.normalTexture&&Md(o.normalTexture,e),o.occlusionTexture&&Md(o.occlusionTexture,e,i),o.emissionTexture&&Md(o.emissionTexture,e)}function d_(r,e,i){if(r.meshes)for(const o of r.meshes)h1(o,e,i);if(r.children)for(const o of r.children)d_(o,e,i)}function Sp(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)Sp(e)}function f_(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)f_(i)}function lc(r,e){const i=r.json.bufferViews[e.bufferView],o=yp[e.componentType];return new o(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==Id[e.type]*o.BYTES_PER_ELEMENT?i.byteStride/o.BYTES_PER_ELEMENT:Id[e.type]))}function p_(r,e,i,o){const a=yp[e.componentType],u=(function(v){switch(v){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}})(a),h=r.json.bufferViews[e.bufferView],f=h.byteStride?h.byteStride/a.BYTES_PER_ELEMENT:Id[e.type],_=i.float32,y=_.length/i.capacity;for(let v=0,b=0;v<e.count*f;v+=f,b+=y)for(let T=0;T<y;T++)_[b+T]=o[v+T]*u;i._trim()}function d1(r,e,i){const o=r.indices,a=r.attributes,u={};u.indexArray=new Ar;const h=e.json.accessors[o],f=h.count/3;u.indexArray.reserve(f);const _=lc(e,h);for(let T=0;T<f;T++)u.indexArray.emplaceBack(_[3*T],_[3*T+1],_[3*T+2]);u.indexArray._trim(),u.vertexArray=new jn;const y=e.json.accessors[a.POSITION];u.vertexArray.reserve(y.count);const v=lc(e,y);for(let T=0;T<y.count;T++)u.vertexArray.emplaceBack(v[3*T],v[3*T+1],v[3*T+2]);if(u.vertexArray._trim(),u.aabb=new ut(y.min,y.max),u.centroid=(function(T,E){const I=[0,0,0],P=T.length;if(P>0){for(let L=0;L<P;L++){const D=3*T[L];I[0]+=E[D],I[1]+=E[D+1],I[2]+=E[D+2]}I[0]/=P,I[1]/=P,I[2]/=P}return I})(_,v),a.COLOR_0!==void 0){const T=e.json.accessors[a.COLOR_0],E=Id[T.type],I=lc(e,T);u.colorArray=E===3?new jn:new Ns,u.colorArray.resize(T.count),p_(e,T,u.colorArray,I)}if(a.NORMAL!==void 0){u.normalArray=new jn;const T=e.json.accessors[a.NORMAL];u.normalArray.resize(T.count);const E=lc(e,T);p_(e,T,u.normalArray,E)}if(a.TEXCOORD_0!==void 0&&i.length>0){u.texcoordArray=new Bo;const T=e.json.accessors[a.TEXCOORD_0];u.texcoordArray.resize(T.count);const E=lc(e,T);p_(e,T,u.texcoordArray,E)}if(a._FEATURE_ID_RGBA4444!==void 0){const T=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(u.featureData=lc(e,T))}a._FEATURE_RGBA4444!==void 0&&(u.featureData=new Uint32Array(lc(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const b=r.material;return u.material=(function(T,E){const{emissiveFactor:I=[0,0,0],alphaMode:P="OPAQUE",alphaCutoff:L=.5,normalTexture:D,occlusionTexture:B,emissiveTexture:V,doubleSided:G,name:K}=T,{baseColorFactor:Z=[1,1,1,1],metallicFactor:ee=1,roughnessFactor:ne=1,baseColorTexture:ae,metallicRoughnessTexture:be}=T.pbrMetallicRoughness||{},he=B?E[B.index]:void 0;if(B&&B.extensions&&B.extensions.KHR_texture_transform&&he){const Ee=B.extensions.KHR_texture_transform;he.offsetScale=[Ee.offset[0],Ee.offset[1],Ee.scale[0],Ee.scale[1]]}return{name:K,pbrMetallicRoughness:{baseColorFactor:new yi(...Z),metallicFactor:ee,roughnessFactor:ne,baseColorTexture:ae?E[ae.index]:void 0,metallicRoughnessTexture:be?E[be.index]:void 0}
7,doubleSided:G,emissiveFactor:new yi(...I),alphaMode:P,alphaCutoff:L,normalTexture:D?E[D.index]:void 0,occlusionTexture:he,emissionTexture:V?E[V.index]:void 0,defined:T.defined===void 0}})(b!==void 0?e.json.materials[b]:{defined:!1},i),u}function Dy(r,e,i){const{matrix:o,rotation:a,translation:u,scale:h,mesh:f,extras:_,children:y,name:v}=r,b={};if(b.name=v,b.localMatrix=o||(function(T,E,I,P){var L=E[0],D=E[1],B=E[2],V=E[3],G=L+L,K=D+D,Z=B+B,ee=L*G,ne=L*K,ae=L*Z,be=D*K,he=D*Z,Ee=B*Z,Ce=V*G,Pe=V*K,Fe=V*Z,Be=P[0],ze=P[1],De=P[2];return T[0]=(1-(be+Ee))*Be,T[1]=(ne+Fe)*Be,T[2]=(ae-Pe)*Be,T[3]=0,T[4]=(ne-Fe)*ze,T[5]=(1-(ee+Ee))*ze,T[6]=(he+Ce)*ze,T[7]=0,T[8]=(ae+Pe)*De,T[9]=(he-Ce)*De,T[10]=(1-(ee+be))*De,T[11]=0,T[12]=I[0],T[13]=I[1],T[14]=I[2],T[15]=1,T})([],a||[0,0,0,1],u||[0,0,0],h||[1,1,1]),b.globalMatrix=mi(b.localMatrix),f!==void 0){b.meshes=i[f];const T=b.anchor=[0,0];for(const E of b.meshes){const{min:I,max:P}=E.aabb;T[0]+=I[0]+P[0],T[1]+=I[1]+P[1]}T[0]=Math.floor(T[0]/b.meshes.length/2),T[1]=Math.floor(T[1]/b.meshes.length/2)}if(_&&(_.id&&(b.id=_.id),_.lights&&(b.lights=(function(T){if(!T.length)return[];const E=(function(B){const V=atob(B),G=new Uint8Array(V.length);for(let K=0;K<V.length;K++)G[K]=V.codePointAt(K);return G})(T),I=[],P=E.length/24,L=new Uint16Array(E.buffer),D=new Float32Array(E.buffer);for(let B=0;B<P;B++){const V=L[2*B*6]/30,G=L[2*B*6+1]/30,K=L[2*B*6+10]/100,Z=D[6*B+1],ee=D[6*B+2],ne=D[6*B+3],ae=D[6*B+4],be=ne-Z,he=ae-ee,Ee=Math.hypot(be,he);I.push({pos:[Z+.5*be,ee+.5*he,G],normal:[he/Ee,-be/Ee,0],width:Ee,height:V,depth:K,points:[Z,ee,ne,ae]})}return I})(_.lights)),_.MAPBOX_geometry_bloom&&(b.isGeometryBloom=_.MAPBOX_geometry_bloom)),y){const T=[];for(const E of y)T.push(Dy(e.json.nodes[E],e,i));b.children=T}return b}function f1(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new up(r.vertices,r.indices,8,256),[i,o]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:o}}function p1(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 o=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const f=h[0],_=h[1];typeof f=="number"&&typeof _=="number"&&o.push(new Oe(f,_))}if(o.length<3)return null;o.length>1&&o[o.length-1].equals(o[0])&&o.pop();let a=0;for(let h=0;h<o.length;h++){const f=o[h],_=o[(h+1)%o.length],y=o[(h+2)%o.length];a+=(f.x-_.x)*(y.y-_.y)-(y.x-_.x)*(f.y-_.y)}a>0&&o.reverse();const u=Ou(o.flatMap((h=>[h.x,h.y])),[]);return u.length===0?null:{vertices:o,indices:u}}function m1(r,e){const i=[],o=[];let a=0;const u=[];for(const h of r){a=i.length;const f=h.vertexArray.float32,_=h.indexArray.uint16;for(let y=0;y<h.vertexArray.length;y++)u[0]=f[3*y+0],u[1]=f[3*y+1],u[2]=f[3*y+2],gr(u,u,e),i.push(new Oe(u[0],u[1]));for(let y=0;y<3*h.indexArray.length;y++)o.push(_[y]+a)}if(o.length%3!=0)return null;for(let h=0;h<o.length;h+=3){const f=i[o[h+0]],_=i[o[h+1]],y=i[o[h+2]];(f.x-_.x)*(y.y-_.y)-(y.x-_.x)*(f.y-_.y)>0&&([o[h+1],o[h+2]]=[o[h+2],o[h+1]])}return{vertices:i,indices:o}}function m_(r){const e=(function(_,y){const v=[],b=WebGL2RenderingContext;if(_.json.textures)for(const T of _.json.textures){const E={magFilter:b.LINEAR,minFilter:b.NEAREST,wrapS:b.REPEAT,wrapT:b.REPEAT};T.sampler!==void 0&&Object.assign(E,_.json.samplers[T.sampler]),v.push({image:y[T.source],sampler:E,uploaded:!1})}return v})(r,r.images),i=(function(_,y){const v=[];for(const b of _.json.meshes){const T=[];for(const E of b.primitives)T.push(d1(E,_,y));v.push(T)}return v})(r,e),{scenes:o,scene:a,nodes:u}=r.json,h=o?o[a||0].nodes:[...u.keys()],f=[];for(const _ of h)f.push(Dy(u[_],r,i));return(function(_,y,v){const b={},T=new Set;for(let E=0;E<_.length;E++){const I=v[y[E]];if(!I.extras)continue;const P=I.extras["mapbox:footprint:version"],L=I.extras["mapbox:footprint:id"];(P||L)&&T.add(E),P==="1.0.0"&&L&&(b[L]=E)}for(let E=0;E<_.length;E++){if(T.has(E))continue;const I=_[E],P=v[y[E]];if(!P.extras)continue;let L=null;I.id in b&&(L=m1(_[b[I.id]].meshes,I.localMatrix)),L||(L=p1(P)),L&&(I.footprint=f1(L))}if(T.size>0){const E=Array.from(T.values()).sort(((I,P)=>I-P));for(let I=E.length-1;I>=0;I--)_.splice(E[I],1)}})(f,h,r.json.nodes),f}function _1(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,o=r.aabb.min[1]-1,a=ac/(r.aabb.max[0]-i+2),u=ac/(r.aabb.max[1]-o+2);for(let h=0;h<e.length;h+=3){const f=e[h+2],_=(e[h+0]-i)*a|0,y=(e[h+1]-o)*u|0;f>r.heightmap[y*ac+_]&&(r.heightmap[y*ac+_]=f)}}function Ly(r,e,i,o,a){i.reserve(i.length+4*r.length),o.reserve(o.length+10*r.length),a.reserve(a.length+10*r.length);let u=o.length;for(const h of r){const f=Math.min(10,Math.max(4,1.3*h.height))*e,_=[-h.normal[1],h.normal[0],0],y=Math.min(.29,.1*h.width/h.depth),v=h.width-2*h.depth*e*(y+.01),b=qr([],h.pos,_,v/2),T=qr([],h.pos,_,-v/2),E=[b[0],b[1],b[2]+h.height],I=[T[0],T[1],T[2]+h.height],P=qr([],h.normal,_,y);Zi(P,P,f);const L=qr([],h.normal,_,-y);Zi(L,L,f),gi(P,b,P),gi(L,T,L),b[2]+=.1,T[2]+=.1,o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(L[0],L[1],L[2]),o.emplaceBack(b[0],b[1],b[2]),o.emplaceBack(T[0],T[1],T[2]),o.emplaceBack(E[0],E[1],E[2]),o.emplaceBack(I[0],I[1],I[2]),o.emplaceBack(b[0],b[1],b[2]),o.emplaceBack(T[0],T[1],T[2]),o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(L[0],L[1],L[2]);const D=v/f/2;a.emplaceBack(-D-y,-1,D,.8),a.emplaceBack(D+y,-1,D,.8),a.emplaceBack(-D,0,D,1.3),a.emplaceBack(D,0,D,1.3),a.emplaceBack(D+y,-.8,D,.7),a.emplaceBack(D+y,-.8,D,.7),a.emplaceBack(0,0,D,1.3),a.emplaceBack(0,0,D,1.3),a.emplaceBack(D+y,-1.2,D,.8),a.emplaceBack(D+y,-1.2,D,.8),i.emplaceBack(6+u,4+u,8+u),i.emplaceBack(7+u,9+u,5+u),i.emplaceBack(0+u,1+u,2+u),i.emplaceBack(1+u,3+u,2+u),u+=10}}function g1(r,e){const i={};i.indexArray=new Ar,i.vertexArray=new jn,i.colorArray=new Ns,Ly(r,e,i.indexArray,i.vertexArray,i.c
7olorArray);const o={defined:!0};o.emissiveFactor=yi.black;const a={};return a.baseColorFactor=yi.white,o.pbrMetallicRoughness=a,i.material=o,i.aabb=new ut([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const Oy=jt([{name:"a_pos_3f",components:3,type:"Float32"}]),y1=jt([{name:"a_normal_3",components:3,type:"Int16"}]),x1=jt([{name:"a_centroid_3",components:3,type:"Int16"}]),Fy=jt([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),v1=jt([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),b1=jt([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),w1=jt([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),T1=jt([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),S1=jt([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),ky=le.types,Ep=32767;function E1(r,e){const i=$e+e;for(const o of r)for(const a of o)if(a.x<-e||a.x>i||a.y<-e||a.y>i)return!1;return!0}function I1(r){switch(r){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${r}`)}}class __{constructor(){this.layoutVertexArray=new jn,this.layoutAttenuationArray=new Ns,this.layoutColorArray=new Gn,this.indexArray=new Ar,this.indexArrayForConflation=new Ar,this.segmentsBucket=new Wi}}class g_{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Wi,this.entranceBloom=new __;const i=66560;this.layoutVertexArray=new jn,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new Ka,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new Ka,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new Gn,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new Vs,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new Tu,this.layoutAOArray.reserve(i),this.indexArray=new Ar,this.indexArray.reserve(66560),this.indexArrayForConflation=new Ar,this.segmentsBucket=new Wi,this.entranceBloom=new __,e&&(this.layoutFacadePaintArray=new Gn,this.layoutFacadeDataArray=new ba,this.layoutFacadeVerticalRangeArray=new Gn)}reserve(e,i,o){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(i),o&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class By{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Bo,this.footprintsIndices=new Vs,this.footprintsMin=new Oe(1/0,1/0),this.footprintsMax=new Oe(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new g_(!1),this.buildingWithFacade=new g_(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.fqid)),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new vo(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.projection=e.projection,this.groundEffect=new Qm(e),this.groundEffect.groundRadiusArray=new rs,this.hasAppearances=null}updateFootprints(e,i){const o=new up([],[],1),a={vertices:[],indices:new Uint32Array(0),grid:o,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:a,id:e})}updateAppearances(e,i,o,a){}prepare(){return(function(){if(gp!=null||yy!=null)return null;if(Vu!=null)return Vu;const e=fetch(qt.BUILDING_GEN_URL);return Vu=(function(i){let o,a,u,h,f;function _(){o=new Uint8Array(f.buffer),a=new Int16Array(f.buffer),u=new Int32Array(f.buffer),h=new Float32Array(f.buffer)}function y(){throw new Error("Unexpected BuildingGen error.")}const v=()=>{},b={a:{a:y,f:function(T){const E=o.length,I=Math.max(T>>>0,Math.ceil(1.2*E)),P=Math.ceil((I-E)/65536);try{return f.grow(P),_(),!0}catch{return!1}},g:y,b:v,c:v,d:v,e:v}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,b):i.then((T=>T.arrayBuffer())).then((T=>WebAssembly.instantiate(T,b)))).then((T=>{const E=T.instance.exports;return(0,E.g)(),f=E.f,_(),new K0({setStyle:E.h,setAOOptions:E.i,setMetricOptions:E.j,setStructuralOptions:E.k,setFacadeOptions:E.l,setFauxFacadeOptions:E.m,setFacadeClassifierOptions:E.n,addFeature:E.o,addFacade:E.p,generateMesh:E.q,getLastError:E.r,getOuterRingLength:E.s,getMeshCount:E.t,getPositionsPtr:E.u,getPositionsLength:E.v,getNormalsPtr:E.w,getNormalsLength:E.x,getAOPtr:E.y,getAOLength:E.z,getUVPtr:E.A,getUVLength:E.B,getFauxFacadePtr:E.C,getFauxFacadeLength:E.D,getIndicesPtr:E.E,getIndicesLength:E.F,getBuildingPart:E.G,getRingCount:E.H,getRingPtr:E.I,getRingLength:E.J,malloc:E.K,free:E.L,heapU8:o,heap16:a,heap32:u,heapF32:h})}))})(e).then((i=>(Vu=null,gp=i,gp))).catch((i=>{tt("Could not load building-gen"),Vu=null,yy=i})),Vu})()}populate(e,i,o,a){const u=J0();if(!u)return;const h=F(o);this.tileToMeter=h,this.brightness=i.brightness,u.setStyle({normalScale:[1,-1,h],tileToMeters:h}),u.setAOOptions(!1,.3),u.setMetricOptions(!1,16),u.setStructuralOptions(!0),u.setFacadeClassifierOptions(3);const f=new Map,_=new Map;let y=0;for(const{feature:D}of e){if(ky[D.type]!=="LineString"){f.set(D.id,D.properties.source_id);continue}const B=this.layers[0]._featureFilter.needGeometry;if(B&&!this.layers[0]._featureFilter.filter(new Li(this.zoom),D,o))continue;const V=ue(D,B);if(!B&&!this.layers[0]._featureFilter.filter(new Li(this.zoom),V,o))continue;const G=B?V.geometry:ie(D,o,a),K=[];for(const ae of G)for(const be of ae)K.push(be.x),K.push(be.y);const Z={coordinates:K,crossPerc:D.properties.cross_perc,distanceToRoad:D.properties.distance_to_road,entrances:D.properties.entrances,sourceId:0},ee=D.properties.source_id;let ne=_.get(ee);ne||(ne=[],_.set(ee,ne)),ne.push(Z),++y}this.maxHeight=0;const v=new Array,b=new Set,T=D=>{D!=null&&b.add(D)},E=(D,B)=>{D!=null&&v.push({buildingId:D,footprintIndex:B})},I=64*(e.length-y),P=I/2;this.buildingWithFacade.reserve(I,P,!0),this.buildingWithoutFacade.reserve(2*I,2*P,!1),this.footprintsIndices.reserve(16*(e.length-y)),this.footprintsVertices.reserve(8*(e.length-y));for(const{feature:D,id:B,index:V,sourceLayerIndex:G}of e){if(ky[D.type]==="LineString")continue;const K=this.layers[0]._featureFilter.needGeometry;if(K&&!this.layers[0]._featureFilter.filter(new Li(this.zoom),D,o))continue;let Z=null;if(D.properties&&D.properties.hasOwnProperty("building_id")&&(Z=D.properties.building_id,b.has(Z)))continue;const ee=ue(D,K);if(!K&&!this.layers[0]._featureFilter.filter(new Li(this.zoom),ee,o))continue;const ne=K?ee.geometry:ie(D,o,a),ae=gd(ne,500);let be=!1;for(const vt of ae)if(vt.length!==1){be=!0;break}if(be){T(Z);continue}if(!E1(ne,163)){T(Z);continue}const he=this.layers[0],Ee=I1(he.layout.get("building-roof-shape").evaluate(D,{},o)),Ce=he.layout.get("building-base").evaluate(D,{},o),Pe=he.layout.get("building-height").evaluate(D,{},o),Fe=he.layout.get("building-flood-light-ground-radius").evaluate(D,{},o),Be=he.paint.get("building-ambient-occlusion-intensity"),ze=Fe/this.tileToMeter;D.properties["building-part"]="roof";const De=he.paint.get("building-color").evaluate(D,{},this.canonical).toPremultipliedRenderColor(this.lut),Se=he.paint.get("building-emissive-strength").evaluate(D,{},this.canonical);D.properties["building-part"]="wall";const we=he.paint.get("building-color").evaluate(D,{},this.canonical).toPremultipliedRenderColor(this.lut),Le=he.paint.get("building-emissive-strength").evaluate(D,{},this.canonical);D.properties["building-part"]="window";const Ze=he.paint.get("building-color").evaluate(D,{},this.canonical).toPremultipliedRenderColor(this.lut),je=he.paint.get("building-emissive-strength").evaluate(D,{},this.canonical);D.properties["building-part"]="door";const dt=he.paint.get("building-color").evaluate(D,{},this.canonical).toPremultipliedRenderColor(this.lut),Qe=he.paint.get("building-emissive-strength").evaluate(D,{},this.canonical);let rt=he.layout.get("building-flood-light-wall-radius").evaluate(D,{},o);rt=O(rt,0,2048);const at=rt/2048*Ep,Ut=f.get(B),Ge=_.get(Ut)||[],lt=Ge.length!==0&&he.layout.get("building-facade").evaluate(D,{},o);u.setFacadeOptions(4,!0),u.setFauxFacadeOptions(lt,!1,1);let It=0,Zt=0,Xt=0,Rt=0,Si=0,W=0,J=0,Ie=0,ke=0,Ye=0,Ke=0;if(lt){let vt=Math.round(he.layout.get("building-facade-floors").evaluate(D,{},o));if(Ce===0){vt=Math.max(1,vt-(Ge.length>0?1:0));let bi=4;if(Pe>100){const ji=[10,13,15];bi=ji[D.id?D.id%ji.length:0]}else Pe<=10&&(bi=3);u.setFacadeOptions(bi,!0),Si=(Pe<15?1.3:1.61803)*bi/h}else Si=Ce/h;W=Pe/h,Si=Math.min(Si,W),Xt=he.layout.get("building-facade-unit-width").evaluate(D,{},o)/h,Rt=(W-Si)/vt,u.setFauxFacadeOptions(!0,!0,Xt);const Ki=he.layout.get("building-facade-window").evaluate(D,{},o);It=Ki[0],Zt=Ki[1],J=Math.floor(65535*Math.min(1,Si/$e)),Ie=Math.floor(65535*Math.min(1,W/$e)),ke=Math.floor(255*It)<<8|Math.floor(255*Zt),Ye=Math.floor(65535*Math.min(1,
vendor: 4,314 bytes, line 7
7Xt/$e)),Ke=Math.floor(65535*Math.min(1,Rt/$e))}const ft=Array(ae.length),mt={x:1/0,y:1/0},Ct={x:-1/0,y:-1/0},kt={x:0,y:0};let Nt=0;for(let vt=0;vt<ae.length;vt++){const Ki=ae[vt];if(Ki.length>0){const bi=[],ji=Array(Ki.length+1);ji[0]=0;for(let Pr=0;Pr<Ki.length;Pr++){const Nr=Ki[Pr];for(let wr=0;wr<Nr.length;wr++){const Tr=Nr[Nr.length-wr-1];mt.x=Math.min(mt.x,Tr.x),mt.y=Math.min(mt.y,Tr.y),Ct.x=Math.max(Ct.x,Tr.x),Ct.y=Math.max(Ct.y,Tr.y),kt.x+=Tr.x,kt.y+=Tr.y,Nt++,bi.push(Tr.x),bi.push(Tr.y)}ji[Pr+1]=bi.length}ft[vt]={id:D.id?D.id:0,height:Pe,minHeight:Ce,sourceId:0,roofType:Ee,coordinates:bi,ringIndices:ji}}}kt.x/=Nt||1,kt.y/=Nt||1;const Gt=u.generateMesh(ft,Ge);if(typeof Gt=="string"){tt(`Unable to generate building ${D.id}: ${Gt}`),T(Z);continue}if(Gt.meshes.length===0||Gt.modifiedPolygonRings.length===0){T(Z);continue}const bt=lt?this.buildingWithFacade:this.buildingWithoutFacade;let Et=0;for(const vt of Gt.meshes)Et+=vt.positions.length/3;const ti=bt.segmentsBucket.prepareSegment(Et,bt.layoutVertexArray,bt.indexArray),ai=[];let li=null,vi=0,Ci=-1;const Ei=bt.layoutVertexArray.length,ui=Ei+Et;bt.layoutVertexArray.resize(ui),bt.layoutCentroidArray.resize(ui),bt.layoutNormalArray.resize(ui),bt.layoutAOArray.resize(ui),bt.layoutColorArray.resize(ui),bt.layoutFloodLightDataArray.resize(ui),lt&&(bt.layoutFacadePaintArray.resize(ui),bt.layoutFacadeDataArray.resize(ui),bt.layoutFacadeVerticalRangeArray.resize(ui));const pi=bt.indexArray.length;let Bt=0,Wt=Ei;for(const vt of Gt.meshes){let Ki,bi;if(vt.buildingPart===1)Ki=De,bi=Se;else if(vt.buildingPart===0)Ki=we,bi=Le;else if(vt.buildingPart===2)Ki=Ze,bi=je;else{if(vt.buildingPart!==3)continue;Ki=dt,bi=Qe}if(bi=O(bi,0,1),vt.buildingPart===3){const Di=new Array;for(let Rr=0;Rr<vt.positions.length;Rr+=12){const jo=vt.positions[Rr+0],qs=vt.positions[Rr+1],Jr=vt.positions[Rr+3],bn=vt.positions[Rr+4],Zn=vt.positions[Rr+2],dl=vt.positions[Rr+8]-Zn,eh=1,_s=Jr-jo,gs=bn-qs,Jd=Math.hypot(_s,gs);Di.push({pos:[jo+.5*_s,qs+.5*gs,Zn],normal:[gs/Jd,-_s/Jd,0],width:Jd,height:dl,depth:eh,points:[jo,qs,Jr,bn]})}const hr=bt.entranceBloom.segmentsBucket.prepareSegment(10*Di.length,bt.entranceBloom.layoutVertexArray,bt.entranceBloom.indexArray),_r=bt.entranceBloom.layoutVertexArray.length;vi=bt.entranceBloom.indexArray.length,Ly(Di,.5/this.tileToMeter,bt.entranceBloom.indexArray,bt.entranceBloom.layoutVertexArray,bt.entranceBloom.layoutAttenuationArray);const Fn=bt.entranceBloom.layoutVertexArray.length-_r;Ci=bt.entranceBloom.indexArray.length-vi;for(let Rr=0;Rr<Fn;Rr++)bt.entranceBloom.layoutColorArray.emplaceBack(255*dt.r<<8|255*dt.g,255*dt.b<<8|51*Qe);hr.vertexLength+=Fn,hr.primitiveLength+=Ci,li={part:vt.buildingPart,vertexOffset:_r,vertexLength:Fn}}bt.layoutVertexArray.float32.set(vt.positions,3*Wt);const ji=vt.positions.length/3;for(let Di=0;Di<ji;++Di){const hr=3*Di;Bt=Math.max(Bt,vt.positions[hr+2]);const _r=vt.normals[hr+1]*Ep,Fn=vt.normals[hr+2]*Ep,Rr=3*(Wt+Di);bt.layoutNormalArray.int16[Rr]=vt.normals[hr]*Ep,bt.layoutNormalArray.int16[Rr+1]=_r,bt.layoutNormalArray.int16[Rr+2]=Fn;const jo=vt.ao[Di];bt.layoutAOArray.uint8[Wt+Di]=255*jo;const qs=1+(jo-1)*Be,Jr=255*Ki.b*qs<<8|255*bi;bt.layoutColorArray.uint16[2*(Wt+Di)]=255*Ki.r*qs<<8|255*Ki.g*qs,bt.layoutColorArray.uint16[2*(Wt+Di)+1]=Jr}const Pr=Math.floor(kt.x),Nr=Math.floor(kt.y),wr=Math.floor(Pe);for(let Di=0;Di<ji;++Di){const hr=3*(Wt+Di);bt.layoutCentroidArray.int16[hr]=Pr,bt.layoutCentroidArray.int16[hr+1]=Nr,bt.layoutCentroidArray.int16[hr+2]=wr}if(bt.layoutFloodLightDataArray.uint16.fill(vt.buildingPart===0?at:0,Wt,Wt+ji),lt){const Di=255*Ze.r<<8|255*Ze.g,hr=255*Ze.b<<8|255*je;for(let _r=0;_r<ji;++_r){const Fn=2*(Wt+_r);bt.layoutFacadePaintArray.uint16[Fn]=Di,bt.layoutFacadePaintArray.uint16[Fn+1]=hr}for(let _r=0;_r<ji;++_r)if(vt.isFauxFacade[_r]){const Fn=Math.min(65535,Math.floor(vt.uv[2*_r]*Gt.outerRingLength));bt.layoutFacadeDataArray.emplace(Wt+_r,1|Fn,ke,Ye,Ke),bt.layoutFacadeVerticalRangeArray.emplace(Wt+_r,J,Ie)}else bt.layoutFacadeDataArray.emplace(Wt+_r,0,0,0,0),bt.layoutFacadeVerticalRangeArray.emplace(Wt+_r,0,0)}const Tr=ti.vertexLength,Lr=vt.indices.length/3,Pn=bt.indexArray.length;bt.indexArray.resize(Pn+Lr);for(let Di=0;Di<Lr;++Di){const hr=3*Di,_r=3*Pn+hr;bt.indexArray.uint16[_r]=Tr+vt.indices[hr],bt.indexArray.uint16[_r+1
7]=Tr+vt.indices[hr+1],bt.indexArray.uint16[_r+2]=Tr+vt.indices[hr+2]}vt.buildingPart!==1&&vt.buildingPart!==0&&vt.buildingPart!==2&&vt.buildingPart!==3||ai.push({part:vt.buildingPart,vertexOffset:Wt,vertexLength:vt.positions.length/3}),Wt+=ji,ti.vertexLength+=ji,ti.primitiveLength+=vt.indices.length/3}this.maxHeight=Math.max(this.maxHeight,Bt);const qi=bt.indexArray.length-pi,xt=this.footprintsIndices.length,Ht=this.footprintsVertices.length,Ii=[],Ri=new Oe(1/0,1/0),Oi=new Oe(-1/0,-1/0),mr=this.groundEffect.vertexArray.length;for(const vt of Gt.modifiedPolygonRings){const Ki=[],bi=new Oe(1/0,1/0),ji=new Oe(-1/0,-1/0);for(let Pr=0;Pr<vt.length;Pr+=2){const Nr=vt.length-Pr-2;bi.x=Math.min(bi.x,vt[Nr]),bi.y=Math.min(bi.y,vt[Nr+1]),ji.x=Math.max(ji.x,vt[Nr]),ji.y=Math.max(ji.y,vt[Nr+1]);const wr=new Oe(vt[Nr],vt[Nr+1]);Ki.push(wr),Ii.push(wr.x,wr.y),this.footprintsVertices.emplaceBack(wr.x,wr.y)}Ri.x=Math.min(Ri.x,bi.x),Ri.y=Math.min(Ri.y,bi.y),Oi.x=Math.max(Oi.x,ji.x),Oi.y=Math.max(Oi.y,ji.y),this.groundEffect.addData(Ki,[bi,ji],ze)}const zi=this.groundEffect.vertexArray.length-mr;this.groundEffect.groundRadiusArray.reserveForAdditional(zi);for(let vt=0;vt<zi;vt++)this.groundEffect.groundRadiusArray.emplaceBack(Fe);(mt.x<0||Ct.x>$e||mt.y<0||Ct.y>$e)&&this.featuresOnBorder.push({featureId:D.id,footprintIndex:this.footprints.length});{const vt=Ou(Ii,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+vt.length),this.footprintsIndices.uint16.set(vt,xt),this.buildingIds.add(Z??D.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Ri.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Ri.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Oi.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Oi.y);const Ki={footprintVertexOffset:Ht,footprintVertexLength:this.footprintsVertices.length-Ht,footprintIndexOffset:xt,footprintIndexLength:this.footprintsIndices.length-xt,min:Ri,max:Oi,hiddenFlags:0,indicesOffset:pi,indicesLength:qi,bloomIndicesOffset:vi,bloomIndicesLength:Ci,groundEffectVertexOffset:mr,groundEffectVertexLength:zi,hasFauxFacade:lt,height:Bt,promoteId:B,feature:ee,parts:ai,buildingBloom:li},bi=this.footprints.length;D.id!==void 0&&this.featureFootprintLookup.set(D.id,bi),E(Z,bi),this.footprints.push(Ki)}this.programConfigurations.populatePaintArrays(bt.layoutVertexArray.length,D,V,{},i.availableImages,o,i.brightness),this.groundEffect.addPaintPropertiesData(D,V,{},i.availableImages,o,i.brightness),i.featureIndex.insert(D,ne,V,G,this.index,Ei)}v.forEach((({buildingId:D,footprintIndex:B})=>{b.has(D)&&(this.footprints[B].hiddenFlags|=4)}));const L=new Set;this.buildingIds.forEach(((D,B,V)=>{b.has(D)||L.add(D)})),this.buildingIds=L,this.groundEffect.prepareBorderSegments()}update(e,i,o,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,o,a,h,f),this.groundEffect.update(e,i,u,o,a,h,f),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const i=o=>{o.layoutVertexBuffer=e.createVertexBuffer(o.layoutVertexArray,Oy.members),o.layoutNormalBuffer=e.createVertexBuffer(o.layoutNormalArray,y1.members),o.layoutCentroidBuffer=e.createVertexBuffer(o.layoutCentroidArray,x1.members),o.layoutFloodLightDataBuffer=e.createVertexBuffer(o.layoutFloodLightDataArray,S1.members),o.layoutFacadeDataArray&&o.layoutFacadeDataArray.length&&(o.layoutFacadeDataBuffer=e.createVertexBuffer(o.layoutFacadeDataArray,b1.members)),o.layoutFacadeVerticalRangeArray&&o.layoutFacadeVerticalRangeArray.length&&(o.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(o.layoutFacadeVerticalRangeArray,w1.members)),o.entranceBloom.layoutVertexArray.length&&(o.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(o.entranceBloom.layoutVertexArray,Oy.members),o.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(o.entranceBloom.layoutAttenuationArray,T1.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=i=>{i.layoutVertexBuffer&&(i.layoutVertexBuffer.destroy(),i.layoutNormalBuffer.destroy(),i.layoutColorBuffer.destroy(),i.segmentsBucket.destroy(),i.indexBuffer&&i.indexBuffer.destroy(),i.entranceBloom.layoutVertexBuffer&&(i.entranceBloom.layoutVertexBuffer.destroy(),i.entranceBloom.layoutColorBuffer.destroy(),i.entranceBloom.layoutAttenuationBuffer.destroy(),i.entranceBloom.indexBuffer.destroy(),i.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,i,o=!0){let a=!1;const u=o?i:0,h=0|(o?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of e){const _=this.footprints[f],y=_.hiddenFlags&h|u;_.hiddenFlags!==y&&(_.hiddenFlags=y,a=!0,this.groundEffect.updateHiddenByLandmarkRange(_.groundEffectVertexOffset,_.groundEffectVertexLength,_.hiddenFlags!==0))}return a&&(this.indexArrayForConflationUploaded=!1),a}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const i=a=>{a.indexArray.length!==0&&(a.indexArrayForConflation.resize(a.indexArray.length),a.indexArrayForConflation.uint16.set(a.indexArray.uint16),a.entranceBloom.indexArrayForConflation.resize(a.entranceBloom.indexArray.length),a.entranceBloom.indexArrayForConflation.uint16.set(a.entranceBloom.indexArray.uint16))};i(this.buildingWithoutFacade),i(this.buildingWithFacade);for(const a of this.footprints){const u=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,h=a.indicesOffset+a.indicesLength;if(a.hiddenFlags!==0){for(let _=a.indicesOffset;_<h;_++)u.indexArrayForConflation.uint16[3*_+0]=0,u.indexArrayForConflation.uint16[3*_+1]=0,u.indexArrayForConflation.uint16[3*_+2]=0;const f=a.bloomIndicesOffset+a.bloomIndicesLength;for(let _=a.bloomIndicesOffset;_<f;_++)u.entranceBloom.indexArrayForConflation.uint16[3*_+0]=0,u.entranceBloom.indexArrayForConflation.uint16[3*_+1]=0,u.entranceBloom.indexArrayForConflation.uint16[3*_+2]=0}}const o=a=>{a.indexArray.length!==0&&(a.indexBuffer?a.indexBuffer.updateData(a.indexArrayForConflation):a.indexBuffer=e.createIndexBuffer(a.indexArrayForConflation,!0),a.entranceBloom.indexBuffer?a.entranceBloom.indexBuffer.updateData(a.entranceBloom.indexArrayForConflation):a.entranceBloom.indexBuffer=e.createIndexBuffer(a.entranceBloom.indexArrayForConflation,!0))};o(this.buildingWithoutFacade),o(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const i=o=>{o.layoutColorBuffer?o.layoutColorBuffer.updateData(o.layoutColorArray):o.layoutColorBuffer=e.createVertexBuffer(o.layoutColorArray,Fy.members,!0),o.layoutFacadePaintArray&&(o.layoutFacadePaintBuffer?o.layoutFacadePaintBuffer.updateData(o.layoutFacadePaintArray):o.layoutFacadePaintBuffer=e.createVertexBuffer(o.layoutFacadePaintArray,v1.members,!0)),o.entranceBloom.layoutColorBuffer?o.entranceBloom.layoutColorBuffer.updateData(o.entranceBloom.layoutColorArray):o.entranceBloom.layoutColorBuffer=e.createVertexBuffer(o.entranceBloom.layoutColorArray,Fy.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){const o=e.paint.get("building-ambient-occlusion-intensity");for(const a of this.footprints){if(4&a.hiddenFlags)continue;const u=i[a.promoteId],h=a.feature;h.properties["building-part"]="roof";const f=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),_=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="wall";const y=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),v=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="window";const b=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),T=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="door";const E=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),I=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical),P=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const D of a.parts){let B,V=f;D.part===1?(V=f,B=_):D.part===0?(V=y,B=v):D.part===2?(V=b,B=T):D.part===3&&(V=E,B=I),B=O(B,0,1);for(let G=0;G<D.vertexLength;G++){const K=D.vertexOffset+G,Z=1+(P.layoutAOArray.uint8[K]/255-1)*o;P.layoutColorArray.emplace(K,V.r*Z*255<<8|V.g*Z*255,V.b*Z*255<<8|255*B),a.hasFauxFacade&&P.layoutFacadePaintArray.emplace(K,255*b.r<<8|255*b.g,255*b.b<<8|255*T)}}const L=a.buildingBloom;if(L)for(let D=0;D<L.vertexLength;D++)P.entranceBloom.layoutColorArray.emplace(L.vertexOffset+D,255*E.r<<8|255*E.g,255*E.b<<8|51*
7I)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(dp(this.activeReplacements,a))return;this.activeReplacements=a;for(const h of this.footprints)h.hiddenFlags&=-2;const u=[];for(const h of this.activeReplacements){if(h.order<=Ng)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.footprints)_.min.x>h.max.x||_.max.x<h.min.x||_.min.y>h.max.y||_.max.y<h.min.y||(u.length=0,M1(this.footprintsVertices,_.footprintVertexOffset,_.footprintVertexLength,h.footprintTileId.canonical,e.canonical,u),Ym(h.footprint,u,this.footprintsIndices.uint16,_.footprintIndexOffset,_.footprintIndexLength,0,-f)&&(_.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const h of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(h.groundEffectVertexOffset,h.groundEffectVertexLength,h.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(e.id!==void 0){const i=this.featureFootprintLookup.get(e.id);return this.footprints[i]}return null}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+$e)*$e+(i+$e);if(this.footprintLookup.hasOwnProperty(u)){const f=this.footprintLookup[u];return f?{height:f.height,hidden:f.hiddenFlags!==0}:void 0}const h=new Oe(e,i);for(const f of this.footprints)e>f.max.x||f.min.x>e||i>f.max.y||f.min.y>i||f.height<=o||A1(h,this.footprintsVertices.float32.subarray(2*f.footprintVertexOffset,2*(f.footprintVertexOffset+f.footprintVertexLength)),this.footprintsIndices.uint16.subarray(f.footprintIndexOffset,f.footprintIndexOffset+f.footprintIndexLength))&&(o=f.height,this.footprintLookup[u]=f,a=f.hiddenFlags!==0);if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.footprintLookup[u]=void 0}}function A1(r,e,i){for(let o=0;o<i.length;o+=3){const a=i[o],u=i[o+1],h=i[o+2],f=e[2*a+0],_=e[2*a+1],y=e[2*u+0],v=e[2*u+1],b=e[2*h+0],T=e[2*h+1],E=(f-b)*(r.y-T)-(_-T)*(r.x-b),I=(y-f)*(r.y-_)-(v-_)*(r.x-f);if(E<0!=I<0&&E!==0&&I!==0)continue;const P=(b-y)*(r.y-v)-(T-v)*(r.x-y);if(P===0||P<0==E+I<=0)return!0}return!1}function M1(r,e,i,o,a,u){const h=Math.pow(2,o.z-a.z);for(let f=0;f<i;f++){let _=r.float32[2*(f+e)+0],y=r.float32[2*(f+e)+1];_=(_+a.x*$e)*h-o.x*$e,y=(y+a.y*$e)*h-o.y*$e,u.push(new Oe(_,y))}}let Ny,Vy;ot(By,"BuildingBucket",{omit:["layers"]}),ot(g_,"BuildingGeometry"),ot(__,"BuildingBloomGeometry");const C1=jt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),P1=jt([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:R1}=C1,z1=jt([{name:"a_packed",components:3,type:"Float32"}]),{members:D1}=z1,L1=jt([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:O1}=L1;class Uy{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new al({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const o=this.getKey(e,i);return this.positions[o]}trim(){const e=this.width,i=this.height=ye(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,o){const a=[];let u=e.length%2==1?-e[e.length-1]*o:0,h=e[0]*o,f=!0;a.push({left:u,right:h,isDash:f,zeroLength:e[0]===0});let _=e[0];for(let y=1;y<e.length;y++){f=!f;const v=e[y];u=_*o,_+=v,h=_*o,a.push({left:u,right:h,isDash:f,zeroLength:v===0})}return a}addRoundDash(e,i,o){const a=i/2;for(let u=-o;u<=o;u++){const h=this.width*(this.nextRow+o+u);let f=0,_=e[f];for(let y=0;y<this.width;y++){y/_.right>1&&(_=e[++f]);const v=Math.abs(y-_.left),b=Math.abs(y-_.right),T=Math.min(v,b);let E;const I=u/o*(a+1);if(_.isDash){const P=a-Math.abs(I);E=Math.sqrt(T*T+P*P)}else E=a-Math.sqrt(T*T+I*I);this.image.data[h+y]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let _=e.length-1;_>=0;--_){const y=e[_],v=e[_+1];y.zeroLength?e.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,e.splice(_,1))}const o=e[0],a=e[e.length-1];o.isDash===a.isDash&&(o.left=a.left-this.width,a.right=o.right+this.width);const u=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(y,v);this.image.data[u+_]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}
7addDash(e,i){const o=this.getKey(e,i);if(this.positions[o])return this.positions[o];const a=i==="round",u=a?7:0,h=2*u+1;if(this.nextRow+h>this.height)return tt("LineAtlas out of space"),null;e.length===0&&e.push(1);let f=0;for(let v=0;v<e.length;v++)e[v]<0&&(tt("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),f+=e[v];if(f!==0){const v=this.width/f,b=this.getDashRanges(e,this.width,v);a?this.addRoundDash(b,v,u):this.addRegularDash(b,i==="square"?.5*v:0)}const _=this.nextRow+u;this.nextRow+=h;const y={tl:[_,u],br:[f,0]};return this.positions[o]=y,y}}ot(Uy,"LineAtlas");const F1=le.types,k1=Math.cos(Math.PI/180*37.5),B1=Math.cos(Math.PI/180*5);class y_{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 _u,this.layoutVertexArray2=new jn,this.patternVertexArray=new jn,this.indexArray=new Ar,this.programConfigurations=new vo(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Wi,this.maxLineLength=0,this.zOffsetVertexArray=new jn,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.tessellationStep=e.tessellationStep?e.tessellationStep:$e/64,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){this.hasPattern=Hm("line",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("line-sort-key");this.tileToMeter=F(o);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const T=this.layers[0].layout.get("line-z-offset"),E=T.isConstant()&&!T.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&E?"none":"offset",this.elevationType==="offset"&&h==="none"&&tt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const _=[];for(const{feature:T,id:E,index:I,sourceLayerIndex:P}of e){const L=this.layers[0]._featureFilter.needGeometry,D=ue(T,L);if(!this.layers[0]._featureFilter.filter(new Li(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),D,o))continue;const B=u?u.evaluate(D,{},o):void 0,V={id:E,properties:T.properties,type:T.type,sourceLayerIndex:P,index:I,geometry:L?D.geometry:ie(T,o,a),patterns:{},sortKey:B};_.push(V)}u&&_.sort(((T,E)=>T.sortKey-E.sortKey));const{lineAtlas:y,featureIndex:v}=i,b=this.addConstantDashes(y);for(const T of _){const{geometry:E,index:I,sourceLayerIndex:P}=T;if(b&&this.addFeatureDashes(T,y),this.hasPattern){const L=qm("line",this.layers,T,this.zoom,this.pixelRatio,i);this.patternFeatures.push(L)}else this.addFeature(T,E,I,o,y.positions,i.availableImages,i.brightness,i.elevationFeatures);v.insert(e[I].feature,E,I,P,this.index)}}addConstantDashes(e){let i=!1;for(const o of this.layers){const a=o.paint.get("line-dasharray").value,u=o.layout.get("line-cap").value;if(a.kind!=="constant"||u.kind!=="constant")i=!0;else{const h=u.value,f=a.value;if(!f)continue;e.addDash(f,h)}}return i}addFeatureDashes(e,i){const o=this.zoom;for(const a of this.layers){const u=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if(u.kind==="constant"&&h.kind==="constant")continue;let f,_;if(u.kind==="constant"){if(f=u.value,!f)continue}else f=u.evaluate({zoom:o},e);_=h.kind==="constant"?h.value:h.evaluate({zoom:o},e),i.addDash(f,_),e.patterns[a.id]=[i.getKey(f,_)]}}update(e,i,o,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,o,a,h,f,_)}addFeatures(e,i,o,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,o,a,h,e.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,D1)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,O1)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,P1.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,R1),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,i){let o,a;if(i&&i>0?(o=`mapbox_clip_start_${i}`,a=`mapbox_clip_end_${i}`):(o="mapbox_clip_start",a="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(o)&&e.properties.hasOwnProperty(a))return{start:+e.properties[o],end:+e.properties[a]}}addFeature(e,i,o,a,u,h,f,_){const y=this.layers[0].layout,v=y.get("line-join").evaluate(e,{}),b=y.get("line-cap").evaluate(e,{}),T=y.get("line-miter-limit"),E=y.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const I=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=y.get("line-z-offset").value;const P=this.layers[0].paint.get("line-width").value;if(P.kind!=="constant"&&P.isLineProgressConstant===!1&&(this.variableWidthValue=P),this.elevationType==="road"){const L=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,_,v,b,T,E)){const[D,B]=this.clipRuntimeLinesToTile(i,1);for(let V=0;V<D.length;V++){const G=D[V],K=B[V],Z={progress:{min:K.progress.min,max:K.progress.max},nextDir:this.computeSegNextDir(K,G),prevDir:this.computeSegPrevDir(K,G)};this.addLine(G,e,a,v,b,T,E,Z,I&&K.parentIndex>0?K.parentIndex:null)}this.fillNonElevatedRoadSegment(L)}}else for(let L=0;L<i.length;L++)this.addLine(i[L],e,a,v,b,T,E,void 0,I&&L>0?L:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,u,h,a,f,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return mp(e,-i,-i,$e+i,$e+i)}clipRuntimeLinesToTile(e,i){const o=[];return[mp(e,-i,-i,$e+i,$e+i,o),o]}addElevatedRoadFeature(e,i,o,a,u,h,f,_){const y=[],v=di.getElevationFeature(e,a);if(v){const b=this.clipLinesToTile(i,1),T=this.prepareElevatedLines(b,v,o);for(const E of T)y.push({geometry:E,elevation:v,elevationTileID:o,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(y.length===0)return!1;for(const b of y){const T=this.layoutVertexArray.length;this.addLine(b.geometry,e,o,u,h,f,_);const E=new Ti(o,b.elevationTileID);if(b.elevation)for(let I=T;I<this.layoutVertexArray.length;I++){const P=new Oe(this.layoutVertexArray.int16[6*I]>>1,this.layoutVertexArray.int16[6*I+1]>>1),L=E.pointElevation(P,b.elevation,.05);this.updateHeightRange(L),this.zOffsetVertexArray.emplaceBack(L,0,0)}else this.fillNonElevatedRoadSegment(T)}return!0}prepareElevatedLines(e,i,o){if(i.constantHeight!=null)return e;const a=[],u=1/F(o);for(const h of e)W0(h,new si(i,u),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,o,a,u,h,f,_,y){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineS
7oFar=0,this.currentVertex=void 0,this.lineClips=y?this.lineFeatureClips(i,y):this.lineClips;const v=a==="none";this.patternJoinNone=this.hasPattern&&v,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const b=_&&_.progress.min>0,T=_&&_.progress.max<1;if(this.lineClips){let ae={min:this.lineClips.start,max:this.lineClips.end},be=1;if(_){const Ce=this.lineClips.end-this.lineClips.start;ae=(function(Pe,Fe,Be){return{min:Pi(Pe.min,Fe,Be),max:Pi(Pe.max,Fe,Be)}})(_.progress,{min:0,max:1},ae),Ce>0&&(be=(ae.max-ae.min)/Ce)}const he=+i.properties.mapbox_clip_feature_len,Ee=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(he)||Number.isNaN(Ee)){for(let Pe=0;Pe<e.length-1;Pe++)this.totalDistance+=e[Pe].dist(e[Pe+1]);const Ce=this.totalDistance/(ae.max-ae.min);this.totalFeatureLength=Number.isFinite(Ce)?Ce:0,this.lineClips.start=ae.min,this.lineClips.end=ae.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=he,this.distance=Ee*be,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 E=F1[i.type]==="Polygon";let I=e.length;for(;I>=2&&e[I-1].equals(e[I-2]);)I--;let P=0;for(;P<I-1&&e[P].equals(e[P+1]);)P++;if(I<(E?3:2))return;a==="bevel"&&(h=1.05);const L=this.segments.prepareSegment(10*I,this.layoutVertexArray,this.indexArray);let D,B,V,G,K,Z,ee,ne;_&&_.prevDir&&(Z=_.prevDir.perp()),_&&_.nextDir&&(ee=_.nextDir.perp()),this.e1=this.e2=-1,E&&(D=e[I-2],K=e[P].sub(D)._unit()._perp());for(let ae=P;ae<I;ae++){if(V=ae===I-1?E?e[P+1]:void 0:e[ae+1],V&&e[ae].equals(V))continue;K&&(G=K),D&&(B=D),D=e[ae],ne=this.evaluateLineProgressFeatures(B?B.dist(D):0),K=V?V.sub(D)._unit()._perp():G,G=G||K;const be=B&&V;let he=be?a:E||v?"butt":u;const Ee=G.x*K.x+G.y*K.y;if(v){const we=function(Le){if(Le.patternJoinNone){const Ze=Le.segmentPoints.length/2,je=Le.lineSoFar-Le.segmentStart;for(let dt=0;dt<Ze;++dt){const Qe=Le.segmentPoints[2*dt+1],rt=Math.round(Le.segmentPoints[2*dt])+.5+.25*Qe;Le.patternVertexArray.emplaceBack(rt,je,Le.segmentStart),Le.patternVertexArray.emplaceBack(rt,je,Le.segmentStart)}Le.segmentPoints.length=0}Le.e1=Le.e2=-1};if(be&&Ee<B1){this.updateDistance(B,D),this.addCurrentVertex(D,G,1,1,L,ne),we(this),this.addCurrentVertex(D,K,-1,-1,L,ne);continue}if(B){if(!V){this.updateDistance(B,D),this.addCurrentVertex(D,G,1,1,L,ne),we(this);continue}he="miter"}}let Ce=G.add(K);Ce.x===0&&Ce.y===0||Ce._unit();const Pe=Ce.x*K.x+Ce.y*K.y,Fe=Pe!==0?1/Pe:1/0,Be=2*Math.sqrt(2-2*Pe),ze=Pe<k1&&B&&V,De=G.x*K.y-G.y*K.x>0,Se=this.overscaling<=16?15*$e/(512*this.overscaling):0;if(be&&he==="round"){if(Fe<f)he="miter";else if(Fe<=2){const we=x_(D,-10,$e+10);he=this.elevationType==="offset"&&(we||this.hasCrossSlope)?"miter":"fakeround"}}if(he==="miter"&&Fe>h&&(he="bevel"),he==="bevel"&&(Fe>2&&(he="flipbevel"),Fe<h&&(he="miter")),B&&!(he==="miter"&&ze)&&this.updateDistance(B,D),he==="miter")if(ze){const we=D.dist(B);if(we>2*Se){const Ze=D.sub(D.sub(B)._mult(Se/we)._round());this.updateDistance(B,Ze),this.addCurrentVertex(Ze,G,0,0,L,ne),B=Ze}this.updateDistance(B,D),Ce._mult(Fe),this.addCurrentVertex(D,Ce,0,0,L,ne);const Le=D.dist(V);if(Le>2*Se){const Ze=D.add(V.sub(D)._mult(Se/Le)._round());this.updateDistance(D,Ze),this.addCurrentVertex(Ze,K,0,0,L,ne),D=Ze}}else Ce._mult(Fe),this.addCurrentVertex(D,Ce,0,0,L,ne);else if(he==="flipbevel"){if(Fe>100)Ce=K.mult(-1);else{const we=Fe*G.add(K).mag()/G.sub(K).mag();Ce._perp()._mult(we*(De?-1:1))}this.addCurrentVertex(D,Ce,0,0,L,ne),this.addCurrentVertex(D,Ce.mult(-1),0,0,L,ne)}else if(he==="bevel"||he==="fakeround"){ne!=null&&B&&this.addCurrentVertex(D,ee||G,-1,-1,L,ne);const we=D.dist(B)<=2*Se&&he!=="bevel",Le=Ce.mult(De?1:-1);Le._mult(Fe);const Ze=K.mult(De?-1:1),je=G.mult(De?-1:1),dt=this.evaluateLineProgressFeatures(this.distance);if(ne==null&&(this.addHalfVertex(D,Le.x,Le.y,!1,!De,0,L,dt),we||this.addHalfVertex(D,Le.x+2*je.x,Le.y+2*je.y,!1,De,0,L,dt)),he==="fakeround"){const Qe=Math.round(180*Be/Math.PI/20);this.addHalfVertex(D,je.x,je.y,!1,De,0,L,dt);for(let rt=0;rt<Qe;rt++){let at=rt/Qe;if(at!==.5){const Ge=at-.5;at+=at*Ge*(at-1)*((1.0904+Ee*(Ee*(3.55645-1.43519*Ee)-3.2452))*Ge*Ge+(.848013+Ee*(.215638*Ee-1.06021)))}const Ut=Ze.sub(je)._mult(at)._add(je)._unit();this.addHalfVertex(D,Ut.x,Ut.y,!1,De,0,L,dt)}
7this.addHalfVertex(D,Ze.x,Ze.y,!1,De,0,L,dt)}we||ne!=null||this.addHalfVertex(D,Le.x+2*Ze.x,Le.y+2*Ze.y,!1,De,0,L,dt),ne!=null&&V&&this.addCurrentVertex(D,Z||K,1,1,L,ne)}else if(he==="butt")this.addCurrentVertex(D,Ce,0,0,L,ne);else if(he==="square"){if(!B){const we=b?0:-1;this.addCurrentVertex(D,Ce,we,we,L,ne)}if(this.addCurrentVertex(D,Ce,0,0,L,ne),B){const we=T?0:1;this.addCurrentVertex(D,Ce,we,we,L,ne)}}else if(he==="round"){if(B){const we=!be&&ee?ee:G;this.addCurrentVertex(D,we,0,0,L,ne),!be&&T||this.addCurrentVertex(D,we,1,1,L,ne,!0)}if(V){const we=!be&&Z?Z:K;!be&&b||this.addCurrentVertex(D,we,-1,-1,L,ne,!0),this.addCurrentVertex(D,we,0,0,L,ne)}}}}addVerticesTo(e,i,o,a,u,h,f,_,y,v){const b=(i.w-e.w)/this.tessellationStep|0;let T=0;const E=this.scaledDistance;if(b>1){this.lineSoFar=e.w;const P=(i.x-e.x)/b,L=(i.y-e.y)/b,D=(i.z-e.z)/b,B=(i.w-e.w)/b;for(let V=1;V<b;++V){e.x+=P,e.y+=L,e.z+=D,this.lineSoFar+=B,T+=B;const G=this.evaluateLineProgressFeatures(this.prevDistance+T);this.scaledDistance=(this.prevDistance+T)/this.totalDistance,this.addHalfVertex(e,o,a,v,!1,f,y,G),this.addHalfVertex(e,u,h,v,!0,-_,y,G)}}this.lineSoFar=i.w,this.scaledDistance=E;const I=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,o,a,v,!1,f,y,I),this.addHalfVertex(i,u,h,v,!0,-_,y,I)}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):tt(`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,o,a,u,h,f=!1){const _=i.x+i.y*o,y=i.y-i.x*o,v=i.y*a-i.x,b=-i.y-i.x*a;if(h!=null){const T=this.elevationType==="offset",E=-10,I=$e+10,P=h.zOffset,L=new cy(e.x,e.y,P,this.lineSoFar),D=!!T&&x_(e,E,I),B=this.lineSoFar,V=this.distance;if(this.currentVertex)if(D){const G=this.currentVertexIsOutside,K=this.currentVertex,Z=new cy(e.x,e.y,P,this.lineSoFar);if(hy(K,Z,E,I),!x_(Z,E,I)){if(G){this.e1=this.e2=-1,this.distance-=K.dist(L),this.lineSoFar=K.w;const ee=this.evaluateLineProgressFeatures(K.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(K,_,y,f,!1,o,u,ee),this.addHalfVertex(K,v,b,f,!0,-a,u,ee),this.prevDistance=this.distance}this.distance=this.prevDistance+K.dist(Z),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(K,Z,_,y,v,b,o,a,u,f),this.distance=V,this.scaledDistance=this.distance/this.totalDistance}}else{const G=this.currentVertex;if(this.currentVertexIsOutside){hy(G,L,E,I),this.e1=this.e2=-1,this.distance-=G.dist(L),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=G.w;const K=this.evaluateLineProgressFeatures(G.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(G,_,y,f,!1,o,u,K),this.addHalfVertex(G,v,b,f,!0,-a,u,K),this.prevDistance=this.distance,this.distance=V,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(G,L,_,y,v,b,o,a,u,f)}else D||(this.addHalfVertex(e,_,y,f,!1,o,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h));this.currentVertex=L,this.currentVertexIsOutside=D,this.lineSoFar=B}else this.addHalfVertex(e,_,y,f,!1,o,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h)}addHalfVertex({x:e,y:i},o,a,u,h,f,_,y){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*o)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1),0,this.lineS
7oFar-this.segmentStartf32),this.lineClips){const b=wt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),h?this.e2=v:this.e1=v,y!=null&&this.zOffsetVertexArray.emplaceBack(y.zOffset,y.variableWidth,y.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 x_(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let jy,Gy;function Hy(r,e,i){return e*($e/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}ot(y_,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const qy=(r,e,i)=>(1-i)*r+i*e;function $y(r,e){return 1/Hy(r,1,e.tileZoom)}function Zy(r,e,i,o){return r.translatePosMatrix(o||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Wy=r=>{const e=[];Xy(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 o=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return o&&a&&e.push("LINE_JOIN_NONE"),e};function Xy(r){const e=r.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let v_;const Yy=()=>v_||(v_={layout:jy||(jy=new sr({"line-cap":new Xe(fe.layout_line["line-cap"]),"line-join":new Xe(fe.layout_line["line-join"]),"line-miter-limit":new He(fe.layout_line["line-miter-limit"]),"line-round-limit":new He(fe.layout_line["line-round-limit"]),"line-sort-key":new Xe(fe.layout_line["line-sort-key"]),"line-z-offset":new Xe(fe.layout_line["line-z-offset"]),"line-elevation-reference":new He(fe.layout_line["line-elevation-reference"]),"line-cross-slope":new He(fe.layout_line["line-cross-slope"]),visibility:new He(fe.layout_line.visibility),"line-width-unit":new He(fe.layout_line["line-width-unit"])})),paint:Gy||(Gy=new sr({"line-opacity":new Xe(fe.paint_line["line-opacity"]),"line-color":new Xe(fe.paint_line["line-color"]),"line-translate":new He(fe.paint_line["line-translate"]),"line-translate-anchor":new He(fe.paint_line["line-translate-anchor"]),"line-width":new Xe(fe.paint_line["line-width"]),"line-gap-width":new Xe(fe.paint_line["line-gap-width"]),"line-offset":new Xe(fe.paint_line["line-offset"]),"line-blur":new Xe(fe.paint_line["line-blur"]),"line-dasharray":new Xe(fe.paint_line["line-dasharray"]),"line-pattern":new Xe(fe.paint_line["line-pattern"]),"line-pattern-cross-fade":new He(fe.paint_line["line-pattern-cross-fade"]),"line-gradient":new ya(fe.paint_line["line-gradient"]),"line-trim-offset":new He(fe.paint_line["line-trim-offset"]),"line-trim-fade-range":new He(fe.paint_line["line-trim-fade-range"]),"line-trim-color":new He(fe.paint_line["line-trim-color"]),"line-emissive-strength":new Xe(fe.paint_line["line-emissive-strength"]),"line-border-width":new Xe(fe.paint_line["line-border-width"]),"line-border-color":new Xe(fe.paint_line["line-border-color"]),"line-occlusion-opacity":new He(fe.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},v_);class N1 extends Xe{possiblyEvaluate(e,i){return i=new Li(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,o,a){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,o,a)}}let Cd;function Ky(r,e){return e>0?e+2*r:r}const V1=jt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),U1=jt([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),j1=jt([{name:"a_projected_pos",components:4,type:"Float32"}],4);jt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const G1=jt([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),H1=jt([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),q1=jt([{name:"a_texb",components:2,type:"Uint16"}]),$1=jt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),Z1=jt([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);jt([{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 Jy=jt([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),W1=jt([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);
vendor: 12,668 bytes, line 7
7jt([{name:"triangle",components:3,type:"Uint16"}]),jt([{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"}]),jt([{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"}]),jt([{type:"Float32",name:"offsetX"}]),jt([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Br=24;function X1(r,e,i){return r.sections.forEach((o=>{o.text=(function(a,u,h){const f=u.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),is.applyArabicShaping&&(a=is.applyArabicShaping(a)),a})(o.text,e,i)})),r}const Pd={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function Y1(r){return r==="︶"||r==="ï¹"||r==="︸"||r==="ï¹"||r==="ï¹"||r==="︾"||r==="︼"||r==="︺"||r==="ï¸"||r==="ï¹"||r==="ï¸"||r==="ï¸"||r==="ï¸"||r==="ï½"||r==="ï¿£"||r==="ï¸"||r==="ï¸"}function K1(r){return r==="︵"||r==="ï¹"||r==="︷"||r==="ï¹"||r==="ï¹"||r==="︽"||r==="︻"||r==="︹"||r==="ï¸"||r==="︿"}const b_=4294967296,Qy=1/b_,ex=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Ip=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 o=this.readVarint(),a=o>>3,u=this.pos;this.type=7&o,r(a,e,this),this.pos===u&&this.skip(o)}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)*b_;return this.pos+=8,r}readSFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*b_;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,o;return o=e[this.pos++],i=127&o,o<128?i:(o=e[this.pos++],i|=(127&o)<<7,o<128?i:(o=e[this.pos++],i|=(127&o)<<14,o<128?i:(o=e[this.pos++],i|=(127&o)<<21,o<128?i:(o=e[this.pos],i|=(15&o)<<28,(function(a,u,h){const f=h.buf;let _,y;if(y=f[h.pos++],_=(112&y)>>4,y<128||(y=f[h.pos++],_|=(127&y)<<3,y<128)||(y=f[h.pos++],_|=(127&y)<<10,y<128)||(y=f[h.pos++],_|=(127&y)<<17,y<128)||(y=f[h.pos++],_|=(127&y)<<24,y<128)||(y=f[h.pos++],_|=(1&y)<<31,y<128))return ju(a,_,u);throw new Error("Expected varint not more than 10 bytes")})(i,r,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const r=this.readVarint();return r%2==1?(r+1)/-2:r/2}readBoolean(){return!!this.readVarint()}readString(){const r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&ex?ex.decode(this.buf.subarray(e,r)):(function(i,o,a){let u="",h=o;for(;h<a;){const f=i[h];let _,y,v,b=null,T=f>239?4:f>223?3:f>191?2:1;if(h+T>a)break;T===1?f<128&&(b=f):T===2?(_=i[h+1],(192&_)==128&&(b=(31&f)<<6|63&_,b<=127&&(b=null))):T===3?(_=i[h+1],y=i[h+2],(192&_)==128&&(192&y)==128&&(b=(15&f)<<12|(63&_)<<6|63&y,(b<=2047||b>=55296&&b<=57343)&&(b=null))):T===4&&(_=i[h+1],y=i[h+2],v=i[h+3],(192&_)==128&&(192&y)==128&&(192&v)==128&&(b=(15&f)<<18|(63&_)<<12|(63&y)<<6|63&v,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,T=1):b>65535&&(b-=65536,u+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),u+=String.fromCharCode(b),h+=T}return u})(this.buf,e,r)}readBytes(){const r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e}readPackedVarint(r=[],e){const i=this.readPackedEnd();for(;this.pos<i;)r.push(this.readVarint(e));return r}readPackedSVarint(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSVarint());return r}readPackedBoolean(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readBoolean());return r}readPackedFloat(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFloat());return r}readPackedDouble(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readDouble());return r}readPackedFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed32());return r}readPackedSFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed32());return r}readPackedFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed64());return r}readPackedSFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed64());return r}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(r){const e=7&r;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(r,e){this.writeVarint(r<<3|e)}realloc(r){let e=this.length||16;for(;e<this.pos+r;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeSFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Qy),!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*Qy),!0),this.pos+=8}writeVarint(r){(r=+r||0)>268435455||r<0?(function(e,i){let o,a;if(e>=0?(o=e%4294967296|0,a=e/4294967296|0):(o=~(-e%4294967296),a=~(-e/4294967296),4294967295^o?o=o+1|0:(o=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),(function(u,h,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)})(o,0,i),(function(u,h){const f=(7&u)<<4;h.buf[h.pos++]|=f|((u>>>=3)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u)))))})(a,i)})(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))}writeSVarint(r){this.writeVarint(r<0?2*-r-1:2*r)}writeBoolean(r){this.writeVarint(+r)}writeString(r){r=String(r),this.realloc(4*r.length),this.pos++;const e=this.pos;this.pos=(function(o,a,u){for(let h,f,_=0;_<a.length;_++){if(h=a.charCodeAt(_),h>55295&&h<57344){if(!f){h>56319||_+1===a.length?(o[u++]=239,o[u++]=191,o[u++]=189):f=h;continue}if(h<56320){o[u++]=239,o[u++]=191,o[u++]=189,f=h;continue}h=f-55296<<10|h-56320|65536,f=null}else f&&(o[u++]=239,o[u++]=191,o[u++]=189,f=null);h<128?o[u++]=h:(h<2048?o[u++]=h>>6|192:(h<65536?o[u++]=h>>12|224:(o[u++]=h>>18|240,o[u++]=h>>12&63|128),o[u++]=h>>6&63|128),o[u++]=63&h|128)}return u})(this.buf,r,this.pos);const i=this.pos-e;i>=128&&tx(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 o=this.pos-i;o>=128&&tx(i,o,this),this.pos=i-1,this.writeVarint(o),this.pos+=o}writeMessage(r,e,i){this.writeTag(r,2),this.writeRawMessage(e,i)}writePackedVarint(r,e){e.length&&this.writeMessage(r,J1,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,Q1,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,ib,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,eb,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,tb,e)}writePackedFixed32(r,e){e.length&&this.writeMessage(r,rb,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,nb,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,ob,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,sb,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 ju(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function tx(r,e,i){const o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(o);for(let a=i.pos-1;a>=r;a--)i.buf[a+o]=i.buf[a]}function J1(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function Q1(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function eb(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function tb(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function ib(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function rb(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function nb(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function ob(r,e){for(let i=0;i<r.length;
7i++)e.writeFixed64(r[i])}function sb(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}const w_=3;function ab(r,e,i){e.glyphs=[],r===1&&i.readMessage(lb,e)}function lb(r,e,i){if(r===3){const{id:o,bitmap:a,width:u,height:h,left:f,top:_,advance:y}=i.readMessage(cb,{});e.glyphs.push({id:o,bitmap:new al({width:u+2*w_,height:h+2*w_},a),metrics:{width:u,height:h,left:f,top:_,advance:y}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function cb(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 ix=w_,$n={horizontal:1,vertical:2,horizontalOnly:3};class Rd{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const o=new Rd;return o.scale=e||1,o.fontStack=i,o}static forImage(e){const i=new Rd;return i.image=e,i}}class Gu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,o){const a=new Gu;for(let u=0;u<e.sections.length;u++){const h=e.sections[u];h.image?a.addImageSection(h,o):a.addTextSection(h,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=(function(i,o){let a="";for(let u=0;u<i.length;u++){const h=i.charCodeAt(u+1)||null,f=i.charCodeAt(u-1)||null;a+=!o&&(h&&ou(h)&&!Pd[i[u+1]]||f&&ou(f)&&!Pd[i[u-1]])||!Pd[i[u]]?i[u]:Pd[i[u]]}return a})(this.text,e)}trim(){let e=0;for(let o=0;o<this.text.length&&Ap[this.text.charCodeAt(o)];o++)e++;let i=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&Ap[this.text.charCodeAt(o)];o--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const o=new Gu;return o.text=this.text.substring(e,i),o.sectionIndex=this.sectionIndex.slice(e,i),o.sections=this.sections,o}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(Rd.forText(e.scale,e.fontStack||i));const o=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(o)}addImageSection(e,i){const o=e.image?e.image.getPrimary():null;if(!o)return void tt("Can't add FormattedSection with an empty image.");o.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(Rd.forImage(o)),this.sectionIndex.push(this.sections.length-1)):tt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function T_(r,e,i,o,a,u,h,f,_,y,v,b,T,E,I,P=1){const L=Gu.fromFeature(r,a,P);
7b===$n.vertical&&L.verticalizePunctuation(T);let D=[];const B=(function(ee,ne,ae,be,he,Ee){if(!ee)return[];const Ce=[],Pe=(function(De,Se,we,Le,Ze,je){let dt=0;for(let Qe=0;Qe<De.length();Qe++){const rt=De.getSection(Qe);dt+=rx(De.getCodePoint(Qe),rt,Le,Ze,Se,je)}return dt/Math.max(1,Math.ceil(dt/we))})(ee,ne,ae,be,he,Ee),Fe=ee.text.indexOf("â")>=0;let Be=0;for(let De=0;De<ee.length();De++){const Se=ee.getSection(De),we=ee.getCodePoint(De);if(Ap[we]||(Be+=rx(we,Se,be,he,ne,Ee)),De<ee.length()-1){const Le=!((ze=we)<11904||!(yt["Bopomofo Extended"](ze)||yt.Bopomofo(ze)||yt["CJK Compatibility Forms"](ze)||yt["CJK Compatibility Ideographs"](ze)||yt["CJK Compatibility"](ze)||yt["CJK Radicals Supplement"](ze)||yt["CJK Strokes"](ze)||yt["CJK Symbols and Punctuation"](ze)||yt["CJK Unified Ideographs Extension A"](ze)||yt["CJK Unified Ideographs"](ze)||yt["Enclosed CJK Letters and Months"](ze)||yt["Halfwidth and Fullwidth Forms"](ze)||yt.Hiragana(ze)||yt["Ideographic Description Characters"](ze)||yt["Kangxi Radicals"](ze)||yt["Katakana Phonetic Extensions"](ze)||yt.Katakana(ze)||yt["Vertical Forms"](ze)||yt["Yi Radicals"](ze)||yt["Yi Syllables"](ze)));(ub[we]||Le||Se.image)&&Ce.push(ox(De+1,Be,Pe,Ce,hb(we,ee.getCodePoint(De+1),Le&&Fe),!1))}}var ze;return sx(ox(ee.length(),Be,Pe,Ce,0,!0))})(L,y,u,e,o,E),{processBidirectionalText:V,processStyledBidirectionalText:G}=is;if(V&&L.sections.length===1){const ee=V(L.toString(),B);for(const ne of ee){const ae=new Gu;ae.text=ne,ae.sections=L.sections;for(let be=0;be<ne.length;be++)ae.sectionIndex.push(0);D.push(ae)}}else if(G){const ee=G(L.text,L.sectionIndex,B);for(const ne of ee){const ae=new Gu;ae.text=ne[0],ae.sectionIndex=ne[1],ae.sections=L.sections,D.push(ae)}}else D=(function(ee,ne){const ae=[],be=ee.text;let he=0;for(const Ee of ne)ae.push(ee.substring(he,Ee)),he=Ee;return he<be.length&&ae.push(ee.substring(he,be.length)),ae})(L,B);const K=[],Z={positionedLines:K,text:L.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if((function(ee,ne,ae,be,he,Ee,Ce,Pe,Fe,Be,ze,De){let Se=0,we=0,Le=0;const Ze=Pe==="right"?1:Pe==="left"?0:.5;let je=!1;for(const Ge of he){const lt=Ge.getSections();for(const It of lt){if(It.image)continue;const Zt=ne[It.fontStack];if(Zt&&(je=Zt.ascender!==void 0&&Zt.descender!==void 0,!je))break}if(!je)break}let dt=0;for(const Ge of he){Ge.trim();const lt=Ge.getMaxScale(),It=(lt-1)*Br,Zt={positionedGlyphs:[],lineOffset:0};ee.positionedLines[dt]=Zt;const Xt=Zt.positionedGlyphs;let Rt=0;if(!Ge.length()){we+=Ee,++dt;continue}let Si=0,W=0;for(let Ie=0;Ie<Ge.length();Ie++){const ke=Ge.getSection(Ie),Ye=Ge.getSectionIndex(Ie),Ke=Ge.getCodePoint(Ie);let ft=ke.scale,mt=null,Ct=null,kt=null,Nt=Br,Gt=0,bt=Fe;bt===$n.vertical&&((Qe=Ke)===12312||Qe===12313||Qe===12316||Qe===12540||Qe===12448)&&(bt=$n.horizontal);const Et=!(bt===$n.horizontal||!ze&&!nu(Ke)||ze&&(Ap[Ke]||su(Ke)));if(ke.image){const ti=be.get(ke.image.toString());if(!ti)continue;kt=ke.image,ee.iconsInText=ee.iconsInText||!0,Ct=ti.paddedRect;const ai=ti.displaySize;ft=ft*Br/De,mt={width:ai[0],height:ai[1],left:0,top:-ix,advance:Et?ai[1]:ai[0],localGlyph:!1},Gt=je?-mt.height*ft:lt*Br-17-ai[1]*ft,Nt=mt.advance;const li=(Et?ai[0]:ai[1])*ft-Br*lt;li>0&&li>Rt&&(Rt=li)}else{const ti=ae[ke.fontStack];if(!ti)continue;ti[Ke]&&(Ct=ti[Ke]);const ai=ne[ke.fontStack];if(!ai)continue;const li=ai.glyphs[Ke];if(!li)continue;if(mt=li.metrics,Nt=Ke!==8203?Br:0,je){const vi=ai.ascender!==void 0?Math.abs(ai.ascender):0,Ci=ai.descender!==void 0?Math.abs(ai.descender):0,Ei=(vi+Ci)*ft;Si<Ei&&(Si=Ei,W=(vi-Ci)/2*ft),Gt=-vi*ft}else Gt=(lt-ft)*Br-17}Et?(ee.verticalizable=!0,Xt.push({glyph:Ke,image:kt,x:Se,y:we+Gt,vertical:Et,scale:ft,localGlyph:mt.localGlyph,fontStack:ke.fontStack,sectionIndex:Ye,metrics:mt,rect:Ct}),Se+=Nt*ft+Be):(Xt.push({glyph:Ke,image:kt,x:Se,y:we+Gt,vertical:Et,scale:ft,localGlyph:mt.localGlyph,fontStack:ke.fontStack,sectionIndex:Ye,metrics:mt,rect:Ct}),Se+=mt.advance*ft+Be)}Xt.length!==0&&(Le=Math.max(Se-Be,Le),je?ax(Xt,Ze,Rt,W,Ee*lt/2):ax(Xt,Ze,Rt,0,Ee/2)),Se=0;const J=Ee*lt+Rt;Zt.lineOffset=Math.max(Rt,It),we+=J,++dt}var Qe;const rt=we,{horizontalAlign:at,verticalAlign:Ut}=S_(Ce);(function(Ge,lt,It,Zt,Xt,Rt){const Si=(lt-It)*Xt,W=-Rt*Zt;for(const J of Ge)for(const Ie of J.positionedGlyphs)Ie.x+=Si,Ie.y+=W})(ee.positionedLines,Ze,at,Ut,Le,rt),ee.top+=-Ut*rt,ee.bottom=ee.top+rt,ee.left+=-at*Le,ee.right=ee.left+Le,ee.hasBaseline=je})(Z,e,i,o,D,h,f,_,b,y,T,I),!(function(ee){for(const ne of ee)if(ne.positionedGlyphs.length!==0)return!1;return!0})(K))return Z}const Ap={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ub={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 rx(r,e,i,o,a,u){if(e.image){const h=o.get(e.image.toString());return h?h.displaySize[0]*e.scale*Br/u+a:0}{const h=i[e.fontStack],f=h&&h.glyphs[r];return f?f.metrics.advance*e.scale+a:0}}function nx(r,e,i,o){const a=Math.pow(r-e,2);return o?r<e?a/2:2*a:a+Math.abs(i)*i}function hb(r,e,i){let o=0;return r===10&&(o-=1e4),i&&(o+=150),r!==40&&r!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function ox(r,e,i,o,a,u){let h=null,f=nx(e,i,a,u);for(const _ of o){const y=nx(e-_.x,i,a,u)+_.badness;y<=f&&(h=_,f=y)}return{index:r,x:e,priorBreak:h,badness:f}}function sx(r){return r?sx(r.priorBreak).concat(r.index):[]}function S_(r){let e=.5,i=.5;
7switch(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 ax(r,e,i,o,a){if(!(e||i||o||a))return;const u=r.length-1,h=r[u],f=(h.x+h.metrics.advance*h.scale)*e;for(let _=0;_<=u;_++)r[_].x-=f,r[_].y+=i+o+a}function E_(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function Mp(r,e,i,o){const{horizontalAlign:a,verticalAlign:u}=S_(o),h=i[0]-r.displaySize[0]*a,f=i[1]-r.displaySize[1]*u;return{imagePrimary:r,imageSecondary:e,top:f,bottom:f+r.displaySize[1],left:h,right:h+r.displaySize[0]}}function I_(r,e,i,o,a,u){const h=r.imagePrimary;let f;if(h.content){const L=h.content,D=h.pixelRatio||1;f=[L[0]/D,L[1]/D,h.displaySize[0]-L[2]/D,h.displaySize[1]-L[3]/D]}const _=e.left*u,y=e.right*u;let v,b,T,E;i==="width"||i==="both"?(E=a[0]+_-o[3],b=a[0]+y+o[1]):(E=a[0]+(_+y-h.displaySize[0])/2,b=E+h.displaySize[0]);const I=e.top*u,P=e.bottom*u;return i==="height"||i==="both"?(v=a[1]+I-o[0],T=a[1]+P+o[2]):(v=a[1]+(I+P-h.displaySize[1])/2,T=v+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:v,right:b,bottom:T,left:E,collisionPadding:f}}function lx(r){return!r.imagePrimary.stretchX}function cx(r){return!r.imagePrimary.stretchY}function ux(r){return{width:r.right-r.left,height:r.bottom-r.top}}const ds=128;function Hu(r,e,i){const{expression:o}=e;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new Li(r+1,{worldview:i}))};if(o.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:u}=o;let h=0;for(;h<a.length&&a[h]<=r;)h++;h=Math.max(0,h-1);let f=h;for(;f<a.length&&a[f]<r+1;)f++;f=Math.min(a.length-1,f);const _=a[h],y=a[f];return o.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:y,interpolationType:u}:{kind:"camera",minZoom:_,maxZoom:y,minSize:o.evaluate(new Li(_,{worldview:i})),maxSize:o.evaluate(new Li(y,{worldview:i})),interpolationType:u}}}function A_(r,{uSize:e,uSizeT:i},{lowerSize:o,upperSize:a}){return r.kind==="source"?o/ds:r.kind==="composite"?wt(o/ds,a/ds,i):e}function qu(r,e,i=1){let o=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:u,minZoom:h,maxZoom:f}=r,_=u?O(Un.interpolationFactor(u,e,h,f),0,1):0;r.kind==="camera"?a=wt(r.minSize,r.maxSize,_)*i:o=_*i}return{uSizeT:o,uSize:a}}class Ia extends Oe{constructor(e,i,o,a,u){super(e,i),this.angle=a,this.z=o,u!==void 0&&(this.segment=u)}clone(){return new Ia(this.x,this.y,this.z,this.angle,this.segment)}}function hx(r,e,i,o,a){if(e.segment===void 0)return!0;let u=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(u),u=r[h]}f+=r[h].dist(r[h+1]),h++;const _=[];let y=0;for(;f<i/2;){const v=r[h],b=r[h+1];if(!b)return!1;let T=r[h-1].angleTo(v)-v.angleTo(b);for(T=Math.abs((T+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:T}),y+=T;f-_[0].distance>o;)y-=_.shift().angleDelta;if(y>a)return!1;h++,f+=v.dist(b)}return!0}function dx(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function fx(r,e,i){return r?.6*e*i:0}function px(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function db(r,e,i,o,a,u){const h=fx(i,a,u),f=px(i,o)*u;let _=0;const y=dx(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],T=r[v+1],E=b.dist(T);if(_+E>y){const I=(y-_)/E,P=wt(b.x,T.x,I),L=wt(b.y,T.y,I),D=new Ia(P,L,0,T.angleTo(b),v);return!h||hx(r,D,f,h,e)?D:void 0}_+=E}}function fb(r,e,i,o,a,u,h,f,_){const y=fx(o,u,h),v=px(o,a),b=v*h,T=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),mx(r,T?e/2*f%e:(v/2+2*u)*h*f%e,e,y,i,b,T,!1,_)}function mx(r,e,i,o,a,u,h,f,_){const y=u/2,v=dx(r);let b=0,T=e-i,E=[];for(let I=0;I<r.length-1;I++){const P=r[I],L=r[I+1],D=P.dist(L),B=L.angleTo(P);for(;T+i<b+D;){T+=i;const V=(T-b)/D,G=wt(P.x,L.x,V),K=wt(P.y,L.y,V);if(G>=0&&G<_&&K>=0&&K<_&&T-y>=0&&T+y<=v){const Z=new Ia(G,K,0,B,I);o&&!hx(r,Z,u,o,a)||E.push(Z)}}b+=D}return f||E.length||h||(E=mx(r,b/2,i,o,a,u,h,!0,_)),E}function _x(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort(((h,f)=>
7f.h-h.h));const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,u=0;for(const h of r)for(let f=o.length-1;f>=0;f--){const _=o[f];if(!(h.w>_.w||h.h>_.h)){if(h.x=_.x,h.y=_.y,u=Math.max(u,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===_.w&&h.h===_.h){const y=o.pop();y&&f<o.length&&(o[f]=y)}else h.h===_.h?(_.x+=h.w,_.w-=h.w):h.w===_.w?(_.y+=h.h,_.h-=h.h):(o.push({x:_.x+h.w,y:_.y,w:_.w-h.w,h:h.h}),_.y+=h.h,_.h-=h.h);break}}return{w:a,h:u,fill:e/(a*u)||0}}ot(Ia,"Anchor");const cc=1;class zd{static getImagePositionScale(e,i,o){if(i&&e){const{sx:a,sy:u}=e;return{x:a,y:u}}return{x:o,y:o}}constructor(e,i,o,a){this.paddedRect=e;const{pixelRatio:u,version:h,stretchX:f,stretchY:_,content:y,sdf:v,usvg:b}=i;this.pixelRatio=u,this.stretchX=f,this.stretchY=_,this.content=y,this.version=h,this.padding=o,this.sdf=v,this.usvg=b,this.scale=zd.getImagePositionScale(a,b,u)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function M_(r,e,i){const o=Xo.parse(r),a=(function(u,h,f=[1,1]){return{x:0,y:0,w:(u.data?u.data.width:u.width*f[0])+2*h,h:(u.data?u.data.height:u.height*f[1])+2*h}})(e,i,[o.sx,o.sy]);return{bin:a,imagePosition:new zd(a,e,i,o),imageVariant:o}}class gx{constructor(e,i,o){const a=new Map,u=new Map;this.haveRenderCallbacks=[];const h=[];this.addImages(e,a,cc,h),this.addImages(i,u,2,h);const{w:f,h:_}=_x(h),y=new ln({width:f||1,height:_||1});for(const[v,b]of e.entries()){const T=a.get(v).paddedRect;ln.copy(b.data,y,{x:0,y:0},{x:T.x+cc,y:T.y+cc},b.data,null,b.sdf)}for(const[v,b]of i.entries()){const T=u.get(v),E=T.paddedRect;let I=T.padding;const P=E.x+I,L=E.y+I,D=b.data.width,B=b.data.height;I=I>1?I-1:I,ln.copy(b.data,y,{x:0,y:0},{x:P,y:L},b.data,o),ln.copy(b.data,y,{x:0,y:B-I},{x:P,y:L-I},{width:D,height:I},o),ln.copy(b.data,y,{x:0,y:0},{x:P,y:L+B},{width:D,height:I},o),ln.copy(b.data,y,{x:D-I,y:0},{x:P-I,y:L},{width:I,height:B},o),ln.copy(b.data,y,{x:0,y:0},{x:P+D,y:L},{width:I,height:B},o),ln.copy(b.data,y,{x:D-I,y:B-I},{x:P-I,y:L-I},{width:I,height:I},o),ln.copy(b.data,y,{x:0,y:B-I},{x:P+D,y:L-I},{width:I,height:I},o),ln.copy(b.data,y,{x:0,y:0},{x:P+D,y:L+B},{width:I,height:I},o),ln.copy(b.data,y,{x:D-I,y:0},{x:P-I,y:L+B},{width:I,height:I},o)}this.lut=o,this.image=y,this.iconPositions=a,this.patternPositions=u}addImages(e,i,o,a){for(const[u,h]of e.entries()){const{bin:f,imagePosition:_,imageVariant:y}=M_(u,h,o);i.set(u,_),a.push(f),h.hasRenderCallback&&this.haveRenderCallbacks.push(y.id)}}patchUpdatedImages(e,i,o){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((a=>e.hasImage(a,o))),e.dispatchRenderCallbacks(this.haveRenderCallbacks,o);for(const a of e.getUpdatedImages(o)){for(const u of this.iconPositions.keys()){const h=Xo.parse(u);if(fn.isEqual(h.id,a)){const f=e.getImage(a,o);this.patchUpdatedImage(this.iconPositions.get(u),f,i,null)}}for(const u of this.patternPositions.keys()){const h=Xo.parse(u);if(fn.isEqual(h.id,a)){const f=e.getImage(a,o);this.patchUpdatedImage(this.patternPositions.get(u),f,i,this.lut)}}}}patchUpdatedImage(e,i,o,a=null){if(!e||!i||e.version===i.version)return;e.version=i.version;const[u,h]=e.tl,f=e.sdf;if(this.lut||f){const _={width:i.data.width,height:i.data.height},y=new ln(_);ln.copy(i.data,y,{x:0,y:0},{x:0,y:0},_,a,f),o.update(y,{position:{x:u,y:h}})}else o.update(i.data,{position:{x:u,y:h}})}}ot(zd,"ImagePosition"),ot(gx,"ImageAtlas");const Dd=1e20;function yx(r,e,i,o,a,u,h,f,_){for(let y=e;y<e+o;y++)xx(r,i*u+y,u,a,h,f,_);for(let y=i;y<i+a;y++)xx(r,y*u+e,1,o,h,f,_)}function xx(r,e,i,o,a,u,h){u[0]=0,h[0]=-Dd,h[1]=Dd,a[0]=r[e];for(let f=1,_=0,y=0;f<o;f++){a[f]=r[e+f*i];const v=f*f;do{const b=u[_];y=(a[f]-a[b]+v-b*b)/(f-b)/2}while(y<=h[_]&&--_>-1);_++,u[_]=f,h[_]=y,h[_+1]=Dd}for(let f=0,_=0;f<o;f++){for(;h[_+1]<f;)_++;const y=u[_],v=f-y;r[e+f*i]=a[y]+v*v}}const fs=2,C_={none:0,ideographs:1,all:2};class $u{constructor(e,i,o){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=o,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,i){const o=[],a=this.url||qt.GLYPHS_URL;for(const u in e)for(const h of e[u])o.push({stack:u,id:h});oe(o,(({stack:u,id:h},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let y=_.glyphs[h];if(y!==void 0)return void f(null,{stack:u,id:h,glyph:y});if(y=this._tinySDF(_,u,h),y)return _.glyphs[h]=y,void f(null,{stack:u,id:h,glyph:y});const v=Math.floor(h/256);if(256*v>65535)return tt("glyphs > 65535 not supported"),void f(null,{stack:u,id:h,glyph:y});if(_.ranges[v])return void f(null,{stack:u,id:h,glyph:y});let b=_.requests[v];b||(b=_.requests[v]=[],$u.loadGlyphRange(u,v,a,this.requestManager,((T,E)=>
7{if(E){_.ascender=E.ascender,_.descender=E.descender;for(const I in E.glyphs)this._doesCharSupportLocalGlyph(+I)||(_.glyphs[+I]=E.glyphs[+I]);_.ranges[v]=!0}for(const I of b)I(T,E);delete _.requests[v]}))),b.push(((T,E)=>{T?f(T):E&&f(null,{stack:u,id:h,glyph:E.glyphs[h]||null})}))}),((u,h)=>{if(u)i(u);else if(h){const f={};for(const{stack:_,id:y,glyph:v}of h)f[_]===void 0&&(f[_]={}),f[_].glyphs===void 0&&(f[_].glyphs={}),f[_].glyphs[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},f[_].ascender=this.entries[_].ascender,f[_].descender=this.entries[_].descender;i(null,f)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==C_.none&&(this.localGlyphMode===C_.all?!!this.localFontFamily:!!this.localFontFamily&&(yt["CJK Unified Ideographs"](e)||yt["Hangul Syllables"](e)||yt.Hiragana(e)||yt.Katakana(e)||yt["CJK Symbols and Punctuation"](e)||yt["CJK Unified Ideographs Extension A"](e)||yt["CJK Unified Ideographs Extension B"](e)||yt.Osage(e)))}_tinySDF(e,i,o){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let u=e.tinySDF;if(!u){let P="400";/bold/i.test(i)?P="900":/medium/i.test(i)?P="500":/light/i.test(i)&&(P="200"),u=e.tinySDF=new $u.TinySDF({fontFamily:a,fontWeight:P,fontSize:24*fs,buffer:3*fs,radius:8*fs}),u.fontWeight=P}if(this.localGlyphs[u.fontWeight][o])return this.localGlyphs[u.fontWeight][o];const h=String.fromCodePoint(o),{data:f,width:_,height:y,glyphWidth:v,glyphHeight:b,glyphLeft:T,glyphTop:E,glyphAdvance:I}=u.draw(h);return this.localGlyphs[u.fontWeight][o]={id:o,bitmap:new al({width:_,height:y},f),metrics:{width:v/fs,height:b/fs,left:T/fs,top:E/fs-27,advance:I/fs,localGlyph:!0}}}}$u.loadGlyphRange=function(r,e,i,o,a){const u=256*e,h=u+255,f=o.transformRequest(o.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${u}-${h}`),vl.Glyphs);Wo(f,((_,y)=>{if(_)a(_);else if(y){const v={},b=(function(T){return new Ip(T).readFields(ab,{})})(y);for(const T of b.glyphs)v[T.id]=T;a(null,{glyphs:v,ascender:b.ascender,descender:b.descender})}}))},$u.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:u="normal",fontStyle:h="normal",lang:f=null}={}){this.buffer=e,this.cutoff=o,this.radius=i,this.lang=f;const _=this.size=r+4*e,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${h} ${u} ${r}px ${a}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:u}=this.ctx.measureText(r),h=Math.ceil(i),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-a))),_=Math.min(this.size-this.buffer,h+Math.ceil(o)),y=f+2*this.buffer,v=_+2*this.buffer,b=Math.max(y*v,0),T=new Uint8ClampedArray(b),E={data:T,width:y,height:v,glyphWidth:f,glyphHeight:_,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(f===0||_===0)return E;const{ctx:I,buffer:P,gridInner:L,gridOuter:D}=this;this.lang&&(I.lang=this.lang),I.clearRect(P,P,f,_),I.fillText(r,P,P+h);const B=I.getImageData(P,P,f,_);D.fill(Dd,0,b),L.fill(0,0,b);for(let V=0;V<_;V++)for(let G=0;G<f;G++){const K=B.data[4*(V*f+G)+3]/255;if(K===0)continue;const Z=(V+P)*y+G+P;if(K===1)D[Z]=0,L[Z]=Dd;else{const ee=.5-K;D[Z]=ee>0?ee*ee:0,L[Z]=ee<0?ee*ee:0}}yx(D,0,0,y,v,y,this.f,this.v,this.z),yx(L,P,P,f,_,y,this.f,this.v,this.z);for(let V=0;V<b;V++){const G=Math.sqrt(D[V])-Math.sqrt(L[V]);T[V]=Math.round(255-255*(G/this.radius+this.cutoff))}return E}};const Hs=cc;function vx(r,e){return r+e[1]-e[0]}function P_(r,e,i,o,a=1){const u=[],h=r.imagePrimary,f=h.pixelRatio,_=h.paddedRect.w-2*Hs,y=h.paddedRect.h-2*Hs,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,T=h.stretchX||[[0,_]],E=h.stretchY||[[0,y]],I=T.reduce(vx,0),P=E.reduce(vx,0),L=_-I,D=y-P;let B=0,V=I,G=0,K=P,Z=0,ee=L,ne=0,ae=D;if(h.content&&o){const he=h.content;B=Cp(T,0,he[0]),G=Cp(E,0,he[1]),V=Cp(T,he[0],he[2]),K=Cp(E,he[1],he[3]),Z=he[0]-B,ne=he[1]-G,ee=he[2]-
7he[0]-V,ae=he[3]-he[1]-K}const be=(he,Ee,Ce,Pe)=>{const Fe=Pp(he.stretch-B,V,v,r.left*a),Be=Rp(he.fixed-Z,ee,he.stretch,I),ze=Pp(Ee.stretch-G,K,b,r.top*a),De=Rp(Ee.fixed-ne,ae,Ee.stretch,P),Se=Pp(Ce.stretch-B,V,v,r.left*a),we=Rp(Ce.fixed-Z,ee,Ce.stretch,I),Le=Pp(Pe.stretch-G,K,b,r.top*a),Ze=Rp(Pe.fixed-ne,ae,Pe.stretch,P),je=new Oe(Fe,ze),dt=new Oe(Se,ze),Qe=new Oe(Se,Le),rt=new Oe(Fe,Le),at=new Oe(Be/f,De/f),Ut=new Oe(we/f,Ze/f),Ge=e*Math.PI/180;if(Ge){const Si=Math.sin(Ge),W=Math.cos(Ge),J=[W,-Si,Si,W];je._matMult(J),dt._matMult(J),rt._matMult(J),Qe._matMult(J)}const lt=he.stretch+he.fixed,It=Ce.stretch+Ce.fixed,Zt=Ee.stretch+Ee.fixed,Xt=Pe.stretch+Pe.fixed,Rt=r.imageSecondary;return{tl:je,tr:dt,bl:rt,br:Qe,texPrimary:{x:h.paddedRect.x+Hs+lt,y:h.paddedRect.y+Hs+Zt,w:It-lt,h:Xt-Zt},texSecondary:Rt?{x:Rt.paddedRect.x+Hs+lt,y:Rt.paddedRect.y+Hs+Zt,w:It-lt,h:Xt-Zt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:at,pixelOffsetBR:Ut,minFontScaleX:ee/f/v,minFontScaleY:ae/f/b,isSDF:i}};if(o&&(h.stretchX||h.stretchY)){const he=bx(T,L,I),Ee=bx(E,D,P);for(let Ce=0;Ce<he.length-1;Ce++){const Pe=he[Ce],Fe=he[Ce+1];for(let Be=0;Be<Ee.length-1;Be++)u.push(be(Pe,Ee[Be],Fe,Ee[Be+1]))}}else u.push(be({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:y+1}));return u}function pb(r,e){const i=r.stretchY||[[0,r.paddedRect.h-2*Hs]];return e&&(r.stretchX||r.stretchY)?wx(r.stretchX||[[0,r.paddedRect.w-2*Hs]])*wx(i):1}function Cp(r,e,i){let o=0;for(const a of r)o+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return o}function bx(r,e,i){const o=[{fixed:-Hs,stretch:0}];for(const[a,u]of r){const h=o[o.length-1];o.push({fixed:a-h.stretch,stretch:h.stretch}),o.push({fixed:a-h.stretch,stretch:h.stretch+(u-a)})}return o.push({fixed:e+Hs,stretch:i}),o}function wx(r){return 2*r.length+1}function Pp(r,e,i,o){return r/e*i+o}function Rp(r,e,i,o){return r-e*i/o}function mb(r,e,i,o){const a=e+r.positionedLines[o].lineOffset;return o===0?i+a/2:i+(a+(e+r.positionedLines[o-1].lineOffset))/2}function _b(r,e=1,i=!1){let o=1/0,a=1/0,u=-1/0,h=-1/0;const f=r[0];for(let E=0;E<f.length;E++){const I=f[E];(!E||I.x<o)&&(o=I.x),(!E||I.y<a)&&(a=I.y),(!E||I.x>u)&&(u=I.x),(!E||I.y>h)&&(h=I.y)}const _=Math.min(u-o,h-a);let y=_/2;const v=new Fc([],gb);if(_===0)return new Oe(o,a);for(let E=o;E<u;E+=_)for(let I=a;I<h;I+=_)v.push(new Zu(E+y,I+y,y,r));let b=(function(E){let I=0,P=0,L=0;const D=E[0];for(let B=0,V=D.length,G=V-1;B<V;G=B++){const K=D[B],Z=D[G],ee=K.x*Z.y-Z.x*K.y;P+=(K.x+Z.x)*ee,L+=(K.y+Z.y)*ee,I+=3*ee}return new Zu(P/I,L/I,0,E)})(r),T=v.length;for(;v.length;){const E=v.pop();(E.d>b.d||!b.d)&&(b=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,T)),E.max-b.d<=e||(y=E.h/2,v.push(new Zu(E.p.x-y,E.p.y-y,y,r)),v.push(new Zu(E.p.x+y,E.p.y-y,y,r)),v.push(new Zu(E.p.x-y,E.p.y+y,y,r)),v.push(new Zu(E.p.x+y,E.p.y+y,y,r)),T+=4)}return i&&(console.log(`num probes: ${T}`),console.log(`best distance: ${b.d}`)),b.p}function gb(r,e){return e.max-r.max}class Zu{constructor(e,i,o,a){this.p=new Oe(e,i),this.h=o,this.d=(function(u,h){let f=!1,_=1/0;for(let y=0;y<h.length;y++){const v=h[y];for(let b=0,T=v.length,E=T-1;b<T;E=b++){const I=v[b],P=v[E];I.y>u.y!=P.y>u.y&&u.x<(P.x-I.x)*(u.y-I.y)/(P.y-I.y)+I.x&&(f=!f),_=Math.min(_,ur(u,I,P))}}return(f?1:-1)*Math.sqrt(_)})(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const yb=Object.keys,R_=Number.POSITIVE_INFINITY,xb=Math.sqrt(2);function cl(r,e,i,o,a){const u=E_(r)&&r.collisionPadding?r.collisionPadding:[0,0,0,0],h={top:r.top-u[1],bottom:r.bottom+u[3],left:r.left-u[0],right:r.right+u[2],scaled:!1};return o!==void 0&&(function(f,_){f.top*=_,f.bottom*=_,f.left*=_,f.right*=_,f.scaled=!0}
7)(h,o),i&&(function(f,_){if(!_)return;const y=oi(_),v=new Oe(f.left,f.top),b=new Oe(f.right,f.top),T=new Oe(f.left,f.bottom),E=new Oe(f.right,f.bottom),I=new Oe(0,0);v._rotateAround(y,I),b._rotateAround(y,I),T._rotateAround(y,I),E._rotateAround(y,I),f.left=Math.min(v.x,b.x,T.x,E.x),f.right=Math.max(v.x,b.x,T.x,E.x),f.top=Math.min(v.y,b.y,T.y,E.y),f.bottom=Math.max(v.y,b.y,T.y,E.y)})(h,i),a&&(h.left+=a[0],h.right+=a[0],h.top+=a[1],h.bottom+=a[1]),e?{top:Math.min(e.top,h.top),bottom:Math.max(e.bottom,h.bottom),left:Math.min(e.left,h.left),right:Math.max(e.right,h.right),scaled:e.scaled||h.scaled}:h}function Tx(r,[e,i]){let o=0,a=0;if(i===R_){e<0&&(e=0);const u=e/xb;switch(r){case"top-right":case"top-left":a=u-7;break;case"bottom-right":case"bottom-left":a=7-u;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":o=-u;break;case"top-left":case"bottom-left":o=u;break;case"left":o=e;break;case"right":o=-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":o=-e;break;case"top-left":case"bottom-left":case"left":o=e}}return[o,a]}function vb(r,e,i,o,a,u,h,f,_,y,v,b,T,E){const I=r.layers[0],P=I.appearances;if(P.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const L={iconBBox:null,iconVerticalBBox:null},D={textBBox:null,textVerticalBBox:null},{baseIconRotate:B,baseTextRotate:V,iconScaleFactor:G}=(function(Z,ee,ne){const ae=Z.get("icon-rotate").evaluate(ee,{},ne),be=Z.get("text-rotate").evaluate(ee,{},ne),[he,Ee]=Z.get("icon-size-scale-range");return{baseIconRotate:ae,baseTextRotate:be,iconScaleFactor:O(1,he,Ee)}})(o,a,u);e&&(L.iconBBox=cl(e,L.iconBBox,B,h),i)&&(L.iconVerticalBBox=cl(i,L.iconVerticalBBox,B+90,h));const K=Dp(b.horizontal);K&&(D.textBBox=cl(K,D.textBBox,V,1,E)),b.vertical&&(D.textVerticalBBox=cl(b.vertical,D.textVerticalBBox,V+90,1,E));for(const Z of P)Z.hasIconProperties()&&bb(L,r,I,Z,a,u,f,B,h,_,e,y,G,v),Z.hasTextProperties()&&wb(D,I,Z,a,u,E,V,T,K,b.vertical);return{iconBBox:L.iconBBox,iconVerticalBBox:L.iconVerticalBBox,textBBox:D.textBBox,textVerticalBBox:D.textVerticalBBox}}function bb(r,e,i,o,a,u,h,f,_,y,v,b,T,E){const{appearanceIconOffset:I,appearanceIconRotate:P,appearanceIconSize:L}=(function(G,K,Z,ee,ne,ae,be,he){const Ee=G.hasProperty("icon-offset")?K.getAppearanceValueAndResolveTokens(G,"icon-offset",Z,ee,[]):null,Ce=Ee&&Array.isArray(Ee)?Ee:ne,Pe=G.hasProperty("icon-rotate")?K.getAppearanceValueAndResolveTokens(G,"icon-rotate",Z,ee,[]):null,Fe=typeof Pe=="number"?Pe:ae,Be=G.hasProperty("icon-size")?K.getAppearanceValueAndResolveTokens(G,"icon-size",Z,ee,[]):null;return{appearanceIconOffset:Ce,appearanceIconRotate:Fe,appearanceIconSize:typeof Be=="number"?Be*he.iconScaleFactor:be}})(o,i,a,u,h,f,_,y);let D=null,B=null,V=null;o.hasProperty("icon-image")?V=(function(G,K,Z,ee,ne,ae,be){let he=null;const Ee=K.getAppearanceValueAndResolveTokens(Z,"icon-image",ee,ne,[]);if(Ee){const Ce=G.getResolvedImageFromTokens(Ee),Pe=Z.getUnevaluatedProperty("icon-size"),Fe=Ld(Ce,Hu(G.zoom,Pe,G.worldview),Pe,ne,G.zoom,ee,G.pixelRatio,be,G.worldview);he=ae.get(Fe.iconPrimary.toString())}return he})(e,i,o,a,u,b,T):v&&(V=v.imagePrimary),V&&(D=Mp(V,null,I,E),e.allowVerticalPlacement&&(B=Mp(V,null,I,E))),D&&(r.iconBBox=cl(D,r.iconBBox,P,L)),B&&(r.iconVerticalBBox=cl(B,r.iconVerticalBBox,P+90,L))}function wb(r,e,i,o,a,u,h,f,_,y){const{appearanceTextOffset:v,appearanceTextRotate:b,appearanceTextSize:T}=(function(I,P,L,D,B,V,G){const K=I.hasProperty("text-offset")?P.getAppearanceValueAndResolveTokens(I,"text-offset",L,D,[]):null,Z=K&&Array.isArray(K)?[K[0]*Br,K[1]*Br]:B,ee=I.hasProperty("text-rotate")?P.getAppearanceValueAndResolveTokens(I,"text-rotate",L,D,[]):null,ne=typeof ee=="number"?ee:V,ae=I.hasProperty("text-size")?P.getAppearanceValueAndResolveTokens(I,"text-size",L,D,[]):null;return{appearanceTextOffset:Z,appearanceTextRotate:ne,appearanceTextSize:typeof ae=="number"?ae:G}})(i,e,o,a,u,h,f),E=T/f;_&&(r.textBBox=cl(_,r.textBBox,b,E,v)),y&&(r.textVerticalBBox=cl(y,r.textVerticalBBox,b+90,E,v))}function zp(r,e,i,o,a,u,h,f,_){if(!e||!e.usvg)return;const y=ux(o),v=ux(a),b=u!=="both"&&u!=="width"||!lx(o)?1:v.width/y.width,T=u!=="both"&&u!=="height"||!cx(o)?1:v.height/y.height;i.scaleSelf(b,T);const E=i.toString();h.set(E,i),f.set(E,e);const{imagePosition:I}=M_(E,e,cc);_.set(E,I)}function Sx(r,e,i,o,a,u,h,f,_){if(!r)return;const y=(function(v,b,T,E,I,P){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const L=b.possiblyEvaluate(new Li(v.maxZoom,{worldview:P}),T).evaluate(I,{},T),D=b.possiblyEvaluate(new Li(v.minZoom,{worldview:P}),T).evaluate(I,{},T);return Math.max(L,D)}return b.possiblyEvaluate(new Li(E,{worldview:P})).evaluate(I,{},T)})(e,i,o,a,u,_);return r.scaleSelf(y*f*h)}function Ld(r,e,i,o,a,u,h,f,_){return{iconPrimary:Sx(r.getPrimary(),e,i,o,a,u,h,f,_),iconSecondary:Sx(r.getSecondary(),e,i,o,a,u,h,f,_)}}function Tb(r,e,i){if(!e)return;const o=i.get(r.toString()),a=i.get(e.toString());o&&a&&(o.paddedRect.w===a.paddedRect.w&&o.paddedRect.h===a.paddedRect.h||tt(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),o.usvg!==a.usvg&&tt(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function Ex(r,e,i,o){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,o){const u=e.get(o.toString());r.imageSecondary=u}}function Sb(r,e){for(const i in r.horizontal)Ix(r.horizontal[i],e);Ix(r.vertical,e)}function Ix(r,e){if(r){for(const i of r.positionedLines)for(const o of i.positionedGlyphs)if(o.image!==null){const a=o.image.toString();o.rect=e.get(a).paddedRect}}}function z_(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 Eb(r,e,i,o,a,u,h,f,_){const y=Dp(u.horizontal)||u.vertical,v=i.get("icon-text-fit-padding").evaluate(o,{},a);let b,T=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&u.vertical&&(b=I_(e,u.vertical,_,v,f,h)),y&&(T=I_(e,y,_,v,f,h))),{defaultShapedIcon:T,verticallyShapedIcon:b}}function Ib(r,e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B,V,G,K,Z,ee){let ne=h.textMaxSize.evaluate(e,{},T);ne===void 0?ne=f*h.textScaleFactor:ne*=h.textScaleFactor;const ae=r.layers[0].layout,be=Br,he=f*h.textScaleFactor/be,Ee=Dp(i.horizontal)||i.vertical;if(L!=="none"&&r.appearanceFeatureData&&e.index<r.appearanceFeatureData.length){const Qe=r.a
7ppearanceFeatureData[e.index];Qe&&(Qe.textShaping=Ee,Qe.iconTextFitPadding=ae.get("icon-text-fit-padding").evaluate(e,{},T),Qe.fontScale=he)}const Ce=E.name==="globe",Pe=r.tilePixelRatio*ne/be,Fe=(Le=r.overscaling,r.zoom>18&&Le>2&&(Le>>=1),Math.max($e/(512*Le),1)*ae.get("symbol-spacing")),Be=ae.get("text-padding")*r.tilePixelRatio,ze=ae.get("icon-padding")*r.tilePixelRatio,De=oi(ae.get("text-max-angle")),Se=ae.get("icon-rotation-alignment")==="map"&&V!=="point",we=Fe/2;var Le;r.hasAnyIconTextFit===!1&&L!=="none"&&(r.hasAnyIconTextFit=!0);const Ze=e.properties?+e.properties[Te]:null,je=Ze&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(Ze):65535,dt=(Qe,rt,at)=>{if(rt.x<0||rt.x>=$e||rt.y<0||rt.y>=$e)return;let Ut=null;if(Ce){const{x:Ge,y:lt,z:It}=E.projectTilePoint(rt.x,rt.y,at);Ut={anchor:new Ia(Ge,lt,It,0,void 0),up:E.upVector(at,rt.x,rt.y)}}(function(Ge,lt,It,Zt,Xt,Rt,Si,W,J,Ie,ke,Ye,Ke,ft,mt,Ct,kt,Nt,Gt,bt,Et,ti,ai,li,vi,Ci,Ei,ui,pi,Bt,Wt,qi,xt){const Ht=Ge.addToLineVertexArray(lt,Zt);let Ii,Ri,Oi,mr,zi,vt,Ki,bi=0,ji=0,Pr=0,Nr=0,wr=-1,Tr=-1;const Lr={};let Pn=Sc("");const Di=It?It.anchor:lt,hr=ui!=="none";let _r=0,Fn=0;if(J._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Jr=J.layout.get("text-offset").evaluate(Et,{},vi);_r=Jr[0]*Br,Fn=Jr[1]*Br}else _r=J.layout.get("text-radial-offset").evaluate(Et,{},vi)*Br,Fn=R_;if(Ge.allowVerticalPlacement&&Xt.vertical){const Jr=Xt.vertical;if(mt)vt=D_(Jr),W&&(Ki=D_(W));else{const bn=J.layout.get("text-rotate").evaluate(Et,{},vi)+90;Oi=Lp(Ie,Di,lt,ke,Ye,Ke,Jr,ft,bn,Ct,qi),W&&(mr=Lp(Ie,Di,lt,ke,Ye,Ke,W,Nt,bn,null,Wt))}}if(Rt){const Jr=Ge.iconSizeData,bn=J.layout.get("icon-rotate").evaluate(Et,{},vi),Zn=P_(Rt,bn,ai,hr,ti.iconScaleFactor),dl=W?P_(W,bn,ai,hr,ti.iconScaleFactor):void 0;Ri=Lp(Ie,Di,lt,ke,Ye,Ke,Rt,Nt,bn,null,Bt);const eh=(function(gs,Jd,qv,Bw,$v,Zv,Nw,Vw){const Wv=gs.layers[0],Xv=Wv.appearances;let th=Jd.length;if(qv&&(th=Math.max(th,qv.length)),Xv.length===0)return th;const[Uw,jw]=Bw.get("icon-size-scale-range"),Gw=O(1,Uw,jw);for(const Yv of Xv){const Kv=Yv.getUnevaluatedProperties();if(Kv._values["icon-image"].value!==void 0){const Jv=Wv.getAppearanceValueAndResolveTokens(Yv,"icon-image",$v,Zv,[]);if(Jv){const Qv=gs.getResolvedImageFromTokens(Jv);if(Qv){const e0=Kv._values["icon-size"],Hw=Ld(Qv,Hu(gs.zoom,e0,gs.worldview),e0,Zv,gs.zoom,$v,gs.pixelRatio,Gw,gs.worldview),qw=Nw.get(Hw.iconPrimary.toString());th=Math.max(th,pb(qw,Vw))}}}}return th})(Ge,Zn,dl,J.layout,Et,vi,Ge.iconAtlasPositions,hr);bi=4*eh;let _s=null;Jr.kind==="source"?(_s=[ds*J.layout.get("icon-size").evaluate(Et,{},vi)*ti.iconScaleFactor],_s[0]>Aa&&tt(`${Ge.layerIds[0]}: Value for "icon-size" is >= ${Od}. Reduce your "icon-size".`)):Jr.kind==="composite"&&(_s=[ds*ti.compositeIconSizes[0].evaluate(Et,{},vi)*ti.iconScaleFactor,ds*ti.compositeIconSizes[1].evaluate(Et,{},vi)*ti.iconScaleFactor],(_s[0]>Aa||_s[1]>Aa)&&tt(`${Ge.layerIds[0]}: Value for "icon-size" is >= ${Od}. Reduce your "icon-size".`)),Ge.addSymbols(Ge.icon,Zn,_s,bt,Gt,Et,void 0,It,lt,Ht.lineStartIndex,Ht.lineLength,-1,li,vi,Ci,Ei,Ge.symbolInstances.length,eh),wr=Ge.icon.placedSymbolArray.length-1,dl&&(ji=4*eh,Ge.addSymbols(Ge.icon,dl,_s,bt,Gt,Et,$n.vertical,It,lt,Ht.lineStartIndex,Ht.lineLength,-1,li,vi,Ci,Ei,Ge.symbolInstances.length,eh),Tr=Ge.icon.placedSymbolArray.length-1)}for(const Jr in Xt.horizontal){const bn=Jr,Zn=Xt.horizontal[bn];Ii||(Pn=Sc(Zn.text),mt?zi=D_(Zn):Ii=Lp(Ie,Di,lt,ke,Ye,Ke,Zn,ft,J.layout.get("text-rotate").evaluate(Et,{},vi),Ct,qi));const dl=Zn.positionedLines.length===1;if(Pr+=Ax(Ge,It,lt,Zn,Si,J,mt,Et,Ct,Ht,Xt.vertical?$n.horizontal:$n.horizontalOnly,dl?yb(Xt.horizontal):[bn],Lr,wr,ti,li,vi,Ge.symbolInstances.length,Ci),dl)break}Xt.vertical&&(Nr+=Ax(Ge,It,lt,Xt.vertical,Si,J,mt,Et,Ct,Ht,$n.vertical,["vertical"],Lr,Tr,ti,li,vi,Ge.symbolInstances.length,Ci));let Rr=-1;const jo=(Jr,bn)=>Jr?Math.max(Jr,bn):bn;Rr=jo(zi,Rr),Rr=jo(vt,Rr),Rr=jo(Ki,Rr);const qs=Rr>-1?1:0;Ge.glyphOffsetArray.length>=65535&&tt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Et.sortKey!==void 0&&Ge.addToSortKey
7Ranges(Ge.symbolInstances.length,Et.sortKey),Ge.symbolInstances.emplaceBack(lt.x,lt.y,Di.x,Di.y,Di.z,Lr.right>=0?Lr.right:-1,Lr.center>=0?Lr.center:-1,Lr.left>=0?Lr.left:-1,Lr.vertical>=0?Lr.vertical:-1,wr,Tr,Pn,Ii!==void 0?Ii:Ge.collisionBoxArray.length,Ii!==void 0?Ii+1:Ge.collisionBoxArray.length,Oi!==void 0?Oi:Ge.collisionBoxArray.length,Oi!==void 0?Oi+1:Ge.collisionBoxArray.length,Ri!==void 0?Ri:Ge.collisionBoxArray.length,Ri!==void 0?Ri+1:Ge.collisionBoxArray.length,mr||Ge.collisionBoxArray.length,mr?mr+1:Ge.collisionBoxArray.length,ke,Pr,Nr,bi,ji,qs,0,_r,Fn,Rr,0,hr?1:0,pi)})(r,rt,Ut,Qe,i,o,u,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Be,B,y,0,ze,Se,D,e,h,v,b,T,I,P,L,je,G,K,Z)};if(V==="line")for(const Qe of mp(e.geometry,0,0,$e,$e)){const rt=fb(Qe,Fe,De,i.vertical||Ee,o,be,Pe,r.overscaling,$e);for(const at of rt)Ee&&Ab(r,Ee.text,we,at)||dt(Qe,at,T)}else if(V==="line-center"){for(const Qe of e.geometry)if(Qe.length>1){const rt=db(Qe,De,i.vertical||Ee,o,be,Pe);rt&&dt(Qe,rt,T)}}else if(e.type==="Polygon")for(const Qe of gd(e.geometry,0)){const rt=_b(Qe,16);dt(Qe[0],new Ia(rt.x,rt.y,0,0,void 0),T)}else if(e.type==="LineString")for(const Qe of e.geometry)dt(Qe,new Ia(Qe[0].x,Qe[0].y,0,0,void 0),T);else if(e.type==="Point")for(const Qe of e.geometry)for(const rt of Qe)dt([rt],new Ia(rt.x,rt.y,0,0,void 0),T)}const Od=255,Aa=Od*ds;function Ax(r,e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B){const V=(function(Z,ee,ne,ae,be,he,Ee,Ce){const Pe=[];if(ee.positionedLines.length===0)return Pe;const Fe=ae.layout.get("text-rotate").evaluate(he,{})*Math.PI/180,Be=(function(Le){const Ze=Le[0],je=Le[1],dt=Ze*je;return dt>0?[Ze,-je]:dt<0?[-Ze,je]:Ze===0?[je,Ze]:[je,-Ze]})(ne);let ze=Math.abs(ee.top-ee.bottom);for(const Le of ee.positionedLines)ze-=Le.lineOffset;const De=ee.positionedLines.length,Se=ze/De;let we=ee.top-ne[1];for(let Le=0;Le<De;++Le){const Ze=ee.positionedLines[Le];we=mb(ee,Se,we,Le);for(const je of Ze.positionedGlyphs){if(!je.rect)continue;const dt=je.rect||{};let Qe=ix+1,rt=!0,at=1,Ut=0;if(je.image){const kt=Ee.get(je.image.toString());if(!kt)continue;if(kt.sdf){tt("SDF images are not supported in formatted text and will be ignored.");continue}rt=!1,at=kt.pixelRatio,Qe=cc/at}const Ge=(be||Ce)&&je.vertical,lt=je.metrics.advance*je.scale/2,It=je.metrics,Zt=je.rect;if(Zt===null)continue;Ce&&ee.verticalizable&&(Ut=je.image?lt-je.metrics.width*je.scale/2:0);const Xt=be?[je.x+lt,je.y]:[0,0];let Rt=[0,0],Si=[0,0],W=!1;be||(Ge?(Si=[je.x+lt+Be[0],je.y+Be[1]-Ut],W=!0):Rt=[je.x+lt+ne[0],je.y+ne[1]-Ut]);const J=Zt.w*je.scale/(at*(je.localGlyph?fs:1)),Ie=Zt.h*je.scale/(at*(je.localGlyph?fs:1));let ke,Ye,Ke,ft;if(Ge){const kt=je.y-we,Nt=new Oe(-lt,lt-kt),Gt=-Math.PI/2,bt=new Oe(...Si);ke=new Oe(-lt+Rt[0],Rt[1]),ke._rotateAround(Gt,Nt)._add(bt),ke.x+=-kt+lt,ke.y-=(It.left-Qe)*je.scale;const Et=je.image?It.advance*je.scale:Br*je.scale,ti=String.fromCodePoint(je.glyph);Y1(ti)?ke.x+=(1-Qe)*je.scale:K1(ti)?ke.x+=Et-It.height*je.scale+(-Qe-1)*je.scale:ke.x+=je.image||It.width+2*Qe===Zt.w&&It.height+2*Qe===Zt.h?(Et-Ie)/2:(Et-(It.height+2*Qe)*je.scale)/2,Ye=new Oe(ke.x,ke.y-J),Ke=new Oe(ke.x+Ie,ke.y),ft=new Oe(ke.x+Ie,ke.y-J)}else{const kt=(It.left-Qe)*je.scale-lt+Rt[0],Nt=(-It.top-Qe)*je.scale+Rt[1],Gt=kt+J,bt=Nt+Ie;ke=new Oe(kt,Nt),Ye=new Oe(Gt,Nt),Ke=new Oe(kt,bt),ft=new Oe(Gt,bt)}if(Fe){let kt;kt=be?new Oe(0,0):W?new Oe(Be[0],Be[1]):new Oe(ne[0],ne[1]),ke._rotateAround(Fe,kt),Ye._rotateAround(Fe,kt),Ke._rotateAround(Fe,kt),ft._rotateAround(Fe,kt)}const mt=new Oe(0,0),Ct=new Oe(0,0);Pe.push({tl:ke,tr:Ye,bl:Ke,br:ft,texPrimary:dt,texSecondary:void 0,writingMode:ee.writingMode,glyphOffset:Xt,sectionIndex:je.sectionIndex,isSDF:rt,pixelOffsetTL:mt,pixelOffsetBR:Ct,minFontScaleX:0,minFontScaleY:0})}}return Pe})(0,o,_,u,h,f,a,r.allowVerticalPlacement),G=r.textSizeData;let K=null;G.kind==="source"?(K=[ds*u.layout.get("text-size").evaluate(f,{},L)*I.textScaleFactor],K[0]>Aa&&tt(`${r.layerIds[0]}: Value for "text-size" is >= ${Od}. Reduce your "text-size".`)):G.kind==="composite"&&(K=[ds*I.compositeTextSizes[0].evaluate(f,{},L)*I.textScaleFactor,ds*I.compositeTextSizes[1].evaluate(f,{}
vendor: 5,014 bytes, line 7
7,L)*I.textScaleFactor],(K[0]>Aa||K[1]>Aa)&&tt(`${r.layerIds[0]}: Value for "text-size" is >= ${Od}. Reduce your "text-size".`)),r.addSymbols(r.text,V,K,_,h,f,v,e,i,y.lineStartIndex,y.lineLength,E,P,L,B,!1,D,V.length);for(const Z of b)T[Z]=r.text.placedSymbolArray.length-1;return 4*V.length}function Dp(r){for(const e in r)return r[e];return null}function Lp(r,e,i,o,a,u,h,f,_,y,v){let b,T,E,I;if(b=v?v.top:h.top,T=v?v.bottom:h.bottom,E=v?v.left:h.left,I=v?v.right:h.right,E_(h)&&h.collisionPadding){const P=h.collisionPadding;E-=P[0],b-=P[1],I+=P[2],T+=P[3]}if(_){const P=new Oe(E,b),L=new Oe(I,b),D=new Oe(E,T),B=new Oe(I,T),V=oi(_);let G=new Oe(0,0);y&&(G=new Oe(y[0],y[1])),P._rotateAround(V,G),L._rotateAround(V,G),D._rotateAround(V,G),B._rotateAround(V,G),E=Math.min(P.x,L.x,D.x,B.x),I=Math.max(P.x,L.x,D.x,B.x),b=Math.min(P.y,L.y,D.y,B.y),T=Math.max(P.y,L.y,D.y,B.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,E,b,I,T,f,o,a,u),r.length-1}function D_(r){E_(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 Ab(r,e,i,o){const a=r.compareText;if(e in a){const u=a[e];for(let h=u.length-1;h>=0;h--)if(o.dist(u[h])<i)return!0}else a[e]=[];return a[e].push(o),!1}function Mx(r,e){const i=r.fovAboveCenter,o=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-o)/Math.cos(r._pitch),u=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let h=Math.sin(r._pitch)*u+a;const f=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let _=Math.max(r.zoom-17,0);r.isOrthographic&&(_/=10),h*=1+_}return Math.min(1.01*h,f)}function Fd(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),o=r.x*i,a=(r.x+1)*i,u=r.y*i,h=(r.y+1)*i,f=S(o),_=S(a),y=M(u),v=M(h),b=e.project(f,y),T=e.project(_,y),E=e.project(_,v),I=e.project(f,v);let P=Math.min(b.x,T.x,E.x,I.x),L=Math.min(b.y,T.y,E.y,I.y),D=Math.max(b.x,T.x,E.x,I.x),B=Math.max(b.y,T.y,E.y,I.y);const V=i/16;function G(Z,ee,ne,ae,be,he){const Ee=(ne+be)/2,Ce=(ae+he)/2,Pe=e.project(S(Ee),M(Ce)),Fe=Math.max(0,P-Pe.x,L-Pe.y,Pe.x-D,Pe.y-B);P=Math.min(P,Pe.x),D=Math.max(D,Pe.x),L=Math.min(L,Pe.y),B=Math.max(B,Pe.y),Fe>V&&(G(Z,Pe,ne,ae,Ee,Ce),G(Pe,ee,Ee,Ce,be,he))}G(b,T,o,u,a,u),G(T,E,a,u,a,h),G(E,I,a,h,o,h),G(I,b,o,h,o,u),P-=V,L-=V,D+=V,B+=V;const K=1/Math.max(D-P,B-L);return{scale:K,x:P*K,y:L*K,x2:D*K,y2:B*K,projection:e}}function Cx(r,{x:e,y:i},o=0){return new Oe(((e-o)*r.scale-r.x)*$e,(i*r.scale-r.y)*$e)}const Mb=Ni(new Float32Array(16));class ul{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 n(0,0)}projectTilePoint(e,i,o){return{x:e,y:i,z:0}}locationPoint(e,i,o,a=!0){return e._coordinatePoint(e.locationCoordinate(i,o),a)}pixelsPerMeter(e,i){return w(1,e)*i}pixelSpaceConversion(e,i,o){return 1}farthestPixelDistance(e){return Mx(e,e.pixelsPerMeter)}pointCoordinate(e,i,o,a){const u=e.horizonLineFromTop(!1),h=new Oe(i,Math.max(u,o));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,o){const a=new Oe(i,o);if(e.elevation)return e.elevation.pointCoordinate(a);{const u=this.pointCoordinate(e,a.x,a.y,0);return[u.x,u.y,u.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const o=e.horizonLineFromTop();return i.y<o}createInversionMatrix(e,i){return Mb}createTileMatrix(e,i,o){let a,u,h;const f=o.canonical,_=Ni(new Float64Array(16));if(this.isReprojectedInTileSpace){const y=Fd(f,this);a=1,u=y.x+o.wrap*y.scale,h=y.y,Hr(_,_,[a/y.scale,a/y.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(f.z),u=(f.x+Math.pow(2,f.z)*o.wrap)*a,h=f.y*a;return Qr(_,_,[u,h,0]),Hr(_,_,[a/$e,a/$e,1]),_}upVector(e,i,o){return[0,0,1]}upVectorScale(e,i,o){return{metersToTile:1}}}class Cb extends ul{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,o]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(oi(i));this.n=(a+Math.sin(oi(o)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:o,c:a,r0:u}=this,h=oi(e-this.center[0]),f=oi(i),_=Math.sqrt(a-2*o*Math.sin(f))/o;return{x:_*Math.sin(h*o),y:_*Math.cos(h*o)-u,z:0}}unproject(e,i){const{n:o,c:a,r0:u}=this,h=u+i;let f=Math.atan2(e,Math.abs(h))*Math.sign(h);h*o<0&&(f-=Math.PI*Math.sign(e)*Math.sign(h));const _=oi(this.center[0])*o;f=q(f,-Math.PI-_,Math.PI-_);const y=O(hn(f/o)+this.center[0],-180,180),v=Math.asin(O((a-(e*e+h*h)*o*o)/(2*o),-1,1)),b=O(hn(v),-C,C);return new n(y,b)}}const kd=1.340264,Bd=-.081106,Nd=893e-6,Vd=.003796,Op=Math.sqrt(3)/2;class Pb extends ul{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;
vendor: 6,281 bytes, line 7
7const o=Math.asin(Op*Math.sin(i)),a=o*o,u=a*a*a;return{x:.5*(e*Math.cos(o)/(Op*(kd+3*Bd*a+u*(7*Nd+9*Vd*a)))/Math.PI+.5),y:1-.5*(o*(kd+Bd*a+u*(Nd+Vd*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=o*o,u=a*a*a;for(let v,b,T,E=0;E<12&&(b=o*(kd+Bd*a+u*(Nd+Vd*a))-i,T=kd+3*Bd*a+u*(7*Nd+9*Vd*a),v=b/T,o=O(o-v,-Math.PI/3,Math.PI/3),a=o*o,u=a*a*a,!(Math.abs(v)<1e-12));++E);const h=Op*e*(kd+3*Bd*a+u*(7*Nd+9*Vd*a))/Math.cos(o),f=Math.asin(Math.sin(o)/Op),_=O(180*h/Math.PI,-180,180),y=O(180*f/Math.PI,-C,C);return new n(_,y)}}class Rb extends ul{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 o=360*(e-.5),a=O(360*(.5-i),-C,C);return new n(o,a)}}const Wu=Math.PI/2;function Fp(r){return Math.tan((Wu+r)/2)}class zb extends ul{constructor(e){super(e),this.center=e.center||[0,30];const[i,o]=this.parallels=e.parallels||[30,30];let a=oi(i),u=oi(o);this.southernCenter=a+u<0,this.southernCenter&&(a=-a,u=-u);const h=Math.cos(a),f=Fp(a);this.n=a===u?Math.sin(a):Math.log(h/Math.cos(u))/Math.log(Fp(u)/f),this.f=h*Math.pow(Fp(a),this.n)/this.n}project(e,i){i=oi(i),this.southernCenter&&(i=-i),e=oi(e-this.center[0]);const o=1e-6,{n:a,f:u}=this;u>0?i<-Wu+o&&(i=-Wu+o):i>Wu-o&&(i=Wu-o);const h=u/Math.pow(Fp(i),a);let f=h*Math.sin(a*e),_=u-h*Math.cos(a*e);return f=.5*(f/Math.PI+.5),_=.5*(_/Math.PI+.5),{x:f,y:this.southernCenter?_:1-_,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:o,f:a}=this,u=a-i,h=Math.sign(u),f=Math.sign(o)*Math.sqrt(e*e+u*u);let _=Math.atan2(e,Math.abs(u))*h;u*o<0&&(_-=Math.PI*Math.sign(e)*h);const y=O(hn(_/o)+this.center[0],-180,180),v=O(hn(2*Math.atan(Math.pow(a/f,1/o))-Wu),-C,C);return new n(y,this.southernCenter?-v:v)}}class Px extends ul{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:g(e),y:x(i),z:0}}unproject(e,i){const o=S(e),a=M(i);return new n(o,a)}}const Rx=oi(C);class Db extends ul{project(e,i){const o=(i=oi(i))*i,a=o*o;return{x:.5*((e=oi(e))*(.8707-.131979*o+a*(a*(.003971*o-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=25,u=0,h=o*o;do{h=o*o;const y=h*h;u=(o*(1.007226+h*(.015085+y*(.028874*h-.044475-.005916*y)))-i)/(1.007226+h*(.045255+y*(.259866*h-.311325-.005916*11*y))),o=O(o-u,-Rx,Rx)}while(Math.abs(u)>1e-6&&--a>0);h=o*o;const f=O(hn(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),_=hn(o);return new n(f,_)}}const zx=oi(C);class Lb extends ul{project(e,i){i=oi(i),e=oi(e);const o=Math.cos(i),a=2/Math.PI,u=Math.acos(o*Math.cos(e/2)),h=Math.sin(u)/u,f=.5*(e*a+2*o*Math.sin(e/2)/h)||0,_=.5*(i+Math.sin(i)/h)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(_/Math.PI+1),z:0}}unproject(e,i){let o=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,u=25;const h=1e-6;let f=0,_=0;do{const y=Math.cos(a),v=Math.sin(a),b=2*v*y,T=v*v,E=y*y,I=Math.cos(o/2),P=Math.sin(o/2),L=2*I*P,D=P*P,B=1-E*I*I,V=B?1/B:0,G=B?Math.acos(y*I)*Math.sqrt(1/B):0,K=.5*(2*G*y*P+2*o/Math.PI)-e,Z=.5*(G*v+a)-i,ee=.5*V*(E*D+G*y*I*T)+1/Math.PI,ne=V*(L*b/4-G*v*P),ae=.125*V*(b*P-G*v*E*L),be=.5*V*(T*I+G*D*y)+.5,he=ne*ae-be*ee;f=(Z*ne-K*be)/he,_=(K*ae-Z*ee)/he,o=O(o-f,-Math.PI,Math.PI),a=O(a-_,-zx,zx)}while((Math.abs(f)>h||Math.abs(_)>h)&&--u>0);return new n(hn(o),hn(a))}}class Dx extends ul{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(oi(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:o,cosPhi:a}=this;return{x:oi(e)*a*o+.5,y:-Math.sin(oi(i))/a*o+.5,z:0}}unproject(e,i){const{scale:o,cosPhi:a}=this,u=-(i-.5)/o,h=O(hn((e-.5)/o)/a,-180,180),f=Math.asin(O(u*a,-1,1)),_=O(hn(f),-C,C);return new n(h,_)}}class Ob extends Px{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,o){const a=hd(e,i,o);return gr(a,a,sp(wo(o))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,o){const a=rl(i.lat,i.lng),u=Bi([],a),h=o?e._centerAltitude+o:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;qr(a,a,u,w(1,0)*$e*h);const f=Ni(new Float64Array(16));return Gi(f,e.pixelMatrix,e.globeMatrix),gr(a,a,f),new Oe(a[0],a[1])}pixelsPerMeter(e,i){return w(1,0)*i}pixelSpaceConversion(e,i,o){const a=w(1,e)*i,u=wt(w(1,45)*i,a,o);return this.pixelsPerMeter(e,i)/u}createTileMatrix(e,i,o){const a=Bm(wo(o.canonical));return Gi(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:o}=e,a=sp(wo(i));return wn(a,a,oi(o.lng)),Wn(a,a,oi(o.lat)),Hr(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,o,a){return ol(e,i,o,!0)||new U(0,0)}pointCoordinate3D(e,i,o){const a=this.pointCoordinate(e,i,o,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!ol(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=(function(a,u){const h=a.cameraToCenterDistance,f=a._centerAltitude*u,_=a._camera,y=a._camera.forward(),v=gi([],Zi([],y,-h),[0,0,f]),b=a.worldSize/(2*Math.PI),T=[0,0,-b],E=a.width/a.height,I=Math.tan(a.fovAboveCenter),P=Zi([],_.up(),I),L=Zi([],_.right(),I*E),D=Bi([],gi([],gi([],y,P),L)),B=[];let V;if(new st(v,D).closestPointOnSphere(T,b,B)){const G=gi([],B,T),K=xr([],G,v);V=Math.cos(a.fovAboveCenter)*Ir(K)}else{const G=xr([],v,T),K=xr([],T,v);Bi(K,K);const Z=Ir(G)-b;V=Math.sqrt(Z*(Z+2*b));const ee=Math.acos(V/(b+Z))-Math.acos(fr(y,K));V*=Math.cos(ee)}return 1.01*V})(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),o=sl(e.zoom);if(o>0){const a=Mx(e,w(1,e.center.lat)*e.worldSize),u=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return wt(i,a+u*(1-Math.cos(h)),Math.pow(o,10))}return i}upVector(e,i,o){return hd(i,o,e,1)}upVectorScale(e){return{metersToTile:Vo(op(wo(e)))}}}function Lx(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;
7switch(r.name){case"mercator":return new Px(r);case"equirectangular":return new Rb(r);case"naturalEarth":return new Db(r);case"equalEarth":return new Pb(r);case"winkelTripel":return new Lb(r);case"albers":return i?new Dx(r):new Cb(r);case"lambertConformalConic":return i?new Dx(r):new zb(r);case"globe":return new Ob(r)}throw new Error(`Invalid projection name: ${r.name}`)}const Fb=le.types,kb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ud(r,e,i,o,a,u,h,f,_,y,v,b,T){const E=f?Math.min(Aa,Math.round(f[0])):0,I=f?Math.min(Aa,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*o),Math.round(32*a),u,h,(E<<1)+(_?1:0),0+(I<<1),16*y,16*v,256*b,256*T)}function jd(r,e,i){r.emplaceBack(e,i)}function Gd(r,e,i,o,a,u,h){r.emplaceBack(e,i,o,a,u,h)}const kp=(r,e,i,o)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],o[0],o[1],o[2])};function Xu(r,e,i,o,a){r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a)}function Bb(r){for(const e of r.sections)if(wm(e.text))return!0;return!1}class L_{constructor(e){this.layoutVertexArray=new Wh,this.indexArray=new Ar,this.programConfigurations=e,this.segments=new Wi,this.dynamicLayoutVertexArray=new Ns,this.opacityVertexArray=new yu,this.placedSymbolArray=new Jf,this.iconTransitioningVertexArray=new Gn,this.globeExtVertexArray=new Xh,this.zOffsetVertexArray=new rs,this.orientationVertexArray=new Jh,this.symbolInstanceIndices=[]}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getIconVertexData(e,i){const o=[],a=this.layoutVertexArray.uint16;for(let u=0;u<i;++u){const h=12*(e+u);o.push(...a.slice(h,h+12))}return o}updateIconVertexData(e,i,o,a,u,h,f,_,y,v,b,T,E){const I=this.layoutVertexArray.uint16,P=12*e;I[P]=i,I[P+1]=o,I[P+2]=a,I[P+3]=u,I[P+4]=h,I[P+5]=f,I[P+6]=_,I[P+7]=y,I[P+8]=v,I[P+9]=b,I[P+10]=T,I[P+11]=E}upload(e,i,o,a,u,h){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,V1.members,!!h),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,j1.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,kb,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,q1.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,U1.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||u)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,G1.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,H1.members,!0)),this.opacityVertexBuffer.itemSize=1),(o||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())}}ot(L_,"SymbolBuffers");class O_{constructor(e,i,o){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new o,this.segments=new Wi,this.collisionVertexArray=new Yh,this.collisionVertexArrayExt=new Ns}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,$1.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Z1.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}ot(O_,"CollisionBuffers");class Bp{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((h=>h.fqid)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ni([]),this.placementViewportMatrix=Ni([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.textSizeData=Hu(this.zoom,i["text-size"],this.worldview),this.iconSizeData=Hu(this.zoom,i["icon-size"],this.worldview);const o=this.layers[0].layout,a=o.get("symbol-sort-key"),u=o.get("symbol-z-order");this.lut=e.lut,this.canOverlap=o.get("text-allow-overlap")||o.get("icon-allow-overlap")||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=o.get("text-writing-mode").map((h=>$n[h])),this.stateDependentLayerIds=this.layers.filter((h=>h.isStateDependent())).map((h=>h.id)),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(e){const i=this.layers[0].getAppearances();return!(!i||i.length===0)&&i.some((o=>o.getProperty(e)!=null))}createArrays(){this.text=new L_(new vo(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("text")||e.startsWith("symbol")))),this.icon=new L_(new vo(this.layers,{zoom:this.zoom,lut:this.lut},(e=>e.startsWith("icon")||e.startsWith("symbol")))),this.glyphOffsetArray=new Iu,this.lineVertexArray=new ep,this.symbolInstances=new rd}calculateGlyphDependencies(e,i,o,a,u){for(const h of e){const f=h.codePointAt(0);if(f===void 0)break;if(i[f]=!0,a&&u&&f<=65535){const _=Pd[h];_&&(i[_.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,i,o,a,u,h){let f=1;const _=e.getUnevaluatedProperties()._values["icon-size"],y=Hu(this.zoom,_,this.worldview),v=qu(y,i);if(y.kind!=="constant"&&y.kind!=="camera"||(f=v.uSize),y.kind==="composite"){const{minZoom:b,maxZoom:T}=y,E=_.possiblyEvaluate(new Li(b,{worldview:this.worldview}),a),I=_.possiblyEvaluate(new Li(T,{worldview:this.worldview}),a),P=E.evaluate(o,{},a,u);f=P+(I.evaluate(o,{},a,u)-P)*v.uSizeT}return y.kind==="source"&&(f=_.possiblyEvaluate(new Li(this.zoom,{worldview:this.worldview}),a).evaluate(o,{},a,u)),f*h}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!dp(this.activeReplacements,o)&&(this.activeReplacements=o,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?_n.build(e):e}populate(e,i,o,a){const u=this.layers[0],h=u.layout,f=this.projection.name==="globe",_=h.get("text-font"),y=h.get("text-field"),v=h.get("icon-image"),[b,T]=h.get("icon-size-scale-range"),E=O(i.scaleFactor||1,b,T),I=(y.value.kind!=="constant"||y.value.value instanceof mn&&!y.value.value.isEmpty()||y.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,L=this.hasAnyAppearanceProperty("icon-image"),D=h.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!I&&!P&&!L)return;const B=i.iconDependencies,V=i.glyphDependencies,G=i.availableImages,K=new Li(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),Z=ee=>{const ne=ee.id.toString();B.has(ne)?B.get(ne).push(ee):B.set(ne,[ee])};for(const ee of e){const{feature:ne,id:ae,index:be,sourceLayerIndex:he}=ee,Ee=u._featureFilter.needGeometry,Ce=ue(ne,Ee);if(!u._featureFilter.filter(K,Ce,o))continue;if(Ee||(Ce.geometry=ie(ne,o,a)),f&&ne.type!==1&&o.z<=5){const Le=Ce.geometry,Ze=.98078528056,je=(dt,Qe)=>fr(hd(dt.x,dt.y,o,1),hd(Qe.x,Qe.y,o,1))<Ze;for(let dt=0;dt<Le.length;dt++)Le[dt]=Y(Le[dt],je)}let Pe,Fe;if(I){const Le=u.getValueAndResolveTokens("text-field",Ce,o,G),Ze=mn.factory(Le);Bb(Ze)&&(this.hasRTLText=!0),(!this.hasRTLText||$l()==="unavailable"||this.hasRTLText&&is.isParsed())&&(Pe=X1(Ze,u,Ce))}if(P){const Le=u.getValueAndResolveTokens("icon-image",Ce,o,G);Fe=this.getResolvedImageFromTokens(Le)}const Be=this.layers[0];let ze=!1;if(!Fe&&L){const Le=Be.getAppearances();for(const Ze of Le)if(Ze.getProperty("icon-image")){const je=Be.getAppearanceValueAndResolveTokens(Ze,"icon-image",Ce,o,G);if(je){Fe=this.getResolvedImageFromTokens(je),ze=!0;break}}}if(!Pe&&!Fe)continue;const De=this.sortFeaturesByKey?D.evaluate(Ce,{},o):void 0,Se={id:ae,text:Pe,icon:Fe,index:be,sourceLayerIndex:he,geometry:Ce.geometry,properties:ne.properties,type:Fb[ne.type],sortKey:De};if(this.features.push(Se),this.featureToAppearanceIndex[be]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:ae,properties:ne.properties,usesAppearanceIconAsPlaceholder:ze,isUsingAppearanceVertexData:!1,layoutBasedVertexData:[],activeAppearance:null}),Fe){const Le=Be._unevaluatedLayout._values,{iconPrimary:Ze,iconSecondary:je}=Ld(Fe,this.iconSizeData,Le["icon-size"],o,this.zoom,Se,this.pixelRatio,E,this.worldview);Z(Ze),je&&(this.hasAnySecondaryIcon=!0,Z(je))}const we=Be.getAppearances();if(we.length!==0&&we.forEach((Le=>{if(!Le.getProperty("icon-image"))return;
7const Ze=this.getCombinedIconPrimary(Le,Be,Ce,o,G,Se,E);Ze&&Z(Ze)})),Pe){const Le=_.evaluate(Ce,{},o).join(","),Ze=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf($n.vertical)>=0;for(const je of Pe.sections)if(je.image){const dt=je.image.getPrimary().scaleSelf(this.pixelRatio),Qe=dt.id.toString(),rt=B.get(Qe)||[];rt.push(dt),B.set(Qe,rt)}else{const dt=Hl(Pe.toString()),Qe=je.fontStack||Le,rt=V[Qe]=V[Qe]||{};this.calculateGlyphDependencies(je.text,rt,Ze,this.allowVerticalPlacement,dt)}}}if(h.get("symbol-placement")==="line"&&(this.features=(function(ee){const ne={},ae={},be=[];let he=0;function Ee(Be){be.push(ee[Be]),he++}function Ce(Be,ze,De){const Se=ae[Be];return delete ae[Be],ae[ze]=Se,be[Se].geometry[0].pop(),be[Se].geometry[0]=be[Se].geometry[0].concat(De[0]),Se}function Pe(Be,ze,De){const Se=ne[ze];return delete ne[ze],ne[Be]=Se,be[Se].geometry[0].shift(),be[Se].geometry[0]=De[0].concat(be[Se].geometry[0]),Se}function Fe(Be,ze,De){const Se=De?ze[0][ze[0].length-1]:ze[0][0];return`${Be}:${Se.x}:${Se.y}`}for(let Be=0;Be<ee.length;Be++){const ze=ee[Be],De=ze.geometry,Se=ze.text?ze.text.toString():null;if(!Se){Ee(Be);continue}const we=Fe(Se,De),Le=Fe(Se,De,!0);if(we in ae&&Le in ne&&ae[we]!==ne[Le]){const Ze=Pe(we,Le,De),je=Ce(we,Le,be[Ze].geometry);delete ne[we],delete ae[Le],ae[Fe(Se,be[je].geometry,!0)]=je,be[Ze].geometry=null}else we in ae?Ce(we,Le,De):Le in ne?Pe(we,Le,De):(Ee(Be),ne[we]=he-1,ae[Le]=he-1)}return be.filter((Be=>Be.geometry))})(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const ee of i.elevationFeatures)this.elevationFeatureIdToIndex.set(ee.id,this.elevationFeatures.length),this.elevationFeatures.push(ee)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort(((ee,ne)=>ee.sortKey-ne.sortKey))}getCombinedIconPrimary(e,i,o,a,u,h,f){let _,y;const v=e.getUnevaluatedProperties();if(v._values["icon-image"].value!==void 0){const b=i.getAppearanceValueAndResolveTokens(e,"icon-image",o,a,u);_=this.getResolvedImageFromTokens(b)}else{const b=i.getValueAndResolveTokens("icon-image",o,a,u);_=this.getResolvedImageFromTokens(b)}if(_){const b=v._values["icon-size"]||i._unevaluatedLayout._values["icon-size"];y=Ld(_,Hu(this.zoom,b,this.worldview),b,a,this.zoom,h,this.pixelRatio,f,this.worldview).iconPrimary}return y}updateAppearanceBasedIconTextures(e,i,o,a){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const u=this.layers[0];let h=!1,f=0;const _=u.layout,[y,v]=_.get("icon-size-scale-range"),b=O(1,y,v);for(let T=0;T<this.symbolInstances.length;T++){const E=this.symbolInstances.get(T),I=this.featureToAppearanceIndex[E.featureIndex],P=I!==void 0?this.appearanceFeatureData[I]:void 0;if(P&&E.placedIconSymbolIndex>=0){const L=P.id,D=i&&L!==void 0?i[String(L)]:void 0,B={type:"Point",id:P.id,properties:P.properties,geometry:[]},V=this.layers[0].appearances&&this.layers[0].appearances.find((G=>G.isActive({globals:a,feature:B,canonical:e,featureState:D})));if(P.activeAppearance===V){f+=E.numIconVertices;continue}if(V){P.activeAppearance=V;const G=this.getCombinedIconPrimary(V,u,B,e,o,{sortKey:void 0,text:void 0,icon:null,index:E.featureIndex,sourceLayerIndex:E.featureIndex,geometry:[],properties:P.properties,type:"Point",id:P.id},b);if(!G)continue;const K=G.toString(),Z=this.iconAtlasPositions&&this.iconAtlasPositions.get(K);if(Z){const ee=u.getAppearanceValueAndResolveTokens(V,"icon-offset",B,e,o),ne=ee&&Array.isArray(ee)?ee:[0,0];let ae=Mp(Z,void 0,ne,u.layout.get("icon-anchor").evaluate(B,{},e));const be=u.getAppearanceValueAndResolveTokens(V,"icon-rotate",B,e,o),he=typeof be=="number"?be:0,Ee=Z.sdf,Ce=u.layout.get("icon-text-fit").constantOr("none");Ce!=="none"&&P.textShaping&&P.iconTextFitPadding&&P.fontScale&&(ae=I_(ae,P.textShaping,Ce,P.iconTextFitPadding,ne,P.fontScale));
7const Pe=this.calculateEffectiveAppearanceIconSize(V,a.zoom,B,e,o,b),Fe=0,Be=1+(Math.min(Aa,Math.round(Pe*ds))<<1),ze=P_(ae,he,Ee,Ce!=="none",b);P.isUsingAppearanceVertexData||(P.isUsingAppearanceVertexData=!0,P.layoutBasedVertexData=this.icon.getIconVertexData(f,E.numIconVertices));for(let Se=0;Se<ze.length;++Se){const we=ze[Se],Le=P.layoutBasedVertexData[0]||E.tileAnchorX,Ze=P.layoutBasedVertexData[1]||E.tileAnchorY,je=16*we.pixelOffsetTL.x,dt=16*we.pixelOffsetTL.y,Qe=16*we.pixelOffsetBR.x,rt=16*we.pixelOffsetBR.y,at=16*we.minFontScaleX,Ut=16*we.minFontScaleY;this.icon.updateIconVertexData(f,Le,Ze,Math.round(32*we.tl.x),Math.round(32*we.tl.y),we.texPrimary.x,we.texPrimary.y,Fe,Be,je,dt,at,Ut),this.icon.updateIconVertexData(f+1,Le,Ze,Math.round(32*we.tr.x),Math.round(32*we.tr.y),we.texPrimary.x+we.texPrimary.w,we.texPrimary.y,Fe,Be,Qe,dt,at,Ut),this.icon.updateIconVertexData(f+2,Le,Ze,Math.round(32*we.bl.x),Math.round(32*we.bl.y),we.texPrimary.x,we.texPrimary.y+we.texPrimary.h,Fe,Be,je,rt,at,Ut),this.icon.updateIconVertexData(f+3,Le,Ze,Math.round(32*we.br.x),Math.round(32*we.br.y),we.texPrimary.x+we.texPrimary.w,we.texPrimary.y+we.texPrimary.h,Fe,Be,Qe,rt,at,Ut),f+=4}const De=E.numIconVertices-4*ze.length;for(let Se=0;Se<De;++Se)this.icon.updateIconVertexData(f+Se,0,0,0,0,0,0,0,0,0,0,0,0);h=!0}else f+=E.numIconVertices}else if(P.usesAppearanceIconAsPlaceholder)this.layers[0].appearances&&this.layers[0].appearances.length>0&&(this.icon.updateIconVertexData(f,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(f+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(f+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(f+3,0,0,0,0,0,0,0,0,0,0,0,0),h=!0),f+=E.numIconVertices,P.activeAppearance=null;else if(P.isUsingAppearanceVertexData){const K=P.layoutBasedVertexData.length/12;for(let Z=0;Z<K;++Z){const ee=Z*12;this.icon.updateIconVertexData(f+Z,P.layoutBasedVertexData[ee+0],P.layoutBasedVertexData[ee+1],P.layoutBasedVertexData[ee+2],P.layoutBasedVertexData[ee+3],P.layoutBasedVertexData[ee+4],P.layoutBasedVertexData[ee+5],P.layoutBasedVertexData[ee+6],P.layoutBasedVertexData[ee+7],P.layoutBasedVertexData[ee+8],P.layoutBasedVertexData[ee+9],P.layoutBasedVertexData[ee+10],P.layoutBasedVertexData[ee+11])}f+=K,P.isUsingAppearanceVertexData=!1,P.activeAppearance=null,h=!0}else f+=E.numIconVertices,P.activeAppearance=null}}return h}update(e,i,o,a,u,h,f){this.text.programConfigurations.updatePaintArrays(e,i,u,o,a,h,f,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,u,o,a,h,f,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const o=F(e),a=1/o;let u=!1,h=!1;for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f),y=nr(1,0,0),v=nr(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:T,numIconVertices:E,numVerticalIconVertices:I}=_,P=b>0||T>0,L=E>0,D=this.elevationFeatures[_.elevationFeatureIndex];if(D){const B=new Oe(_.tileAnchorX,_.tileAnchorY),V=.075+D.pointElevation(B);_.zOffset!==V&&(i=!0,_.zOffset=V),V!==0&&(this.hasAnyZOffset=!0);const G=D.computeSlopeNormal(B,a),K=za(Ho(),nr(0,0,1),G);vs(y,y,K),vs(v,v,K),y[2]*=o,v[2]*=o,y[0]===1&&y[1]===0&&y[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(u=u||P,h=h||L)}if(P&&(kp(this.text.orientationVertexArray,b,y,v),kp(this.text.orientationVertexArray,T,y,v)),L){const{placedIconSymbolIndex:B,verticalPlacedIconSymbolIndex:V}=_;B>=0&&kp(this.icon.orientationVertexArray,E,y,v),V>=0&&kp(this.icon.orientationVertexArray,I,y,v)}}u||(this.text.orientationVertexArray=void 0),h||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(u,h,f)=>{o+=h,o>u.length&&u.resize(o);for(let _=-h;_<0;_++)u.emplace(_+o,f)},i=(u,h,f)=>{a+=h,a>u.length&&u.resize(a);for(let _=-h;_<0;_++)u.emplace(_+a,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let o=0,a=0;for(let u=0;u<this.symbolInstances.length;u++){const h=this.symbolInstances.get(u),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:_,numIconVertices:y}=h,v=h.zOffset,b=y>0;if((f>0||_>0)&&(e(this.text.zOffsetVertexArray,f,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:T,verticalPlacedIconSymbolIndex:E}=h;T>=0&&i(this.icon.zOffsetVertexArray,y,v),E>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,v)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,i,o,a,u){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some((
vendor: 9,924 bytes, line 7
7h=>h.appearances&&h.appearances.length>0))),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,i,o,a){return!!(e&&i&&o)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(e,i,o,a)&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Lx(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const o=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:u}of i)this.lineVertexArray.emplaceBack(a,u);return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,i,o,a,u,h,f,_,y,v,b,T,E,I,P,L,D,B){const V=e.indexArray,G=e.layoutVertexArray,K=e.globeExtVertexArray,Z=e.segments.prepareSegment(4*B,G,V,this.canOverlap?h.sortKey:void 0),ee=this.glyphOffsetArray.length,ne=Z.vertexLength,ae=this.allowVerticalPlacement&&f===$n.vertical?Math.PI/2:0,be=h.text&&h.text.sections;for(let Ce=0;Ce<i.length;Ce++){const{tl:Pe,tr:Fe,bl:Be,br:ze,texPrimary:De,texSecondary:Se,pixelOffsetTL:we,pixelOffsetBR:Le,minFontScaleX:Ze,minFontScaleY:je,glyphOffset:dt,isSDF:Qe,sectionIndex:rt}=i[Ce],at=Z.vertexLength,Ut=dt[1];if(Ud(G,y.x,y.y,Pe.x,Ut+Pe.y,De.x,De.y,o,Qe,we.x,we.y,Ze,je),Ud(G,y.x,y.y,Fe.x,Ut+Fe.y,De.x+De.w,De.y,o,Qe,Le.x,we.y,Ze,je),Ud(G,y.x,y.y,Be.x,Ut+Be.y,De.x,De.y+De.h,o,Qe,we.x,Le.y,Ze,je),Ud(G,y.x,y.y,ze.x,Ut+ze.y,De.x+De.w,De.y+De.h,o,Qe,Le.x,Le.y,Ze,je),_){const{x:Ge,y:lt,z:It}=_.anchor,[Zt,Xt,Rt]=_.up;Gd(K,Ge,lt,It,Zt,Xt,Rt),Gd(K,Ge,lt,It,Zt,Xt,Rt),Gd(K,Ge,lt,It,Zt,Xt,Rt),Gd(K,Ge,lt,It,Zt,Xt,Rt),Xu(e.dynamicLayoutVertexArray,Ge,lt,It,ae)}else Xu(e.dynamicLayoutVertexArray,y.x,y.y,y.z,ae);if(L){const Ge=Se||De;jd(e.iconTransitioningVertexArray,Ge.x,Ge.y),jd(e.iconTransitioningVertexArray,Ge.x+Ge.w,Ge.y),jd(e.iconTransitioningVertexArray,Ge.x,Ge.y+Ge.h),jd(e.iconTransitioningVertexArray,Ge.x+Ge.w,Ge.y+Ge.h)}V.emplaceBack(at,at+1,at+2),V.emplaceBack(at+1,at+2,at+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(dt[0]),Ce!==i.length-1&&rt===i[Ce+1].sectionIndex||e.programConfigurations.populatePaintArrays(G.length,h,h.index,{},E,I,P,be&&be[rt],this.worldview)}const he=B-i.length;he!==0&&this._addNullVertices(he,G,o,_,K,e,L,Z,V);const Ee=_?_.anchor:y;e.placedSymbolArray.emplaceBack(Ee.x,Ee.y,Ee.z,y.x,y.y,ee,this.glyphOffsetArray.length-ee,ne,v,b,y.segment,o?o[0]:0,o?o[1]:0,a[0],a[1],f,0,0,0,T,0),e.symbolInstanceIndices.push(D)}_addNullVertices(e,i,o,a,u,h,f,_,y){for(let v=0;v<e;v++){for(let T=0;T<4;T++)Ud(i,0,0,0,0,0,0,o,!1,0,0,0,0),a&&Gd(u,0,0,0,0,0,0),Xu(h.dynamicLayoutVertexArray,0,0,0,0),f&&jd(h.iconTransitioningVertexArray,0,0);const b=_.vertexLength;y.emplaceBack(b,b+1,b+2),y.emplaceBack(b+1,b+2,b+3),_.vertexLength+=4,_.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,i,o,a,u,h,f){e.emplaceBack(i,o,a,u,h,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,o,a,u,h,f){const _=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),y=_.vertexLength,v=f.tileAnchorX,b=f.tileAnchorY;for(let E=0;E<4;E++)o.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(o.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(o.layoutVertexArray,a,u,h,v,b,new Oe(e.x1,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,u,h,v,b,new Oe(e.x2,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,u,h,v,b,new Oe(e.x2,e.y2)),this._commitLayoutVertex(o.layoutVertexArray,a,u,h,v,b,new Oe(e.x1,e.y2)),_.vertexLength+=4;const T=o.indexArray;T.emplaceBack(y,y+1),T.emplaceBack(y+1,y+2),T.emplaceBack(y+2,y+3),T.emplaceBack(y+3,y),_.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,o,a,u,h){for(let f=a;f<u;f++){const _=o.get(f),y=this.getSymbolInstanceTextSize(e,h,i,f);this._addCollisionDebugVertices(_,y,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,o,a,u,h){for(let f=a;f<u;f++){const _=o.get(f),y=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(_,y,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,o){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new O_(vu,Jy.members,Gn),this.iconCollisionBox=new O_(vu,Jy.members,Gn);const a=qu(this.iconSizeData,e),u=qu(this.textSizeData,e,o);for(let h=0;h<this.symbolInstances.length;h++){const f=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(u,e,i,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(u,e,i,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,i,o,a){const u=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),h=A_(this.textSizeData,e,u)/Br;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,o){const a=this.icon.placedSymbolArray.get(o),u=A_(this.iconSizeData,e,a);return this.tilePixelRatio*u}_commitDebugCollisionVertexUpdate(e,i,o,a){e.emplaceBack(i,-o,-o,a),e.emplaceBack(i,o,-o,a),e.emplaceBack(i,o,o,a),e.emplaceBack(i,-o,o,a)}_updateTextDebugCollisionBoxes(e,i,o,a,u,h,f){for(let _=a;_<u;_++){const y=o.get(_),v=this.getSymbolInstanceTextSize(e,h,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,y.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,o,a,u,h,f){for(let _=a;_<u;_++){const y=o.get(_),v=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,y.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,o,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const u=qu(this.iconSizeData,e,a),h=qu(this.textSizeData,e,o);for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(h,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,o),this._updateTextDebugCollisionBoxes(h,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,o),this._updateIconDebugCollisionBoxes(u,e,i,_.iconBoxStartIndex,_.iconBoxEndIndex,_,a),this._updateIconDebugCollisionBoxes(u,e,i,_.verticalIconBoxStartIndex,_.verticalIconBoxEndIndex,_,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,o,a,u,h,f,_,y){const v={};if(i<o){const{x1:b,y1:T,x2:E,y2:I,padding:P,projectedAnchorX:L,projectedAnchorY:D,projectedAnchorZ:B,tileAnchorX:V,tileAnchorY:G,featureIndex:K}=e.get(i);v.textBox={x1:b,y1:T,x2:E,y2:I,padding:P,projectedAnchorX:L,projectedAnchorY:D,projectedAnchorZ:B,tileAnchorX:V,tileAnchorY:G},v.textFeatureIndex=K}if(a<u){const{x1:b,y1:T,x2:E,y2:I,padding:P,projectedAnchorX:L,projectedAnchorY:D,projectedAnchorZ:B,tileAnchorX:V,tileAnchorY:G,featureIndex:K}=e.get(a);v.verticalTextBox={x1:b,y1:T,x2:E,y2:I,padding:P,projectedAnchorX:L,projectedAnchorY:D,projectedAnchorZ:B,tileAnchorX:V,tileAnchorY:G},v.verticalTextFeatureIndex=K}if(h<f){const{x1:b,y1:T,x2:E,y2:I,padding:P,projectedAnchorX:L,projectedAnchorY:D,projectedAnchorZ:B,tileAnchorX:V,tileAnchorY:G,featureIndex:K}=e.get(h);v.iconBox={x1:b,y1:T,x2:E,y2:I,padding:P,projectedAnchorX:L,projectedAnchorY:D,projectedAnchorZ:B,tileAnchorX:V,tileAnchorY:G},v.iconFeatureIndex=K}if(_<y){const{x1:b,y1:T,x2:E,y2:I,padding:P,projectedAnchorX:L,projectedAnchorY:D,projectedAnchorZ:B,tileAnchorX:V,tileAnchorY:G,featureIndex:K}=e.get(_);v.verticalIconBox={x1:b,y1:T,x2:E,y2:I,padding:P,projectedAnchorX:L,projectedAnchorY:D,projectedAnchorZ:B,tileAnchorX:V,tileAnchorY:G},v.verticalIconFeatureIndex=K}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const o=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.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 o=e.placedSymbolArray.get(i),a=o.vertexStartIndex+4*o.numGlyphs;for(let u=o.vertexStartIndex;
7u<a;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),o=Math.cos(e),a=[],u=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const _=this.symbolInstances.get(f);a.push(0|Math.round(i*_.tileAnchorX+o*_.tileAnchorY)),u.push(_.featureIndex)}return h.sort(((f,_)=>a[f]-a[_]||u[_]-u[f])),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort(((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset))}addToSortKeyRanges(e,i){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===i?o.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 o=this.symbolInstances.get(i);this.featureSortOrder.push(o.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:u,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:y}=o;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),u>=0&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),h>=0&&h!==u&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_),y>=0&&this.addIndicesForPlacedSymbol(this.icon,y)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(e){const i=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let o;return this.elevationFeatures&&i<this.elevationFeatures.length&&(o=this.elevationFeatures[i]),o}}function Ox(r,e){return e.replace(/{([^{}]+)}/g,((i,o)=>o in r?String(r[o]):""))}let Fx,kx,F_;ot(Bp,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),Bp.addDynamicAttributes=Xu;class Bx{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:mo,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}}ot(Bx,"FormatSectionOverride",{omit:["defaultValue"]});const k_=()=>F_||(F_={layout:Fx||(Fx=new sr({"symbol-placement":new He(fe.layout_symbol["symbol-placement"]),"symbol-spacing":new He(fe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new He(fe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Xe(fe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new He(fe.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new He(fe.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new He(fe.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new He(fe.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new He(fe.layout_symbol["icon-ignore-placement"]),"icon-optional":new He(fe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new He(fe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Xe(fe.layout_symbol["icon-size"]),"icon-size-scale-range":new He(fe.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Xe(fe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Xe(fe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Xe(fe.layout_symbol["icon-image"]),"icon-image-use-theme":new He({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Xe(fe.layout_symbol["icon-rotate"]),"icon-padding":new He(fe.layout_symbol["icon-padding"]),"icon-keep-upright":new He(fe.layout_symbol["icon-keep-upright"]),"icon-offset":new Xe(fe.layout_symbol["icon-offset"]),"icon-anchor":new Xe(fe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new He(fe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new He(fe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new He(fe.layout_symbol["text-rotation-alignment"]),"text-field":new Xe(fe.layout_symbol["text-field"]),"text-font":new Xe(fe.layout_symbol["text-font"]),"text-size":new Xe(fe.layout_symbol["text-size"]),"text-size-scale-range":new He(fe.layout_symbol["text-size-scale-range"]),"text-max-width":new Xe(fe.layout_symbol["text-max-width"]),"text-line-height":new Xe(fe.layout_symbol["text-line-height"]),"text-letter-spacing":new Xe(fe.layout_symbol["text-letter-spacing"]),"text-justify":new Xe(fe.layout_symbol["text-justify"]),"text-radial-offset":new Xe(fe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new He(fe.layout_symbol["text-variable-anchor"]),"text-anchor":new Xe(fe.layout_symbol["text-anchor"]),"text-max-angle":new He(fe.layout_symbol["text-max-angle"]),"text-writing-mode":new He(fe.layout_symbol["text-writing-mode"]),"text-rotate":new Xe(fe.layout_symbol["text-rotate"]),"text-padding":new He(fe.layout_symbol["text-padding"]),"text-keep-upright":new He(fe.layout_symbol["text-keep-upright"]),"text-transform":new Xe(fe.layout_symbol["text-transform"]),"text-offset":new Xe(fe.layout_symbol["text-offset"]),"text-allow-overlap":new He(fe.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new He(fe.layout_symbol["text-ignore-placement"]),"text-optional":new He(fe.layout_symbol["text-optional"]),visibility:new He(fe.layout_symbol.visibility)})),paint:kx||(kx=new sr({"icon-opacity":new Xe(fe.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Xe(fe.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Xe(fe.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Xe(fe.paint_symbol["text-emissive-strength"]),"icon-color":new Xe(fe.paint_symbol["icon-color"]),"icon-halo-color":new Xe(fe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Xe(fe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Xe(fe.paint_symbol["icon-halo-blur"]),"icon-translate":new He(fe.paint_symbol["icon-translate"]),"icon-translate-anchor":new He(fe.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new He(fe.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Xe(fe.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Xe(fe.paint_symbol["text-occlusion-opacity"]),"text-color":new Xe(fe.paint_symbol["text-color"],{runtimeType:In,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Xe(fe.paint_symbol["text-halo-color"]),"text-halo-width":new Xe(fe.paint_symbol["text-halo-width"]),"text-halo-blur":new Xe(fe.paint_symbol["text-halo-blur"]),"text-translate":new He(fe.paint_symbol["text-translate"]),"text-translate-anchor":new He(fe.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new He(fe.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new He(fe.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new He(fe.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new He(fe.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Xe(fe.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},F_);class Np extends xn{constructor(e,i,o,a){super(e,k_(),i,o,a,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=Ni([]),this.hasOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){e!=="icon-occlusion-opacity"&&e!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,i){super.recalculate(e,i),this.appearances&&this.appearances.forEac
7h((a=>{a.recalculate(e,i,this.iconImageUseTheme)})),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const o=this.layout.get("text-writing-mode");if(o){const a=[];for(const u of o)a.indexOf(u)<0&&a.push(u);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,o,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===o&&this._brightnessMax===a||(this._colorAdjustmentMatrix=(function(u,h,f,_){u=er(u),h=ii(h);const y=lo(),v=u/3,b=1-2*v,T=[b,v,v,0,v,b,v,0,v,v,b,0,0,0,0,1],E=.5-.5*h,I=_-f;return Gi(y,[I,0,0,0,0,I,0,0,0,0,I,0,f,f,f,1],[h,0,0,0,0,h,0,0,0,0,h,0,E,E,E,1]),Gi(y,y,T),y})(e,i,o,a),this._saturation=e,this._contrast=i,this._brightnessMin=o,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,o,a){const u=this.layout.get(e).evaluate(i,{},o,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||jl(h.value)||!u?u:Ox(i.properties,u)}getAppearanceValueAndResolveTokens(e,i,o,a,u){const h=e.getProperty(i);if(!h)return;const f=h.evaluate(o,{},a,u),_=e.getUnevaluatedProperties()._values[i];return _.isDataDriven()||jl(_.value)||!f||typeof f!="string"?f:Ox(o.properties,f)}createBucket(e){return new Bp(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of k_().paint.overridableProperties){if(!Np.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),o=new Bx(i),a=new iu(o,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new Wa("source",a):new pa("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new _a(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,o){return!(!this.layout||i.isDataDriven()||o.isDataDriven())&&Np.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const o=e.get("text-field"),a=k_().paint.properties[i];let u=!1;const h=f=>{for(const _ of f)if(a.overrides&&a.overrides.hasOverride(_))return void(u=!0)};if(o.value.kind==="constant"&&o.value.value instanceof mn)h(o.value.value.sections);else if(o.value.kind==="source"){const f=y=>{u||(y instanceof Yo&&kr(y.value)===Al?h(y.value.sections):y instanceof zo?h(y.sections):y.eachChild(f))},_=o.value;_._styleExpression&&f(_._styleExpression.expression)}return u}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,o){return{config:new Us(this,{zoom:i,lut:o}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let Nx,Vx,Ux,jx;var B_=jt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function Vp(r,e,i,o,a,u,h,f){const _=[r,e,1,i,o,1,a,u,1],y=[h,f,1],v=ao([],_),[b,T,E]=xs(y,y,v);return rr(_,_,[b,0,0,0,T,0,0,0,E])}function Gx(r,e,i,o,a,u,h,f){const _=(function(y,v,b,T,E,I,P,L){const D=Vp(0,0,1,0,1,1,0,1),B=Vp(y,v,b,T,E,I,P,L);return rr(B,B,ao([],D))})(r,e,i,o,a,u,h,f);return[_[2]/_[8]/$e,_[5]/_[8]/$e]}function Up(r){return[r[0],Math.min(Math.max(r[1],-C),C)]}class Hx extends la{constructor(e,i,o,a){super(),this.id=e,this.dispatcher=o,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 Po("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Tc(this.map._requestManager.transformRequest(this.url,vl.Image),((o,a)=>{this._imageRequest=null,this._loaded=!0,o?this.fire(new Sl(o)):a&&(this.image=a instanceof HTMLImageElement?Fr.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 Ad(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 Po("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 Ad||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],o=e[0][1];for(const u of e)u[1]>o&&(o=u[1]),u[1]<i&&(i=u[1]);const a=(o+i)/2;if(a>C?this.onNorthPole=!0:a<-C&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const u=e.map(U.fromLngLat);this.tileID=(function(h){let f=1/0,_=1/0,y=-1/0,v=-1/0;for(const P of h)f=Math.min(f,P.x),_=Math.min(_,P.y),y=Math.max(y,P.x),v=Math.max(v,P.y);const b=Math.max(y-f,v-_),T=Math.max(0,Math.floor(-Math.log2(b))),E=Math.pow(2,T);let I=Math.floor((f+y)/2*E);return I>1&&(I-=1),new Mi(T,I,Math.floor((_+v)/2*E))})(u),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Po("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Ad||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const D in this.tiles){const B=this.tiles[D];B.state!=="loaded"&&(B.state="loaded",B.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Fd(new Mi(0,0,0),this.map.transform.projection),o=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!(function(D){const B=D[1].x-D[0].x,V=D[1].y-D[0].y,G=D[2].x-D[1].x,K=D[2].y-D[1].y,Z=D[3].x-D[2].x,ee=D[3].y-D[2].y,ne=D[0].x-D[3].x,ae=D[0].y-D[3].y,be=B*K-G*V,he=G*ee-Z*K,Ee=Z*ae-ne*ee,Ce=ne*V-B*ae;return be>0&&he>0&&Ee>0&&Ce>0||be<0&&he<0&&Ee<0&&Ce<0})(o))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=Fd(this.tileID,this.map.transform.projection),[u,h,f,_]=this.coordinates.map((D=>{const B=a.projection.project(D[0],D[1]);return Cx(a,B)._round()}));this.perspectiveTransform=Gx(u.x,u.y,h.x,h.y,f.x,f.y,_.x,_.y);const y=this._boundsArray=new Ja;y.emplaceBack(u.x,u.y,0,0),y.emplaceBack(h.x,h.y,$e,0),y.emplaceBack(_.x,_.y,0,$e),y.emplaceBack(f.x,f.y,$e,$e),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(y,B_.members),this.boundsSegments=Wi.simpleSegment(0,0,4,2);const v=[],b=[Up((T=this.coordinates)[0]),Up(T[1]),Up(T[2]),Up(T[3])];var T;const[E,I,P,L]=(function(D){let B=D[0][0],V=B,G=D[0][1],K=G;for(let Z=1;Z<D.length;Z++)D[Z][0]<B?B=D[Z][0]:D[Z][0]>V&&(V=D[Z][0]),D[Z][1]<G?G=D[Z][1]:D[Z][1]>K&&(K=D[Z][1]);return[B,G,V-B,K-G]})(b);{const D=new Ja,[B,V,G,K]=(function(ze){let De=ze[0].x,Se=De,we=ze[0].y,Le=we;for(let Ze=1;Ze<ze.length;Ze++)ze[Ze].x<De?De=ze[Ze].x:ze[Ze].x>Se&&(Se=ze[Ze].x),ze[Ze].y<we?we=ze[Ze].y:ze[Ze].y>Le&&(Le=ze[Ze].y);return[De,we,Se-De,Le-we]})(o),Z=ze=>[(ze.x-B)/G,(ze.y-V)/K],[ee,ne,ae,be]=o.map(Z),he=(function(ze,De,Se,we,Le,Ze,je,dt){const Qe=Vp(0,0,1,0,1,1,0,1);return rr(Qe,Qe,ao([],Vp(ze,De,Se,we,Le,Ze,je,dt)))})(ee[0],ee[1],ne[0],ne[1],ae[0],ae[1],be[0],be[1]);this.elevatedGlobePerspectiveTransform=Gx(ee[0],ee[1],ne[0],ne[1],ae[0],ae[1],be[0],be[1]);const Ee=(ze,De)=>{v.push(ze.lng);const Se=Math.round((ze.lng-E)/P*$e),we=Math.round((ze.lat-I)/L*$e),Le=Z(De),Ze=xs([],[Le[0],Le[1],1],he),je=Math.round(Ze[0]/Ze[2]*$e),dt=Math.round(Ze[1]/Ze[2]*$e);D.emplaceBack(Se,we,je,dt)},Ce=o[3].x-o[0].x,Pe=o[3].y-o[0].y,Fe=o[2].x-o[1].x,Be=o[2].y-o[1].y;for(let ze=0;ze<65;ze++){const De=ze/64,Se=[o[0].x+De*Ce,o[0].y+De*Pe],we=[o[1].x+De*Fe,o[1].y+De*Be],Le=we[0]-Se[0],Ze=we[1]-Se[1];for(let je=0;je<65;je++){const dt=je/64,Qe={x:Se[0]+Le*dt,y:Se[1]+Ze*dt};Ee(i.projection.unproject(Qe.x,Qe.y),Qe)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(D,B_.members)}{this.maxLongitudeTriangleSize=0;let D=[],B=new Ar;const V=(G,K,Z)=>{B.emplaceBack(G,K,Z);const ee=v[G],ne=v[K],ae=v[Z],be=Math.min(Math.min(ee,ne),ae),he=Math.max(Math.max(ee,ne),ae)-be;he>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=he),D.push(be+he/2)};for(let G=0;G<64;G++)for(let K=0;K<64;K++){const Z=65*G+K,ee=Z+1,ne=Z+65,ae=ne+1;V(Z,ne,ee),V(ee,ne,ae)}[D,B]=(function(G,K){const Z=Array.from({length:G.length},((ae,be)=>be));Z.sort(((ae,be)=>G[ae]-G[be]));const ee=[],ne=new Ar;for(let ae=0;ae<Z.length;ae++){const be=Z[ae];ee.push(G[be]);const he=3*be,Ee=he+1;ne.emplaceBack(K.uint16[he],K.uint16[Ee],K.uint16[Ee+1])}return[ee,ne]})(D,B),this.elevatedGlobeTrianglesCenterLongitudes=D,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(
7B)}this.elevatedGlobeSegments=Wi.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,P/$e,0,L/$e,0,0,I,E,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,o=i.gl;!this._dirty||this.texture instanceof Ad||(this.texture?this.texture.update(this.image):(this.texture=new c_(i,this.image,o.RGBA8),this.texture.bind(o.LINEAR,o.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 o=this.elevatedGlobeTrianglesCenterLongitudes;let a=(u=e+180)+360*Math.round((o[0]-u)/360);var u;const h=new Wi,f=(b,T)=>{h.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:T,sortKey:void 0,vaos:{}})},_=.51*this.maxLongitudeTriangleSize;if(Math.abs(o[0]-a)<=_){const b=Qi(o,0,o.length,a+_);return b===o.length||f(b,Er(o,b+1,o.length,a+360-_)-b),h}a<o[0]&&(a+=360);const y=Er(o,0,o.length,a-_);if(y===o.length)return f(0,o.length),h;f(0,y-0);const v=Qi(o,y+1,o.length,a+_);return v!==o.length&&f(v,o.length-v),h}}const Nb=(Math.pow(256,2)-1)/16907520;class qx extends xn{constructor(e,i,o,a){super(e,{layout:Ux||(Ux=new sr({visibility:new He(fe.layout_raster.visibility)})),paint:jx||(jx=new sr({"raster-opacity":new He(fe.paint_raster["raster-opacity"]),"raster-color":new ya(fe.paint_raster["raster-color"]),"raster-color-mix":new He(fe.paint_raster["raster-color-mix"]),"raster-color-range":new He(fe.paint_raster["raster-color-range"]),"raster-hue-rotate":new He(fe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new He(fe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new He(fe.paint_raster["raster-brightness-max"]),"raster-saturation":new He(fe.paint_raster["raster-saturation"]),"raster-contrast":new He(fe.paint_raster["raster-contrast"]),"raster-resampling":new He(fe.paint_raster["raster-resampling"]),"raster-fade-duration":new He(fe.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new He(fe.paint_raster["raster-emissive-strength"]),"raster-array-band":new He(fe.paint_raster["raster-array-band"]),"raster-elevation":new He(fe.paint_raster["raster-elevation"]),"raster-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},i,o,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 Hx&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[o,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(o)&&isNaN(a)||o===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=dd({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:o,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[o,a])}}let $x,Zx,Wx,Xx,Yx;class Kx extends xn{constructor(e,i,o,a){super(e,{layout:$x||($x=new sr({visibility:new He(fe["layout_raster-particle"].visibility)})),paint:Zx||(Zx=new sr({"raster-particle-array-band":new He(fe["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new He(fe["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new ya(fe["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new He(fe["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new He(fe["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new He(fe["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new He(fe["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new He(fe["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),this._updateColorRamp(),this.lastInvalidatedAt=Fr.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=dd({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}
7_invalidateAnimationState(){this.lastInvalidatedAt=Fr.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Vb extends xn{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 N_(r,e,i){const o=[0,0,1],a=Ra([]);return qo(a,a,i?-oi(r)+Math.PI:oi(r)),co(a,a,-oi(e)),vs(o,o,a),Bi(o,o)}const Jx={None:0,Model:1,Symbol:2,FillExtrusion:4};class jp{constructor(e,i,o,a){this.message=(e?`${e}: `:"")+o,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function V_(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class Qx{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 ev{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new td,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const i=16*e,o=this.instancedDataArray.float32;let a=Math.floor(o[i+2]);const u=1.05*(o[i+2]-a);return a/=100,[o[i]%1*1.05,o[i+1]%1*1.05,u,a]}tileCoordinatesForInstance(e){const i=16*e,o=this.instancedDataArray.float32;let a=o[i+0];return a=a>$e?a-$e:a,new Oe(Math.trunc(a),Math.trunc(o[i+1]))}translationForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+4],o[i+5],o[i+6]]}rotationScaleForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+7],o[i+8],o[i+9],o[i+10],o[i+11],o[i+12],o[i+13],o[i+14],o[i+15]]}transformForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+7],o[i+8],o[i+9],o[i+4],o[i+10],o[i+11],o[i+12],o[i+5],o[i+13],o[i+14],o[i+15],o[i+6],0,0,0,1]}}class U_{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map((i=>i.fqid)),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id)),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){this.tileToMeter=F(o);const u=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:h,id:f,index:_,sourceLayerIndex:y}of e){const v=f??(h.properties&&h.properties.hasOwnProperty("id")?h.properties.id:void 0),b=ue(h,u);if(!this.layers[0]._featureFilter.filter(new Li(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),b,o))continue;const T={id:v,sourceLayerIndex:y,index:_,geometry:u?b.geometry:ie(h,o,a),properties:h.properties,type:h.type,patterns:{}},E=this.addFeature(T,T.geometry,b);E&&i.featureIndex.insert(h,T.geometry,_,y,this.index,this.instancesPerModel[E].instancedDataArray.length,$e/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,i=this.layers[0].scope;let o=0;for(const a of this.modelUris){const u=e.getModel(a,i);if(!u)continue;const h=this.instancesPerModel[a];
7if(h){const f=.5*fc(u.aabb.max,u.aabb.min)*h.maxScale+h.maxXYTranslationDistance,_=Math.min($e,Math.max(f/this.tileToMeter,$e/32));o=Math.max(_,o)}}return o}update(e,i,o,a){for(const u in this.instancesPerModel){const h=this.instancesPerModel[u];for(const f in e)h.idToFeaturesIndex.hasOwnProperty(f)&&(this.evaluate(h.features[h.idToFeaturesIndex[f]],e[f],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];for(const a of o.features){const u=this.layers[0],h=a.feature,f=this.canonical,_=u.paint.get("model-rotation").evaluate(h,{},f),y=u.paint.get("model-scale").evaluate(h,{},f),v=u.paint.get("model-translation").evaluate(h,{},f);un(a.rotation,_)&&un(a.scale,y)&&un(a.translation,v)||(this.evaluate(a,a.featureStates,o,!0),e=!0)}}return e}updateReplacement(e,i,o,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const u=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(dp(this.activeReplacements,u))return!1;this.activeReplacements=u;let h=!1;for(const f in this.instancesPerModel){const _=this.instancesPerModel[f],y=_.instancedDataArray;for(const v of _.features){const b=v.instancedDataOffset,T=v.instancedDataCount;for(let E=0;E<T;E++){const I=16*(E+b);let P=y.float32[I+0];const L=P>$e;P=L?P-$e:P;const D=Math.floor(P),B=Math.floor(y.float32[I+1]);let V=!1;for(const G of this.activeReplacements)if(!Vg(G,o,Jx.Model,a)&&!(G.min.x>D||D>G.max.x||G.min.y>B||B>G.max.y)&&(V=qg(Hg(D,B,e.canonical,G.footprintTileId.canonical),G.footprint),V))break;y.float32[I]=V?P+$e:P,h=h||V!==L}}}return h}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];o.instancedDataArray.length<0||o.instancedDataArray.length===0||(o.instancedDataBuffer?o.instancedDataBuffer.updateData(o.instancedDataArray):o.instancedDataBuffer=e.createVertexBuffer(o.instancedDataArray,c1.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const o in this.instancesPerModel){const a=this.instancesPerModel[o];a.instancedDataArray.length!==0&&a.instancedDataBuffer&&a.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(e&&i&&this.modelUris&&this.modelsRequested)for(const o of this.modelUris)i.removeModel(o,"",!0)}addFeature(e,i,o){const a=this.layers[0],u=a.layout.get("model-id").evaluate(o,{},this.canonical);if(!u)return tt(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),u;(V_(u,!1)||this.styleDefinedModelURLs[u]!==void 0)&&(this.modelUris.includes(u)||this.modelUris.push(u)),this.instancesPerModel[u]||(this.instancesPerModel[u]=new ev);const h=this.instancesPerModel[u],f=h.instancedDataArray,_=new Qx(o,f.length);for(const y of i)for(const v of y){if(v.x<0||v.x>=$e||v.y<0||v.y>=$e)continue;if(this.lookupDim!==0){const T=(this.lookupDim-1)/$e,E=this.lookupDim*(v.y*T|0)+v.x*T|0;if(this.lookup){if(this.lookup[E]!==0)continue;this.lookup[E]=1}}this.instanceCount++;const b=f.length;f.resize(b+1),h.instancesEvaluatedElevation.push(0),f.float32[16*b]=v.x,f.float32[16*b+1]=v.y}return _.instancedDataCount=h.instancedDataArray.length-_.instancedDataOffset,_.instancedDataCount>0&&(e.id&&(h.idToFeaturesIndex[e.id]=h.features.length),h.features.push(_),this.evaluate(_,{},h,!1)),u}getModelUris(){return this.modelUris}evaluate(e,i,o,a){const u=this.layers[0],h=e.feature,f=this.canonical,_=e.rotation=u.paint.get("model-rotation").evaluate(h,i,f),y=e.scale=u.paint.get("model-scale").evaluate(h,i,f),v=e.translation=u.paint.get("model-translation").evaluate(h,i,f),b=Object.assign({},u.paint.get("model-color").evaluate(h,i,f));b.a=u.paint.get("model-color-mix-intensity").evaluate(h,i,f);const T=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]);const E=v[0]*v[0]+v[1]*v[1],I=E>0?Math.sqrt(E):0;o.maxScale=Math.max(Math.max(o.maxScale,y[0]),Math.max(y[1],y[2])),o.maxXYTranslationDistance=Math.max(o.maxXYTranslationDistance,I),this.maxScale=Math.max(Math.max(this.maxScale,y[0]),Math.max(y[1],y[2])),Ry(T,_,y);const P=Math.round(100*b.a)+b.b/1.05;for(let L=0;L<e.instancedDataCount;++L){const D=e.instancedDataOffset+L,B=16*D,V=o.instancedDataArray.float32;let G=0;a&&(G=V[B+6]-o.instancesEvaluatedElevation[D]);const K=0|V[B+1];V[B]=(0|V[B])+b.r/1.05,V[B+1]=K+b.g/1.05,V[B+2]=P,V[B+3]=1/(f.z>10?this.tileToMeter:F(f,K)),V[B+4]=v[0],V[B+5]=v[1],V[B+6]=v[2]+G,V[B+7]=T[0],V[B+8]=T[1],V[B+9]=T[2],V[B+10]=T[4],V[B+11]=T[5],V[B+12]=T[6],V[B+13]=T[8],V[B+14]=T[9],V[B+15]=T[10],o.instancesEvaluatedElevation[D]=v[2]}}}let tv,iv;ot(U_,"ModelBucket",{omit:["layers"]}),ot(ev,"PerModelAttributes"),ot(Qx,"ModelFeature");class Yu{constructor(e,i,o){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=o}static create(e,i,o){const a=o||e.findDEMTileFor(i);if(!a||!a.dem)return;const u=a.dem,h=a.tileID,f=1<<i.canonical.z-h.canonical.z;return new Yu(a,u.dim/$e/f,[(i.canonical.x/f-h.canonical.x)*u.dim,(i.canonical.y/f-h.canonical.y)*u.dim])}tileCoordToPixel(e,i){const o=i*this._scale+this._offset[1];return new Oe(Math.floor(e*this._scale+this._offset[0]),Math.floor(o))}getElevationAt(e,i,o,a){const u=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],f=Math.floor(u),_=Math.floor(h),y=this._dem;return a=!!a,o?wt(wt(y.get(f,_,a),y.get(f,_+1,a),h-_),wt(y.get(f+1,_,a),y.get(f+1,_+1,a),h-_),u-f):y.get(f,_,a)}getElevationAtPixel(e,i,o){return this._dem.get(e,i,!!o)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*w(1,e)*this._dem.stride}}const j_=new Float32Array(262144),uc=new Uint8Array(262144);function rv(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,rv(i));return e}function nv(r,e,i){if(r.meshes)for(const o of r.meshes){if(o.aabb.min[0]===1/0)continue;const a=ut.applyTransform(o.aabb,r.globalMatrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const o of r.children)nv(o,e,i)}const ov=["","wall","door","roof","window","lamp","logo"];class sv{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:rv(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new ut([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new ut([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const o of this.node.meshes)this.node.lightMeshIndex!==e&&(o.transformedAabb=ut.applyTransformFast(o.aabb,this.node.globalMatrix),i.encapsulate(
7o.transformedAabb)),e++;this.aabb=i}return this.aabb}}class Gp{constructor(e,i,o,a,u,h,f,_){this.id=o,this.layers=e,this.layerIds=this.layers.map((y=>y.fqid)),this.stateDependentLayerIds=this.layers.filter((y=>y.isStateDependent())).map((y=>y.id)),this.modelTraits|=Uu.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=Uu.HasMapboxMeshFeatures),u&&(this.modelTraits|=Uu.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const y of i)this.nodesInfo.push(new sv(y)),nv(y,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,i){for(const o of this.getNodesInfo()){const a=o.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}updateAppearances(e,i,o,a){}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const o=i?this.stateDependentLayers:this.layers;if(!Zo(e,this.states))for(const a of o)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 o of i){const a=o.node;this.uploaded?this.updatePbrBuffer(a):d_(a,e,!0)}for(const o of i)Sp(o.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const o of e.meshes)o.pbrBuffer&&(o.pbrBuffer.updateData(o.featureArray),i=!0);return i}needsReEvaluation(e,i,o){const a=e.transform.projectionOptions,u=e.style.getBrightness(),h=this.brightness!==u;if(!this.uploaded||this.dirty||a.name!==this.projection.name||Hd(o.paint.get("model-color").value,h)||Hd(o.paint.get("model-color-mix-intensity").value,h)||Hd(o.paint.get("model-roughness").value,h)||Hd(o.paint.get("model-emissive-strength").value,h)||Hd(o.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=a,this.brightness=u;const f=this.getNodesInfo();for(const _ of f)_.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const o=this.getNodesInfo(),a=this.id.canonical;for(const u of o){const h=u.feature;u.evaluatedTranslation=i.paint.get("model-translation").evaluate(h,{},a),u.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},a)}}evaluate(e,i){const o=this.getNodesInfo();for(const a of o){if(!a.node.meshes)continue;const u=a.feature,h=i&&i[u.id];if(Zo(h,a.state))continue;a.state=structuredClone(h);const f=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],y=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,f){for(let b=0;b<ov.length;b++){const T=ov[b];T.length&&(u.properties.part=T);const E=e.paint.get("model-color").evaluate(u,h,v).toPremultipliedRenderColor(null),I=e.paint.get("model-color-mix-intensity").evaluate(u,h,v);a.evaluatedColor[b]=[E.r,E.g,E.b,I],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(u,h,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v),a.evaluatedRMEA[b][3]=E.a,a.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(u,h,v),!a.hasTranslucentParts&&E.a<1&&(a.hasTranslucentParts=!0)}delete u.properties.part,jb(a,_!==a.evaluatedColor[2]||y!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(u,h,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(u,h,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,o,a){const u=e.findDEMTileFor(o);if(u&&(u.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(u.dem&&u.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=u.tileID.overscaledZ;const h=Yu.create(e,o,u);
7if(!h)return;this.modelTraits&Uu.HasMapboxMeshFeatures&&this.updateDEM(e,h,o,a);for(const f of this.getNodesInfo()){const _=f.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const y=_.footprint.vertices;let v=h.getElevationAt(y[0].x,y[0].y,!0,!0);for(let b=1;b<y.length;b++)v=Math.min(v,h.getElevationAt(y[b].x,y[b].y,!0,!0));_.elevation=v}}this.terrainTile=u.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,o,a){let u=i._dem._modifiedForSources[a];if(u===void 0&&(i._dem._modifiedForSources[a]=[],u=i._dem._modifiedForSources[a]),u.includes(o.canonical))return;const h=i._dem.dim;u.push(o.canonical);let f=!1;for(const _ of this.getNodesInfo()){const y=_.node;if(!y.footprint||!y.footprint.grid)continue;const v=y.footprint.grid,b=i.tileCoordToPixel(v.min.x,v.min.y),T=i.tileCoordToPixel(v.max.x,v.max.y),E=Math.min(Math.min(h-T.y,b.x),Math.min(b.y,h-T.x));if(E<0)continue;const I=O(E,2,5);let P=Math.max(0,b.x-I),L=Math.max(0,b.y-I),D=Math.min(T.x+I,h-1),B=Math.min(T.y+I,h-1);for(let Z=L;Z<=B;++Z)for(let ee=P;ee<=D;++ee)uc[Z*h+ee]=255;let V=0,G=0;for(let Z=0;Z<v.cellsY;++Z)for(let ee=0;ee<v.cellsX;++ee){if(!v.cells[Z*v.cellsX+ee])continue;const ne=i.tileCoordToPixel(v.min.x+ee/v.xScale,v.min.y+Z/v.yScale),ae=i.tileCoordToPixel(v.min.x+(ee+1)/v.xScale,v.min.y+(Z+1)/v.yScale);for(let be=ne.y;be<=Math.min(ae.y+1,h-1);++be)for(let he=ne.x;he<=Math.min(ae.x+1,h-1);++he)uc[be*h+he]===255&&(uc[be*h+he]=0,V+=i.getElevationAtPixel(he,be),G++)}const K=V/G;P=Math.max(1,b.x-I),L=Math.max(1,b.y-I),D=Math.min(T.x+I,h-2),B=Math.min(T.y+I,h-2),f=!0;for(let Z=L;Z<=B;++Z)for(let ee=P;ee<=D;++ee)uc[Z*h+ee]===0&&(j_[Z*h+ee]=i._dem.set(ee,Z,K));for(let Z=1;Z<I;++Z){P=Math.max(1,b.x-Z),L=Math.max(1,b.y-Z),D=Math.min(T.x+Z,h-2),B=Math.min(T.y+Z,h-2);for(let ee=L;ee<=B;++ee)for(let ne=P;ne<=D;++ne){const ae=ee*h+ne;if(uc[ae]===255){let be=0,he=0,Ee=-1,Ce=-1;for(let Pe=-1;Pe<=1;++Pe)for(let Fe=-1;Fe<=1;++Fe){const Be=(ee+Pe)*h+ne+Fe;if(uc[Be]>=Z)continue;const ze=j_[Be],De=Math.abs(ze);De>he&&(be=ze,he=De,Ee=Fe,Ce=Pe)}if(he>.1){const Pe=1-(Z+.5*Math.abs(Ee*Ce))/I;let Fe=i._dem.get(ne,ee)+be*Pe;const Be=i._dem.get(ne+Ee,ee+Ce),ze=i._dem.get(ne-Ee,ee-Ce,!0);(Fe-Be)*(Fe-ze)>0&&(Fe=(Be+ze)/2),j_[ae]=i._dem.set(ne,ee,Fe),uc[ae]=Z}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Fr.now())}setFilter(e){this.filter=e?hu(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter((e=>this.filter.filter(new Li(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical))):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)Sp(i.node),f_(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const u=a.node.footprint;a.hiddenByReplacement=!!u&&!o.find((h=>h.footprint===u))}}getHeightAtTileCoord(e,i){const o=[],a=[0,0,0],u=Ni([]);for(const h of this.getNodesInfo()){const f=h.node.meshes[0],_=f.transformedAabb;if(e<_.min[0]||i<_.min[1]||e>_.max[0]||i>_.max[1])continue;if(h.node.hidden===!0)return{height:1/0,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};Xr(u,h.node.globalMatrix),a[0]=e,a[1]=i,gr(a,a,u);const y=(a[0]-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*ac|0,v=Math.min(63,(a[1]-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*ac|0)*ac+Math.min(63,y),b=f.heightmap[v];if(!(b<0&&h.node.footprint))return h.hiddenByReplacement?void 0:{height:b,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};if(h.node.footprint.grid.query(new Oe(e,i),new Oe(e,i),o),o.length>0)return{height:void 0,maxHeight:h.feature.properties.height,hidden:h.hiddenByReplacement,verticalScale:h.evaluatedScale[2]}}}}function Hd(r,e){return r instanceof Wa&&!r.isLightConstant&&e}function Ub(r,e,i,o,a,u,h,f){let _=(61440&e|(61440&e)>>4)>>8,y=(3840&e|(3840&e)>>4)>>4,v=240&e|(240&e)>>4;i[3]>0&&(_=wt(_,255*i[0],i[3]),y=wt(y,255*i[1],i[3]),v=wt(v,255*i[2],i[3]));const b=_<<8|y,T=v<<8|Math.floor(255*o[3]),E=(function(Z){const ee=O(Z,0,2);return Math.min(Math.round(.5*ee*255),255)})(o[2])<<8|15*o[0]<<4|15*o[1],I=O(a[0],0,1),P=O(a[1],0,1),L=O(a[2],0,1),D=O(a[3],0,1);let B,V,G,K;if(I!==P&&h!==u&&P!==I){const Z=h-u;V=1/(Z*(P-I)),G=-(u+Z*I)/(Z*(P-I));const ee=O(a[4],-1,1);K=Math.pow(10,ee),B=255*L<<8|255*D}else B=65535,V=0,G=1,K=1;if(r.emplaceBack(b,T,E,B,V,G,K),f){const Z=f.length;f.clear();for(let ee=0;ee<Z;ee++)f.emplaceBack(b,T,E,B,V,G,K)}}function jb(r,e,i){const o=r.node;let a=0;const u=i&Uu.HasMeshoptCompression;for(const h of o.meshes){if(o.lights&&o.lightMeshIndex===a||!h.featureData)continue;h.featureArray=new wu,h.featureArray.reserve(h.featureData.length);let f=e;for(const _ of h.featureData){const y=u?65535&_:_>>16&65535,v=u?_>>16&65535:65535&_,b=(15&v)<8?15&v:0,T=r.evaluatedRMEA[b],E=r.evaluatedColor[b],I=r.emissionHeightBasedParams[b];let P;if(f&&b===2&&o.lights&&(P=new wu,P.resize(10*o.lights.length)),Ub(h.featureArray,y,E,T,I,h.aabb.min[2],h.aabb.max[2],P),P&&f){f=!1;const L=o.meshes[o.lightMeshIndex];L.featureArray=P,L.featureArray._trim()}}h.featureArray._trim(),a++}}ot(Gp,"Tiled3dModelBucket",{omit:["layers"]}),ot(sv,"Tiled3dModelFeature");const Gb=["id","tile","layer","source","sourceLayer","state"];class hc{constructor(e,i,o,a,u){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=o,this._y=a,this.properties=e?e.properties:{},this.id=u}clone(){const e=new hc(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of Gb)this[i]!==void 0&&(e[i]=this[i]);return e}}class dc extends la{constructor(e,i,o,a){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=i,this._modelsInfo=new Map}load(){const e=[];for(const i in this._options.models){const o=this._options.models[i],a=this._modelsInfo.get(i);if(a){const u=a.model;u.position=o.position!=null?new n(o.position[0],o.position[1]):new n(0,0),u.orientation=o.orientation!=null?o.orientation:[0,0,0],a.modelSpec=o,dc.applyModelSpecification(u,o),u.computeBoundsAndApplyParent(),this.models.push(u)}else{const u=Ay(this.map._requestManager.transformRequest(o.uri,vl.Model).url).then((h=>{if(!h)return;const f=m_(h),_=new zy(i,o.uri,o.position,o.orientation,f);dc.applyModelSpecification(_,o),_.computeBoundsAndApplyParent(),this.models.push(_),this._modelsInfo.set(i,{modelSpec:o,model:_})})).catch((h=>{this.fire(new Sl(new Error(`Could not load model ${i} from ${o.uri}: ${h.message}`)))}));e.push(u)}}Promise.allSettled(e).then((()=>{this._loaded=!0,this.fire(new Po("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((i=>{this._loaded=!0,this.fire(new Sl(new Error(`Could not load models: ${i.message}`)))}))}static applyModelSpecification(e,i){i.nodeOverrides&&dc.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&dc.convertMaterialOverrides(e,i.materialOverrides),i.nodeOverrideNames&&(e.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(e.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(e.featureProperties=i.featureProperties)}static convertNodeOverrides(e,i){if(Array.isArray(i)&&i.every((o=>
7typeof o=="string"))){e.nodeOverrideNames=[];for(const o of i)e.nodeOverrideNames.push(o)}else Object.entries(i).forEach((([o,a])=>{const u={orientation:[0,0,0]};if(a.hasOwnProperty("orientation")){const h=a.orientation;h&&(u.orientation=h)}e.nodeOverrides.set(o,u)}))}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every((o=>typeof o=="string"))){e.materialOverrideNames=[];for(const o of i)e.materialOverrideNames.push(o)}else Object.entries(i).forEach((([o,a])=>{const u={color:new yi(1,1,1),colorMix:0,emissionStrength:0,opacity:1},h=a["model-color"];h!==void 0&&(u.color.r=h[0],u.color.g=h[1],u.color.b=h[2]);const f=a["model-color-mix-intensity"];f!==void 0&&(u.colorMix=f);const _=a["model-emissive-strength"];_!==void 0&&(u.emissionStrength=_);const y=a["model-opacity"];y!==void 0&&(u.opacity=y),e.materialOverrides.set(o,u)}))}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,i){}serialize(){return this._options}setProperty(e,i){return!1}reload(){const e=xo(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(e){this.models=[];const i=new Map;for(const o in e){const a=e[o];if(this._modelsInfo.has(o)){const u=this._modelsInfo.get(o);u&&u.modelSpec.uri===a.uri&&i.set(o,u)}}this._modelsInfo=i,this._options.models=e,this._loaded=!1,this.load()}}function G_(r,e,i,o){const a=1<<r.z;e.lat=M((o/$e+r.y)/a),e.lng=S((i/$e+r.x)/a)}function Hb(r,e,i,o){const a=r.getNodesInfo()[e];
7if(!a||a.hiddenByReplacement||!a.node.meshes)return;let u=Number.MAX_VALUE;const h=a.node,f=i.tile,_=o.calculatePosMatrix(f.tileID.toUnwrapped(),o.worldSize),y=a.evaluatedScale;let v=0;o.elevation&&h.elevation&&(v=h.elevation*o.elevation.exaggeration()),Qr(_,_,[(h.anchor?h.anchor[0]:0)*(y[0]-1),(h.anchor?h.anchor[1]:0)*(y[1]-1),v]),Hr(_,_,y);const b=i.queryGeometry,T=b.isPointQuery()?b.screenBounds:b.screenGeometry,E=function(P){const L=Gi([],_,P.globalMatrix);Gi(L,o.expandedFarZProjMatrix,L);for(let D=0;D<P.meshes.length;++D){const B=P.meshes[D];if(D===P.lightMeshIndex)continue;const V=h_(T,o,L,B.aabb);V!=null&&(u=Math.min(V,u))}if(P.children)for(const D of P.children)E(D)};if(E(h),u===Number.MAX_VALUE)return;const I=new n(0,0);return G_(f.tileID.canonical,I,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:u,position:I,feature:a.feature}}const qb={circle:class extends xn{constructor(r,e,i,o){super(r,{layout:Cn||(Cn=new sr({"circle-sort-key":new Xe(fe.layout_circle["circle-sort-key"]),"circle-elevation-reference":new He(fe.layout_circle["circle-elevation-reference"]),visibility:new He(fe.layout_circle.visibility)})),paint:ar||(ar=new sr({"circle-radius":new Xe(fe.paint_circle["circle-radius"]),"circle-color":new Xe(fe.paint_circle["circle-color"]),"circle-blur":new Xe(fe.paint_circle["circle-blur"]),"circle-opacity":new Xe(fe.paint_circle["circle-opacity"]),"circle-translate":new He(fe.paint_circle["circle-translate"]),"circle-translate-anchor":new He(fe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new He(fe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new He(fe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Xe(fe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Xe(fe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Xe(fe.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new He(fe.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}createBucket(r){return new xi(r)}queryRadius(r){const e=r;return an("circle-radius",this,e)+an("circle-stroke-width",this,e)+Zr(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,o,a,u,h,f){const _=no(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),y=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return fg(r,o,u,h,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,y)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const o=dg(this);return{config:new Us(this,{zoom:e,lut:i}),defines:o,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 xn{createBucket(r){return new mg(r)}constructor(r,e,i,o){super(r,{layout:_g||(_g=new sr({visibility:new He(fe.layout_heatmap.visibility)})),paint:gg||(gg=new sr({"heatmap-radius":new Xe(fe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Xe(fe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new He(fe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ya(fe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new He(fe.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=dd({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 an("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,o,a,u,h,f){const _=this.paint.get("heatmap-radius").evaluate(e,i);return fg(r,o,u,h,f,!0,!0,new Oe(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 Us(this,{zoom:e,lut:i}
7),overrideFog:!1}:{}}},hillshade:class extends xn{constructor(r,e,i,o){super(r,{layout:yg||(yg=new sr({visibility:new He(fe.layout_hillshade.visibility)})),paint:xg||(xg=new sr({"hillshade-illumination-direction":new He(fe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new He(fe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new He(fe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new He(fe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new He(fe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new He(fe.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new He(fe.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}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 xn{constructor(r,e,i,o){super(r,{layout:Lg||(Lg=new sr({"fill-sort-key":new Xe(fe.layout_fill["fill-sort-key"]),visibility:new He(fe.layout_fill.visibility),"fill-elevation-reference":new He(fe.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Xe(fe.layout_fill["fill-construct-bridge-guard-rail"])})),paint:Og||(Og=new sr({"fill-antialias":new He(fe.paint_fill["fill-antialias"]),"fill-opacity":new Xe(fe.paint_fill["fill-opacity"]),"fill-color":new Xe(fe.paint_fill["fill-color"]),"fill-outline-color":new Xe(fe.paint_fill["fill-outline-color"]),"fill-translate":new He(fe.paint_fill["fill-translate"]),"fill-translate-anchor":new He(fe.paint_fill["fill-translate-anchor"]),"fill-pattern":new Xe(fe.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new He(fe.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new He(fe.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Xe(fe.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Xe(fe.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Xe(fe.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}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 Us(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 Wm(r)}queryRadius(){return Zr(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,o,a,u){return!r.queryGeometry.isAboveHorizon&&hi(Hn(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),o)}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 xn{constructor(r,e,i,o){super(r,{layout:ay||(ay=new sr({visibility:new He(fe["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new He(fe["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:ly||(ly=new sr({"fill-extrusion-opacity":new He(fe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Xe(fe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new He(fe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new He(fe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Xe(fe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new He(fe["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Xe(fe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Xe(fe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new He(fe["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new He(fe["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new He(fe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new He(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new He(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new He(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new He(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new He(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new He(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new He(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Xe(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Xe(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new He(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new He(fe["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new He(fe["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new He(fe["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Xe(fe["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Xe(fe["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new He(fe["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new pp(r)}queryRadius(){return Zr(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,o,a,u,h,f,_){const y=no(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),v=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),T=[0,0],E=f&&u.elevation,I=u.elevation?u.elevation.exaggeration():1,P=r.tile.getBucket(this);if(E&&P instanceof pp){const G=P.centroidVertexArray,K=_+1;K<G.length&&(T[0]=G.geta_centroid_pos0(K),T[1]=G.geta_centroid_pos1(K))}if(T[0]===0&&T[1]===1)return!1;u.projection.name==="globe"&&(o=sy([o],[new Oe(0,0),new Oe($e,$e)],r.tileID.canonical).map((G=>G.polygon)).flat());const L=E?f:null,[D,B]=my(u,o,b,v,y,h,L,T,I,u.center.lat,r.tileID.canonical),V=r.queryGeometry;return py(D,B,V.isPointQuery()?V.screenBounds:V.screenGeometry)}},building:class extends xn{constructor(r,e,i,o){super(r,{layout:Ny||(Ny=new sr({visibility:new He(fe.layout_building.visibility),"building-facade":new Xe(fe.layout_building["building-facade"]),"building-facade-floors":new Xe(fe.layout_building["building-facade-floors"]),"building-facade-unit-width":new Xe(fe.layout_building["building-facade-unit-width"]),"building-facade-window":new Xe(fe.layout_building["building-facade-window"]),"building-roof-shape":new Xe(fe.layout_building["building-roof-shape"]),"building-height":new Xe(fe.layout_building["building-height"]),"building-base":new Xe(fe.layout_building["building-base"]),"building-flood-light-wall-radius":new Xe(fe.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Xe(fe.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Xe(fe.layout_building["building-flip-roof-orientation"])})),paint:Vy||(Vy=new sr({"building-opacity":new He(fe.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new He(fe.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new He(fe.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new He(fe.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new He(fe.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new He(fe.paint_building["building-vertical-scale"]),"building-cast-shadows":new He(fe.paint_building["building-cast-shadows"]),"building-color":new Xe(fe.paint_building["building-color"]),"building-emissive-strength":new Xe(fe.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new He(fe.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new He(fe.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new He(fe.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new He(fe.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new He(fe.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new By(r)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(r){return!0}queryRadius(r){return 0}queryIntersectsFeature(r,e,i,o,a,u,h,f,_){let y=this.layout.get("building-height").evaluate(e,i);const v=this.layout.get("building-base").evaluate(e,i),b=r.tile.getBucket(this).getFootprint(e);if(b){if(b.hiddenFlags!==0)return!1;y=b.height}const[T,E]=my(u,o,v,y,new Oe(0,0),h,null,[0,0],1,u.center.lat,r.tileID.canonical),I=r.queryGeometry;return py(T,E,I.isPointQuery()?I.screenBounds:I.screenGeometry)}},line:class extends xn{constructor(r,e,i,o){const a=Yy();super(r,a,e,i,o),a.layout&&(this.layout=new ga(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 Fl,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>
7{if(Cd)return Cd;const i=Yy();return Cd=new N1(i.paint.properties["line-width"].specification),Cd.useIntegerZoom=!0,Cd})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new y_(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const o=Wy(this);return{config:new Us(this,{zoom:e,lut:i}),defines:o,overrideFog:!1}}queryRadius(r){const e=r,i=Ky(an("line-width",this,e),an("line-gap-width",this,e)),o=an("line-offset",this,e);return i/2+Math.abs(o)+Zr(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,o,a,u){if(r.queryGeometry.isAboveHorizon)return!1;const h=Hn(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*Ky(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 _&&(o=(function(y,v){const b=[],T=new Oe(0,0);for(let E=0;E<y.length;E++){const I=y[E],P=[];for(let L=0;L<I.length;L++){const D=I[L],B=I[L+1],V=L===0?T:D.sub(I[L-1])._unit()._perp(),G=L===I.length-1?T:B.sub(D)._unit()._perp(),K=V._add(G)._unit();K._mult(1/(K.x*G.x+K.y*G.y)),P.push(K._mult(v)._add(D))}b.push(P)}return b})(o,_*r.pixelToTileUnitsFactor)),(function(y,v,b){for(let T=0;T<v.length;T++){const E=v[T];if(y.length>=3){for(let I=0;I<E.length;I++)if(Ai(y,E[I]))return!0}if(tr(y,E,b))return!0}return!1})(h,o,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:Np,background:class extends xn{constructor(r,e,i,o){super(r,{layout:Nx||(Nx=new sr({visibility:new He(fe.layout_background.visibility)})),paint:Vx||(Vx=new sr({"background-pitch-alignment":new He(fe.paint_background["background-pitch-alignment"]),"background-color":new He(fe.paint_background["background-color"]),"background-pattern":new He(fe.paint_background["background-pattern"]),"background-opacity":new He(fe.paint_background["background-opacity"]),"background-emissive-strength":new He(fe.paint_background["background-emissive-strength"]),"background-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}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:qx,"raster-particle":Kx,sky:class extends xn{constructor(r,e,i,o){super(r,{layout:Wx||(Wx=new sr({visibility:new He(fe.layout_sky.visibility)})),paint:Xx||(Xx=new sr({"sky-type":new He(fe.paint_sky["sky-type"]),"sky-atmosphere-sun":new He(fe.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new He(fe.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new He(fe.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new He(fe.paint_sky["sky-gradient-radius"]),"sky-gradient":new ya(fe.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new He(fe.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new He(fe.paint_sky["sky-atmosphere-color"]),"sky-opacity":new He(fe.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvali
7dated=!0)}_updateColorRamp(){this.colorRamp=dd({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 o=this.paint.get("sky-atmosphere-sun"),a=!o,u=r.style.light,h=u.properties.get("position");return a&&u.properties.get("anchor")==="viewport"&&tt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?N_(h.azimuthal,90-h.polar,e):N_(o[0],90-o[1],e)}const i=this.paint.get("sky-gradient-center");return N_(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 xn{constructor(r,e,i,o){super(r,{paint:Yx||(Yx=new sr({}))},e,null)}},model:class extends xn{constructor(r,e,i,o){super(r,{layout:tv||(tv=new sr({visibility:new He(fe.layout_model.visibility),"model-id":new Xe(fe.layout_model["model-id"])})),paint:iv||(iv=new sr({"model-opacity":new Xe(fe.paint_model["model-opacity"]),"model-rotation":new Xe(fe.paint_model["model-rotation"]),"model-scale":new Xe(fe.paint_model["model-scale"]),"model-translation":new Xe(fe.paint_model["model-translation"]),"model-color":new Xe(fe.paint_model["model-color"]),"model-color-mix-intensity":new Xe(fe.paint_model["model-color-mix-intensity"]),"model-type":new He(fe.paint_model["model-type"]),"model-cast-shadows":new He(fe.paint_model["model-cast-shadows"]),"model-receive-shadows":new He(fe.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new He(fe.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Xe(fe.paint_model["model-emissive-strength"]),"model-roughness":new Xe(fe.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Xe(fe.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new He(fe.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new He(fe.paint_model["model-front-cutoff"]),"model-elevation-reference":new He(fe.paint_model["model-elevation-reference"]),"model-color-use-theme":new Xe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this.layer=r,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new U_(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 Gp?$e-1:0}queryRenderedFeatures(r,e,i){const o=e.getSource();if(!(o&&o instanceof dc))return{};const a=o,u={};u[this.id]=[];const h=u[this.id];let f=0;for(const _ of a.models){const y=e.getFeatureState(this.sourceLayer,_.id),v={type:"Unknown",id:_.id,properties:_.featureProperties},b=this.paint.get("model-rotation").evaluate(v,y),T=this.paint.get("model-scale").evaluate(v,y),E=this.paint.get("model-translation").evaluate(v,y),I=this.paint.get("model-elevation-reference");let P=[];Tp(P,_,i,_.position,b,T,E,I==="ground",I==="ground",!1),i.projection.name==="globe"&&(P=wp(P,i));const L=Gi([],i.projMatrix,P),D=h_(r.isPointQuery()?r.screenBounds:r.screenGeometry,i,L,_.aabb);if(D!=null){const B=new hc(void 0,0,0,0,_.id);B.layer=this.layer,B.properties=structuredClone(_.featureProperties),B.properties.layer=this.id,B.properties.uri=_.uri,B.properties.orientation=_.orientation,B.sourceLayer=this.sourceLayer,B.geometry={type:"Point",coordinates:[_.position.lng,_.position.lat]},B.state=y,B.source=this.source,h.push({featureIndex:f,feature:B,intersectionZ:D})}++f}return u}queryIntersectsFeature(r,e,i,o,a,u){if(!this.modelManager)return!1;const h=this.modelManager,f=r.tile.getBucket(this);if(!(f&&f instanceof U_))return!1;for(const _ in f.instancesPerModel){const y=f.instancesPerModel[_],v=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(y.idToFeaturesIndex.hasOwnProperty(v)){const b=y.features[y.idToFeaturesIndex[v]],T=h.getModel(_,this.scope);if(!T)return!1;let E=[];const I=new n(0,0),P=f.canonical;let L=Number.MAX_VALUE;for(let D=0;D<b.instancedDataCount;++D){const B=16*(b.instancedDataOffset+D),V=y.instancedDataArray.float32,G=[V[B+4],V[B+5],V[B+6]];G_(P,I,Math.floor(V[B]),Math.floor(V[B+1])),Tp(E,T,u,I,b.rotation,b.scale,G,!1,!1,!1),u.projection.name==="globe"&&(E=wp(E,u));const K=Gi([],u.projMatrix,E),Z=r.queryGeometry,ee=h_(Z.isPointQuery()?Z.screenBounds:Z.screenGeometry,u,K,T.aabb);ee!=null&&(L=Math.min(ee,L))}return L!==Number.MAX_VALUE&&L}}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 pa}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends xn{constructor(r,e,i,o){super(r,{layout:Fg||(Fg=new sr({"clip-layer-types":ne
7w He(fe.layout_clip["clip-layer-types"]),"clip-layer-scope":new He(fe.layout_clip["clip-layer-scope"])})),paint:kg||(kg=new sr({}))},e,i,o)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new Bg(r)}is3D(r){return!0}}},H_=new yi(0,0,0),q_={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},$_={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},Hp={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},$b={PAINT_ORDER_FILL_AND_STROKE:1},qd={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},av={MASK_TYPE_LUMINANCE:1};function Zb(r,e,i){r===1&&e.icons.push((function(o,a){return(function(u){if(u.usvg_tree.height||(u.usvg_tree.height=u.usvg_tree.width),!u.metadata)return u;const{metadata:h}=u;if(h.content_area){const{content_area:f}=h;f.left==null&&(f.left=0),f.top==null&&(f.top=f.left),f.width==null&&(f.width=u.usvg_tree.width),f.height==null&&(f.height=f.width)}if(h.text_placeholder){const{text_placeholder:f}=h;f.top==null&&(f.top=f.left),f.height==null&&(f.height=f.width)}return h.stretch_x&&h.stretch_x.length&&lv(h,"x"),h.stretch_y&&h.stretch_y.length&&lv(h,"y"),u})(o.readFields(Wb,{name:void 0},a))})(i,i.readVarint()+i.pos))}function lv(r,e){const i=[],o=r[`stretch_${e}`];let a=null;for(let u=0;u<o.length;u++)a===null?a=i.length===0?o[0]:i[i.length-1][1]+o[u]:(i.push([a,a+o[u]]),a=null);r[`stretch_${e}_areas`]=i}function Wb(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=(function(o,a){return o.readFields(Xb,{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(o,a){return o.readFields(Jb,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)})(i,i.readVarint()+i.pos),e.data="usvg_tree")}function Xb(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=cv(i,i.readVarint()+i.pos):r===4?e.variables.push((function(o,a){return o.readFields(Kb,{name:void 0},a)})(i,i.readVarint()+i.pos)):r===5&&(e.text_placeholder=cv(i,i.readVarint()+i.pos))}function cv(r,e){return r.readFields(Yb,{},e)}function Yb(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 Kb(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=Zp(i.readVarint()),e.value="rgb_color")}function Jb(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(qp(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push((function(o,a){return o.readFields(ow,{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(o,a){return o.readFields(aw,{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(o,a){return o.readFields(lw,{children:[]},a)})(i,i.readVarint()+i.pos)):r===8&&e.masks.push((function(o,a){const u=o.readFields(cw,{left:0,width:20,mask_type:av.MASK_TYPE_LUMINANCE,children:[]},a);return u.height==null&&(u.height=u.width),u.top==null&&(u.top=u.left),u})(i,i.readVarint()+i.pos))}function qp(r,e){return r.readFields(Qb,{},e)}function Qb(r,e,i){r===1?(e.group=(function(o,a){return o.readFields(ew,{opacity:255,children:[]},a)})(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=(function(o,a){return o.readFields(iw,{paint_order:1,commands:[],step:1,diffs:[],rule:q_.PATH_RULE_NON_ZERO},a)})(i,i.readVarint()+i.pos),e.node="path")}function ew(r,e,i){r===1?e.transform=$p(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(qp(i,i.readVarint()+i.pos))}function $p(r,e){return r.readFields(tw,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function tw(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 iw(r,e,i){r===1?e.fill=(function(o,a){return o.readFields(rw,{rgb_color:H_,paint:"rgb_color",opacity:255},a)})(i,i.readVarint()+i.pos):r===2?e.stroke=(function(o,a){return o.readFields(nw,{rgb_color:H_,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.
7step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function rw(r,e,i){r===1?(e.rgb_color=Zp(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 Zp(r){return new yi((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function nw(r,e,i){r===1?(e.rgb_color=Zp(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 ow(r,e,i){r===1?e.transform=$p(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(uv(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 uv(r,e){return r.readFields(sw,{offset:0,opacity:255,rgb_color:H_},e)}function sw(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=Zp(i.readVarint()))}function aw(r,e,i){r===1?e.transform=$p(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(uv(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 lw(r,e,i){r===1?e.transform=$p(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(qp(i,i.readVarint()+i.pos))}function cw(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(qp(i,i.readVarint()+i.pos))}class uw{static calculate(e={},i=[]){const o=new Map,a=new Map;if(Object.keys(e).length===0)return o;i.forEach((u=>{a.set(u.name,u.rgb_color||new yi(0,0,0))}));for(const[u,h]of Object.entries(e))a.has(u)?o.set(a.get(u).toString(),h):console.warn(`Ignoring unknown image variable "${u}"`);return o}}function Ku(r,e=255,i){const o=e/255,a=r.toString(),u=i.has(a)?i.get(a).clone():r.clone();return u.a*=o,u.toString()}function $d(r,e){if(!Ao()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}let Z_,Zd=null;function W_(r,e,i,o,a){for(const u of o.children)hv(r,e,i,u,a)}function hv(r,e,i,o,a){o.group?(r.save(),(function(u,h,f,_,y){const v=_.mask_idx!=null?f.masks[_.mask_idx]:null,b=_.clip_path_idx!=null?f.clip_paths[_.clip_path_idx]:null;if(_.transform&&(h=Ju(_.transform).preMultiplySelf(h)),!(function(I,P,L){return I.opacity!==255||P||L})(_,b!=null,v!=null))return void W_(u,h,f,_,y);const T=$d(u.canvas.width,u.canvas.height),E=T.getContext("2d");W_(E,h,f,_,y),b&&yv(E,h,f,b),v&&xv(E,h,f,v,y),u.globalAlpha=_.opacity/255,u.drawImage(T,0,0)})(r,e,i,o.group,a),r.restore()):o.path&&(r.save(),(function(u,h,f,_,y){u.setTransform(h),_.paint_order===$b.PAINT_ORDER_FILL_AND_STROKE?(dv(u,f,_,y),pv(u,f,_,y)):(pv(u,f,_,y),dv(u,f,_,y))})(r,e,i,o.path,a),r.restore())}function dv(r,e,i,o){const a=i.fill;if(!a)return;const u=a.opacity/255;switch(r.save(),r.beginPath(),vv(i,r),a.paint){case"rgb_color":r.fillStyle=Ku(a.rgb_color,a.opacity,o);break;case"linear_gradient_idx":{const h=e.linear_gradients[a.linear_gradient_idx];h.transform&&r.setTransform(Ju(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=mv(r,h,u,o);break}case"radial_gradient_idx":{const h=e.radial_gradients[a.radial_gradient_idx];h.transform&&r.setTransform(Ju(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=_v(r,h,u,o)}}r.fill(fv(i)),r.restore()}function fv(r){return r.rule===q_.PATH_RULE_NON_ZERO?"nonzero":r.rule===q_.PATH_RULE_EVEN_ODD?"evenodd":void 0}function pv(r,e,i,o){const a=i.stroke;if(!a)return;const u=bv(i);
7r.lineWidth=a.width,r.miterLimit=a.miterlimit,r.setLineDash(a.dasharray),r.lineDashOffset=a.dashoffset;const h=a.opacity/255;switch(a.paint){case"rgb_color":r.strokeStyle=Ku(a.rgb_color,a.opacity,o);break;case"linear_gradient_idx":r.strokeStyle=mv(r,e.linear_gradients[a.linear_gradient_idx],h,o,!0);break;case"radial_gradient_idx":r.strokeStyle=_v(r,e.radial_gradients[a.radial_gradient_idx],h,o,!0)}switch(a.linejoin){case Hp.LINE_JOIN_MITER_CLIP:case Hp.LINE_JOIN_MITER:r.lineJoin="miter";break;case Hp.LINE_JOIN_ROUND:r.lineJoin="round";break;case Hp.LINE_JOIN_BEVEL:r.lineJoin="bevel"}switch(a.linecap){case $_.LINE_CAP_BUTT:r.lineCap="butt";break;case $_.LINE_CAP_ROUND:r.lineCap="round";break;case $_.LINE_CAP_SQUARE:r.lineCap="square"}r.stroke(u)}function mv(r,e,i,o,a=!1){if(e.stops.length===1){const T=e.stops[0];return Ku(T.rgb_color,T.opacity*i,o)}const{x1:u,y1:h,x2:f,y2:_}=e;let y=new DOMPoint(u,h),v=new DOMPoint(f,_);if(a){const T=Ju(e.transform);y=T.transformPoint(y),v=T.transformPoint(v)}const b=r.createLinearGradient(y.x,y.y,v.x,v.y);for(const T of e.stops)b.addColorStop(T.offset,Ku(T.rgb_color,T.opacity*i,o));return b}function _v(r,e,i,o,a=!1){if(e.stops.length===1){const D=e.stops[0];return Ku(D.rgb_color,D.opacity*i,o)}const u=Ju(e.transform),{fx:h,fy:f,fr:_,cx:y,cy:v,r:b}=e;let T=new DOMPoint(h,f),E=new DOMPoint(y,v),I=_,P=b;if(a){T=u.transformPoint(T),E=u.transformPoint(E);const D=(u.a+u.d)/2;I=_*D,P=e.r*D}const L=r.createRadialGradient(T.x,T.y,I,E.x,E.y,P);for(const D of e.stops)L.addColorStop(D.offset,Ku(D.rgb_color,D.opacity*i,o));return L}function gv(r,e,i,o){const a=o.transform?Ju(o.transform).preMultiplySelf(e):e,u=$d(r.canvas.width,r.canvas.height),h=u.getContext("2d");for(const _ of o.children)if(_.group)gv(h,a,i,_.group);else if(_.path){const y=_.path,v=new Path2D;v.addPath(bv(y),a),h.fill(v,fv(y))}const f=o.clip_path_idx!=null?i.clip_paths[o.clip_path_idx]:null;f&&yv(h,a,i,f),r.globalCompositeOperation="source-over",r.drawImage(u,0,0)}function yv(r,e,i,o){const a=$d(r.canvas.width,r.canvas.height);gv(a.getContext("2d"),e,i,o),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function xv(r,e,i,o,a){if(o.children.length===0)return;const u=o.mask_idx!=null?i.masks[o.mask_idx]:null;u&&xv(r,e,i,u,a);const h=r.canvas.width,f=r.canvas.height,_=$d(h,f),y=_.getContext("2d"),v=o.width,b=o.height,T=o.left,E=o.top,I=new Path2D,P=new Path2D;P.rect(T,E,v,b),I.addPath(P,e),y.clip(I);for(const B of o.children)hv(y,e,i,B,a);const L=y.getImageData(0,0,h,f),D=L.data;if(o.mask_type===av.MASK_TYPE_LUMINANCE)for(let B=0;B<D.length;B+=4)D[B+3]=D[B+3]/255*(.2126*D[B]+.7152*D[B+1]+.0722*D[B+2]);y.putImageData(L,0,0),r.globalCompositeOperation="destination-in",r.drawImage(_,0,0)}function Ju(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function vv(r,e){const i=r.step;let o=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(o,a);for(let u=0,h=2;u<r.commands.length;u++)switch(r.commands[u]){case qd.PATH_COMMAND_MOVE:o+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.moveTo(o,a);break;case qd.PATH_COMMAND_LINE:o+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.lineTo(o,a);break;case qd.PATH_COMMAND_QUAD:{const f=o+r.diffs[h++]*i,_=a+r.diffs[h++]*i;o=f+r.diffs[h++]*i,a=_+r.diffs[h++]*i,e.quadraticCurveTo(f,_,o,a);break}case qd.PATH_COMMAND_CUBIC:{const f=o+r.diffs[h++]*i,_=a+r.diffs[h++]*i,y=f+r.diffs[h++]*i,v=_+r.diffs[h++]*i;o=y+r.diffs[h++]*i,a=v+r.diffs[h++]*i,e.bezierCurveTo(f,_,y,v,o,a);break}case qd.PATH_COMMAND_CLOSE:e.closePath()}return e}function bv(r){return vv(r,new Path2D)}class Wp{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)}}ot(Wp,"LRUCache");class X_{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new ln(e,e.data)}getFromCache(e,i,o){return this.cacheMap.has(o)||this.cacheMap.set(o,new Wp(150)),this.cacheMap.get(o).get(xo(e.toString(),i))}setInCache(e,i,o,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new Wp(150));const u=this.cacheDependenciesMap.get(a),h=xo(e.id.toString(),o);u.get(h)||u.set(h,new Set);const f=this.cacheMap.get(a),_=e.toString();u.get(h).add(_),f.put(xo(e.toString(),o),i)}removeImagesFromCacheByIds(e,i,o=0){if(!this.cacheMap.has(o)||!this.cacheDependenciesMap.has(o))return;const a=this.cacheMap.get(o),u=this.cacheDependenciesMap.get(o);for(const h of e){const f=xo(h.toString(),i);if(u.has(f)){for(const _ of u.get(f))a.delete(_);u.delete(f)}}}rasterize(e,i,o,a){const u=this.getFromCache(e,o,a);if(u)return u.clone();const h=(function(_,y){const v=uw.calculate(y.params,_.metadata?_.metadata.variables:[]),b=_.usvg_tree,T=b.width,E=b.height,I=Math.max(1,Math.round(T*y.sx)),P=Math.max(1,Math.round(E*y.sy)),L=new DOMMatrix([I/T,0,0,P/E,0,0]);return Zd===null&&(Zd=$d(10,10),Z_=Zd.getContext("2d",{willReadFrequently:!0})),Zd.width=I,Zd.height=P,W_(Z_,L,b,b,v),Z_.getImageData(0,0,I,P)})(i.icon,e),f=X_._getImage(h);return this.setInCache(e,f,o,a),f.clone()}}class wv{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const o=this.toIdx(e,i);return{min:this.minimums[o],max:this.maximums[o]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function Tv(r,e,i,o){let a=0,u=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(o[h])<1e-15){if(i[h]<r[h]||i[h]>e[h])return null}else{const f=1/o[h];let _=(r[h]-i[h])*f,y=(e[h]-i[h])*f;if(_>y){const v=_;_=y,y=v}if(_>a&&(a=_),y<u&&(u=y),a>u)return null}return a}function Sv(r,e,i,o,a,u,h,f,_,y,v){const b=o-r,T=a-e,E=u-i,I=h-r,P=f-e,L=_-i,D=v[1]*L-v[2]*P,B=v[2]*I-v[0]*L,V=v[0]*P-v[1]*I,G=b*D+T*B+E*V;if(Math.abs(G)<1e-15)return null;const K=1/G,Z=y[0]-r,ee=y[1]-e,ne=y[2]-i,ae=(Z*D+ee*B+ne*V)*K;if(ae<0||ae>1)return null;const be=ee*E-ne*T,he=ne*b-Z*E,Ee=Z*T-ee*b,Ce=(v[0]*be+v[1]*he+v[2]*Ee)*K;return Ce<0||ae+Ce>1?null:(I*be+P*he+L*Ee)*K}function Ev(r,e,i){return(r-e)/(i-e)}function Iv(r,e,i,o,a,u,h,f,_){const y=1<<i,v=u-o,b=h-a,T=(r+1)/y*v+o,E=(e+0)/y*b+a,I=(e+1)/y*b+a;f[0]=(r+0)/y*v+o,f[1]=E,_[0]=T,_[1]=I}class Av{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=(function(u){const h=Math.ceil(Math.log2(u.dim/8)),f=[];let _=Math.ceil(Math.pow(2,h));const y=1/_,v=(E,I,P,L,D)=>{const B=L?1:0,V=(E+1)*P-B,G=I*P,K=(I+1)*P-B;D[0]=E*P,D[1]=G,D[2]=V,D[3]=K};let b=new wv(_);const T=[];for(let E=0;E<_*_;E++){v(E%_,Math.floor(E/_),y,!1,T);const I=hl(T[0],T[1],u),P=hl(T[2],T[1],u),L=hl(T[2],T[3],u),D=hl(T[0],T[3],u);b.minimums.push(Math.min(I,P,L,D)),b.maximums.push(Math.max(I,P,L,D)),b.leaves.push(1)}for(f.push(b),_/=2;_>=1;_/=2){const E=f[f.length-1];b=new wv(_);for(let I=0;I<_*_;I++){v(I%_,Math.floor(I/_),2,!0,T);const P=E.getElevation(T[0],T[1]),L=E.getElevation(T[2],T[1]),D=E.getElevation(T[2],T[3]),B=E.getElevation(T[0],T[3]),V=E.isLeaf(T[0],T[1]),G=E.isLeaf(T[2],T[1]),K=E.isLeaf(T[2],T[3]),Z=E.isLeaf(T[0],T[3]),ee=Math.min(P.min,L.min,D.min,B.min),ne=Math.max(P.max,L.max,D.max,B.max),ae=V&&G&&K&&Z;
7b.maximums.push(ne),b.minimums.push(ee),b.leaves.push(ne-ee<=5&&ae?1:0)}f.push(b)}return f})(this.dem),o=i.length-1,a=i[o];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,o,0)}raycastRoot(e,i,o,a,u,h,f=1){return Tv([e,i,-100],[o,a,this.maximums[0]*f],u,h)}raycast(e,i,o,a,u,h,f=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,o,a,u,h,f);if(_==null)return null;const y=[],v=[],b=[],T=[],E=[{idx:0,t:_,nodex:0,nodey:0,depth:0}];for(;E.length>0;){const{idx:I,t:P,nodex:L,nodey:D,depth:B}=E.pop();if(this.leaves[I]){Iv(L,D,B,e,i,o,a,b,T);const G=1<<B,K=(L+0)/G,Z=(L+1)/G,ee=(D+0)/G,ne=(D+1)/G,ae=hl(K,ee,this.dem)*f,be=hl(Z,ee,this.dem)*f,he=hl(Z,ne,this.dem)*f,Ee=hl(K,ne,this.dem)*f,Ce=Sv(b[0],b[1],ae,T[0],b[1],be,T[0],T[1],he,u,h),Pe=Sv(T[0],T[1],he,b[0],T[1],Ee,b[0],b[1],ae,u,h),Fe=Math.min(Ce!==null?Ce:Number.MAX_VALUE,Pe!==null?Pe:Number.MAX_VALUE);if(Fe!==Number.MAX_VALUE)return Fe;{const Be=qr([],u,h,P);if(Mv(ae,be,Ee,he,Ev(Be[0],b[0],T[0]),Ev(Be[1],b[1],T[1]))>=Be[2])return P}continue}let V=0;for(let G=0;G<this._siblingOffset.length;G++){Iv((L<<1)+this._siblingOffset[G][0],(D<<1)+this._siblingOffset[G][1],B+1,e,i,o,a,b,T),b[2]=-100,T[2]=this.maximums[this.childOffsets[I]+G]*f;const K=Tv(b,T,u,h);if(K!=null){const Z=K;y[G]=Z;let ee=!1;for(let ne=0;ne<V&&!ee;ne++)Z>=y[v[ne]]&&(v.splice(ne,0,G),ee=!0);ee||(v[V]=G),V++}}for(let G=0;G<V;G++){const K=v[G];E.push({idx:this.childOffsets[I]+K,t:y[K],nodex:(L<<1)+this._siblingOffset[K][0],nodey:(D<<1)+this._siblingOffset[K][1],depth:B+1})}}return null}_addNode(e,i,o){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(o),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,o,a,u){if(e[a].isLeaf(i,o)===1)return;this.childOffsets[u]||(this.childOffsets[u]=this.nodeCount);const h=a-1,f=e[h];let _=0,y=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],T=2*o+this._siblingOffset[v][1],E=f.getElevation(b,T),I=f.isLeaf(b,T),P=this._addNode(E.min,E.max,I);I&&(_|=1<<v),y||(y=P)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*o+this._siblingOffset[v][1],h,y+v)}}function Mv(r,e,i,o,a,u){return wt(wt(r,i,u),wt(e,o,u),a)}function hl(r,e,i){const o=i.dim,a=O(r*o-.5,0,o-1),u=O(e*o-.5,0,o-1),h=Math.floor(a),f=Math.floor(u),_=Math.min(h+1,o-1),y=Math.min(f+1,o-1);return Mv(i.get(h,f),i.get(_,f),i.get(h,y),i.get(_,y),a-h,u-f)}const hw={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function dw(r,e,i){return(256*r*256+256*e+i)/10-1e4}function fw(r,e,i){return 256*r+e+i/256-32768}class Xp{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,o,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void tt(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const u=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let _=0;_<u;_++)h[this._idx(-1,_)]=h[this._idx(0,_)],h[this._idx(u,_)]=h[this._idx(u-1,_)],h[this._idx(_,-1)]=h[this._idx(_,0)],h[this._idx(_,u)]=h[this._idx(_,u-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(u,-1)]=h[this._idx(u-1,0)],h[this._idx(-1,u)]=h[this._idx(0,u-1)],h[this._idx(u,u)]=h[this._idx(u-1,u-1)]}const f=o==="terrarium"?fw:dw;for(let _=0;_<h.length;++_){const y=4*_;this.floatView[_]=f(this.pixels[y],this.pixels[y+1],this.pixels[y+2])}this._timestamp=Fr.now()}_buildQuadTree(){this._tree=new Av(this)}get(e,i,o=!1){o&&(e=O(e,-1,this.dim),i=O(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,o){const a=this._idx(e,i),u=this.floatView[a];return this.floatView[a]=o,o-u}static getUnpackVector(e){return hw[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 o=[0,0,0,0],a=Xp.getUnpackVector(i);let u=Math.floor((e+a[3])/a[2]);return o[2]=u%256,u=Math.floor(u/256),o[1]=u%256,u=Math.floor(u/256),o[0]=u,o}getPixels(){return new wg({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,u=i*this.dim+this.dim,h=o*this.dim,f=o*this.dim+this.dim;switch(i){case-1:a=u-1;break;case 1:u=a+1}switch(o){case-1:h=f-1;break;case 1:f=h+1}const _=-i*this.dim,y=-o*this.dim;for(let v=h;v<f;v++)for(let b=a;b<u;b++){const T=4*this._idx(b,v),E=4*this._idx(b+_,v+y);this.pixels[T+0]=e.pixels[E+0],this.pixels[T+1]=e.pixels[E+1],this.pixels[T+2]=e.pixels[E+2],this.pixels[T+3]=e.pixels[E+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function pw(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(o,a){return o.readFields(xw,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)})(i,i.readVarint()+i.pos))}function mw(r,e,i){r===1?(e.delta_filter=(function(o,a){return o.readFields(_w,{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 _w(r,e,i){r===1&&(e.blockSize=i.readVarint())}function gw(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 yw(r,e,i){let o=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push((function(u,h){return u.readFields(mw,{},h)})(i,i.readVarint()+i.pos)):r===4?e.codec=(function(u,h){return u.readFields(gw,{},h)})(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?o=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=o)}function xw(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(o,a){return o.readFields(yw,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)})(i,i.readVarint()+i.pos))}function vw(r,e,i){if(r===2)(function(o,a,u){o.readFields(bw,u,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function bw(r,e,i){if(r===1){let o=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[o++]=i.readVarint()}}function ww(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let o=2;o>=1;o--){const a=o===1?1:0,u=o===2?1:0;for(let h=0;h<e[0];h++){const f=e[1]*h;for(let _=a;_<e[1];_++){const y=e[2]*(_+f);for(let v=u;v<e[2];v++){const b=e[3]*(v+y);for(let T=0;T<e[3];T++){const E=b+T;
vendor: 2,088 bytes, line 7
7r[E]+=r[E-i]}}}}i*=e[o]}return r}function Tw(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function Sw(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const o=r[i],a=r[i+1];r[i]=(240&o)>>4|(61440&o)>>8|(240&a)<<4|61440&a,r[i+1]=15&o|(3840&o)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const o=r[i],a=r[i+1],u=r[i+2],h=r[i+3];r[i+0]=(192&o)>>6|(192&a)>>4|(192&u)>>2|192&h,r[i+1]=(48&o)>>4|(48&a)>>2|48&u|(48&h)<<2,r[i+2]=(12&o)>>2|12&a|(12&u)<<2|(12&h)<<4,r[i+3]=3&o|(3&a)<<2|(3&u)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}ot(Xp,"DEMData"),ot(Av,"DemMinMaxQuadTree",{omit:["dem"]});var To=Uint8Array,Wd=Uint16Array,Ew=Int32Array,Cv=new To([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]),Pv=new To([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]),Iw=new To([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rv=function(r,e){for(var i=new Wd(31),o=0;o<31;++o)i[o]=e+=1<<r[o-1];var a=new Ew(i[30]);for(o=1;o<30;++o)for(var u=i[o];u<i[o+1];++u)a[u]=u-i[o]<<5|o;return{b:i,r:a}},zv=Rv(Cv,2),Dv=zv.b,Aw=zv.r;Dv[28]=258,Aw[258]=28;for(var Mw=Rv(Pv,0).b,Lv=new Wd(32768),Dr=0;Dr<32768;++Dr){var Qu=(43690&Dr)>>1|(21845&Dr)<<1;Lv[Dr]=((65280&(Qu=(61680&(Qu=(52428&Qu)>>2|(13107&Qu)<<2))>>4|(3855&Qu)<<4))>>8|(255&Qu)<<8)>>1}var Xd=function(r,e,i){for(var o=r.length,a=0,u=new Wd(e);a<o;++a)r[a]&&++u[r[a]-1];var h,f=new Wd(e);for(a=1;a<e;++a)f[a]=f[a-1]+u[a-1]<<1;h=new Wd(1<<e);var _=15-e;for(a=0;a<o;++a)if(r[a])for(var y=a<<4|r[a],v=e-r[a],b=f[r[a]-1]++<<v,T=b|(1<<v)-1;b<=T;++b)h[Lv[b]>>_]=y;return h},Yd=new To(288);for(Dr=0;Dr<144;++Dr)Yd[Dr]=8;for(Dr=144;Dr<256;++Dr)Yd[Dr]=9;for(Dr=256;Dr<280;++Dr)Yd[Dr]=7;for(Dr=280;Dr<288;++Dr)Yd[Dr]=8;var Ov=new To(32);for(Dr=0;Dr<32;++Dr)Ov[Dr]=5;var Cw=Xd(Yd,9),Pw=Xd(Ov,5),Y_=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},ps=function(r,e,i){var o=e/8|0;return(r[o]|r[o+1]<<8)>>(7&e)&i},K_=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)}
7,Rw=["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"],ms=function(r,e,i){var o=new Error(e||Rw[r]);if(o.code=r,Error.captureStackTrace&&Error.captureStackTrace(o,ms),!i)throw o;return o},zw=new To(0),Dw=typeof TextDecoder<"u"&&new TextDecoder;try{Dw.decode(zw,{stream:!0})}catch{}const Lw={gzip_data:"gzip"};class Uo extends Error{constructor(e){super(e),this.name="MRTError"}}const Ow={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Fv={uint32:1,uint16:2,uint8:4},Fw={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let J_;class Yp{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 Uo(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),o=new DataView(e);if(i[0]!==13)throw new Uo("File is not a valid MRT.");return o.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),o=this.getHeaderLength(e);if(i.length<o)throw new Uo(`Expected header with length >= ${o} but got buffer of length ${i.length}`);const a=new J_(i.subarray(0,o)).readFields(pw,{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 Uo(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const u of a.layers)this.layers[u.name]=new kv(u,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],o=this.getLayer(e.layerName);for(let a of e.blockIndices){const u=o.dataIndex[a],h=u.firstByte-e.firstByte,f=u.lastByte-e.firstByte;if(o._blocksInProgress.has(a))continue;const _={layerName:o.name,firstByte:h,lastByte:f,pixelFormat:o.pixelFormat,blockIndex:a,blockShape:[u.bands.length].concat(o.bandShape),buffer:o.buffer,codec:u.codec.codec,filters:u.filters.map((y=>y.filter))};o._blocksInProgress.add(a),i.push(_)}return new Bv(i,(()=>{i.forEach((a=>o._blocksInProgress.delete(a.blockIndex)))}),((a,u)=>{if(i.forEach((h=>o._blocksInProgress.delete(h.blockIndex))),a)throw a;u.forEach((h=>{this.getLayer(h.layerName).processDecodedData(h)}))}))}}class kv{constructor({version:e,name:i,units:o,tileSize:a,pixelFormat:u,buffer:h,dataIndex:f},_){if(this.version=e,this.version!==1)throw new Uo(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=o,this.tileSize=a,this.buffer=h,this.pixelFormat=Ow[u],this.dataIndex=f,this.bandShape=[a+2*h,a+2*h,Fv[this.pixelFormat]],this._decodedBlocks=new Wp(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Fv[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map((({bands:e})=>e)).flat()}processDecodedData(e){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[o,a]of this.dataIndex.entries()){for(const[u,h]of a.bands.entries())if(h===e)return{bandIndex:i+u,blockIndex:o,blockBandIndex:u};i+=a.bands.length}break;case"number":for(const[o,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:o,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new Uo(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,o=-1/0;const a=[],u=new Set;for(const h of e){const{blockIndex:f}=this.getBlockForBand(h);if(f<0)throw new Uo(`Invalid band: ${JSON.stringify(h)}`);const _=this.dataIndex[f];a.includes(f)||a.push(f),u.add(f),i=Math.min(i,_.firstByte),o=Math.max(o,_.lastByte)}if(u.size>this.cacheSize)throw new Uo(`Number of blocks to decode (${u.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:o,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:o}=this.getBlockForBand(e);if(i<0)throw new Uo(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new Uo(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const u=this.dataIndex[i],h=this.bandShape.reduce(((y,v)=>y*v),1),f=o*h,_=a.subarray(f,f+h);return{data:_,bytes:new Uint8Array(_.buffer).subarray(_.byteOffset,_.byteOffset+_.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:u.offset,scale:u.scale}}}Yp.setPbf=function(r){J_=r};class Bv{constructor(e,i,o){this.tasks=e,this._onCancel=i,this._onComplete=o,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}Yp.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map((o=>{const{layerName:a,firstByte:u,lastByte:h,pixelFormat:f,blockShape:_,blockIndex:y,filters:v,codec:b}=o,T=i.subarray(u,h+1),E=new Uint32Array(_[0]*_[1]*_[2]);let I;if(b!=="gzip_data")throw new Uo(`Unhandled codec: ${b}`);return I=(function(P,L){if(!globalThis.DecompressionStream&&L==="gzip_data")return Promise.resolve(((G=(function(ee){ee[0]==31&&ee[1]==139&&ee[2]==8||ms(6,"invalid gzip data");var ne=ee[3],ae=10;4&ne&&(ae+=2+(ee[10]|ee[11]<<8));for(var be=(ne>>3&1)+(ne>>4&1);be>0;be-=!ee[ae++]);return ae+(2&ne)})(V=P))+8>V.length&&ms(6,"invalid gzip data"),(function(ee,ne,ae,be){var he=ee.length;
7if(!he||ne.f&&!ne.l)return ae||new To(0);var Ee=!ae,Ce=Ee||ne.i!=2,Pe=ne.i;Ee&&(ae=new To(3*he));var Fe,Be,ze=function(Ei){var ui=ae.length;if(Ei>ui){var pi=new To(Math.max(2*ui,Ei));pi.set(ae),ae=pi}},De=ne.f||0,Se=ne.p||0,we=ne.b||0,Le=ne.l,Ze=ne.d,je=ne.m,dt=ne.n,Qe=8*he;do{if(!Le){De=ps(ee,Se,1);var rt=ps(ee,Se+1,3);if(Se+=3,!rt){var at=ee[(Ie=4+((Se+7)/8|0))-4]|ee[Ie-3]<<8,Ut=Ie+at;if(Ut>he){Pe&&ms(0);break}Ce&&ze(we+at),ae.set(ee.subarray(Ie,Ut),we),ne.b=we+=at,ne.p=Se=8*Ut,ne.f=De;continue}if(rt==1)Le=Cw,Ze=Pw,je=9,dt=5;else if(rt==2){var Ge=ps(ee,Se,31)+257,lt=ps(ee,Se+10,15)+4,It=Ge+ps(ee,Se+5,31)+1;Se+=14;for(var Zt=new To(It),Xt=new To(19),Rt=0;Rt<lt;++Rt)Xt[Iw[Rt]]=ps(ee,Se+3*Rt,7);Se+=3*lt;var Si=Y_(Xt),W=(1<<Si)-1,J=Xd(Xt,Si);for(Rt=0;Rt<It;){var Ie,ke=J[ps(ee,Se,W)];if(Se+=15&ke,(Ie=ke>>4)<16)Zt[Rt++]=Ie;else{var Ye=0,Ke=0;for(Ie==16?(Ke=3+ps(ee,Se,3),Se+=2,Ye=Zt[Rt-1]):Ie==17?(Ke=3+ps(ee,Se,7),Se+=3):Ie==18&&(Ke=11+ps(ee,Se,127),Se+=7);Ke--;)Zt[Rt++]=Ye}}var ft=Zt.subarray(0,Ge),mt=Zt.subarray(Ge);je=Y_(ft),dt=Y_(mt),Le=Xd(ft,je),Ze=Xd(mt,dt)}else ms(1);if(Se>Qe){Pe&&ms(0);break}}Ce&&ze(we+131072);for(var Ct=(1<<je)-1,kt=(1<<dt)-1,Nt=Se;;Nt=Se){var Gt=(Ye=Le[K_(ee,Se)&Ct])>>4;if((Se+=15&Ye)>Qe){Pe&&ms(0);break}if(Ye||ms(2),Gt<256)ae[we++]=Gt;else{if(Gt==256){Nt=Se,Le=null;break}var bt=Gt-254;Gt>264&&(bt=ps(ee,Se,(1<<(ai=Cv[Rt=Gt-257]))-1)+Dv[Rt],Se+=ai);var Et=Ze[K_(ee,Se)&kt],ti=Et>>4;if(Et||ms(3),Se+=15&Et,mt=Mw[ti],ti>3){var ai=Pv[ti];mt+=K_(ee,Se)&(1<<ai)-1,Se+=ai}if(Se>Qe){Pe&&ms(0);break}Ce&&ze(we+131072);var li=we+bt;if(we<mt){var vi=0-mt,Ci=Math.min(mt,li);for(vi+we<0&&ms(3);we<Ci;++we)ae[we]=(void 0)[vi+we]}for(;we<li;++we)ae[we]=ae[we-mt]}}ne.l=Le,ne.p=Nt,ne.b=we,ne.f=De,Le&&(De=1,ne.m=je,ne.d=Ze,ne.n=dt)}while(!De);return we!=ae.length&&Ee?(Fe=ae,((Be=we)==null||Be>Fe.length)&&(Be=Fe.length),new To(Fe.subarray(0,Be))):ae.subarray(0,we)})(V.subarray(G,-8),{i:2},new To(((D=V)[(B=D.length)-4]|D[B-3]<<8|D[B-2]<<16|D[B-1]<<24)>>>0))));var D,B,V,G;const K=Lw[L];if(!K)throw new Error(`Unhandled codec: ${L}`);const Z=new globalThis.DecompressionStream(K);return new Response(new Blob([P]).stream().pipeThrough(Z)).arrayBuffer().then((ee=>new Uint8Array(ee)))})(T,b).then((P=>((function(L,D){L.readFields(vw,D)})(new J_(P),E),new Fw[f](E.buffer)))),I.then((P=>{for(let L=v.length-1;L>=0;L--)switch(v[L]){case"delta_filter":ww(P,_);break;case"zigzag_filter":Tw(P);break;case"bitshuffle_filter":Sw(P,f);break;default:throw new Uo(`Unhandled filter "${v[L]}"`)}return{layerName:a,blockIndex:y,data:P}})).catch((P=>{throw P}))})))},ot(Bv,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),ot(Yp,"MapboxRasterTile"),ot(kv,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class Nv{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const o=e[i];this._stringToNumber[o]=i,this._numberToString[i]=o}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class Vv{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Xa($e,16,0),this.featureIndexArray=new od,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,o,a,u,h=0,f=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,a,u,h);const y=this.grid;for(let v=0;v<i.length;v++){const b=i[v],T=[1/0,1/0,-1/0,-1/0];for(let E=0;E<b.length;E++){const I=b[E];T[0]=Math.min(T[0],I.x),T[1]=Math.min(T[1],I.y),T[2]=Math.max(T[2],I.x),T[3]=Math.max(T[3],I.y)}f!==0&&(T[0]-=f,T[1]-=f,T[2]+=f,T[3]+=f),T[0]<$e&&T[1]<$e&&T[2]>=0&&T[3]>=0&&y.insert(_,T[0],T[1],T[2],T[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new me(new Ip(this.rawTileData)).layers,this.sourceLayerCoder=new Nv(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:o,transform:a,tileTransform:u,pixelPosMatrix:h,availableImages:f,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const y=i.queryRadius?i.queryRadius:0,v=o.bufferedTilespaceBounds,b=this.grid.query(v.min.x,v.min.y,v.max.x,v.max.y,((P,L,D,B)=>vn(o.bufferedTilespaceGeometry,P-y,L-y,D+y,B+y)));b.sort(kw);let T=null;a.elevation&&b.length>0&&(T=Yu.create(a.elevation,this.tileID));const E={};let I;for(let P=0;P<b.length;P++){const L=b[P];if(L===I)continue;I=L;const D=this.featureIndexArray.get(L);let B=null;
7this.is3DTile?this.loadMatchingModelFeature(E,D,e,o,a,_):this.loadMatchingFeature(E,D,e,f,_,((V,G,K,Z=0)=>(B||(B=ie(V,this.tileID.canonical,u)),G.queryIntersectsFeature(o,V,K,B,this.z,a,h,T,Z))))}return E}loadMatchingFeature(e,i,o,a,u,h){const{featureIndex:f,bucketIndex:_,sourceLayerIndex:y,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],T=o.layers,E=Object.keys(T);if(E.length&&!nt(E,b))return;const I=o.sourceCache,P=this.sourceLayerCoder.decode(y),L=this.vtLayers[P].feature(f),D=this.getId(L,P);for(let B=0;B<b.length;B++){const V=b[B];if(!T[V])continue;const{styleLayer:G,targets:K}=T[V];let Z={};D!==void 0&&(Z=I.getFeatureState(G.sourceLayer,D));const ee=!h||h(L,G,Z,v);if(!ee)continue;const ne=new hc(L,this.z,this.x,this.y,D);ne.tile=this.tileID.canonical,ne.state=Z;let ae=this.serializedLayersCache.get(V);ae||(ae=G.serialize(),ae.id=V,this.serializedLayersCache.set(V,ae)),ne.source=ae.source,ne.sourceLayer=ae["source-layer"],ne.layer=Object.assign({},ae),ne.layer.paint=Uv(ae.paint,G.paint,L,Z,a),ne.layer.layout=Uv(ae.layout,G.layout,L,Z,a);let be=!1;for(const he of K){this.updateFeatureProperties(ne,he);const{filter:Ee}=he;if(Ee){if(L.properties=ne.properties,Ee.needGeometry){const Ce=ue(L,!0);if(!Ee.filter(new Li(this.tileID.overscaledZ,{worldview:u}),Ce,this.tileID.canonical))continue}else if(!Ee.filter(new Li(this.tileID.overscaledZ,{worldview:u}),L))continue}be=!0,he.targetId&&this.addFeatureVariant(ne,he)}be&&this.appendToResult(e,V,f,ne,ee)}}loadMatchingModelFeature(e,i,o,a,u,h){const{featureIndex:f,bucketIndex:_}=i,y=this.bucketLayerIDs[_],v=o.layers,b=Object.keys(v);if(!b.length||nt(b,y))for(let T=0;T<y.length;T++){const E=y[T],{styleLayer:I,targets:P}=v[E];if(I.type!=="model")continue;const L=a.tile,D=L.getBucket(I);if(!(D&&D instanceof Gp))continue;const B=Hb(D,f,a,u);if(!B)continue;const{z:V,x:G,y:K}=L.tileID.canonical,{feature:Z,intersectionZ:ee,position:ne}=B;let ae={};Z.id!==void 0&&(ae=o.sourceCache.getFeatureState(I.sourceLayer,Z.id));const be=new hc({},V,G,K,Z.id);be.tile=this.tileID.canonical,be.state=ae,be.properties=Z.properties,be.geometry={type:"Point",coordinates:[ne.lng,ne.lat]};let he=this.serializedLayersCache.get(E);he||(he=I.serialize(),he.id=E,this.serializedLayersCache.set(E,he)),be.source=he.source,be.sourceLayer=he["source-layer"],be.layer=Object.assign({},he);let Ee=!1;for(const Ce of P){this.updateFeatureProperties(be,Ce);const{filter:Pe}=Ce;if(Pe){if(Z.properties=be.properties,Pe.needGeometry){if(!Pe.filter(new Li(this.tileID.overscaledZ,{worldview:h}),Z,this.tileID.canonical))continue}else if(!Pe.filter(new Li(this.tileID.overscaledZ,{worldview:h}),Z))continue}Ee=!0,Ce.targetId&&this.addFeatureVariant(be,Ce)}Ee&&this.appendToResult(e,E,f,be,ee)}}updateFeatureProperties(e,i,o){if(i.properties){const a={};for(const u in i.properties){const h=i.properties[u].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,o);h!=null&&(a[u]=h)}e.properties=a}}addFeatureVariant(e,i,o){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,o,a,u){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:o,feature:a,intersectionZ:u})}lookupSymbolFeatures(e,i,o,a,u,h){const f={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:o,featureIndex:_,layoutVertexArrayOffset:0},a,u,h);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:o}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(o),u=this.vtFeatures[a];if(u[i])return u[i];const h=this.vtLayers[a].feature(i);return u[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const o of i)if(e===o)return!0;return!1}getId(e,i){let o=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const u=Fs(a);if(u.result!=="success"){const h=u.value.map((f=>`${f.key}: ${f.message}`)).join(", ");return void tt(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=u.value}o=this.promoteIdExpression.evaluate({zoom:0},e)}else o=e.properties[a];typeof o=="boolean"&&(o=Number(o))}return o}}function Uv(r,e,i,o,a){return ge(r,((u,h)=>{const f=e instanceof ga?e.get(h):null;return f&&f.evaluate?f.evaluate(i,o,void 0,a):f}))}function kw(r,e){return e-r}ot(Vv,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const jv=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,095 bytes, line 7
7];class Q_{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,o]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=o>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const u=jv[15&o];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Q_(f,h,u,e)}constructor(e,i=64,o=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=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=jv.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${o}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=i,o}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return eg(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,o,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:f}=this,_=[0,u.length-1,0],y=[];for(;_.length;){const v=_.pop()||0,b=_.pop()||0,T=_.pop()||0;if(b-T<=f){for(let L=T;L<=b;L++){const D=h[2*L],B=h[2*L+1];D>=e&&D<=o&&B>=i&&B<=a&&y.push(u[L])}continue}const E=T+b>>1,I=h[2*E],P=h[2*E+1];I>=e&&I<=o&&P>=i&&P<=a&&y.push(u[E]),(v===0?e<=I:i<=P)&&(_.push(T),_.push(E-1),_.push(1-v)),(v===0?o>=I:a>=P)&&(_.push(E+1),_.push(b),_.push(1-v))}return y}within(e,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:u,nodeSize:h}=this,f=[0,a.length-1,0],_=[],y=o*o;for(;f.length;){const v=f.pop()||0,b=f.pop()||0,T=f.pop()||0;if(b-T<=h){for(let L=T;L<=b;L++)Hv(u[2*L],u[2*L+1],e,i)<=y&&_.push(a[L]);continue}const E=T+b>>1,I=u[2*E],P=u[2*E+1];Hv(I,P,e,i)<=y&&_.push(a[E]),(v===0?e-o<=I:i-o<=P)&&(f.push(T),f.push(E-1),f.push(1-v)),(v===0?e+o>=I:i+o>=P)&&(f.push(E+1),f.push(b),f.push(1-v))}return _}}function eg(r,e,i,o,a,u){if(a-o<=i)return;const h=o+a>>1;Gv(r,e,h,o,a,u),eg(r,e,i,o,h-1,1-u),eg(r,e,i,h+1,a,1-u)}function Gv(r,e,i,o,a,u){for(;a>o;){if(a-o>600){const y=a-o+1,v=i-o+1,b=Math.log(y),T=.5*Math.exp(2*b/3),E=.5*Math.sqrt(b*T*(y-T)/y)*(v-y/2<0?-1:1);Gv(r,e,i,Math.max(o,Math.floor(i-v*T/y+E)),Math.min(a,Math.floor(i+(y-v)*T/y+E)),u)}const h=e[2*i+u];let f=o,_=a;for(Kd(r,e,o,i),e[2*a+u]>h&&Kd(r,e,o,a);f<_;){for(Kd(r,e,f,_),f++,_--;e[2*f+u]<h;)f++;for(;e[2*_+u]>h;)_--}e[2*o+u]===h?Kd(r,e,o,_):(_++,Kd(r,e,_,a)),_<=i&&(o=_+1),i<=_&&(a=_-1)}}function Kd(r,e,i,o){tg(r,i,o),tg(e,2*i,2*o),tg(e,2*i+1,2*o+1)}function tg(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}function Hv(r,e,i,o){const a=r-i,u=e-o;return a*a+u*u}s.$=Pc,s.A=Xo,s.B=xo,s.C=2,s.D=ku,s.E=la,s.F=zd,s.G=_x,s.H=Cc,s.I=fn,s.J=jf,s.K=ht,s.L=Fa,s.M=eu,s.N=Ul,s.O=Cf,s.P=Oe,s.Q=jl,s.R=vl,s.S=uu,s.T=c_,s.U=Fs,s.V=jp,s.W=Nh,s.X=Ua,s.Y=Va,s.Z=Ol,s._=gn,s.a=function(r){return qt.API_CDN_URL_REGEX.test(r)},s.a$=M,s.a0=St,s.a1=Yn,s.a2=Fo,s.a3=class extends jp{},s.a4=tu,s.a5=Mf,s.a6=fe,s.a7=function(r){const e=r.value;return e?St(e)?V_(e,!0)?[]:[new jp(r.key,e,`invalid url "${e}"`)]:[new jp(r.key,e,`string expected, "${ht(e)}" found`)]:[]},s.a8=Bf,s.a9=sr,s.aA=O,s.aB=Gi,s.aC=tn,s.aD=on,s.aE=Ai,s.aF=g,s.aG=j,s.aH=function(r,e){const i={};for(let o=0;o<e.length;o++){const a=e[o];a in r&&(i[a]=r[a])}return i},s.aI=c,s.aJ=x,s.aK=class{constructor(r){this.entries={}
7,this.scheduler=r}request(r,e,i,o){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[u,h]=a.result;return this.scheduler?this.scheduler.add((()=>{o(u,h)}),e):o(u,h),()=>{}}return a.callbacks.push(o),a.cancel||(a.cancel=i(((u,h)=>{a.result=[u,h];for(const f of a.callbacks)this.scheduler?this.scheduler.add((()=>{f(u,h)}),e):f(u,h);setTimeout((()=>delete this.entries[r]),3e3)}))),()=>{a.result||(a.callbacks=a.callbacks.filter((u=>u!==o)),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},s.aL=function(r,e,i){const o=JSON.stringify(r.request);return r.data&&(this.deduped.entries[o]={result:[null,r.data]}),this.deduped.request(o,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},(a=>{const u=Wo(r.request,((h,f,_)=>{h?a(h):f&&a(null,{rawData:f,vectorTile:i?void 0:new me(new Ip(f)),responseHeaders:new Map(_.entries())})}));return()=>{u.cancel(),a()}}),e)},s.aM=function(r){return r?{cacheControl:r.get("Cache-Control"),expires:r.get("Expires")}:{cacheControl:void 0,expires:void 0}},s.aN=Ln,s.aO=function(r){Xn++,Xn>xc&&(r.getActor().send("enforceCacheSizeLimit",yc),Xn=0)},s.aP=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log2(r)))},s.aQ=ir,s.aR=qx,s.aS=Kx,s.aT=n,s.aU=Hx,s.aV=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let o=0;o<r.length;o++){const a=document.createElement("source");rm(r[o])||(i.crossOrigin="Anonymous"),a.src=r[o],i.appendChild(a)}return{cancel:()=>{}}},s.aW=Ad,s.aX=dc,s.aY=de,s.aZ=Fd,s.a_=S,s.aa=He,s.ab=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return Pt(r.expression.evaluate(e))}interpolate(r,e,i){return{x:wt(r.x,e.x,i),y:wt(r.y,e.y,i),z:wt(r.z,e.z,i),azimuthal:wt(r.azimuthal,e.azimuthal,i),polar:wt(r.polar,e.polar,i)}}},s.ac=Li,s.ad=pa,s.ae=U,s.af=gr,s.ag=Ir,s.ah=N,s.ai=ga,s.aj=sl,s.ak=wt,s.al=$e,s.am=lh,s.an=oi,s.ao=yi,s.ap=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return(function([i,o]){const a=Pt([1,i,o]);return{x:a.x,y:a.y,z:a.z}})(r.expression.evaluate(e))}interpolate(r,e,i){return{x:wt(r.x,e.x,i),y:wt(r.y,e.y,i),z:wt(r.z,e.z,i)}}},s.aq=function(r,e,i=0,o=!0){const a=new Oe(i,i),u=r.sub(a),h=e.add(a),f=[u,new Oe(h.x,u.y),h,new Oe(u.x,h.y)];return o&&f.push(u.clone()),f},s.ar=function(r,e){const i=[];for(let o=0;o<r.length;o++){const a=q(o-1,-1,r.length-1),u=q(o+1,-1,r.length-1),h=r[o],f=r[u],_=r[a].sub(h).unit(),y=f.sub(h).unit(),v=y.angleWithSep(_.x,_.y),b=_.add(y).unit().mult(-1*e/Math.sin(v/2));i.push(h.add(b))}return i},s.as=Cx,s.at=vn,s.au=function(r,e,i=0){return nr(((e.x-i)*r.scale-r.x)*$e,(e.y*r.scale-r.y)*$e,A(e.z,e.y))},s.av=xr,s.aw=Bi,s.ax=st,s.ay=Hy,s.az=function(r){let e=1/0,i=1/0,o=-1/0,a=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),o=Math.max(o,u.x),a=Math.max(a,u.y);return{min:new Oe(e,i),max:new Oe(o,a)}},s.b=function(r){return qt.API_FONTS_REGEX.test(r)},s.b$=Hg,s.b0=Ar,s.b1=Ja,s.b2=ce,s.b3=Kf,s.b4=Bp,s.b5=function(){is.isLoading()||is.isLoaded()||$l()!=="deferred"||kf()},s.b6=hu,s.b7=ue,s.b8=hc,s.b9=or,s.bA=Ni,s.bB=kn,s.bC=lo,s.bD=function(r,e){const{x:i,y:o}=r.point,a=cg(i,o,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Gi(a,a,Bm(wo(e)))},s.bE=so,s.bF=Dn,s.bG=fc,s.bH=qr,s.bI=en,s.bJ=fr,s.bK=qu,s.bL=$n,s.bM=A_,s.bN=function(r,e,i,o,a){const u=5*e+2;r.float32[u+0]=i,r.float32[u+1]=o,r.float32[u+2]=a},s.bO=Xu,s.bP=Tn,s.bQ=$o,s.bR=Ts,s.bS=mc,s.bT=q,s.bU=function(r,e,i,o){var a=new $i(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=o,a},s.bV=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,o=1<<i,a=Math.floor(r.x),u=Math.floor((r.x-a)*o),h=Math.floor(r.y*o),f=this.findDEMTileFor(new ir(i,a,i,u,h));return!(!f||!f.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const o=this._source();if(!o||r.y<0||r.y>1)return e;const a=o.getSource().maxzoom,u=1<<a,h=Math.floor(r.x),f=r.x-h,_=new ir(a,h,a,Math.floor(f*u),Math.floor(r.y*u)),y=this.findDEMTileFor(_);if(!y||!y.dem)return e;const v=y.dem,b=1<<y.tileID.canonical.z,T=(f*b-y.tileID.canonical.x)*v.dim,E=(r.y*b-y.tileID.canonical.y)*v.dim,I=Math.floor(T),P=Math.floor(E);return(i?this.exaggeration():1)*wt(wt(v.get(I,P),v.get(I,P+1),E-P),wt(v.get(I+1,P),v.get(I+1,P+1),E-P),T-I)}static getAtTileOffset(r,e,i,o){const a=1<<r.canonical.z;return o?o.pointElevation(e):i?i.getAtPointOrZero(new U(r.wrap+(r.canonical.x+e.x/$e)/a,(r.canonical.y+e.
7y/$e)/a)):0}static getAtTileOffsetFunc(r,e,i,o){return(a,u,h)=>{const f=this.getAtTileOffset(r,a,u,h),_=o.upVector(r.canonical,a.x,a.y);return Zi(_,_,f*o.upVectorScale(r.canonical,e,i).metersToTile),_}}getForTilePoints(r,e,i,o){if(this.isUsingMockSource())return!1;const a=Yu.create(this,r,o);return!!a&&(e.forEach((u=>{u[2]=this.exaggeration()*a.getElevationAt(u[0],u[1],i)})),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,o=e.tileID,a=1<<r.canonical.z-o.canonical.z;let u=r.canonical.x/a-o.canonical.x,h=r.canonical.y/a-o.canonical.y,f=0;for(let _=0;_<r.canonical.z-o.canonical.z&&!i.leaves[f];_++){u*=2,h*=2;const y=2*Math.floor(h)+Math.floor(u);f=i.childOffsets[f]+y,u%=1,h%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,o=Number.MIN_VALUE;for(const a of r){const u=this.getMinMaxForTile(a.tileID);u&&(i=Math.min(i,u.min),o=Math.max(o,u.max),e=!0)}return e?{min:i,max:o}:null}},s.bW=mp,s.bX=ni,s.bY=Br,s.bZ=Vg,s.b_=Jx,s.ba=y_,s.bb=Wm,s.bc=ie,s.bd=Bs,s.be=Vs,s.bf=nl,s.bg=Wi,s.bh=Ou,s.bi=B_,s.bj=function(r,e){const i=sl(e.zoom);if(i===0)return wo(r);const o=np(r),a=km(o),u=g(o.getWest())*e.worldSize,h=g(o.getEast())*e.worldSize,f=x(o.getNorth())*e.worldSize,_=x(o.getSouth())*e.worldSize,y=[u,f,0],v=[h,f,0],b=[u,_,0],T=[h,_,0],E=Xr([],e.globeMatrix);return gr(y,y,E),gr(v,v,E),gr(b,b,E),gr(T,T,E),a[0]=us(a[0],b,i),a[1]=us(a[1],T,i),a[2]=us(a[2],v,i),a[3]=us(a[3],y,i),ut.fromPoints(a)},s.bk=sp,s.bl=Xr,s.bm=hd,s.bn=us,s.bo=Ka,s.bp=rc,s.bq=So,s.br=Qr,s.bs=Yp,s.bt=Ip,s.bu=Wo,s.bv=function(r,e){const i=[];for(const o in r)o in e||i.push(o);return i},s.bw=oe,s.bx=["type","source","source-layer","minzoom","maxzoom","filter","layout"],s.by=Zo,s.bz=mi,s.c=Yr,s.c$=function(r,e,i){let o=0;for(let a=0;a<2;++a)r[a]>0&&(o+=(r[a]-0)*(r[a]-0)),e[a]<0&&(o+=(0-e[a])*(0-e[a]));return o},s.c0=qg,s.c1=S_,s.c2=Tx,s.c3=z_,s.c4=Q_,s.c5=Zi,s.c6=Pa,s.c7=Ra,s.c8=function(r,e,i){i*=.5;var o=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+a*f,r[1]=a*_-o*f,r[2]=u*_+h*f,r[3]=h*_-u*f,r},s.c9=co,s.cA=ei,s.cB=ci,s.cC=Cy,s.cD=Mi,s.cE=sg,s.cF=function(r,e,i,o,a,u,h,f,_){if(_.name==="globe")return sg(r,e,new Mi(i,o,a),!1);const y=Fd({z:i,x:o,y:a},_);
7return new ut([(u+y.x/y.scale)*e,e*(y.y/y.scale),h],[(u+y.x2/y.scale)*e,e*(y.y2/y.scale),f])},s.cG=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},s.cH=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},s.cI=function(r){const e=Math.round((r+45+360)%360/90)%4;return nh[e]},s.cJ=C,s.cK=bs,s.cL=Lu,s.cM=function(r){const e=Ni(new Float64Array(16));Gi(e,r.pixelMatrix,r.globeMatrix);const i=[0,io,0],o=[0,ro,0];return gr(i,i,e),gr(o,o,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!Vm(r,new n(r.center.lat,90)),o[0]>0&&o[0]<=r.width&&o[1]>0&&o[1]<=r.height&&!Vm(r,new n(r.center.lat,-90))]},s.cN=function(r,e){const{scale:i}=r.tileTransform,o=i*$e/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return(function(a,u,h){var f=u[1],_=u[2],y=u[3],v=h[0],b=h[1];return a[0]=u[0]*v,a[1]=f*v,a[2]=_*b,a[3]=y*b,a})(new Float32Array(4),e.inverseAdjustmentMatrix,[o,o])},s.cO=vp,s.cP=Bn,s.cQ=My,s.cR=function(r){const e=My(r,!0);return so([],[e[0],e[1],e[4],e[5]])},s.cS=Hr,s.cT=Je,s.cU=Wn,s.cV=function(r){const{x:e,y:i}=r.point,{lng:o,lat:a}=r._center;return cg(e,i,r.worldSize,o,a)},s.cW=cn,s.cX=hn,s.cY=Yi,s.cZ=Kr,s.c_=to,s.ca=lr,s.cb=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},s.cc=dr,s.cd=function(r,e,i,o,a){var u=1/Math.tan(e/2);if(r[0]=u/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0){var h=1/(o-a);r[10]=(a+o)*h,r[14]=2*a*o*h}else r[10]=-1,r[14]=-2*o;return r},s.ce=function(r,e,i,o,a,u,h){var f=1/(e-i),_=1/(o-a),y=1/(u-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*y,r[11]=0,r[12]=(e+i)*f,r[13]=(a+o)*_,r[14]=(h+u)*y,r[15]=1,r},s.cf=w,s.cg=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},s.ch=Pu,s.ci=Kl,s.cj=Mr,s.ck=No,s.cl=Ql,s.cm=Lx,s.cn=function(){var r=new $i(4);return $i!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},s.co=function(r,e,i){var o=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+u*f,r[1]=a*_+h*f,r[2]=o*-f+u*_,r[3]=a*-f+h*_,r},s.cp=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},s.cq=un,s.cr=function(r){var e=r[0],i=r[1],o=r[2],a=r[3];return Math.sqrt(e*e+i*i+o*o+a*a)},s.cs=Js,s.ct=vs,s.cu=yr,s.cv=3,s.cw=2,s.cx=7,s.cy=6,s.cz=Ws,s.d=function(r){return qt.API_TILEJSON_REGEX.test(r)},s.d$=class{constructor(r,e,i,o){this.context=r,this.format=o,this.size=i,this.texture=r.gl.createTexture();const[a,u,h]=this.size,{gl:f}=r;f.bindTexture(f.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&f.texImage3D(f.TEXTURE_3D,0,this.format,a,u,h,0,a_(this.format),l_(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_3D,this.texture),r!==this.minFilter&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MAG_FILTER,r),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},s.d0=function(r){return r*r*r*r*r},s.d1=m,s.d2=45,s.d3=Ru,s.d4=function(r,e,i){const o=Math.sqrt(r*r+e*e+i*i),a=o>0?Math.acos(i/o)*ta:0;let u=r!==0||e!==0?Math.atan2(-e,-r)*ta+90:0;return u<0&&(u+=360),[o,u,a]},s.d5=nr,s.d6=Pt,s.d7=F,s.d8=gi,s.d9=ut,s.dA=function(r){return r({pluginStatus:yn,pluginURL:ts}),lu.on("pluginStateChange",r),r},s.dB=Jl,s.dC=class extends ns{constructor(r){super(r),this.current=zu}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let o=0;o<9;o++)if(i[o]!==this.current[o]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.dD=ia,s.dE=function(r,e,i){const o=sl(i.zoom),a=r.style.map._antialias,u=r.terrain&&r.terrain.exaggeration()>0;return o===0&&!a&&!u},s.dF=function(r){const e=r.pixelsPerMeter,i=e/w(1,r.center.lat),o=Ni(new Float64Array(16));return Qr(o,o,[r.point.x,r.point.y,0]),Hr(o,o,[i,i,e]),Float32Array.from(o)},s.dG=np,s.dH=function(r){const e=C-5;r=O(r,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(oi(r))),3);return Math.round(i*(ud.length-1))},s.dI=function(r,e,i,o){const a=e.getNorth(),u=e.getSouth(),h=e.getWest(),f=e.getEast(),_=1<<r.z,y=f-h,v=a-u,b=y/il,T=-v/ud[i],E=[0,b,0,T,0,0,a,h,0];if(r.z>0){const I=180/o;rr(E,E,[I/y+1,0,0,0,I/v+1,0,-.5*I/b,.5*I/T,1])}return E[2]=_,E[5]=r.x,E[8]=r.y,E},s.dJ=wo,s.dK=function(r,e,i){const o=Ni(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return wn(o,i.globeMatrix,a),Float32Array.from(o)},s.dL=wg,s.dM=Vo,s.dN=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},s.dO=Ca,s.dP=function(r,e){var i=Math.sin(e),o=Math.cos(e);return r[0]=o,r[1]=i,r[2]=0,r[3]=-i,r[4]=o,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},s.dQ=xs,s.dR=lg,s.dS=ii,s.dT=er,s.dU=256,s.dV=function(r,e){const i=[0,0,0];return gr(i,i,sp(wo(e.canonical))),gr(i,i,r),i},s.dW=r=>({u_matrix:new Ql(r),u_texsize:new No(r),u_pixels_to_tile_units:new Du(r),u_device_pixel_ratio:new Mr(r),u_width_scale:new Mr(r),u_floor_width_scale:new Mr(r),u_image:new Pu(r),u_units_to_pixels:new No(r),u_tile_units_to_pixels:new Mr(r),u_alpha_discard_threshold:new Mr(r),u_trim_offset:new No(r),u_trim_fade_range:new No(r),u_trim_color:new Ru(r),u_zbias_factor:new Mr(r),u_tile_to_meter:new Mr(r),u_ground_shadow_factor:new Kl(r),u_pattern_transition:new Mr(r)}),s.dX=r=>({u_matrix:new Ql(r),u_pixels_to_tile_units:new Du(r),u_device_pixel_ratio:new Mr(r),u_width_scale:new Mr(r),u_floor_width_scale:new Mr(r),u_units_to_pixels:new No(r),u_dash_image:new Pu(r),u_gradient_image:new Pu(r),u_image_height:new Mr(r),u_texsize:new No(r),u_tile_units_to_pixels:new Mr(r),u_alpha_discard_threshold:new Mr(r),u_trim_offset:new No(r),u_trim_fade_range:new No(r),u_trim_color:new Ru(r),u_zbias_factor:new Mr(r),u_tile_to_meter:new Mr(r),u_ground_shadow_factor:new Kl(r)}),s.dY=r=>({u_camera_to_center_distance:new Mr(r),u_extrude_scale:new Du(r),u_device_pixel_ratio:new Mr(r),u_matrix:new Ql(r),u_inv_rot_matrix:new Ql(r),u_merc_center:new No(r),u_tile_id:new Kl(r),u_zoom_transition:new Mr(r),u_up_dir:new Kl(r),u_emissive_strength:new Mr(r)}),s.dZ=bu,s.d_=W1,s.da=Or,s.db=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},s.dc=Ay,s.dd=m_,s.de=zy,s.df=V_,s.dg=function(r,e){return r.readFields(Zb,{icons:[]},e)},s.dh=_p,s.di=$u,s.dj=C_,s.dk=wc,s.dl=ql,s.dm=Da,s.dn=Sc,s.dp=Me,s.dq=function(r){const e=r.indexOf(va);return e>=0?r.slice(0,e):r},s.dr=function(r){return r.indexOf(va)>=0},s.ds=function(r){const e=r.lastIndexOf(va);return e>=0?r.slice(e+1):""},s.dt=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.du=function(r,e,i,o){return r.type==="custom"?new Vb(r,e):new qb[r.type](r,e,i,o)},s.dv=Ne,s.dw=function(r){const e=r.indexOf(va);return e>=0?r.slice(e+1):""},s.dx=class extends hc{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},s.dy=lu,s.dz=aa,s.e=qt,s.e$=Vt,s.e0=dg,s.e1=(r,e,i,o,a,u)=>{const h=r.transform,f=h.projection.name==="globe";let _;if(u.paint.get("circle-pitch-alignment")==="map")if(f){const v=lg(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=h.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const y={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Fr.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:u0,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:u.paint.get("circle-emissive-strength")};if(f){y.u_inv_rot_matrix=o,y.u_merc_center=a,y.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],y.u_zoom_transition=sl(h.zoom);const v=a[0]*$e,b=a[1]*$e;y.u_up_dir=h.projection.upVector(new Mi(0,0,0),v,b)}return y},s.e2=Wy,s.e3=_n,s.e4=(r,e,i,o,a,u,h,f,_,y)=>{const v=r.transform,b=v.pitch<15?qy(.07,.7,O((14-v.zoom)/5,0,1)):.07,T=i.paint.get("line-trim-color-use-theme").
7constantOr("default")==="none";return{u_matrix:Zy(r,e,i,o),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:v.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:u,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:$y(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:f,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(T?null:i.lut).toArray01(),u_zbias_factor:b,u_tile_to_meter:F(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:y}},s.e5=(r,e,i,o,a,u,h,f,_,y)=>{const v=r.transform,b=v.calculatePixelsToTileUnitsMatrix(e),T=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",E=v.pitch<15?qy(.07,.7,O((14-v.zoom)/5,0,1)):.07;return{u_matrix:Zy(r,e,i,o),u_pixels_to_tile_units:b,u_device_pixel_ratio:u,u_width_scale:h,u_floor_width_scale:f,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:Xy(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:$y(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(T?null:i.lut).toArray01(),u_zbias_factor:E,u_tile_to_meter:F(e.tileID.canonical,0),u_ground_shadow_factor:y}},s.e6=ye,s.e7=dd,s.e8=A,s.e9=oo,s.eA=function(r,e){var i=2*Math.acos(e[3]),o=Math.sin(i/2);return o>Wr?(r[0]=e[0]/o,r[1]=e[1]/o,r[2]=e[2]/o):(r[0]=1,r[1]=0,r[2]=0),i},s.eB=G_,s.eC=Tp,s.eD=wp,s.eE=[1,1,1],s.eF=Yu,s.eG=Xs,s.eH=function(r,e,i,o){var a=e[0],u=e[1],h=e[2],f=e[3];return r[0]=a+o*(i[0]-a),r[1]=u+o*(i[1]-u),r[2]=h+o*(i[2]-h),r[3]=f+o*(i[3]-f),r},s.eI=Uu,s.eJ=Gn,s.eK=Bo,s.eL=function(r,e,i,o,a,u,h,f,_,y,v,b,T,E,I,P){var L=new $i(16);return L[0]=r,L[1]=e,L[2]=i,L[3]=o,L[4]=a,L[5]=u,L[6]=h,L[7]=f,L[8]=_,L[9]=y,L[10]=v,L[11]=b,L[12]=T,L[13]=E,L[14]=I,L[15]=P,L},s.eM=l,s.eN=el,s.eO=ed,s.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Oe(1/0,1/0),max:new Oe(-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=jg(new Oe(0,0),new Oe($e,$e),r),o=[];if(e&&!Xm(i,this._globalClipBounds))return o;for(const a of this._activeRegions){if(a.hiddenByOverlap||!Xm(i,a))continue;const u=N0(a.min,a.max,r);o.push({min:u.min,max:u.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return o}setSources(r){this._setSources(r.map((e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const o of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(o).buckets[e.layer];a&&a.updateFootprints(o.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(),o=r.getClipMask(),a=r.getClipScope();for(const u of e){if(!u.footprint)continue;const h=jg(u.footprint.min,u.footprint.max,u.id);this._activeRegions.push({min:h.min,max:h.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:u.id,footprint:u.footprint,order:i,clipMask:o,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort(((e,i)=>e.priority-i.priority||hp(e.min,i.min)||hp(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(function(o,a){const u=(h,f)=>h+f;return o.length-a.length||o.reduce(u,"").localeCompare(a.reduce(u,""))})(e.clipScope,i.clipScope)));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],o=this._prevRegions[e];r=i.priority!==o.priority||!Ug(i,o)||i.order!==o.order||i.clipMask!==o.clipMask||!Zo(i.clipScope,o.clipScope),this._activeRegions[e].hiddenByOverlap=o.hiddenByOverlap,++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==yd&&(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 o=this._activeRegions;if(i>=o.length)return i;const a=o[i].priority;for(;i<o.length&&o[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,o=e(i);for(;i!==o;){let a=i;const u=i;for(;a!==o;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let f=0;f<u;f++){const _=this._activeRegions[f];if(!_.hiddenByOverlap&&h.order===yd&&Xm(h,_)&&(h.hiddenByOverlap=Gg(h.footprint,h.tileId,_.footprint,_.tileId),h.hiddenByOverlap))break}++a}i=o,o=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},s.eQ=yd,s.eR=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new Bs,o=new Ar,a=[],u=r+1+2,h=e[0]+1,f=e[0]+1+(1+e.length),_=(y,v,b)=>{let T=y===u-1?y-2:y===0?y:y-1;return T+=b?24575:0,[T,v]};for(let y=0;y<u;++y)i.emplaceBack(..._(y,0,!0));for(let y=0;y<h;++y)for(let v=0;v<u;++v)i.emplaceBack(..._(v,y,(v===0||v===u-1)&&!0));for(let y=0;y<e.length;++y){const v=e[y];for(let b=0;b<u;++b)i.emplaceBack(..._(b,v,!0))}for(let y=0;y<e.length;++y){const v=o.length,b=e[y]+1+2,T=new Ar;for(let P=0;P<b-1;P++){const L=P===b-2,D=L?u*(f-e.length+y-P):u;for(let B=0;B<u-1;B++){const V=P*u+B;P===0||L||B===0||B===u-2?(T.emplaceBack(V+1,V,V+D),T.emplaceBack(V+D,V+D+1,V+1)):(o.emplaceBack(V+1,V,V+D),o.emplaceBack(V+D,V+D+1,V+1))}}const E=Wi.simpleSegment(0,v,i.length,o.length-v);for(let P=0;P<T.uint16.length;P+=3)o.emplaceBack(T.uint16[P],T.uint16[P+1],T.uint16[P+2]);const I=Wi.simpleSegment(0,v,i.length,o.length-v);a.push({withoutSkirts:E,withSkirts:I})}return{vertices:i,indices:o,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(il,ud);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,nl.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Ar;for(let h=0;h<=il;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new wa,o=new wa,a=new wa,u=new wa;this._poleSegments=[];for(let h=0,f=0;h<to;h++){const _=360/(1<<h);i.emplaceBack(0,-on,0,.5,0),o.emplaceBack(0,-on,0,.5,1),a.emplaceBack(0,-on,0,.5,.5),u.emplaceBack(0,-on,0,.5,.5);for(let y=0;y<=il;y++){let v=y/il,b=0;const T=wt(0,_,v),[E,I,P]=Ta(l0,c0,T,on);i.emplaceBack(E,I,P,v,b),o.emplaceBack(E,I,P,v,1-b);const L=oi(T);v=.5+.5*Math.sin(L),b=.5+.5*Math.cos(L),a.emplaceBack(E,I,P,v,b),u.emplaceBack(E,I,P,v,1-b)}this._poleSegments.push(Wi.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,bo,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(o,bo,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,bo,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(u,bo,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},s.eS=Ng,s.eT=yl,s.eU=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},s.eV=pe,s.eW=k,s.eX=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},s.eY=ih,s.eZ=rl,s.e_=pc,s.ea=pp,s.eb=oy,s.ec=Ea,s.ed=Xg,s.ee=Wg,s.ef=R,s.eg=function(r,e){if(r===e){var i=e[1],o=e[2],a=e[3],u=e[6],h=e[7],f=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=o,r[9]=u,r[11]=e[14],r[12]=a,r[13]=h,r[14]=f}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},s.eh=Nb,s.ei=jt,s.ej=id,s.ek=256,s.el=Bm,s.em=jn,s.en=wn,s.eo=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},s.ep=wa,s.eq=Ef,s.er=Qh,s.es=function(r,e,i,o,a){return O((r-e)/(i-e)*(a-o)+o,o,a)},s.et=qo,s.eu=function(r,e){var i=e[0],o=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=v*h-f*y,T=-v*u+f*_,E=y*u
7-h*_,I=i*b+o*T+a*E;return I?(r[0]=b*(I=1/I),r[1]=(-v*o+a*y)*I,r[2]=(f*o-a*h)*I,r[3]=T*I,r[4]=(v*i-a*_)*I,r[5]=(-f*i+a*u)*I,r[6]=E*I,r[7]=(-y*i+o*_)*I,r[8]=(h*i-o*u)*I,r):null},s.ev=2,s.ew=ys,s.ex=Ho,s.ey=Sr,s.ez=function(r,e){var i=new $i(3);Sr(i,e);var o=1/i[0],a=1/i[1],u=1/i[2],h=e[0]*o,f=e[1]*a,_=e[2]*u,y=e[4]*o,v=e[5]*a,b=e[6]*u,T=e[8]*o,E=e[9]*a,I=e[10]*u,P=h+v+I,L=0;return P>0?(L=2*Math.sqrt(P+1),r[3]=.25*L,r[0]=(b-E)/L,r[1]=(T-_)/L,r[2]=(f-y)/L):h>v&&h>I?(L=2*Math.sqrt(1+h-v-I),r[3]=(b-E)/L,r[0]=.25*L,r[1]=(f+y)/L,r[2]=(T+_)/L):v>I?(L=2*Math.sqrt(1+v-h-I),r[3]=(T-_)/L,r[0]=(f+y)/L,r[1]=.25*L,r[2]=(b+E)/L):(L=2*Math.sqrt(1+I-h-v),r[3]=(f-y)/L,r[0]=(T+_)/L,r[1]=(b+E)/L,r[2]=.25*L),r},s.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,((e,i)=>String.fromCharCode(+("0x"+i)))))},s.f0=function([r,e,i]){const o=Math.hypot(r,e,i),a=Math.atan2(r,i),u=.5*Math.PI-Math.acos(-e/o);return new n(hn(a),hn(u))},s.f1=ws,s.f2=u_,s.f3=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!(function(i){if(vr==null){const o=i.navigator?i.navigator.userAgent:null;vr=!!i.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return vr})(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},s.f4=function(r,e){yc=r,xc=e},s.f5=Vm,s.f6=ug,s.f7=function(r){const e=[0,0,0],i=Ni(new Float64Array(16));return Gi(i,r.pixelMatrix,r.globeMatrix),gr(e,e,i),new Oe(e[0],e[1])},s.f8=function(){const r=Sd;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(t_),Sd=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},s.f9=function(){_p().acquire(t_)},s.fA=Xp,s.fB=le,s.fC=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==wy){const i=new Uint32Array(r,0,7),[,,o,a,u,h]=i;e=i.byteLength+a+u+h+u,(o!==r.byteLength||e>=r.byteLength)&&tt("Invalid b3dm header information.")}return Iy(r,e)},s.fD=function(r,e){const i=m_(r);for(const o of i){for(const a of o.meshes)_1(a);o.lights&&(o.lightMeshIndex=o.meshes.length,o.meshes.push(g1(o.lights,e)))}return i},s.fE=Gp,s.fF=Kt,s.fG=gy,s.fH=is,s.fI=On,s.fJ=function(r){po(),Mo?.then((e=>{e.keys().then((i=>{for(let o=0;o<i.length-r;o++)e.delete(i[o]).catch((a=>tt(a.message)))})).catch((i=>tt(i.message)))})).catch((e=>tt(e.message)))},s.fa=$l,s.fb=function(r,e,i=!1){if(yn===On.deferred||yn===On.loading||yn===On.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");ts=Fr.resolveURL(r),yn=On.deferred,Gh=e,au(),i||kf()},s.fc=function(r){Bu=Fr.resolveURL(r),Nu||(Nu=new ku(_p(),new la)),Nu.broadcast("setMeshoptUrl",Bu)},s.fd=vy,s.fe=function(r){n_=Fr.resolveURL(r),Nu||(Nu=new ku(_p(),new la)),Nu.broadcast("setDracoUrl",n_)},s.ff=xy,s.fg=Td,s.fh=function(r){const e=fo();if(!e)return;const i=e.delete(gc);r&&i.then((()=>r())).catch(r)},s.fi=sc,s.fj=ot,s.fk=al,s.fl=fs,s.fm=Nv,s.fn=Vv,s.fo=Uy,s.fp=Te,s.fq="hd_road_elevation",s.fr=di,s.fs=ge,s.ft=Sa,s.fu=M_,s.fv=cc,s.fw=function(r,e,i,o,a,u,h,f=1,_,y,v){r.createArrays(),r.tilePixelRatio=$e/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const b=r.layers[0].layout,T=r.layers[0]._unevaluatedLayout._values,E={};E.scaleFactor=f,E.textSizeScaleRange=b.get("text-size-scale-range"),E.iconSizeScaleRange=b.get("icon-size-scale-range");const[I,P]=E.textSizeScaleRange,[L,D]=E.iconSizeScaleRange;E.textScaleFactor=O(E.scaleFactor,I,P),E.iconScaleFactor=O(E.scaleFactor,L,D);const B=T["text-size"],V=T["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:ae,maxZoom:be}=r.textSizeData;E.compositeTextSizes=[B.possiblyEvaluate(new Li(ae,{worldview:v}),u),B.possiblyEvaluate(new Li(be,{worldview:v}),u)]}if(r.iconSizeData.kind==="composite"){const{minZoom:ae,maxZoom:be}=r.iconSizeData;E.compositeIconSizes=[V.possiblyEvaluate(new Li(ae,{worldview:v}),u),V.possiblyEvaluate(new Li(be,{worldview:v}),u)]}E.layoutTextSize=B.possiblyEvaluate(new Li(h+1,{worldview:v}),u),E.layoutIconSize=V.possiblyEvaluate(new Li(h+1,{worldview:v}),u),E.textMaxSize=B.possiblyEvaluate(new Li(18,{worldview:v}),u);const G=b.get("symbol-placement"),K=b.get("text-rotation-alignment")==="map"&&G!=="point",Z=b.get("text-size");let ee=!1;const ne=[];for(const ae of r.features){const be=b.get("text-font").evaluate(ae,{},u).join(","),he=Z.evaluate(ae,{},u)*E.textScaleFactor,Ee=E.layoutTextSize.evaluate(ae,{},u)*E.textScaleFactor,Ce=E.layoutIconSize.evaluate(ae,{},u)*E.iconScaleFactor,Pe={horizontal:{},vertical:void 0},Fe=ae.text;let Be,ze=[0,0];if(Fe){const Rt=Fe.toString(),Si=b.get("text-letter-spacing").evaluate(ae,{},u)*Br,W=b.get("text-line-height").evaluate(ae,{},u)*Br,J=Uh(Rt)?Si:0,Ie=b.get("text-anchor").evaluate(ae,{},u),ke=b.get("text-variable-anchor");if(!ke){const Ct=b.get("text-radial-offset").evaluate(ae,{},u);if(Ct)ze=Tx(Ie,[Ct*Br,R_]);
7else{const kt=b.get("text-offset").evaluate(ae,{},u);ze=[kt[0]*Br,kt[1]*Br]}}let Ye=K?"center":b.get("text-justify").evaluate(ae,{},u);const Ke=G==="point",ft=Ke?b.get("text-max-width").evaluate(ae,{},u)*Br:1/0,mt=Ct=>{r.allowVerticalPlacement&&Hl(Rt)&&(Pe.vertical=T_(Fe,e,i,a,be,ft,W,Ie,Ct,J,ze,$n.vertical,!0,Ee,he,_))};if(!K&&ke){const Ct=Ye==="auto"?ke.map((Nt=>z_(Nt))):[Ye];let kt=!1;for(let Nt=0;Nt<Ct.length;Nt++){const Gt=Ct[Nt];if(!Pe.horizontal[Gt])if(kt)Pe.horizontal[Gt]=Pe.horizontal[0];else{const bt=T_(Fe,e,i,a,be,ft,W,"center",Gt,J,ze,$n.horizontal,!1,Ee,he,_);bt&&(Pe.horizontal[Gt]=bt,kt=bt.positionedLines.length===1)}}mt("left")}else{if(Ye==="auto"&&(Ye=z_(Ie)),Ke||b.get("text-writing-mode").indexOf("horizontal")>=0||!Hl(Rt)){const Ct=T_(Fe,e,i,a,be,ft,W,Ie,Ye,J,ze,$n.horizontal,!1,Ee,he,_);Ct&&(Pe.horizontal[Ye]=Ct)}mt(Ke?"left":Ye)}}let De,Se,we,Le,Ze,je,dt=!1;const Qe=b.get("icon-text-fit").evaluate(ae,{},u);if(ae.icon&&ae.icon.hasPrimary()){const Rt=Ld(ae.icon,r.iconSizeData,T["icon-size"],u,r.zoom,ae,_,E.iconScaleFactor,v);De=Rt.iconPrimary,we=Rt.iconSecondary;const Si=De.toString();if(Se=o.get(Si),Se&&(Ze=b.get("icon-offset").evaluate(ae,{},u),je=b.get("icon-anchor").evaluate(ae,{},u),Be=Mp(a.get(Si),we?a.get(we.toString()):void 0,Ze,je),dt=Se.sdf,r.sdfIcons===void 0?r.sdfIcons=Se.sdf:r.sdfIcons!==Se.sdf&&tt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Se.pixelRatio!==r.pixelRatio||b.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),we){const W=we.toString();Le=o.get(W)}}ee=ee||!(!ae.icon||!ae.icon.hasSecondary());const rt=Dp(Pe.horizontal)||Pe.vertical;r.iconsInText||(r.iconsInText=!!rt&&rt.iconsInText);const at=Ee*E.textScaleFactor/Br,{defaultShapedIcon:Ut,verticallyShapedIcon:Ge}=Eb(r,Be,b,ae,u,Pe,at,Ze,Qe);Qe!=="none"&&Be&&(lx(Be)||cx(Be))&&(zp(0,Se,De,Be,Ut,Qe,y,o,a),zp(0,Le,we,Be,Ut,Qe,y,o,a),Ge&&(zp(0,Se,De,Be,Ge,Qe,y,o,a),zp(0,Le,we,Be,Ge,Qe,y,o,a))),Be=Ut;const{iconBBox:lt,iconVerticalBBox:It,textBBox:Zt,textVerticalBBox:Xt}=vb(r,Be,Ge,b,ae,u,Ce,Ze,E,a,je,Pe,Ee,ze);ne.push({feature:ae,shapedTextOrientations:Pe,shapedText:rt,shapedIcon:Be,iconPrimary:De,iconSecondary:we,iconOffset:Ze,iconAnchor:je,verticallyShapedIcon:Ge,layoutTextSize:Ee,layoutIconSize:Ce,textOffset:ze,isSDFIcon:dt,iconTextFit:Qe,iconCollisionBounds:lt,iconVerticalCollisionBounds:It,textCollisionBounds:Zt,textVerticalCollisionBounds:Xt})}return{featureData:ne,sizes:E,hasAnySecondaryIcon:ee,textAlongLine:K,symbolPlacement:G}},s.fx=gx,s.fy=function(r,e,i,o,a,u,h,f,_,y){r.iconAtlasPositions=y.iconPositions;const{featureData:v,hasAnySecondaryIcon:b,sizes:T,textAlongLine:E,symbolPlacement:I}=e;for(const P of v){const{shapedIcon:L,verticallyShapedIcon:D,feature:B,shapedTextOrientations:V,shapedText:G,layoutTextSize:K,textOffset:Z,isSDFIcon:ee,iconPrimary:ne,iconSecondary:ae,iconTextFit:be,iconOffset:he,iconCollisionBounds:Ee,iconVerticalCollisionBounds:Ce,textCollisionBounds:Pe}=P;Ex(L,y.iconPositions,ne,ae),Ex(D,y.iconPositions,ne,ae),Sb(V,y.iconPositions),Tb(ne,ae,y.iconPositions),(G||L)&&Ib(r,B,V,L,D,_,T,K,0,Z,ee,o,a,h,f,b,be,he,E,I,Ee,Ce,Pe)}i&&r.generateCollisionDebugBuffers(u,r.collisionBoxArray,T.textScaleFactor)},s.fz=me,s.g=function(r,e){return aa(Object.assign(r,{method:"GET"}),e)},s.h=function(r){return r.indexOf("mapbox:")===0},s.i=function(r){return qt.API_STYLE_REGEX.test(r)&&!Yr(r)},s.j=cr,s.k=Co,s.l=function(r){return decodeURIComponent(atob(r).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""))},s.m=function(r,e){return aa(Object.assign(r,{type:"json"}),e)},s.n=Tc,s.o=Fr,s.p=function(r,e){return aa(Object.assign(r,{method:"POST"}),e)},s.q=ln,s.r=Ao,s.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},s.t=function(){return i_||(i_=new sc("ImageRasterizer")),i_},s.u=function(){return(function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)})()},s.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},s.w=tt,s.x=X_,s.y=Sl,s.z=Po})),pl(["./shared"],(function(s){function Wr(pe){const O=pe?pe.url.toString():void 0;return O?performance.getEntriesByName(O):[]}
7function $i(pe){if(typeof pe=="number"||typeof pe=="boolean"||typeof pe=="string"||pe==null)return JSON.stringify(pe);if(Array.isArray(pe)){let N="[";for(const q of pe)N+=`${$i(q)},`;return`${N}]`}let O="{";for(const N of Object.keys(pe).sort())O+=`${N}:${$i(pe[N])},`;return`${O}}`}function so(pe){let O="";for(const N of s.bx)O+=`/${$i(pe[N])}`;return O}class Ca{constructor(O){this.keyCache={},this._layers={},this._layerConfigs={},O&&this.replace(O)}replace(O,N){this._layerConfigs={},this._layers={},this.update(O,[],N)}update(O,N,q){this._options=q;for(const re of O)this._layerConfigs[re.id]=re,(this._layers[re.id]=s.du(re,this.scope,null,this._options)).compileFilter(q),this.keyCache[re.id]&&delete this.keyCache[re.id];for(const re of N)delete this.keyCache[re],delete this._layerConfigs[re],delete this._layers[re];this.familiesBySource={};const oe=(function(re,ce){const ye={};for(let ge=0;ge<re.length;ge++){const Ne=re[ge];let Me=ce&&ce[Ne.id];Me||(Ne.type==="symbol"?Me=Ne.id:(Me=so(Ne),Ne.type==="line"&&Ne.paint&&(function _t(tt){return typeof tt=="string"&&tt==="line-progress"||(Array.isArray(tt)?tt.some(_t):!(!tt||typeof tt!="object")&&Object.values(tt).some(_t))})(Ne.paint["line-width"])&&(Me+=`/${$i(Ne.paint["line-width"])}`))),ce&&(ce[Ne.id]=Me);let nt=ye[Me];nt||(nt=ye[Me]=[]),nt.push(Ne)}const de=[];for(const ge in ye)de.push(ye[ge]);return de})(Object.values(this._layerConfigs),this.keyCache);for(const re of oe){const ce=re.map((nt=>this._layers[nt.id])),ye=ce[0];if(ye.visibility==="none")continue;const de=ye.source||"";let ge=this.familiesBySource[de];ge||(ge=this.familiesBySource[de]={});const Ne=ye.sourceLayer||"_geojsonTileLayer";let Me=ge[Ne];Me||(Me=ge[Ne]=[]),Me.push(ce)}}}const ao=1*s.fl;class rr{constructor(O){const N={},q=[];for(const ye in O){const de=O[ye],ge=N[ye]={};for(const Ne in de.glyphs){const Me=de.glyphs[+Ne];if(!Me||Me.bitmap.width===0||Me.bitmap.height===0)continue;const nt=Me.metrics.localGlyph?ao:1,_t={x:0,y:0,w:Me.bitmap.width+2*nt,h:Me.bitmap.height+2*nt};q.push(_t),ge[Ne]=_t}}const{w:oe,h:re}=s.G(q),ce=new s.fk({width:oe||1,height:re||1});for(const ye in O){const de=O[ye];for(const ge in de.glyphs){const Ne=de.glyphs[+ge];if(!Ne||Ne.bitmap.width===0||Ne.bitmap.height===0)continue;const Me=N[ye][ge],nt=Ne.metrics.localGlyph?ao:1;s.fk.copy(Ne.bitmap,ce,{x:0,y:0},{x:Me.x+nt,y:Me.y+nt},Ne.bitmap)}}this.image=ce,this.positions=N}}function lo(pe,O,N){pe[O]?N&&(pe[O].center=N):pe[O]={floorIds:new Set,center:N||[0,0],floors:{}}}function mi(pe,O,N,q){for(const oe of O)lo(pe,oe),pe[oe].floors[N]=q,pe[oe].floorIds.add(N)}function Ni(pe){return{id:pe.properties.id.toString(),center:pe.properties.center.toString().split(";").map(Number)}}function Xr(pe){return{id:pe.properties.id.toString(),isDefault:!!pe.properties.is_default&&pe.properties.is_default,connections:pe.properties.connected_floor_ids?new Set(pe.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:pe.properties.conflicted_floor_ids?new Set(pe.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:pe.properties.building_ids?new Set(pe.properties.building_ids.toString().split(";")):new Set,name:pe.properties.name.toString(),zIndex:pe.properties.z_index}}function Gi(pe,O){return O.every((N=>pe.properties&&pe.properties[N]!=null))}function Qr(pe){return Gi(pe,["type","id","name"])&&pe.properties.type==="building"}function Hr(pe){return Gi(pe,["type","id","name","z_index"])&&pe.properties.type==="floor"}s.fj(rr,"GlyphAtlas");class Wn{constructor(O){this.tileID=new s.aQ(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.tileZoom=O.tileZoom,this.uid=O.uid,this.zoom=O.zoom,this.lut=O.lut,this.canonical=O.tileID.canonical,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.scope=O.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=O.showCollisionBoxes,this.collectResourceTiming=!!O.request&&O.request.collectResourceTiming,this.promoteId=O.promoteId,this.isSymbolTile=O.isSymbolTile,this.tileTransform=s.aZ(O.tileID.canonical,O.projection),this.projection=O.projection,this.worldview=O.worldview,this.localizableLayerIds=O.localizableLayerIds,this.brightness=O.brightness,this.extraShadowCaster=!!O.extraShadowCaster,this.tessellationStep=O.tessellationStep,this.scaleFactor=O.scaleFactor,this.worldview=O.worldview,this.indoor=O.indoor}parse(O,N,q,oe,re,ce){this.status="parsing",this.data=O,this.collisionBoxArray=new s.b3;const ye=new s.fm(Object.keys(O.layers).sort()),de=new s.fn(this.tileID,this.promoteId);de.bucketLayerIDs=[];const ge={},Ne=new s.fo(256,256),Me={featureIndex:de,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Ne,availableImages:q,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const Lt=this.indoor.indoorState.activeFloorsVisible,zt=(function(Pt,Kt,or){const vr=(function(Qi,ii){if(!Qi)return s.w("No source layers defined in indoor specification"),ii;if(Qi.size===0)return ii;const er=Qi.difference(ii);for(const Pi of er)s.w(`Missing source layer required in indoor specification: ${Pi}`);return ii.intersection(ii)}
7)(Kt.sourceLayers,new Set(Object.keys(Pt.layers))),lr=Kt.indoorState,Er=(function(Qi,ii,er,Pi){const qt=new Set,cr=new Set,Yr=new Set,rn=new Map,Sn={},ra=Ur=>{const Nn=rn.get(Ur)||new Set;for(const dn of qt)if((rn.get(dn)||new Set).has(Ur)||Nn.has(dn))return!0;return!1};for(const Ur of ii){const Nn=Qi.layers[Ur];if(Nn)for(let dn=0;dn<Nn.length;dn++){const Ao=Nn.feature(dn);if(Qr(Ao)){const{id:Fr,center:na}=Ni(Ao);lo(Sn,Fr,na),qt.add(Fr)}else if(Hr(Ao)){const{id:Fr,isDefault:na,connections:Da,conflicts:gc,buildings:yc,name:xc,zIndex:xl}=Xr(Ao);mi(Sn,yc,Fr,{name:xc,zIndex:xl}),rn.set(Fr,gc),(Fr===Pi||Da.has(Pi))&&qt.add(Fr),cr.add(Fr),na&&Yr.add(Fr)}}else s.w(`indoor source layer not found: ${Ur}`)}if(er)for(const Ur of er)cr.has(Ur)&&(ra(Ur)||qt.add(Ur));for(const Ur of Yr)qt.has(Ur)||ra(Ur)||qt.add(Ur);return{buildings:Sn,activeFloors:qt}})(Pt,vr,lr.lastActiveFloors,lr.selectedFloorId);return or.send("setIndoorData",Er),Er})(O,this.indoor,re);Me.activeFloors=Lt?zt.activeFloors:void 0}const nt=[],_t=N.familiesBySource[this.source];for(const Lt in _t){const zt=O.layers[Lt];if(!zt)continue;let Pt=!1,Kt=!1,or=!1;for(const ii of _t[Lt])ii[0].type==="symbol"?Pt=!0:Kt=!0,ii[0].is3D()&&ii[0].type!=="model"&&(or=!0);if(this.extraShadowCaster&&!or||this.isSymbolTile===!0&&!Pt||this.isSymbolTile===!1&&!Kt)continue;zt.version===1&&s.w(`Vector tile source "${this.source}" layer "${Lt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const vr=ye.encode(Lt),lr=[],Er=this.localizableLayerIds&&this.localizableLayerIds.has(Lt);let Qi=!1;for(let ii=0,er=0;ii<zt.length;ii++){const Pi=zt.feature(ii),qt=de.getId(Pi,Lt),cr=Pi.properties?Pi.properties.worldview:null;if(Er&&this.worldview&&typeof cr=="string")if(cr==="all")Pi.properties.$localized=!0;else{if(!cr.split(",").includes(this.worldview))continue;Pi.properties.$localized=!0,Pi.properties.worldview=this.worldview}!Qi&&Pi.properties&&Pi.properties.hasOwnProperty(s.fp)&&(Qi=!0),lr.push({feature:Pi,id:qt,index:er,sourceLayerIndex:vr}),er++}Qi&&!Me.elevationFeatures&&O.layers.hasOwnProperty(s.fq)&&(Me.elevationFeatures=s.fr.parseFrom(O.layers[s.fq],this.canonical));for(const ii of _t[Lt]){const er=ii[0];if(this.extraShadowCaster&&(!er.is3D()||er.type==="model")||this.isSymbolTile!==void 0&&er.type==="symbol"!==this.isSymbolTile||er.minzoom&&this.zoom<Math.floor(er.minzoom)||er.maxzoom&&this.zoom>=er.maxzoom||er.visibility==="none")continue;wn(ii,this.zoom,Me.brightness,q,this.worldview);const Pi=ge[er.id]=er.createBucket({index:de.bucketLayerIDs.length,layers:ii,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:vr,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:oe,worldview:this.worldview,localizable:Er});de.bucketLayerIDs.push(ii.map((cr=>s.B(cr.id,cr.scope))));let qt=Pi.prepare?Pi.prepare():null;qt!=null?(qt=qt.then((()=>Pi.populate(lr,Me,this.tileID.canonical,this.tileTransform))),nt.push(qt)):Pi.populate(lr,Me,this.tileID.canonical,this.tileTransform)}}const tt=()=>{let Lt,zt,Pt,Kt,or,vr;Ne.trim();const lr={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Er=()=>{if(Lt)return this.status="done",ce(Lt);if(this.extraShadowCaster)this.status="done",ce(null,{buckets:Object.values(ge).filter((ii=>!ii.isEmpty())),featureIndex:de,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Me.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(zt&&Pt&&Kt){const ii=new rr(zt),er=new Map;for(const[cr,Yr]of Pt.entries()){const{imagePosition:rn}=s.fu(cr,Yr,s.fv);er.set(cr,rn)}const Pi={};for(const cr in ge){const Yr=ge[cr];Yr instanceof s.b4&&(wn(Yr.layers,this.zoom,Me.brightness,q,this.worldview),Pi[cr]=s.fw(Yr,zt,ii.positions,Pt,er,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,or,this.worldview))}const qt={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(re,Pt,or,(()=>{qt.iconsPending=!1,Qi(Pi,ii,qt)})),this.rasterizeIfNeeded(re,Kt,vr,(()=>{qt.patternsPending=!1,Qi(Pi,ii,qt)}))}},Qi=(ii,er,Pi,qt)=>{if(Pi.iconsPending||Pi.patternsPending)return;const cr=new s.fx(Pt,Kt,this.lut);for(const Yr in ge){const rn=ge[Yr];if(Yr in ii)s.fy(rn,ii[Yr],this.showCollisionBoxes,q,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Pt,cr);else if(rn.hasPattern&&(rn instanceof s.ba||rn instanceof s.bb||rn instanceof s.ea)){wn(rn.layers,this.zoom,Me.brightness,q,this.worldview);const Sn=Object.fromEntries(cr.patternPositions);rn.addFeatures(Me,this.tileID.canonical,Sn,q,this.tileTransform,this.brightness)}}this.status="done",ce(null,{buckets:Object.values(ge).filter((Yr=>!Yr.isEmpty())),featureIndex:de,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:er.image,lineAtlas:Ne,imageAtlas:cr,brightness:Me.brightness})};if(!this.extraShadowCaster){const ii=s.fs(Me.glyphDependencies,(qt=>Object.keys(qt).map(Number)));Object.keys(ii).length?re.send("getGlyphs",{uid:this.uid,stacks:ii},((qt,cr)=>{Lt||(Lt=qt,zt=cr,Er())}),void 0,!1,lr):zt={};const er=Array.from(Me.iconDependencies.keys()).map((qt=>s.I.parse(qt)));er.length?re.send("getImages",{images:er,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},((qt,cr)=>{Lt||(Lt=qt,Pt=new Map,or=this.updateImageMapAndGetImageTaskQueue(Pt,cr,Me.iconDependencies),Er())}),void 0,!1,lr):(Pt=new Map,or=new Map);const Pi=Array.from(Me.patternDependencies.keys()).map((qt=>s.I.parse(qt)));Pi.length?re.send("getImages",{images:Pi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},((qt,cr)=>{Lt||(Lt=qt,Kt=new Map,vr=this.updateImageMapAndGetImageTaskQueue(Kt,cr,Me.patternDependencies),Er())}),void 0,!1,lr):(Kt=new Map,vr=new Map)}if(Me.elevationFeatures&&Me.elevationFeatures.length>0){const ii=[];for(const Pi of Object.values(ge))if(Pi instanceof s.bb){const qt=Pi.getUnevaluatedPortalGraph();qt&&ii.push(qt)}const er=s.ft.evaluate(ii);for(const Pi of Object.values(ge))if(Pi instanceof s.bb){const qt=O.layers[ye.decode(Pi.sourceLayerIndex)];Pi.setEvaluatedPortalGraph(er,qt,this.tileID.canonical,Me.availableImages,Me.brightness)}}Er()};nt.length>0?Promise.allSettled(nt).then(tt).catch(ce):tt()}updateParameters(O){this.scaleFactor=O.scaleFactor,this.showCollisionBoxes=O.showCollisionBoxes,this.projection=O.projection,this.brightness=O.brightness,this.tileTransform=s.aZ(O.tileID.canonical,O.projection),this.extraShadowCaster=O.extraShadowCaster,this.lut=O.lut,this.worldview=O.worldview,this.indoor=O.indoor}rasterizeIfNeeded(O,N,q,oe){Array.from(N.values()).some((re=>re.usvg))?this.rasterize(O,N,q,oe):oe()}updateImageMapAndGetImageTaskQueue(O,N,q){const oe=new Map;for(const re of N.keys()){const ce=q.get(re)||[];for(const ye of ce){const de=ye.toString(),ge=N.get(ye.id.toString());ge.usvg?oe.has(de)||(oe.set(de,ye),O.set(de,Object.assign({},ge))):O.set(de,ge)}}return oe}rasterize(O,N,q,oe){this.rasterizeTask=O.send("rasterizeImages",{scope:this.scope,tasks:q},((re,ce)=>{if(!re)for(const[ye,de]of ce.entries()){const ge=Object.assign(N.get(ye),{data:de});N.set(ye,ge)}oe()}))}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function wn(pe,O,N,q,oe){const re=new s.ac(O,{brightness:N,worldview:oe});for(const ce of pe)ce.recalculate(re,q)}class kn extends s.E{constructor(O,N,q,oe,re,ce,ye){super(),this.actor=O,this.layerIndex=N,this.availableImages=q,this.availableModels=oe,this.loadVectorData=ce||s.aL,this.loading={},this.loaded={},this.deduped=new s.aK(O.scheduler),this.isSpriteLoaded=re,this.scheduler
7=O.scheduler,this.brightness=ye}loadTile(O,N){const q=O.uid,oe=O&&O.request,re=oe&&oe.collectResourceTiming,ce=this.loading[q]=new Wn(O);ce.abort=this.loadVectorData(O,((ye,de)=>{const ge=!this.loading[q];if(delete this.loading[q],ce.cancelRasterize(),ge||ye||!de)return ce.status="done",ge||(this.loaded[q]=ce),N(ye);const Ne=de.rawData,Me={},nt=s.aM(de.responseHeaders);nt&&nt.expires&&(Me.expires=nt.expires),nt&&nt.cacheControl&&(Me.cacheControl=nt.cacheControl),ce.vectorTile=de.vectorTile||new s.fz(new s.bt(Ne));const _t=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,((tt,Lt)=>{if(tt||!Lt)return N(tt);const zt={};if(re){const Pt=Wr(oe);Pt.length>0&&(zt.resourceTiming=JSON.parse(JSON.stringify(Pt)))}N(null,Object.assign({rawTileData:Ne.slice(0),responseHeaders:de.responseHeaders},Lt,Me,zt))}))};this.isSpriteLoaded?_t():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(_t,{type:"parseTile",isSymbolTile:O.isSymbolTile,zoom:O.tileZoom}):_t()})),this.loaded=this.loaded||{},this.loaded[q]=ce}))}reloadTile(O,N){const q=this.loaded,oe=O.uid;if(q&&q[oe]){const re=q[oe];re.updateParameters(O);const ce=(ye,de)=>{const ge=re.reloadCallback;ge&&(delete re.reloadCallback,re.parse(re.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ge)),N(ye,de)};re.status==="parsing"?re.reloadCallback=ce:re.status==="done"&&(re.vectorTile?re.parse(re.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ce):ce())}else N(null,void 0)}abortTile(O,N){const q=O.uid,oe=this.loading[q];oe&&(oe.abort&&oe.abort(),delete this.loading[q]),N()}removeTile(O,N){const q=this.loaded,oe=O.uid;q&&q[oe]&&delete q[oe],N()}}class So{loadTile(O,N){const{uid:q,encoding:oe,rawImageData:re,padding:ce}=O,ye=ImageBitmap&&re instanceof ImageBitmap?this.getImageData(re,ce):re;N(null,new s.fA(q,ye,oe,ce<1))}reloadTile(O,N){N(null,null)}abortTile(O,N){N()}removeTile(O,N){N()}getImageData(O,N){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(O.width,O.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=O.width,this.offscreenCanvas.height=O.height,this.offscreenCanvasContext.drawImage(O,0,0,O.width,O.height);const q=this.offscreenCanvasContext.getImageData(-N,-N,O.width+2*N,O.height+2*N);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),q}}s.bs.setPbf(s.bt);class ki{constructor(O){this._mrt=new s.bs(O.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=O.uid,this.tileID=O.tileID,this.source=O.source}parse(O,N){const q=this._mrt;this.status="parsing",this._entireBuffer=O;try{q.parseHeader(O),this._isHeaderLoaded=!0;const oe=[];for(const re in q.layers){const ce=q.getLayer(re),ye=ce.getDataRange(ce.getBandList()),de=q.createDecodingTask(ye),ge=O.slice(ye.firstByte,ye.lastByte+1),Ne=s.bs.performDecoding(ge,de).then((Me=>de.complete(null,Me))).catch((Me=>de.complete(Me,null)));oe.push(Ne)}Promise.allSettled(oe).then((()=>N(null,q))).catch((re=>N(re)))}catch(oe){N(oe)}}}class Sr{constructor(O){this.actor=O,this.loading={},this.loaded={}}loadTile(O,N){const q=O.uid,oe=O.request,re=this.loading[q]=new ki(O),{cancel:ce}=s.bu(oe,((ye,de,ge)=>{const Ne=!this.loading[q];if(delete this.loading[q],Ne||ye||!de)return re.status="done",Ne||(this.loaded[q]=re),N(ye);re.parse(de,((Me,nt)=>{if(Me||!nt)return N(Me);N(null,nt,ge)})),this.loaded[q]=re}));re.abort=ce}reloadTile(O,N){N(null,void 0)}abortTile(O,N){const q=O.uid,oe=this.loading[q];oe&&(oe.abort&&oe.abort(),delete this.loading[q]),N()}removeTile(O,N){const q=O.uid;this.loaded[q]&&delete this.loaded[q],N()}decodeRasterArray(O,N){s.bs.performDecoding(O.buffer,O.task).then((q=>N(null,q))).catch((q=>N(q)))}}const dr=s.fB.prototype.toGeoJSON;class Bn{constructor(O){this._feature=O,this.extent=s.al,this.type=O.type,this.properties=O.tags,"id"in O&&!isNaN(O.id)&&(this.id=parseInt(O.id,10))}loadGeometry(){if(this._feature.type===1){const O=[];for(const N of this._feature.geometry)O.push([new s.P(N[0],N[1])]);return O}{const O=[];for(const N of this._feature.geometry){const q=[];for(const oe of N)q.push(new s.P(oe[0],oe[1]));
7O.push(q)}return O}}toGeoJSON(O,N,q){return dr.call(this,O,N,q)}}class ei{constructor(O,N){this.name=O,this.extent=s.al,this.length=N.length,this._jsonFeatures=N}feature(O){return new Bn(this._jsonFeatures[O])}}class Eo{constructor(O){this.layers={},this.extent=s.al;for(const N of Object.keys(O))this.layers[N]=new ei(N,O[N])}}const Ir=64/4096,nr=128;class Vt{constructor(){this.features=new Map}clear(){this.features.clear()}load(O=[],N){for(const q of O){const oe=q.id;if(oe==null)continue;let re=this.features.get(oe);re&&this.updateCache(re,N),q.geometry?(re=Or(q),this.updateCache(re,N),this.features.set(oe,re)):this.features.delete(oe),this.updateCache(re,N)}}updateCache(O,N){for(const{canonical:q,uid:oe}of Object.values(N)){const{z:re,x:ce,y:ye}=q;gi(O,Math.pow(2,re),ce,ye)&&delete N[oe]}}getTile(O,N,q){const oe=Math.pow(2,O),re=[];for(const ce of this.features.values())gi(ce,oe,N,q)&&re.push(Zi(ce,oe,N,q));return{features:re}}getFeatures(){return[...this.features.values()]}}function gi({minX:pe,minY:O,maxX:N,maxY:q},oe,re,ce){return pe<(re+1+Ir)/oe&&O<(ce+1+Ir)/oe&&N>(re-Ir)/oe&&q>(ce-Ir)/oe}function Or(pe){const{id:O,geometry:N,properties:q}=pe;if(!N)return;if(N.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:oe,coordinates:re}=N,ce={id:O,type:1,geometry:[],tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},ye=ce.geometry;if(oe==="Point")cn(re,ye,ce);else if(oe==="MultiPoint")for(const de of re)cn(de,ye,ce);else if(oe==="LineString")ce.type=2,Rn(re,ye,ce);else if(oe==="MultiLineString")ce.type=2,zn(re,ye,ce);else if(oe==="Polygon")ce.type=3,zn(re,ye,ce,!0);else{if(oe!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const de of re)zn(de,ye,ce,!0)}return ce}function cn([pe,O],N,q){const oe=s.aF(pe);let re=s.aJ(O);re=re<0?0:re>1?1:re,N.push(oe,re),q.minX=Math.min(q.minX,oe),q.minY=Math.min(q.minY,re),q.maxX=Math.max(q.maxX,oe),q.maxY=Math.max(q.maxY,re)}function Rn(pe,O,N,q=!1,oe=!1){const re=[];for(const ce of pe)cn(ce,re,N);O.push(re),q&&(function(ce,ye){let de=0;for(let ge=0,Ne=ce.length,Me=Ne-2;ge<Ne;Me=ge,ge+=2)de+=(ce[ge]-ce[Me])*(ce[ge+1]+ce[Me+1]);if(de>0===ye)for(let ge=0,Ne=ce.length;ge<Ne/2;ge+=2){const Me=ce[ge],nt=ce[ge+1];ce[ge]=ce[Ne-2-ge],ce[ge+1]=ce[Ne-1-ge],ce[Ne-2-ge]=Me,ce[Ne-1-ge]=nt}})(re,oe)}function zn(pe,O,N,q=!1){for(let oe=0;oe<pe.length;oe++)Rn(pe[oe],O,N,q,oe===0)}function Zi(pe,O,N,q){const{id:oe,type:re,geometry:ce,tags:ye}=pe,de=[];if(re===1)(function(ge,Ne,Me,nt,_t){for(let tt=0;tt<ge.length;tt+=2){const Lt=Math.round(s.al*(ge[tt+0]*Ne-Me)),zt=Math.round(s.al*(ge[tt+1]*Ne-nt));_t.push([Lt,zt])}})(ce,O,N,q,de);else if(re===2)for(const ge of ce)qr(ge,O,N,q,de);else if(re===3)for(const ge of ce)fc(ge,O,N,q,de);return{id:oe,type:re,geometry:de,tags:ye}}function qr(pe,O,N,q,oe){const re=-nr,ce=s.al+nr;let ye;for(let de=0;de<pe.length-2;de+=2){let ge=Math.round(s.al*(pe[de+0]*O-N)),Ne=Math.round(s.al*(pe[de+1]*O-q)),Me=Math.round(s.al*(pe[de+2]*O-N)),nt=Math.round(s.al*(pe[de+3]*O-q));const _t=Me-ge,tt=nt-Ne;ge<re&&Me<re||(ge<re?(Ne+=Math.round(tt*((re-ge)/_t)),ge=re):Me<re&&(nt=Ne+Math.round(tt*((re-ge)/_t)),Me=re),Ne<re&&nt<re||(Ne<re?(ge+=Math.round(_t*((re-Ne)/tt)),Ne=re):nt<re&&(Me=ge+Math.round(_t*((re-Ne)/tt)),nt=re),ge>=ce&&Me>=ce||(ge>=ce?(Ne+=Math.round(tt*((ce-ge)/_t)),ge=ce):Me>=ce&&(nt=Ne+Math.round(tt*((ce-ge)/_t)),Me=ce),Ne>=ce&&nt>=ce||(Ne>=ce?(ge+=Math.round(_t*((ce-Ne)/tt)),Ne=ce):nt>=ce&&(Me=ge+Math.round(_t*((ce-Ne)/tt)),nt=ce),ye&&ge===ye[ye.length-1][0]&&Ne===ye[ye.length-1][1]||(ye=[[ge,Ne]],oe.push(ye)),ye.push([Me,nt])))))}}function fc(pe,O,N,q,oe){const re=(N-Ir)/O,ce=(q-Ir)/O,ye=(N+1+Ir)/O,de=(q+1+Ir)/O;function ge(nt,_t){let tt=0;return nt<re?tt|=1:nt>ye&&(tt|=2),_t<ce?tt|=4:_t>de&&(tt|=8),tt}let Ne=[];for(let nt=1;nt<=8;nt*=2){let _t=pe[pe.length-2],tt=pe[pe.length-1],Lt=!(ge(_t,tt)&nt);for(let zt=0;zt<pe.length;zt+=2){const Pt=pe[zt],Kt=pe[zt+1],or=!(ge(Pt,Kt)&nt);or!==Lt&&(8&nt?Ne.push(_t+(Pt-_t)*(de-tt)/(Kt-tt),de):4&nt?Ne.push(_t+(Pt-_t)*(ce-tt)/(Kt-tt),ce):2&nt?Ne.pu
7sh(ye,tt+(Kt-tt)*(ye-_t)/(Pt-_t)):1&nt&&Ne.push(re,tt+(Kt-tt)*(re-_t)/(Pt-_t))),or&&Ne.push(Pt,Kt),_t=Pt,tt=Kt,Lt=or}if(!(pe=Ne).length||nt===8)break;Ne=[]}const Me=[];for(let nt=0;nt<Ne.length;nt+=2)Me.push([Math.round(s.al*(Ne[nt]*O-N)),Math.round(s.al*(Ne[nt+1]*O-q))]);oe.push(Me)}function ml({name:pe,features:O},N){N.writeStringField(1,pe),N.writeVarintField(5,s.al);const q=new Map,oe=new Map,re={keys:q,values:oe,feature:null};for(const ce of O)re.feature=ce,N.writeMessage(2,pc,re);for(const ce of q.keys())N.writeStringField(3,ce);for(const ce of oe.keys())N.writeMessage(4,Ws,ce)}function pc(pe,O){const N=pe.feature;N.id!==void 0&&Number.isSafeInteger(+N.id)&&O.writeVarintField(1,+N.id),N.tags&&O.writeMessage(2,ys,pe),O.writeVarintField(3,N.type),O.writeMessage(4,en,N)}function ys({keys:pe,values:O,feature:N},q){for(const oe of Object.keys(N.tags)){let re=N.tags[oe];if(re===null)continue;let ce=pe.get(oe);ce===void 0&&(ce=pe.size,pe.set(oe,ce)),q.writeVarint(ce);const ye=typeof re;ye!=="string"&&ye!=="boolean"&&ye!=="number"&&(re=JSON.stringify(re));let de=O.get(re);de===void 0&&(de=O.size,O.set(re,de)),q.writeVarint(de)}}function Bi(pe,O){return(O<<3)+(7&pe)}function fr(pe){return pe<<1^pe>>31}function en(pe,O){const{geometry:N,type:q}=pe;let oe=0,re=0;if(q===1){O.writeVarint(Bi(1,N.length));for(const ce of N){const ye=ce[0]-oe,de=ce[1]-re;O.writeVarint(fr(ye)),O.writeVarint(fr(de)),oe+=ye,re+=de}}else for(const ce of N){O.writeVarint(Bi(1,1));const ye=ce.length-(q===3?1:0);for(let de=0;de<ye;de++){de===1&&O.writeVarint(Bi(2,ye-1));const ge=ce[de][0]-oe,Ne=ce[de][1]-re;O.writeVarint(fr(ge)),O.writeVarint(fr(Ne)),oe+=ge,re+=Ne}q===3&&O.writeVarint(Bi(7,1))}}function Ws(pe,O){const N=typeof pe;N==="string"?O.writeStringField(1,pe):N==="boolean"?O.writeBooleanField(7,pe):N==="number"&&(pe%1!=0?O.writeDoubleField(3,pe):pe<0?O.writeSVarintField(6,pe):O.writeVarintField(5,pe))}const gr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:pe=>pe},xs=Math.fround||(vs=new Float32Array(1),pe=>(vs[0]=+pe,vs[0]));var vs;const Dn=3,un=5,xr=6;class ih{constructor(O){this.options=Object.assign(Object.create(gr),O),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(O){const{log:N,minZoom:q,maxZoom:oe}=this.options;N&&console.time("total time");const re=`prepare ${O.length} points`;N&&console.time(re),this.points=O;const ce=[];for(let de=0;de<O.length;de++){const ge=O[de];if(!ge.geometry)continue;const[Ne,Me]=ge.geometry.coordinates,nt=xs(bs(Ne)),_t=xs(ws(Me));ce.push(nt,_t,1/0,de,-1,1),this.options.reduce&&ce.push(0)}let ye=this.trees[oe+1]=this._createTree(ce);N&&console.timeEnd(re);for(let de=oe;de>=q;de--){const ge=+Date.now();ye=this.trees[de]=this._createTree(this._cluster(ye,de)),N&&console.log("z%d: %d clusters in %dms",de,ye.numItems,+Date.now()-ge)}return N&&console.timeEnd("total time"),this}getClusters(O,N){let q=((O[0]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,O[1]));let re=O[2]===180?180:((O[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,O[3]));if(O[2]-O[0]>=360)q=-180,re=180;else if(q>re){const Me=this.getClusters([q,oe,180,ce],N),nt=this.getClusters([-180,oe,re,ce],N);return Me.concat(nt)}const ye=this.trees[this._limitZoom(N)],de=ye.range(bs(q),ws(ce),bs(re),ws(oe)),ge=ye.data,Ne=[];for(const Me of de){const nt=this.stride*Me;Ne.push(ge[nt+un]>1?Pa(ge,nt,this.clusterProps):this.points[ge[nt+Dn]])}return Ne}getChildren(O){const N=this._getOriginId(O),q=this._getOriginZoom(O),oe="No cluster with the specified id.",re=this.trees[q];if(!re)throw new Error(oe);const ce=re.data;if(N*this.stride>=ce.length)throw new Error(oe);const ye=this.options.radius/(this.options.extent*Math.pow(2,q-1)),de=re.within(ce[N*this.stride],ce[N*this.stride+1],ye),ge=[];for(const Ne of de){const Me=Ne*this.stride;ce[Me+4]===O&&ge.push(ce[Me+un]>1?Pa(ce,Me,this.clusterProps):this.points[ce[Me+Dn]])}if(ge.length===0)throw new Error(oe);return ge}getLeaves(O,N,q){const oe=[];return this._appendLeaves(oe,O,N=N||10,q=q||0,0),oe}getTile(O,N,q){const oe=this.trees[this._limitZoom(O)],re=Math.pow(2,O),{extent:ce,radiu
vendor: 1,845 bytes, line 7
7s:ye}=this.options,de=ye/ce,ge=(q-de)/re,Ne=(q+1+de)/re,Me={features:[]};return this._addTileFeatures(oe.range((N-de)/re,ge,(N+1+de)/re,Ne),oe.data,N,q,re,Me),N===0&&this._addTileFeatures(oe.range(1-de/re,ge,1,Ne),oe.data,re,q,re,Me),N===re-1&&this._addTileFeatures(oe.range(0,ge,de/re,Ne),oe.data,-1,q,re,Me),Me.features.length?Me:null}getClusterExpansionZoom(O){let N=this._getOriginZoom(O)-1;for(;N<=this.options.maxZoom;){const q=this.getChildren(O);if(N++,q.length!==1)break;O=q[0].properties.cluster_id}return N}_appendLeaves(O,N,q,oe,re){const ce=this.getChildren(N);for(const ye of ce){const de=ye.properties;if(de&&de.cluster?re+de.point_count<=oe?re+=de.point_count:re=this._appendLeaves(O,de.cluster_id,q,oe,re):re<oe?re++:O.push(ye),O.length===q)break}return re}_createTree(O){const N=new s.c4(O.length/this.stride|0,this.options.nodeSize,Float32Array);for(let q=0;q<O.length;q+=this.stride)N.add(O[q],O[q+1]);return N.finish(),N.data=O,N}_addTileFeatures(O,N,q,oe,re,ce){for(const ye of O){const de=ye*this.stride,ge=N[de+un]>1;let Ne,Me,nt;if(ge)Ne=Xs(N,de,this.clusterProps),Me=N[de],nt=N[de+1];else{const Lt=this.points[N[de+Dn]];Ne=Lt.properties;const[zt,Pt]=Lt.geometry.coordinates;Me=bs(zt),nt=ws(Pt)}const _t={type:1,geometry:[[Math.round(this.options.extent*(Me*re-q)),Math.round(this.options.extent*(nt*re-oe))]],tags:Ne};let tt;tt=ge||this.options.generateId?N[de+Dn]:this.points[N[de+Dn]].id,tt!==void 0&&(_t.id=tt),ce.features.push(_t)}}_limitZoom(O){return Math.max(this.options.minZoom,Math.min(Math.floor(+O),this.options.maxZoom+1))}_cluster(O,N){const{radius:q,extent:oe,reduce:re,minPoints:ce}=this.options,ye=q/(oe*Math.pow(2,N)),de=O.data,ge=[],Ne=this.stride;for(let Me=0;Me<de.length;Me+=Ne){if(de[Me+2]<=N)continue;de[Me+2]=N;const nt=de[Me],_t=de[Me+1],tt=O.within(de[Me],de[Me+1],ye),Lt=de[Me+un];let zt=Lt;
vendor: 10,787 bytes, line 7
7for(const Pt of tt){const Kt=Pt*Ne;de[Kt+2]>N&&(zt+=de[Kt+un])}if(zt>Lt&&zt>=ce){let Pt,Kt=nt*Lt,or=_t*Lt,vr=-1;const lr=(Me/Ne<<5)+(N+1)+this.points.length;for(const Er of tt){const Qi=Er*Ne;if(de[Qi+2]<=N)continue;de[Qi+2]=N;const ii=de[Qi+un];Kt+=de[Qi]*ii,or+=de[Qi+1]*ii,de[Qi+4]=lr,re&&(Pt||(Pt=this._map(de,Me,!0),vr=this.clusterProps.length,this.clusterProps.push(Pt)),re(Pt,this._map(de,Qi)))}de[Me+4]=lr,ge.push(Kt/zt,or/zt,1/0,lr,-1,zt),re&&ge.push(vr)}else{for(let Pt=0;Pt<Ne;Pt++)ge.push(de[Me+Pt]);if(zt>1)for(const Pt of tt){const Kt=Pt*Ne;if(!(de[Kt+2]<=N)){de[Kt+2]=N;for(let or=0;or<Ne;or++)ge.push(de[Kt+or])}}}}return ge}_getOriginId(O){return O-this.points.length>>5}_getOriginZoom(O){return(O-this.points.length)%32}_map(O,N,q){if(O[N+un]>1){const ce=this.clusterProps[O[N+xr]];return q?Object.assign({},ce):ce}const oe=this.points[O[N+Dn]].properties,re=this.options.map(oe);return q&&re===oe?Object.assign({},re):re}}function Pa(pe,O,N){return{type:"Feature",id:pe[O+Dn],properties:Xs(pe,O,N),geometry:{type:"Point",coordinates:[(q=pe[O],360*(q-.5)),tn(pe[O+1])]}};var q}function Xs(pe,O,N){const q=pe[O+un],oe=q>=1e4?`${Math.round(q/1e3)}k`:q>=1e3?Math.round(q/100)/10+"k":q,re=pe[O+xr],ce=re===-1?{}:Object.assign({},N[re]);return Object.assign(ce,{cluster:!0,cluster_id:pe[O+Dn],point_count:q,point_count_abbreviated:oe})}function bs(pe){return pe/360+.5}function ws(pe){const O=Math.sin(pe*Math.PI/180),N=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return N<0?0:N>1?1:N}function tn(pe){const O=(180-360*pe)*Math.PI/180;return 360*Math.atan(Math.exp(O))/Math.PI-90}function Ho(pe,O,N,q){let oe=q;const re=O+(N-O>>1);let ce,ye=N-O;const de=pe[O],ge=pe[O+1],Ne=pe[N],Me=pe[N+1];for(let nt=O+3;nt<N;nt+=3){const _t=Ra(pe[nt],pe[nt+1],de,ge,Ne,Me);if(_t>oe)ce=nt,oe=_t;else if(_t===oe){const tt=Math.abs(nt-re);tt<ye&&(ce=nt,ye=tt)}}oe>q&&(ce-O>3&&Ho(pe,O,ce,q),pe[ce+2]=oe,N-ce>3&&Ho(pe,ce,N,q))}function Ra(pe,O,N,q,oe,re){let ce=oe-N,ye=re-q;if(ce!==0||ye!==0){const de=((pe-N)*ce+(O-q)*ye)/(ce*ce+ye*ye);de>1?(N=oe,q=re):de>0&&(N+=ce*de,q+=ye*de)}return ce=pe-N,ye=O-q,ce*ce+ye*ye}function co(pe,O,N,q){const oe={id:pe??null,type:O,geometry:N,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(O==="Point"||O==="MultiPoint"||O==="LineString")qo(oe,N);else if(O==="Polygon")qo(oe,N[0]);else if(O==="MultiLineString")for(const re of N)qo(oe,re);else if(O==="MultiPolygon")for(const re of N)qo(oe,re[0]);return oe}function qo(pe,O){for(let N=0;N<O.length;N+=3)pe.minX=Math.min(pe.minX,O[N]),pe.minY=Math.min(pe.minY,O[N+1]),pe.maxX=Math.max(pe.maxX,O[N]),pe.maxY=Math.max(pe.maxY,O[N+1])}function pn(pe,O,N,q){if(!O.geometry)return;const oe=O.geometry.coordinates;if(oe&&oe.length===0)return;const re=O.geometry.type,ce=Math.pow(N.tolerance/((1<<N.maxZoom)*N.extent),2);let ye=[],de=O.id;if(N.promoteId?de=O.properties[N.promoteId]:N.generateId&&(de=q||0),re==="Point")Ys(oe,ye);else if(re==="MultiPoint")for(const ge of oe)Ys(ge,ye);else if(re==="LineString")Ks(oe,ye,ce,!1);else if(re==="MultiLineString"){if(N.lineMetrics){for(const ge of oe)ye=[],Ks(ge,ye,ce,!1),pe.push(co(de,"LineString",ye,O.properties));return}Js(oe,ye,ce,!1)}else if(re==="Polygon")Js(oe,ye,ce,!0);else{if(re!=="MultiPolygon"){if(re==="GeometryCollection"){for(const ge of O.geometry.geometries)pn(pe,{id:de,geometry:ge,properties:O.properties},N,q);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ge of oe){const Ne=[];Js(ge,Ne,ce,!0),ye.push(Ne)}}pe.push(co(de,re,ye,O.properties))}function Ys(pe,O){O.push(za(pe[0]),Vr(pe[1]),0)}function Ks(pe,O,N,q){let oe,re,ce=0;for(let de=0;de<pe.length;de++){const ge=za(pe[de][0]),Ne=Vr(pe[de][1]);O.push(ge,Ne,0),de>0&&(ce+=q?(oe*Ne-ge*re)/2:Math.sqrt(Math.pow(ge-oe,2)+Math.pow(Ne-re,2))),oe=ge,re=Ne}const ye=O.length-3;O[2]=1,Ho(O,0,ye,N),O[ye+2]=1,O.size=Math.abs(ce),O.start=0,O.end=O.size}function Js(pe,O,N,q){for(let oe=0;oe<pe.length;oe++){const re=[];Ks(pe[oe],re,N,q),O.push(re)}}function za(pe){return pe/360+.5}function Vr(pe){const O=Math.sin(pe*Math.PI/180),N=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return N<0?0:N>1?1:N}function Tn(pe,O,N,q,oe,re,ce,ye){if(q/=O,re>=(N/=O)&&ce<q)return pe;if(ce<N||re>=q)return null;const de=[];for(const ge of pe){const Ne=ge.geometry;let Me=ge.type;const nt=oe===0?ge.minX:ge.minY,_t=oe===0?ge.maxX:ge.maxY;if(nt>=N&&_t<q){de.push(ge);continue}if(_t<N||nt>=q)continue;let tt=[];if(Me==="Point"||Me==="MultiPoint")_l(Ne,tt,N,q,oe);else if(Me==="LineString")Ts(Ne,tt,N,q,oe,!1,ye.lineMetrics);else if(Me==="MultiLineString")$o(Ne,tt,N,q,oe,!1);else if(Me==="Polygon")$o(Ne,tt,N,q,oe,!0);else if(Me==="MultiPolygon")for(const Lt of Ne){const zt=[];$o(Lt,zt,N,q,oe,!0),zt.length&&tt.push(zt)}if(tt.length){if(ye.lineMetrics&&Me==="LineString"){for(const Lt of tt)de.push(co(ge.id,Me,Lt,ge.tags));continue}Me!=="LineString"&&Me!=="MultiLineString"||(tt.length===1?(Me="LineString",tt=tt[0]):Me="MultiLineString"),Me!=="Point"&&Me!=="MultiPoint"||(Me=tt.length===3?"Point":"MultiPoint"),de.push(co(ge.id,Me,tt,ge.tags))}}return de.length?de:null}function _l(pe,O,N,q,oe){for(let re=0;re<pe.length;re+=3){const ce=pe[re+oe];ce>=N&&ce<=q&&uo(O,pe[re],pe[re+1],pe[re+2])}}function Ts(pe,O,N,q,oe,re,ce){let ye=Io(pe);const de=oe===0?gl:Qs;let ge,Ne,Me=pe.start;for(let zt=0;zt<pe.length-3;zt+=3){const Pt=pe[zt],Kt=pe[zt+1],or=pe[zt+2],vr=pe[zt+3],lr=pe[zt+4],Er=oe===0?Pt:Kt,Qi=oe===0?vr:lr;let ii=!1;ce&&(ge=Math.sqrt(Math.pow(Pt-vr,2)+Math.pow(Kt-lr,2))),Er<N?Qi>N&&(Ne=de(ye,Pt,Kt,vr,lr,N),ce&&(ye.start=Me+ge*Ne)):Er>q?Qi<q&&(Ne=de(ye,Pt,Kt,vr,lr,q),ce&&(ye.start=Me+ge*Ne)):uo(ye,Pt,Kt,or),Qi<N&&Er>=N&&(Ne=de(ye,Pt,Kt,vr,lr,N),ii=!0),Qi>q&&Er<=q&&(Ne=de(ye,Pt,Kt,vr,lr,q),ii=!0),!re&&ii&&(ce&&(ye.end=Me+ge*Ne),O.push(ye),ye=Io(pe)),ce&&(Me+=ge)}let nt=pe.length-3;const _t=pe[nt],tt=pe[nt+1],Lt=oe===0?_t:tt;Lt>=N&&Lt<=q&&uo(ye,_t,tt,pe[nt+2]),nt=ye.length-3,re&&nt>=3&&(ye[nt]!==ye[0]||ye[nt+1]!==ye[1])&&uo(ye,ye[0],ye[1],ye[2]),ye.length&&O.push(ye)}function Io(pe){const O=[];return O.size=pe.size,O.start=pe.start,O.end=pe.end,O}function $o(pe,O,N,q,oe,re){for(const ce of pe)Ts(ce,O,N,q,oe,re,!1)}function uo(pe,O,N,q){pe.push(O,N,q)}function gl(pe,O,N,q,oe,re){const ce=(re-O)/(q-O);return uo(pe,re,N+(oe-N)*ce,1),ce}function Qs(pe,O,N,q,oe,re){const ce=(re-N)/(oe-N);return uo(pe,O+(q-O)*ce,re,1),ce}function Ji(pe,O){const N=[];for(let q=0;q<pe.length;q++){const oe=pe[q],re=oe.type;let ce;if(re==="Point"||re==="MultiPoint"||re==="LineString")ce=$r(oe.geometry,O);else if(re==="MultiLineString"||re==="Polygon"){ce=[];for(const ye of oe.geometry)ce.push($r(ye,O))}else if(re==="MultiPolygon"){ce=[];for(const ye of oe.geometry){const de=[];for(const ge of ye)de.push($r(ge,O));ce.push(de)}}N.push(co(oe.id,re,ce,oe.tags))}return N}function $r(pe,O){const N=[];N.size=pe.size,pe.start!==void 0&&(N.start=pe.start,N.end=pe.end);for(let q=0;q<pe.length;q+=3)N.push(pe[q]+O,pe[q+1],pe[q+2]);return N}function mc(pe,O){if(pe.transformed)return pe;const N=1<<pe.z,q=pe.x,oe=pe.y;for(const re of pe.features){const ce=re.geometry,ye=re.type;if(re.geometry=[],ye===1)for(let de=0;de<ce.length;de+=2)re.geometry.push(ea(ce[de],ce[de+1],O,N,q,oe));else for(let de=0;de<ce.length;de++){const ge=[];for(let Ne=0;Ne<ce[de].length;Ne+=2)ge.push(ea(ce[de][Ne],ce[de][Ne+1],O,N,q,oe));re.geometry.push(ge)}}return pe.transformed=!0,pe}function ea(pe,O,N,q,oe,re){return[Math.round(N*(pe*q-oe)),Math.round(N*(O*q-re))]}function ho(pe,O,N,q,oe){const re=O===oe.maxZoom?0:oe.tolerance/((1<<O)*oe.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:pe.length,source:null,x:N,y:q,z:O,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ye of pe)_c(ce,ye,re,oe);return ce}function _c(pe,O,N,q){const oe=O.geometry,re=O.type,ce=[];if(pe.minX=Math.min(pe.minX,O.minX),pe.minY=Math.min(pe.minY,O.minY),pe.maxX=Math.max(pe.maxX,O.maxX),pe.maxY=Math.max(pe.maxY,O.maxY),re==="Point"||re==="MultiPoint")for(let ye=0;ye<oe.length;ye+=3)ce.push(oe[ye],oe[ye+1]),pe.numPoints++,pe.numSimplified++;else if(re==="LineString")Oe(ce,oe,pe,N,!1,!1);else if(re==="MultiLineString"||re==="Polygon")for(let ye=0;ye<oe.length;ye++)Oe(ce,oe[ye],pe,N,re==="Polygon",ye===0);else if(re==="MultiPolygon")for(let ye=0;ye<oe.length;ye++){const de=oe[ye];for(let ge=0;ge<de.length;ge++)Oe(ce,de[ge],pe,N,!0,ge===0)}if(ce.length){let ye=O.tags||null;if(re==="LineString"&&q.lineMetrics){ye={};for(const ge in O.tags)ye[ge]=O.tags[ge];ye.mapbox_clip_start=oe.start/oe.size,ye.mapbox_clip_end=oe.end/oe.size}const de={geometry:ce,type:re==="Polygon"||re==="MultiPolygon"?3:re==="LineString"||re==="MultiLineString"?2:1,tags:ye};O.id!==null&&(de.id=O.id),pe.features.push(de)}}function Oe(pe,O,N,q,oe,re){const ce=q*q;if(q>0&&O.size<(oe?ce:q))return void(N.numPoints+=O.length/3);const ye=[];for(let de=0;de<O.length;de+=3)(q===0||O[de+2]>ce)&&(N.numSimplified++,ye.push(O[de],O[de+1])),N.numPoints++;oe&&(function(de,ge){let Ne=0;for(let Me=0,nt=de.length,_t=nt-2;Me<nt;_t=Me,Me+=2)Ne+=(de[Me]-de[_t])*(de[Me+1]+de[_t+1]);if(Ne>0===ge)for(let Me=0,nt=de.length;Me<nt/2;Me+=2){const _t=de[Me],tt=de[Me+1];de[Me]=de[nt-2-Me],de[Me+1]=de[nt-1-Me],de[nt-2-Me]=_t,de[nt-1-Me]=tt}})(ye,re),pe.push(ye)}const Zo={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class rh{constructor(O,N){const q=(N=this.options=(function(re,ce){for(const ye in ce)re[ye]=ce[ye];return re})(Object.create(Zo),N)).debug;if(q&&console.time("preprocess data"),N.maxZoom<0||N.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(N.promoteId&&N.generateId)throw new Error("promoteId and generateId cannot be used together.");let oe=(function(re,ce){const ye=[];if(re.type==="FeatureCollection")for(let de=0;de<re.features.length;de++)pn(ye,re.features[de],ce,de);else pn(ye,re.type==="Feature"?re:{geometry:re},ce);return ye})(O,N);this.tiles={},this.tileCoords=[],q&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",N.indexMaxZoom,N.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),oe=(function(re,ce){const ye=ce.buffer/ce.extent;let de=re;const ge=Tn(re,1,-1-ye,ye,0,-1,2,ce),Ne=Tn(re,1,1-ye,2+ye,0,-1,2,ce);return(ge||Ne)&&(de=Tn(re,1,-ye,1+ye,0,-1,2,ce)||[],ge&&(de=Ji(ge,1).concat(de)),Ne&&(de=de.concat(Ji(Ne,-1)))),de})(oe,N),oe.length&&this.splitTile(oe,0,0,0),q&&(oe.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(O,N,q,oe,re,ce,ye){const de=[O,N,q,oe],ge=this.options,Ne=ge.debug;for(;de.length;){oe=de.pop(),q=de.pop(),N=de.pop(),O=de.pop();const Me=1<<N,nt=ta(N,q,oe);let _t=this.tiles[nt];
7if(!_t&&(Ne>1&&console.time("creation"),_t=this.tiles[nt]=ho(O,N,q,oe,ge),this.tileCoords.push({z:N,x:q,y:oe}),Ne)){Ne>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",N,q,oe,_t.numFeatures,_t.numPoints,_t.numSimplified),console.timeEnd("creation"));const ii=`z${N}`;this.stats[ii]=(this.stats[ii]||0)+1,this.total++}if(_t.source=O,re==null){if(N===ge.indexMaxZoom||_t.numPoints<=ge.indexMaxPoints)continue}else{if(N===ge.maxZoom||N===re)continue;if(re!=null){const ii=re-N;if(q!==ce>>ii||oe!==ye>>ii)continue}}if(_t.source=null,O.length===0)continue;Ne>1&&console.time("clipping");const tt=.5*ge.buffer/ge.extent,Lt=.5-tt,zt=.5+tt,Pt=1+tt;let Kt=null,or=null,vr=null,lr=null,Er=Tn(O,Me,q-tt,q+zt,0,_t.minX,_t.maxX,ge),Qi=Tn(O,Me,q+Lt,q+Pt,0,_t.minX,_t.maxX,ge);O=null,Er&&(Kt=Tn(Er,Me,oe-tt,oe+zt,1,_t.minY,_t.maxY,ge),or=Tn(Er,Me,oe+Lt,oe+Pt,1,_t.minY,_t.maxY,ge),Er=null),Qi&&(vr=Tn(Qi,Me,oe-tt,oe+zt,1,_t.minY,_t.maxY,ge),lr=Tn(Qi,Me,oe+Lt,oe+Pt,1,_t.minY,_t.maxY,ge),Qi=null),Ne>1&&console.timeEnd("clipping"),de.push(Kt||[],N+1,2*q,2*oe),de.push(or||[],N+1,2*q,2*oe+1),de.push(vr||[],N+1,2*q+1,2*oe),de.push(lr||[],N+1,2*q+1,2*oe+1)}}getTile(O,N,q){O=+O,N=+N,q=+q;const oe=this.options,{extent:re,debug:ce}=oe;if(O<0||O>24)return null;const ye=1<<O,de=ta(O,N=N+ye&ye-1,q);if(this.tiles[de])return mc(this.tiles[de],re);ce>1&&console.log("drilling down to z%d-%d-%d",O,N,q);let ge,Ne=O,Me=N,nt=q;for(;!ge&&Ne>0;)Ne--,Me>>=1,nt>>=1,ge=this.tiles[ta(Ne,Me,nt)];return ge&&ge.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",Ne,Me,nt),console.time("drilling down")),this.splitTile(ge.source,Ne,Me,nt,O,N,q),ce>1&&console.timeEnd("drilling down"),this.tiles[de]?mc(this.tiles[de],re):null):null}}function ta(pe,O,N){return 32*((1<<pe)*N+O)+pe}function oi(pe,O){const N=pe.tileID.canonical;if(!this._geoJSONIndex)return void O(null,null);const q=this._geoJSONIndex.getTile(N.z,N.x,N.y);if(!q)return void O(null,null);const oe=ge=>ge.tags&&"3d_elevation_id"in ge.tags&&"source"in ge.tags&&ge.tags.source==="elevation",re=q.features.filter((ge=>oe(ge)));let ce={_geojsonTileLayer:q.features};re.length>0&&(ce={_geojsonTileLayer:q.features.filter((ge=>!oe(ge))),hd_road_elevation:re});const ye=new Eo(ce),de=(function(ge){const Ne=new s.bt;for(const Me of Object.keys(ge))Ne.writeMessage(3,ml,{name:Me,features:ge[Me]});return Ne.finish()})(ce).buffer;O(null,{vectorTile:ye,rawData:de})}class hn extends kn{constructor(O,N,q,oe,re,ce,ye){super(O,N,q,oe,re,oi,ye),ce&&(this.loadGeoJSON=ce),this._dynamicIndex=new Vt}loadData(O,N){const q=O&&O.request,oe=q&&q.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(O,((re,ce)=>{if(re||!ce)return N(re);if(typeof ce!="object")return N(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`));{try{if(O.filter){const de=s.U(O.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(de.result==="error")throw new Error(de.value.map((ge=>`${ge.key}: ${ge.message}`)).join(", "));ce.features=ce.features.filter((ge=>de.value.evaluate({zoom:0},ge)))}O.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),O.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),O.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=O.cluster?new ih((function({superclusterOptions:de,clusterProperties:ge}){if(!ge||!de)return de;const Ne={},Me={},nt={accumulated:null,zoom:0},_t={properties:null},tt=Object.keys(ge);for(const Lt of tt){const[zt,Pt]=ge[Lt],Kt=s.U(Pt),or=s.U(typeof zt=="string"?[zt,["accumulated"],["get",Lt]]:zt);Ne[Lt]=Kt.value,Me[Lt]=or.value}return de.map=Lt=>{_t.properties=Lt;const zt={};for(const Pt of tt)zt[Pt]=Ne[Pt].evaluate(nt,_t);return zt},de.reduce=(Lt,zt)=>{_t.properties=zt;for(const Pt of tt)nt.accumulated=Lt[Pt],Lt[Pt]=Me[Pt].evaluate(nt,_t)},de})(O)).load(ce.features):O.dynamic?this._dynamicIndex:(function(de,ge){return new rh(de,ge)})(ce,O.geojsonVtOptions)}catch(de){return N(de)}const ye={};if(oe){const de=Wr(q);de&&(ye.resourceTiming={},ye.resourceTiming[O.source]=JSON.parse(JSON.stringify(de)))}N(null,ye)}}))}reloadTile(O,N){const q=this.loaded;return q&&q[O.uid]?O.partial?N(null,void 0):super.reloadTile(O,N):this.loadTile(O,N)}loadGeoJSON(O,N){if(O.request)s.m(O.request,N);else{if(typeof O.data!="string")return N(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`));setTimeout((()=>{try{return N(null,JSON.parse(O.data))}catch{return N(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`))}}),0)}}getClusterExpansionZoom(O,N){try{N(null,this._geoJSONIndex.getClusterExpansionZoom(O.clusterId))}catch(q){N(q)}}getClusterChildren(O,N){try{N(null,this._geoJSONIndex.getChildren(O.clusterId))}catch(q){N(q)}}getClusterLeaves(O,N){try{N(null,this._geoJSONIndex.getLeaves(O.clusterId,O.limit,O.offset))}catch(q){N(q)}}}class nh{constructor(O,N,q){this.tileID=new s.aQ(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.tileZoom=O.tileZoom,this.uid=O.uid,this.zoom=O.zoom,this.canonical=O.tileID.canonical,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=O.projection,this.brightness=N,this.worldview=q}parse(O,N,q,oe){this.status="parsing";const re=new s.aQ(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),ce=[],ye=N.familiesBySource[q.source],de=new s.fn(re,q.promoteId);de.bucketLayerIDs=[],de.is3DTile=!0,s.fC(O).then((ge=>{if(!ge)return oe(new Error("Could not parse tile"));const Ne=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("MAPBOX_mesh_features")||ge.json.asset.extras&&ge.json.asset.extras.MAPBOX_mesh_features,Me=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("EXT_meshopt_compression"),nt=ne
7w s.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const _t in ye)for(const tt of ye[_t]){const Lt=tt[0];de.bucketLayerIDs.push(tt.map((Kt=>s.B(Kt.id,Kt.scope)))),Lt.recalculate(nt,[]);const zt=s.fD(ge,1/s.d7(q.tileID.canonical)),Pt=new s.fE(tt,zt,re,Ne,Me,this.brightness,de,this.worldview);Ne||(Pt.needsUpload=!0),ce.push(Pt),Pt.evaluate(Lt)}this.status="done",oe(null,{buckets:ce,featureIndex:de,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})})).catch((ge=>oe(new Error(ge.message))))}}class ia{constructor(O,N,q,oe,re,ce,ye,de){this.actor=O,this.layerIndex=N,this.availableImages=q,this.availableModels=oe,this.brightness=ye,this.loading={},this.loaded={},this.worldview=de}loadTile(O,N){const q=O.uid,oe=this.loading[q]=new nh(O,this.brightness,this.worldview);s.bu(O.request,((re,ce)=>{const ye=!this.loading[q];return delete this.loading[q],ye||re?(oe.status="done",ye||(this.loaded[q]=oe),N(re)):ce&&ce.byteLength!==0?void oe.parse(ce,this.layerIndex,O,((de,ge)=>{oe.status="done",this.loaded=this.loaded||{},this.loaded[q]=oe,de||!ge?N(de):N(null,ge)})):(oe.status="done",this.loaded[q]=oe,N())}))}reloadTile(O,N){const q=this.loaded,oe=O.uid;if(q&&q[oe]){const re=q[oe];re.projection=O.projection,re.brightness=O.brightness;const ce=(ye,de)=>{re.reloadCallback&&(delete re.reloadCallback,this.loadTile(O,N)),N(ye,de)};re.status==="parsing"?re.reloadCallback=ce:re.status==="done"&&this.loadTile(O,N)}}abortTile(O,N){const q=O.uid;this.loading[q]&&delete this.loading[q],N()}removeTile(O,N){const q=this.loaded,oe=O.uid;q&&q[oe]&&delete q[oe],N()}}class yl{constructor(O){this.self=O,this.actor=new s.fG(O,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new s.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=s.cm({name:"mercator"}),this.workerSourceTypes={vector:kn,geojson:hn,"raster-dem":So,"raster-array":Sr,"batched-model":ia},this.workerSources={},this.self.registerWorkerSource=(N,q)=>{if(this.workerSourceTypes[N])throw new Error(`Worker source with name "${N}" already registered.`);this.workerSourceTypes[N]=q},this.self.registerRTLTextPlugin=N=>{if(s.fH.isParsed())throw new Error("RTL text plugin already registered.");s.fH.setState({pluginStatus:s.fI.parsed,pluginURL:s.fH.getPluginURL()}),s.fH.applyArabicShaping=N.applyArabicShaping,s.fH.processBidirectionalText=N.processBidirectionalText,s.fH.processStyledBidirectionalText=N.processStyledBidirectionalText;for(const q of this.rtlPluginParsingListeners)q(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(O,N,q){delete this.layerIndexes[O],delete this.availableImages[O],delete this.availableModels[O],delete this.workerSources[O],q()}checkIfReady(O,N,q){q()}setReferrer(O,N){this.referrer=N}spriteLoaded(O,N){this.isSpriteLoaded[O]||(this.isSpriteLoaded[O]={});const{scope:q,isLoaded:oe}=N;if(this.isSpriteLoaded[O][q]=oe,this.workerSources[O]&&this.workerSources[O][q])for(const re in this.workerSources[O][q]){const ce=this.workerSources[O][q][re];for(const ye in ce){const de=ce[ye];de instanceof kn&&(de.isSpriteLoaded=oe,de.fire(new s.z("isSpriteLoaded")))}}}setImages(O,N,q){this.availableImages[O]||(this.availableImages[O]={});const{scope:oe,images:re}=N;if(this.availableImages[O][oe]=re,this.workerSources[O]&&this.workerSources[O][oe]){for(const ce in this.workerSources[O][oe]){const ye=this.workerSources[O][oe][ce];for(const de in ye)ye[de].availableImages=re}q()}else q()}setModels(O,{scope:N,models:q},oe){if(this.availableModels[O]||(this.availableModels[O]={}),this.availableModels[O][N]=q,this.workerSources[O]&&this.workerSources[O][N]){for(const re in this.workerSources[O][N]){const ce=this.workerSources[O][N][re];for(const ye in ce)ce[ye].availableModels=q}oe()}else oe()}setProjection(O,N){this.projections[O]=s.cm(N)}setBrightness(O,N,q){this.brightness=N,q()}setWorldview(O,N,q){this.worldview=N,q()}setLayers(O,N,q){this.getLayerIndex(O,N.scope).replace(N.layers,N.options),q()}updateLayers(O,N,q){this.getLayerIndex(O,N.scope).update(N.layers,N.removedIds,N.options),q()}loadTile(O,N,q){N.projection=this.projections[O]||this.defaultProjection,this.getWorkerSource(O,N.type,N.source,N.scope).loadTile(N,q)}decodeRasterArray(O,N,q){this.getWorkerSource(O,N.type,N.source,N.scope).decodeRasterArray(N,q)}reloadTile(O,N,q){N.projection=this.projections[O]||this.defaultProjection,this.getWorkerSource(O,N.type,N.source,N.scope).reloadTile(N,q)}abortTile(O,N,q){this.getWorkerSource(O,N.type,N.source,N.scope).abortTile(N,q)}removeTile(O,N,q){this.getWorkerSource(O,N.type,N.source,N.scope).removeTile(N,q)}removeSource(O,N,q){if(!(this.workerSources[O]&&this.workerSources[O][N.scope]&&this.workerSources[O][N.scope][N.type]&&this.workerSources[O][N.scope][N.type][N.source]))return;const oe=this.workerSources[O][N.scope][N.type][N.source];delete this.workerSources[O][N.scope][N.type][N.source],oe.removeSource!==void 0?oe.removeSource(N,q):q()}loadWorkerSource(O,N,q){try{this.self.importScripts(N.url),q()}catch(oe){q(oe)}}syncRTLPluginState(O,N,q){if(s.fH.isParsed())q(null,!0);else if(s.fH.isParsing())this.rtlPluginParsingListeners.push(q);else try{s.fH.setState(N);const oe=s.fH.getPluginURL();!s.fH.isLoaded()||s.fH.isParsed()||s.fH.isParsing()||oe==null||(s.fH.setState({pluginStatus:s.fI.parsing,pluginURL:s.fH.getPluginURL()}),this.self.importScripts(oe),s.fH.isParsed()?q(null,!0):this.rtlPluginParsingListeners.push(q))}catch(oe){q(oe)}}setDracoUrl(O,N){this.dracoUrl=N}getAvailableImages(O,N){this.availableImages[O]||(this.availableImages[O]={});let q=this.availableImages[O][N];return q||(q=[]),q}getAvailableModels(O,N){this.availableModels[O]||(this.availableModels[O]={});let q=this.availableModels[O][N];return q||(q={}),q}getLayerIndex(O,N){this.layerIndexes[O]||(this.layerIndexes[O]={});let q=this.layerIndexes[O][N];return q||(q=this.layerIndexes[O][N]=new Ca,q.scope=N),q}getWorkerSource(O,N,q,oe){const re=this.workerSources;return re[O]||(re[O]={}),re[O][oe]||(re[O][oe]={}),re[O][oe][N]||(re[O][oe][N]={}),this.isSpriteLoaded[O]||(this.isSpriteLoaded[O]={}),re[O][oe][N][q]||(re[O][oe][N][q]=new this.workerSourceTypes[N]({send:(ce,ye,de,ge,Ne,Me)=>this.actor.send(ce,ye,de,O,Ne,Me),scheduler:this.actor.scheduler},this.getLayerIndex(O,oe),this.getAvailableImages(O,oe),this.getAvailableModels(O,oe),this.isSpriteLoaded[O][oe],void 0,this.brightness,this.worldview)),re[O][oe][N][q]}rasterizeImagesWorker(O,N,q){const oe=new Map;for(const[re,{image:ce,imageVariant:ye}]of N.tasks.entries()){const de=this.imageRasterizer.rasterize(ye,ce,N.scope,O);oe.set(re,de)}q(void 0,oe)}removeRasterizedImages(O,N,q){this.imageRasterizer.removeImagesFromCacheByIds(N.imageIds,N.scope,O),q()}enforceCacheSizeLimit(O,N){s.fJ(N)}getWorkerPerformanceMetrics(O,N,q){q(void 0,void 0)}}return s.fF(self)&&(self.worker=new yl(self)),yl})),pl(["./shared"],(function(s){var Wr="3.17.0";const $i={create:"create",load:"load",fullLoad:"fullLoad"},so={mark(l){performance.mark(l)},measure(l,t,n){performance.measure(l,t,n)}};function Ca(l){const t=l.name.split("?")[0];return s.a(t)&&t.includes("mapbox-gl.js")?"javascript":s.a(t)&&t.includes("mapbox-gl.css")?"css":s.b(t)?"fontRange":s.c(t)?"sprite":s.i(t)?"style":s.d(t)?"tilejson":"other"}var ao,rr={},lo=(function(){if(ao)return rr;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":(function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,m,g=new Blob([""],{type:"text/javascript"}),x=URL.createObjectURL(g);try{m=new Worker(x),p=!0}catch{p=!1}return m&&m.terminate(),URL.revokeObjectURL(x),p})()?(function(){var p=document.createElement("canvas");p.width=p.height=1;var m=p.getContext("2d");if(!m)return!1;var g=m.getImageData(0,0,1,1);return g&&g.width===p.width})()?(n[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(n[d]=(function(p){var m,g=(function(x){var w=document.createElement("canvas"),S=Object.create(l.webGLContextAttributes);return S.failIfMajorPerformanceCaveat=x,w.getContext("webgl2",S)})(p);if(!g)return!1;try{m=g.createShader(g.VERTEX_SHADER)}catch{return!1}return!(!m||g.isContextLost())&&(g.shaderSource(m,"void main() {}"),g.compileShader(m),g.getShaderParameter(m,g.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}ao=1,rr.supported=l,rr.notSupportedReason=t;var n={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},rr})();
7function mi(l,t,n){const c=document.createElement(l);return t!=null&&(c.className=t),n&&n.appendChild(c),c}function Ni(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 Xr=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Gi=Xr&&Xr.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Qr;function Hr(){Xr&&Gi&&(Qr=Xr[Gi],Xr[Gi]="none")}function Wn(){Xr&&Gi&&(Xr[Gi]=Qr)}function wn(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",wn,!0)}function kn(){window.addEventListener("click",wn,!0),window.setTimeout((()=>{window.removeEventListener("click",wn,!0)}),0)}function So(l,t){const n=l.getBoundingClientRect();return dr(l,n,t)}function ki(l,t){const n=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(dr(l,n,t[d]));return c}function Sr(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function dr(l,t,n){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new s.P((n.clientX-t.left)*c,(n.clientY-t.top)*c)}const Bn="01",ei="NO_ACCESS_TOKEN";class Eo{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",Bn,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(!s.h(t))return t;const c=nr(t);return c.params.push(`sdk=js-${Wr}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!s.h(t))return t;const c=nr(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeModelURL(t,n){if(!s.h(t))return t;const c=nr(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeSourceURL(t,n,c,d){if(!s.h(t))return t;const p=nr(t);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),c&&p.params.push(`language=${c}`),d&&p.params.push(`worldview=${d}`),this._makeAPIURL(p,this._customAccessToken||n)}normalizeIconsetURL(t,n){const c=nr(t);return s.h(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||n)):Vt(c)}normalizeSpriteURL(t,n,c,d){const p=nr(t);return s.h(t)?(p.path=`/styles/v1${p.path}/sprite${n}${c}`,this._makeAPIURL(p,this._customAccessToken||d)):(p.path+=`${n}${c}`,Vt(p))}normalizeTileURL(t,n,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!s.h(t))return t;const d=nr(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||c&&d.authority!=="raster"&&c===512?"@2x":""}${s.k.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${s.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${s.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${s.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${s.e.TILE_URL_VERSION}${d.path}`);const p=this._customAccessToken||(function(m){for(const g of m){const x=g.match(/^access_token=(.*)$/);if(x)return x[1]}return null})(d.params)||s.e.ACCESS_TOKEN;return s.e.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,p)}canonicalizeTileURL(t,n){const c=nr(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${s.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${s.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${s.e.TILE_URL_VERSION}/`,"")}`;let p=c.params;return n&&(p=p.filter((m=>!m.match(/^access_token=/)))),p.length&&(d+=`?${p.join("&")}`),d}canonicalizeTileset(t,n){const c=!!n&&s.h(n),d=[];for(const p of t.tiles||[])s.j(p)?d.push(this.canonicalizeTileURL(p,c)):d.push(p);return d}_makeAPIURL(t,n){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=nr(s.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const p=t.params.indexOf("secure");p>=0&&t.params.splice(p,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!s.e.REQUIRE_ACCESS_TOKEN)return Vt(t);if(n=n||s.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((p=>p.indexOf("access_token")===-1)),t.params.push(`access_token=${n||""}`),Vt(t)}}const Ir=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function nr(l){const t=l.match(Ir);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 Vt(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const gi="mapbox.eventData";function Or(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(s.l(t[1]))}catch{return null}}class cn{constructor(t){this.type=t,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const n=Or(s.e.ACCESS_TOKEN);let c="";return c=n&&n.u?s.f(n.u):s.e.ACCESS_TOKEN||"",t?`${gi}.${t}:${c}`:`${gi}:${c}`}fetchEventData(){const t=s.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp");if(t)try{const p=localStorage.getItem(n);p&&(this.eventData=JSON.parse(p));const m=localStorage.getItem(c);m&&(this.anonId=m);const g=localStorage.getItem(d);g&&(this.anonIdTimestamp=Number(g));const x=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<x)&&this.refreshUUID()}catch{s.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=s.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const t=s.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp"),p=this.anonId,m=this.anonIdTimestamp;if(t&&p)try{localStorage.setItem(c,p),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData)),m&&localStorage.setItem(d,m.toString())}catch{s.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,n,c,d){if(!s.e.EVENTS_URL)return;const p=nr(s.e.EVENTS_URL);p.params.push(`access_token=${d||s.e.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},g=n?Object.assign(m,n):m,x={url:Vt(p),headers:{"Content-Type":"text/plain"},body:JSON.stringify([g])};this.pendingRequest=s.p(x,(w=>{this.pendingRequest=null,c(w),this.saveEventData(),this.processRequests(d)}))}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}class Rn extends cn{constructor(t){super("metrics"),t&&(this.data=t)}postMetricsEvent(t){if(!s.e.EVENTS_URL||!t&&!s.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),s.v(this.anonId)||this.refreshUUID();const n=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:n},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:n,payload:c}=this.queue.shift();this.postEvent(n,c,(()=>{}),t)}}const zn=new class extends cn{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){s.e.EVENTS_URL&&s.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some((n=>s.h(n)||s.j(n)))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Or(s.e.ACCESS_TOKEN),n=t?t.u:s.e.ACCESS_TOKEN;let c=n!==this.eventData.tokenU;s.v(this.anonId)||(this.refreshUUID(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const p=new Date(this.eventData.lastSuccess),m=new Date(d),g=(d-this.eventData.lastSuccess)/864e5;c=c||g>=1||g<-1||p.getDate()!==m.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Wr,skuId:Bn,"enabled.telemetry":!1,userId:this.anonId},(p=>{p||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)}),l):this.processRequests()}},Zi=zn.postTurnstileEvent.bind(zn),qr=new class extends cn{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,n,c){this.skuToken=t,this.errorCb=c,s.e.EVENTS_URL&&(n||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(ei)))}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.anonIdTimestamp||this.fetchEventData(),s.v(this.anonId)||this.refreshUUID(),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Wr,skuId:Bn,skuToken:this.skuToken,userId:this.anonId},(c=>{c?this.errorCb(c):t&&(this.success[t]=!0)}),l))}remove(){this.errorCb=null}},fc=qr.postMapLoadEvent.bind(qr),ml=new class extends cn{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=s.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:n,style:c,importedStyles:d}=t;if(!s.e.EVENTS_URL||!l&&!s.e.ACCESS_TOKEN)return;const p=this.getMapInstanceId(n),m={mapInstanceId:p,eventId:this.getEventId(p),style:c};d.length&&(m.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:m},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:n}=this.queue.shift();this.postEvent(t,n,(()=>{}),l)}},pc=ml.postStyleLoadEvent.bind(ml),ys=new Rn({attributes:[{name:"maps/js/layer
7-animations/style-with-appearances"}]}),Bi=ys.postMetricsEvent.bind(ys),fr=new Rn({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),en=fr.postMetricsEvent.bind(fr),Ws=new class extends cn{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){s.e.EVENTS_URL&&(l||s.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:n}=this.queue.shift(),c=(function(d){const p=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),g=(function(C){const z={};if(C){for(const R in C)if(R!=="other")for(const k of C[R]){const F=`${R}ResolveRangeMin`,U=`${R}ResolveRangeMax`,H=`${R}RequestCount`,j=`${R}RequestCachedCount`;z[F]=Math.min(z[F]||1/0,k.startTime),z[U]=Math.max(z[U]||-1/0,k.responseEnd);const te=Y=>{z[Y]===void 0&&(z[Y]=0),++z[Y]};k.transferSize!==void 0&&k.transferSize===0&&te(j),te(H)}}return z})((function(C,z){const R={};if(C)for(const k of C){const F=z(k);R[F]===void 0&&(R[F]=[]),R[F].push(k)}return R})(p,Ca)),x=window.devicePixelRatio,w=navigator.connection||navigator.mozConnection||navigator.webkitConnection,S=w?w.effectiveType:void 0,M={counters:[],metadata:[],attributes:[]},A=(C,z,R)=>{R!=null&&C.push({name:z,value:R.toString()})};for(const C in g)A(M.counters,C,g[C]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(A(M.counters,"interactionRangeMin",d.interactionRange[0]),A(M.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const C of Object.values($i)){const z=m.find((R=>R.name===C));z&&A(M.counters,C,z.startTime)}return A(M.counters,"visibilityHidden",d.visibilityHidden),A(M.attributes,"style",(function(C){if(C)for(const z of C){const R=z.name.split("?")[0];if(s.i(R)){const k=R.split("/").slice(-2);if(k.length===2)return`mapbox://styles/${k[0]}/${k[1]}`}}})(p)),A(M.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),A(M.attributes,"fogEnabled",d.fogEnabled?"true":"false"),A(M.attributes,"projection",d.projection),A(M.attributes,"zoom",d.zoom),A(M.metadata,"devicePixelRatio",x),A(M.metadata,"connectionEffectiveType",S),A(M.metadata,"navigatorUserAgent",navigator.userAgent),A(M.metadata,"screenWidth",window.screen.width),A(M.metadata,"screenHeight",window.screen.height),A(M.metadata,"windowWidth",window.innerWidth),A(M.metadata,"windowHeight",window.innerHeight),A(M.metadata,"mapWidth",d.width/x),A(M.metadata,"mapHeight",d.height/x),A(M.metadata,"webglRenderer",d.renderer),A(M.metadata,"webglVendor",d.vendor),A(M.metadata,"sdkVersion",Wr),A(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)}},gr=Ws.postPerformanceEvent.bind(Ws),xs=new class extends cn{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,n,c){if(!s.e.API_URL||!s.e.SESSION_PATH)return;const d=nr(s.e.API_URL+s.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||s.e.ACCESS_TOKEN||""}`);const p={url:Vt(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=s.g(p,(m=>{this.pendingRequest=null,n(m),this.saveEventData(),this.processRequests(c)}))}getSessionAPI(l,t,n,c){this.skuToken=t,this.errorCb=c,s.e.SESSION_PATH&&s.e.API_URL&&(n||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(ei)))}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}},vs=xs.getSessionAPI.bind(xs),Dn=new Set;function un(l,t){t?Dn.add(l):Dn.delete(l)}class xr{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(s.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function ih(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class Pa extends s.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&s.r()&&(this.imageRasterizerDispatcher=new s.D(s.t(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new s.q({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const 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 s.x),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())}
7addImage(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 s.y(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new s.y(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"&&(s.r()?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=>s.I.from(n)))}getImages(t,n,c){const d=[],p=[],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)?p.push(S):M.addPendingRequest(S))}if(d.length===0)return void this._notify(p,n,c);let g=!0;const x=!!this.loaded.get(n),w=this.images.get(n);if(!x)for(const S of d)w.has(S.toString())||(g=!1);x||g?this._notify(d,n,c):this.requestors.push({ids:d,scope:n,callback:c})}rasterizeImages(t,n){const c=new Map,{tasks:d,scope:p}=t;for(const[m,g]of d.entries()){const x=this.getImage(g.id,p);x&&c.set(m,{image:x,imageVariant:g})}this._rasterizeImages(p,c,n)}_rasterizeImages(t,n,c){if(s.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:n,scope:t},c);else{const d=new Map;for(const[p,{image:m,imageVariant:g}]of n.entries())d.set(p,this.imageRasterizer.rasterize(g,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),p=new Map;for(const m of t){if(!d.get(m.toString())){if(m.iconsetId)continue;this.fire(new s.z("styleimagemissing",{id:m.name}))}const g=d.get(m.toString());if(!g){s.w(`Image "${m.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const x={data:g.usvg?null:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,usvg:g.usvg,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)};g.usvg&&Object.assign(x,{width:g.icon.usvg_tree.width,height:g.icon.usvg_tree.height}),p.set(s.I.toString(m),x)}c(null,p)}getPixelSize(t){const{width:n,height:c}=this.atlasImage.get(t);return{width:n,height:c}}getPattern(t,n,c){const d=t.toString(),p=this.patterns.get(n),m=p.get(d),g=this.getImage(t,n);if(!g)return null;if(m){if(m.position.version===g.version)return m.position;m.position.version=g.version}else{if(g.usvg&&!g.data){const x=this.getPatternInFlightId(d,n);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const w=new s.A(t).scaleSelf(s.o.devicePixelRatio),S=new Map([[w.toString(),{image:g,imageVariant:w}]]);return this._rasterizeImages(n,S,((M,A)=>this.storePatternImage(w,n,g,c,A))),null}this.storePattern(t,n,g)}return this._updatePatternAtlas(n,c),p.get(d).position}getPatternInFlightId(t,n){return s.B(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,c,d,p){const m=t.toString(),g=p?p.get(m):void 0;g&&(c.data=g,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*s.C,h:c.data.height+2*s.C,x:0,y:0},p=new s.F(d,c,s.C);this.patterns.get(n).set(t.toString(),{bin:d,position:p})}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 s.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:w})=>w)),{w:p,h:m}=s.G(d),g=this.atlasImage.get(t);g.resize({width:p||1,height:m||1});const x=this.images.get(t);for(const[w,{bin:S,position:M}]of c.entries()){let A=M.padding;const C=S.x+A,z=S.y+A,R=x.get(w).data,k=R.width,F=R.height;A=A>1?A-1:A,s.q.copy(R,g,{x:0,y:0},{x:C,y:z},{width:k,height:F},n),s.q.copy(R,g,{x:0,y:F-A},{x:C,y:z-A},{width:k,height:A},n),s.q.copy(R,g,{x:0,y:0},{x:C,y:z+F},{width:k,height:A},n),s.q.copy(R,g,{x:k-A,y:0},{x:C-A,y:z},{width:A,height:F},n),s.q.copy(R,g,{x:0,y:0},{x:C+k,y:z},{width:A,height:F}
7,n),s.q.copy(R,g,{x:k-A,y:F-A},{x:C-A,y:z-A},{width:A,height:A},n),s.q.copy(R,g,{x:0,y:F-A},{x:C+k,y:z-A},{width:A,height:A},n),s.q.copy(R,g,{x:0,y:0},{x:C+k,y:z+F},{width:A,height:A},n),s.q.copy(R,g,{x:k-A,y:0},{x:C-A,y:z+F},{width:A,height:A},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}dispatchRenderCallbacks(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 p=c.get(d.toString());ih(p)&&this.updateImage(d,n,p)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Xs(l){const t=l.value,n=l.valueSpec,c=l.style,d=l.styleSpec,p=l.key,m=l.arrayElementValidator||Ji;if(!Array.isArray(t))return[new s.V(p,t,`array expected, ${s.K(t)} found`)];if(n.length&&t.length!==n.length)return[new s.V(p,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new s.V(p,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let g={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(g.function=n.function),s.H(n.value)&&(g=n.value);let x=[];for(let w=0;w<t.length;w++)x=x.concat(m({array:t,arrayIndex:w,value:t[w],valueSpec:g,style:c,styleSpec:d,key:`${p}[${w}]`},!0));return x}function bs(l){const t=l.key,n=l.value,c=l.valueSpec;if(!s.L(n))return[new s.V(t,n,`number expected, ${s.K(n)} found`)];if(n!=n)return[new s.V(t,n,"number expected, NaN found")];if("minimum"in c){let d=c.minimum;if(Array.isArray(c.minimum)&&(d=c.minimum[l.arrayIndex]),n<d)return[new s.V(t,n,`${n} is less than the minimum value ${d}`)]}if("maximum"in c){let d=c.maximum;if(Array.isArray(c.maximum)&&(d=c.maximum[l.arrayIndex]),n>d)return[new s.V(t,n,`${n} is greater than the maximum value ${d}`)]}return[]}function ws(l){const t=l.key,n=l.value;if(!s.H(n))return[new s.V(t,n,`object expected, ${s.K(n)} found`)];const c=l.valueSpec,d=s.J(n.type);let p,m,g,x={};const w=d!=="categorical"&&n.property===void 0,S=!w,M=(function(R){const k=R.stops;return Array.isArray(k)&&Array.isArray(k[0])&&s.H(k[0][0])})(n),A=$r({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(R){if(d==="identity")return[new s.V(R.key,R.value,'identity function may not have a "stops" property')];let k=[];const F=R.value;return k=k.concat(Xs({key:R.key,value:F,valueSpec:R.valueSpec,style:R.style,styleSpec:R.styleSpec,arrayElementValidator:C})),Array.isArray(F)&&F.length===0&&k.push(new s.V(R.key,F,"array must have at least one stop")),k},default:function(R){return Ji({key:R.key,value:R.value,valueSpec:c,style:R.style,styleSpec:R.styleSpec})}}});return d==="identity"&&w&&A.push(new s.V(l.key,l.value,'missing required property "property"')),d==="identity"||n.stops||A.push(new s.V(l.key,l.value,'missing required property "stops"')),d==="exponential"&&c.expression&&!s.M(c)&&A.push(new s.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(S&&!s.N(c)?A.push(new s.V(l.key,l.value,"property functions not supported")):w&&!s.O(c)&&A.push(new s.V(l.key,l.value,"zoom functions not supported"))),d!=="categorical"&&!M||n.property!==void 0||A.push(new s.V(l.key,l.value,'"property" property is required')),A;function C(R){let k=[];const F=R.value,U=R.key;if(!Array.isArray(F))return[new s.V(U,F,`array expected, ${s.K(F)} found`)];if(F.length!==2)return[new s.V(U,F,`array length 2 expected, length ${F.length} found`)];if(M){if(!s.H(F[0]))return[new s.V(U,F,`object expected, ${s.K(F[0])} found`)];const H=F[0];if(H.zoom===void 0)return[new s.V(U,F,"object stop key must have zoom")];if(H.value===void 0)return[new s.V(U,F,"object stop key must have value")];const j=s.J(H.zoom);if(typeof j!="number")return[new s.V(U,H.zoom,"stop zoom values must be numbers")];if(g&&g>j)return[new s.V(U,H.zoom,"stop zoom values must appear in ascending order")];j!==g&&(g=j,m=void 0,x={}),k=k.concat($r({key:`${U}[0]`,value:F[0],valueSpec:{zoom:{}},style:R.style,styleSpec:R.styleSpec,objectElementValidators:{zoom:bs,value:z}}))}else k=k.concat(z({key:`${U}[0]`,value:F[0],style:R.style,styleSpec:R.styleSpec},F));return s.Q(s.S(F[1]))?k.concat([new s.V(`${U}[1]`,F[1],"expressions are not allowed in function stops.")]):k.concat(Ji({key:`${U}[1]`,value:F[1],valueSpec:c,style:R.style,styleSpec:R.styleSpec}))}function z(R,k){const F=s.K(R.value),U=s.J(R.value),H=R.value!==null?R.value:k;if(p){if(F!==p)return[new s.V(R.key,H,`${F} stop domain type must match previous stop domain type ${p}`)]}else p=F;
7if(F!=="number"&&F!=="string"&&F!=="boolean"&&typeof U!="number"&&typeof U!="string"&&typeof U!="boolean")return[new s.V(R.key,H,"stop domain value must be a number, string, or boolean")];if(F!=="number"&&d!=="categorical"){let j=`number expected, ${F} found`;return s.N(c)&&d===void 0&&(j+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(R.key,H,j)]}return d!=="categorical"||F!=="number"||typeof U=="number"&&isFinite(U)&&Math.floor(U)===U?d!=="categorical"&&F==="number"&&typeof U=="number"&&typeof m=="number"&&m!==void 0&&U<m?[new s.V(R.key,H,"stop domain values must appear in ascending order")]:(m=U,d==="categorical"&&U in x?[new s.V(R.key,H,"stop domain values must be unique")]:(x[U]=!0,[])):[new s.V(R.key,H,`integer expected, found ${String(U)}`)]}}function tn(l){const t=(l.expressionContext==="property"?s.W:s.U)(s.S(l.value),l.valueSpec);if(t.result==="error")return t.value.map((c=>new s.V(`${l.key}${c.key}`,l.value,c.message)));const n=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!n.outputDefined())return[new s.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!s.Z(n))return[new s.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return Ho(n,l);if(l.expressionContext==="appearance")return Ra(n,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!s.X(n,["zoom","feature-state"]))return[new s.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!s.Y(n))return[new s.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ho(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(
7d);if(n.size===0)return[];const c=[];return l instanceof s._&&n.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild((d=>{c.push(...Ho(d,t))})),c)}function Ra(l,t){const n=new Set;if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.add(d);if(n.size===0)return[];const c=[];return l instanceof s._&&!n.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] is not an allowed parameter`)]:(l.eachChild((d=>{c.push(...Ra(d,t))})),c)}function co(l){const t=l.key,n=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(s.J(n))===-1&&d.push(new s.V(t,n,`expected one of [${c.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(c.values).indexOf(s.J(n))===-1&&d.push(new s.V(t,n,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function qo(l){return s.a2(s.S(l.value))?tn(Object.assign({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):pn(l)}function pn(l){const t=l.value,n=l.key;if(!Array.isArray(t))return[new s.V(n,t,`array expected, ${s.K(t)} found`)];if(t.length<1)return[new s.V(n,t,"filter array must have at least 1 element")];const c=l.styleSpec;let d=co({key:`${n}[0]`,value:t[0],valueSpec:c.filter_operator});const p=()=>{t.length>=2&&(s.a0(t[1])||d.push(new s.V(`${n}[1]`,t[1],`string expected, ${s.K(t[1])} found`)));for(let m=2;m<t.length;m++)s.J(t[1])==="$type"?d=d.concat(co({key:`${n}[${m}]`,value:t[m],valueSpec:c.geometry_type})):s.a0(t[m])||s.L(t[m])||s.$(t[m])||d.push(new s.V(`${n}[${m}]`,t[m],`string, number, or boolean expected, ${s.K(t[m])} found.`))};switch(s.J(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&s.J(t[1])==="$type"&&d.push(new s.V(n,t,`"$type" cannot be use with operator "${t[0]}"`)),t.length!==3&&d.push(new s.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`)),p();break;case"==":case"!=":t.length!==3&&d.push(new s.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`)),p();break;case"in":case"!in":p();break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)d=d.concat(pn({key:`${n}[${m}]`,value:t[m],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":t.length!==2?d.push(new s.V(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):s.a0(t[1])||d.push(new s.V(`${n}[1]`,t[1],`string expected, ${s.K(t[1])} found`))}return d}function Ys(l,t){const n=l.key,c=l.style,d=l.layer,p=l.styleSpec,m=l.value,g=l.objectKey,x=p[`${t}_${l.layerType}`];if(!x)return[];const w=g.match(/^(.*)-use-theme$/);if(w&&x[w[1]])return s.Q(s.S(m))?[].concat(Ji({key:n,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:g})):Ji({key:n,value:m,valueSpec:{type:"string"},style:c,styleSpec:p});const S=g.match(/^(.*)-transition$/);if(t==="paint"&&S&&x[S[1]]&&x[S[1]].transition)return Ji({key:n,value:m,valueSpec:p.transition,style:c,styleSpec:p});const M=l.valueSpec||x[g];if(!M)return[new s.a3(n,m,`unknown property "${g}"`)];let A;if(s.a0(m)&&s.N(M)&&!M.tokens&&(A=/^{([^}]+)}$/.exec(m))){const z=`\`{ "type": "identity", "property": ${A?JSON.stringify(A[1]):'"_"'} }\``;return[new s.V(n,m,`"${g}" does not support interpolation syntax 8Use an identity property function instead: ${z}.`)]}const C=[];if(l.layerType==="symbol")g!=="text-field"||!c||c.glyphs||c.imports||C.push(new s.V(n,m,'use of "text-field" requires a style "glyphs" property')),g==="text-font"&&s.a4(s.S(m))&&s.J(m.type)==="identity"&&C.push(new s.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")&&s.N(M)&&(s.a5(M)||s.O(M))){const z=s.W(s.S(m),M).value,R="expression"in z&&z.expression||"_styleExpression"in z&&z._styleExpression&&z._styleExpression.expression;R&&!s.X(R,["measure-light"])&&(g==="model-emissive-strength"&&s.Y(R)&&s.Z(R)||C.push(new s.V(n,m,`${g} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return C.concat(Ji({key:l.key,value:m,valueSpec:M,style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:g}))}function Ks(l){return Ys(l,"paint")}function Js(l){return Ys(l,"layout")}function za(l){let t=[];const n=l.value,c=l.key,d=l.style,p=l.styleSpec;if(!s.H(n))return[new s.V(c,n,"object expected")];n.type||n.ref||t.push(new s.V(c,n,'either "type" or "ref" is required'));let m=s.J(n.type);const g=s.J(n.ref);
8if(n.id){const x=s.J(n.id);for(let w=0;w<l.arrayIndex;w++){const S=d.layers[w];s.J(S.id)===x&&t.push(new s.V(c,n.id,`duplicate layer id "${x}", previously used at line ${S.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach((w=>{w in n&&t.push(new s.V(c,n[w],`"${w}" is prohibited for ref layers`))})),d.layers.forEach((w=>{s.J(w.id)===g&&(x=w)})),x?x.ref?t.push(new s.V(c,n.ref,"ref cannot reference another ref layer")):m=s.J(x.type):typeof g=="string"&&t.push(new s.V(c,n.ref,`ref layer "${g}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(n.source)if(s.a0(n.source)){const x=d.sources&&d.sources[n.source],w=x&&s.J(x.type);x?w==="vector"&&m==="raster"?t.push(new s.V(c,n.source,`layer "${n.id}" requires a raster source`)):w==="raster"&&m!=="raster"?t.push(new s.V(c,n.source,`layer "${n.id}" requires a vector source`)):w!=="vector"||n["source-layer"]?w==="raster-dem"&&m!=="hillshade"?t.push(new s.V(c,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&w==="geojson"&&!x.lineMetrics?t.push(new s.V(c,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&w!=="raster-array"&&t.push(new s.V(c,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):t.push(new s.V(c,n.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new s.V(c,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new s.V(c,n.source,`source "${n.source}" not found`))}else t.push(new s.V(`${c}.source`,n.source,'"source" must be a string'));else t.push(new s.V(c,n,'missing required property "source"'));return t=t.concat($r({key:c,value:n,valueSpec:p.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ji({key:`${c}.type`,value:n.type,valueSpec:p.layer.type,style:l.style,styleSpec:l.styleSpec,object:n,objectKey:"type"}),filter:x=>qo(Object.assign({layerType:m},x)),layout:x=>$r({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":w=>Js(Object.assign({layerType:m},w))}}),paint:x=>$r({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":w=>Ks(Object.assign({layerType:m,layer:n},w))}}),appearances(x){const w=Xs({key:x.key,value:x.value,valueSpec:x.valueSpec,style:x.style,styleSpec:x.styleSpec,arrayElementValidator:A=>(function(C){const{key:z,layer:R,layerType:k}=C,F=s.J(C.value),U=s.J(F.name),H=s.J(F.condition),j=$r({key:z,value:F,valueSpec:C.styleSpec.appearance,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{condition:te=>(function(Y){const Q=[];return Q.push(...tn({key:Y.key,value:Y.object.condition,valueSpec:s.a6.appearance.condition,expressionContext:"appearance"})),Q})(Object.assign({layer:R,layerType:k},te)),properties:te=>(function(Y){const Q=[],{styleSpec:X,layer:$,layerType:ie}=Y,ue=X[`paint_${ie}`],le=X[`layout_${ie}`],xe=Y.object[Y.objectKey];for(const ve in xe){const Ae=ve in ue?"paint":ve in le?"layout":void 0;if(!Ae){Q.push(new s.V(Y.key,ve,`unknown property "${ve}" for layer type "${ie}"`));continue}const Ve=Object.assign({},Y,{key:`${Y.key}.${ve}`,object:xe,objectKey:ve,layer:$,layerType:ie,value:xe[ve],valueSpec:Ae==="paint"?ue[ve]:le[ve]});Q.push(...Ys(Ve,Ae))}return Q})(Object.assign({layer:R,layerType:k},te))}});return U!=="hidden"&&H===void 0&&j.push(new s.V(C.key,"name",'Appearance with name different than "hidden" must have a condition')),j})(Object.assign({layerType:m,layer:n},A))}),S=Array.isArray(x.value)?x.value:[],M=new Set;return S.forEach(((A,C)=>{const z=s.J(A.name);if(z)if(M.has(z)){const R=s.J(n.id);w.push(new s.V(x.key,z,`Duplicated appearance name "${z}" for layer "${R}"`))}else M.add(z)})),w}}})),t}function Vr({key:l,value:t}){return s.a0(t)?[]:[new s.V(l,t,`string expected, ${s.K(t)} found`)]}const Tn={promoteId:function l({key:t,value:n}){if(s.a0(n))return Vr({key:t,value:n});if(Array.isArray(n)){const d=[],p=s.S(n),m=s.U(p);return m.result==="error"&&m.value.forEach((g=>{d.push(new s.V(`${t}${g.key}`,null,`${g.message}`))})),s.X(m.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||d.push(new s.V(`${t}`,null,"promoteId expression should be only feature dependent")),d}
8if(!s.H(n))return[new s.V(t,n,`string, expression or object expected, "${s.K(n)}" found`)];const c=[];for(const d in n)c.push(...l({key:`${t}.${d}`,value:n[d]}));return c}};function _l(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!s.H(t))return[new s.V(n,t,`object expected, ${s.K(t)} found`)];if(!("type"in t))return[new s.V(n,t,'"type" is required')];const p=s.J(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&("url"in t||"tiles"in t||m.push(new s.a3(n,t,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat($r({key:n,value:t,valueSpec:c[`source_${p.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:Tn})),m;case"geojson":if(m=$r({key:n,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:Tn}),"cluster"in t&&"clusterProperties"in t){if(!s.H(t.clusterProperties))return[new s.V(`${n}.clusterProperties`,t,`object expected, ${s.K(t)} found`)];for(const g in t.clusterProperties){const x=t.clusterProperties[g];if(!Array.isArray(x))return[new s.V(`${n}.clusterProperties.${g}`,x,"array expected")];const[w,S]=x,M=typeof w=="string"?[w,["accumulated"],["get",g]]:w;m.push(...tn({key:`${n}.${g}.map`,value:S,expressionContext:"cluster-map"})),m.push(...tn({key:`${n}.${g}.reduce`,value:M,expressionContext:"cluster-reduce"}))}}return m;case"video":return $r({key:n,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return $r({key:n,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new s.V(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return co({key:`${n}.type`,value:t.type,valueSpec:{values:Ts(c)}})}}function Ts(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 Io(l){const t=l.value,n=l.styleSpec,c=n.light,d=l.style;if(t===void 0)return[];if(!s.H(t))return[new s.V("light",t,`object expected, ${s.K(t)} found`)];let p=[];for(const m in t){const g=m.match(/^(.*)-transition$/),x=m.match(/^(.*)-use-theme$/);p=p.concat(x&&c[x[1]]?Ji({key:m,value:t[m],valueSpec:{type:"string"},style:d,styleSpec:n}):g&&c[g[1]]&&c[g[1]].transition?Ji({key:m,value:t[m],valueSpec:n.transition,style:d,styleSpec:n}):c[m]?Ji({key:m,value:t[m],valueSpec:c[m],style:d,styleSpec:n}):[new s.V(m,t[m],`unknown property "${m}"`)])}return p}function $o(l){const t=l.value;if(!t)return[];const n=l.key;if(!s.H(t))return[new s.V(n,t,`object expected, ${s.K(t)} found`)];let c=[];const d=l.styleSpec,p=d["light-3d"],m=l.style,g=l.style.lights;for(const S of["type","id"])if(!(S in t))return c=c.concat([new s.V(n,t,`missing property "${S}"`)]),c;if(!s.a0(t.type))return c=c.concat([new s.V(`${n}.type`,t.type,"string expected")]),c;if(g)for(let S=0;S<l.arrayIndex;S++){const M=s.J(t.type),A=g[S];s.J(A.type)===M&&c.push(new s.V(n,t.id,`duplicate light type "${t.type}", previously defined at line ${A.id.__line__}`))}const x=`properties_light_${t.type}`;if(!(x in d))return c=c.concat([new s.V(`${n}.type`,t,`Invalid light type ${t.type}`)]),c;const w=d[x];for(const S in t)if(S==="properties"){const M=t[S];if(!s.H(M))return c=c.concat([new s.V("properties",M,`object expected, ${s.K(M)} found`)]),c;for(const A in M){const C=A.match(/^(.*)-transition$/),z=A.match(/^(.*)-use-theme$/);c=c.concat(z&&w[z[1]]?Ji({key:S,value:M[A],valueSpec:{type:"string"},style:m,styleSpec:d}):C&&w[C[1]]&&w[C[1]].transition?Ji({key:S,value:t[S],valueSpec:d.transition,style:m,styleSpec:d}):w[A]?Ji({key:A,value:M[A],valueSpec:w[A],style:m,styleSpec:d}):[new s.a3(l.key,M[A],`unknown property "${A}"`)])}}else c=c.concat(p[S]?Ji({key:S,value:t[S],valueSpec:p[S],style:m,styleSpec:d}):[new s.a3(S,t[S],`unknown property "${S}"`)]);return c}function uo(l){const t=l.value,n=l.key,c=l.style,d=l.styleSpec,p=d.terrain;if(t==null)return[];if(!s.H(t))return[new s.V("terrain",t,`object expected, ${s.K(t)} found`)];let m=[];for(const g in t){const x=g.match(/^(.*)-transition$/),w=g.match(/^(.*)-use-theme$/);m=m.concat(w&&p[w[1]]?Ji({key:g,value:t[g],valueSpec:{type:"string"},style:c,styleSpec:d}):x&&p[x[1]]&&p[x[1]].transition?Ji({key:g,value:t[g],valueSpec:d.transition,style:c,styleSpec:d}):p[g]?Ji({key:g,value:t[g],valueSpec:p[g],style:c,styleSpec:d}):[new s.a3(g,t[g],`unknown property "${g}
8"`)])}if(t.source)if(s.a0(t.source)){const g=c.sources&&c.sources[t.source],x=g&&s.J(g.type);g?x!=="raster-dem"&&m.push(new s.V(`${n}.source`,t.source,`terrain cannot be used with a source of type ${x}, it only be used with a "raster-dem" source type`)):m.push(new s.V(`${n}.source`,t.source,`source "${t.source}" not found`))}else m.push(new s.V(`${n}.source`,t.source,"source must be a string"));else m.push(new s.V(n,t,'terrain is missing required property "source"'));return m}function gl(l){const t=l.value,n=l.style,c=l.styleSpec,d=c.fog;if(t===void 0)return[];if(!s.H(t))return[new s.V("fog",t,`object expected, ${s.K(t)} found`)];let p=[];for(const m in t){const g=m.match(/^(.*)-transition$/),x=m.match(/^(.*)-use-theme$/);p=p.concat(x&&d[x[1]]?Ji({key:m,value:t[m],valueSpec:{type:"string"},style:n,styleSpec:c}):g&&d[g[1]]&&d[g[1]].transition?Ji({key:m,value:t[m],valueSpec:c.transition,style:n,styleSpec:c}):d[m]?Ji({key:m,value:t[m],valueSpec:d[m],style:n,styleSpec:c}):[new s.a3(m,t[m],`unknown property "${m}"`)])}return p}const Qs={"*":()=>[],array:Xs,boolean:function(l){const t=l.value,n=l.key;return s.$(t)?[]:[new s.V(n,t,`boolean expected, ${s.K(t)} found`)]},number:bs,color:function({key:l,value:t}){return s.a0(t)?s.a1.parseCSSColor(t)===null?[new s.V(l,t,`color expected, "${t}" found`)]:[]:[new s.V(l,t,`color expected, ${s.K(t)} found`)]},enum:co,filter:qo,function:ws,layer:za,object:$r,source:_l,model:s.a7,light:Io,"light-3d":$o,terrain:uo,fog:gl,string:Vr,formatted:function(l){return Vr(l).length===0?[]:tn(l)},resolvedImage:function(l){return Vr(l).length===0?[]:tn(l)},projection:function(l){const t=l.value,n=l.styleSpec,c=n.projection,d=l.style;if(s.H(t)){let p=[];for(const m in t)p=p.concat(Ji({key:m,value:t[m],valueSpec:c[m],style:d,styleSpec:n}));return p}return s.a0(t)?[]:[new s.V("projection",t,`object or string expected, ${s.K(t)} found`)]},import:function(l){const t=l.key,{value:n,styleSpec:c}=l;if(!s.H(n))return[new s.V(t,n,"import must be an object")];const{data:d,...p}=n;Object.defineProperty(p,"__line__",{value:n.__line__,enumerable:!1});let m=$r(Object.assign({},l,{value:p,valueSpec:c.import}));return s.J(p.id)===""&&m.push(new s.V(`${l.key}.id`,p,"import id can't be an empty string")),d&&(m=m.concat(ea(d,c,{key:`${l.key}.data`}))),m},iconset:function(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!s.H(t))return[new s.V(n,t,"object expected")];if(!t.type)return[new s.V(n,t,'"type" is required')];const p=s.J(t.type);let m=[];if(m=m.concat($r({key:n,value:t,valueSpec:c[`iconset_${p}`],style:d,styleSpec:c})),(function(g,x){return!(g!=="source"||!x.source)})(p,t)){const g=d.sources&&d.sources[t.source],x=g&&s.J(g.type);g?x!=="raster-array"&&m.push(new s.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 s.V(n,t.source,`source "${t.source}" not found`))}return m}};function Ji(l,t=!1){const n=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression){if(s.a4(s.J(n)))return ws(l);if(s.Q(s.S(n)))return tn(l)}if(c.type&&Qs[c.type]){const p=Qs[c.type](l);return t===!0&&p.length>0&&Array.isArray(l.value)?tn(l):p}return $r(Object.assign({},l,{valueSpec:c.type?d[c.type]:c}))}function $r(l){const t=l.key,n=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},p=l.style,m=l.styleSpec;if(!s.H(n))return[new s.V(t,n,`object expected, ${s.K(n)} found`)];let g=[];for(const x in n){const w=x.split(".")[0];let S;d[w]?S=d[w]:c[w]?S=Ji:d["*"]?S=d["*"]:c["*"]&&(S=Ji),S?g=g.concat(S({key:(t&&`${t}.`)+x,value:n[x],valueSpec:c[w]||c["*"],style:p,styleSpec:m,object:n,objectKey:x},n)):g.push(new s.a3(t,n[x],`unknown property "${x}"`))}for(const x in c){if(d[x])continue;const w=c[x];w.required&&w.default===void 0&&n[x]===void 0&&g.push(new s.V(t,n,`missing required property "${x}"`))}return g}function mc({key:l,value:t}){const n=Vr({key:l,value:t});if(n.length)return n;const c=t;return c.indexOf("{fontstack}")===-1&&n.push(new s.V(l,t,'"glyphs" url must include a "{fontstack}" token')),c.indexOf("{range}")===-1&&n.push(new s.V(l,t,'"glyphs" url must include a "{range}" token')),n}function ea(l,t=s.a6,n={}){return $r({key:n.key||"",value:l,valueSpec:Object.assign(t.$root,{"*":{type:"*"}}),styleSpec:t,style:l,objectElementValidators:{glyphs:mc}})}function ho(l,t=s.a6){return N(ea(l,t))}const _c=l=>N(_l(l)),Oe=l=>N(Io(l)),Zo=l=>N($o(l)),rh=l=>N(uo(l)),ta=l=>N(gl(l)),oi=l=>N((function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.snow;if(n===void 0)return[];
8if(!s.H(n))return[new s.V("snow",n,`object expected, ${s.K(n)} found`)];let m=[];for(const g in n){const x=g.match(/^(.*)-transition$/);m=m.concat(x&&p[x[1]]&&p[x[1]].transition?Ji({key:g,value:n[g],valueSpec:d.transition,style:c,styleSpec:d}):p[g]?Ji({key:g,value:n[g],valueSpec:p[g],style:c,styleSpec:d}):[new s.a3(g,n[g],`unknown property "${g}"`)])}return m})(l)),hn=l=>N((function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.rain;if(n===void 0)return[];if(!s.H(n))return[new s.V("rain",n,`object expected, ${s.K(n)} found`)];let m=[];for(const g in n){const x=g.match(/^(.*)-transition$/);m=m.concat(x&&p[x[1]]&&p[x[1]].transition?Ji({key:g,value:n[g],valueSpec:d.transition,style:c,styleSpec:d}):p[g]?Ji({key:g,value:n[g],valueSpec:p[g],style:c,styleSpec:d}):[new s.a3(g,n[g],`unknown property "${g}"`)])}return m})(l)),nh=l=>N(za(l)),ia=l=>N(qo(l)),yl=l=>N(Ks(l)),pe=l=>N(Js(l)),O=l=>N(s.a7(l));function N(l){return l.slice().sort(((t,n)=>t.line&&n.line?t.line-n.line:0))}function q(l,t){let n=!1;if(t&&t.length)for(const c of t)c instanceof s.a3?s.w(c.message):(l.fire(new s.y(new Error(c.message))),n=!0);return n}const oe=s.a6.light;let re;class ce extends s.E{constructor(t,n="flat"){super(),this._transitionable=new s.a8(re||(re=new s.a9({anchor:new s.aa(oe.anchor),position:new s.ab(oe.position),color:new s.aa(oe.color),intensity:new s.aa(oe.intensity)}))),this.setLight(t,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n,c={}){this._validate(Oe,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)&&q(this,t.call(ho,Object.assign({value:n,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}}const ye=s.a6.terrain;let de=class extends s.E{constructor(l,t,n,c,d){super(),this.scope=n,this._transitionable=new s.a8(new s.a9({source:new s.aa(ye.source),exaggeration:new s.aa(ye.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 s.ac(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let n=-1,c=-1,d=1;for(const p of t.zoomStops)d=t.evaluate(new s.ac(p,{worldview:this.worldview})),d>.01?(n=p,c=-1):c=p;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 s.ad}};const ge=45,Ne=65,Me=.05;function nt(l,t,n,c){const d=s.ah(ge,Ne,n),[p,m]=_t(l,c);let g=1-Math.min(1,Math.exp((t-p)/(m-p)*-6));return g*=g*g,g=Math.min(1,1.00747*g),g*d*l.alpha}function _t(l,t){const n=.5/Math.tan(.5*t);return[l.range[0]+n,l.range[1]+n]}function tt(l,t,n,c,d){const p=s.af([],[t,n,c],d.mercatorFogMatrix);return nt(l,s.ag(p),d.pitch,d._fov)}function Lt(l,t,n,c,d,p,m){const g=[[n,c,0],[d,c,0],[d,p,0],[n,p,0]];let x=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(const S of g){const M=s.af([],S,t),A=s.ag(M);x=Math.min(x,A),w=Math.max(w,A)}return[nt(l,x,m.pitch,m._fov),nt(l,w,m.pitch,m._fov)]}const zt=s.a6.fog;class Pt extends s.E{constructor(t,n,c,d){super();const p=new s.a9({range:new s.aa(zt.range),color:new s.aa(zt.color),"color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new s.aa(zt["high-color"]),"high-color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new s.aa(zt["space-color"]),"space-color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}
8),"horizon-blend":new s.aa(zt["horizon-blend"]),"star-intensity":new s.aa(zt["star-intensity"]),"vertical-range":new s.aa(zt["vertical-range"])});this._transitionable=new s.a8(p,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=n,this.properties=new s.ai(p),this.scope=c}get state(){const t=this._transform,n=t.projection.name==="globe",c=s.aj(t.zoom),d=this.properties.get("range"),p=[.5,3];return{range:n?[s.ak(p[0],d[0],c),s.ak(p[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,n,c={}){if(this._validate(ta,t,c))return;const d=Object.assign({},t);for(const p of Object.keys(zt))d[p]===void 0&&(d[p]=zt[p].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:s.ah(ge,Ne,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?(function(c,d,p){const m=s.ae.fromLngLat(d),g=p.elevation?p.elevation.getAtPointOrZero(m):0;return tt(c,m.x,m.y,g,p)})(this.state,t,n):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const n=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Lt(this.state,n,0,0,s.al,s.al,this._transform)}getOpacityForBounds(t,n,c,d,p){return this._transform.projection.supportsFog?Lt(this.state,t,n,c,d,p,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?_t(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 p;if(d[2]>=0)p=d;else{const m=t.points[c-4];p=s.am(m,d,m[2]/(m[2]-d[2]))}if(tt(this.state,p[0],p[1],0,this._transform)>=Me)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)&&q(this,t.call(ho,Object.assign({value:n,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}}let Kt,or,vr,lr,Er=class extends s.E{constructor(l,t,n,c){super();const d=Kt||(Kt=new s.a9({density:new s.aa(s.a6.snow.density),intensity:new s.aa(s.a6.snow.intensity),color:new s.aa(s.a6.snow.color),opacity:new s.aa(s.a6.snow.opacity),vignette:new s.aa(s.a6.snow.vignette),"vignette-color":new s.aa(s.a6.snow["vignette-color"]),"center-thinning":new s.aa(s.a6.snow["center-thinning"]),direction:new s.aa(s.a6.snow.direction),"flake-size":new s.aa(s.a6.snow["flake-size"])}));this._transitionable=new s.a8(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ai(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=s.an(n[0]),d=-Math.max(s.an(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette"),g=this.properties.get("vignette-color");return g.a=m,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.ao(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:g}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(oi,l,n))return;const c=Object.assign({},l),d=s.a6.snow;for(const p of Object.keys(d))c[p]===void 0&&(c[p]=d[p].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&q(this,l.call(ho,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}},Qi=class extends s.E{constructor(l,t,n,c){super();const d=or||(or=new s.a9({density:new s.aa(s.a6.rain.density),intensity:new s.aa(s.a6.rain.intensity),color:new s.aa(s.a6.rain.color),opacity:new s.aa(s.a6.rain.opacity),vignette:new s.aa(s.a6.rain.vignette),"vignette-color":new s.aa(s.a6.rain["vignette-color"]),"center-thinning":new s.aa(s.a6.rain["center-thinning"]),direction:new s.aa(s.a6.rain.direction),"droplet-size":new s.aa(s.a6.rain["droplet-size"]),"distortion-strength":new s.aa(s.a6.rain["distortion-strength"])}));this._transitionable=new s.a8(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ai(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=s.an(n[0]),d=-Math.max(s.an(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette-color");return m.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.ao(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),droplet
8Size: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(hn,l,n))return;const c=Object.assign({},l),d=s.a6.rain;for(const p of Object.keys(d))c[p]===void 0&&(c[p]=d[p].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&q(this,l.call(ho,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}};class ii extends s.E{constructor(t,n,c,d){super(),this.scope=c,this._options=t,this.properties=new s.ai(n),this._transitionable=new s.a8(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 er{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 s.P||typeof t[0]=="number"){const p=s.P.convert(t);c=[p],d=n.isPointAboveHorizon(p)}else{const p=s.P.convert(t[0]),m=s.P.convert(t[1]),g=p.add(m)._div(2);c=[p,m],d=s.aq(p,m).every((x=>n.isPointAboveHorizon(x)))&&n.isPointAboveHorizon(g)}return new er(c,d,n)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return s.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.aq(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)),s.ar(d,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.aq(n,c,t),p=this.cameraPoint.clone();switch(3*((p.y>n.y)+(p.y>c.y))+((p.x>n.x)+(p.x>c.x))){case 0:d[0]=p,d[4]=p.clone();break;case 1:d.splice(1,0,p);break;case 2:d[1]=p;break;case 3:d.splice(4,0,p);break;case 5:d.splice(2,0,p);break;case 6:d[3]=p;break;case 7:d.splice(3,0,p);break;case 8:d[2]=p}return d}containsTile(t,n,c,d=0){const p=Math.max(t.queryPadding,t.evaluateQueryRenderedFeaturePadding())/n._pixelsPerMercatorPixel+1,m=c?this._bufferedCameraMercator(p,n):this._bufferedScreenMercator(p,n);let g=t.tileID.wrap+(m.unwrapped?d:0);const x=m.polygon.map((k=>s.as(t.tileTransform,k,g)));if(!s.at(x,0,0,s.al,s.al))return;g=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const w=this.screenGeometryMercator.polygon.map((k=>s.au(t.tileTransform,k,g))),S=w.map((k=>new s.P(k[0],k[1]))),M=n.getFreeCameraOptions().position||new s.ae(0,0,0),A=s.au(t.tileTransform,M,g),C=w.map((k=>{const F=s.av(k,k,A);return s.aw(F,F),new s.ax(A,F)})),z=s.ay(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:C,bufferedTilespaceGeometry:x,bufferedTilespaceBounds:(R=s.az(x),R.min.x=s.aA(R.min.x,0,s.al),R.min.y=s.aA(R.min.y,0,s.al),R.max.x=s.aA(R.max.x,0,s.al),R.max.y=s.aA(R.max.y,0,s.al),R),tile:t,t
8ileID:t.tileID,pixelToTileUnitsFactor:z};var R}_bufferedScreenMercator(t,n){const c=cr(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((p=>n.pointCoordinate3D(p))),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,n){const c=cr(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((p=>n.pointCoordinate3D(p))),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,n){const c=(function(p,m){const g=s.aB([],m.pixelMatrix,m.globeMatrix),x=[0,-s.aD,0,1],w=[0,s.aD,0,1],S=[0,0,0,1];s.aC(x,x,g),s.aC(w,w,g),s.aC(S,S,g);const M=new s.P(x[0]/x[3],x[1]/x[3]),A=new s.P(w[0]/w[3],w[1]/w[3]),C=s.aE(p,M)&&x[3]<S[3],z=s.aE(p,A)&&w[3]<S[3];if(!C&&!z)return null;const R=(function(Q,X,$){for(let ie=1;ie<Q.length;ie++){const ue=qt(X.pointCoordinate3D(Q[ie-1]).x),le=qt(X.pointCoordinate3D(Q[ie]).x);if($<0){if(ue<le)return{idx:ie,t:-ue/(le-1-ue)}}else if(le<ue)return{idx:ie,t:(1-ue)/(le+1-ue)}}return null})(p,m,C?-1:1);if(!R)return null;const{idx:k,t:F}=R;let U=k>1?Pi(p.slice(0,k),m):[],H=k<p.length?Pi(p.slice(k),m):[];U=U.map((Q=>new s.P(qt(Q.x),Q.y))),H=H.map((Q=>new s.P(qt(Q.x),Q.y)));const j=[...U];j.length===0&&j.push(H[H.length-1]);const te=s.ak(j[j.length-1].y,(H.length===0?U[0]:H[0]).y,F);let Y;return Y=C?[new s.P(0,te),new s.P(0,0),new s.P(1,0),new s.P(1,te)]:[new s.P(1,te),new s.P(1,1),new s.P(0,1),new s.P(0,te)],j.push(...Y),H.length===0?j.push(U[0]):j.push(...H),{polygon:j.map((Q=>new s.ae(Q.x,Q.y))),unwrapped:!1}})(t,n);if(c)return c;const d=(function(p,m){let g=!1,x=-1/0,w=0;for(let M=0;M<p.length-1;M++)p[M].x>x&&(x=p[M].x,w=M);for(let M=0;M<p.length-1;M++){const A=(w+M)%(p.length-1),C=p[A],z=p[A+1];Math.abs(C.x-z.x)>.5&&(C.x<z.x?(C.x+=1,A===0&&(p[p.length-1].x+=1)):(z.x+=1,A+1===p.length-1&&(p[0].x+=1)),g=!0)}const S=s.aF(m.center.lng);return g&&S<Math.abs(S-1)&&p.forEach((M=>{M.x-=1})),{polygon:p,unwrapped:g}})(Pi(t,n).map((p=>new s.P(qt(p.x),p.y))),n);return{polygon:d.polygon.map((p=>new s.ae(p.x,p.y))),unwrapped:d.unwrapped}}}function Pi(l,t){return s.aG(l,(n=>{const c=t.pointCoordinate3D(n);n.x=c.x,n.y=c.y}),1/256)}function qt(l){return l<0?1+l%1:l%1}function cr(l){return 100*l|0}function Yr(l,t,n,c,d){const p=function(g,x){if(g)return d(g);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=Object.assign(x,S);break}}}const w=s.aH(Object.assign({},x,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);w.tiles=t.canonicalizeTileset(w,l.url),d(null,w)}},m=(function(g,x,w){if(!g)return null;if(!x&&!w)return g;w=w||g.worldview_default;const S=Object.values(g.language||{});if(S.length===0)return null;const M=Object.values(g.worldview||{});if(M.length===0)return null;const A=S.every((z=>z===x)),C=M.every((z=>z===w));return A&&C?g:x in(g.language_options||{})||w in(g.worldview_options||{})?null:g.language_options&&g.worldview_options?g:null})(l.data,n,c);return m?s.o.frame((()=>p(null,m))):l.url?s.m(t.transformRequest(t.normalizeSourceURL(l.url,null,n,c),s.R.Source),p):s.o.frame((()=>{const{data:g,...x}=l;p(null,x)}))}function rn(l,t){const n=Math.pow(2,t.z),c=Math.floor(s.aF(l.getWest())*n),d=Math.floor(s.aJ(l.getNorth())*n),p=Math.ceil(s.aF(l.getEast())*n),m=Math.ceil(s.aJ(l.getSouth())*n);return t.x>=c&&t.x<p&&t.y>=d&&t.y<m}class Sn{constructor(t,n,c){this.bounds=t?s.aI.convert(this.validateBounds(t)):null,this.minzoom=n||0,this.maxzoom=c||24}
8validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const n of t)this.extraBounds.push(s.aI.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 Sn(t.bounds,t.minzoom,t.maxzoom);return n.addExtraBounds(t.extra_bounds),n}}class ra extends s.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,Object.assign(this,s.aH(n,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({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 s.aK}load(t){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=Yr(this._options,this.map._requestManager,n,c,((d,p)=>{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 s.y(d));else if(p){if(Object.assign(this,p),this.hasWorldviews=!!p.worldview_options,p.worldview_default&&(this.worldviewDefault=p.worldview_default),p.vector_layers){this.vectorLayers=p.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const m of p.vector_layers)this.vectorLayerIds.push(m.id),p.worldview&&p.worldview[m.source]&&this.localizableLayerIds.add(m.id)}this.tileBounds=Sn.fromTileJSON(p),Zi(p.tiles,this.map._requestManager._customAccessToken),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.B(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(t,n){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),p=this.map._requestManager.transformRequest(d,s.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,g=m?{image:m.image.clone()}:null,x={request:p,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:g,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:s.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};if(this.hasWorldviews&&s.h(c)&&(x.localizableLayerIds=this.localizableLayerIds),x.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",x,w.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,w.bind(this),void 0,!0);else{const S=s.aL.call({deduped:this._deduped},x,((M,A)=>{if(M||!A)w.call(this,M);else{const C=s.aM(A.responseHeaders);x.data={rawData:A.rawData.slice(0),expires:C.expires,cacheControl:C.cacheControl},t.actor&&t.actor.send("loadTile",x,w.bind(this),void 0,!0)}}),!0);t.request={cancel:S}}function w(S,M){return delete t.request,t.aborted?n(null):S&&S instanceof s.aN&&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),s.aO(this.dispatcher),n(null,M),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(t,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 Ur extends s.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=Object.assign({type:"raster"},n),Object.assign(this,s.aH(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const n=this.map.getWorldview();this._tileJSONRequest=Yr(this._options,this.map._requestManager,null,n,((c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new s.y(c)):d&&(Object.assign(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map((p=>p.id))),this.tileBounds=Sn.fromTileJSON(d),Zi(d.tiles),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.B(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const c=s.o.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=s.n(this.map._requestManager.transformRequest(d,s.R.Tile),((p,m,g)=>{if(delete t.request,t.aborted)return t.state="unloaded",n(null);if(p)return t.state="errored",n(p);if(!m)return n(null);const x=s.aM(g);this.map._refreshExpiredTiles&&t.setExpiryData(x),t.setTexture(m,this.map.painter),t.state="loaded",s.aO(this.dispatcher),n(null)}))}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n&&n()}unloadTile(t,n){t.texture&&t.texture instanceof s.T?(t.destroy(!1),t.texture&&t.texture instanceof s.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),n&&n()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Nn([l,t],n,c,{scaled:d=!0}={}){const{tileSize:p,buffer:m}=c,{x:g,y:x,z:w}=n;if(!isFinite(g)||!isFinite(x)||!isFinite(w))throw new Error("Invalid MRT header");const S=2**w,M=S*s.aF(l),A=S*s.aJ(t);return(function([C,z],R,{scaled:k=!0}={}){if(!R)throw new Error("bandView is undefined");const{data:F,tileSize:U,buffer:H,offset:j,scale:te,dimension:Y}=R;if(C<-H||C>U+H||z<-H||z>U+H)throw new Error(`Point (${C}, ${z}) out of bounds for tileSize=${U}, buffer=${H}`);const Q=(z+H)*(U+2*H)+(C+H);if(new Uint32Array(F.buffer)[Q]===4294967295)return null;let X=[];X=k?[]:new R.data.constructor(Y);for(let $=0;$<Y;$++)X[$]=Math.round(1e12*(F[Y*Q+$]*te+j))/1e12;return X})([Math.min(Math.max(-m,Math.floor((M-g)*p)),p-1+m),Math.min(Math.max(-m,Math.floor((A-x)*p)),p-1+m)],c,{scaled:d})}class dn extends Ur{constructor(t,n,c,d){super(t,n,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({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,s.R.Tile),p={request:d,uid:t.uid,tileID:t.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const m=(g,x,w)=>{if(delete t.request,t.aborted)return t.state="unloaded",n(null);if(g)return g.name==="AbortError"?void 0:(t.state="errored",n(g));if(this.map._refreshExpiredTiles&&x){const S=s.aM(w);t.setExpiryData(S)}if(this.partial&&t.state!=="expired")t.state="empty";else if(!this.partial){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",p,m.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,n){const c=t.texturePerLayer;if(t.flushAllQueues(),c.size){t.destroy(!1);for(const d of c.values())this.map.painter.saveTileTexture(d)}else t.destroy()}prepareTile(t,n,c,d){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBandForRender(n,c,d,((p,m)=>{if(p)return t.state="errored",this.fire(new s.y(p)),void this.triggerRepaint(t);m&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(c,m,this.map.painter),t.state="loaded",this.triggerRepaint(t))})))}getInitialBand(t){if(!this.rasterLayers)return 0;const n=this.rasterLayers.find((({id:p})=>p===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 p=null;n instanceof s.aR?p=n.paint.get("raster-array-band"):n instanceof s.aS&&(p=n.paint.get("raster-particle-array-band"));const m=p||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 g=t.textureDescriptorPerLayer.get(n.id);return Object.assign({},g,{texture:t.texturePerLayer.get(n.id)})}getImages(t,n){const c=new Map;for(const d of t)for(const p of n){const[m,g]=p.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(g)||!x.hasDataForBand(g))continue;const{bytes:w,tileSize:S,buffer:M}=x.getBandView(g),A=S+2*M,C={data:new s.q({width:A,height:A},w),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(p,C)}return c}queryRasterArrayValueByBandId(t,n,c){const d=n._mrt;return new Promise((p=>{const m={},g=new Set;for(const[x,w]of Object.entries(d.layers)){if(c.layerName&&x!==c.layerName)continue;const S={};m[x]=S;for(const{bands:M}of w.dataIndex)for(const A of M)c.bands&&!c.bands.includes(A)||(g.add(s.B(x,A)),n.fetchBand(x,null,A,(C=>{s.o.frame((()=>{S[A]=C?null:Nn([t.lng,t.lat],d,w.getBandView(A)),g.delete(s.B(x,A)),g.size===0&&p(m)}))}),!1))}g.size===0&&p(m)}))}_loadTileForQuery(t,n){if(this._loadTileLoaded[t.uid])return void n(null,t._mrt);if(this._loadTilePending[t.uid])return void this._loadTilePending[t.uid].push(n);this._loadTilePending[t.uid]=[n];const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,s.R.Tile);t.actor.send("loadTile",{request:d,uid:t.uid,tileID:t.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:!1},((p,m,g)=>{if(p)return this._loadTilePending[t.uid].forEach((x=>x(p,null))),void delete this._loadTilePending[t.uid];if(!m)return this._loadTilePending[t.uid].forEach((x=>x(null,null))),void delete this._loadTilePending[t.uid];if(this.map._refreshExpiredTiles&&m){const x=s.aM(g);t.setExpiryData(x)}t._mrt=m,t._isHeaderLoaded=!0,t.state="loaded",this._loadTilePending[t.uid].forEach((x=>x(null,m))),this._loadTileLoaded[t.uid]=!0,delete this._loadTilePending[t.uid]}),void 0,!0)}queryRasterArrayValueByAllBands(t,n,c){return new Promise(((d,p)=>{this._loadTileForQuery(n,((m,g)=>{m?p(m):d(g?this.queryRasterArrayValueByBandId(t,n,c):null)}))}))}queryRasterArrayValue(t,n){const c=s.aT.convert(t),d=this.findLoadedParent(c);return d&&d._mrt?n.bands||!this.partial?this.queryRasterArrayValueByBandId(c,d,n):this.queryRasterArrayValueByAllBands(c,d,n):Promise.resolve(null)}findLoadedParent(t){const n=s.ae.fromLngLat(t,this.map.transform.tileSize),c=this.maxzoom+1,d=1<<c,p=Math.floor(n.x),m=Math.floor((n.x-p)*d),g=Math.floor(n.y*d),x=this.map.style.getSourceCache(this.id),w=new s.aQ(c,p,c,m,g);return x.findLoadedParent(w,this.minzoom)}}const Ao={vector:ra,raster:Ur,"raster-dem":class extends Ur{constructor(l,t,n,c){super(l,t,n,c),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,p){d&&(l.state="errored",t(d)),p&&(l.dem=p,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=s.n(this.map._requestManager.transformRequest(n,s.R.Tile),(function(d,p,m){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(p){const g=s.aM(m);this.map._refreshExpiredTiles&&l.setExpiryData(g);const x=ImageBitmap&&p instanceof ImageBitmap&&s.r(),w=1-(p.width-s.aP(p.width))/2;w<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const S=x?p:s.o.getImageData(p,w),M={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
8ype,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:w};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,p=(t.x+1+n)%n,m=t.x+1===n?l.wrap+1:l.wrap,g={};return g[new s.aQ(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},g[new s.aQ(l.overscaledZ,m,t.z,p,t.y).key]={backfilled:!1},t.y>0&&(g[new s.aQ(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},g[new s.aQ(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},g[new s.aQ(l.overscaledZ,m,t.z,p,t.y-1).key]={backfilled:!1}),t.y+1<n&&(g[new s.aQ(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},g[new s.aQ(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},g[new s.aQ(l.overscaledZ,m,t.z,p,t.y+1).key]={backfilled:!1}),g}},"raster-array":dn,geojson:class extends s.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=Object.assign({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=s.al/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:s.al,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:s.al,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new s.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new s.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const 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 s.z("dataloading",{dataType:"source"})),this._loaded=!1;const t=Object.assign({append:l},this.workerOptions);t.scope=this.scope;const n=this._data;typeof n=="string"?(t.request=this.map._requestManager.transformRequest(s.o.resolveURL(n),s.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 s.y(c));else{const p={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(p.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new s.z("data",p)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)}))}loaded(){return this._loaded}reload(){const l=s.B(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const 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()}
8:null,p=this._partialReload,m={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:s.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:p,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};l.request=this.actor.send(n,m,((g,x)=>p&&!x?(l.state="loaded",t(null)):(delete l.request,l.destroy(!1),l.aborted?t(null):g?t(g):(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 Object.assign({}
8,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.aU{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,s.R.Source).url);s.aV(this.urls,((t,n)=>{this._loaded=!0,t?this.fire(new s.y(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 s.y(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.aU,model:s.aX,"batched-model":class extends s.E{constructor(l,t,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=s.B(this.id,this.scope);this.load((()=>this.map.style.clearSource(l)))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=Yr(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 s.y(c))):d&&(Object.assign(this,d),d.bounds&&(this.tileBounds=new Sn(d.bounds,this.minzoom,this.maxzoom)),Zi(d.tiles,this.map._requestManager._customAccessToken),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)}))}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(n,s.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:s.o.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const p=Object.values(l.buckets);for(const m of p)m.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",c,d.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(p,m){return l.aborted?t(null):p&&p.status!==404?t(p):(this.map._refreshExpiredTiles&&m&&l.setExpiryData(m),l.loadModelData(m,this.map.painter),l.state="loaded",void t(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends s.aU{constructor(l,t,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((p=>typeof p!="number"))))||this.fire(new s.y(new s.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.y(new s.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new s.y(new s.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new s.y(new s.V(`sources.${l}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new s.y(new s.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new s.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof s.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends s.E{constructor(l,t,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 s.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Sn(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,s.aH(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y: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,p=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:n,y:c,z:d},{signal:p.signal})).then((function(m){return delete l.request,l.aborted?(l.state="unloaded",t(null)):m===void 0?(l.state="errored",t(null)):m===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null)):(function(g){return g instanceof ImageData||g instanceof HTMLCanvasElement||g instanceof ImageBitmap||g instanceof HTMLImageElement})(m)?(this.loadTileData(l,m),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch((m=>{m.name!=="AbortError"&&(l.state="errored",t(m))})),l.request.cancel=()=>p.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof s.T?(l.destroy(!1),l.texture&&l.texture instanceof s.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x: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=s.B(this.id,this.scope);this.map.style.clearSource(l)}
8_update(){this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}}},Fr=function(l,t,n,c){const d=new Ao[t.type](l,t,n,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return s.aY(["load","abort","unload","serialize","prepare"],d),d};function na(l,t,n=""){return`${n}:${t.id||""}:${t.layer.id}:${(function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:p}=c;return`featureset:${d}${p?`:import:${p}`:""}`}})(l.target)}`}function Da(l,t,n,c=""){if(l.uniqueFeatureID){const d=na(l,t,c);if(n.has(d))return!0;n.add(d)}return!1}function gc(l,t,n,c,d=!1){const p=t.sourceCache.transform,m=t.sourceCache.tilesIn(l,t.has3DLayers,d);m.sort(xl);const g=[];for(const x of m){const w=x.tile.queryRenderedFeatures(t,x,n,c,p,d);Object.keys(w).length&&g.push({wrappedTileID:x.tile.tileID.wrapped().key,queryResults:w})}for(const x in t.layers){const w=t.layers[x];if(w.styleLayer){const S=w.styleLayer.queryRenderedFeatures(l,t.sourceCache,c);Object.keys(S).length&&g.push({wrappedTileID:0,queryResults:S})}}return g.length===0?{}:(function(x){const w={},S={};for(const M of x){const A=M.queryResults,C=M.wrappedTileID,z=S[C]=S[C]||{};for(const R in A){const k=A[R],F=z[R]=z[R]||{},U=w[R]=w[R]||[];for(const H of k)F[H.featureIndex]||(F[H.featureIndex]=!0,U.push(H))}}return w})(g)}function yc(l,t,n,c,d,p){const m={},g=c.queryRenderedSymbols(l),x=[];for(const w of Object.keys(g).map(Number))x.push(d[w]);x.sort(xl);for(const w of x){const S=w.featureIndex.lookupSymbolFeatures(g[w.bucketInstanceId],w.bucketIndex,w.sourceLayerIndex,t,n,p);for(const M in S){const A=m[M]=m[M]||[],C=S[M];C.sort(((z,R)=>{const k=w.featureSortOrder;if(k){const F=k.indexOf(z.featureIndex);return k.indexOf(R.featureIndex)-F}return R.featureIndex-z.featureIndex}));for(const z of C)A.push(z)}}return m}function xc(l,t){const n=l.getRenderableIds().map((p=>l.getTileByID(p))),c=[],d={};for(let p=0;p<n.length;p++){const m=n[p],g=m.tileID.canonical.key;d[g]||(d[g]=!0,m.querySourceFeatures(c,t))}return c}function xl(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 Mo(l,t){const n={};if(!t)return n;for(const c of l){const d=c.layerIds.map((p=>t.getLayer(p))).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map((p=>d.filter((m=>m.id===p))[0])));for(const p of d)n[p.fqid]=c}}return n}const En=32,fo=33,po=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,n=0,c=0,d=0,p=0,m=0,g=0;for(1&t?d=p=m=En:n=c=g=En;(t>>=1)>1;){const w=n+d>>1,S=c+p>>1;1&t?(d=n,p=c,n=m,c=g):(n=d,c=p,d=m,p=g),m=w,g=S}const x=4*l;po[x+0]=n,po[x+1]=c,po[x+2]=d,po[x+3]=p}const Xn=new Uint16Array(2178),Co=new Uint8Array(1089),Ss=new Uint16Array(1089);function oa(l){return l===0?-.03125:l===32?.03125:0}const vc={type:2,extent:s.al,loadGeometry:()=>[[new s.P(0,0),new s.P(s.al+1,0),new s.P(s.al+1,s.al+1),new s.P(0,s.al+1),new s.P(0,0)]]};class sa{constructor(t,n,c,d,p,m){this.tileID=t,this.uid=s.b2(),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=p,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection),this.worldview=m,this._hasAppearances=null}registerFadeDuration(t){const n=t+this.timeAdded;n<s.o.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=s.aZ(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=Mo(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b4){if(this.hasSymbolBuckets=!0,!c)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b4&&p.hasRTLText){this.hasRTLText=!0,s.b5();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],m=n.style.getOwnLayer(d);if(!m)continue;
8const g=m.queryRadius(p);this.queryPadding=Math.max(this.queryPadding,g)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new s.b3}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,n,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,Mo(t.buckets,n.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t,n){for(const p in this.buckets){const m=this.buckets[p];if(m.uploadPending()){let g={},x=[],w={zoom:0,pitch:0,brightness:0,worldview:""};if(n){if(n.style){x=n.style.listImages();const S=m.layers[0],M=S.sourceLayer||"_geojsonTileLayer",A=n.style.getLayerSourceCache(S);A&&(g=A._state.getState(M,void 0))}w={zoom:n.transform.zoom||0,pitch:n.transform.pitch||0,brightness:n.style.getBrightness()||0,worldview:n.worldview||""}}m.upload(t,this.tileID.canonical,g,x,w)}}const c=t.gl,d=this.imageAtlas;d&&!d.uploaded&&(this.imageAtlasTexture=new s.T(t,d.image,c.RGBA8,{useMipmap:!!d.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new s.T(t,this.glyphAtlasImage,c.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new s.T(t,this.lineAtlas.image,c.R8),this.lineAtlas.uploaded=!0)}prepare(t,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._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(n)),(this._lastUpdatedBrightness||d||this._hasAppearances)&&(!this._hasAppearances&&this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(n,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}evaluateQueryRenderedFeaturePadding(){let t=0;for(const n in this.buckets){const c=this.buckets[n];c.evaluateQueryRenderedFeaturePadding&&(t=Math.max(t,c.evaluateQueryRenderedFeaturePadding()))}return t}queryRenderedFeatures(t,n,c,d,p,m){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const g=this.evaluateQueryRenderedFeaturePadding(),x=(function(w,S){const M=s.bq([],[.5*w.width,.5*-w.height,1]);return s.br(M,M,[1,-1,0]),s.aB(M,M,w.calculateProjMatrix(S.toUnwrapped())),Float32Array.from(M)})(p,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:n,pixelPosMatrix:x,transform:d,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:g})}querySourceFeatures(t,n){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),p=n?n.sourceLayer:"",m=d._geojsonTileLayer||d[p];if(!m)return;const g=s.b6(n&&n.filter),{z:x,x:w,y:S}=this.tileID.canonical,M={z:x,x:w,y:S};for(let A=0;A<m.length;A++){const C=m.feature(A);if(g.needGeometry){const k=s.b7(C,!0);if(!g.filter(new s.ac(this.tileID.overscaledZ,{worldview:this.worldview}),k,this.tileID.canonical))continue}else if(!g.filter(new s.ac(this.tileID.overscaledZ,{worldview:this.worldview}),C))continue;const z=c.getId(C,p),R=new s.b8(C,x,w,S,z);R.tile=M,t.push(R)}}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=s.b9(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{const p=this.expirationTime-n;p?this.expirationTime=c+Math.max(p,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}hasAppearances(t){for(const n in this.buckets)if(t.style.hasLayer(n)&&this.buckets[n].layers.some((c=>c.appearances&&c.appearances.length>0)))return!0;return!1}updateBuckets(t,n){if(!this.latestFeatureIndex||!t.style)return;const c=t.style.listImages(),d=t.style.getBrightness();for(const p in this.buckets){if(!t.style.hasLayer(p))continue;const m=this.buckets[p],g=m.layers[0],x=g.sourceLayer||"_geojsonTileLayer",w=t.style.getLayerSourceCache(g);let S={};w&&(S=w._state.getState(x,void 0));const M=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},A=Object.keys(S).length>0&&!n;m.hasAppearances=m.layers.some((R=>R.appearances&&R.appearances.length>0));const C=A?m.stateDependentLayers:m.layers;if(A&&m.stateDependentLayers.length!==0||n){const R=this.latestFeatureIndex.loadVTLayers();m.update(S,R[x],c,M,C,n,d)}if(A&&m.stateDependentLayers.length!==0||n||m.hasAppearances){const R={zoom:t.transform.zoom,pitch:t.transform.pitch,brightness:t.style.getBrightness()||0,worldview:t.worldview};m.updateAppearances(this.tileID.canonical,S,c,R)}(m instanceof s.ba||m instanceof s.bb)&&t._terrain&&t._terrain.enabled&&w&&m.uploadPending()&&t._terrain._clearRenderCacheForTile(w.id,this.tileID);const z=t&&t.style&&t.style.getOwnLayer(p);z&&(this.queryPadding=Math.max(this.queryPadding,z.queryRadius(m)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<s.o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=s.o.now()+t}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof s.T?this.texture.update(t):(this.texture=new s.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}
8setDependencies(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 p of n)if(d[p])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,n){if(!n||n.name==="mercator"||this._tileDebugBuffer)return;const c=s.bc(vc,this.tileID.canonical,this.tileTransform)[0],d=new s.bd,p=new s.be;for(let m=0;m<c.length;m++){const{x:g,y:x}=c[m];d.emplaceBack(g,x),p.emplaceBack(m)}p.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(p),this._tileDebugBuffer=t.createVertexBuffer(d,s.bf.members),this._tileDebugSegments=s.bg.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(t,n){if(this._tileBoundsBuffer||!n||n.name==="mercator")return;const c=s.bc(vc,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const m=(function(g,x){const w=s.aZ(g,x),S=Math.pow(2,g.z);for(let k=0;k<fo;k++)for(let F=0;F<fo;F++){const U=s.a_((g.x+(F+oa(F))/En)/S),H=s.a$((g.y+(k+oa(k))/En)/S),j=x.project(U,H),te=k*fo+F;Xn[2*te+0]=Math.round((j.x*w.scale-w.x)*s.al),Xn[2*te+1]=Math.round((j.y*w.scale-w.y)*s.al)}Co.fill(0),Ss.fill(0);for(let k=2045;k>=0;k--){const F=4*k,U=po[F+0],H=po[F+1],j=po[F+2],te=po[F+3],Y=U+j>>1,Q=H+te>>1,X=Y+Q-H,$=Q+U-Y,ie=H*fo+U,ue=te*fo+j,le=Q*fo+Y,xe=Math.hypot((Xn[2*ie+0]+Xn[2*ue+0])/2-Xn[2*le+0],(Xn[2*ie+1]+Xn[2*ue+1])/2-Xn[2*le+1])>=16;Co[le]=Co[le]||(xe?1:0),k<1022&&(Co[le]=Co[le]||Co[(H+$>>1)*fo+(U+X>>1)]||Co[(te+$>>1)*fo+(j+X>>1)])}const M=new s.b1,A=new s.b0;let C=0;function z(k,F){const U=F*fo+k;return Ss[U]===0&&(M.emplaceBack(Xn[2*U+0],Xn[2*U+1],k*s.al/En,F*s.al/En),Ss[U]=++C),Ss[U]-1}function R(k,F,U,H,j,te){const Y=k+U>>1,Q=F+H>>1;if(Math.abs(k-j)+Math.abs(F-te)>1&&Co[Q*fo+Y])R(j,te,k,F,Y,Q),R(U,H,j,te,Y,Q);else{const X=z(k,F),$=z(U,H),ie=z(j,te);A.emplaceBack(X,$,ie)}}return R(0,0,En,En,En,0),R(En,En,0,0,0,En),{vertices:M,indices:A}})(this.tileID.canonical,n);d=m.vertices,p=m.indices}else{d=new s.b1,p=new s.b0;for(const{x:g,y:x}of c)d.emplaceBack(g,x,0,0);const m=s.bh(d.int16.subarray(0,4*d.length),void 0,4);for(let g=0;g<m.length;g+=3)p.emplaceBack(m[g],m[g+1],m[g+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,s.bi.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(p),this._tileBoundsSegments=s.bg.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugBuffers(t,n){const c=n.projection;if(!c||c.name!=="globe"||n.freezeTileCoverage)return;const d=this.tileID.canonical,p=s.bj(d,n),m=s.bk(p),g=s.aj(n.zoom);let x;g>0&&(x=s.bl(new Float64Array(16),n.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,n,m,x,g),this._makeGlobeTileDebugTextBuffer(t,d,n,m,x,g)}_globePoint(t,n,c,d,p,m,g){let x=s.bm(t,n,c);if(m){const w=1<<c.z,S=s.aF(d.center.lng),M=s.aJ(d.center.lat),A=(c.x+.5)/w-S;let C=0;A>.5?C=-1:A<-.5&&(C=1);let z=(t/s.al+c.x)/w+C,R=(n/s.al+c.y)/w;z=(z-S)*d._pixelsPerMercatorPixel+S,R=(R-M)*d._pixelsPerMercatorPixel+M;const k=[z*d.worldSize,R*d.worldSize,0];s.af(k,k,m),x=s.bn(x,k,g)}return s.af(x,x,p)}_makeGlobeTileDebugBorderBuffer(t,n,c,d,p,m){const g=new s.bd,x=new s.be,w=new s.bo,S=(A,C,z,R,k)=>{const F=(z-A)/(k-1),U=(R-C)/(k-1),H=g.length;for(let j=0;j<k;j++){const te=A+j*F,Y=C+j*U;g.emplaceBack(te,Y);const Q=this._globePoint(te,Y,n,c,d,p,m);w.emplaceBack(Q[0],Q[1],Q[2]),x.emplaceBack(H+j)}},M=s.al;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(g,s.bf.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(w,s.bp.members),this._tileDebugSegments=s.bg.simpleSegment(0,0,g.length,x.length)}_makeGlobeTileDebugTextBuffer(t,n,c,d,p,m){const g=s.al/4,x=new s.bd,w=new s.b0,S=new s.bo,M=25;w.reserve(32),x.reserve(M),S.reserve(M);const A=(C,z)=>M*C+z;for(let C=0;C<M;C++){const z=C*g;for(let R=0;R<M;R++){const k=R*g;x.emplaceBack(k,z);const F=this._globePoint(k,z,n,c,d,p,m);S.emplaceBack(F[0],F[1],F[2])}}for(let C=0;C<4;C++)for(let z=0;z<4;z++){const R=A(C,z),k=A(C,z+1),F=A(C+1,z),U=A(C+1,z+1);w.emplaceBack(R,k,F),w.emplaceBack(F,k,U)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(w),this._tileDebugTextBuffer=t.createVertexBuffer(x,s.bf.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(S,s.bp.members),this._tileDebugTextSegments=s.bg.simpleSegment(0,0,M,32)}destroy(t=!0){for(const n in this.buckets)this.buckets[n].destroy(t);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),t&&this.texture&&this.texture instanceof s.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof s.T&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}s.bs.setPbf(s.bt);class bc extends sa{constructor(t,n,c,d,p){super(t,n,c,d,p),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
8getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,n,c){const d=c.context,p=d.gl;let m=this.texturePerLayer.get(t)||c.getTileTexture(n.width);m&&m instanceof s.T?m.update(n,{premultiply:!1}):m=new s.T(d,n,p.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 s.bs(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=s.bu(d,((p,m,g)=>{if(p)n(p);else try{const x=c.getHeaderLength(m);if(x>t)return void(this.request=this.fetchHeader(x,n));c.parseHeader(m),this._isHeaderLoaded=!0;let w=0;for(const S of Object.values(c.layers))w=Math.max(w,S.dataIndex[S.dataIndex.length-1].lastByte);m.byteLength>=w&&(this.entireBuffer=m),n(null,this.entireBuffer||m,g)}catch(x){n(x)}})),this.request}fetchBandForRender(t,n,c,d){this.fetchBand(t,n,c,(p=>
8{if(p)return void d(p);this.updateTextureDescriptor(t,n,c);const m=this.textureDescriptorPerLayer.get(n);d(null,m?m.img:null)}))}fetchBand(t,n,c,d,p=!0){const m=this._mrt;if(!this._isHeaderLoaded||!m)return void d(new Error("Tile header is not ready"));const g=this.actor;if(!g)return void d(new Error("Can't fetch tile band without an actor"));let x;const w=s.B(String(c),s.B(this.tileID.key,t));let S=this._taskQueue.get(w);S?S.add(d):(S=new Set,S.add(d),this._taskQueue.set(w,S));const M=(R,k)=>{x.complete(R,k),R?d(R):(S.forEach((F=>F(null,k))),this._taskQueue.delete(w))},A=(R,k)=>{if(R)return d(R);const F=g.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:k,task:x},M,void 0,!0);if(n!==null){const U=this._workQueuePerLayer.get(n)||[];U.push((()=>{F&&F.cancel(),x.cancel()})),this._workQueuePerLayer.has(n)||this._workQueuePerLayer.set(n,U)}};let C;try{C=m.getLayer(t)}catch(R){if(this.state==="reloading")return;throw R}if(!C)return void d(new Error(`Unknown sourceLayer "${t}"`));if(C.hasDataForBand(c))return S.forEach((R=>R(null,null))),void this._taskQueue.delete(w);const z=C.getDataRange([c]);if(x=m.createDecodingTask(z),!x||x.tasks.length)if(n!==null&&this.flushQueues(n),this.entireBuffer)A(null,this.entireBuffer.slice(z.firstByte,z.lastByte+1));else{const R=Object.assign({},this.requestParams,{headers:{Range:`bytes=${z.firstByte}-${z.lastByte}`}}),k=s.bu(R,A);if(n!==null){const F=this._fetchQueuePerLayer.get(n)||[];F.push((()=>{k.cancel(),x.cancel()})),this._fetchQueuePerLayer.has(n)||this._fetchQueuePerLayer.set(n,F)}}}updateNeeded(t,n){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==n||this.refreshedUponExpiration)&&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:p,tileSize:m,buffer:g,offset:x,scale:w}=d.getBandView(c),S=m+2*g,M=new s.q({width:S,height:S},p),A=this.texturePerLayer.get(n);A&&A instanceof s.T&&A.update(M,{premultiply:!1}),this.textureDescriptorPerLayer.set(n,{layer:t,band:c,img:M,buffer:g,offset:x,tileSize:m,format:d.pixelFormat,mix:[w,256*w,65536*w,16777216*w]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const n of this.texturePerLayer.values())n&&n instanceof s.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 Qd{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 p={value:n,timeout:void 0};if(c!==void 0&&(p.timeout=setTimeout((()=>{this.remove(t,p)}),c)),this.data[d].push(p),this.order.push(d),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const 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),p=this.data[c][d];return this.data[c].splice(d,1),p.timeout&&clearTimeout(p.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(p.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const 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 vl{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]||{},Object.assign(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==d&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const p in this.state[t][d])c[p]||(this.deletedStates[t][d][p]=null)}else for(const p in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][p]===null&&delete this.deletedStates[t][d][p]}removeFeatureState(t,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]||{},p=this.deletedStates[t];if(p===null)return{};if(n!==void 0){const g=String(n),x=Object.assign({},c[g],d[g]);if(p){const w=p[n];if(w===null)return{};for(const S in w)delete x[S]}return x}const m=Object.assign({},c,d);if(p)for(const g in p)delete m[g];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 p={};for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]={}),Object.assign(this.state[d][m],this.stateChanges[d][m]),p[m]=this.state[d][m];c[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const p={};if(this.deletedStates[d]===null)for(const m in this.state[d])p[m]={},this.state[d][m]={};else for(const m in this.deletedStates[d]){if(this.deletedStates[d][m]===null)this.state[d][m]={};else if(this.state[d][m])for(const g of Object.keys(this.deletedStates[d][m]))delete this.state[d][m][g];p[m]=this.state[d][m]}c[d]=c[d]||{},Object.assign(c[d],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(n)}}class Ln extends s.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 Qd(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
8,this._minTileCacheSize=n.minTileCacheSize,this._maxTileCacheSize=n.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new vl,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,this.map?this.map.painter:void 0),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(wc).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,p)=>{const m=d.tileID,g=p.tileID,x=new s.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),w=new s.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-g.overscaledZ||w.y-x.y||w.x-x.x})).map((d=>d.tileID.key)):c.map((d=>d.tileID)).sort(wc).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,p){if(d){if(t.state="errored",d.status!==404)this._source.fire(new s.y(d,{tile:t}));else{if(this._source.fire(new s.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const g=this.map.painter.terrain;this.update(this.transform,g.getScaledDemTileSize(),!0),g.resetTileLookupCache(this.id)}else this.update(this.transform)}return}t.timeAdded=s.o.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);let m=new Map;p&&p.responseHeaders&&(m=p.responseHeaders),this._source.fire(new s.z("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id,responseHeaders:m}))}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const p=n[d];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);c(t,m),c(m,t)}}function c(d,p){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let m=p.tileID.canonical.x-d.tileID.canonical.x;const g=p.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),w=p.tileID.key;m===0&&g===0||Math.abs(g)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,m,g),d.neighboringTiles&&d.neighboringTiles[w]&&(d.neighboringTiles[w].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,c,d){for(const p in this._tiles){let m=this._tiles[p];if(d[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>c)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const w=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[w.key],m&&m.hasData()&&(g=w)}let x=g;
8for(;x.overscaledZ>n;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[g.key]=g;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),p=this._getLoadedTile(d);if(p)return p}}_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,p=Math.floor(c*d*5),m=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,p):p,g=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(g)}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 p=this._tiles[d];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),c[p.tileID.key]=p}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,n,c,d,p){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 g,x=this._source.maxzoom;const w=this.map&&this.map.painter?this.map.painter._terrain:null;if(w&&w.sourceCache===this&&w.attenuationRange()){const A=w.attenuationRange()[0],C=Math.floor(A)-Math.log2(w.getDemUpscale());x>C&&(x=C)}if(this.used||this.usedForTerrain){if(this._source.tileID)g=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((A=>new s.aQ(A.canonical.z,A.wrap,A.canonical.z,A.canonical.x,A.canonical.y)));else if(this.tileCoverLift!==0){const A=t.clone();A.tileCoverLift=this.tileCoverLift,g=A.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"&&(g.push(new s.aQ(1,0,1,0,0)),g.push(new s.aQ(1,0,1,1,0)),g.push(new s.aQ(1,0,1,0,1)),g.push(new s.aQ(1,0,1,1,1)))}else if(g=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 A=this._source.hasTile.bind(this._source);g=g.filter((C=>A(C)))}}else g=[];if(g.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!aa(this._source.type)){const A=t.coveringZoomLevel({tileSize:n||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),C=Math.min(A,this._source.maxzoom);if(m){const z=t.extendTileCover(g,C);for(const R of z)g.push(R)}else if(p){const z=t.extendTileCoverToNearPlane(g,this.transform.getFrustum(C),C);for(const R of z)g.push(R)}else if(this.castsShadows&&d){const z=t.extendTileCover(g,C,d,16);for(const R of z)this._shadowCasterTiles[R.key]=!0,g.push(R)}}const S=this._updateRetainedTiles(g);if(aa(this._source.type)&&g.length!==0){const A={},C={},z=Object.keys(S);for(const k of z){const F=S[k],U=this._tiles[k];if(!U||U.fadeEndTime&&U.fadeEndTime<=s.o.now())continue;const H=this.findLoadedParent(F,Math.max(F.overscaledZ-Ln.maxOverzooming,this._source.minzoom));H&&(this._addTile(H.tileID),A[H.tileID.key]=H.tileID),C[k]=F}const R=g[g.length-1].overscaledZ;for(const k in this._tiles){const F=this._tiles[k];if(S[k]||!F.hasData())continue;let U=F.tileID;for(;U.overscaledZ>R;){U=U.scaledTo(U.overscaledZ-1);const H=this._tiles[U.key];if(H&&H.hasData()&&C[U.key]){S[k]=F.tileID;break}}}for(const k in A)S[k]||(this._coveredTiles[k]=!0,S[k]=A[k])}for(const A in S)this._tiles[A].clearFadeHold();const M=s.bv(this._tiles,S);for(const A of M){const C=this._tiles[A];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(+A)}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(((w,S)=>
8Math.min(w,S.overscaledZ)),1/0),p=t[0].overscaledZ,m=Math.max(p-Ln.maxOverzooming,this._source.minzoom),g=Math.max(p+Ln.maxUnderzooming,this._source.minzoom),x={};for(const w of t){const S=this._addTile(w);n[w.key]=w,S.hasData()||d<this._source.maxzoom&&(x[w.key]=w)}this._retainLoadedChildren(x,d,g,n);for(const w of t){let S=this._tiles[w.key];if(S.hasData())continue;if(w.canonical.z>=this._source.maxzoom){const A=w.children(this._source.maxzoom)[0],C=this.getTile(A);if(C&&C.hasData()){n[A.key]=A;continue}}else{const A=w.children(this._source.maxzoom);if(n[A[0].key]&&n[A[1].key]&&n[A[2].key]&&n[A[3].key])continue}let M=S.wasRequested();for(let A=w.overscaledZ-1;A>=m;--A){const C=w.scaledTo(A);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 p=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(p),c)break;d=p}for(const p of n)this._loadedParentTiles[p]=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,p=this._source.tileSize*t.overscaleFactor();n=this._source.type==="raster-array"?new bc(t,p,this.transform.tileZoom,d,this._isRaster):new sa(t,p,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 s.z("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=[],p=this.transform;if(!p)return d;const m=p.projection.name==="globe",g=s.aF(p.center.lng);for(const x in this._tiles){const w=this._tiles[x];if(c&&w.clearQueryDebugViz(),w.holdingForFade())continue;let S;if(m){const M=w.tileID.canonical;if(M.z===0){const A=[Math.abs(s.aA(g,...Wo(M,-1))-g),Math.abs(s.aA(g,...Wo(M,1))-g)];S=[0,2*A.indexOf(Math.min(...A))-1]}else{const A=[Math.abs(s.aA(g,...Wo(M,-1))-g),Math.abs(s.aA(g,...Wo(M,0))-g),Math.abs(s.aA(g,...Wo(M,1))-g)];S=[A.indexOf(Math.min(...A))-1]}}else S=[0];for(const M of S){const A=t.containsTile(w,p,n,M);A&&d.push(A)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,n){const c=this.getRenderableIds(t,n).map((p=>this._tiles[p].tileID)),d=this.transform.projection.name==="globe";for(const p of c)p.projMatrix=this.transform.calculateProjMatrix(p.toUnwrapped()),p.expandedProjMatrix=d?this.transform.calculateProjMatrix(p.toUnwrapped(),!1,!0):p.projMatrix;return c}sortCoordinatesByDistance(t){const n=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),p={};for(const m of n){const g=1/(1<<m.canonical.z);p[m.key]=((m.canonical.x+.5)*g+m.wrap-c[0])*d[0]+((m.canonical.y+.5)*g-c[1])*d[1]-c[2]*d[2]}return n.sort(((m,g)=>p[m.key]-p[g.key])),n}hasTransition(){if(this._source.hasTransition())return!0;
8if(aa(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=s.o.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],p=this.map.painter.terrain,m=this.usedForTerrain&&p?p.getScaledDemTileSize():this._source.tileSize;for(const x of d){const w=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 w)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}const g=Array.from(c.values());s.bw(g,((x,w)=>{const S=new sa(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),w(M,S)}))}),n)}}function wc(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 aa(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function Wo(l,t){const n=1<<l.z;return[l.x/n+t,(l.x+1)/n+t]}Ln.maxOverzooming=10,Ln.maxUnderzooming=3;class rm{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 p=this.style.getLayerSource(d);p&&p.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 p=d.layer,m=this.style.getLayerSourceCache(p);let g=1;p.type==="fill-extrusion"?g=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0:p.type==="building"&&(g=d.visible?p.paint.get("building-vertical-scale"):0);let x=m?m.getTile(n):null;if(!x&&m)for(const w in m._tiles){const S=m._tiles[w];if(n.canonical.isChildOf(S.tileID.canonical)){x=S;break}}this.currentBuildingBuckets.push({bucket:x?x.getBucket(p):null,tileID:x?x.tileID:n,verticalScale:g})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const p=t.symbolInstances.get(d),m=p.zOffset,g=this._getHeightAtTileOffset(n,p.tileAnchorX,p.tileAnchorY);p.zOffset=g!==Number.NEGATIVE_INFINITY?g:m,c||m===p.zOffset||(c=!0),t.hasAnyZOffset||p.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,n,c,d){let p=n,m=c;if(t.canonical.z!==d.canonical.z){const g=d.canonical,x=1/(1<<t.canonical.z-g.z);p=(n+t.canonical.x*s.al)*x-g.x*s.al|0,m=(c+t.canonical.y*s.al)*x-g.y*s.al|0}return{tileX:p,tileY:m}}_getHeightAtTileOffset(t,n,c){let d,p;for(let m=0;m<this.layers.length;++m){const g=this.layers[m].layer;if(g.type!=="fill-extrusion"&&g.type!=="building")continue;const{bucket:x,tileID:w,verticalScale:S}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:M,tileY:A}=this._mapCoordToOverlappingTile(t,n,c,w),C=x.getHeightAtTileCoord(M,A);C&&C.height!==void 0&&(C.hidden?d=C.height:p=Math.max(C.height*S,p||0))}if(p!==void 0)return p;for(let m=0;m<this.layers.length;++m){const g=this.layers[m];if(g.layer.type!=="model"||!g.visible)continue;const{bucket:x,tileID:w}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:S,tileY:M}=this._mapCoordToOverlappingTile(t,n,c,w),A=x.getHeightAtTileCoord(S,M);if(A&&!A.hidden)return A.height===void 0&&d!==void 0?Math.min(A.maxHeight,d)*A.verticalScale:A.height?A.height*A.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function ef(l,t){const n={};for(const c in l)c!=="ref"&&(n[c]=l[c]);return s.bx.forEach((c=>{c in t&&(n[c]=t[c])})),n}function bl(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]=ef(l[n],t[l[n].ref]));return l}const ri={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 Tc(l,t,n){n.push({command:ri.addSource,args:[l,t[l]]})}function oh(l,t,n){t.push({command:ri.removeSource,args:[l]}),n[l]=!0}function tf(l,t,n,c){oh(l,n,c),Tc(l,t,n)}function rf(l,t,n){let c;for(c in l[n])if(l[n].hasOwnProperty(c)&&c!=="data"&&!s.by(l[n][c],t[n][c]))return!1;for(c in t[n])if(t[n].hasOwnProperty(c)&&c!=="data"&&!s.by(l[n][c],t[n][c]))return!1;return!0}function Es(l,t,n,c,d,p){let m;
vendor: 4,352 bytes, line 8
8for(m in t=t||{},l=l||{})l.hasOwnProperty(m)&&(s.by(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}));for(m in t)t.hasOwnProperty(m)&&!l.hasOwnProperty(m)&&(s.by(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}))}function wl(l){return l.id}function Tl(l,t){return l[t.id]=t,l}function sh(l,t,n){const c=t.createTileMatrix(l,l.worldSize,n.toUnwrapped());return s.aB(new Float32Array(16),l.projMatrix,c)}function Sc(l,t,n){if(t.projection.name===n.projection.name)return l.projMatrix;const c=n.clone();return c.setProjection(t.projection),sh(c,t.getProjection(),l)}function Po(l,t,n){return t.name===n.projection.name?l.projMatrix:sh(n,t,l)}class Sl{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=s.aA(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 p=n-1,m=this._distances[p],g=c-m,x=g>0?(d-m)/g:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}class ah{constructor(t,n,c){const d=this.boxCells=[],p=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([]),p.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,p){this._forEachCell(n,c,d,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(p)}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,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,c,d,p,m){this.circleCells[p].push(m)}_query(t,n,c,d,p,m){if(c<0||t>this.width||d<0||n>this.height)return!p&&[];const g=[];if(t<=0&&n<=0&&this.width<=c&&this.height<=d){if(p)return!0;for(let x=0;x<this.boxKeys.length;x++)g.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 w=this.circles[3*x],S=this.circles[3*x+1],M=this.circles[3*x+2];g.push({key:this.circleKeys[x],x1:w-M,y1:S-M,x2:w+M,y2:S+M})}return m?g.filter(m):g}return this._forEachCell(t,n,c,d,this._queryCell,g,{hitTest:p,seenUids:{box:{},circle:{}}},m),p?g.length>0:g}_queryCircle(t,n,c,d,p){const m=t-c,g=t+c,x=n-c,w=n+c;if(g<0||m>this.width||w<0||x>this.height)return!d&&[];const S=[];return this._forEachCell(m,x,g,w,this._queryCellCircle,S,{hitTest:d,circle:{x:t,y:n,radius:c},seenUids:{box:{},circle:{}}},p),d?S.length>0:S}query(t,n,c,d,p){return this._query(t,n,c,d,!1,p)}hitTest(t,n,c,d,p){return this._query(t,n,c,d,!0,p)}hitTestCircle(t,n,c,d){return this._queryCircle(t,n,c,!0,d)}_queryCell(t,n,c,d,p,m,g,x){const w=g.seenUids,S=this.boxCells[p];if(S!==null){const A=this.bboxes;for(const C of S)if(!w.box[C]){w.box[C]=!0;const z=4*C;if(t<=A[z+2]&&n<=A[z+3]&&c>=A[z+0]&&d>=A[z+1]&&(!x||x(this.boxKeys[C]))){if(g.hitTest)return m.push(!0),!0;m.push({key:this.boxKeys[C],x1:A[z],y1:A[z+1],x2:A[z+2],y2:A[z+3]})}}}const M=this.circleCells[p];if(M!==null){const A=this.circles;for(const C of M)if(!w.circle[C]){w.circle[C]=!0;const z=3*C;if(this._circleAndRectCollide(A[z],A[z+1],A[z+2],t,n,c,d)&&(!x||x(this.circleKeys[C]))){if(g.hitTest)return m.push(!0),!0;{const R=A[z],k=A[z+1],F=A[z+2];m.push({key:this.circleKeys[C],x1:R-F,y1:k-F,x2:R+F,y2:k+F})}}}}}_queryCellCircle(t,n,c,d,p,m,g,x){const w=g.circle,S=g.seenUids,M=this.boxCells[p];if(M!==null){const C=this.bboxes;for(const z of M)if(!S.box[z]){S.box[z]=!0;const R=4*z;if(this._circleAndRectCollide(w.x,w.y,w.radius,C[R+0],C[R+1],C[R+2],C[R+3])&&(!x||x(this.boxKeys[z])))return m.push(!0),!0}}const A=this.circleCells[p];if(A!==null){const C=this.circles;for(const z of A)if(!S.circle[z]){S.circle[z]=!0;const R=3*z;
8if(this._circlesCollide(C[R],C[R+1],C[R+2],w.x,w.y,w.radius)&&(!x||x(this.circleKeys[z])))return m.push(!0),!0}}}_forEachCell(t,n,c,d,p,m,g,x){const w=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),M=this._convertToXCellCoord(c),A=this._convertToYCellCoord(d);for(let C=w;C<=M;C++)for(let z=S;z<=A;z++)if(p.call(this,t,n,c,d,this.xCellCount*z+C,m,g,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,p,m){const g=d-t,x=p-n,w=c+m;return w*w>g*g+x*x}_circleAndRectCollide(t,n,c,d,p,m,g){const x=(m-d)/2,w=Math.abs(t-(d+x));if(w>x+c)return!1;const S=(g-p)/2,M=Math.abs(n-(p+S));if(M>S+c)return!1;if(w<=x||M<=S)return!0;const A=w-x,C=M-S;return A*A+C*C<=c*c}}const Is={unknown:0,flipRequired:1,flipNotRequired:2},la=Math.tan(85*Math.PI/180);function fn(l,t,n,c,d,p,m){const g=s.bC();if(n)if(p.name==="globe"){const x=s.bD(d,t);s.aB(g,g,x)}else{const x=s.bE([],m);g[0]=x[0],g[1]=x[1],g[4]=x[2],g[5]=x[3],c||s.bB(g,g,d.angle)}else s.aB(g,d.labelPlaneMatrix,l);return g}function Ec(l,t,n,c,d,p,m){const g=fn(l,t,n,c,d,p,m);return p.name==="globe"&&n||(g[2]=g[6]=g[10]=g[14]=0),g}function El(l,t,n,c,d,p,m){if(n){if(p.name==="globe"){const g=fn(l,t,n,c,d,p,m);return s.bl(g,g),s.aB(g,l,g),g}{const g=s.bz(l),x=s.bA([]);return x[0]=m[0],x[1]=m[1],x[4]=m[2],x[5]=m[3],s.aB(g,g,x),c||s.bB(g,g,-d.angle),g}}return d.glCoordMatrix}function Yn(l,t,n,c){const d=[l,t,n,1];n?s.aC(d,d,c):pt(d,d,c);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function yi(l,t){return Math.min(.5+l/t*.5,1.5)}function nf(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 of(l,t,n,c,d,p,m,g,x,w,S=1){const M=n.transform,A=c?l.textSizeData:l.iconSizeData,C=s.bK(A,n.transform.zoom,S),z=M.projection.name==="globe",R=[256/n.width*2+1,256/n.height*2+1],k=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;k.clear();let F=null;z&&(F=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const U=l.lineVertexArray,H=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,j=n.transform.width/n.transform.height;let te,Y=!1;for(let Q=0;Q<H.length;Q++){const X=H.get(Q),{numGlyphs:$,writingMode:ie}=X;if(ie!==s.bL.vertical||Y||te===s.bL.horizontal||(Y=!0),te=ie,(X.hidden||ie===s.bL.vertical)&&!Y){mo($,k);continue}Y=!1;const ue=new s.P(X.tileAnchorX,X.tileAnchorY),le=l.elevationType==="road",xe=!!M.elevation||le;let{x:ve,y:Ae,z:Ve}=M.projection.projectTilePoint(ue.x,ue.y,w.canonical),me=null;if(xe){const it=le?l.getElevationFeatureForText(Q):null;me={getElevation:x,elevation:M.elevation,elevationFeature:it};const[gt,Mt,$t]=x(ue,M.elevation,it);ve+=gt,Ae+=Mt,Ve+=$t}const se=[ve,Ae,Ve,1];if(s.aC(se,se,t),!nf(se,R)){mo($,k);continue}const Te=se[3],_e=yi(n.transform.getCameraToCenterDistance(M.projection),Te),Re=s.bM(A,C,X),We=m?Re/_e:Re*_e,et=Yn(ve,Ae,Ve,d);if(et[3]<=0){mo($,k);continue}let qe={};const Ue=s.an(l.layers[0].layout.get("text-max-angle")),ct=Math.cos(Ue),st=m?null:me,Je=lh(X,We,!1,g,t,d,p,l.glyphOffsetArray,U,k,F,et,ue,qe,j,st,M.projection,w,m,ct);Y=Je.useVertical,st&&Je.needsFlipping&&(qe={}),(Je.notEnoughRoom||Y||Je.needsFlipping&&lh(X,We,!0,g,t,d,p,l.glyphOffsetArray,U,k,F,et,ue,qe,j,st,M.projection,w,m,ct).notEnoughRoom)&&mo($,k)}c?(l.text.dynamicLayoutVertexBuffer.updateData(k),F&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(F)):(l.icon.dynamicLayoutVertexBuffer.updateData(k),F&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(F))}function sf(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k){const{lineStartIndex:F,glyphStartIndex:U,segment:H}=g,j=U+g.numGlyphs,te=F+g.lineLength,Y=t.getoffsetX(U),Q=t.getoffsetX(j-1),X=La(l*Y,n,c,d,p,m,H,F,te,x,w,S,M,A,!0,C,z,R,k);if(!X)return null;const $=La(l*Q,n,c,d,p,m,H,F,te,x,w,S,M,A,!0,C,z,R,k);return $?{first:X,last:$}:null}function wt(l,t,n,c){return l===s.bL.horizontal&&Math.abs(c)>Math.abs(n)?{useVertical:!0}:l===s.bL.vertical?c>0?{needsFlipping:!0}:null:t!==Is.unknown&&(function(d,p){return d===0||Math.abs(p/d)>la})(n,c)?t===Is.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function lh(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k,F,U,H){const j=t/24,te=l.lineOffsetX*j,Y=l.lineOffsetY*j,{lineStartIndex:Q,glyphStartIndex:X,numGlyphs:$,segment:ie,writingMode:ue,flipState:le}=l,xe=Q+l.lineLength,ve=Ae=>{if(S){const[Te,_e,Re]=Ae.up,We=w.length;s.bN(S,We+0,Te,_e,Re),s.bN(S,We+1,Te,_e,Re),s.bN(S,We+2,Te,_e,Re),s.bN(S,We+3,Te,_e,Re)}const[Ve,me,se]=Ae.point;s.bO(w,Ve,me,se,Ae.angle)};if($>1){const Ae=sf(j,g,te,Y,n,M,A,l,x,p,C,R,!1,k,F,U,H);if(!Ae)return{notEnoughRoom:!0};if(c&&!n){let[Ve,me,se]=Ae.first.point,[Te,_e,Re]=Ae.last.point;[Ve,me]=Yn(Ve,me,se,m),[Te,_e]=Yn(Te,_e,Re,m);const We=wt(ue,le,(Te-Ve)*z,_e-me);if(l.flipState=We&&We.needsFlipping?Is.flipRequired:Is.flipNotRequired,We)return We}ve(Ae.first);for(let Ve=X+1;Ve<X+$-1;Ve++){const me=La(j*g.getoffsetX(Ve),te,Y,n,M,A,ie,Q,xe,x,p,C,R,!1,!1,k,F,U,H);if(!me)return w.length-=4*(Ve-X),{notEnoughRoom:!0};ve(me)}ve(Ae.last)}else{if(c&&!n){const Ve=Yn(A.x,A.y,0,d),me=Q+ie+1,se=new s.P(x.getx(me),x.gety(me)),Te=Yn(se.x,se.y,0,d),_e=Te[3]>0?Te:Kn(A,se,Ve,1,d,void 0,k,F.canonical),Re=wt(ue,le,(_e[0]-Ve[0])*z,_e[1]-Ve[1]);if(l.flipState=Re&&Re.needsFlipping?Is.flipRequired:Is.flipNotRequired,Re)return Re}const Ae=La(j*g.getoffsetX(X),te,Y,n,M,A,ie,Q,xe,x,p,C,R,!1,!1,k,F,U,H);if(!Ae)return{notEnoughRoom:!0};ve(Ae)}return{}}function Il(l,t,n,c,d){const{x:p,y:m,z:g}=c.projectTilePoint(l.x,l.y,t);if(!d)return Yn(p,m,g,n);const[x,w,S]=d.getElevation(l,d.elevation,d.elevationFeature);return Yn(p+x,m+w,g+S,n)}function Kn(l,t,n,c,d,p,m,g){const x=Il(l.sub(t)._unit()._add(l),g,d,m,p);return s.av(x,n,x),s.aw(x,x),s.bH(x,n,x,c)}function La(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k,F,U){const H=c?l-t:l+t;let j=H>0?1:-1,te=0;c&&(j*=-1,te=Math.PI),j<0&&(te+=Math.PI);let Y=g+m+(j>0?0:1)|0,Q=d,X=d,$=0,ie=0;const ue=Math.abs(H),le=[],xe=[];let ve=p,Ae=ve,Ve=s.bF([]);const me=()=>Kn(Ae,ve,X,ue-$+1,S,A,R,k.canonical);for(;$+ie<=ue;){if(Y+=j,Y<g||Y>=x)return null;if(X=Q,Ae=ve,le.push(X),C&&xe.push(Ae),ve=new s.P(w.getx(Y),w.get
8y(Y)),Q=M[Y],!Q){const st=Il(ve,k.canonical,S,R,A);Q=st[3]>0?M[Y]=st:me()}$+=ie;const Ue=s.av([],Q,X),ct=s.bG(X,Q);if(n&&ct>0&&ie>0&&s.bJ(Ve,Ue)/(ie*ct)<U)return null;ie=ct,Ve=Ue}z&&A&&(M[Y]&&(Q=me(),ie=s.bG(X,Q),Ve=s.av([],Q,X)),M[Y]=Q);const se=(ue-$)/ie,Te=ve.sub(Ae)._mult(se)._add(Ae),_e=s.bH([],X,Ve,se);let Re=[0,0,1],We=Ve[0],et=Ve[1];if(F&&(Re=R.upVector(k.canonical,Te.x,Te.y),Re[0]!==0||Re[1]!==0||Re[2]!==1)){const Ue=[Re[2],0,-Re[0]],ct=s.bI([],Re,Ue);s.aw(Ue,Ue),s.aw(ct,ct),We=s.bJ(Ve,Ue),et=s.bJ(Ve,ct)}if(n){const Ue=s.bI([],Re,Ve);s.aw(Ue,Ue),s.bH(_e,_e,Ue,n*j)}const qe=te+Math.atan2(et,We);return le.push(_e),C&&xe.push(Te),{point:_e,angle:qe,path:le,tilePath:xe,up:Re}}function mo(l,t){const n=t.length,c=n+4*l;t.resize(c),t.float32.fill(-1/0,4*n,4*c)}function pt(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 Yt=100;class wi{constructor(t,n,c=new ah(t.width+200,t.height+200,25),d=new ah(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+Yt,this.screenBottomBoundary=t.height+Yt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=n}placeCollisionBox(t,n,c,d,p,m,g,x,w,S,M){let A=c.projectedAnchorX,C=c.projectedAnchorY,z=c.projectedAnchorZ;const R=c.tileAnchorX,k=c.tileAnchorY,F=c.elevation,U=c.tileID,H=t.getProjection();if(F&&U){const[xe,ve,Ae]=H.upVector(U.canonical,c.tileAnchorX,c.tileAnchorY),Ve=H.upVectorScale(U.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;A+=xe*F*Ve,C+=ve*F*Ve,z+=Ae*F*Ve}const j=t.projection.name==="globe",te=t.projection.name==="globe"?s.aj(this.transform.zoom):0;if(U&&j&&te<1&&!m){const xe=1<<U.canonical.z,ve=s.bP(R,k);s.bQ(ve,ve,1/s.al),s.bR(ve,ve,s.bP(U.canonical.x,U.canonical.y)),s.bQ(ve,ve,1/xe),s.bS(ve,ve,s.bP(d[0],d[1])),ve[0]=s.bT(ve[0],-.5,.5),s.bQ(ve,ve,s.al);const Ae=s.bU(ve[0],ve[1],s.al/(2*Math.PI),1);s.aC(Ae,Ae,p),A=s.ak(A,Ae[0],te),C=s.ak(C,Ae[1],te),z=s.ak(z,Ae[2],te)}const Y=this.projectAndGetPerspectiveRatio(S,A,C,z,c.tileID,H.name==="globe"||!!F||this.transform.pitch>0,H),Q=w*Y.perspectiveRatio,X=(c.x1*n+g.x-c.padding)*Q+Y.point.x,$=(c.y1*n+g.y-c.padding)*Q+Y.point.y,ie=(c.x2*n+g.x+c.padding)*Q+Y.point.x,ue=(c.y2*n+g.y+c.padding)*Q+Y.point.y,le=Y.perspectiveRatio<=.55||Y.occluded;return!this.isInsideGrid(X,$,ie,ue)||!x&&this.grid.hitTest(X,$,ie,ue,M)||le?{box:[],offscreen:!1,occluded:Y.occluded}:{box:[X,$,ie,ue],offscreen:this.isOffscreen(X,$,ie,ue),occluded:!1}}placeCollisionCircles(t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k){const F=[],U=this.transform.elevation,H=t.getProjection(),j=t.elevationType==="road",te=!!U||j,Y=s.bV.getAtTileOffsetFunc(k,this.transform.center.lat,this.transform.worldSize,H),Q=new s.P(c.tileAnchorX,c.tileAnchorY),X=new s.P(c.tileAnchorX,c.tileAnchorY);let{x:$,y:ie,z:ue}=H.projectTilePoint(X.x,X.y,k.canonical),le=null;if(te){const ct=j?t.getElevationFeatureForText(d):null;le={getElevation:Y,elevation:U,elevationFeature:ct};const[st,Je,it]=Y(Q,U,ct);$+=st,ie+=Je,ue+=it}const xe=H.name==="globe",ve=this.projectAndGetPerspectiveRatio(x,$,ie,ue,k,xe||!!U||this.transform.pitch>0,H),{perspectiveRatio:Ae}=ve,Ve=(A?g/Ae:g*Ae)/s.bY,me=Yn($,ie,ue,w),se=c.lineOffsetX*Ve,Te=c.lineOffsetY*Ve,_e=s.an(t.layers[0].layout.get("text-max-angle")),Re=Math.cos(_e),We=ve.signedDistanceFromCamera>0?sf(Ve,m,se,Te,j&&c.flipState===1,me,X,c,p,w,{},te&&!A?le:null,A&&te,H,k,A,Re):null;let et=!1,qe=!1,Ue=!0;if(We&&!ve.occluded){const ct=.5*z*Ae+R,st=new s.P(-100,-100),Je=new s.P(this.screenRightBoundary,this.screenBottomBoundary),it=new Sl,{first:gt,last:Mt}=We,$t=gt.path.length;let ci=[];for(let At=$t-1;At>=1;At--)ci.push(gt.path[At]);for(let At=1;At<Mt.path.length;At++)ci.push(Mt.path[At]);const ut=2.5*ct;S&&(ci=ci.map((([At,di,Ti],xi)=>(te&&!xe&&(Ti=Y(xi<$t-1?gt.tilePath[$t-1-xi]:Mt.tilePath[xi-$t+2],U,le.elevationFeature)[2]),Yn(At,di,Ti,S)))),ci.some((At=>At[3]<=0))&&(ci=[]));let si=[];if(ci.length>0){let At=1/0,di=-1/0,Ti=1/0,xi=-1/0;
8for(const ni of ci)At=Math.min(At,ni[0]),Ti=Math.min(Ti,ni[1]),di=Math.max(di,ni[0]),xi=Math.max(xi,ni[1]);di>=st.x&&At<=Je.x&&xi>=st.y&&Ti<=Je.y&&(si=[ci.map((ni=>new s.P(ni[0],ni[1])))],(At<st.x||di>Je.x||Ti<st.y||xi>Je.y)&&(si=s.bW(si,st.x,st.y,Je.x,Je.y)))}for(const At of si){it.reset(At,.25*ct);let di=0;di=it.length<=.5*ct?1:Math.ceil(it.paddedLength/ut)+1;for(let Ti=0;Ti<di;Ti++){const xi=Ti/Math.max(di-1,1),ni=it.lerp(xi),Ot=ni.x+Yt,hi=ni.y+Yt;F.push(Ot,hi,ct,0);const tr=Ot-ct,Ui=hi-ct,fi=Ot+ct,Qt=hi+ct;if(Ue=Ue&&this.isOffscreen(tr,Ui,fi,Qt),qe=qe||this.isInsideGrid(tr,Ui,fi,Qt),!n&&this.grid.hitTestCircle(Ot,hi,ct,C)&&(et=!0,!M))return{circles:[],offscreen:!1,collisionDetected:et,occluded:!1}}}}return{circles:!M&&et||!qe?[]:F,offscreen:Ue,collisionDetected:et,occluded:ve.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,p=-1/0,m=-1/0;for(const S of t){const M=new s.P(S.x+Yt,S.y+Yt);c=Math.min(c,M.x),d=Math.min(d,M.y),p=Math.max(p,M.x),m=Math.max(m,M.y),n.push(M)}const g=this.grid.query(c,d,p,m).concat(this.ignoredGrid.query(c,d,p,m)),x={},w={};for(const S of g){const M=S.key;if(x[M.bucketInstanceId]===void 0&&(x[M.bucketInstanceId]={}),x[M.bucketInstanceId][M.featureIndex])continue;const A=[new s.P(S.x1,S.y1),new s.P(S.x2,S.y1),new s.P(S.x2,S.y2),new s.P(S.x1,S.y2)];s.bX(n,A)&&(x[M.bucketInstanceId][M.featureIndex]=!0,w[M.bucketInstanceId]===void 0&&(w[M.bucketInstanceId]=[]),w[M.bucketInstanceId].push(M.featureIndex))}return w}insertCollisionBox(t,n,c,d,p){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:p},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,c,d,p){const m=n?this.ignoredGrid:this.grid,g={bucketInstanceId:c,featureIndex:d,collisionGroupID:p};for(let x=0;x<t.length;x+=4)m.insertCircle(g,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,n,c,d,p,m,g){const x=[n,c,d,1];let w=!1;d||this.transform.pitch>0?(s.aC(x,x,t),this.fogState&&p&&g.name!=="globe"&&(w=(function(A,C,z,R,k,F){const U=F.calculateFogTileMatrix(k),H=[C,z,R];return s.af(H,H,U),nt(A,s.ag(H),F.pitch,F._fov)})(this.fogState,n,c,d,p.toUnwrapped(),this.transform)>.9)):pt(x,x,t);const S=x[3];return{point:new s.P((x[0]/S+1)/2*this.transform.width+Yt,(-x[1]/S+1)/2*this.transform.height+Yt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(g)/S*.5,1.5),signedDistanceFromCamera:S,occluded:m&&x[2]>S||w}}isOffscreen(t,n,c,d){return c<Yt||t>=this.screenRightBoundary||d<Yt||n>this.screenBottomBoundary}isInsideGrid(t,n,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=s.bA([]);return s.br(t,t,[-100,-100,0]),t}}class In{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 Ro{constructor(t,n,c,d,p,m=!1){this.text=new In(t?t.text:null,n,c,p),this.icon=new In(t?t.icon:null,n,d,p),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class _i{constructor(t,n,c,d=!1){this.text=t,this.icon=n,this.skipFade=c,this.clipped=d}}class Ic{constructor(){this.invProjMatrix=s.bC(),this.viewportMatrix=s.bC(),this.circles=[]}}class Al{constructor(t,n,c,d,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=p}}class Ml{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 nn(l,t,n,c,d){const{horizontalAlign:p,verticalAlign:m}=s.c1(l),g=-(p-.5)*t,x=-(m-.5)*n,w=s.c2(l,c);return new s.P(g+w[0]*d,x+w[1]*d)}function br(l,t,n,c,d){const p=new s.P(l,t);return n&&p._rotate(c?d:-d),p}class nm{constructor(t,n,c,d,p,m){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new wi(this.transform,p),this.buildingIndex=m,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Ml(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(t,n,c,d,p=1){const m=c.getBucket(n),g=c.latestFeatureIndex;if(!m||!g||n.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,w=m.layers[0].paint,S=c.collisionBoxArray,M=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ
8),A=c.tileSize/s.al,C=c.tileID.toUnwrapped();this.transform.setProjection(m.projection);const z=(R=c.tileID,k=m.getProjection(),F=this.transform,k.name===this.projection?F.calculateProjMatrix(R.toUnwrapped()):sh(F,k,R));var R,k,F;const U=x.get("text-pitch-alignment")==="map",H=x.get("text-rotation-alignment")==="map";n.compileFilter(n.options);const j=n.dynamicFilter(),te=n.dynamicFilterNeedsFeature(),Y=this.transform.calculatePixelsToTileUnitsMatrix(c),Q=Ec(z,c.tileID.canonical,U,H,this.transform,m.getProjection(),Y);let X=null;const $=m.getProjection().createInversionMatrix(this.transform,c.tileID.canonical);if(U){const se=El(z,c.tileID.canonical,U,H,this.transform,m.getProjection(),Y);X=s.aB([],this.transform.labelPlaneMatrix,se)}let ie=null;j&&c.latestFeatureIndex&&(ie={unwrappedTileID:C,dynamicFilter:j,dynamicFilterNeedsFeature:te}),this.retainedQueryData[m.bucketInstanceId]=new Al(m.bucketInstanceId,g,m.sourceLayerIndex,m.index,c.tileID);const[ue,le]=m.layers[0].layout.get("text-size-scale-range"),xe=s.aA(p,ue,le),[ve,Ae]=x.get("icon-size-scale-range"),Ve=s.aA(p,ve,Ae),me={bucket:m,layout:x,paint:w,posMatrix:z,invMatrix:$,mercatorCenter:[s.aF(this.transform.center.lng),s.aJ(this.transform.center.lat)],textLabelPlaneMatrix:Q,labelToScreenMatrix:X,clippingData:ie,scale:M,textPixelRatio:A,holdingForFade:c.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:s.bK(m.textSizeData,this.transform.zoom,xe),partiallyEvaluatedIconSize:s.bK(m.iconSizeData,this.transform.zoom,Ve),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const se of m.sortKeyRanges){const{sortKey:Te,symbolInstanceStart:_e,symbolInstanceEnd:Re}=se;t.push({sortKey:Te,symbolInstanceStart:_e,symbolInstanceEnd:Re,parameters:me})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:me})}attemptAnchorPlacement(t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k,F,U,H,j,te){const{textOffset0:Y,textOffset1:Q,crossTileID:X}=R,$=[Y,Q],ie=nn(t,m,g,$,x),ue=this.collisionIndex.placeCollisionBox(F,x,n,c,d,p,br(ie.x,ie.y,w,S,this.transform.angle),z,M,A,C.predicate);if(H){const le=F.getSymbolInstanceIconSize(te,this.transform.zoom,R.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(F,le,H,c,d,p,br(ie.x,ie.y,w,S,this.transform.angle),z,M,A,C.predicate).box.length===0)return}if(ue.box.length>0){let le;return this.prevPlacement&&this.prevPlacement.variableOffsets[X]&&this.prevPlacement.placements[X]&&this.prevPlacement.placements[X].text&&(le=this.prevPlacement.variableOffsets[X].anchor),this.variableOffsets[X]={textOffset:$,width:m,height:g,anchor:t,textScale:x,prevAnchor:le},this.markUsedJustification(F,t,R,U),F.allowVerticalPlacement&&(this.markUsedOrientation(F,U,R),this.placedOrientations[X]=U),{shift:ie,placedGlyphBoxes:ue}}}placeLayerBucketPart(t,n,c,d,p=1){const{bucket:m,layout:g,paint:x,posMatrix:w,textLabelPlaneMatrix:S,labelToScreenMatrix:M,clippingData:A,textPixelRatio:C,mercatorCenter:z,invMatrix:R,holdingForFade:k,collisionBoxArray:F,partiallyEvaluatedTextSize:U,partiallyEvaluatedIconSize:H,collisionGroup:j,latestFeatureIndex:te}=t.parameters,Y=g.get("text-optional"),Q=g.get("icon-optional"),X=g.get("text-allow-overlap"),$=g.get("icon-allow-overlap"),ie=g.get("text-rotation-alignment")==="map",ue=g.get("icon-rotation-alignment")==="map",le=g.get("text-pitch-alignment")==="map",xe=x.get("symbol-z-offset"),ve=g.get("symbol-elevation-reference")==="sea",Ae=g.get("symbol-placement"),[Ve,me]=g.get("text-size-scale-range"),[se,Te]=g.get("icon-size-scale-range"),_e=s.aA(p,Ve,me),Re=s.aA(p,se,Te),We=g.get("text-variable-anchor"),et=ie&&Ae!=="point",qe=ue&&Ae!=="point",Ue=We&&m.hasTextData(),ct=m.hasIconTextFit()&&Ue&&m.hasIconData();this.transform.setProjection(m.projection);const st=Ue||et,Je=qe||ct;let it=X&&($||!m.hasIconData()||Q),gt=$&&(X||!m.hasTextData()||Y);const Mt=!xe.isConstant();!m.collisionArrays&&F&&m.deserializeCollisionBoxes(F),c&&d&&m.updateCollisionDebugBuffers(this.transform.zoom,F,_e,Re);const $t=(ut,si,At)=>{const{crossTileID:di,numVerticalGlyphVertices:Ti}=ut;let xi=null;if(A&&A.dynamicFilterNeedsFeature||Mt){const ar=this.retainedQueryData[m.bucketInstanceId];xi=te.loadFeature({featureIndex:ut.featureIndex,bucketIndex:ar.bucketIndex,sourceLayerIndex:ar.sourceLayerIndex,layoutVertexArrayOffset:0});const pr=xi.properties?xi.properties.worldview:null;if(m.localizable&&m.worldview&&typeof pr=="string")if(pr==="all")xi.properties.$localized=!0;else{if(!pr.split(",").includes(m.worldview))return;xi.properties.$localized=!0,xi.properties.worldview=m.worldview}}if(A&&!(0,A.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:m.worldview},xi,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new s.P(ut.tileAnchorX,ut.tileAnchorY),this.transform.calculateDistanceTileData(A.unwrappedTileID)))return this.placements[di]=new _i(!1,!1,!1,!0),void n.add(di);const ni=xe.evaluate(xi,{});if(n.has(di))return;if(k)return void(this.placements[di]=new _i(!1,!1,!1));let Ot=!1,hi=!1,tr=!0,Ui=!1,fi=!1,Qt=null,Ft={box:null,offscreen:null,occluded:null},Fi={box:null},ur=null,Xi=null,Ai=null,vn=0,Kr=0,Cr=0;At.textFeatureIndex?vn=At.textFeatureIndex:ut.useRuntimeCollisionCircles&&(vn=ut.featureIndex),At.verticalTextFeatureIndex&&(Kr=At.verticalTextFeatureIndex);const sn=m.elevationFeatures?m.elevationFeatures[ut.elevationFeatureIndex]:void 0,an=ar=>{ar.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const pr=this.transform.elevation;ar.elevation=ve?ni:ni+s.bV.getAtTileOffset(ar.tileID,new s.P(ar.tileAnchorX,ar.tileAnchorY),pr,sn),ar.elevation+=ut.zOffset},Zr=At.textBox;if(Zr){an(Zr);const ar=Mi=>{let yr=s.bL.horizontal;if(m.allowVerticalPlacement&&!Mi&&this.prevPlacement){const ir=this.prevPlacement.placedOrientations[di];ir&&(this.placedOrientations[di]=ir,yr=ir,this.markUsedOrientation(m,yr,ut))}return yr},pr=(Mi,yr)=>{if(m.allowVerticalPlacement&&Ti>0&&At.verticalTextBox){for(const ir of m.writingModes)if(ir===s.bL.vertical?(Ft=yr(),Fi=Ft):Ft=Mi(),Ft&&Ft.box&&Ft.box.length)break}else Ft=Mi()};if(We){let Mi=We;if(this.prevPlacement&&this.prevPlacement.variableOffsets[di]){const Yi=this.prevPlacement.variableOffsets[di];Mi.indexOf(Yi.anchor)>0&&(Mi=Mi.filter((oo=>oo!==Yi.anchor)),Mi.unshift(Yi.anchor))}const yr=(Yi,oo,ic)=>{const bo=m.getSymbolInstanceTextSize(U,ut,this.transform.zoom,si),rc=(Yi.x2-Yi.x1)*bo+2*Yi.padding,nl=(Yi.y2-Yi.y1)*bo+2*Yi.padding,Vo=ut.hasIconTextFit&&!$?oo:null;Vo&&an(Vo);let ls={box:[],offscreen:!1,occluded:!1};const ol=X?2*Mi.length:Mi.length;for(let js=0;js<ol;++js){const cs=this.attemptAnchorPlacement(Mi[js%Mi.length],Yi,z,R,st,rc,nl,bo,ie,le,C,w,j,js>=Mi.length,ut,si,m,ic,Vo,U,H);if(cs&&(ls=cs.placedGlyphBoxes,ls&&ls.box&&ls.box.length)){Ot=!0,Qt=cs.shift;break}}return ls};pr((()=>yr(Zr,At.iconBox,s.bL.horizontal)),(()=>{const Yi=At.verticalTextBox;return Yi&&an(Yi),m.allowVerticalPlacement&&!(Ft&&Ft.box&&Ft.box.length)&&Ti>0&&Yi?yr(Yi,At.verticalIconBox,s.bL.vertical):{box:null,offscreen:null,occluded:null}})),Ft&&(Ot=Ft.box,tr=Ft.offscreen,Ui=Ft.occluded);const ir=ar(!(!Ft||!Ft.box));if(!Ot&&this.prevPlacement){const Yi=this.prevPlacement.variableOffsets[di];Yi&&(this.variableOffsets[di]=Yi,this.markUsedJustification(m,Yi.anchor,ut,ir))}}else{const Mi=(yr,ir)=>{const Yi=m.getSymbolInstanceTextSize(U,ut,this.transform.zoom,si),oo=this.collisionIndex.placeCollisionBox(m,Yi,yr,z,R,st,new s.P(0,0),X,C,w,j.predicate);return oo&&oo.box&&oo.box.length&&(this.markUsedOrientation(m,ir,ut),this.placedOrientations[di]=ir),oo};pr((()=>
8Mi(Zr,s.bL.horizontal)),(()=>{const yr=At.verticalTextBox;return m.allowVerticalPlacement&&Ti>0&&yr?(an(yr),Mi(yr,s.bL.vertical)):{box:null,offscreen:null,occluded:null}})),ar(!!(Ft&&Ft.box&&Ft.box.length))}}if(ur=Ft,Ot=ur&&ur.box&&ur.box.length>0,tr=ur&&ur.offscreen,Ui=ur&&ur.occluded,ut.useRuntimeCollisionCircles){const ar=ut.centerJustifiedTextSymbolIndex>=0?ut.centerJustifiedTextSymbolIndex:ut.verticalPlacedTextSymbolIndex,pr=m.text.placedSymbolArray.get(ar),Mi=s.bM(m.textSizeData,U,pr),yr=g.get("text-padding");Xi=this.collisionIndex.placeCollisionCircles(m,X,pr,ar,m.lineVertexArray,m.glyphOffsetArray,Mi,w,S,M,c,le,j.predicate,ut.collisionCircleDiameter*Mi/s.bY,yr,this.retainedQueryData[m.bucketInstanceId].tileID),Ot=X||Xi.circles.length>0&&!Xi.collisionDetected,tr=tr&&Xi.offscreen,Ui=Xi.occluded}if(At.iconFeatureIndex&&(Cr=At.iconFeatureIndex),At.iconBox){const ar=pr=>{an(pr);const Mi=ut.hasIconTextFit&&Qt?br(Qt.x,Qt.y,ie,le,this.transform.angle):new s.P(0,0),yr=m.getSymbolInstanceIconSize(H,this.transform.zoom,ut.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,yr,pr,z,R,Je,Mi,$,C,w,j.predicate)};Fi&&Fi.box&&Fi.box.length&&At.verticalIconBox?(Ai=ar(At.verticalIconBox),hi=Ai.box.length>0):(Ai=ar(At.iconBox),hi=Ai.box.length>0),tr=tr&&Ai.offscreen,fi=Ai.occluded}const Hn=Y||ut.numHorizontalGlyphVertices===0&&Ti===0,no=Q||ut.numIconVertices===0;if(Hn||no?no?Hn||(hi=hi&&Ot):Ot=hi&&Ot:hi=Ot=hi&&Ot,Ot&&ur&&ur.box&&this.collisionIndex.insertCollisionBox(ur.box,g.get("text-ignore-placement"),m.bucketInstanceId,Fi&&Fi.box&&Kr?Kr:vn,j.ID),hi&&Ai&&this.collisionIndex.insertCollisionBox(Ai.box,g.get("icon-ignore-placement"),m.bucketInstanceId,Cr,j.ID),Xi&&(Ot&&this.collisionIndex.insertCollisionCircles(Xi.circles,g.get("text-ignore-placement"),m.bucketInstanceId,vn,j.ID),c)){const ar=m.bucketInstanceId;let pr=this.collisionCircleArrays[ar];pr===void 0&&(pr=this.collisionCircleArrays[ar]=new Ic);for(let Mi=0;Mi<Xi.circles.length;Mi+=4)pr.circles.push(Xi.circles[Mi+0]),pr.circles.push(Xi.circles[Mi+1]),pr.circles.push(Xi.circles[Mi+2]),pr.circles.push(Xi.collisionDetected?1:0)}const Cn=m.projection.name!=="globe";it=it&&(Cn||!Ui),gt=gt&&(Cn||!fi),this.placements[di]=new _i(Ot||it,hi||gt,tr||m.justReloaded),n.add(di)},ci=this.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(m,ci),m.elevationType==="road"&&m.updateRoadElevation(ci.canonical),m.updateZOffset(),m.sortFeaturesByY){const ut=m.getSortedSymbolIndexes(this.transform.angle);for(let si=ut.length-1;si>=0;--si){const At=ut[si];$t(m.symbolInstances.get(At),At,m.collisionArrays[At])}m.hasAnyZOffset&&s.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const ut=m.getSortedIndexesByZOffset();for(let si=0;si<ut.length;++si){const At=ut[si];$t(m.symbolInstances.get(At),At,m.collisionArrays[At])}}else for(let ut=t.symbolInstanceStart;ut<t.symbolInstanceEnd;ut++)$t(m.symbolInstances.get(ut),ut,m.collisionArrays[ut]);if(c&&m.bucketInstanceId in this.collisionCircleArrays){const ut=this.collisionCircleArrays[m.bucketInstanceId];s.bl(ut.invProjMatrix,w),ut.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(t,n,c,d){const{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:g,verticalPlacedTextSymbolIndex:x,crossTileID:w}=c,S=s.c3(n),M=d===s.bL.vertical?x:S==="left"?p:S==="center"?m:S==="right"?g:-1;p>=0&&(t.text.placedSymbolArray.get(p).crossTileID=M>=0&&p!==M?0:w),m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=M>=0&&m!==M?0:w),g>=0&&(t.text.placedSymbolArray.get(g).crossTileID=M>=0&&g!==M?0:w),x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=M>=0&&x!==M?0:w)}markUsedOrientation(t,n,c){const d=n===s.bL.horizontal||n===s.bL.horizontalOnly?n:0,p=n===s.bL.vertical?n:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:g,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:w}=c,S=t.text.placedSymbolArray;m>=0&&(S.get(m).placedOrientation=d),g>=0&&(S.get(g).placedOrientation=d),x>=0&&(S.get(x).placedOrientation=d),w>=0&&(S.get(w).placedOrientation=p)}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,p=n?n.opacities:{},m=n?n.variableOffsets:{},g=n?n.placedOrientations:{};for(const x in this.placements){const w=this.placements[x],S=p[x];S?(this.opacities[x]=new Ro(S,d,w.text,w.icon,null,w.clipped),c=c||w.text!==S.text.placed||w.icon!==S.icon.placed):(this.opacities[x]=new Ro(null,d,w.text,w.icon,w.skipFade,w.clipped),c=c||w.text||w.icon)}for(const x in p){const w=p[x];if(!this.opacities[x]){const S=new Ro(w,d,!1,!1);S.isHidden()||(this.opacities[x]=S,c=c||w.text.placed||w.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 g)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=g[x]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n,c,d){d&&(this.lastReplacementSourceUpdateTime=d.updateTime);const p=new Set;for(const m of n){const g=m.getBucket(t);g&&m.latestFeatureIndex&&t.fqid===g.layerIds[0]&&(this.updateBucketOpacities(g,p,m,m.collisionBoxArray,c,d,m.tileID,t.scope),g.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(g,m.tileID),g.elevationType==="road"&&g.updateRoadElevation(m.tileID.canonical),g.updateZOffset())}}updateBucketOpacities(t,n,c,d,p,m,g,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 w=t.layers[0].layout,S=t.layers[0].paint,M=!!t.layers[0].dynamicFilter(),A=new Ro(null,0,!1,!1,
8!0),C=w.get("text-allow-overlap"),z=w.get("icon-allow-overlap"),R=w.get("text-variable-anchor"),k=w.get("text-rotation-alignment")==="map",F=w.get("text-pitch-alignment")==="map",U=S.get("symbol-z-offset"),H=w.get("symbol-elevation-reference")==="sea",j=!U.isConstant(),te=new Ro(null,0,C&&(z||!t.hasIconData()||w.get("icon-optional")),z&&(C||!t.hasTextData()||w.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const Y=(X,$,ie)=>{for(let ue=0;ue<$/4;ue++)X.opacityVertexArray.emplaceBack(ie)};let Q=0;m&&t.updateReplacement(g,m);for(let X=0;X<t.symbolInstances.length;X++){const $=t.symbolInstances.get(X),{numHorizontalGlyphVertices:ie,numVerticalGlyphVertices:ue,crossTileID:le,numIconVertices:xe,tileAnchorX:ve,tileAnchorY:Ae}=$;let Ve=null;const me=this.retainedQueryData[t.bucketInstanceId];j&&$&&me&&(Ve=c.latestFeatureIndex.loadFeature({featureIndex:$.featureIndex,bucketIndex:me.bucketIndex,sourceLayerIndex:me.sourceLayerIndex,layoutVertexArrayOffset:0}));const se=U.evaluate(Ve,{}),Te=n.has(le);let _e=this.opacities[le];Te?_e=A:_e||(_e=te,this.opacities[le]=_e),n.add(le);const Re=ie>0||ue>0,We=xe>0,et=this.placedOrientations[le],qe=et===s.bL.vertical,Ue=et===s.bL.horizontal||et===s.bL.horizontalOnly;!Re&&!We||_e.isHidden()||Q++;let ct=!1;if((Re||We)&&m)for(const st of t.activeReplacements){if(s.bZ(st,p,s.b_.Symbol,x)||st.min.x>ve||ve>st.max.x||st.min.y>Ae||Ae>st.max.y)continue;const Je=s.b$(ve,Ae,g.canonical,st.footprintTileId.canonical);if(ct=s.c0(Je,st.footprint),ct)break}if(Re){const st=ct?ca:_n(_e.text);Y(t.text,ie,qe?ca:st),Y(t.text,ue,Ue?ca:st);const Je=_e.text.isHidden(),{leftJustifiedTextSymbolIndex:it,centerJustifiedTextSymbolIndex:gt,rightJustifiedTextSymbolIndex:Mt,verticalPlacedTextSymbolIndex:$t}=$,ci=t.text.placedSymbolArray,ut=Je||qe?1:0;it>=0&&(ci.get(it).hidden=ut),gt>=0&&(ci.get(gt).hidden=ut),Mt>=0&&(ci.get(Mt).hidden=ut),$t>=0&&(ci.get($t).hidden=Je||Ue?1:0);const si=this.variableOffsets[le];si&&this.markUsedJustification(t,si.anchor,$,et);const At=this.placedOrientations[le];At&&(this.markUsedJustification(t,"left",$,At),this.markUsedOrientation(t,At,$))}if(We){const st=ct?ca:_n(_e.icon),{placedIconSymbolIndex:Je,verticalPlacedIconSymbolIndex:it}=$,gt=t.icon.placedSymbolArray,Mt=_e.icon.isHidden()?1:0;Je>=0&&(Y(t.icon,xe,qe?ca:st),gt.get(Je).hidden=Mt),it>=0&&(Y(t.icon,$.numVerticalIconVertices,Ue?ca:st),gt.get(it).hidden=Mt)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const st=t.collisionArrays[X];if(st){let Je=new s.P(0,0),it=!0;if(st.textBox||st.verticalTextBox){if(R){const Mt=this.variableOffsets[le];Mt?(Je=nn(Mt.anchor,Mt.width,Mt.height,Mt.textOffset,Mt.textScale),k&&Je._rotate(F?this.transform.angle:-this.transform.angle)):it=!1}M&&(it=!_e.clipped),st.textBox&&As(t.textCollisionBox.collisionVertexArray,_e.text.placed,!it||qe,se,H,Je.x,Je.y),st.verticalTextBox&&As(t.textCollisionBox.collisionVertexArray,_e.text.placed,!it||Ue,se,H,Je.x,Je.y)}const gt=it&&!!(!Ue&&st.verticalIconBox);st.iconBox&&As(t.iconCollisionBox.collisionVertexArray,_e.icon.placed,gt,se,H,$.hasIconTextFit?Je.x:0,$.hasIconTextFit?Je.y:0),st.verticalIconBox&&As(t.iconCollisionBox.collisionVertexArray,_e.icon.placed,!gt,se,H,$.hasIconTextFit?Je.x:0,$.hasIconTextFit?Je.y:0)}}}if(t.fullyClipped=Q===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 X=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=X.invProjMatrix,t.placementViewportMatrix=X.viewportMatrix,t.collisionCircleArray=X.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}isStale(){return this.stale}setStale(){this.stale=!0}}function As(l,t,n,c,d,p,m){l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0)}const ch=Math.pow(2,25),Cl=Math.pow(2,24),Ac=Math.pow(2,17),uh=Math.pow(2,16),Mc=Math.pow(2,9),mn=Math.pow(2,8),Xo=Math.pow(2,1);function _n(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*ch+t*Cl+n*Ac+t*uh+n*Mc+t*mn+n*Xo+t}const ca=0;class Oa{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,p,m){const g=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(g,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort(((x,w)=>x.sortKey-w.sortKey)));this._currentPartIndex<g.length;){const x=g[this._currentPartIndex];
8if(n.placeLayerBucketPart(x,this._seenCrossTileIDs,c,x.symbolInstanceStart===0,m),this._currentPartIndex++,p())return!0}return!1}}class kr{constructor(t,n,c,d,p,m,g,x,w){this.placement=new nm(t,p,m,g,x,w),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,c,d,p){const m=s.o.now(),g=()=>{const x=s.o.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=n[t[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&x.visibility!=="none"&&(!x.minzoom||x.minzoom<=w)&&(!x.maxzoom||x.maxzoom>w)){const S=x,M=S.layout.get("symbol-z-elevate"),A=S.layout.get("symbol-sort-key").constantOr(1)!==void 0,C=S.layout.get("symbol-z-order"),z=C==="viewport-y"||C==="auto"&&!(C!=="viewport-y"&&A),R=S.layout.get("text-allow-overlap")||S.layout.get("icon-allow-overlap")||S.layout.get("text-ignore-placement")||S.layout.get("icon-ignore-placement"),k=z&&R,F=this._inProgressLayer=this._inProgressLayer||new Oa(S),U=s.B(x.source,x.scope);if(F.continuePlacement(M||k?d[U]:c[U],this.placement,this._showCollisionBoxes,x,g,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Jn=512/s.al/2;class Yo{constructor(t,n,c){this.tileID=t,this.bucketInstanceId=c,this.index=new s.c4(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*s.al,p=t.canonical.y*s.al;for(let m=0;m<n.length;m++){const{key:g,crossTileID:x,tileAnchorX:w,tileAnchorY:S}=n.get(m),M=Math.floor((d+w)*Jn),A=Math.floor((p+S)*Jn);this.index.add(M,A),this.keys.push(g),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),p=Jn/Math.pow(2,n.canonical.z-this.tileID.canonical.z),m=n.canonical.x*s.al,g=n.canonical.y*s.al;for(let x=0;x<t.length;x++){const w=t.get(x);if(w.crossTileID)continue;const{key:S,tileAnchorX:M,tileAnchorY:A}=w,C=Math.floor((m+M)*p),z=Math.floor((g+A)*p),R=this.index.range(C-d,z-d,C+d,z+d).sort(((k,F)=>k-F));for(const k of R){const F=this.crossTileIDs[k];if(this.keys[k]===S&&!c.has(F)){c.add(F),w.crossTileID=F;break}}}}}class zr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class hh{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],p={};for(const m in d){const g=d[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+n),p[g.tileID.key]=g}this.indexes[c]=p}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 p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const g in m){const x=m[g];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,d)}else{const g=m[t.scaledTo(Number(p)).key];g&&g.findMatches(n.symbolInstances,t,d)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=c.generate(),d.add(m.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Yo(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 p in d)t[d[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[p]),delete d[p],n=!0)}return n}}class _o{constructor(){this.layerIndexes={},this.crossTileIDs=new zr,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,c,d){let p=this.layerIndexes[t.fqid];p===void 0&&(p=this.layerIndexes[t.fqid]=new hh);let m=!1;const g={};d.name!=="globe"&&p.handleWrapJump(c);for(const x of n){const w=x.getBucket(t);w&&t.fqid===w.layerIds[0]&&(w.bucketInstanceId||(w.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(x.tileID,w,this.crossTileIDs)&&(m=!0),g[w.bucketInstanceId]=!0)}return p.removeStaleBuckets(g)&&(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 zo=771;class Dt{constructor(t,n,c,d){this.blendFunction=t,this.blendColor=n.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}Dt.Replace=[1,0,1,0],Dt.disabled=new Dt(Dt.Replace,s.ao.transparent,[!1,!1,!1,!1]),Dt.unblended=new Dt(Dt.Replace,s.ao.transparent,[!0,!0,!0,!0]),Dt.alphaBlended=new Dt([1,zo,1,zo],s.ao.transparent,[!0,!0,!0,!0]),Dt.alphaBlendedNonPremultiplied=new Dt([770,zo,770,zo],s.ao.transparent,[!0,!0,!0,!0]),Dt.multiply=new Dt([774,0,774,0],s.ao.transparent,[!0,!0,!0,!0]),Dt.additive=new Dt([1,1,1,1],s.ao.transparent,[!0,!0,!0,!0]);class ht{constructor(t,n,c){this.func=t,this.mask=n,this.range=c}}ht.ReadOnly=!1,ht.ReadWrite=!0,ht.disabled=new ht(519,ht.ReadOnly,[0,1]);const Cc=7680;class St{constructor(t,n,c,d,p,m){this.test=t,this.ref=n,this.mask=c,this.fail=d,this.depthFail=p,this.pass=m}}St.disabled=new St({func:519,mask:0},0,0,Cc,Cc,Cc);const Fa=1029,Pc=2305;class Tt{constructor(t,n,c){this.enable=t,this.mode=n,this.frontFace=c}}function Do(l,t){const n=s.ca(l,3);s.cc(l,t),s.cg(l,3,n)}function dh(l,t){const n=s.c7([]);return s.c8(n,n,-t),s.c9(n,n,-l),n}function Rc(l,t){const n=[l[0],l[1],0],c=[t[0],t[1],0];if(s.ag(n)>=1e-15){const m=s.aw([],n);s.c5(c,m,s.bJ(c,m)),t[0]=c[0],t[1]=c[1]}const d=s.bI([],t,l);if(s.c6(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return dh(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),p)}Tt.disabled=new Tt(!1,Fa,Pc),Tt.backCCW=new Tt(!0,Fa,Pc),Tt.backCW=new Tt(!0,Fa,2304),Tt.frontCW=new Tt(!0,1028,2304),Tt.frontCCW=new Tt(!0,1028,Pc);class gn{constructor(t,n){this.position=t,this.orientation=n}get position(){return this._position}set position(t){if(t){const n=t instanceof s.ae?t:new s.ae(t[0],t[1],t[2]);
8this._renderWorldCopies&&(n.x=s.bT(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n,c){if(this.orientation=null,!this.position)return;const d=this.position,p=c||(this._elevation?this._elevation.getAtPointOrZero(s.ae.fromLngLat(t)):0),m=s.ae.fromLngLat(t,p),g=[m.x-d.x,m.y-d.y,m.z-d.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=Rc(g,n)}setPitchBearing(t,n){this.orientation=dh(s.an(t),s.an(-n))}}class zc{constructor(t,n){this._transform=s.bA([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new s.ae(t[0],t[1],t[2])}get position(){const t=s.ca(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&s.cg(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||s.c7([]),t&&Do(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=dh(t,n),Do(this._transform,this._orientation)}forward(){const t=s.ca(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=s.ca(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=s.ca(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const c=new Float64Array(16);return s.bl(c,this.getWorldToCamera(t,n)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,n,c){const d=this.position;s.c5(d,d,-t);const p=new Float64Array(16);return s.bq(p,[c,c,c]),s.br(p,p,d),p[10]*=n,p}getWorldToCamera(t,n){const c=new Float64Array(16),d=new Float64Array(4),p=this.position;return s.cb(d,this._orientation),s.c5(p,p,-t),s.cc(c,d),s.br(c,c,p),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=n,c[9]*=n,c[10]*=n,c[11]*=n,c}getCameraToClipPerspective(t,n,c,d){const p=new Float64Array(16);return s.cd(p,t,n,c,d),p}getCameraToClipOrthographic(t,n,c,d,p,m){const g=new Float64Array(16);return s.ce(g,t,n,c,d,p,m),g}getDistanceToElevation(t,n=!1){const c=t===0?0:s.cf(t,n?s.a$(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new zc([...this.position],[...this.orientation])}}const jr={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Dc{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=s.ak(t.top,n.top,c)),n.bottom!=null&&t.bottom!=null&&(this.bottom=s.ak(t.bottom,n.bottom,c)),n.left!=null&&t.left!=null&&(this.left=s.ak(t.left,n.left,c)),n.right!=null&&t.right!=null&&(this.right=s.ak(t.right,n.right,c)),this}getCenter(t,n){const c=s.aA((this.left+t-this.right)/2,0,t),d=s.aA((this.top+n-this.bottom)/2,0,n);return new s.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Dc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const go=15;class fh{constructor(t,n,c,d,p,m,g){this.tileSize=512,this._renderWorldCopies=p===void 0||p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(m),this.setMaxBounds(g),this.width=0,this.height=0,this._center=new s.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Dc,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new zc,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 fh(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
8xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<go}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._centerAltitudeValidForE
8xaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(n),this._calcMatrices()}getProjection(){return s.aH(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=s.cm(this.projectionOptions);const c=this.getProjection(),d=!s.by(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=s.cm({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 s.cf(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.bT(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=s.cn(),s.co(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=s.aA(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=s.an(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const 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()>
80&&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,p=0;for(let m=0;m<n.length;m++){const g=new s.P(n[m][0]*this.width,c+n[m][1]*(this.height-c)),x=t.pointCoordinate(g);if(!x)continue;const w=1/Math.hypot(x[0]-this._camera.position[0],x[1]-this._camera.position[1]);d+=x[3]*w,p+=w}return p===0?NaN:d/p}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,n=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*n,d=this._mercatorZfromZoom(t),p=this._mercatorZfromZoom(this._maxZoom),m=Math.max(d-c,p);this._setZoom(this._zoomFromMercatorZ(m))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}equals(t){const n=this.elevation,c=t.elevation,d=n!=null!=(c!=null)||n&&c&&n.exaggeration()!==c.exaggeration();return this.width===t.width&&this.height===t.height&&this.center.lng===t.center.lng&&this.center.lat===t.center.lat&&this.zoom===t.zoom&&this.bearing===t.bearing&&this.pitch===t.pitch&&this.fov===t.fov&&this.projection.name===t.projection.name&&this._edgeInsets.equals(t.padding)&&!d}computeZoomRelativeTo(t){const 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=s.ag(s.av([],this._camera.position,c));return s.aA(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let n=!1;if(t.orientation&&!s.cp(t.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];s.cq(c,this._camera.position)||(this._setCameraPosition(c),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,n=new gn;return n.position=new s.ae(t[0],t[1],t[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(t){if(!s.cr(t))return!1;s.cs(t,t);const n=s.ct([],[0,0,-1],t),c=s.ct([],[0,-1,0],t);if(c[2]<0)return!1;const d=Rc(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]=s.aA(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 s.cu(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new s.P(0,0)),d=this.pointCoordinate(new s.P(this.width,0)),p=this.pointCoordinate(new s.P(this.width,this.height)),m=this.pointCoordinate(new s.P(0,this.height)),g=Math.floor(Math.min(c.x,d.x,p.x,m.x)),x=Math.floor(Math.max(c.x,d.x,p.x,m.x)),w=1;for(let S=g-w;S<=x+w;S++)S!==0&&n.push(new s.cu(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,d){let p=[];const m=c!=null,g=!m;if(g&&this.zoom<n||m&&c[0]===0&&c[1]===0)return p;const x=new Set,w=(M,A,C,z,R)=>
8{const k=s.cY(A,M,C,z,R);x.has(k)||(p.push(new s.aQ(M,A,C,z,R)),x.add(k))};for(let M=0;M<t.length;M++){const A=t[M];if(g&&A.canonical.z!==n||m&&d!==void 0&&d>A.canonical.z)continue;const C=A.canonical,z=A.overscaledZ,R=A.wrap,k=1<<C.z,F=C.x+1<k,U=C.x>0,H=C.y+1<k,j=C.y>0,te=A.wrap-(U?0:1),Y=A.wrap+(F?0:1),Q=U?C.x-1:k-1,X=F?C.x+1:0;if(m)c[0]<0?(w(z,Y,C.z,X,C.y),c[1]<0&&H&&(w(z,R,C.z,C.x,C.y+1),w(z,Y,C.z,X,C.y+1)),c[1]>0&&j&&(w(z,R,C.z,C.x,C.y-1),w(z,Y,C.z,X,C.y-1))):c[0]>0?(w(z,te,C.z,Q,C.y),c[1]<0&&H&&(w(z,R,C.z,C.x,C.y+1),w(z,te,C.z,Q,C.y+1)),c[1]>0&&j&&(w(z,R,C.z,C.x,C.y-1),w(z,te,C.z,Q,C.y-1))):c[1]<0&&H?w(z,R,C.z,C.x,C.y+1):j&&w(z,R,C.z,C.x,C.y-1);else{const $=A.visibleQuadrants;1&$&&(w(z,te,C.z,Q,C.y),j&&(w(z,R,C.z,C.x,C.y-1),w(z,te,C.z,Q,C.y-1))),2&$&&(w(z,Y,C.z,X,C.y),j&&(w(z,R,C.z,C.x,C.y-1),w(z,Y,C.z,X,C.y-1))),4&$&&(w(z,te,C.z,Q,C.y),H&&(w(z,R,C.z,C.x,C.y+1),w(z,te,C.z,Q,C.y+1))),8&$&&(w(z,Y,C.z,X,C.y),H&&(w(z,R,C.z,C.x,C.y+1),w(z,Y,C.z,X,C.y+1)))}}const S=[];for(const M of p)p.some((A=>M.isChildOf(A)))||S.push(M);if(p=S.filter((M=>!t.some((A=>!!(M.overscaledZ<n&&A.isChildOf(M))||M.equals(A)||M.isChildOf(A))))),g){const M=1<<n,A=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),C=[M*A.x,M*A.y],z=4,R=z*z;p=p.filter((k=>{const F=k.canonical.x+.5-C[0],U=k.canonical.y+.5-C[1];return F*F+U*U<R}))}return p}extendTileCoverToNearPlane(t,n,c){const d=[],p=new Set;for(const U of t)p.add(U.key);const m=(U,H,j,te,Y)=>{const Q=s.cY(H,U,j,te,Y);p.has(Q)||(d.push(new s.aQ(U,H,j,te,Y)),p.add(Q))},g=t.reduce(((U,H)=>Math.max(U,H.overscaledZ)),c),x=1<<c,w=[new s.P(0,0),new s.P(s.al,0),new s.P(s.al,s.al),new s.P(0,s.al)],S=new s.P(0,0),M=new s.P(0,0),A=(U,H)=>{const j=Math.floor(U[0]),te=Math.floor(U[1]),Y=(U[0]-j)*s.al,Q=(U[1]-te)*s.al,X=Math.floor(H[0]),$=Math.floor(H[1]),ie=(H[0]-X)*s.al,ue=(H[1]-$)*s.al;for(let le=-1;le<=1;le++){const xe=j+le;if(!(xe<0||xe>=x)){S.x=Y-le*s.al,M.x=ie-(xe-X)*s.al;for(let ve=-1;ve<=1;ve++){const Ae=te+ve;S.y=Q-ve*s.al,M.y=ue-(Ae-$)*s.al,s.cZ(S,M,w)&&m(g,0,c,xe,Ae)}}}},C=n.points,z=C[s.cv],R=C[s.cw],k=this._projectToGround(z,C[s.cx]),F=this._projectToGround(R,C[s.cy]);return A(z,k),A(R,F),d}_projectToGround(t,n){return s.cz(s.cA(),t,n,t[2]/(t[2]-n[2]))}coveringTiles(t){let n=this.coveringZoomLevel(t);const c=n,d=this.elevation&&this.elevation.exaggeration(),p=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 g=this.locationCoordinate(this.center),x=this.center.lat,w=1<<n,S=[w*g.x,w*g.y,0],M=this.projection.name==="globe",A=!M,C=s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,A),z=M?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),R=w*s.cf(1,this.center.lat),k=this._camera.position[2]/s.cf(1,this.center.lat),F=[w*z.x,w*z.y,k*(A?1:R)],U=M||d,H=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),j=this.isLODDisabled(!0)?n:0;let te;if(this._elevation&&t.isTerrainDEM)te=1e4*this._elevation.exaggeration();else if(this._elevation){const se=this._elevation.getMinMaxForVisibleTiles();te=se?se.max:this._centerAltitude}else te=this._centerAltitude;const Y=t.isTerrainDEM?-te:this._elevation?this._elevation.getMinElevationBelowMSL():0,Q=this.projection.isReprojectedInTileSpace?s.cC(this):1,X=se=>{const _e=new s.ae(se.x+25e-6,se.y,se.z),Re=new s.ae(se.x,se.y+25e-6,se.z),We=se.toLngLat(),et=_e.toLngLat(),qe=Re.toLngLat(),Ue=this.locationCoordinate(We),ct=this.locationCoordinate(et),st=this.locationCoordinate(qe),Je=Math.hypot(ct.x-Ue.x,ct.y-Ue.y),it=Math.hypot(st.x-Ue.x,st.y-Ue.y);return Math.sqrt(Je*it)*Q/25e-6},$=se=>{const Te=te,_e=Y;return{aabb:s.cF(this,w,0,0,0,se,_e,Te,this.projection),zoom:0,x:0,y:0,minZ:_e,maxZ:Te,wrap:se,fullyVisible:!1}},ie=[];let ue=[];const le=n,xe=t.reparseOverscaled?c:n,ve=(k-this._centerAltitude)*R,Ae=se=>{if(!this._elevation||!se.tileID||!m)return;const Te=this._elevation.getMinMaxForTile(se.tileID),_e=se.aabb;Te?(_e.min[2]=Te.min,_e.max[2]=Te.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))},Ve=(se,Te)=>{if(.707*Te<se)return 1;const _e=Te/se;return _e/(1.4144271570014144+(Math.pow(1.1,_e-1.4144271570014144+1)-1)/(1.1-1)-1)},me=se=>{if(se.zoom<j)return!0;
8if(se.zoom===le)return!1;if(se.shouldSplit!=null)return se.shouldSplit;const Te=se.aabb.distanceX(F),_e=se.aabb.distanceY(F);let Re=ve,We=1;if(M){Re=se.aabb.distanceZ(F);const it=Math.pow(2,se.zoom),gt=s.a$((se.y+1)/it),Mt=s.a$(se.y/it),$t=Math.min(Math.max(x,gt),Mt),ci=s.d1($t)/s.d1(x);if(We=$t===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,ci/this._mercatorScaleRatio),this.zoom<=s.c_&&se.zoom===le-1&&ci>=.9)return!0}else if(p&&(Re=se.aabb.distanceZ(F)*R),this.projection.isReprojectedInTileSpace&&c<=5){const it=Math.pow(2,se.zoom),gt=X(new s.ae((se.x+.5)/it,(se.y+.5)/it));We=gt>.85?1:gt}if(!m&&!M){const it=Math.sqrt(Te*Te+_e*_e+Re*Re);let gt=(1<<le-se.zoom)*H*We;return gt*=Ve(Math.max(Re,ve),it),it<gt}let et=Number.MAX_VALUE,qe=0;const Ue=se.aabb.getCorners(),ct=[];for(const it of Ue){s.av(ct,it,F),M||(p?ct[2]*=R:ct[2]=ve);const gt=s.bJ(ct,this._camera.forward());gt<et&&(et=gt,qe=Math.abs(ct[2]))}let st=(1<<le-se.zoom)*H*We;if(st*=Ve(Math.max(qe,ve),et),et<st)return!0;const Je=se.aabb.closestPoint(S);return Je[0]===S[0]&&Je[1]===S[1]};if(this.renderWorldCopies)for(let se=1;se<=3;se++)ie.push($(-se)),ie.push($(se));for(ie.push($(0));ie.length>0;){const se=ie.pop(),Te=se.x,_e=se.y;let Re=se.fullyVisible;const We=()=>this.projection.name==="globe"&&(se.y===0||se.y===(1<<se.zoom)-1);if(!Re){let et=U?se.aabb.intersects(C):se.aabb.intersectsFlat(C);if(et===0&&We()){const qe=new s.cD(se.zoom,Te,_e);et=s.cE(this,w,qe,!0).intersects(C)}if(et===0)continue;Re=et===2}if(se.zoom!==le&&me(se))for(let et=0;et<4;et++){const qe=(Te<<1)+et%2,Ue=(_e<<1)+(et>>1),ct={aabb:m?se.aabb.quadrant(et):s.cF(this,w,se.zoom+1,qe,Ue,se.wrap,se.minZ,se.maxZ,this.projection),zoom:se.zoom+1,x:qe,y:Ue,wrap:se.wrap,fullyVisible:Re,tileID:void 0,shouldSplit:void 0,minZ:se.minZ,maxZ:se.maxZ};p&&!M&&(ct.tileID=new s.aQ(se.zoom+1===le?xe:se.zoom+1,se.wrap,se.zoom+1,qe,Ue),Ae(ct)),ie.push(ct)}else{const et=se.zoom===le?xe:se.zoom;if(t.minzoom&&t.minzoom>et)continue;let qe=0;if(!Re){let Je=U?se.aabb.intersectsPrecise(C):se.aabb.intersectsPreciseFlat(C);if(Je===0&&We()){const it=new s.cD(se.zoom,Te,_e);Je=s.cE(this,w,it,!0).intersectsPrecise(C)}if(Je===0)continue;if(t.calculateQuadrantVisibility)if(C.containsPoint(se.aabb.center))qe=15;else for(let it=0;it<4;it++)se.aabb.quadrant(it).intersects(C)!==0&&(qe|=1<<it)}const Ue=S[0]-(.5+Te+(se.wrap<<se.zoom))*(1<<n-se.zoom),ct=S[1]-.5-_e,st=se.tileID?se.tileID:new s.aQ(et,se.wrap,se.zoom,Te,_e);t.calculateQuadrantVisibility&&(st.visibleQuadrants=qe),ue.push({tileID:st,distanceSq:Ue*Ue+ct*ct})}}if(this.fogCullDistSq){const se=this.fogCullDistSq,Te=this.horizonLineFromTop();ue=ue.filter((_e=>{const Re=[0,0,0,1],We=[s.al,s.al,0,1],et=this.calculateFogTileMatrix(_e.tileID.toUnwrapped());s.aC(Re,Re,et),s.aC(We,We,et);const qe=s.cG([],Re,We),Ue=s.cH([],Re,We),ct=s.c$(qe,Ue);if(ct===0)return!0;let st=!1;const Je=this._elevation;if(Je&&ct>se&&Te!==0){const it=this.calculateProjMatrix(_e.tileID.toUnwrapped());let gt;t.isTerrainDEM||(gt=Je.getMinMaxForTile(_e.tileID)),gt||(gt={min:Y,max:te});const Mt=s.cI(this.rotation),$t=[Mt[0]*s.al,Mt[1]*s.al,gt.max];s.af($t,$t,it),st=(1-$t[1])*this.height*.5<Te}return ct<se||st}))}return ue.sort(((se,Te)=>se.distanceSq-Te.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.log2(t)}project(t){const n=s.aA(t.lat,-s.cJ,s.cJ),c=this.projection.project(t.lng,n);return new s.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let c,d;const p=this.centerPoint;if(this.projection.name==="globe"){const g=this.worldSize;c=(n.x-p.x)/g,d=(n.y-p.y)/g}else{const g=this.pointCoordinate(n),x=this.pointCoordinate(p);c=g.x-x.x,d=g.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new s.ae(m.x-c,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,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?s.cf(n,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new s.ae(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,n){const c=n??this._centerAltitude,d=[t.x,t.y,0,1],p=[t.x,t.y,1,1];s.aC(d,d,this.pixelMatrixInverse),s.aC(p,p,this.pixelMatrixInverse);const m=p[3];s.cK(d,d,1/d[3]),s.cK(p,p,1/m);const g=d[2],x=p[2];return{p0:d,p1:p,t:g===x?0:(c-g)/(x-g)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return s.aC(n,n,this.pixelMatrixInverse),s.aC(c,c,this.pixelMatrixInverse),s.cK(n,n,1/n[3]),s.cK(c,c,1/c[3]),n[2]=s.cf(n[2],this._center.lat)*this.worldSize,c[2]=s.cf(c[2],this._center.lat)*this.worldSize,s.cK(n,n,1/this.worldSize),s.cK(c,c,1/this.worldSize),new s.ax([n[0],n[1],n[2]],s.aw([],s.av([],c,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:c,t:d}=t,p=s.cf(n[2],this._center.lat),m=s.cf(c[2],this._center.lat);return new s.ae(s.ak(n[0],c[0],d)/this.worldSize,s.ak(n[1],c[1],d)/this.worldSize,s.ak(p,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 s.ae(c[0],c[1],c[2]);let d=0,p=this.horizonLineFromTop();if(t.y>p)return this.pointCoordinate(t,n);const m=.02*p,g=t.clone();for(let x=0;x<10&&p-d>m;x++){g.y=s.ak(d,p,.66);const w=this.projection.pointCoordinate3D(this,g.x,g.y);w?(p=g.y,c=w):d=g.y}return c?new s.ae(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=s.cL)return!this.isPointAboveHorizon(t);const 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 s.aC(d,d,this.pixelMatrix),d[3]>0?new s.P(d[0]/d[3],d[1]/d[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new s.P(n,t)),m=this.pointLocation3D(new s.P(d,t)),g=this.pointLocation3D(new s.P(d,c)),x=this.pointLocation3D(new s.P(n,c));let w=Math.min(p.lng,m.lng,g.lng,x.lng),S=Math.max(p.lng,m.lng,g.lng,x.lng),M=Math.min(p.lat,m.lat,g.lat,x.lat),A=Math.max(p.lat,m.lat,g.lat,x.lat);const C=Math.pow(2,-this.zoom)/16*270,z=this.projection.name==="globe"?1:4,R=(k,F,U,H,j)=>{const te=(k+U)/2,Y=(F+H)/2,Q=new s.P(te,Y),{lng:X,lat:$}=this.pointLocation3D(Q),ie=Math.max(0,w-X,M-$,X-S,$-A);w=Math.min(w,X),S=Math.max(S,X),M=Math.min(M,$),A=Math.max(A,$),(j<z||ie>C)&&(R(k,F,te,Y,j+1),R(te,Y,U,H,j+1))};if(R(n,t,d,t,1),R(d,t,d,c,1),R(d,c,n,c,1),R(n,c,n,t,1),this.projection.name==="globe"){const[k,F]=s.
8cM(this);k?(A=90,S=180,w=-180):F&&(M=-90,S=180,w=-180)}return new s.aI(new s.aT(w,M),new s.aT(S,A))}_getBoundsRectangular(t,n){const{top:c,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,g=new s.P(d,c),x=new s.P(m,c),w=new s.P(m,p),S=new s.P(d,p);let M=this.pointCoordinate(g,t),A=this.pointCoordinate(x,t);const C=this.pointCoordinate(w,n),z=this.pointCoordinate(S,n),R=(k,F)=>(F.y-k.y)/(F.x-k.x);return M.y>1&&A.y>=0?M=new s.ae((1-z.y)/R(z,M)+z.x,1):M.y<0&&A.y<=1&&(M=new s.ae(-z.y/R(z,M)+z.x,0)),A.y>1&&M.y>=0?A=new s.ae((1-C.y)/R(C,A)+C.x,1):A.y<0&&M.y<=1&&(A=new s.ae(-C.y/R(C,A)+C.x,0)),new s.aI().extend(this.coordinateLocation(M)).extend(this.coordinateLocation(A)).extend(this.coordinateLocation(z)).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)=>{if(d.dem){const p=d.dem.tree;c.min=Math.min(c.min,p.minimums[0]),c.max=Math.max(c.max,p.maximums[0])}return c}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(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=-s.cJ,this.maxLat=s.cJ,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=s.aF(this.minLng)*this.tileSize,this.worldMaxX=s.aF(this.maxLng)*this.tileSize,this.worldMinY=s.aJ(this.maxLat)*this.tileSize,this.worldMaxY=s.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,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,p=1/this.height,m=this.cameraWorldSize,g=m/this.zoomScale(d.z),x=(d.x+Math.pow(2,d.z)*t.wrap)*g,w=d.y*g,S=this.point;S.x*=m/this.worldSize,S.y*=m/this.worldSize;const M=this.angle,A=Math.sin(-M),C=-Math.cos(-M);return c[n]={bearing:[A,C],center:[(S.x-x)*p,(S.y-w)*p],scale:g/s.al*p},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 s.aB(d,this.worldToFogMatrix,d),c[n]=new Float32Array(d),c[n]}calculateProjMatrix(t,n=!1,c=!1){const d=t.key;let p;if(p=c?this._expandedProjMatrixCache:n?this._alignedProjMatrixCache:this._projMatrixCache,p[d])return p[d];const m=this.calculatePosMatrix(t,this.worldSize);let g;return g=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:n?this.alignedProjMatrix:this.projMatrix,s.aB(m,g,m),p[d]=new Float32Array(m),p[d]}calculatePixelsToTileUnitsMatrix(t){const n=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[n])return c[n];const d=s.cN(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=s.bq([],[t,t,t]);return s.aB(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const n=s.cf(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(n),d=this._camera.forward(),p=s.cf(1,this._center.lat);c[2]/=p,d[2]/=p,s.aw(d,d);const m=t.raycast(c,d,t.exaggeration());if(m){const g=s.bH([],c,d,m),x=new s.ae(g[0],g[1],s.cf(g[2],s.a$(g[1])
8)),w=(x.z+s.ag([x.x-c[0],x.y-c[1],x.z-c[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(w),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=s.cf(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),p=n.getAtPointOrZero(new s.ae(...d)),m=this.pixelsPerMeter/this.worldSize*p,g=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=g)if(x<0||t){const w=this.locationCoordinate(this._center,this._centerAltitude),S=[d[0],d[1],w.z-d[2]],M=s.ag(S);S[2]-=(g-x)/this._pixelsPerMercatorPixel;const A=s.ag(S);if(A===0)return;s.c5(S,S,M/A*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],w.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 A=this.center;return A.lat=s.aA(A.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(A.lng=s.aA(A.lng,this.minLng,this.maxLng)),this.center=A,void(this._constraining=!1)}const n=this._unmodified,{x:c,y:d}=this.point;let p=0,m=c,g=d;const x=this.width/2,w=this.height/2,S=this.worldMinY*this.scale,M=this.worldMaxY*this.scale;if(d-w<S&&(g=S+w),d+w>M&&(g=M-w),M-S<this.height&&(p=Math.max(p,this.height/(M-S)),g=(M+S)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const A=this.worldMinX*this.scale,C=this.worldMaxX*this.scale,z=this.worldSize/2-(A+C)/2;m=(c+z+this.worldSize)%this.worldSize-z,m-x<A&&(m=A+x),m+x>C&&(m=C-x),C-A<this.width&&(p=Math.max(p,this.width/(C-A)),m=(C+A)/2)}m===c&&g===d||this._allowWorldUnderZoom||(this.center=this.unproject(new s.P(m,g))),p&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(p)),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=s.cf(1,this.center.lat)/s.cf(1,s.d2));const d=s.cO(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const p=this.projection.zAxisUnit==="meters"?c:1,m=this._camera.getWorldToCamera(this.worldSize,p);let g;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 $=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ie=$*this.aspect,ue=-ie,le=-$;ie-=t.x,ue-=t.x,$+=t.y,le+=t.y,g=this._camera.getCameraToClipOrthographic(ue,ie,le,$,this._nearZ,this._farZ),((xe,ve,Ae,Ve)=>{for(let me=0;me<16;me++)xe[me]=s.ak(ve[me],Ae[me],Ve)})(g,g,x,s.d0(this.pitch>=go?1:this.pitch/go))}else g=x;const w=s.cP([],x,m);let S=s.cP([],g,m);if(this.projection.isReprojectedInTileSpace){const $=this.locationCoordinate(this.center),ie=s.bA([]);s.br(ie,ie,[$.x*this.worldSize,$.y*this.worldSize,0]),s.aB(ie,ie,s.cQ(this)),s.br(ie,ie,[-$.x*this.worldSize,-$.y*this.worldSize,0]),s.aB(S,S,ie),s.aB(w,w,ie),this.inverseAdjustmentMatrix=s.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.cS([],S,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=S,this.invProjMatrix=s.bl(new Float64Array(16),this.projMatrix),n){const $=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);$[8]=2*-t.x/this.width,$[9]=2*t.y/this.height,this.expandedFarZProjMatrix=s.cP([],$,m)}else this.expandedFarZProjMatrix=this.projMatrix;const M=s.bl([],g);this.frustumCorners=s.cT.fromInvProjectionMatrix(M,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n);const A=new Float32Array(16);s.bA(A),s.cS(A,A,[1,-1,1]),s.cU(A,A,this._pitch),s.bB(A,A,this.angle);const C=s.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.bz(C);const z=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;C[8]=2*-t.x/this.width,C[9]=2*(t.y+z)/this.height,this.skyboxMatrix=s.aB(A,C,A);const R=this.point,k=R.x,F=R.y,U=this.width%2/2,H=this.height%2/2,j=Math.cos(this.angle),te=Math.sin(this.angle),Y=k-Math.round(k)+j*U+te*H,Q=F-Math.round(F)+j*H+te*U,X=new Float64Array(S);if(s.br(X,X,[Y>.5?Y-1:Y,Q>.5?Q-1:Q,0]),this.alignedProjMatrix=X,S=s.bC(),s.cS(S,S,[this.width/2,-this.height/2,1]),s.br(S,S,[1,-1,0]),this.labelPlaneMatr
8ix=S,S=s.bC(),s.cS(S,S,[1,-1,1]),s.br(S,S,[-1,-1,0]),s.cS(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=s.aB(new Float64Array(16),this.labelPlaneMatrix,w),this._calcFogMatrices(),this._distanceTileDataCache={},S=s.bl(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=s.cV(this);const $=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.af($,$,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,p=[t,t,n];s.c5(p,p,d),s.c5(c,c,-1),s.cW(c,c,p);const m=s.bC();s.br(m,m,c),s.cS(m,m,p),this.mercatorFogMatrix=m,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,n,d)}_computeCameraPosition(t){const n=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,p=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*n-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*p,d.y/this.worldSize-c[1]*p,t/this.worldSize*this._centerAltitude-c[2]*p]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let p=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(p=Math.min((n-c)/d,1)),this._camera.position=s.bH([],this._camera.position,t,p),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,n=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),p=s.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.an(this._maxPitch)),g=Math.max((t[2]-p)/Math.cos(c),m),x=this._zoomFromMercatorZ(g);s.bH(t,t,n,g),this._pitch=s.aA(c,s.an(this.minPitch),s.an(this.maxPitch)),this.angle=s.bT(d,-Math.PI,Math.PI),this._setZoom(s.aA(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s.ae(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}zoomFromMercatorZAdjusted(t){let n=0,c=s.cL,d=0,p=1/0;for(;c-n>1e-6&&c>n;){const m=n+.5*(c-n),g=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,g),w=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),S=Math.abs(m-w);S<p&&(p=S,d=m),m<w?n=m:c=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(s.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,n){const c=Math.min(t.x,n.x),d=Math.max(t.x,n.x),p=Math.min(t.y,n.y),m=Math.max(t.y,n.y);if(p<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const g=[new s.P(c,p),new s.P(d,m),new s.P(c,m),new s.P(d,p)],x=this.renderWorldCopies?-3:0,w=this.renderWorldCopies?4:1;for(const S of g){const M=this.pointRayIntersection(S);if(M.t<0)return!0;const A=this.rayIntersectionCoordinate(M);if(A.x<x||A.y<0||A.x>w||A.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(t,n){const c=s.ag(s.av([],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],p){const m=[n,c,d,1];s.aC(m,m,p);const g=m[3]=Math.max(m[3],1e-6);return m[0]/=g,m[1]/=g,m[2]/=g,m})([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,t))}}getCameraToCenterDistance(t,n=this.zoom,c=this.worldSize){const d=s.cO(t,n,this.width,this.height,1024),p=t.pixelSpaceConversion(this.center.lat,c,d);let m=.5/Math.tan(.5*this._fov)*this.height*p;return this.isOrthographic&&(m=s.ak(1,m,s.d0(this.pitch>=go?1:this.pitch/go))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.aB(t,t,this.globeMatrix),t}getFrustum(t){return s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const Ms=(l,t)=>{if(t>0&&l.terrain&&s.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=l.transform,c=Math.max(Math.abs(n._zoom-(l.minCutoffZoom-1)),1),d=n.isLODDisabled(!1)?s.ah(60,45,n.pitch):s.ah(30,15,n.pitch),p=n._farZ-n._nearZ,m=t*n.height,g=((1-(x=d))*n.cameraToCenterDistance+x*(n._farZ+m))*c;var x;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(g-n._nearZ)/p,(g-m-n._nearZ)/p]}}},Qn=2048;class Pl{constructor(t,n){this.aabb=t,this.lastCascade=n}}class om{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 Pl(n,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,n,c){const d=s.d9.fromPoints(t.points);let p=0;for(const m in this.receivers){const g=this.receivers[m];if(!g||!d.intersectsAabb(g.aabb))continue;g.aabb.min=d.closestPoint(g.aabb.min),g.aabb.max=d.closestPoint(g.aabb.max);const x=g.aabb.getCorners();for(let w=0;w<c.length;w++){let S=!0;for(const M of x){const A=[M[0]*n,M[1]*n,M[2]];if(s.af(A,A,c[w].matrix),A[0]<-1||A[0]>1||A[1]<-1||A[1]>1){S=!1;break}}if(g.lastCascade=w,p=Math.max(p,w),S)break}}return p+1}}class ka{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new om,this._depthMode=new ht(t.context.gl.LEQUAL,ht.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,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(((z,R)=>{const k=c.style._mergedLayers[R];return z+(k.hasShadowPass()&&!k.isHidden(t.zoom)?1:0)}),0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const p=c.context,m=Qn,g=Qn;if(this._cascades.length===0||Qn!==this._cascades[0].texture.size[0]){this._cascades=[];for(let z=0;z<2;++z){const R=c._shadowMapDebug,k=p.gl,F=p.createFramebuffer(m,g,R?1:0,"texture"),U=new s.T(p,{width:m,height:g,data:null},k.DEPTH_COMPONENT16);if(F.depthAttachment.set(U.texture),R){const H=new s.T(p,{width:m,height:g,data:null},k.RGBA8);F.colorAttachment0.set(H.texture)}this._cascades.push({framebuffer:F,texture:U,matrix:[],far:0,boundingSphereRadius:0,frustum:new s.cB,scale:0})}}this.shadowDirection=zl(n);let x=0;if(t.elevation){const z=t.elevation,R=[1e4,-1e4];z.visibleDemTiles.filter((k=>
8k.dem)).forEach((k=>{const F=k.dem.tree;R[0]=Math.min(R[0],F.minimums[0]),R[1]=Math.max(R[1],F.maximums[0])})),R[0]!==1e4&&(x=(R[1]-R[0])*z.exaggeration())}const w=1.5*t.cameraToCenterDistance,S=3*w,M=new Float64Array(16);for(let z=0;z<this._cascades.length;++z){const R=this._cascades[z];let k=t.height/50,F=1;z===0?F=w:(k=w,F=S);const[U,H]=Cs(t,this.shadowDirection,k,F,Qn,x);R.scale=t.scale,R.matrix=U,R.boundingSphereRadius=H,s.bl(M,R.matrix),R.frustum=s.cB.fromInvProjectionMatrix(M,1,0,!0),R.far=F}const A=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[A].far,this._cascades[A].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=Qn,this._uniformValues.u_shadowmap_0=jr.ShadowMap0,this._uniformValues.u_shadowmap_1=jr.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const C=c.transform.elevation;for(const z of this._groundShadowTiles){let R={min:0,max:0};if(C){const k=C.getMinMaxForTile(z);k&&(R=k)}this.addShadowReceiver(z.toUnwrapped(),R.min,R.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,Qn,Qn]);for(let p=0;p<this._numCascadesToRender;++p){c.currentShadowCascade=p,d.bindFramebuffer.set(this._cascades[p].framebuffer.framebuffer),d.clear({color:s.ao.white,depth:1});for(const m of t.order){const g=t._mergedLayers[m];if(!g.hasShadowPass()||g.isHidden(c.transform.zoom))continue;const x=t.getLayerSourceCache(g),w=x?n[x.id]:void 0;(g.type==="model"||w&&w.length)&&c.renderLayer(c,x,g,w)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,n=t.style,c=t.context,d=c.gl,p=n.directionalLight,m=n.ambientLight;if(!p||!m)return;const g=[],x=Ms(t,t.longestCutoffRange);x.shouldRenderCutoff&&g.push("RENDER_CUTOFF"),g.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&g.push("NORMAL_OFFSET");const w=Ko(n,p,m),S=new ht(d.LEQUAL,ht.ReadOnly,t.depthRangeFor3D),M=new St({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const A of this._groundShadowTiles){const C=A.toUnwrapped(),z=t.isTileAffectedByFog(A),R=t.getOrCreateProgram("groundShadow",{defines:g,overrideFog:z});this.setupShadows(C,R),t.uploadCommonUniforms(c,R,C,null,x);const k={u_matrix:t.transform.calculateProjMatrix(C),u_ground_shadow_factor:w};R.draw(t,d.TRIANGLES,S,M,Dt.multiply,Tt.disabled,k,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Dt.unblended:Dt.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const n=this.painter.transform,c=n.calculatePosMatrix(t,n.worldSize);return s.aB(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}calculateShadowPassMatrixFromMatrix(t){const n=s.bz(t);return s.aB(n,this._cascades[this.painter.currentShadowCascade].matrix,t),n}setupShadows(t,n,c){if(!this.enabled)return;const d=this.painter.transform,p=this.painter.context,m=p.gl,g=this._uniformValues,x=new Float64Array(16),w=d.calculatePosMatrix(t,d.worldSize);for(let S=0;S<this._cascades.length;S++)s.aB(x,this._cascades[S].matrix,w),g[S===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(x),p.activeTexture.set(m.TEXTURE0+jr.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=s.d7(t.canonical),M=2/d.tileSize*s.al/Qn,A=M*this._cascades[0].boundingSphereRadius,C=M*this._cascades[this._cascades.length-1].boundingSphereRadius,z=(c==="vector-tile"?1:3)*(function(R,k,F,U,H){const j=s.aA((R-22)/-22,0,1
8);return .125*(1-j)+4*j})(d.zoom);g.u_shadow_normal_offset=[S,A*z,C*z],g.u_shadow_bias=[1e-4,.0012,.012]}else g.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(p,g)}setupShadowsFromMatrix(t,n,c=!1){if(!this.enabled)return;const d=this.painter.context,p=d.gl,m=this._uniformValues,g=new Float64Array(16);for(let x=0;x<2;x++)s.aB(g,this._cascades[x].matrix,t),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(g),d.activeTexture.set(p.TEXTURE0+jr.ShadowMap0+x),this._cascades[x].texture.bindExtraParam(p.LINEAR,p.LINEAR,p.CLAMP_TO_EDGE,p.CLAMP_TO_EDGE,p.GREATER);this.useNormalOffset=c,c?(m.u_shadow_normal_offset=[1,3,3],m.u_shadow_bias=[6e-5,.0012,.012]):m.u_shadow_bias=[36e-5,.0012,.012],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 p=(function(x,w,S){const M=S/(1<<x.canonical.z);return new s.d9([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,w])})(t,n,c).getCorners(),m=n/-d[2];d[0]<0?(s.d8(p[0],p[0],[d[0]*m,0,0]),s.d8(p[3],p[3],[d[0]*m,0,0])):d[0]>0&&(s.d8(p[1],p[1],[d[0]*m,0,0]),s.d8(p[2],p[2],[d[0]*m,0,0])),d[1]<0?(s.d8(p[0],p[0],[0,d[1]*m,0]),s.d8(p[1],p[1],[0,d[1]*m,0])):d[1]>0&&(s.d8(p[2],p[2],[0,d[1]*m,0]),s.d8(p[3],p[3],[0,d[1]*m,0]));const g={};return g.vertices=p,g.planes=[Rl(p[1],p[0],p[4]),Rl(p[2],p[1],p[5]),Rl(p[3],p[2],p[6]),Rl(p[0],p[3],p[7])],g}addShadowReceiver(t,n,c){this._receivers.add(t,s.d9.fromTileIdAndHeight(t,n,c))}getMaxCascadeForTile(t){const n=this._receivers.get(t);return n&&n.lastCascade?n.lastCascade:0}}function Rl(l,t,n){const c=s.av([],n,t),d=s.av([],l,t),p=s.bI([],c,d),m=s.ag(p);return m===0?[0,0,1,0]:(s.c5(p,p,1/m),[p[0],p[1],p[2],-s.bJ(p,t)])}function zl(l){const t=l.properties.get("direction"),n=s.d4(t.x,t.y,t.z);n[2]=s.aA(n[2],0,75);const c=s.d6([n[0],n[1],n[2]]);return s.d5(c.x,c.y,c.z)}function Ko(l,t,n){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),p=t.properties.get("intensity"),m=t.properties.get("direction"),g=[m.x,m.y,m.z],x=n.properties.get("color-use-theme")==="none",w=n.properties.get("color"),S=n.properties.get("intensity"),M=Math.max(s.bJ([0,0,1],g),0),A=[0,0,0];s.c5(A,w.toPremultipliedRenderColor(x?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),S);const C=[0,0,0];return s.c5(C,d.toPremultipliedRenderColor(c?null:l.getLut(n.scope)).toArray01Linear().slice(0,3),M*p),s.db([A[0]>0?A[0]/(A[0]+C[0]):0,A[1]>0?A[1]/(A[1]+C[1]):0,A[2]>0?A[2]/(A[2]+C[2]):0])}function Cs(l,t,n,c,d,p){const m=l.zoom,g=l.scale,x=l.worldSize,w=1/x,S=l.aspect,M=Math.sqrt(1+S*S)*Math.tan(.5*l.fovX),A=M*M,C=c-n,z=c+n;let R,k;A>C/z?(R=c,k=c*M):(R=.5*z*(1+A),k=.5*Math.sqrt(C*C+2*(c*c+n*n)*A+z*z*A*A));const F=l.projection.pixelsPerMeter(l.center.lat,x),U=l._camera.getCameraToWorldMercator(),H=[0,0,-R*w];s.af(H,H,U);let j=k*w;const te=l._edgeInsets;if(!(te.left===0&&te.top===0&&te.right===0&&te.bottom===0||te.left===te.right&&te.top===te.bottom)){const Re=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?F:1),We=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,n,c);We[8]=2*-l.centerOffset.x/l.width,We[9]=2*l.centerOffset.y/l.height;const et=new Float64Array(16);s.cP(et,We,Re);const qe=new Float64Array(16);s.bl(qe,et);const Ue=s.cB.fromInvProjectionMatrix(qe,x,m,!0);for(const ct of Ue.points){const st=((Y=ct)[0]/=g,Y[1]/=g,Y[2]=s.cf(Y[2],l._center.lat),Y);j=Math.max(j,s.c6(s.da([],H,st)))}}var Y;j*=d/(d-1);const Q=Math.acos(t[2]),X=Math.atan2(-t[0],-t[1]),$=new zc;$.position=H,$.setPitchBearing(Q,X);const ie=$.getWorldToCamera(x,F),ue=j*x,le=Math.min(l._mercatorZfromZoom(17)*x*-2,-2*ue),xe=$.getCameraToClipOrthographic(-ue,ue,-ue,ue,le,(ue+p*F)/t[2]),ve=new Float64Array(16);s.aB(ve,xe,ie);const Ae=s.d5(Math.floor(1e6*H[0])/1e6*x,Math.floor(1e6*H[1])/1e6*x,0),Ve=.5*d,me=[0,0,0];s.af(me,Ae,ve),s.c5(me,me,Ve);const se=[Math.floor(me[0]),Math.floor(me[1]),Math.floor(me[2])],Te=[0,0,0];s.av(Te,me,se),s.c5(Te,Te,-1/Ve);const _e=new Float64Array(16);return s.bA(_e),s.br(_e,_e,Te),s.aB(ve,_e,ve),[ve,ue]}class sm extends s.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,n){return s.dc(this.requestManager.transformRequest(n,s.R.Model).url).then((c=>{if(!c)return;const d=s.dd(c),p=new s.de(t,n,void 0,void 0,d);return p.computeBoundsAndApplyParent(),p})).catch((c=>{if(c&&c.status===404)return null;this.fire(new s.y(new Error(`Could not load model ${t} from ${n}: ${c.message}`)))}))}load(t,n,c={forceReload:!1}){this.models[n]||(this.models[n]={});const d=Object.keys(t),p=[],m=[];for(const g of d){const x=t[g];this.hasURLBeenRequested(x)&&!c.forceReload||(this.modelByURL[x]={modelId:g,scope:n},p.push(this.loadModel(g,x)),m.push(g)),this.models[n][g]||(this.models[n][g]={model:null,numReferences:1})}this.numModelsLoading[n]=(this.numModelsLoading[n]||0)+m.length,Promise.allSettled(p).then((g=>{for(let x=0;x<g.length;x++){const{status:w}=g[x];if(w==="rejected")continue;const{value:S}=g[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 s.z("data",{dataType:"style"}))})).catch((g=>{this.fire(new s.y(new Error(`Could not load models: ${g.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:p,modelId:m}=this.modelByURL[d];this.models[p][m].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,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])}
8reloadModels(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)&&s.df(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 p=this.modelUris[n][t];c||delete this.modelUris[n][t],delete this.modelByURL[p];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 ph=s.a6.colorTheme,am=new s.a9({data:new s.aa(ph.data)});function af(l){if(!l.metadata||!l.metadata.content_area)return;const t=s.o.devicePixelRatio,{left:n,top:c,width:d,height:p}=l.metadata.content_area,m=n*t,g=c*t;return[m,g,m+d*t,g+p*t]}function lf(l){if(l)return l.map((([t,n])=>[t*s.o.devicePixelRatio,n*s.o.devicePixelRatio]))}class mh{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 dn))return t;const d=n.map((m=>this.sourceCache.getTile(m))),p=c.getImages(d,Array.from(this.pendingRequests));for(const[m,g]of p)t.set(s.I.from({name:m,iconsetId:this.id}),g),this.pendingRequests.delete(m);for(const m of this.pendingRequests)this.missingRequests.add(m);return this.pendingRequests.clear(),t}}const Ps=(l,t)=>q(l,t&&t.filter((n=>n.identifier!=="source.canvas"))),cf=s.aH(ri,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),uf=s.aH(ri,["setCenter","setZoom","setBearing","setPitch"]),Lc=new Set(["background","sky","slot","custom"]),Rs={version:8,layers:[],sources:{}},Dl={duration:300,delay:0};class eo extends s.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=Object.assign({},Dl),this._buildingIndex=new rm(this),this.crossTileSymbolIndex=new _o,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=n.styleChanges||new xr,this._hasDataDrivenEmissive=!1,this.dispatcher=n.dispatcher?n.dispatcher:new s.D(s.dh(),this),n.imageManager?this.imageManager=n.imageManager:(this.imageManager=new Pa(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=n.glyphManager?n.glyphManager:new s.di(t._requestManager,n.localFontFamily?s.dj.all:n.localIdeographFontFamily?s.dj.ideographs:s.dj.none,n.localFontFamily||n.localIdeographFontFamily),n.modelManager?this.modelManager=n.modelManager:(this.modelManager=new sm(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={}
8,this._order=[],this._markersNeedUpdate=!1,this.options=n.configOptions?n.configOptions:new Map,this._configDependentLayers=n.configDependentLayers?n.configDependentLayers:new Set,this._indoorDependentLayers=n.indoorDependentLayers?n.indoorDependentLayers: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",s.dk());const c=this;this._rtlTextPluginCallback=eo.registerForPluginStateChange((d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},((p,m)=>{if(s.dl(p),m&&m.every((g=>g)))for(const g in c._sourceCaches){const x=c._sourceCaches[g],w=x.getSource().type;w!=="vector"&&w!=="geojson"||x.reload()}}))})),this.on("data",(d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const p=this.getOwnSource(d.sourceId);if(p&&p.vectorLayerIds)for(const m in this._layers){const g=this._layers[m];g.source===p.id&&this._validateLayer(g)}}))}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(s.h(t))return t;const n=s.dm(t);if(!n.startsWith("http"))try{return new URL(n,location.href).toString()}catch{return n}return n}return`json://${s.dn(JSON.stringify(t))}`}_diffStyle(t,n,c){this.globalId=this._getGlobalId(t);const d=(p,m)=>{try{m(null,this.setState(p,c))}catch(g){m(g,!1)}};if(typeof t=="string"){const p=this.map._requestManager.normalizeStyleURL(t),m=this.map._requestManager.transformRequest(p,s.R.Style);s.m(m,((g,x)=>{g?this.fire(new s.y(g)):x&&d(x,n)}))}else typeof t=="object"&&d(t,n)}loadURL(t,n={}){this.fire(new s.z("dataloading",{dataType:"style"}));const c=typeof n.validate=="boolean"?n.validate:!s.h(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 p=this.map._requestManager.transformRequest(t,s.R.Style);this._request=s.m(p,((m,g)=>{if(this._request=null,m)this.fire(new s.y(m));else if(g)return this.importsCache.set(t,g),this._load(g,c)}))}loadJSON(t,n={}){this.fire(new s.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=s.o.frame((()=>{this._request=null,this._load(t,n.validate!==!1)}))}loadEmpty(){this.fire(new s.z("dataloading",{dataType:"style"})),this._load(Rs,!1)}_loadImports(t,n,c){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of t){const m=this._createFragmentStyle(p),g=new Promise((S=>{m.once("style.import.load",S),m.once("error",S)})).then((()=>this.mergeAll()));if(d.push(g),this.resolvedImports.has(p.url)){m.loadEmpty();continue}const x=p.data||this.importsCache.get(p.url);x?(m.loadJSON(x,{validate:n}),this._isInternalStyle(x)&&(m.globalId=null)):p.url?m.loadURL(p.url,{validate:n}):m.loadEmpty();const w={style:m,id:p.id,config:p.config};if(c){const S=this.fragments.findIndex((({id:M})=>M===c));
8this.fragments=this.fragments.slice(0,S).concat(w).concat(this.fragments.slice(S))}else this.fragments.push(w)}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?s.B(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[n];(t.config||d)&&(c=Object.assign({},t.config,d));const p=new eo(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,indoorDependentLayers:this._indoorDependentLayers});return p.setEventedParent(this.map,{style:p}),p}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),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){if(this._isInternalStyle(t)){const p=Object.assign({},Rs,{imports:[{id:"basemap",data:t,url:""}]},t.center?{center:t.center}:{},t.bearing?{bearing:t.bearing}:{},t.pitch?{pitch:t.pitch}:{},t.zoom?{zoom:t.zoom}:{},t.light?{light:t.light}:{});return this._importedAsBasemap=!0,void this._load(p,n)}if(this.updateConfig(this._config,t.schema),n&&Ps(this,ho(t)))return;this._loaded=!0,this.stylesheet=s.dp(t);const c=()=>{for(const x in t.sources)this.addSource(x,t.sources[x],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const x in t.iconsets)this.addIconset(x,t.iconsets[x]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const p=bl(this.stylesheet.layers);if(this._order=p.map((x=>x.id)),this.stylesheet.light&&s.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const x=this.stylesheet.lights[0];this.light=new ce(x.properties,x.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ce(this.stylesheet.light)),this._layers={};for(const x of p){const w=s.du(x,this.scope,this._styleColorTheme.lut,this.options);w.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(w.fqid),w.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(w.fqid),this._hasAppearances=this._hasAppearances||w.getAppearances().length!==0,w.setEventedParent(this,{layer:{id:w.id}}),this._layers[w.id]=w;const S=this.getOwnLayerSourceCache(w),M=!!this.directionalLight&&this.directionalLight.shadowsEnabled();S&&w.canCastShadows()&&M&&(S.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const m=this.stylesheet.terrain;m&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(m,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.z("data",{dataType:"style"}));const g=this.isRootStyle();t.imports?this._loadImports(t.imports,n).then((()=>{this._reloadImports(),this.fire(new s.z(g?"style.load":"style.import.load"))})).catch((x=>{this.fire(new s.y(new Error("Failed to load imports",x))),this.fire(new s.z(g?"style.load":"style.import.load"))})):(this._reloadImports(),this.fire(new s.z(g?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const d=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(d){const p=this._evaluateColorThemeData(d);this._loadColorTheme(p).then((()=>{c()})).catch((m=>{s.w(`Couldn't load color theme from the stylesheet: ${m}`),c()}))}else this._styleColorTheme.lut=null,c()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some((t=>t.style.hasAppearances()))}mergeAll(){let t,n,c,d,p,m,g,x,w,S;const M={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((A=>{if(A.stylesheet){if(A.light!=null&&(t=A.light),A.stylesheet.lights)for(const C of A.stylesheet.lights)C.type==="ambient"&&A.ambientLight!=null&&(n=A.ambientLight),C.type==="directional"&&A.directionalLight!=null&&(c=A.directionalLight);d=this._prioritizeTerrain(d,A.terrain,A.stylesheet.terrain),A.stylesheet.fog&&A.fog!=null&&(p=A.fog),A.stylesheet.snow&&A.snow!=null&&(m=A.snow),A.stylesheet.rain&&A.rain!=null&&(g=A.rain),A.stylesheet.camera!=null&&(S=A.stylesheet.camera),A.stylesheet.projection!=null&&(x=A.stylesheet.projection),A.stylesheet.transition!=null&&(w=A.stylesheet.transition),M[A.scope]=A._styleColorTheme}})),this.light=t,this.ambientLight=n,this.directionalLight=c,this.fog=p,this.snow=m,this.rain=g,this._styleColorThemeForScope=M,d===null?delete this.terrain:this.terrain=d,this.camera=S||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition=Object.assign({},Dl,w),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}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=>
8{n.stylesheet.projection!=null&&(t=n.stylesheet.projection)})),this.projection=t||{name:"mercator"}}mergeSources(){const t={},n={},c={};this.forEachFragmentStyle((d=>{for(const p in d._sourceCaches){const m=s.B(p,d.scope);t[m]=d._sourceCaches[p]}for(const p in d._otherSourceCaches){const m=s.B(p,d.scope);n[m]=d._otherSourceCaches[p]}for(const p in d._symbolSourceCaches){const m=s.B(p,d.scope);c[m]=d._symbolSourceCaches[p]}})),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=n,this._mergedSymbolSourceCaches=c}mergeIndoor(){this.forEachFragmentStyle((t=>{if(t.stylesheet&&t.stylesheet.indoor)for(const n of Object.values(t.stylesheet.indoor)){const c=n,d=s.B(c.sourceId,t.scope);this._mergedIndoor[d]=new Set(c.sourceLayers||[])}}))}mergeLayers(){const t={},n=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle((m=>{for(const g of m._order){const x=m._layers[g];if(x.type==="slot"){const w=s.dq(g);if(t[w])continue;t[w]=[]}x.slot&&t[x.slot]?t[x.slot].push(x):n.push(x)}})),this._mergedOrder=[];let d=-1;const p=(m=[])=>{for(const g of m)if(g.type==="slot"){const x=s.dq(g.id);t[x]&&p(t[x]),this._mergedSlots.push(x)}else{const x=s.B(g.id,g.scope);this._mergedOrder.push(x),c[x]=g,g.is3D(!!this.terrain)&&(this._has3DLayers=!0,d=this._mergedOrder.length-1),g.type==="circle"&&(this._hasCircleLayers=!0),g.type==="symbol"&&(this._hasSymbolLayers=!0),g.type==="clip"&&(this._clipLayerPresent=!0)}};if(p(n),this._has3DLayers){const m={};for(let g=0;g<this._mergedOrder.length;++g){const x=this._mergedOrder[g];m[x]=g===d?1:g<d?c[x].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort(((g,x)=>m[g]-m[x]))}this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?(function(n,c,d,p){const m=Object.assign({},c);for(const x of Object.keys(ph))m[x]===void 0&&(m[x]=ph[x].default);const g=new s.a8(am,n,new Map(d));return g.setTransitionOrValue(m,d),g.untransitioned().possiblyEvaluate(new s.ac(0,{worldview:void 0}))})(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const n=this._styleColorTheme.lutLoadingCorrelationID;return new Promise(((c,d)=>{const p="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let m=t;m.startsWith(p)||(m=p+m);const g=s.I.from("mapbox-reserved-lut"),x=new Image;x.src=m,x.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},x.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==n)return void c();this._styleColorTheme.lutLoading=!1;const{width:w,height:S,data:M}=s.o.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(w!==S*S)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(g)&&this.removeImage(g),this.addImage(g,{data:new s.q({width:w,height:S},M),pixelRatio:1,sdf:!1,usvg:!1,version:0});const A=this.imageManager.getImage(g,this.scope);A?(this._styleColorTheme.lut={image:A.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 p,m,g;const x=s.o.devicePixelRatio>1?"@2x":"";let w=s.m(c.transformRequest(c.normalizeSpriteURL(n,x,".json"),s.R.SpriteJSON),((A,C)=>{w=null,g||(g=A,p=C,M())})),S=s.n(c.transformRequest(c.normalizeSpriteURL(n,x,".png"),s.R.SpriteImage),((A,C)=>{S=null,g||(g=A,m=C,M())}));function M(){if(g)d(g);else if(p&&m){const A=s.o.getImageData(m),C={};for(const z in p){const{width:R,height:k,x:F,y:U,sdf:H,pixelRatio:j,stretchX:te,stretchY:Y,content:Q}=p[z],X=new s.q({width:R,height:k});s.q.copy(A,X,{x:F,y:U},{x:0,y:0},{width:R,height:k},null),C[z]={data:X,pixelRatio:j!==void 0?j:1,sdf:H!==void 0&&H,stretchX:te,stretchY:Y,content:Q,usvg:!1,version:0}}d(null,C)}}return{cancel(){w&&(w.cancel(),w=null),S&&(S.cancel(),S=null)}}})(t,this.map._requestManager,((n,c)=>{if(this._spriteRequest=null,n)this.fire(new s.y(n));else if(c){const d=new Map;for(const p in c)d.set(s.I.from(p),c[p]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.z("data",{dataType:"style"}))}))}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 s.y(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 s.y(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 p=new mh(t,this.scope,c);this.imageManager.addImageProvider(p,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!s.h(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const n=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(p,m)=>{if(this._spriteRequest=null,p)n?this._loadSprite(t):this.fire(new s.y(p));else if(m){const g=new Map;for(const x in m)g.set(s.I.from(x),m[x]);this.addImages(g)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.z("data",{dataType:"style"}))},s.bu((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),s.R.Iconset),((p,m)=>{if(p)return void d(p);const g={},x=s.dg(new s.bt(m));for(const w of x.icons){const S={version:1,pixelRatio:s.o.devicePixelRatio,content:af(w),stretchX:w.metadata?lf(w.metadata.stretch_x_areas):void 0,stretchY:w.metadata?lf(w.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:w};g[w.name]=S}d(null,g)})))}_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 s.y(new Error(`Source layer "${c}" does not exist on source "${n.id}" as specified by style layer "${t.id}"`)))}
8loaded(){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}_updateDataDrivenEmissiveStrength(){for(const t in this._mergedLayers){const n=this._mergedLayers[t];if(n._transitionablePaint&&n._transitionablePaint._values){const c=n._transitionablePaint._values["line-emissive-strength"];if(c&&c.value&&c.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const n=this.getOwnLayer(t);if(n)return n;this.fire(new s.y(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 s.y(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 p=t.getProgramIds();if(p)for(const m of p){const g=t.getDefaultProgramParams(m,n.zoom,this._styleColorTheme.lut);g&&(c.style=this,this.fog&&(c._fogVisible=!0,g.overrideFog=!0,c.getOrCreateProgram(m,g)),c._fogVisible=!1,g.overrideFog=!1,c.getOrCreateProgram(m,g),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(g.overrideRtt=!0,c.getOrCreateProgram(m,g)))}}}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 g=this._changes.getLayerUpdatesByScope();for(const x in g){const{updatedIds:w,removedIds:S}=g[x];(w||S)&&(this._updateWorkerLayers(x,w,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 p={};for(const g in this._mergedSourceCaches){const x=this._mergedSourceCaches[g];p[g]=x.used,x.used=!1,x.tileCoverLift=0}for(const g of this._mergedOrder){const x=this._mergedLayers[g];if(x.visibility!=="none"&&x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)){const w=this.getLayerSourceCache(x);w&&(w.used=!0,w.tileCoverLift=Math.max(w.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback((()=>
8{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 g of m)g.sourceCache.used=!0;for(const g in p){const x=this._mergedSourceCaches[g];p[g]!==x.used&&x.getSource().fire(new s.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new s.z("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const 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(),Ps(this,ho(t)))return!1;(t=s.dp(t)).layers=bl(t.layers);const c=(function(m,g){if(!m)return[{command:ri.setStyle,args:[g]}];let x=[];try{if(!s.by(m.version,g.version))return[{command:ri.setStyle,args:[g]}];if(s.by(m.center,g.center)||x.push({command:ri.setCenter,args:[g.center]}),s.by(m.zoom,g.zoom)||x.push({command:ri.setZoom,args:[g.zoom]}),s.by(m.bearing,g.bearing)||x.push({command:ri.setBearing,args:[g.bearing]}),s.by(m.pitch,g.pitch)||x.push({command:ri.setPitch,args:[g.pitch]}),s.by(m.sprite,g.sprite)||x.push({command:ri.setSprite,args:[g.sprite]}),s.by(m.glyphs,g.glyphs)||x.push({command:ri.setGlyphs,args:[g.glyphs]}),s.by(m.imports,g.imports)||(function(C=[],z=[],R){z=z||[];const k=(C=C||[]).map(wl),F=z.map(wl),U=C.reduce(Tl,{}),H=z.reduce(Tl,{}),j=k.slice();let te,Y,Q,X;for(te=0,Y=0;te<k.length;te++)Q=k[te],H.hasOwnProperty(Q)?Y++:(R.push({command:ri.removeImport,args:[Q]}),j.splice(j.indexOf(Q,Y),1));for(te=0,Y=0;te<F.length;te++)Q=F[F.length-1-te],j[j.length-1-te]!==Q&&(U.hasOwnProperty(Q)?(R.push({command:ri.removeImport,args:[Q]}),j.splice(j.lastIndexOf(Q,j.length-Y),1)):Y++,X=j[j.length-te],R.push({command:ri.addImport,args:[H[Q],X]}),j.splice(j.length-te,0,Q));for(const $ of z){const ie=U[$.id];ie&&(delete ie.data,s.by(ie,$)||R.push({command:ri.updateImport,args:[$.id,$]}))}})(m.imports,g.imports,x),s.by(m.transition,g.transition)||x.push({command:ri.setTransition,args:[g.transition]}),s.by(m.light,g.light)||x.push({command:ri.setLight,args:[g.light]}),s.by(m.fog,g.fog)||x.push({command:ri.setFog,args:[g.fog]}),s.by(m.snow,g.snow)||x.push({command:ri.setSnow,args:[g.snow]}),s.by(m.rain,g.rain)||x.push({command:ri.setRain,args:[g.rain]}),s.by(m.projection,g.projection)||x.push({command:ri.setProjection,args:[g.projection]}),s.by(m.lights,g.lights)||x.push({command:ri.setLights,args:[g.lights]}),s.by(m.camera,g.camera)||x.push({command:ri.setCamera,args:[g.camera]}),s.by(m.iconsets,g.iconsets)||(function(C,z,R){let k;for(k in z=z||{},C=C||{})C.hasOwnProperty(k)&&(z.hasOwnProperty(k)||R.push({command:ri.removeIconset,args:[k]}));for(k in z){if(!z.hasOwnProperty(k))continue;const F=z[k];C.hasOwnProperty(k)?s.by(C[k],F)||(R.push({command:ri.removeIconset,args:[k]}),R.push({command:ri.addIconset,args:[k,F]})):R.push({command:ri.addIconset,args:[k,F]})}})(m.iconsets,g.iconsets,x),!s.by(m["color-theme"],g["color-theme"]))return[{command:ri.setStyle,args:[g]}];const w={},S=[];(function(C,z,R,k){let F;for(F in z=z||{},C=C||{})C.hasOwnProperty(F)&&(z.hasOwnProperty(F)||oh(F,R,k));for(F in z){if(!z.hasOwnProperty(F))continue;const U=z[F];C.hasOwnProperty(F)?s.by(C[F],U)||(C[F].type==="geojson"&&U.type==="geojson"&&rf(C,z,F)?R.push({command:ri.setGeoJSONSourceData,args:[F,U.data]}):tf(F,z,R,k)):Tc(F,z,R)}})(m.sources,g.sources,S,w);const M=[];
8m.layers&&m.layers.forEach((C=>{C.source&&w[C.source]?x.push({command:ri.removeLayer,args:[C.id]}):M.push(C)}));let A=m.terrain;A&&w[A.source]&&(x.push({command:ri.setTerrain,args:[void 0]}),A=void 0),x=x.concat(S),s.by(A,g.terrain)||x.push({command:ri.setTerrain,args:[g.terrain]}),(function(C,z,R){z=z||[];const k=(C=C||[]).map(wl),F=z.map(wl),U=C.reduce(Tl,{}),H=z.reduce(Tl,{}),j=k.slice(),te=Object.create(null);let Y,Q,X,$,ie,ue,le;for(Y=0,Q=0;Y<k.length;Y++)X=k[Y],H.hasOwnProperty(X)?Q++:(R.push({command:ri.removeLayer,args:[X]}),j.splice(j.indexOf(X,Q),1));for(Y=0,Q=0;Y<F.length;Y++)X=F[F.length-1-Y],j[j.length-1-Y]!==X&&(U.hasOwnProperty(X)?(R.push({command:ri.removeLayer,args:[X]}),j.splice(j.lastIndexOf(X,j.length-Q),1)):Q++,ue=j[j.length-Y],R.push({command:ri.addLayer,args:[H[X],ue]}),j.splice(j.length-Y,0,X),te[X]=!0);for(Y=0;Y<F.length;Y++)if(X=F[Y],$=U[X],ie=H[X],!te[X]&&!s.by($,ie))if(s.by($.source,ie.source)&&s.by($["source-layer"],ie["source-layer"])&&s.by($.type,ie.type)){for(le in Es($.layout,ie.layout,R,X,null,ri.setLayoutProperty),Es($.paint,ie.paint,R,X,null,ri.setPaintProperty),s.by($.slot,ie.slot)||R.push({command:ri.setSlot,args:[X,ie.slot]}),s.by($.filter,ie.filter)||R.push({command:ri.setFilter,args:[X,ie.filter]}),s.by($.minzoom,ie.minzoom)&&s.by($.maxzoom,ie.maxzoom)||R.push({command:ri.setLayerZoomRange,args:[X,ie.minzoom,ie.maxzoom]}),$)$.hasOwnProperty(le)&&le!=="layout"&&le!=="paint"&&le!=="filter"&&le!=="metadata"&&le!=="minzoom"&&le!=="maxzoom"&&le!=="slot"&&(le.indexOf("paint.")===0?Es($[le],ie[le],R,X,le.slice(6),ri.setPaintProperty):s.by($[le],ie[le])||R.push({command:ri.setLayerProperty,args:[X,le,ie[le]]}));for(le in ie)ie.hasOwnProperty(le)&&!$.hasOwnProperty(le)&&le!=="layout"&&le!=="paint"&&le!=="filter"&&le!=="metadata"&&le!=="minzoom"&&le!=="maxzoom"&&le!=="slot"&&(le.indexOf("paint.")===0?Es($[le],ie[le],R,X,le.slice(6),ri.setPaintProperty):s.by($[le],ie[le])||R.push({command:ri.setLayerProperty,args:[X,le,ie[le]]}))}else R.push({command:ri.removeLayer,args:[X]}),ue=j[j.lastIndexOf(X)+1],R.push({command:ri.addLayer,args:[ie,ue]})})(M,g.layers,x)}catch(w){console.warn("Unable to compute style diff:",w),x=[{command:ri.setStyle,args:[g]}]}return x})(this.serialize(),t).filter((m=>!(m.command in uf)));if(c.length===0)return!1;const d=c.filter((m=>!(m.command in cf)));if(d.length>0)throw new Error(`Unimplemented: ${d.map((m=>m.command)).join(", ")}.`);const p=[];return c.forEach((m=>{p.push(this[m.command](...m.args))})),n&&Promise.all(p).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 s.y(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 s.z("data",{dataType:"style"})),this}addImage(t,n){return this.getImage(t)?this.fire(new s.y(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,n),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("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 s.z("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this):this.fire(new s.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(t){return this.modelManager.addModelURLs(t,this.getActualScope()),this._updateWorkerModels(),this.fire(new s.z("data",{dataType:"style"})),this}addModel(t,n,c={}
8){return this._checkLoaded(),this._validate(O,`models.${t}`,n,null,c)||(this.modelManager.addModel(t,n,this.getActualScope()),this.fire(new s.z("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.getActualScope())}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.getActualScope(),!1,!0),this.fire(new s.z("data",{dataType:"style"})),this):this.fire(new s.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(t,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(_c,`sources.${t}`,n,null,c))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=Fr(t,n,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id})));const p=m=>
8{const g=(m?"symbol:":"other:")+d.id,x=s.B(g,this.scope),w=this._sourceCaches[g]=new Ln(x,d,m);(m?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=w,w.onAdd(this.map)};p(!1),n.type!=="vector"&&n.type!=="geojson"||p(!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 s.y(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find((([p,m])=>m.type==="source"&&m.source===t));if(d)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const p=s.dq(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new s.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),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 p=c[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const n=this._getTransitionParameters();for(const p of t){if(this._validate(Zo,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(n)}else this.ambientLight=new ii(p,vr||(vr=new s.a9({color:new s.aa(s.a6.properties_light_ambient.color),"color-use-theme":new s.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.aa(s.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(n)}else this.directionalLight=new ii(p,lr||(lr=new s.a9({direction:new s.ap(s.a6.properties_light_directional.direction),color:new s.aa(s.a6.properties_light_directional.color),"color-use-theme":new s.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.aa(s.a6.properties_light_directional.intensity),"cast-shadows":new s.aa(s.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new s.aa(s.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new s.aa(s.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=Object.assign(n,{worldview:this.map.getWorldview()}),d=new s.ac(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,n=this.ambientLight;if(!t||!n)return;const c=A=>.2126*(A[0]<=.03928?A[0]/12.92:Math.pow((A[0]+.055)/1.055,2.4))+.7152*(A[1]<=.03928?A[1]/12.92:Math.pow((A[1]+.055)/1.055,2.4))+.0722*(A[2]<=.03928?A[2]/12.92:Math.pow((A[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),p=t.properties.get("intensity"),m=t.properties.get("direction"),g=1-s.d4(m.x,m.y,m.z)[2]/90,x=c(d)*p*g,w=n.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),S=n.properties.get("intensity"),M=c(w)*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(s.dr(t)){const n=s.ds(t),c=this.fragments.find((({id:p})=>p===n));if(!c)return;const d=s.dq(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,p="")=>`${d}::${p}`;this._featuresetSelectors={};for(const d in t){const p=this._featuresetSelectors[d]=[];
8for(const m of t[d].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){s.w(`Layer is undefined for selector: ${m.layer}`);continue}const w=c(x.source,x.sourceLayer);if(w in n&&n[w]!==m.featureNamespace){s.w(`"featureNamespace ${m.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}n[w]=m.featureNamespace}let g;if(m.properties)for(const x in m.properties){const w=s.U(m.properties[x]);w.result==="success"&&(g=g||{},g[x]=w.value)}p.push({layerId:m.layer,namespace:m.featureNamespace,properties:g,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 s.y(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const p=[];for(const m of d[t].selectors){const g=c.getOwnLayer(m.layer);g&&p.push(g)}return p}getConfigProperty(t,n){const c=this.getFragmentStyle(t);if(!c)return null;const d=s.B(n,c.scope),p=c.options.get(d),m=p?p.value||p.default:null;return m?m.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(t,n){const c=s.B(t,n);return this._mergedIndoor[c]}setIndoorData(t,n){this.map.indoor.setIndoorData(n)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(t,n,c){const d=this.getFragmentStyle(t);if(!d)return;const p=d.stylesheet.schema;if(!p||!p[n])return;const m=s.U(c);if(m.result!=="success")return void Ps(this,m.value);const g=m.value.expression,x=s.B(n,d.scope),w=d.options.get(x);if(!w)return;let S;const{minValue:M,maxValue:A,stepValue:C,type:z,values:R}=p[n],k=s.U(p[n].default);k.result==="success"&&(S=k.value.expression),S?(this.options.set(x,Object.assign({},w,{value:g,default:S,minValue:M,maxValue:A,stepValue:C,type:z,values:R})),this.updateConfigDependencies(n)):this.fire(new s.y(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 p in c){const m=s.B(p,n.scope),g=n.options.get(m),x=g?g.value||g.default:null;d[p]=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,p;const m=s.U(n[c].default);if(m.result==="success"&&(d=m.value.expression),t&&t[c]!==void 0){const A=s.U(t[c]);A.result==="success"&&(p=A.value.expression)}const{minValue:g,maxValue:x,stepValue:w,type:S,values:M}=n[c];if(d){const A=s.B(c,this.scope);this.options.set(A,{default:d,value:p,minValue:g,maxValue:x,stepValue:w,type:S,values:M})}else this.fire(new s.y(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new s.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(t,n=(()=>!0)){for(const c of t){const d=this.getLayer(c);d&&n(d)&&(d.possiblyEvaluateVisibility(),this._updateLayer(d),this._changes.setDirty())}}updateConfigDependencies(t){this._updateLayers(this._configDependentLayers,(n=>!t||n.expressionDependencies.configDependencies.has(t))),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle((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;if(this._layers[d])return void this.fire(new s.y(new Error(`Layer with i
8d "${d}" already exists on this map`)));let p;if(t.type==="custom"){if(Ps(this,s.dt(t)))return;p=s.du(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=s.dp(t),t=Object.assign(t,{source:d})),this._validate(nh,`layers.${d}`,t,{arrayIndex:-1},c))return;p=s.du(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}})}const m=s.B(p.source,p.scope);p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(m),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(m);let g=this._order.length;if(n){const M=this._order.indexOf(n);if(M===-1)return void this.fire(new s.y(new Error(`Layer with id "${n}" does not exist on this map.`)));p.slot===this._layers[n].slot?g=M:s.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(g,0,d),this._layerOrderChanged=!0,this._layers[d]=p;const x=this.getOwnLayerSourceCache(p),w=!!this.directionalLight&&this.directionalLight.shadowsEnabled();x&&p.canCastShadows()&&w&&(x.castsShadows=!0);const S=this._changes.getRemovedLayer(p);if(S&&p.source&&x&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const M=s.B(p.source,p.scope);S.type!==p.type?this._changes.updateSourceCache(M,"clear"):(this._changes.updateSourceCache(M,"reload"),x.pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map),p.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 p=this._order.length;if(n){const m=this._order.indexOf(n);
8if(m===-1)return void this.fire(new s.y(new Error(`Layer with id "${n}" does not exist on this map.`)));c.slot===this._layers[n].slot?p=m:s.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(p,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._indoorDependentLayers.delete(n.fqid),this._changes.removeLayer(n);const d=this.getOwnLayerSourceCache(n);if(d&&d.castsShadows){let p=!1;for(const m in this._layers)if(this._layers[m].source===n.source&&this._layers[m].canCastShadows()){p=!0;break}d.castsShadows=p}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&&!s.by(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(ia,`layers.${d.id}.filter`,n,{layerType:d.type},c)||(d.filter=s.dp(n),this._updateLayer(d)))}getFilter(t){const n=this._checkLayer(t);if(n)return s.dp(n.filter)}setLayoutProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!s.by(p.getLayoutProperty(n),c)){if(c!=null&&(!d||d.validate!==!1)&&Ps(p,pe.call(ho,{key:`layers.${t}.layout.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:s.a6,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(n,c),p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(p.fqid),this._updateLayer(p)}}setLayerProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);p&&(n==="appearances"?(p.setAppearances(c),this._changes.setDirty()):p.isPaintProperty(n)?this.setPaintProperty(t,n,c,d):this.setLayoutProperty(t,n,c,d))}getLayoutProperty(t,n){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(n)}setPaintProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(!p||s.by(p.getPaintProperty(n),c)||c!=null&&(!d||d.validate!==!1)&&Ps(p,yl.call(ho,{key:`layers.${t}.paint.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:s.a6})))return;const m=p.setPaintProperty(n,c);p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(p.fqid),m&&this._updateLayer(p),this._changes.updatePaintProperties(p)}getPaintProperty(t,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:w}=t.target,S=this.getFragmentStyle(w),M=S.getFeaturesetLayers(x);for(const{source:A,sourceLayer:C}of M)S.setFeatureState({id:t.id,source:A,sourceLayer:C},n)}else if("layerId"in t.target){const{layerId:x}=t.target,w=this.getLayer(x);this.setFeatureState({id:t.id,source:w.source,sourceLayer:w.sourceLayer},n)}return}const c=t.source,d=t.sourceLayer,p=this._checkSource(c);if(!p)return;const m=p.type;if(m==="geojson"&&d)return void this.fire(new s.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new s.y(new Error("The feature id parameter must be provided.")));const g=this.getOwnSourceCaches(c);for(const x of g)x.setFeatureState(d,t.id,n)}removeFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:w}=t.target,S=this.getFragmentStyle(w),M=S.getFeaturesetLayers(x);for(const{source:A,sourceLayer:C}of M)S.removeFeatureState({id:t.id,source:A,sourceLayer:C},n)}else if("layerId"in t.target){const{layerId:x}=t.target,w=this.getLayer(x);this.removeFeatureState({id:t.id,source:w.source,sourceLayer:w.sourceLayer},n)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const p=d.type,m=p==="vector"?t.sourceLayer:void 0;if(p==="vector"&&!m)return void this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new s.y(new Error("A feature id is required to remove its specific state property.")));const g=this.getOwnSourceCaches(c);for(const x of g)x.removeFeatureState(m,t.id,n)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let p;if("featuresetId"in t.target){const{featuresetId:m,importId:g}=t.target,x=this.getFragmentStyle(g),w=x.getFeaturesetLayers(m);for(const{source:S,sourceLayer:M}of w){const A=x.getFeatureState({id:t.id,source:S,sourceLayer:M});if(A&&!p)p=A;else if(!s.by(p,A))return void this.fire(new s.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:m}=t.target,g=this.getLayer(m);p=this.getFeatureState({id:t.id,source:g.source,sourceLayer:g.sourceLayer})}return p}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 s.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)[0].getFeatureState(c,t.id);this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),n=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return s.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,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=s.B(t.source,t.scope),d=this._changes.getUpd
8atedSourceCaches();t.source&&!d[c]&&n&&n.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),n.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const n=g=>this._mergedLayers[g].is3D(!!this.terrain),c=this.order,d={},p=[];for(let g=c.length-1;g>=0;g--){const x=c[g];if(n(x)){d[x]=g;for(const w of t){const S=w[x];if(S)for(const M of S)p.push(M)}}}p.sort(((g,x)=>x.intersectionZ-g.intersectionZ));const m=[];for(let g=c.length-1;g>=0;g--){const x=c[g];if(n(x))for(let w=p.length-1;w>=0;w--){const S=p[w].feature;if(S.layer&&d[S.layer.id]<g)break;m.push(S),p.pop()}else for(const w of t){const S=w[x];if(S)for(const M of S)m.push(M.feature)}}return m}queryRasterValue(t,n,c){const d=this.getOwnSource(t);return d?d.type!=="raster-array"?(this.fire(new s.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):d.queryRasterArrayValue(n,c):(this.fire(new s.y(new Error(`Source with id "${t}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ia,"queryRenderedFeatures.filter",n.filter,null,n),d=s.b6(n.filter));const p={},m=S=>{if(Lc.has(S.type))return;const M=this.getOwnLayerSourceCache(S),A=p[M.id]=p[M.id]||{sourceCache:M,layers:{},has3DLayers:!1};S.is3D(!!this.terrain)&&(A.has3DLayers=!0),A.layers[S.fqid]=A.layers[S.fqid]||{styleLayer:S,targets:[]},A.layers[S.fqid].targets.push({filter:d})};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new s.y(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 s.y(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 g=this._queryRenderedFeatures(t,p,c),x=this._flattenAndSortRenderedFeatures(g),w=[];for(const S of x)s.dw(S.layer.id)===this.scope&&w.push(S);return w}queryRenderedFeatureset(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ia,"queryRenderedFeatures.filter",n.filter,null,n),d=s.b6(n.filter));const p="mock",m=[];if(n&&n.target)m.push(Object.assign({},n,{targetId:p,filter:d}));else{const S=this.getFeaturesetDescriptors();for(const M of S)m.push({targetId:p,filter:d,target:M});for(const{style:M}of this.fragments){const A=M.getFeaturesetDescriptors();for(const C of A)m.push({targetId:p,filter:d,target:C})}}const g=this.queryRenderedTargets(t,m,c),x=[],w=new Set;for(const S of g)for(const M of S.variants[p])Da(M,S,w)||x.push(new s.dx(S,M));return x}queryRenderedTargets(t,n,c){const d={},p=(g,x,w,S)=>{const M=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(M.layers[g.fqid]=M.layers[g.fqid]||{styleLayer:g,targets:[]},g.is3D(!!this.terrain)&&(M.has3DLayers=!0),!S)return w.uniqueFeatureID=!1,void M.layers[g.fqid].targets.push(w);M.layers[g.fqid].targets.push(Object.assign({},w,{namespace:S.namespace,properties:S.properties,uniqueFeatureID:S.uniqueFeatureID}))};for(const g of n)if("featuresetId"in g.target){const{featuresetId:x,importId:w}=g.target,S=this.getFragmentStyle(w);if(!S||!S._featuresetSelectors)continue;const M=S._featuresetSelectors[x];if(!M){this.fire(new s.y(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const A of M){const C=S.getOwnLayer(A.layerId);C&&!Lc.has(C.type)&&p(C,S.getOwnLayerSourceCache(C),g,A)}}else if("layerId"in g.target){const{layerId:x}=g.target,w=this.getLayer(x);if(!w||Lc.has(w.type))continue;p(w,this.getLayerSourceCache(w),g)}const m=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,n,c){const d=[],p=!!this.map._showQueryGeometry,m=er.createFromScreenPoints(t,c);for(const g in n){const x=gc(m,n[g],this._availableImages,c,p);Object.keys(x).length&&d.push(x)}if(this.placement)for(const g in n){if(!n[g].sourceCache._onlySymbols)continue;const x=yc(m.screenGeometry,n[g],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;
8c&&this._validate(ia,"querySourceFeatures.filter",c,null,n);let d=[];const p=this.getOwnSourceCaches(t);for(const m of p)d=d.concat(xc(m,n));return d}addSourceType(t,n,c){return eo.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(eo.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 p=!1;for(const g in t)if(!s.by(t[g],d[g])){p=!0;break}if(!p)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=s.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,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=!("source"in t)||t.source==null;if(n===1){if(this.disableElevatedTerrain)return;if("source"in c&&typeof c.source=="object"){const g="terrain-dem-src";this.addSource(g,c.source),c=s.dp(c),c=Object.assign(c,{source:g})}const p=Object.assign({},c),m={};if(this.terrain&&d){p.source=this.terrain.get().source;const g=this.terrain?this.getFragmentStyle(this.terrain.scope):null;g&&(m.style=g.serialize())}if(this._validate(rh,"terrain",p,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 s.z("data",{dataType:"style"}))}else{const p=this.terrain,m=p.get();for(const g of Object.keys(s.a6.terrain))!c.hasOwnProperty(g)&&s.a6.terrain[g].default&&(c[g]=s.a6.terrain[g].default);for(const g in t)if(!s.by(t[g],m[g])){p.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});p.updateTransitions(x),this.fire(new s.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const n=this.fog=new Pt(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 Er(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 Qi(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(!s.by(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(!s.by(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(!s.by(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);
8this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},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 s.z("colorthemeset")),t()})).catch((d=>{s.w(`Couldn't set color theme: ${d}`)}))}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&s.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,n){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=n,c._reloadColorTheme())}_getTransitionParameters(t){return{now:s.o.now(),transition:Object.assign(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 de(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,p={}){if(p&&p.validate===!1)return!1;const m=Object.assign({},this.serialize());return Ps(this,t.call(ho,Object.assign({key:n,style:m,value:c,styleSpec:s.a6},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.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()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle((t=>{t.modelManager.reloadModels(t.scope)}))}updateSources(t){let n;this.directionalLight&&(n=zl(this.directionalLight));const c=new Set,d=new Set;for(const p in this._mergedLayers){const m=this._mergedLayers[p];
8m.type==="building"&&c.add(m.source),m.hasElevation()&&!d.has(m.source)&&d.add(m.source)}for(const p in this._mergedSourceCaches){const m=this._mergedSourceCaches[p],g=d.has(m._source.id);c.has(m._source.id)&&(m._source.reparseOverscaled=!1),m.update(t,void 0,void 0,n,g)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const n=this._sourceCaches[t];n.resume(),n.reload()}}_updatePlacement(t,n,c,d,p,m,g=!1){let x=!1,w=!1;const S={},M={};for(const R of this._mergedOrder){const k=this._mergedLayers[R];if(k.type!=="symbol")continue;const F=s.B(k.source,k.scope);let U=S[F];if(!U){const j=this.getLayerSourceCache(k);if(!j)continue;const te=j.getRenderableIds(!0).map((Y=>j.getTileByID(Y)));M[F]=te.slice(),U=S[F]=te.sort(((Y,Q)=>Q.tileID.overscaledZ-Y.tileID.overscaledZ||(Y.tileID.isLessThan(Q.tileID)?-1:1)))}const H=this.crossTileSymbolIndex.addLayer(k,U,n.center.lng,n.projection);x=x||H}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),g=g||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new s.z("neworder"));const A=!!(this.placement&&!n.equals(this.placement.transform)),C=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!m||this.placement.lastReplacementSourceUpdateTime!==m.updateTime)),z=(A||C||x||this.placement&&this.placement.isStale())&&d===0;if((g||!this.pauseablePlacement||z||d!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.o.now(),n.zoom))&&(this.pauseablePlacement=new kr(n,this._mergedOrder,g||d===0,c,d,p,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(s.o.now()),w=!0),x&&this.pauseablePlacement.placement.setStale()),w||x){this._buildingIndex.onNewFrame(n.zoom);for(let R=0;R<this._mergedOrder.length;R++){const k=this._mergedLayers[this._mergedOrder[R]];if(k.type!=="symbol"||k.visibility==="none")continue;const F=this.isLayerClipped(k);this.placement.updateLayerOpacities(k,S[s.B(k.source,k.scope)],R,F?m:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.o.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:p})=>p===t.id))!==-1)return void this.fire(new s.y(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!n)return c.push(t),this._loadImports([t],!0);const d=c.findIndex((({id:p})=>p===n));return d===-1&&this.fire(new s.y(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),s.by(n.config,c[d].config)||this.setImportConfig(t,n.config,n.data.schema),s.by(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 p=this.getImportIndex(n);if(p===-1)return this;const m=c[d],g=this.fragments[d];return c=c.filter((({id:x})=>x!==t)),this.fragments=this.fragments.filter((({id:x})=>x!==t)),this.stylesheet.imports=c.slice(0,p).concat(m).concat(c.slice(p)),this.fragments=this.fragments.slice(0,p).concat(g).concat(this.fragments.slice(p)),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 p=this.fragments[d];return p.style=this._createFragmentStyle(c[d]),p.style.on("style.import.load",(()=>this.mergeAll())),p.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),p=this.stylesheet.imports||[];if(d===-1)return this;n?p[d].config=n:delete p[d].config;const m=this.fragments[d];c&&m.style.stylesheet&&(m.style.stylesheet.schema=c);const g=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=n,m.style.updateConfig(n,g),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));return n===-1&&this.fire(new s.y(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=s.B(t,n);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const n=s.B(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}
8updateSourceCaches(){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 g=n.images.map((x=>s.I.toString(x)));m.setDependencies(n.tileID.key,n.type,g)}},p=s.B(n.source,n.scope);d(this._mergedOtherSourceCaches[p]),d(this._mergedSymbolSourceCaches[p]),n.images.some((m=>m.iconsetId))&&this.fire(new s.z("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 s.dz(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 s.y(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)}}eo.getSourceType=function(l){return Ao[l]},eo.setSourceType=function(l,t){Ao[l]=t},eo.registerForPluginStateChange=s.dA;class hf extends s.E{constructor(t){super(),this._style=t,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},s.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(t){t===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=t,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(t){this._activeFloorsVisible=t,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(t){for(const[n,c]of Object.entries(t.buildings))if(this._buildings[n])for(const d of c.floorIds)this._buildings[n].floors[d]||(this._buildings[n].floors[d]=c.floors[d]);else this._buildings[n]=c;for(const n of t.activeFloors)this._activeFloors.add(n);this._updateIndoorSelector()}getIndoorTileOptions(t,n){const c=this._style.getIndoorSourceLayers(t,n);return c&&this._indoorState?{sourceLayers:c,indoorState:this._indoorState}:null}_updateUI(t,n,c){const d=(function(p,m,g,x){let w=null,S=Number.MAX_SAFE_INTEGER;if(x<16)return null;for(const[M,A]of Object.entries(p)){const C=A.center;if(C){const z=m.distanceTo(s.aT.convert(C));z<S&&g.contains(C)&&(S=z,w=M)}}return w})(this._buildings,n,c,t);d!==this._closestBuildingId&&(this._closestBuildingId=d,this._updateIndoorSelector())}_updateIndoorSelector(){const t=this._buildings,n=this._closestBuildingId,c=n&&t?t[n]:void 0;if(!c)return void this.fire(new s.z("selector-update",{selectedFloorId:null,activeFloorsVisible:this._activeFloorsVisible,floors:[]}));let d=null;for(const m of c.floorIds)if(this._activeFloors&&this._activeFloors.has(m)){d=m;break}const p=Array.from(c.floorIds).map((m=>({id:m,name:c.floors[m].name,zIndex:c.floors[m].zIndex}))).sort(((m,g)=>g.zIndex-m.zIndex));this.fire(new s.z("selector-update",{selectedFloorId:d,activeFloorsVisible:this._activeFloorsVisible,floors:p}))}_updateActiveFloors(){const t=this._activeFloors;
8this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:t,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var Ba=` 9#define EPSILON 0.0000001 10#define PI 3.141592653589793 11#ifdef RENDER_CUTOFF 12float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} 13#endif`,Na=` 14#ifdef DUAL_SOURCE_BLENDING 15layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1; 16#else 17layout(location=0) out vec4 glFragColor; 18#endif 19#ifdef USE_MRT1 20layout(location=1) out vec4 out_Target1; 21#endif 22highp float unpack_depth(highp vec4 rgba_depth) 23{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} 24#ifdef INDICATOR_CUTOUT 25uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 26#endif 27vec4 applyCutout(vec4 color,float height) { 28#ifdef INDICATOR_CUTOUT 29float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); 30#else 31return color; 32#endif 33} 34#ifdef DEBUG_WIREFRAME 35#define HANDLE_WIREFRAME_DEBUG \\ 36glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 37gl_FragDepth=gl_FragCoord.z-0.0001; 38#else 39#define HANDLE_WIREFRAME_DEBUG 40#endif 41#ifdef RENDER_CUTOFF 42uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 43#endif 44vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,_h=` 45#define EXTENT 8192.0 46#define RAD_TO_DEG 180.0/PI 47#define DEG_TO_RAD PI/180.0 48#define GLOBE_RADIUS EXTENT/PI/2.0 49float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 50#ifdef PROJECTION_GLOBE_VIEW 51vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 52#ifndef PROJECTED_POS_ON_VIEWPORT 53float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; 54#else 55return vec3(0.0); 56#endif 57}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} 58#endif 59vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4( 60unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 61);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
61return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} 62#ifdef RENDER_CUTOFF 63uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 64#endif 65const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) 66{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} 67#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer 68#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib 69#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib 70#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib 71#define DECLARE_MATERIAL_TABLE_INFO 72#endif`,Oc="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Vn=` 73#define ELEVATION_SCALE 7.0 74#define ELEVATION_OFFSET 450.0 75#ifdef PROJECTION_GLOBE_VIEW 76uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( 77mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} 78#else 79vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 80#endif 81#ifdef TERRAIN 82uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { 83#ifdef TERRAIN_DEM_FLOAT_FORMAT 84vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; 85#else 86float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 87#endif 88}float prevElevation(vec2 apos) { 89#ifdef TERRAIN_DEM_FLOAT_FORMAT 90vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; 91#else 92float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 93#endif 94} 95#ifdef TERRAIN_VERTEX_MORPHING 96float elevation(vec2 apos) { 97#ifdef ZERO_EXAGGERATION 98return 0.0; 99#endif 100float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 101#else 102float elevation(vec2 apos) { 103#ifdef ZERO_EXAGGERATION 104return 0.0; 105#endif 106return currentElevation(apos);} 107#endif 108vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} 109#else 110float elevation(vec2 pos) { return 0.0; } 111#endif 112#ifdef DEPTH_OCCLUSION 113uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; 114#ifdef DEPTH_D24 115float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} 116#else 117highp float unpack_depth_rgba(vec4 rgba_depth) 118{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} 119#endif 120bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 121#ifdef CLIP_ZERO_TO_ONE 122coord.z=-1.0+2.0*coord.z; 123#endif 124#ifdef DEPTH_D24 125float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 126#else 127float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 128#endif 129return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
129size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 130#ifdef DEPTH_D24 131highp vec4 depth=vec4( 132texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r 133);depth=unpack_depth4(depth); 134#else 135highp vec4 depth=vec4( 136unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) 137); 138#endif 139return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; 140#ifdef CLIP_ZERO_TO_ONE 141coord.z=-1.0+2.0*coord.z; 142#endif 143int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { 144#ifdef DEPTH_D24 145highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 146#else 147highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 148#endif 149res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w; 150#ifdef CLIP_ZERO_TO_ONE 151coord.z=-1.0+2.0*coord.z; 152#endif 153highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} 154#else 155bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 156#endif`,Fc=`#ifdef FOG 157uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} 158#endif`,$e=`#ifdef FOG 159uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport; 160#ifdef FLIP_Y 161uv.y=1.0-uv.y; 162#endif 163highp vec3 ray_dir=mix( 164mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
164vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} 165#endif`,gh=`#ifdef RASTER_ARRAY 166uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) 167);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) 168);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} 169#endif`,kc=`#ifdef RASTER_ARRAY 170uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} 171#endif 172uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,Bc=`#ifdef RENDER_SHADOWS 173uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} 174#endif`,yh=`#ifdef RENDER_SHADOWS 175precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
175p float bias) { 176#ifdef CLIP_ZERO_TO_ONE 177highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias); 178#else 179highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias); 180#endif 181return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w; 182#ifdef SHADOWS_SINGLE_CASCADE 183vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias); 184#else 185light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0); 186#endif 187}highp float calculate_shadow_bias(float NDotL) { 188#ifdef NORMAL_OFFSET 189return 0.5*u_shadow_bias.x; 190#else 191return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 192#endif 193}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy) 194{highp vec2 biasUV=vec2( 195pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} 196#endif`;const Ll=/#include\s+"([^"]+)"/g,Lo=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,xh=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,ua=new Set(["ifdef","ifndef","elif","if","defined"]),ha=new Set;Ds(Ba,ha),Ds(_h,ha),Ds(Na,ha);const zs={"_prelude_fog.vertex.glsl":Fc,"_prelude_terrain.vertex.glsl":Vn,"_prelude_shadow.vertex.glsl":Bc,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer 197#define MATERIAL_TABLE_DEBUG 0 198uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; 199#if MATERIAL_TABLE_DEBUG 200vec4 colorDebug; 201#endif 202};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}
202float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { 203if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; 204}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { 205iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; 206#if MATERIAL_TABLE_DEBUG 207const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; 208#endif 209uint offset=0u; 210#if MATERIAL_TABLE_DEBUG 211bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} 212#endif 213offset++; 214#if MATERIAL_TABLE_DEBUG 215uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} 216#endif 217offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); 218#if MATERIAL_TABLE_DEBUG 219if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} 220#endif 221uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); 222#if MATERIAL_TABLE_DEBUG 223if(keepFinding) 224{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} 225#endif 226offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; 227#if MATERIAL_TABLE_DEBUG 228if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} 229#endif 230info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) 231{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} 232#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) 233#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) 234#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) 235#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); 236#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; 237#endif`,"_prelude_fog.fragment.glsl":$e,"_prelude_shadow.fragment.glsl":yh,"_prelude_lighting.glsl":` 238#ifdef LIGHTING_3D_MODE 239uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
239));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} 240#endif`,"_prelude_raster_array.glsl":gh,"_prelude_raster_particle.glsl":kc},Nc={};Jt("",Vn),Jt($e,Fc),Jt(yh,Bc),Jt(gh,""),Jt(kc,"");const df=Jt(Na,_h),Vc=Ba,lm=[` 241#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) 242#extension GL_EXT_blend_func_extended : require 243#endif`,"precision mediump float;",Vc,df.fragmentSource].join(` 244`),ff=["precision highp float;",Vc,df.vertexSource].join(` 245`);var vh={background:Jt(`#include "_prelude_fog.fragment.glsl" 246#include "_prelude_lighting.glsl" 247uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength; 248#ifdef LIGHTING_3D_MODE 249in vec4 v_color; 250#endif 251void main() {vec4 out_color; 252#ifdef LIGHTING_3D_MODE 253out_color=v_color; 254#else 255out_color=u_color; 256#endif 257#ifdef FOG 258out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 259#endif 260glFragColor=out_color*u_opacity; 261#ifdef USE_MRT1 262out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 263#endif 264#ifdef OVERDRAW_INSPECTOR 265glFragColor=vec4(1.0); 266#endif 267HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 268#include "_prelude_lighting.glsl" 269in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength; 270#ifdef LIGHTING_3D_MODE 271uniform mediump vec4 u_color;out vec4 v_color; 272#endif 273void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 274#ifdef LIGHTING_3D_MODE 275v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 276#endif 277#ifdef FOG 278v_fog_pos=fog_position(a_pos); 279#endif 280}`),backgroundPattern:Jt(`#include "_prelude_fog.fragment.glsl" 281#include "_prelude_lighting.glsl" 282uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); 283#ifdef LIGHTING_3D_MODE 284out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 285#endif 286#ifdef FOG 287out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 288#endif 289glFragColor=out_color*u_opacity; 290#ifdef USE_MRT1 291out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 292#endif 293#ifdef OVERDRAW_INSPECTOR 294glFragColor=vec4(1.0); 295#endif 296HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 297uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos); 298#ifdef FOG 299v_fog_pos=fog_position(a_pos); 300#endif 301}`),building:Jt(`#include "_prelude_fog.fragment.glsl" 302#include "_prelude_shadow.fragment.glsl" 303#include "_prelude_lighting.glsl" 304const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos; 305#ifdef BUILDING_FAUX_FACADE 306in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity; 307#endif 308#ifdef RENDER_SHADOWS 309in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 310#endif 311#ifdef FLOOD_LIGHT
312in highp float v_flood_radius;in float v_has_flood_light; 313#endif 314uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));} 315#ifdef BUILDING_FAUX_FACADE 316float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y; 317#if 0 318if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0; 319#else 320if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao; 321#endif 322return out_color;} 323#endif 324vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a; 325#ifdef BUILDING_FAUX_FACADE 326if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);} 327#endif 328vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; 329#ifdef RENDER_SHADOWS 330#ifdef RENDER_CUTOFF 331shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} 332#else 333shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 334#endif 335#else 336shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir); 337#endif 338color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); 339#ifdef FLOOD_LIGHT
340float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance); 341#endif 342color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); 343#ifdef FOG 344color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); 345#endif 346color*=u_opacity; 347#ifdef INDICATOR_CUTOUT 348color=applyCutout(color,v_pos.z); 349#endif 350#ifdef FEATURE_CUTOUT 351color=apply_feature_cutout(color,gl_FragCoord); 352#endif 353glFragColor=color; 354#ifdef DEBUG_SHOW_NORMALS 355color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; 356#endif 357#ifdef OVERDRAW_INSPECTOR 358glFragColor=vec4(1.0); 359#endif 360HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 361#include "_prelude_shadow.vertex.glsl" 362in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos; 363#ifdef BUILDING_FAUX_FACADE 364out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive; 365#endif 366#ifdef RENDER_SHADOWS 367uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; 368#endif 369#ifdef FLOOD_LIGHT 370out highp float v_flood_radius;out float v_has_flood_light; 371#endif 372const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 373#ifdef BUILDING_FAUX_FACADE 374mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);} 375#endif 376#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 377#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive 378void main() { 379#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 380#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive 381#ifdef FLOOD_LIGHT 382v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius); 383#endif 384vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0; 385#ifdef BUILDING_FAUX_FACADE 386v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;} 387#endif 388v_pos=a_pos_3f; 389#ifdef RENDER_CUTOFF 390vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity; 391#endif 392#ifdef RENDER_SHADOWS 393vec3 shadow_pos=v_pos; 394#ifdef NORMAL_OFFSET 395vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); 396#endif 397v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0); 398#endif 399#ifdef FOG 400v_fog_pos=fog_position(v_pos); 401#endif 402gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:Jt(`in vec4 v_color_emissive; 403#pragma mapbox: define-attribute highp vec4 bloom_attenuation 404#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 405float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; 406#ifdef HAS_ATTRIBUTE_a_bloom_attenuation 407float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));
407opacity*=saturate(1.0-distance*distance); 408#endif 409#ifdef RENDER_CUTOFF 410opacity*=v_cutoff_opacity; 411#endif 412glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; 413#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 414#pragma mapbox: define-attribute highp vec4 bloom_attenuation 415out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 416#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 417#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 418#ifdef HAS_ATTRIBUTE_a_part_color_emissive 419vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive); 420#else 421v_color_emissive=vec4(1.0); 422#endif 423gl_Position=u_matrix*vec4(a_pos_3f,1.0); 424#ifdef RENDER_CUTOFF 425v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 426#endif 427}`),buildingDepth:Jt(`in highp float v_depth;void main() { 428#ifndef DEPTH_TEXTURE 429glFragColor=pack_depth(v_depth); 430#endif 431}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Jt(`#include "_prelude_fog.fragment.glsl" 432#include "_prelude_lighting.glsl" 433in vec3 v_data;in float v_visibility; 434#pragma mapbox: define highp vec4 color 435#pragma mapbox: define mediump float radius 436#pragma mapbox: define lowp float blur 437#pragma mapbox: define lowp float opacity 438#pragma mapbox: define highp vec4 stroke_color 439#pragma mapbox: define mediump float stroke_width 440#pragma mapbox: define lowp float stroke_opacity 441uniform float u_emissive_strength;void main() { 442#pragma mapbox: initialize highp vec4 color 443#pragma mapbox: initialize mediump float radius 444#pragma mapbox: initialize lowp float blur 445#pragma mapbox: initialize lowp float opacity 446#pragma mapbox: initialize highp vec4 stroke_color 447#pragma mapbox: initialize mediump float stroke_width 448#pragma mapbox: initialize lowp float stroke_opacity 449vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 450smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 451smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 452antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 453);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 454#ifdef LIGHTING_3D_MODE 455out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 456#endif 457#ifdef FOG 458out_color=fog_apply_premultiplied(out_color,v_fog_pos); 459#endif 460glFragColor=out_color*(v_visibility*opacity_t); 461#ifdef OVERDRAW_INSPECTOR 462glFragColor=vec4(1.0); 463#endif 464}`,`#include "_prelude_fog.vertex.glsl" 465#include "_prelude_terrain.vertex.glsl" 466#define NUM_VISIBILITY_RINGS 2 467#define INV_SQRT2 0.70710678 468#define ELEVATION_BIAS 0.0001 469#define NUM_SAMPLES_PER_RING 16 470uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; 471#ifdef PROJECTION_GLOBE_VIEW 472in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 473#endif 474#ifdef ELEVATED_ROADS 475in float a_circle_z_offset; 476#endif 477out vec3 v_data;out float v_visibility; 478#pragma mapbox: define highp vec4 color 479#pragma mapbox: define mediump float radius 480#pragma mapbox: define lowp float blur 481#pragma mapbox: define lowp float opacity 482#pragma mapbox: define highp vec4 stroke_color 483#pragma mapbox: define mediump float stroke_width 484#pragma mapbox: define lowp float stroke_opacity 485vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
485iew_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { 486#if defined(TERRAIN) 487return elevation(pos)+ELEVATION_BIAS; 488#else 489return 0.0; 490#endif 491}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); 492#ifdef PITCH_WITH_MAP 493#ifdef PROJECTION_GLOBE_VIEW 494return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 495#else 496return u_matrix*( world_center+vec4(sample_offset,0,0) ); 497#endif 498#else 499return projected_center+vec4(sample_offset,0,0); 500#endif 501}float get_sample_step() { 502#ifdef PITCH_WITH_MAP 503return 2.0*PI/float(NUM_SAMPLES_PER_RING); 504#else 505return PI/float(NUM_SAMPLES_PER_RING); 506#endif 507}void main() { 508#pragma mapbox: initialize highp vec4 color 509#pragma mapbox: initialize mediump float radius 510#pragma mapbox: initialize lowp float blur 511#pragma mapbox: initialize lowp float opacity 512#pragma mapbox: initialize highp vec4 stroke_color 513#pragma mapbox: initialize mediump float stroke_width 514#pragma mapbox: initialize lowp float stroke_opacity 515vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; 516#ifdef PROJECTION_GLOBE_VIEW 517vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); 518#else 519surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); 520#endif 521#ifdef ELEVATED_ROADS 522world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 523#endif 524vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 525#ifdef PITCH_WITH_MAP 526#ifdef SCALE_WITH_MAP 527view_scale=1.0; 528#else 529view_scale=projected_center.w/u_camera_to_center_distance; 530#endif 531#else 532#ifdef SCALE_WITH_MAP 533view_scale=u_camera_to_center_distance; 534#else 535view_scale=projected_center.w; 536#endif 537#endif 538gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 539#ifdef TERRAIN 540float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 541#ifdef PITCH_WITH_MAP 542float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; 543#else 544occlusion_world_center=world_center;occlusion_projected_center=projected_center; 545#endif 546for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); 547#else 548visibility=1.0; 549#endif 550#ifdef PROJECTION_GLOBE_VIEW 551visibility=1.0; 552#endif 553v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 554#ifdef FOG 555v_fog_pos=fog_position(world_center.xyz); 556#endif 557}`),clippingMask:Jt("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:Jt(`#include "_prelude_fog.fragment.glsl" 558uniform highp float u_intensity;in vec2 v_extrude; 559#pragma mapbox: define highp float weight 560#define GAUSS_COEF 0.3989422804014327 561void main() { 562#pragma mapbox: initialize highp float weight 563float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); 564#ifdef FOG 565if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 566#endif 567#ifdef OVERDRAW_INSPECTOR 568glFragColor=vec4(1.0); 569#endif 570HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 571#include "_prelude_fog.vertex.glsl" 572uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; 573#ifdef PROJECTION_GLOBE_VIEW 574in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 575#endif 576out vec2 v_extrude; 577#pragma mapbox: define highp float weight 578#pragma mapbox: define mediump float radius 579const highp float ZERO=1.0/255.0/16.0; 580#define GAUSS_COEF 0.3989422804014327 581void main() { 582#pragma mapbox: initialize highp float weight 583#pragma mapbox: initialize mediump float radius 584vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; 585#ifdef PROJECTION_GLOBE_VIEW 586vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 587#else 588pos=vec3(tilePos+extrude,elevation(tilePos)); 589#endif 590gl_Position=u_matrix*vec4(pos,1); 591#ifdef FOG 592v_fog_pos=fog_position(pos); 593#endif 594}`),heatmapTexture:Jt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; 595#ifdef OVERDRAW_INSPECTOR 596glFragColor=vec4(0.0); 597#endif 598HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Jt("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" 599in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance; 600#ifdef PROJECTION_GLOBE_VIEW 601uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; 602#endif 603out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation); 604#ifdef PROJECTION_GLOBE_VIEW 605#ifndef PROJECTED_POS_ON_VIEWPORT 606vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition); 607#endif 608#endif 609vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 6100.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Jt("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( 611mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 6120.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Jt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" 613in vec2 a_pos; 614#ifdef PROJECTION_GLOBE_VIEW 615in vec3 a_pos_3; 616#endif 617out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; 618#ifdef PROJECTION_GLOBE_VIEW
619gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 620#else 621gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 622#endif 623}`),elevatedStructuresDepth:Jt(`void main() { 624#ifndef DEPTH_TEXTURE 625glFragColor=vec4(0.); 626#endif 627}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Jt(`#ifdef DEPTH_RECONSTRUCTION 628in float v_height; 629#endif 630void main() { 631#ifdef DEPTH_RECONSTRUCTION 632if (v_height >=0.0) 633discard; 634#else 635#ifdef FEATURE_CUTOUT 636apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord); 637#endif 638#endif 639glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; 640#ifdef DEPTH_RECONSTRUCTION 641out float v_height; 642#endif 643void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 644#ifdef DEPTH_RECONSTRUCTION 645if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 646#endif 647gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Jt(`#include "_prelude_fog.fragment.glsl" 648#include "_prelude_lighting.glsl" 649#include "_prelude_shadow.fragment.glsl" 650in vec3 v_normal;in float v_height; 651#ifdef RENDER_SHADOWS 652in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 653#endif 654vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
654vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) 655{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength; 656#pragma mapbox: define highp vec4 structure_color 657void main() { 658#pragma mapbox: initialize highp vec4 structure_color 659vec3 color=structure_color.xyz; 660#ifdef LIGHTING_3D_MODE 661vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz); 662#ifdef RENDER_SHADOWS 663float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor); 664#else 665color=apply_lighting(color,transformed_normal); 666#endif 667color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} 668#endif 669#ifdef FOG 670color=fog_apply(color,v_fog_pos); 671#endif 672vec4 out_color=vec4(color,1.0); 673#ifdef INDICATOR_CUTOUT 674out_color=applyCutout(out_color,v_height); 675#endif 676#ifdef FEATURE_CUTOUT 677out_color=apply_feature_cutout(out_color,gl_FragCoord); 678#endif 679glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 680#include "_prelude_shadow.vertex.glsl" 681in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; 682#ifdef RENDER_SHADOWS 683uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; 684#endif 685#pragma mapbox: define highp vec4 structure_color 686void main() { 687#pragma mapbox: initialize highp vec4 structure_color 688v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1); 689#ifdef RENDER_SHADOWS 690vec3 shd_pos0=pos;vec3 shd_pos1=pos; 691#ifdef NORMAL_OFFSET 692vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 693#endif 694v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 695#endif 696#ifdef FOG 697v_fog_pos=fog_position(a_pos); 698#endif 699}`),fill:Jt(`#include "_prelude_fog.fragment.glsl" 700#include "_prelude_lighting.glsl" 701#include "_prelude_shadow.fragment.glsl" 702#pragma mapbox: define highp vec4 color 703#pragma mapbox: define lowp float opacity 704uniform float u_emissive_strength; 705#ifdef RENDER_SHADOWS 706uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 707#endif 708#ifdef ELEVATED_ROADS 709in highp float v_road_z_offset; 710#endif 711#ifdef INDICATOR_CUTOUT 712in highp float v_z_offset; 713#endif 714void main() { 715#pragma mapbox: initialize highp vec4 color 716#pragma mapbox: initialize lowp float opacity 717vec4 out_color=color; 718#ifdef LIGHTING_3D_MODE 719out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 720#ifdef RENDER_SHADOWS 721float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 722#endif 723#endif 724#ifdef FOG 725out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 726#endif 727out_color*=opacity; 728#ifdef INDICATOR_CUTOUT 729if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 730#endif 731#ifdef FEATURE_CUTOUT 732out_color=apply_feature_cutout(out_color,gl_FragCoord); 733#endif 734glFragColor=out_color; 735#ifdef USE_MRT1 736out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 737#endif 738#ifdef OVERDRAW_INSPECTOR 739glFragColor=vec4(1.0); 740#endif 741HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 742#include "_prelude_shadow.vertex.glsl" 743in vec2 a_pos; 744#ifdef ELEVATED_ROADS 745in float a_road_z_offset;out highp float v_road_z_offset; 746#endif 747#ifdef RENDER_SHADOWS 748uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 749#endif 750#ifdef INDICATOR_CUTOUT 751out highp float v_z_offset; 752#endif 753uniform mat4 u_matrix; 754#pragma mapbox: define highp vec4 color 755#pragma mapbox: define lowp float opacity 756#pragma mapbox: define highp float z_offset 757void main() { 758#pragma mapbox: initialize highp vec4 color 759#pragma mapbox: initialize lowp float opacity 760#pragma mapbox: initialize highp float z_offset 761#ifdef ELEVATED_ROADS 762z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 763#endif 764float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 765#ifdef RENDER_SHADOWS 766vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 767#ifdef NORMAL_OFFSET 768vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 769#endif 770v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 771#endif 772#ifdef FOG 773v_fog_pos=fog_position(a_pos); 774#endif 775#ifdef INDICATOR_CUTOUT 776v_z_offset=z_offset; 777#endif 778}`),fillOutline:Jt(`#include "_prelude_fog.fragment.glsl" 779#include "_prelude_lighting.glsl" 780#include "_prelude_shadow.fragment.glsl" 781in highp vec2 v_pos;uniform float u_emissive_strength; 782#ifdef RENDER_SHADOWS 783uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 784#endif 785#pragma mapbox: define highp vec4 outline_color 786#pragma mapbox: define lowp float opacity 787void main() { 788#pragma mapbox: initialize highp vec4 outline_color 789#pragma mapbox: initialize lowp float opacity 790float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 791#ifdef LIGHTING_3D_MODE 792out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 793#ifdef RENDER_SHADOWS 794float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 795#endif 796#endif 797#ifdef FOG 798out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 799#endif 800#ifdef FEATURE_CUTOUT 801out_color=apply_feature_cutout(out_color,gl_FragCoord); 802#endif 803glFragColor=out_color*(alpha*opacity); 804#ifdef USE_MRT1 805out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 806#endif 807#ifdef OVERDRAW_INSPECTOR 808glFragColor=vec4(1.0); 809#endif 810HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 811#include "_prelude_shadow.vertex.glsl" 812in vec2 a_pos; 813#ifdef ELEVATED_ROADS 814in float a_road_z_offset; 815#endif 816#ifdef RENDER_SHADOWS 817uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 818#endif 819uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 820#pragma mapbox: define highp vec4 outline_color 821#pragma mapbox: define lowp float opacity 822#pragma mapbox: define highp float z_offset 823void main() { 824#pragma mapbox: initialize highp vec4 outline_color 825#pragma mapbox: initialize lowp float opacity 826#pragma mapbox: initialize highp float z_offset 827#ifdef ELEVATED_ROADS 828z_offset+=a_road_z_offset; 829#endif 830float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 831#ifdef FLIP_Y 832v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 833#else 834v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 835#endif 836#ifdef RENDER_SHADOWS 837vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 838#ifdef NORMAL_OFFSET 839vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 840#endif 841v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 842#endif 843#ifdef FOG 844v_fog_pos=fog_position(a_pos); 845#endif 846}`),fillOutlinePattern:Jt(`#include "_prelude_fog.fragment.glsl" 847#include "_prelude_lighting.glsl" 848#include "_prelude_shadow.fragment.glsl" 849uniform vec2 u_texsize;uniform sampler2D u_image; 850#ifdef FILL_PATTERN_TRANSITION 851uniform float u_pattern_transition; 852#endif 853uniform float u_emissive_strength; 854#ifdef APPLY_LUT_ON_GPU 855uniform highp sampler3D u_lutTexture; 856#endif 857#ifdef RENDER_SHADOWS 858uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 859#endif 860in highp vec2 v_pos;in highp vec2 v_pos_world; 861#pragma mapbox: define lowp float opacity 862#pragma mapbox: define lowp vec4 pattern 863#ifdef FILL_PATTERN_TRANSITION 864#pragma mapbox: define mediump vec4 pattern_b 865#endif 866void main() { 867#pragma mapbox: initialize lowp float opacity 868#pragma mapbox: initialize mediump vec4 pattern 869#ifdef FILL_PATTERN_TRANSITION 870#pragma mapbox: initialize mediump vec4 pattern_b 871#endif 872vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 873#ifdef APPLY_LUT_ON_GPU 874out_color=applyLUT(u_lutTexture,out_color); 875#endif 876#ifdef FILL_PATTERN_TRANSITION 877vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 878#endif 879#ifdef LIGHTING_3D_MODE 880out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 881#ifdef RENDER_SHADOWS 882float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 883#endif 884#endif 885#ifdef FEATURE_CUTOUT 886out_color=apply_feature_cutout(out_color,gl_FragCoord); 887#endif 888#ifdef FOG 889out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 890#endif 891glFragColor=out_color*(alpha*opacity); 892#ifdef USE_MRT1 893out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 894#endif 895#ifdef OVERDRAW_INSPECTOR 896glFragColor=vec4(1.0); 897#endif 898HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 899#include "_prelude_shadow.vertex.glsl" 900uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; 901#ifdef ELEVATED_ROADS 902in float a_road_z_offset; 903#endif 904#ifdef RENDER_SHADOWS 905uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 906#endif 907out highp vec2 v_pos;out highp vec2 v_pos_world; 908#pragma mapbox: define lowp float opacity 909#pragma mapbox: define lowp vec4 pattern 910#ifdef FILL_PATTERN_TRANSITION 911#pragma mapbox: define mediump vec4 pattern_b 912#endif 913#pragma mapbox: define lowp float pixel_ratio 914#pragma mapbox: define highp float z_offset 915void main() { 916#pragma mapbox: initialize lowp float opacity 917#pragma mapbox: initialize mediump vec4 pattern 918#ifdef FILL_PATTERN_TRANSITION 919#pragma mapbox: initialize mediump vec4 pattern_b 920#endif 921#pragma mapbox: initialize lowp float pixel_ratio 922#pragma mapbox: initialize highp float z_offset 923vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; 924#ifdef ELEVATED_ROADS 925z_offset+=a_road_z_offset; 926#endif 927float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); 928#ifdef FLIP_Y 929v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 930#else 931v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 932#endif 933#ifdef RENDER_SHADOWS 934vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 935#ifdef NORMAL_OFFSET 936vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 937#endif 938v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 939#endif 940#ifdef FOG 941v_fog_pos=fog_position(a_pos); 942#endif 943}`),fillPattern:Jt(`#include "_prelude_fog.fragment.glsl" 944#include "_prelude_lighting.glsl" 945#include "_prelude_shadow.fragment.glsl" 946uniform vec2 u_texsize;uniform sampler2D u_image; 947#ifdef FILL_PATTERN_TRANSITION 948uniform float u_pattern_transition; 949#endif 950in highp vec2 v_pos;uniform float u_emissive_strength; 951#ifdef RENDER_SHADOWS 952uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 953#endif 954#ifdef ELEVATED_ROADS 955in highp float v_road_z_offset; 956#endif 957#ifdef APPLY_LUT_ON_GPU 958uniform highp sampler3D u_lutTexture; 959#endif 960#pragma mapbox: define lowp float opacity 961#pragma mapbox: define lowp vec4 pattern 962#ifdef FILL_PATTERN_TRANSITION 963#pragma mapbox: define mediump vec4 pattern_b 964#endif 965void main() { 966#pragma mapbox: initialize lowp float opacity 967#pragma mapbox: initialize mediump vec4 pattern 968#ifdef FILL_PATTERN_TRANSITION 969#pragma mapbox: initialize mediump vec4 pattern_b 970#endif 971vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 972#ifdef APPLY_LUT_ON_GPU 973out_color=applyLUT(u_lutTexture,out_color); 974#endif 975#ifdef FILL_PATTERN_TRANSITION 976vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 977#endif 978#ifdef LIGHTING_3D_MODE 979out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 980#ifdef RENDER_SHADOWS 981float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 982#ifdef ELEVATED_ROADS 983out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 984#else 985out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 986#endif 987#endif 988#endif 989#ifdef FEATURE_CUTOUT 990out_color=apply_feature_cutout(out_color,gl_FragCoord); 991#endif 992#ifdef FOG 993out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 994#endif 995glFragColor=out_color*opacity; 996#ifdef USE_MRT1 997out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 998#endif 999#ifdef OVERDRAW_INSPECTOR 1000glFragColor=vec4(1.0); 1001#endif 1002HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1003#include "_prelude_shadow.vertex.glsl" 1004uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; 1005#ifdef ELEVATED_ROADS 1006in float a_road_z_offset;out highp float v_road_z_offset; 1007#endif 1008#ifdef RENDER_SHADOWS 1009uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1010#endif 1011out highp vec2 v_pos; 1012#pragma mapbox: define lowp float opacity 1013#pragma mapbox: define lowp vec4 pattern 1014#ifdef FILL_PATTERN_TRANSITION 1015#pragma mapbox: define mediump vec4 pattern_b 1016#endif 1017#pragma mapbox: define lowp float pixel_ratio 1018#pragma mapbox: define highp float z_offset 1019void main() { 1020#pragma mapbox: initialize lowp float opacity 1021#pragma mapbox: initialize mediump vec4 pattern 1022#pragma mapbox: initialize lowp float pixel_ratio 1023#pragma mapbox: initialize highp float z_offset 1024#ifdef FILL_PATTERN_TRANSITION 1025#pragma mapbox: initialize mediump vec4 pattern_b 1026#endif 1027vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 1028#ifdef ELEVATED_ROADS 1029z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 1030#endif 1031float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pa
1031ttern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); 1032#ifdef RENDER_SHADOWS 1033vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 1034#ifdef NORMAL_OFFSET 1035vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 1036#endif 1037v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1038#endif 1039#ifdef FOG 1040v_fog_pos=fog_position(a_pos); 1041#endif 1042}`),fillExtrusion:Jt(`#include "_prelude_fog.fragment.glsl" 1043#include "_prelude_shadow.fragment.glsl" 1044#include "_prelude_lighting.glsl" 1045in vec4 v_color;in vec4 v_flat; 1046#ifdef RENDER_SHADOWS 1047in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 1048#endif 1049uniform lowp float u_opacity; 1050#ifdef FAUX_AO 1051uniform lowp vec2 u_ao;in vec2 v_ao; 1052#endif 1053#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1054in vec4 v_roof_color; 1055#endif 1056#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1057in highp vec3 v_normal; 1058#endif 1059uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 1060#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 1061in float v_flood_radius;in float v_has_floodlight; 1062#endif 1063in float v_height; 1064#pragma mapbox: define highp float emissive_strength 1065void main() { 1066#pragma mapbox: initialize highp float emissive_strength 1067#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1068vec3 normal=normalize(v_normal); 1069#endif 1070float z;vec4 color=v_color; 1071#ifdef ZERO_ROOF_RADIUS 1072z=float(normal.z > 0.00001); 1073#ifdef LIGHTING_3D_MODE 1074normal=mix(normal,vec3(0.0,0.0,1.0),z); 1075#else 1076color=mix(v_color,v_roof_color,z); 1077#endif 1078#endif 1079float h=max(0.0,v_height);float ao_shade=1.0; 1080#ifdef FAUX_AO 1081float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; 1082#ifdef ZERO_ROOF_RADIUS 1083concave*=(1.0-z); 1084#endif 1085float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); 1086#ifdef LIGHTING_3D_MODE 1087#ifdef FLOOD_LIGHT 1088color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 1089#else 1090color.rgb*=ao_shade; 1091#endif 1092#else 1093color.rgb*=ao_shade; 1094#endif 1095#endif 1096#ifdef LIGHTING_3D_MODE 1097float flood_radiance=0.0; 1098#ifdef FLOOD_LIGHT 1099flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 1100#endif 1101#ifdef RENDER_SHADOWS 1102#ifdef FLOOD_LIGHT 1103float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); 1104#else 1105float shadowed_lighting_factor; 1106#ifdef RENDER_CUTOFF 1107shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} 1108#else 1109shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 1110#endif 1111color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 1112#endif 1113#else 1114color.rgb=apply_lighting(color.rgb,normal); 1115#ifdef FLOOD_LIGHT 1116color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 1117#endif 1118#endif 1119color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 1120#endif 1121#ifdef FOG 1122color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 1123#endif 1124#ifdef INDICATOR_CUTOUT 1125color=applyCutout(color,h); 1126#endif 1127#ifdef FEATURE_CUTOUT 1128color=apply_feature_cutout(color,gl_FragCoord); 1129#endif 1130glFragColor=color; 1131#ifdef OVERDRAW_INSPECTOR 1132glFragColor=vec4(1.0); 1133#endif 1134HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1135#include "_prelude_terrain.vertex.glsl" 1136#include "_prelude_shadow.vertex.glsl" 1137#include "_prelude_lighting.glsl" 1138#include "_prelude_material_table.vertex.glsl" 1139uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1140#ifdef RENDER_WALL_MODE 1141in vec3 a_join_normal_inside; 1142#endif 1143#ifdef PROJECTION_GLOBE_VIEW 1144in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 1145#endif 1146#ifdef TERRAIN
1147uniform int u_height_type;uniform int u_base_type; 1148#endif 1149uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; 1150#ifdef RENDER_SHADOWS 1151uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; 1152#endif 1153#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1154out vec4 v_roof_color; 1155#endif 1156#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1157out highp vec3 v_normal; 1158#endif 1159#ifdef FAUX_AO 1160uniform lowp vec2 u_ao;out vec2 v_ao; 1161#endif 1162#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 1163out float v_flood_radius;out float v_has_floodlight; 1164#endif 1165out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 1166#pragma mapbox: define highp float base 1167#pragma mapbox: define highp float height 1168#pragma mapbox: define highp vec4 color 1169#pragma mapbox: define highp float flood_light_wall_radius 1170#pragma mapbox: define highp float line_width 1171#pragma mapbox: define highp float emissive_strength 1172void main() {DECLARE_MATERIAL_TABLE_INFO 1173#pragma mapbox: initialize highp float base 1174#pragma mapbox: initialize highp float height 1175#pragma mapbox: initialize highp vec4 color 1176#pragma mapbox: initialize highp float flood_light_wall_radius 1177#pragma mapbox: initialize highp float line_width 1178#pragma mapbox: initialize highp float emissive_strength 1179base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); 1180#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1181v_normal=normal; 1182#endif 1183base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 1184#if defined(HAS_CENTROID) || defined(TERRAIN) 1185centroid_pos=a_centroid_pos; 1186#endif 1187float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 1188#ifdef TERRAIN 1189bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 1190#else 1191h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); 1192#endif 1193#ifdef PROJECTION_GLOBE_VIEW 1194float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 1195#endif 1196float cutoff=1.0;vec3 scaled_pos=pos; 1197#ifdef RENDER_CUTOFF 1198vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0); 1199#ifdef CLIP_ZERO_TO_ONE 1200cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); 1201#else 1202cutoff=cutoff_opacity(u_cutoff_params,ground.z); 1203#endif 1204if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); 1205#endif 1206float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 1207#ifdef RENDER_WALL_MODE 1208vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5; 1209#endif 1210gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 1211#ifdef RENDER_SHADOWS 1212vec3 shd_pos0=pos;vec3 shd_pos1=pos; 1213#ifdef NORMAL_OFFSET 1214vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 1215#endif 1216v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); 1217#endif 1218float NdotL=0.0;float colorvalue=0.0; 1219#ifndef LIGHTING_3D_MODE 1220colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( 1221(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1222#endif 1223#ifdef FAUX_AO
1224float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 1225#ifdef TERRAIN 1226top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1227#endif 1228v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1229#ifdef PROJECTION_GLOBE_VIEW 1230top_height+=u_height_lift; 1231#endif 1232gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1233#endif 1234#ifdef LIGHTING_3D_MODE 1235#ifdef FLOOD_LIGHT 1236float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; 1237#endif 1238v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); 1239#else 1240v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; 1241#endif 1242#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1243float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; 1244#endif 1245#ifdef FOG 1246v_fog_pos=fog_position(pos); 1247#endif 1248}`),fillExtrusionDepth:Jt(`in highp float v_depth;void main() { 1249#ifndef DEPTH_TEXTURE 1250glFragColor=pack_depth(v_depth); 1251#endif 1252}`,`#include "_prelude_terrain.vertex.glsl" 1253#include "_prelude_material_table.vertex.glsl" 1254uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 1255#ifdef TERRAIN 1256uniform int u_height_type;uniform int u_base_type; 1257#endif 1258in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1259#ifdef RENDER_WALL_MODE 1260in vec3 a_join_normal_inside; 1261#endif 1262#pragma mapbox: define highp float base 1263#pragma mapbox: define highp float height 1264#pragma mapbox: define highp float line_width 1265#pragma mapbox: define highp vec4 color 1266out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO 1267#pragma mapbox: initialize highp float base 1268#pragma mapbox: initialize highp float height 1269#pragma mapbox: initialize highp float line_width 1270#pragma mapbox: initialize highp vec4 color 1271base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 1272#if defined(HAS_CENTROID) || defined(TERRAIN) 1273centroid_pos=a_centroid_pos; 1274#endif 1275vec3 pos; 1276#ifdef TERRAIN 1277bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 1278#else 1279pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 1280#endif 1281#ifdef RENDER_WALL_MODE 1282vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5; 1283#endif 1284float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Jt(`#include "_prelude_fog.fragment.glsl" 1285#include "_prelude_lighting.glsl" 1286uniform vec2 u_texsize;uniform sampler2D u_image; 1287#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1288uniform float u_pattern_transition; 1289#endif 1290#ifdef FAUX_AO 1291uniform lowp vec2 u_ao;in vec3 v_ao; 1292#endif 1293#ifdef LIGHTING_3D_MODE 1294in vec3 v_normal; 1295#endif 1296#ifdef APPLY_LUT_ON_GPU 1297uniform highp sampler3D u_lutTexture; 1298#endif 1299in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 1300#pragma mapbox: define highp float base 1301#pragma mapbox: define highp float height 1302#pragma mapbox: define mediump vec4 pattern 1303#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1304#pragma mapbox: define mediump vec4 pattern_b 1305#endif 1306#pragma mapbox: define highp float pixel_ratio 1307void main() { 1308#pragma mapbox: initialize highp float base 1309#pragma mapbox: initialize highp float height 1310#pragma mapbox: initialize mediump vec4 pattern 1311#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1312#pragma mapbox: initialize mediump vec4 pattern_b 1313#endif 1314#pragma mapbox: initialize highp float pixel_ratio 1315vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 1316#ifdef APPLY_LUT_ON_GPU 1317out_color=applyLUT(u_lutTexture,out_color); 1318#endif 1319#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1320vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 1321#endif 1322#ifdef LIGHTING_3D_MODE 1323out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 1324#else 1325out_color=out_color*v_lighting; 1326#endif 1327#ifdef FAUX_AO 1328float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1328),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; 1329#endif 1330#ifdef FOG 1331out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1332#endif 1333#ifdef INDICATOR_CUTOUT 1334out_color=applyCutout(out_color,height); 1335#endif 1336glFragColor=out_color; 1337#ifdef OVERDRAW_INSPECTOR 1338glFragColor=vec4(1.0); 1339#endif 1340HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1341#include "_prelude_terrain.vertex.glsl" 1342#include "_prelude_lighting.glsl" 1343#include "_prelude_material_table.vertex.glsl" 1344uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 1345#ifdef RENDER_WALL_MODE 1346in vec3 a_join_normal_inside; 1347#endif 1348#ifdef PROJECTION_GLOBE_VIEW 1349in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 1350#endif 1351#ifdef TERRAIN 1352uniform int u_height_type;uniform int u_base_type; 1353#endif 1354out highp vec2 v_pos;out vec4 v_lighting; 1355#ifdef FAUX_AO 1356uniform lowp vec2 u_ao;out vec3 v_ao; 1357#endif 1358#ifdef LIGHTING_3D_MODE 1359out vec3 v_normal; 1360#endif 1361#pragma mapbox: define highp float base 1362#pragma mapbox: define highp float height 1363#pragma mapbox: define highp vec4 color 1364#pragma mapbox: define mediump vec4 pattern 1365#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1366#pragma mapbox: define mediump vec4 pattern_b 1367#endif 1368#pragma mapbox: define highp float pixel_ratio 1369#pragma mapbox: define highp float line_width 1370void main() {DECLARE_MATERIAL_TABLE_INFO 1371#pragma mapbox: initialize highp float base 1372#pragma mapbox: initialize highp float height 1373#pragma mapbox: initialize highp vec4 color 1374#pragma mapbox: initialize mediump vec4 pattern 1375#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1376#pragma mapbox: initialize mediump vec4 pattern_b 1377#endif 1378#pragma mapbox: initialize highp float pixel_ratio 1379#pragma mapbox: initialize highp float line_width 1380vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); 1381#if defined(HAS_CENTROID) || defined(TERRAIN) 1382centroid_pos=a_centroid_pos; 1383#endif 1384float ele=0.0;float h=z;vec3 p;float c_ele; 1385#ifdef TERRAIN 1386bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); 1387#else 1388p=vec3(pos_nx.xy,z); 1389#endif 1390#ifdef PROJECTION_GLOBE_VIEW 1391float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 1392#endif 1393#ifdef RENDER_WALL_MODE 1394vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5; 1395#endif 1396float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 1397? pos_nx.xy 1398: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; 1399#ifdef LIGHTING_3D_MODE 1400NdotL=calculate_NdotL(normal); 1401#else 1402NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 1403#endif 1404if (normal.y !=0.0) {float r=0.84; 1405#ifndef LIGHTING_3D_MODE 1406r=mix(0.7,0.98,1.0-u_lightintensity); 1407#endif 1408NdotL*=( 1409(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1410#ifdef FAUX_AO
1411float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 1412#ifdef TERRAIN 1413top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1414#endif 1415v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 1416#ifdef PROJECTION_GLOBE_VIEW 1417top_height+=u_height_lift; 1418#endif 1419gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1420#endif 1421#ifdef LIGHTING_3D_MODE 1422v_normal=normal; 1423#else 1424v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 1425#endif 1426#ifdef FOG 1427v_fog_pos=fog_position(p); 1428#endif 1429}`),groundShadow:Jt(`#include "_prelude_shadow.fragment.glsl" 1430precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1431#ifdef FOG 1432in float v_fog_opacity; 1433#endif 1434void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); 1435#ifdef RENDER_CUTOFF 1436shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 1437#endif 1438#ifdef FOG 1439shadow=mix(shadow,vec3(1.0),v_fog_opacity); 1440#endif 1441#ifdef INDICATOR_CUTOUT 1442shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 1443#endif 1444glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 1445uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; 1446#ifdef FOG 1447out float v_fog_opacity; 1448#endif 1449void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); 1450#ifdef FOG 1451v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); 1452#endif 1453}`),fillExtrusionGroundEffect:Jt(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; 1454#ifdef SDF_SUBPASS 1455in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} 1456#ifdef FOG 1457in highp float v_fog; 1458#endif 1459#endif 1460void main() { 1461#ifdef CLEAR_SUBPASS 1462vec4 color=vec4(1.0); 1463#ifdef CLEAR_FROM_TEXTURE 1464color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 1465#endif 1466glFragColor=color; 1467#else 1468#ifdef SDF_SUBPASS 1469highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; 1470#ifdef FOG 1471fog=v_fog; 1472#endif 1473#ifdef RENDER_CUTOFF 1474fog*=v_cutoff_opacity; 1475#endif 1476glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 1477#else 1478#ifdef USE_MRT1 1479out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0); 1480#else 1481vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 1482#ifdef OVERDRAW_INSPECTOR 1483color=vec4(1.0); 1484#endif 1485glFragColor=color; 1486#endif 1487#endif 1488HANDLE_WIREFRAME_DEBUG; 1489#endif 1490}`,`#include "_prelude_fog.vertex.glsl" 1491in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; 1492#ifdef SDF_SUBPASS 1493out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 1494#ifdef FOG 1495out highp float v_fog; 1496#endif 1497#endif 1498uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
1499#pragma mapbox: define highp float flood_light_ground_radius 1500const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { 1501#pragma mapbox: initialize highp float flood_light_ground_radius 1502vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; 1503#ifdef SDF_SUBPASS 1504v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); 1505#ifdef FOG 1506v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 1507#endif 1508#endif 1509float hidden_by_landmark=0.0; 1510#ifdef HAS_CENTROID 1511hidden_by_landmark=a_hidden_by_landmark; 1512#endif 1513float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); 1514#ifdef RENDER_CUTOFF 1515v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 1516#endif 1517}`),hillshadePrepare:Jt(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( 1518(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 1519)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 1520deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Jt(`#include "_prelude_fog.fragment.glsl" 1521#include "_prelude_lighting.glsl" 1522uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; 1523#ifdef LIGHTING_3D_MODE 1524glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 1525#endif 1526#ifdef FOG 1527glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 1528#endif 1529#ifdef USE_MRT1 1530out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1531#endif 1532#ifdef OVERDRAW_INSPECTOR 1533glFragColor=vec4(1.0); 1534#endif 1535HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1536uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; 1537#ifdef FOG 1538v_fog_pos=fog_position(a_pos); 1539#endif 1540}`),line:Jt(`#include "_prelude_fog.fragment.glsl" 1541#include "_prelude_lighting.glsl" 1542#include "_prelude_shadow.fragment.glsl" 1543uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1543uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; 1544#ifdef ELEVATED_ROADS 1545in highp float v_road_z_offset; 1546#endif 1547#ifdef RENDER_LINE_DASH 1548uniform sampler2D u_dash_image;in vec2 v_tex; 1549#endif 1550#ifdef RENDER_LINE_GRADIENT 1551uniform sampler2D u_gradient_image; 1552#endif 1553#ifdef INDICATOR_CUTOUT 1554in highp float v_z_offset; 1555#endif 1556#ifdef RENDER_SHADOWS 1557uniform 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; 1558#endif 1559float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} 1560#pragma mapbox: define highp vec4 color 1561#pragma mapbox: define lowp float floorwidth 1562#pragma mapbox: define lowp vec4 dash 1563#pragma mapbox: define lowp float blur 1564#pragma mapbox: define lowp float opacity 1565#pragma mapbox: define mediump float side_z_offset 1566#pragma mapbox: define lowp float border_width 1567#pragma mapbox: define lowp vec4 border_color 1568#pragma mapbox: define lowp float emissive_strength 1569float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 1570#pragma mapbox: initialize highp vec4 color 1571#pragma mapbox: initialize lowp float floorwidth 1572#pragma mapbox: initialize lowp vec4 dash 1573#pragma mapbox: initialize lowp float blur 1574#pragma mapbox: initialize lowp float opacity 1575#pragma mapbox: initialize mediump float side_z_offset 1576#pragma mapbox: initialize lowp float border_width 1577#pragma mapbox: initialize lowp vec4 border_color 1578#pragma mapbox: initialize lowp float emissive_strength 1579float 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);alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha; 1580#ifdef RENDER_LINE_DASH 1581float sdfdist=texture(u_dash_image,v_tex).r;
1581float 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); 1582#endif 1583highp vec4 out_color; 1584#ifdef RENDER_LINE_GRADIENT 1585out_color=texture(u_gradient_image,v_uv.xy); 1586#ifdef MULTIPLY_LINE_GRADIENT_COLOR 1587out_color*=color; 1588#endif 1589#else 1590out_color=color; 1591#endif 1592float trim_alpha=1.0; 1593#ifdef RENDER_LINE_TRIM_OFFSET 1594highp 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;} 1595#endif 1596if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 1597#ifdef RENDER_LINE_BORDER 1598float 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);}} 1599#endif 1600#ifdef LIGHTING_3D_MODE 1601out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1602#ifdef RENDER_SHADOWS 1603float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1604#ifdef ELEVATED_ROADS 1605out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1606#else 1607out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1608#endif 1609#endif 1610#endif 1611#ifdef FOG 1612out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1613#endif 1614out_color*=(alpha*opacity); 1615#ifdef INDICATOR_CUTOUT 1616out_color=applyCutout(out_color,v_z_offset); 1617#endif 1618#ifdef FEATURE_CUTOUT 1619out_color=apply_feature_cutout(out_color,gl_FragCoord); 1620#endif 1621glFragColor=out_color; 1622#ifdef DUAL_SOURCE_BLENDING 1623glFragColorSrc1=vec4(vec3(0.0),emissive_strength); 1624#else 1625#ifdef USE_MRT1 1626out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1627#endif 1628#endif 1629#ifdef OVERDRAW_INSPECTOR 1630glFragColor=vec4(1.0); 1631#endif 1632HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1633#include "_prelude_shadow.vertex.glsl" 1634#include "_prelude_terrain.vertex.glsl" 1635#define EXTRUDE_SCALE 0.015873016 1636in vec2 a_pos_normal;in vec4 a_data; 1637#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) 1638in vec3 a_z_offset_width; 1639#endif 1640#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1641in highp vec3 a_packed; 1642#endif 1643#ifdef RENDER_LINE_DASH 1644in float a_linesofar; 1645#endif 1646uniform 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; 1647#ifdef ELEVATED 1648uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1649#ifdef ELEVATION_REFERENCE_SEA 1650return 0.0; 1651#else 1652return elevation(apos); 1653#endif 1654} 1655#endif 1656out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; 1657#ifdef ELEVATED_ROADS 1658out highp float v_road_z_offset; 1659#endif 1660#ifdef RENDER_LINE_DASH 1661uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 1662#endif 1663#ifdef RENDER_LINE_GRADIENT 1664uniform float u_image_height; 1665#endif 1666#ifdef INDICATOR_CUTOUT 1667out highp float v_z_offset; 1668#endif 1669#ifdef RENDER_SHADOWS 1670uniform 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; 1671#endif 1672#pragma mapbox: define highp vec4 color 1673#pragma mapbox: define lowp float floorwidth 1674#pragma mapbox: define lowp vec4 dash 1675#pragma mapbox: define lowp float blur 1676#pragma mapbox: define lowp float opacity 1677#pragma mapbox: define mediump float gapwidth 1678#pragma mapbox: define lowp float offset 1679#pragma mapbox: define mediump float width 1680#pragma mapbox: define mediump float side_z_offset 1681#pragma mapbox: define lowp float border_width 1682#pragma mapbox: define lowp vec4 border_color 1683#pragma mapbox: define lowp float emissive_strength 1684void main() { 1685#pragma mapbox: initialize highp vec4 color 1686#pragma mapbox: initialize lowp float floorwidth 1687#pragma mapbox: initialize lowp vec4 dash 1688#pragma mapbox: initialize lowp float blur 1689#pragma mapbox: initialize lowp float opacity 1690#pragma mapbox: initialize mediump float gapwidth 1691#pragma mapbox: initialize lowp float offset 1692#pragma mapbox: initialize mediump float width 1693#pragma mapbox: initialize mediump float side_z_offset 1694#pragma mapbox: initialize lowp float border_width 1695#pragma mapbox: initialize lowp vec4 border_color 1696#pragma mapbox: initialize lowp float emissive_strength 1697float a_z_offset; 1698#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1699a_z_offset=a_z_offset_width.x; 1700#endif 1701float 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; 1702#ifdef VARIABLE_LINE_WIDTH 1703bool left=normal.y==1.0;halfwidth=(u_width_scale*(left ? a_z_offset_width.y : a_z_offset_width.z))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal; 1704#else 1705halfwidth=(u_width_scale*width)/2.0; 1706#endif 1707offset=-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;
1707vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1708#ifdef ELEVATED_ROADS 1709v_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; 1710#else 1711#ifdef ELEVATED 1712vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1713#ifdef CROSS_SLOPE_VERTICAL 1714float 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); 1715#else 1716#ifdef CROSS_SLOPE_HORIZONTAL 1717float 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; 1718#else 1719float 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; 1720#endif 1721#endif 1722gl_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); 1723#else 1724gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1725#endif 1726#endif 1727#ifdef ELEVATED_ROADS 1728#ifdef RENDER_SHADOWS 1729vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1730#ifdef NORMAL_OFFSET 1731vec3 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(); 1732#endif 1733v_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; 1734#endif 1735#endif 1736#ifndef RENDER_TO_TEXTURE 1737float 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)); 1738#else 1739v_gamma_scale=1.0; 1740#endif 1741#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1742highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; 1743#ifdef RENDER_LINE_GRADIENT 1744highp 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); 1745#else 1746v_uv=vec3(a_uv_x,0.0,line_progress); 1747#endif 1748#endif 1749#ifdef RENDER_LINE_DASH 1750float 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); 1751#endif 1752v_width2=vec2(outset,inset); 1753#ifdef FOG 1754v_fog_pos=fog_position(pos); 1755#endif 1756#ifdef INDICATOR_CUTOUT 1757v_z_offset=a_z_offset; 1758#endif 1759}`),linePattern:Jt(`#include "_prelude_fog.fragment.glsl" 1760#include "_prelude_lighting.glsl" 1761#include "_prelude_shadow.fragment.glsl" 1762uniform 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; 1763#ifdef APPLY_LUT_ON_GPU 1764uniform highp sampler3D u_lutTexture; 1765#endif 1766#ifdef LINE_PATTERN_TRANSITION 1767uniform float u_pattern_transition; 1768#endif 1769in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 1770#ifdef RENDER_LINE_TRIM_OFFSET 1771in highp vec3 v_uv; 1772#endif 1773#ifdef ELEVATED_ROADS 1774in highp float v_road_z_offset; 1775#endif 1776#ifdef LINE_JOIN_NONE 1777in vec2 v_pattern_data; 1778#endif 1779#ifdef INDICATOR_CUTOUT 1780in highp float v_z_offset; 1781#endif 1782#ifdef RENDER_SHADOWS 1783uniform 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; 1784#endif 1785#pragma mapbox: define mediump vec4 pattern 1786#ifdef LINE_PATTERN_TRANSITION 1787#pragma mapbox: define mediump vec4 pattern_b 1788#endif 1789#pragma mapbox: define mediump float pixel_ratio 1790#pragma mapbox: define mediump float blur 1791#pragma mapbox: define mediump float opacity 1792#pragma mapbox: define lowp float emissive_strength 1793void main() { 1794#pragma mapbox: initialize mediump vec4 pattern 1795#ifdef LINE_PATTERN_TRANSITION 1796#pragma mapbox: initialize mediump vec4 pattern_b 1797#endif 1798#pragma mapbox: initialize mediump float pixel_ratio 1799#pragma mapbox: initialize mediump float blur 1800#pragma mapbox: initialize mediump float opacity 1801#pragma mapbox: initialize lowp float emissive_strength 1802vec2 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); 1803#ifdef APPLY_LUT_ON_GPU 1804color=applyLUT(u_lutTexture,color); 1805#endif 1806#ifdef LINE_PATTERN_TRANSITION 1807vec2 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; 1808#endif 1809#ifdef RENDER_LINE_TRIM_OFFSET 1810highp 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);} 1811#endif 1812#ifdef LINE_JOIN_NONE 1813highp 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);} 1814#endif 1815#ifdef LIGHTING_3D_MODE 1816color=apply_lighting_with_emission_ground(color,emissive_strength); 1817#ifdef RENDER_SHADOWS 1818float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1819#ifdef ELEVATED_ROADS 1820color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1821#else 1822color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1823#endif 1824#endif 1825#endif 1826#ifdef FOG 1827color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1828#endif 1829color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 1830#ifdef INDICATOR_CUTOUT 1831color=applyCutout(color,v_z_offset); 1832#endif 1833glFragColor=color; 1834#ifdef DUAL_SOURCE_BLENDING 1835glFragColorSrc1=vec4(vec3(0.0),emissive_strength); 1836#else 1837#ifdef USE_MRT1 1838out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1839#endif 1840#endif 1841#ifdef OVERDRAW_INSPECTOR 1842glFragColor=vec4(1.0); 1843#endif 1844HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1845#include "_prelude_shadow.vertex.glsl" 1846#include "_prelude_terrain.vertex.glsl" 1847#define scale 0.015873016 1848in vec2 a_pos_normal;in vec4 a_data; 1849#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1850in vec3 a_z_offset_width; 1851#endif 1852#ifdef RENDER_LINE_TRIM_OFFSET 1853in highp vec3 a_packed; 1854#endif 1855in highp float a_linesofar; 1856#ifdef LINE_JOIN_NONE 1857in highp vec3 a_pattern_data;out vec2 v_pattern_data; 1858#endif 1859#ifdef INDICATOR_CUTOUT 1860out highp float v_z_offset; 1861#endif 1862uniform 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; 1863#ifdef ELEVATED 1864uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1865#ifdef ELEVATION_REFERENCE_SEA 1866return 0.0; 1867#else 1868return elevation(apos); 1869#endif 1870} 1871#endif 1872out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 1873#ifdef RENDER_LINE_TRIM_OFFSET 1874out highp vec3 v_uv; 1875#endif 1876#ifdef ELEVATED_ROADS 1877out highp float v_road_z_offset; 1878#endif 1879#ifdef RENDER_SHADOWS 1880uniform 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; 1881#endif 1882#pragma mapbox: define mediump float blur 1883#pragma mapbox: define mediump float opacity 1884#pragma mapbox: define mediump float offset 1885#pragma mapbox: define mediump float gapwidth 1886#pragma mapbox: define mediump float width 1887#pragma mapbox: define mediump float floorwidth 1888#pragma mapbox: define mediump vec4 pattern 1889#ifdef LINE_PATTERN_TRANSITION 1890#pragma mapbox: define mediump vec4 pattern_b 1891#endif 1892#pragma mapbox: define mediump float pixel_ratio 1893#pragma mapbox: define lowp float emissive_strength 1894void main() { 1895#pragma mapbox: initialize mediump float blur 1896#pragma mapbox: initialize mediump float opacity 1897#pragma mapbox: initialize mediump float offset 1898#pragma mapbox: initialize mediump float gapwidth 1899#pragma mapbox: initialize mediump float width 1900#pragma mapbox: initialize mediump float floorwidth 1901#pragma mapbox: initialize mediump vec4 pattern 1902#ifdef LINE_PATTERN_TRANSITION 1903#pragma mapbox: initialize mediump vec4 pattern_b 1904#endif 1905#pragma mapbox: initialize mediump float pixel_ratio 1906#pragma mapbox: initialize lowp float emissive_strength 1907float a_z_offset; 1908#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1909a_z_offset=a_z_offset_width.x; 1910#endif 1911float 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;
1911vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1912#ifdef ELEVATED_ROADS 1913v_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; 1914#else 1915#ifdef ELEVATED 1916vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 1917#ifdef CROSS_SLOPE_VERTICAL 1918float 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); 1919#else 1920#ifdef CROSS_SLOPE_HORIZONTAL 1921float 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; 1922#else 1923float 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; 1924#endif 1925#endif 1926gl_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); 1927#else 1928gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1929#endif 1930#endif 1931#ifdef ELEVATED_ROADS 1932#ifdef RENDER_SHADOWS 1933vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1934#ifdef NORMAL_OFFSET 1935vec3 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(); 1936#endif 1937v_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; 1938#endif 1939#endif 1940#ifndef RENDER_TO_TEXTURE 1941float 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)); 1942#else 1943v_gamma_scale=1.0; 1944#endif 1945#ifdef RENDER_LINE_TRIM_OFFSET 1946highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 1947#endif 1948v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 1949#ifdef LINE_JOIN_NONE 1950v_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); 1951#endif 1952#ifdef FOG 1953v_fog_pos=fog_position(pos); 1954#endif 1955#ifdef INDICATOR_CUTOUT 1956v_z_offset=a_z_offset; 1957#endif 1958}`),raster:Jt(`#include "_prelude_fog.fragment.glsl" 1959#include "_prelude_lighting.glsl" 1960#include "_prelude_raster_array.glsl" 1961uniform 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; 1962#ifdef PROJECTION_GLOBE_VIEW 1963in float v_split_fade; 1964#endif 1965uniform 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; 1966#ifndef RASTER_ARRAY 1967uniform highp sampler2D u_image0;uniform sampler2D u_image1; 1968#endif 1969#ifdef RASTER_COLOR 1970uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 1971#endif 1972void main() {vec4 color0,color1,color;vec2 value; 1973#ifdef RASTER_COLOR 1974#ifdef RASTER_ARRAY 1975#ifdef RASTER_ARRAY_LINEAR 1976value=mix( 1977raTexture2D_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 1978); 1979#else 1980value=mix( 1981raTexture2D_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 1982); 1983#endif 1984if (value.y > 0.0) value.x/=value.y; 1985#else 1986color=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); 1987#endif 1988color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 1989#else 1990color0=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); 1991#endif 1992color.a*=u_opacity; 1993#ifdef GLOBE_POLES 1994color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 1995#endif 1996vec3 rgb=color.rgb;rgb=vec3( 1997dot(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); 1998#ifdef LIGHTING_3D_MODE 1999out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 2000#endif 2001#ifdef FOG 2002highp 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)); 2003#endif 2004glFragColor=vec4(out_color*color.a,color.a); 2005#ifdef PROJECTION_GLOBE_VIEW 2006glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 2007#endif 2008#ifdef RENDER_CUTOFF 2009glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 2010#endif 2011#ifdef OVERDRAW_INSPECTOR 2012glFragColor=vec4(1.0); 2013#endif 2014#ifdef USE_MRT1 2015out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 2016#endif 2017HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2018uniform 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; 2019#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 2020#ifdef GLOBE_POLES 2021in vec3 a_globe_pos;in vec2 a_uv; 2022#else 2023in vec2 a_pos;in vec2 a_texture_pos; 2024#endif 2025out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 2026#ifdef PROJECTION_GLOBE_VIEW 2027out float v_split_fade; 2028#endif 2029void main() {vec2 uv; 2030#ifdef GLOBE_POLES 2031vec3 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; 2032#ifdef FOG 2033v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 2034#endif 2035#else 2036float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; 2037#ifdef PROJECTION_GLOBE_VIEW 2038vec3 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]); 2039v_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];
2039if (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; 2040#ifdef FOG 2041v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2042#endif 2043#else 2044gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 2045#ifdef FOG 2046v_fog_pos=fog_position(a_pos); 2047#endif 2048#endif 2049#endif 2050v_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; 2051#ifdef RENDER_CUTOFF 2052v_depth=gl_Position.z; 2053#endif 2054}`),rasterParticle:Jt(`#include "_prelude_fog.fragment.glsl" 2055#include "_prelude_lighting.glsl" 2056uniform 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; 2057#ifdef LIGHTING_3D_MODE 2058out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; 2059#endif 2060#ifdef FOG 2061highp 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)); 2062#endif 2063glFragColor=vec4(out_color*color.a,color.a); 2064#ifdef OVERDRAW_INSPECTOR 2065glFragColor=vec4(1.0); 2066#endif 2067HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2068uniform 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; 2069#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 2070in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 2071#ifdef PROJECTION_GLOBE_VIEW 2072vec3 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; 2073#ifdef FOG 2074v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2075#endif 2076#else 2077uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 2078#ifdef FOG 2079v_fog_pos=fog_position(a_pos); 2080#endif 2081#endif 2082v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Jt("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" 2083in 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( 2084mod(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:Jt("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:Jt(`#include "_prelude_raster_particle.glsl" 2085uniform 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;
2085vec2 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( 2086linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 2087);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:Jt(`#include "_prelude_lighting.glsl" 2088#include "_prelude_shadow.fragment.glsl" 2089#define SDF_PX 8.0 2090#define SDF 1.0 2091#define ICON 0.0 2092uniform 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; 2093#ifdef ICON_TRANSITION 2094uniform float u_icon_transition; 2095#endif 2096#ifdef COLOR_ADJUSTMENT 2097uniform mat4 u_color_adj_mat; 2098#endif 2099#ifdef INDICATOR_CUTOUT 2100in highp float v_z_offset; 2101#else 2102#ifdef RENDER_SHADOWS 2103in highp float v_z_offset; 2104#endif 2105#endif 2106in vec2 v_tex_a; 2107#ifdef ICON_TRANSITION 2108in vec2 v_tex_b; 2109#endif 2110in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 2111#ifdef RENDER_TEXT_AND_SYMBOL 2112in float is_sdf;in vec2 v_tex_a_icon; 2113#endif 2114#ifdef RENDER_SHADOWS 2115uniform 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; 2116#endif 2117#ifdef APPLY_LUT_ON_GPU 2118uniform highp sampler3D u_lutTexture; 2119#endif 2120#pragma mapbox: define highp vec4 fill_color 2121#pragma mapbox: define highp vec4 halo_color 2122#pragma mapbox: define lowp float opacity 2123#pragma mapbox: define lowp float halo_width 2124#pragma mapbox: define lowp float halo_blur 2125#pragma mapbox: define lowp float emissive_strength 2126void main() { 2127#pragma mapbox: initialize highp vec4 fill_color 2128#pragma mapbox: initialize highp vec4 halo_color 2129#pragma mapbox: initialize lowp float opacity 2130#pragma mapbox: initialize lowp float halo_width 2131#pragma mapbox: initialize lowp float halo_blur 2132#pragma mapbox: initialize lowp float emissive_strength 2133vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 2134#ifdef RENDER_TEXT_AND_SYMBOL 2135if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; 2136#ifdef OVERDRAW_INSPECTOR 2137glFragColor=vec4(1.0); 2138#endif 2139return;} 2140#endif 2141#ifdef RENDER_SDF 2142float 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; 2143#else 2144#ifdef ICON_TRANSITION 2145vec4 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); 2146#else 2147out_color=texture(u_texture,v_tex_a); 2148#endif 2149#ifdef APPLY_LUT_ON_GPU 2150out_color=applyLUT(u_lutTexture,out_color); 2151#endif 2152#ifdef COLOR_ADJUSTMENT 2153out_color=u_color_adj_mat*out_color; 2154#endif 2155#endif 2156out_color*=opacity*fade_opacity; 2157#ifdef LIGHTING_3D_MODE 2158out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 2159#ifdef RENDER_SHADOWS 2160float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 2161#ifdef TERRAIN 2162out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 2163#else 2164out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 2165#endif 2166#endif 2167#endif 2168#ifdef INDICATOR_CUTOUT 2169out_color=applyCutout(out_color,v_z_offset); 2170#endif 2171#ifdef FEATURE_CUTOUT 2172out_color=apply_feature_cutout(out_color,gl_FragCoord); 2173#endif 2174glFragColor=out_color; 2175#ifdef OVERDRAW_INSPECTOR 2176glFragColor=vec4(1.0); 2177#endif 2178HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 2179#include "_prelude_shadow.vertex.glsl" 2180#define APPEARANCE_ICON 1.0 2181in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 2182#ifdef Z_OFFSET 2183in float a_auto_z_offset; 2184#endif 2185#ifdef PROJECTION_GLOBE_VIEW 2186in vec3 a_globe_anchor;in vec3 a_globe_normal; 2187#endif 2188#ifdef ICON_TRANSITION 2189in vec2 a_texb; 2190#endif 2191#ifdef OCCLUSION_QUERIES 2192in float a_occlusion_query_opacity; 2193#endif 2194#ifdef ELEVATED_ROADS 2195in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; 2196#endif 2197#ifdef INDICATOR_CUTOUT 2198out highp float v_z_offset; 2199#else 2200#ifdef RENDER_SHADOWS 2201out highp float v_z_offset; 2202#endif 2203#endif 2204uniform 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; 2205#ifdef PROJECTION_GLOBE_VIEW 2206uniform 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; 2207#endif 2208out vec2 v_tex_a; 2209#ifdef ICON_TRANSITION 2210out vec2 v_tex_b; 2211#endif 2212out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 2213#ifdef RENDER_TEXT_AND_SYMBOL 2214out float is_sdf;out vec2 v_tex_a_icon; 2215#endif 2216#ifdef RENDER_SHADOWS 2217uniform 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; 2218#endif 2219#pragma mapbox: define highp vec4 fill_color 2220#pragma mapbox: define highp vec4 halo_color 2221#pragma mapbox: define lowp float opacity 2222#pragma mapbox: define lowp float halo_width 2223#pragma mapbox: define lowp float halo_blur 2224#pragma mapbox: define lowp float emissive_strength 2225#pragma mapbox: define lowp float occlusion_opacity 2226#pragma mapbox: define lowp float z_offset 2227void main() { 2228#pragma mapbox: initialize highp vec4 fill_color 2229#pragma mapbox: initialize highp vec4 halo_color 2230#pragma mapbox: initialize lowp float opacity 2231#pragma mapbox: initialize lowp float halo_width 2232#pragma mapbox: initialize lowp float halo_blur 2233#pragma mapbox: initialize lowp float emissive_strength 2234#pragma mapbox: initialize lowp float occlusion_opacity 2235#pragma mapbox: initialize lowp float z_offset 2236vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance_icon=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance_icon==APPEARANCE_ICON) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); 2237#ifdef Z_OFFSET 2238e+=a_auto_z_offset; 2239#endif 2240vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 2241#ifdef PROJECTION_GLOBE_VIEW 2242mercator_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; 2243#else 2244world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 2245#endif 2246vec4 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 ? 2247camera_to_anchor_distance/u_camera_to_center_distance : 2248u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 22490.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; 2250#ifdef PROJECTION_GLOBE_VIEW 2251vec3 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; 2252#else 2253offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 2254#endif 2255vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 2256#ifdef PROJECTION_GLOBE_VIEW 2257#ifdef PROJECTED_POS_ON_VIEWPORT 2258projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 2259#else 2260vec3 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); 2261#endif 2262#else 2263projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 2264#endif 2265highp 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); 2266#ifdef TERRAIN 2267#ifdef PITCH_WITH_MAP_TERRAIN 2268vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 2269#endif 2270#endif 2271#ifdef Z_OFFSET 2272z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; 2273#else 2274z+=u_pitch_with_map ? z_offset : 0.0; 2275#endif 2276float 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)); 2277#ifdef DEPTH_OCCLUSION 2278float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 2279#endif 2280#ifdef OCCLUSION_QUERIES 2281float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 2282#endif 2283#ifdef Z_TEST_OCCLUSION 2284out_fade_opacity*=occlusion_opacity; 2285#endif 2286float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; 2287#ifdef PROJECTION_GLOBE_VIEW 2288vec3 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; 2289#else 2290#ifdef ELEVATED_ROADS 2291vec3 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; 2292#else 2293pos=vec3(projected_pos.xy/projected_pos.w+offset,z); 2294#endif 2295#endif 2296gl_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; 2297#ifdef RENDER_TEXT_AND_SYMBOL 2298is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 2299#endif 2300#ifdef ICON_TRANSITION 2301v_tex_b=a_texb/u_texsize; 2302#endif 2303#ifdef RENDER_SHADOWS 2304vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; 2305#ifdef NORMAL_OFFSET 2306vec3 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(); 2307#endif 2308v_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; 2309#endif 2310#ifdef INDICATOR_CUTOUT 2311v_z_offset=e; 2312#else 2313#ifdef RENDER_SHADOWS 2314v_z_offset=e; 2315#endif 2316#endif 2317}`),terrainRaster:Jt(`#include "_prelude_fog.fragment.glsl" 2318#include "_prelude_shadow.fragment.glsl" 2319#include "_prelude_lighting.glsl" 2320uniform sampler2D u_image0; 2321#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2322uniform sampler2D u_image1;uniform float u_emissive_texture_available; 2323#endif 2324in vec2 v_pos0; 2325#ifdef FOG 2326in float v_fog_opacity; 2327#endif 2328#ifdef RENDER_SHADOWS 2329in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 2330#endif 2331uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 2332#ifdef LIGHTING_3D_MODE 2333const vec3 normal=vec3(0.0,0.0,1.0); 2334#ifdef RENDER_SHADOWS 2335float cutoffOpacity=1.0; 2336#ifdef RENDER_CUTOFF 2337cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 2338#endif 2339#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2340float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; 2341#else 2342float 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)); 2343#endif 2344#else 2345float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 2346#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2347float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0; 2348#endif 2349#endif 2350#else 2351color=image_color; 2352#endif 2353#ifdef FOG 2354#ifdef ZERO_EXAGGERATION 2355color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2356#else 2357color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 2358#endif 2359#endif 2360glFragColor=color; 2361#ifdef OVERDRAW_INSPECTOR 2362glFragColor=vec4(1.0); 2363#endif 2364HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2365#include "_prelude_terrain.vertex.glsl" 2366uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; 2367#ifdef FOG 2368out float v_fog_opacity; 2369#endif 2370#ifdef RENDER_SHADOWS 2371uniform 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; 2372#endif 2373void 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); 2374#ifdef FOG 2375#ifdef ZERO_EXAGGERATION 2376v_fog_pos=fog_position(decodedPos); 2377#else 2378v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 2379#endif 2380#endif 2381#ifdef RENDER_SHADOWS 2382vec3 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.); 2383#endif 2384}`),terrainDepth:Jt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 2385uniform 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:Jt(`#include "_prelude_fog.fragment.glsl" 2386in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( 2387cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
2387nd-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; 2388#ifdef FOG 2389sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 2390#endif 2391sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 2392#ifdef OVERDRAW_INSPECTOR 2393glFragColor=vec4(1.0); 2394#endif 2395}`,Oc),skyboxGradient:Jt(`#include "_prelude_fog.fragment.glsl" 2396in 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)); 2397#ifdef FOG 2398color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 2399#endif 2400color*=u_opacity;glFragColor=color; 2401#ifdef OVERDRAW_INSPECTOR 2402glFragColor=vec4(1.0); 2403#endif 2404}`,Oc),skyboxCapture:Jt(` 2405in 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; 2406#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 2407#define BETA_M vec3(21e-6,21e-6,21e-6) 2408#define MIE_G 0.76 2409#define DENSITY_HEIGHT_SCALE_R 8000.0 2410#define DENSITY_HEIGHT_SCALE_M 1200.0 2411#define PLANET_RADIUS 6360e3 2412#define ATMOSPHERE_RADIUS 6420e3 2413#define SAMPLE_STEPS 10 2414#define DENSITY_STEPS 4 2415float 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);}
2415float 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))/(e
2415nd-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);}"),globeRaster:Jt(`#include "_prelude_fog.fragment.glsl" 2416#include "_prelude_lighting.glsl" 2417uniform sampler2D u_image0; 2418#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2419uniform sampler2D u_image1;uniform float u_emissive_texture_available; 2420#endif 2421uniform float u_far_z_cutoff;in vec2 v_pos0; 2422#ifndef FOG 2423uniform 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; 2424#endif 2425void main() {vec4 color; 2426#ifdef CUSTOM_ANTIALIASING 2427highp vec2 uv=gl_FragCoord.xy/u_viewport; 2428#ifdef FLIP_Y 2429uv.y=1.0-uv.y; 2430#endif 2431highp vec3 ray_dir=mix( 2432mix(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); 2433#ifdef LIGHTING_3D_MODE 2434#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2435float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); 2436#else 2437raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 2438#endif 2439#else 2440color=vec4(raster.rgb*antialias,raster.a*antialias); 2441#endif 2442#else 2443color=texture(u_image0,v_pos0); 2444#ifdef LIGHTING_3D_MODE 2445#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2446float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0; 2447#else 2448color=apply_lighting_ground(color); 2449#endif 2450#endif 2451#endif 2452#ifdef FOG 2453color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2454#endif 2455color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 2456#ifdef OVERDRAW_INSPECTOR 2457glFragColor=vec4(1.0); 2458#endif 2459HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2460#include "_prelude_terrain.vertex.glsl" 2461uniform 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; 2462#ifdef GLOBE_POLES 2463in vec3 a_globe_pos;in vec2 a_uv; 2464#else 2465in vec2 a_pos; 2466#endif 2467out vec2 v_pos0;void main() { 2468#ifdef GLOBE_POLES 2469vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 2470#else 2471float 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); 2472#endif 2473v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 2474#ifdef GLOBE_POLES 2475vec3 up_vector=globe_derived_up_vector; 2476#else 2477vec3 up_vector=elevationVector(tile_pos); 2478#endif 2479float height=elevation(tile_pos);globe_pos+=up_vector*height; 2480#ifndef GLOBE_POLES 2481globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 2482#endif 2483#ifdef GLOBE_POLES 2484vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 2485#else 2486vec4 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); 2487#endif 2488gl_Position=u_proj_matrix*interpolated_pos; 2489#ifdef FOG 2490v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2491#endif 2492}`),globeAtmosphere:Jt(`#include "_prelude_fog.fragment.glsl" 2493uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; 2494#ifdef PROJECTION_GLOBE_VIEW 2495globe_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) { 2496#ifdef ALPHA_PASS 2497glFragColor=vec4(0,0,0,0);return; 2498#else 2499#ifdef NATIVE 2500glFragColor=vec4(1,1,1,1); 2501#else 2502glFragColor=vec4(0,0,0,1); 2503#endif 2504return; 2505#endif 2506} 2507#endif 2508highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 25090.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 2510#ifdef PROJECTION_GLOBE_VIEW 2511highp 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 ? 2512PI-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); 2513#else 2514horizon_angle=horizon_angle_mercator; 2515#endif 2516horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2516vec3 color_stop_2=u_space_color.rgb; 2517#ifdef ALPHA_PASS 2518float 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); 2519#else 2520vec3 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); 2521#endif 2522}`,`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( 2523mix(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( 2524mix(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:Jt(`#include "_prelude_fog.fragment.glsl" 2525#include "_prelude_shadow.fragment.glsl" 2526#include "_prelude_lighting.glsl" 2527uniform 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; 2528#ifdef RENDER_SHADOWS 2529in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 2530#endif 2531#ifdef OCCLUSION_TEXTURE_TRANSFORM 2532uniform vec4 u_occlusionTextureTransform; 2533#endif 2534#pragma mapbox: define-attribute highp vec3 normal_3f 2535#pragma mapbox: define-attribute highp vec3 color_3f 2536#pragma mapbox: define-attribute highp vec4 color_4f 2537#pragma mapbox: define-attribute highp vec2 uv_2f 2538#pragma mapbox: initialize-attribute highp vec3 normal_3f 2539#pragma mapbox: initialize-attribute highp vec3 color_3f 2540#pragma mapbox: initialize-attribute highp vec4 color_4f 2541#pragma mapbox: initialize-attribute highp vec2 uv_2f 2542#ifdef HAS_ATTRIBUTE_a_pbr 2543in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 2544#endif 2545#ifdef HAS_TEXTURE_u_baseColorTexture 2546uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 2547#endif 2548#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 2549uniform sampler2D u_metallicRoughnessTexture; 2550#endif 2551#ifdef HAS_TEXTURE_u_occlusionTexture 2552uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 2553#endif 2554#ifdef HAS_TEXTURE_u_normalTexture 2555uniform sampler2D u_normalTexture; 2556#endif 2557#ifdef HAS_TEXTURE_u_emissionTexture 2558uniform sampler2D u_emissionTexture; 2559#endif 2560#ifdef APPLY_LUT_ON_GPU 2561uniform highp sampler3D u_lutTexture; 2562#endif 2563#ifdef TERRAIN_FRAGMENT_OCCLUSION 2564in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 2565#ifdef DEPTH_D24 2566highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 2567#else 2568highp float unpack_depth_rgba(highp vec4 rgba_depth) 2569{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;} 2570#endif 2571bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 2572#ifdef FLIP_Y 2573coord.y=1.0-coord.y; 2574#endif 2575#ifdef DEPTH_D24 2576highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 2577#else 2578highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 2579#endif 2580return v_depth > depth+0.0005;} 2581#endif 2582#define saturate(_x) clamp(_x,0.,1.) 2583vec3 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) 2584{ 2585#ifdef LIGHTING_3D_MODE 2586vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 2587#ifdef RENDER_SHADOWS 2588lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2589#else 2590lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 2591#endif 2592return apply_lighting(albedo,transformed_normal,lighting_factor); 2593#else 2594vec3 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
2594Color),vec3(1.0));return c3; 2595#endif 2596}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 2597#ifdef HAS_ATTRIBUTE_a_color_3f 2598albedo*=vec4(color_3f,1.0); 2599#endif 2600#ifdef HAS_ATTRIBUTE_a_pbr 2601#else 2602#ifdef HAS_ATTRIBUTE_a_color_4f 2603albedo*=color_4f; 2604#endif 2605#endif 2606#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 2607vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 2608#ifdef UNPREMULT_TEXTURE_IN_SHADER 2609if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; 2610#endif 2611if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 2612#endif 2613vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 2614#ifdef APPLY_LUT_ON_GPU 2615color=applyLUT(u_lutTexture,color); 2616#endif 2617return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 2618#ifdef HAS_TEXTURE_u_normalTexture 2619highp 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; 2620#ifdef FLIP_Y 2621T=-T;B=-B; 2622#endif 2623highp 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; 2624#else 2625return mat3(1.0); 2626#endif 2627}highp vec3 getNormal(){highp vec3 n; 2628#ifdef HAS_ATTRIBUTE_a_normal_3f 2629n=normalize(normal_3f); 2630#else 2631highp 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)); 2632#ifdef FLIP_Y 2633n=normalize(cross(fdx,fdy)); 2634#else 2635n=normalize(cross(fdx,fdy))*-1.0; 2636#endif 2637#endif 2638#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2639vec3 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); 2640#endif 2641return 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; 2642#ifdef HAS_ATTRIBUTE_a_pbr 2643mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 2644#endif 2645#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2646vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 2647#endif 2648const 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) 2649{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) 2650{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 2651{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) 2652{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) 2653{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) 2654{ 2655#ifdef LIGHTING_3D_MODE 2656return mat.diffuseColor; 2657#else 2658return mat.diffuseColor/PI; 2659#endif 2660}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 2661{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) 2662{vec3 env_light=vec3(0.65,0.65,0.65); 2663#ifdef LIGHTING_3D_MODE 2664float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 2665#endif 2666vec3 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) 2667{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; 2668#ifdef RENDER_SHADOWS 2669lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2670#else 2671lighting_factor=NdotL; 2672#endif 2673vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2673Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 2674#if !defined(LIGHTING_3D_MODE) 2675const 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); 2676#endif 2677color*=intensityFactor;return color;}void main() { 2678#ifdef TERRAIN_FRAGMENT_OCCLUSION 2679if (isOccluded()) {discard;} 2680#endif 2681vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 2682#ifdef LIGHTING_3D_MODE 2683lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 2684#endif 2685vec4 finalColor; 2686#ifdef DIFFUSE_SHADED 2687vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 2688#ifdef HAS_TEXTURE_u_occlusionTexture 2689float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 2690#endif 2691finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 2692#else 2693Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 2694#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2695#ifdef OCCLUSION_TEXTURE_TRANSFORM 2696vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 2697#else 2698vec2 uv=uv_2f; 2699#endif 2700ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 2701#endif 2702vec4 emissive=u_emissiveFactor; 2703#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2704emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 2705#endif 2706#ifdef APPLY_LUT_ON_GPU 2707float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 2708#endif 2709color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 2710#ifdef HAS_ATTRIBUTE_a_pbr 2711float 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; 2712#ifdef APPLY_LUT_ON_GPU 2713color_mix=applyLUT(u_lutTexture,color_mix); 2714#endif 2715color=mix(color,color_mix,min(1.0,resEmission)); 2716#ifdef HAS_ATTRIBUTE_a_color_4f 2717float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2717y));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); 2718#endif 2719#endif 2720vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 2721#endif 2722#ifdef FOG 2723finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 2724#endif 2725#ifdef RENDER_CUTOFF 2726finalColor*=v_cutoff_opacity; 2727#endif 2728#ifdef INDICATOR_CUTOUT 2729finalColor=applyCutout(finalColor,v_position_height.w); 2730#endif 2731#ifdef FEATURE_CUTOUT 2732finalColor=apply_feature_cutout(finalColor,gl_FragCoord); 2733#endif 2734glFragColor=finalColor; 2735#ifdef OVERDRAW_INSPECTOR 2736glFragColor=vec4(1.0); 2737#endif 2738HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2739#include "_prelude_shadow.vertex.glsl" 2740in vec3 a_pos_3f; 2741#pragma mapbox: define-attribute highp vec3 normal_3f 2742#pragma mapbox: define-attribute highp vec2 uv_2f 2743#pragma mapbox: define-attribute highp vec3 color_3f 2744#pragma mapbox: define-attribute highp vec4 color_4f 2745#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr 2746#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 2747uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 2748#ifdef INSTANCED_ARRAYS 2749in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2750#else 2751uniform highp mat4 u_normal_matrix; 2752#endif 2753#ifdef RENDER_SHADOWS 2754uniform 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; 2755#endif 2756out vec4 v_position_height;out lowp vec4 v_color_mix; 2757#ifdef TERRAIN_FRAGMENT_OCCLUSION 2758out highp float v_depth; 2759#endif 2760#ifdef HAS_ATTRIBUTE_a_pbr 2761out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 2762#endif 2763vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 2764#pragma mapbox: initialize-attribute highp vec3 normal_3f 2765#pragma mapbox: initialize-attribute highp vec2 uv_2f 2766#pragma mapbox: initialize-attribute highp vec3 color_3f 2767#pragma mapbox: initialize-attribute highp vec4 color_4f 2768#pragma mapbox: initialize-attribute-custom highp vec4 pbr 2769#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 2770highp mat4 normal_matrix; 2771#ifdef INSTANCED_ARRAYS 2772normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2773#else 2774normal_matrix=u_normal_matrix; 2775#endif 2776vec3 local_pos;mat3 rs; 2777#ifdef MODEL_POSITION_ON_GPU 2778vec3 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; 2779#else 2780local_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); 2781#endif 2782v_position_height.w=a_pos_3f.z; 2783#ifdef HAS_ATTRIBUTE_a_pbr 2784vec4 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; 2785#endif 2786#ifdef FOG 2787v_fog_pos=fog_position(local_pos); 2788#endif 2789#ifdef RENDER_CUTOFF 2790v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2791#endif 2792#ifdef TERRAIN_FRAGMENT_OCCLUSION 2793v_depth=gl_Position.z/gl_Position.w; 2794#ifdef CLIP_ZERO_TO_ONE 2795v_depth=-1.0+2.0*v_depth; 2796#endif 2797#endif 2798#ifdef HAS_ATTRIBUTE_a_normal_3f 2799#ifdef MODEL_POSITION_ON_GPU 2800float 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); 2801#else
2802normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 2803#endif 2804#endif 2805#ifdef HAS_ATTRIBUTE_a_pbr 2806#ifdef HAS_ATTRIBUTE_a_color_4f 2807v_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); 2808#endif 2809#endif 2810#ifdef RENDER_SHADOWS 2811vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 2812#ifdef NORMAL_OFFSET 2813#ifdef HAS_ATTRIBUTE_a_normal_3f 2814#ifdef MODEL_POSITION_ON_GPU 2815vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2816#else 2817vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2818#endif 2819#endif 2820#endif 2821v_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; 2822#endif 2823}`),modelDepth:Jt(`in highp float v_depth;void main() { 2824#ifndef DEPTH_TEXTURE 2825glFragColor=pack_depth(v_depth); 2826#endif 2827}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; 2828#ifdef MODEL_POSITION_ON_GPU 2829#ifdef INSTANCED_ARRAYS 2830in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2831#else 2832uniform highp mat4 u_instance; 2833#endif 2834uniform highp mat4 u_node_matrix; 2835#endif 2836void main() { 2837#ifdef MODEL_POSITION_ON_GPU 2838highp mat4 instance; 2839#ifdef INSTANCED_ARRAYS 2840instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2841#else 2842instance=u_instance; 2843#endif 2844vec3 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;
2844rs[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); 2845#else 2846gl_Position=u_matrix*vec4(a_pos_3f,1); 2847#endif 2848v_depth=gl_Position.z/gl_Position.w;}`),stars:Jt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2849{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;}`,` 2850in 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:Jt("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;}",` 2851in 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; 2852uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 2853uniform float u_horizontalOscillationRate; 2854uniform 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+ 2855localY*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:Jt("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;}",` 2856in 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; 2857uniform float u_velocity; 2858uniform 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;
2858pos*=halfBoxSize; 2859pos+=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+ 2860localY*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:Jt("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:Jt("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" 2861in 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; 2862#ifdef TERRAIN 2863float e=elevation(world_pos.xy);world_pos.z+=e; 2864#endif 2865vec4 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 Ds(l,t){const n=l.split(` 2866`);for(let c of n){if(c=c.trimStart(),c[0]!=="#"||!c.includes("if")||c.startsWith("#endif"))continue;const d=c.match(xh);if(d)for(const p of d)ua.has(p)||t.add(p)}}function Jt(l,t){const n=new Set,c=[],d=[];l=l.replace(Ll,((m,g)=>(d.push(g),""))),t=t.replace(Ll,((m,g)=>(c.push(g),"")));let p=new Set(ha);Ds(l,p),Ds(t,p);for(const m of[...c,...d])Nc[m]||(Nc[m]=new Set,Ds(zs[m],Nc[m])),p=new Set([...p,...Nc[m]]);return{fragmentSource:l=l.replace(Lo,((m,g,x,w,S)=>(n.add(S),g==="define"?` 2867#ifndef HAS_UNIFORM_u_${S} 2868in ${x} ${w} ${S}; 2869#else 2870uniform ${x} ${w} u_${S}; 2871#endif 2872`:g==="initialize"?` 2873#ifdef HAS_UNIFORM_u_${S} 2874 ${x} ${w} ${S} = u_${S}; 2875#endif 2876`:g==="define-attribute"?` 2877#ifdef HAS_ATTRIBUTE_a_${S} 2878 in ${x}
2878 ${w} ${S}; 2879#endif 2880`:g==="initialize-attribute"?"":void 0))),vertexSource:t=t.replace(Lo,((m,g,x,w,S)=>{const M=`MATERIAL_ATTRIBUTE_OFFSET_${S}`,A=w==="float"?"vec2":w,C=`GET_ATTRIBUTE_${A}(a_${S}, materialInfo, ${M})`,z=S.match(/color/)?"color":A;return g==="define-attribute-vertex-shader-only"?` 2881#ifdef HAS_ATTRIBUTE_a_${S} 2882in ${x} ${w} a_${S}; 2883#endif 2884`:n.has(S)?g==="define"?` 2885#ifndef HAS_UNIFORM_u_${S} 2886uniform lowp float u_${S}_t; 2887 #if !defined(${M}) 2888 in ${x} ${A} a_${S}; 2889 #endif 2890out ${x} ${w} ${S}; 2891#else 2892uniform ${x} ${w} u_${S}; 2893#endif 2894`:g==="initialize"?z==="vec4"?` 2895#ifndef HAS_UNIFORM_u_${S} 2896 ${S} = a_${S}; 2897#else 2898 ${x} ${w} ${S} = u_${S}; 2899#endif 2900`:` 2901#if !defined(HAS_UNIFORM_u_${S}) 2902 #ifdef ${M} 2903 ${S} = unpack_mix_${z}(${C}, u_${S}_t); 2904 #else 2905 ${S} = unpack_mix_${z}(a_${S}, u_${S}_t); 2906 #endif 2907#else 2908 ${x} ${w} ${S} = u_${S}; 2909#endif 2910`:g==="define-attribute"?` 2911#ifdef HAS_ATTRIBUTE_a_${S} 2912 in ${x} ${w} a_${S}; 2913 out ${x} ${w} ${S}; 2914#endif 2915`:g==="initialize-attribute"?` 2916#ifdef HAS_ATTRIBUTE_a_${S} 2917 ${S} = a_${S}; 2918#endif 2919`:void 0:g==="define"?` 2920#ifndef HAS_UNIFORM_u_${S} 2921uniform lowp float u_${S}_t; 2922 #if !defined(${M}) 2923 in ${x} ${A} a_${S}; 2924 #endif 2925#else 2926uniform ${x} ${w} u_${S}; 2927#endif 2928`:g==="define-instanced"?z==="mat4"?` 2929#ifdef INSTANCED_ARRAYS 2930in vec4 a_${S}0; 2931in vec4 a_${S}1; 2932in vec4 a_${S}2; 2933in vec4 a_${S}3; 2934#else 2935uniform ${x} ${w} u_${S}; 2936#endif 2937`:` 2938#ifdef INSTANCED_ARRAYS 2939in ${x} ${A} a_${S}; 2940#else 2941uniform ${x} ${w} u_${S}; 2942#endif 2943`:g==="initialize-attribute-custom"?` 2944#ifdef HAS_ATTRIBUTE_a_${S} 2945 ${x} ${w} ${S} = a_${S}; 2946#endif 2947`:z==="vec4"?` 2948#ifndef HAS_UNIFORM_u_${S} 2949 #ifdef ${M} 2950 ${x} ${w} ${S} = ${C}; 2951 #else 2952 ${x} ${w} ${S} = a_${S}; 2953 #endif 2954#else 2955 ${x} ${w} ${S} = u_${S}; 2956#endif 2957`:` 2958#ifndef HAS_UNIFORM_u_${S} 2959 #ifdef ${M} 2960 ${x} ${w} ${S} = unpack_mix_${z}(${C}, u_${S}_t); 2961 #else 2962 ${x} ${w} ${S} = unpack_mix_${z}(a_${S}, u_${S}_t); 2963 #endif 2964#else 2965 ${x} ${w} ${S} = u_${S}; 2966#endif 2967`})),usedDefines:p,vertexIncludes:c,fragmentIncludes:d}}class cm{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,p,m,g,x){this.context=t;let w=this.boundPaintVertexBuffers.length!==d.length;for(let M=0;!w&&M<d.length;M++)this.boundPaintVertexBuffers[M]!==d[M]&&(w=!0);let S=this.boundDynamicVertexBuffers.length!==g.length;for(let M=0;!S&&M<g.length;M++)this.boundDynamicVertexBuffers[M]!==g[M]&&(S=!0);if(!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==c||w||S||this.boundIndexBuffer!==p||this.boundVertexOffset!==m)this.freshBind(n,c,d,p,m,g,x);else{t.bindVertexArrayOES.set(this.vao);for(const M of g)M&&(M.bind(),x&&M.instanceCount&&M.setVertexAttribDivisor(t.gl,n,x));p&&p.dynamicDraw&&p.bind()}}freshBind(t,n,c,d,p,m,g){const x=this.context,w=x.gl;this.vao&&this.destroy(),this.vao=x.gl.createVertexArray(),x.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=m,n.enableAttributes(w,t),n.bind(),n.setVertexAttribPointers(w,t,p);for(const S of c)S.enableAttributes(w,t),S.bind(),S.setVertexAttribPointers(w,t,p);for(const S of m)S&&(S.enableAttributes(w,t),S.bind(),S.setVertexAttribPointers(w,t,p),g&&S.instanceCount&&S.setVertexAttribDivisor(w,t,g));d&&d.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function um(l,t){const n=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new s.ae(0,c/n).toLngLat().lat,new s.ae(0,(c+1)/n).toLngLat().lat]}function hm(l,t,n,c,d,p,m){const g=l.context,x=g.gl,w=n.hillshadeFBO;if(!w)return;l.prepareDrawTile();const S=l.isTileAffectedByFog(t),M=[];l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&M.push("USE_MRT1");const A=l.getOrCreateProgram("hillshade",{overrideFog:S,defines:M});
2967g.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,w.colorAttachment0.get());const C=((F,U,H,j)=>{const te=H.paint.get("hillshade-shadow-color"),Y=H.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",Q=H.paint.get("hillshade-highlight-color"),X=H.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",$=H.paint.get("hillshade-accent-color"),ie=H.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ue=H.paint.get("hillshade-emissive-strength");let le=s.an(H.paint.get("hillshade-illumination-direction"));if(H.paint.get("hillshade-illumination-anchor")==="viewport")le-=F.transform.angle;else if(F.style&&F.style.enable3dLights()&&F.style.directionalLight){const ve=F.style.directionalLight.properties.get("direction"),Ae=s.d4(ve.x,ve.y,ve.z);le=s.an(Ae[1])}const xe=!F.options.moving;return{u_matrix:j||F.transform.calculateProjMatrix(U.tileID.toUnwrapped(),xe),u_image:0,u_latrange:um(0,U.tileID),u_light:[H.paint.get("hillshade-exaggeration"),le],u_shadow:te.toPremultipliedRenderColor(Y?null:H.lut),u_highlight:Q.toPremultipliedRenderColor(X?null:H.lut),u_emissive_strength:ue,u_accent:$.toPremultipliedRenderColor(ie?null:H.lut)}})(l,n,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(g,A,t.toUnwrapped());const{tileBoundsBuffer:z,tileBoundsIndexBuffer:R,tileBoundsSegments:k}=l.getTileBoundsBuffers(n);A.draw(l,x.TRIANGLES,d,p,m,Tt.disabled,C,c.id,z,R,k)}function bh(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 p=n.getPixels();t.demTexture?t.demTexture.update(p,{premultiply:!1}):t.demTexture=new s.T(c,p,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function dm(l,t,n){const c=l.context,d=c.gl;if(!t.dem)return;const p=t.dem;if(c.activeTexture.set(d.TEXTURE1),bh(l,t,p),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=p.dim;c.activeTexture.set(d.TEXTURE0);let g=t.hillshadeFBO;if(!g){const A=new s.T(c,{width:m,height:m,data:null},d.RGBA8);A.bind(d.LINEAR,d.CLAMP_TO_EDGE),g=t.hillshadeFBO=c.createFramebuffer(m,m,1,"renderbuffer"),g.colorAttachment0.set(A.texture)}c.bindFramebuffer.set(g.framebuffer),c.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:w,tileBoundsSegments:S}=l.getMercatorTileBoundsBuffers(),M=[];l.linearFloatFilteringSupported()&&M.push("TERRAIN_DEM_FLOAT_FORMAT"),l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&M.push("USE_MRT1"),l.getOrCreateProgram("hillshadePrepare",{defines:M}).draw(l,d.TRIANGLES,ht.disabled,St.disabled,Dt.unblended,Tt.disabled,((A,C)=>{const z=C.stride,R=s.bC();return s.ce(R,0,s.al,-s.al,0,0,1),s.br(R,R,[0,-s.al,0]),{u_matrix:R,u_image:1,u_dimension:[z,z],u_zoom:A.overscaledZ}})(t.tileID,p),n.id,x,w,S),t.needsHillshadePrepare=!1}class Hi{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 fm extends Hi{getDefault(){return s.ao.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 pf extends Hi{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class wh extends Hi{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Uc extends Hi{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 Th extends Hi{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class da extends Hi{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Va extends Hi{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 Ol extends Hi{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 Ua extends Hi{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 mf extends Hi{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 Sh extends Hi{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 _f extends Hi{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ja extends Hi{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 jc extends Hi{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 Gc extends Hi{getDefault(){return s.ao.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
vendor: 5,030 bytes, line 2967
2967(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Eh extends Hi{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 Hc extends Hi{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 Fl extends Hi{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class gf extends Hi{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let yf=class extends Hi{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class xf extends Hi{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Ga extends Hi{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 vf extends Hi{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 pm extends Hi{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 mm extends Hi{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 _m extends Hi{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 Ih extends Hi{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ah extends Hi{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Mh extends Hi{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 Ch extends Hi{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 bf extends Hi{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 qc extends Hi{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class $c extends qc{constructor(t,n,c=0){super(t,n),this.attachmentPoint=t.gl.COLOR_ATTACHMENT0+c}setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,this.attachmentPoint,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ha extends qc{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 kl extends qc{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 wf extends Ha{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Un=(l,t,n,c)=>({u_matrix:l,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:n,u_emissive_texture_available:c}),Zc=(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k)=>({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:p,u_image0:0,u_image1:1,u_frustum_tl:m,u_frustum_tr:g,u_frustum_br:x,u_frustum_bl:w,u_globe_pos:S,u_globe_radius:M,u_viewport:A,u_grid_matrix:k?Float32Array.from(k):new Float32Array(9),u_skirt_height:C,u_far_z_cutoff:z,u_emissive_texture_available:R});function Bl(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const Jo=new class{constructor(){this.operations={}}newMorphing(l,t,n,c,d){if(l in this.operations){const p=this.operations[l];p.to.tileID.key!==n.tileID.key&&(p.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>
2967=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()}},Wc={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Xc(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 Ph(l,t){const n=1<<l.z;return!t&&(l.x===0||l.x===n-1)||l.y===0||l.y===n-1}function qa(l,t){if(!l.style||!l.style.enable3dLights())return;const n=l.context,c=n.gl;n.activeTexture.set(c.TEXTURE1),t?t.bind(c.LINEAR,c.CLAMP_TO_EDGE):l.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE)}const Nl=l=>({u_matrix:l});function Vl(l,t,n,c,d){if(d>0){const p=s.o.now(),m=(p-l.timeAdded)/d,g=t?(p-t.timeAdded)/d:-1,x=n.getSource(),w=c.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),S=!t||Math.abs(t.tileID.overscaledZ-w)>Math.abs(l.tileID.overscaledZ-w),M=S&&l.refreshedUponExpiration?1:s.aA(S?m:1-g,0,1);return t?{opacity:1,mix:1-M,isFading:m<1}:{opacity:M,mix:0,isFading:m<1}}return{opacity:1,mix:0,isFading:!1}}class Yc extends Ln{constructor(t){const n=Fr("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 Rh extends Ln{constructor(t){const n=Fr("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(((p,m)=>{if(p[m.key]="",!this._tiles[m.key]){const g=new sa(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);g.state="loaded",this._tiles[m.key]=g}return p}),{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(t){const 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 zh extends s.aQ{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 Dh extends s.bV{constructor(t,n){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,p]=(function(x){const w=new s.bd,S=new s.b0,M=131;w.reserve(17161),S.reserve(33800);const A=s.al/128,C=s.al+A/2,z=C+A;for(let k=-A;k<z;k+=A)for(let F=-A;F<z;F+=A){const U=F<0||F>C||k<0||k>C?24575:0,H=s.aA(Math.round(F),0,s.al),j=s.aA(Math.round(k),0,s.al);w.emplaceBack(H+U,j)}const R=(k,F)=>{const U=F*M+k;S.emplaceBack(U+1,U,U+M),S.emplaceBack(U+M,U+M+1,U+1)};for(let k=1;k<129;k++)for(let F=1;F<129;F++)R(F,k);return[0,129].forEach((k=>{for(let F=0;F<130;F++)R(F,k),R(k,F)})),[w,S,32768]})(),m=t.context;this.gridBuffer=m.createVertexBuffer(c,s.bf.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=s.bg.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=s.bg.simpleSegment(0,0,c.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Rh(n.map),this.orthoMatrix=s.bC(),s.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.al,0,s.al,0,1);const g=m.gl;this._overlapStencilMode=new St({func:g.GEQUAL,mask:255},0,255,g.KEEP,g.KEEP,g.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Yc(n.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,n,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,p=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.o.now();const g=t.terrain&&t.terrain.scope,x=d.get("source"),w=p?this._mockSourceCache:t.getSourceCache(x,g);if(!w)return void s.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=w,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&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 2968This 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 p=t.zoom,m=this._style.terrain;if(!this._previousUpdateTimestamp)return m.getExaggeration(p);let g=p-this._previousZoom;const x=this._previousUpdateTimestamp;let w=p;this._evaluationZoom!=null&&(w=this._evaluationZoom,Math.abs(p-w)>.5&&(g=.5*(p-w+g)),g*d<0&&(w+=g)),this._evaluationZoom=w;const S=m.getExaggeration(w),M=S===m.getExaggeration(Math.max(0,w-.1));if(M&&Math.abs(S-this._exaggeration)<.01)return S;let A=Math.min(.1,.00375*(this._updateTimestamp-x));return(M||S<.1||Math.abs(g)<1e-4)&&(A=Math.min(.2,4*A)),s.ak(this._exaggeration,S,A)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.dataType==="source"&&t.coord?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach((t=>t.fb.destroy())),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(s.ae.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=n.getIds().map((x=>{const w=n.getTileByID(x).tileID;return w.projMatrix=c.calculateProjMatrix(w.toUnwrapped()),w}));(function(x,w){const S=w.transform.pointCoordinate(w.transform.getCameraPoint()),M=new s.P(S.x,S.y);x.sort(((A,C)=>
2968{if(C.overscaledZ-A.overscaledZ)return C.overscaledZ-A.overscaledZ;const z=new s.P(A.canonical.x+(1<<A.canonical.z)*A.wrap,A.canonical.y),R=new s.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),k=M.mult(1<<A.canonical.z);return k.x-=.5,k.y-=.5,k.distSqr(z)-k.distSqr(R)}))})(d,this.painter);const p=this.proxyToSource||{};this.proxyToSource={},d.forEach((x=>{this.proxyToSource[x.key]={}})),this.terrainTileForTile={};const m=this._style._mergedSourceCaches;for(const x in m){const w=m[x];if(!w.used||(w!==this.sourceCache&&this.resetTileLookupCache(w.id),this._setupProxiedCoordsForOrtho(w,t[x],p),w.usedForTerrain))continue;const S=t[x];w.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[n.id]=d.map((x=>new zh(x,x.key,this.orthoMatrix))),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const g={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const w=this.terrainTileForTile[x.key];if(!w)continue;const S=w.tileID.key;S in g||(this._visibleDemTiles.push(w),g[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],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(n.TEXTURE1),bh(this.painter,d,p))}}_prepareDemTileUniforms(t,n,c,d){if(!n||n.demTexture==null)return!1;const p=t.tileID.canonical,m=Math.pow(2,n.tileID.canonical.z-p.z),g=d||"";return c[`u_dem_tl${g}`]=[p.x*m%1,p.y*m%1],c[`u_dem_scale${g}`]=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 p=d.dem.tree.minimums[0];return p>0&&t++,c+p}),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 s.dL({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let p=this._emptyDEMTexture;return p?p.update(d,{premultiply:!1}):p=this._emptyDEMTexture=new s.T(t,d,n.R32F,{premultiply:!1}),p}setupElevationDraw(t,n,c){const d=this.painter.context,p=d.gl,m={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};m.u_exaggeration=this.exaggeration();let g=null,x=null,w=1;if(c&&c.morphing&&this._useVertexMorphing){const C=c.morphing.srcDemTile,z=c.morphing.dstDemTile;w=c.morphing.phase,C&&z&&(this._prepareDemTileUniforms(t,C,m,"_prev")&&(x=C),this._prepareDemTileUniforms(t,z,m)&&(g=z))}const S=C=>C&&C.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST;let M=null;var A;if(this.enabled?x&&g?(M=g.demTexture,d.activeTexture.set(p.TEXTURE4),x.demTexture.bind(S(x),p.CLAMP_TO_EDGE),m.u_dem_lerp=w):(g=this.terrainTileForTile[t.tileID.key],M=this._prepareDemTileUniforms(t,g,m)?g.demTexture:this.emptyDEMTexture):M=this.emptyDEMTexture,d.activeTexture.set(p.TEXTURE2),M&&(m.u_dem_size=(A=M).size[0]===1?1:A.size[0]-2,M.bind(S(g),p.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,n,m),c&&c.useMeterToDem&&g){const C=(1<<g.tileID.canonical.z)*s.cf(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,s.al,0),u_tile_br_up:d.upVector(n,s.al,s.al),u_tile_bl_up:d.upVector(n,0,s.al),u_tile_up_scale:c?s.dM(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,p,m,g,x){if(d.transform.projection.name==="globe")(function(w,S,M,A,C){const z=w.context,R=z.gl;let k,F;const U=w.transform,H=s.dE(w,z,U),j=(xe,ve)=>{if(F===ve)return;const Ae=[Wc[ve],"PROJECTION_GLOBE_VIEW"];H&&Ae.push("CUSTOM_ANTIALIASING");const Ve=w.isTileAffectedByFog(xe);k=w.getOrCreateProgram("globeRaster",{defines:Ae,overrideFog:Ve}),F=ve}
2968,te=w.colorModeForRenderPass(),Y=new ht(R.LEQUAL,ht.ReadWrite,w.depthRangeFor3D);Jo.update(C);const Q=s.dF(U),X=[s.aF(U.center.lng),s.aJ(U.center.lat)],$=w.globeSharedBuffers,ie=[U.width*s.o.devicePixelRatio,U.height*s.o.devicePixelRatio],ue=Float32Array.from(U.globeMatrix),le={useDenormalizedUpVectorScale:!0};{const xe=w.transform,ve=Xc(xe.zoom,S.exaggeration(),S.sourceCache._source.tileSize);F=-1;const Ae=R.TRIANGLES;for(const Ve of A){const me=M.getTile(Ve),se=St.disabled,Te=S.prevTerrainTileForTile[Ve.key],_e=S.terrainTileForTile[Ve.key];Bl(Te,_e)&&Jo.newMorphing(Ve.key,Te,_e,C,250),qa(w,me.emissiveTexture),z.activeTexture.set(R.TEXTURE0),me.texture&&me.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);const Re=Jo.getMorphValuesForProxy(Ve.key),We=Re?1:0;Re&&Object.assign(le,{morphing:{srcDemTile:Re.from,dstDemTile:Re.to,phase:s.dD(Re.phase)}});const et=s.dG(Ve.canonical),qe=s.dH(et.getCenter().lat),Ue=s.dI(Ve.canonical,et,qe,xe.worldSize/xe._pixelsPerMercatorPixel),ct=s.bk(s.dJ(Ve.canonical)),st=w.emissiveMode==="mrt-fallback"?1:0,Je=Zc(xe.expandedFarZProjMatrix,ue,Q,ct,s.aj(xe.zoom),X,xe.frustumCorners.TL,xe.frustumCorners.TR,xe.frustumCorners.BR,xe.frustumCorners.BL,xe.globeCenterInViewSpace,xe.globeRadius,ie,ve,xe._farZ,st,Ue);if(j(Ve,We),k&&(S.setupElevationDraw(me,k,le),w.uploadCommonUniforms(z,k,Ve.toUnwrapped()),$)){const[it,gt,Mt]=$.getGridBuffers(qe,ve!==0);k.draw(w,Ae,Y,se,te,Tt.backCCW,Je,"globe_raster",it,gt,Mt)}}}if($&&(w.renderDefaultNorthPole||w.renderDefaultSouthPole)){const xe=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];H&&xe.push("CUSTOM_ANTIALIASING"),k=w.getOrCreateProgram("globeRaster",{defines:xe});for(const ve of A){const{x:Ae,y:Ve,z:me}=ve.canonical,se=Ve===0,Te=Ve===(1<<me)-1,[_e,Re,We,et]=$.getPoleBuffers(me,!1);if(et&&(se||Te)){const qe=M.getTile(ve);qa(w,qe.emissiveTexture),z.activeTexture.set(R.TEXTURE0),qe.texture&&qe.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE);let Ue=s.dK(me,Ae,U);const ct=s.bk(s.dJ(ve.canonical)),st=w.emissiveMode==="mrt-fallback"?1:0,Je=(it,gt)=>it.draw(w,R.TRIANGLES,Y,St.disabled,te,Tt.disabled,Zc(U.expandedFarZProjMatrix,Ue,Ue,ct,0,X,U.frustumCorners.TL,U.frustumCorners.TR,U.frustumCorners.BR,U.frustumCorners.BL,U.globeCenterInViewSpace,U.globeRadius,ie,0,U._farZ,st),"globe_pole_raster",gt,We,et);S.setupElevationDraw(qe,k,le),w.uploadCommonUniforms(z,k,ve.toUnwrapped()),se&&w.renderDefaultNorthPole&&Je(k,_e),Te&&w.renderDefaultSouthPole&&(Ue=s.cS(s.bC(),Ue,[1,-1,1]),Je(k,Re))}}}})(d,p,m,g,x);else{const w=d.context,S=w.gl;let M,A;const C=d.shadowRenderer,z=Ms(d,d.longestCutoffRange),R=te=>{if(A===te)return;const Y=[];Y.push(Wc[te]),z.shouldRenderCutoff&&Y.push("RENDER_CUTOFF"),C&&(Y.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&Y.push("NORMAL_OFFSET")),M=d.getOrCreateProgram("terrainRaster",{defines:Y}),A=te},k=d.colorModeForRenderPass(),F=new ht(S.LEQUAL,ht.ReadWrite,d.depthRangeFor3D);Jo.update(x);const U=d.transform,H=Xc(U.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let j=[0,0,0];if(C){const te=d.style.directionalLight,Y=d.style.ambientLight;te&&Y&&(j=Ko(d.style,te,Y))}{A=-1;const te=S.TRIANGLES,[Y,Q]=[p.gridIndexBuffer,p.gridSegments];for(const X of g){const $=m.getTile(X),ie=St.disabled,ue=p.prevTerrainTileForTile[X.key],le=p.terrainTileForTile[X.key];Bl(ue,le)&&Jo.newMorphing(X.key,ue,le,x,250),qa(d,$.emissiveTexture),w.activeTexture.set(S.TEXTURE0),$.texture&&$.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const xe=Jo.getMorphValuesForProxy(X.key),ve=xe?1:0;let Ae;xe&&(Ae={morphing:{srcDemTile:xe.from,dstDemTile:xe.to,phase:s.dD(xe.phase)}});const Ve=d.emissiveMode==="mrt-fallback"?1:0,me=Un(X.projMatrix,Ph(X.canonical,U.renderWorldCopies)?H/10:H,j,Ve);if(R(ve),!M)continue;p.setupElevationDraw($,M,Ae);const se=X.toUnwrapped();C&&C.setupShadows(se,M),d.uploadCommonUniforms(w,M,se,null,z),M.draw(d,te,F,ie,k,Tt.backCCW,me,"terrain_raster",p.gridBuffer,Y,Q)}}}})(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,p=this.proxiedCoords[d.id],m=this._drapedRenderBatches.shift(),g=n.style.order,x=[];this._updateFBOs(n.emissiveMode==="mrt-fallback");let w=0;for(const S of p){const M=d.getTileByID(S.proxyTileKey),A=d.proxyCachedFBO[S.key]?d.proxyCachedFBO[S.key][t]:void 0,C=A!==void 0?d.renderCache[A]:this.pool[w++],z=A!==void 0;if(M.texture=C.tex,M.emissiveTexture=C.emissiveTex,z&&!C.dirty){x.push(M.tileID);continue}c.bindFramebuffer.set(C.fb.framebuffer);const R=c.gl;let k;R.drawBuffers(n.emissiveMode==="mrt-fallback"?[R.COLOR_ATTACHMENT0,R.COLOR_ATTACHMENT1]:[R.COLOR_ATTACHMENT0]),this.renderedToTile=!1,C.dirty&&(c.clear({color:s.ao.transparent,stencil:0}),C.dirty=!1);for(let F=m.start;F<=m.end;++F){const U=n.style._mergedLayers[g[F]];if(U.isHidden(n.transform.zoom))continue;const H=n.style.getLayerSourceCache(U),j=H?this.proxyToSource[S.key][H.id]:[S];if(!j)continue;const te=j;
2968c.viewport.set([0,0,C.fb.width,C.fb.height]),k!==(H?H.id:null)&&(this._setupStencil(C,j,U,H),k=H?H.id:null),n.renderLayer(n,H,U,te)}if(R.drawBuffers([R.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const F of this._pendingGroundEffectLayers){const U=n.style._mergedLayers[g[F]];if(U.isHidden(n.transform.zoom))continue;const H=n.style.getLayerSourceCache(U),j=H?this.proxyToSource[S.key][H.id]:[S];if(!j)continue;const te=j;c.viewport.set([0,0,C.fb.width,C.fb.height]),k!==(H?H.id:null)&&(this._setupStencil(C,j,U,H),k=H?H.id:null),n.renderLayer(n,H,U,te)}this.renderedToTile?(C.dirty=!0,x.push(M.tileID)):z||--w,w===5&&(w=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 p=0;p<n;++p)this._style.isLayerDraped(t._mergedLayers[t.order[p]])?c=Math.max(c,p):d=Math.min(d,p);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter((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((p=>p.dem)).map((p=>{const m=p.tileID,g=1<<m.overscaledZ,{x,y:w}=m.canonical,S=x/g,M=(x+1)/g,A=w/g,C=(w+1)/g;return{minx:S,miny:A,maxx:M,maxy:C,t:p.dem.tree.raycastRoot(S,A,M,C,t,n,c),tile:p}}));d.sort(((p,m)=>(p.t!==null?p.t:Number.MAX_VALUE)-(m.t!==null?m.t:Number.MAX_VALUE)));for(const p of d){if(p.t==null)return null;const m=p.tile.dem.tree.raycast(p.minx,p.miny,p.maxx,p.maxy,t,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 s.T(t,{width:c[0],height:c[1],data:null},n.RGBA8);d.bind(n.LINEAR,n.CLAMP_TO_EDGE);const p=t.createFramebuffer(c[0],c[1],1,null);let m;return p.colorAttachment0.set(d.texture),this._emissiveTexture&&(m=new s.T(t,{width:c[0],height:c[1],data:null},n.R8),m.bind(n.LINEAR,n.CLAMP_TO_EDGE),p.createColorAttachment(t,1),p.colorAttachment1.set(m.texture)),p.depthAttachment=new wf(t,p.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,p.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):p.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:p,tex:d,emissiveTex:m,dirty:!1}}_updateFBOs(t){if(this._emissiveTexture!==t){for(const n of this.pool)this._updateFBO(n,t);for(const n of this.proxySourceCache.renderCache)this._updateFBO(n,t);this._emissiveTexture=t}}_updateFBO(t,n){const c=t.fb,d=this.painter.context,p=d.gl,m=this.drapeBufferSize;if(n){const g=new s.T(d,{width:m[0],height:m[1],data:null},p.R8);g.bind(p.LINEAR,p.CLAMP_TO_EDGE),t.emissiveTex=g,c.createColorAttachment(d,1),c.colorAttachment1.set(g.texture)}else t.emissiveTex=void 0,c.removeColorAttachment(d,1);t.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some((t=>{const 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 ra){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]],p=this._style.getLayerSourceCache(d);if(!p||n[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="line")continue;const m=d.widthExpression(),g=d.emissiveStrengthExpression();if(m instanceof s.ad||g instanceof s.ad){n[p.id]=!0;for(const x of this.proxyCoords){const w=this.proxyToSource[x.key][p.id];if(w)for(const S of w)this._clearRenderCacheForTile(p.id,S)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof Ur){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]],p=this._style.getLayerSourceCache(d);if(!p||n[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const m=d.paint.get("raster-fade-duration");for(const g of this.proxyCoords){const x=this.proxyToSource[g.key][p.id];if(x)for(const w of x){const S=Vl(p.getTile(w),p.findLoadedParent(w,0),p,this.painter.transform,m);(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(p.id,w)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,n=t.length;if(n===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,p=0,m=this._style._mergedLayers[t[p]];for(;!this._style.isLayerDraped(m)&&m.isHidden(this.painter.transform.zoom)&&++p<n;)m=this._style._mergedLayers[t[p]];for(;p<n;++p){const g=this._style._mergedLayers[t[p]];g.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(g)?d===void 0&&(d=p):(g.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(c.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:p-1}),c.length!==0){const g=c[c.length-1];this._pendingGroundEffectLayers.every((x=>x>g.end))||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const 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 g=0;g<m.length;++g){const x=Object.values(m[g]);n.renderCachePool.push(...x)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let m=c.length-1;m>=0;m--){const g=c[m];if(n.getTileByID(g.key),n.proxyCachedFBO[g.key]!==void 0){const x=t[g.key],w=this.proxyToSource[g.key];let S=0;for(const M in w){const A=w[M],C=x[M];if(!C||C.length!==A.length||A.some(((z,R)=>z!==C[R]||d[M]&&d[M].hasOwnProperty(z.key)))){S=-1;break}++S}for(const M in n.proxyCachedFBO[g.key])n.renderCache[n.proxyCachedFBO[g.key][M]].dirty=S<0||S!==Object.values(x).length}}const p=[...this._drapedRenderBatches];p.sort(((m,g)=>g.end-g.start-(m.end-m.start)));for(const m of p)for(const g of c){if(n.proxyCachedFBO[g.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[g.key]={},n.proxyCachedFBO[g.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 p=this.painter.context,m=p.gl;if(n.length<=1)return void(this._overlapStencilType=!1);let g;if(c.isTileClipped())g=n.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(n[0].overscaledZ>
2968n[n.length-1].overscaledZ))return void(this._overlapStencilType=!1);g=1,this._overlapStencilMode.test={func:m.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+g>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=g,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):St.disabled}_renderTileClippingMasks(t,n){const c=this.painter,d=this.painter.context,p=d.gl;c._tileClippingMaskIDs={},d.setColorMode(Dt.disabled),d.setDepthMode(ht.disabled);const m=c.getOrCreateProgram("clippingMask");for(const g of t){const x=c._tileClippingMaskIDs[g.key]=--n;m.draw(c,p.TRIANGLES,ht.disabled,new St({func:p.ALWAYS,mask:0},x,255,p.KEEP,p.KEEP,p.REPLACE),Dt.disabled,Tt.disabled,Nl(g.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];s.aC(c,c,n.pixelMatrixInverse),s.cK(c,c,1/c[3]),c[0]/=n.worldSize,c[1]/=n.worldSize;const d=n._camera.position,p=s.cf(1,n.center.lat),m=[d[0],d[1],d[2]/p,0],g=s.da([],c.slice(0,3),m);s.aw(g,g);const x=this.raycast(m,g,this._exaggeration);return x!==null&&x?(s.bH(m,m,g,x),m[3]=m[2],m[2]*=p,m):null}_setupProxiedCoordsForOrtho(t,n,c){if(t.getSource()instanceof s.aU)return this._setupProxiedCoordsForImageSource(t,n,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords;for(let x=0;x<p.length;x++){const w=p[x],S=this._findTileCoveringTileID(w,t);if(S){const M=this._createProxiedId(w,S,c[w.key]&&c[w.key][t.id]);d.push(M),this.proxyToSource[w.key][t.id]=[M]}}let m=!1;const g=new Set;for(let x=0;x<n.length;x++){const w=t.getTile(n[x]);if(!w||!w.hasData())continue;const S=this._findTileCoveringTileID(w.tileID,this.proxySourceCache);if(S&&S.tileID.canonical.z!==w.tileID.canonical.z){const M=this.proxyToSource[S.tileID.key][t.id],A=this._createProxiedId(S.tileID,w,c[S.tileID.key]&&c[S.tileID.key][t.id]);M?M.splice(M.length-1,0,A):this.proxyToSource[S.tileID.key][t.id]=[A];const C=this.proxyToSource[S.tileID.key][t.id];g.has(C)||g.add(C),d.push(A),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m&&this._debugParams.sortTilesHiZFirst)for(const x of g)x.sort(((w,S)=>S.overscaledZ-w.overscaledZ))}_setupProxiedCoordsForImageSource(t,n,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords,m=t.getSource(),g=m.tileID;if(!g)return;const x=new s.P(g.x,g.y)._div(1<<g.z),w=m.coordinates.map(s.ae.fromLngLat).reduce(((M,A)=>(M.min.x=Math.min(M.min.x,A.x-x.x),M.min.y=Math.min(M.min.y,A.y-x.y),M.max.x=Math.max(M.max.x,A.x-x.x),M.max.y=Math.max(M.max.y,A.y-x.y),M)),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(M,A)=>{const C=M.wrap+M.canonical.x/(1<<M.canonical.z),z=M.canonical.y/(1<<M.canonical.z),R=s.al/(1<<M.canonical.z),k=A.wrap+A.canonical.x/(1<<A.canonical.z),F=A.canonical.y/(1<<A.canonical.z);return C+R<k+w.min.x||C>k+w.max.x||z+R<F+w.min.y||z>F+w.max.y};for(let M=0;M<p.length;M++){const A=p[M];for(let C=0;C<n.length;C++){const z=t.getTile(n[C]);if(!z||!z.hasData()||S(A,z.tileID))continue;const R=this._createProxiedId(A,z,c[A.key]&&c[A.key][t.id]),k=this.proxyToSource[A.key][t.id];k?k.push(R):this.proxyToSource[A.key][t.id]=[R],d.push(R)}}}_createProxiedId(t,n,c){let d=this.orthoMatrix;if(c){const p=c.find((m=>m.key===n.tileID.key));if(p)return p}if(n.tileID.key!==t.key){const p=t.canonical.z-n.tileID.canonical.z;let m,g,x;d=s.bC();const w=n.tileID.wrap-t.wrap<<t.overscaledZ;p>0?(m=s.al>>p,g=m*((n.tileID.canonical.x<<p)-t.canonical.x+w),x=m*((n.tileID.canonical.y<<p)-t.canonical.y)):(m=s.al<<-p,g=s.al*(n.tileID.canonical.x-(t.canonical.x+w<<-p)),x=s.al*(n.tileID.canonical.y-(t.canonical.y<<-p))),s.ce(d,0,m,0,m,0,1),s.br(d,d,[g,x,0])}return new zh(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],p=d[t.key];
2968if(c=p?n.getTileByID(p):null,c&&c.hasData()||p===null)return c;let m=c?c.tileID:t,g=m.overscaledZ;const x=n.getSource().minzoom,w=[];if(!p){const M=n.getSource().maxzoom;if(t.canonical.z>=M){const A=t.canonical.z-M;n.getSource().reparseOverscaled?(g=Math.max(t.canonical.z+2,n.transform.tileZoom),m=new s.aQ(g,t.wrap,M,t.canonical.x>>A,t.canonical.y>>A)):A!==0&&(g=M,m=new s.aQ(g,t.wrap,M,t.canonical.x>>A,t.canonical.y>>A))}m.key!==t.key&&(w.push(m.key),c=n.getTile(m))}const S=M=>{w.forEach((A=>{d[A]=M})),w.length=0};for(g-=1;g>=x&&(!c||!c.hasData());g--){c&&S(c.tileID.key);const M=m.calculateScaledKey(g);if(c=n.getTileByID(M),c&&c.hasData())break;const A=d[M];if(A===null)break;A===void 0?w.push(M):c=n.getTileByID(A)}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 $a(l,t,n){const c=(function(g,x,w){const S=s.bJ(x,g),M=s.bJ(w,[.2126,.7152,.0722]),A=(z,R,k)=>(1-k)*z+k*R,C=A(1-.3*Math.min(M,1),1,Math.min(S+1,1));return A(.92,1,Math.asin(s.aA(x[2],-1,1))/Math.PI+.5)*C})(l,[0,0,1],t),d=[0,0,0];s.c5(d,n.slice(0,3),c);const p=[0,0,0];s.c5(p,t.slice(0,3),l[2]);const m=[0,0,0];return s.d8(m,d,p),s.db(m)}const gm=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],ym=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class Tf{static cacheKey(t,n,c,d){const p=[n];d&&p.push(d.cacheKey);for(const m of c)t.usedDefines.has(m)&&p.push(m);return p.join("/")}constructor(t,n,c,d,p,m){const g=t.gl;this.program=g.createProgram(),this.configuration=d,this.name=n,this.fixedDefines=[...m];const x=`#version 300 es 2969${(d?d.defines():[]).concat(m.map((R=>`#define ${R}`))).join(` 2970`)}`,w=[x,lm];for(const R of c.fragmentIncludes)w.push(zs[R]);w.push(c.fragmentSource);const S=w.join(` 2971`),M=[x,ff];for(const R of c.vertexIncludes)M.push(zs[R]);this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&M.push("uniform int u_instanceID;"),M.push(c.vertexSource);let A=M.join(` 2972`);this.forceManualRenderingForInstanceIDShaders&&(A=A.replaceAll("gl_InstanceID","u_instanceID"));const C=g.createShader(g.FRAGMENT_SHADER);if(g.isContextLost())return void(this.failedToCreate=!0);g.shaderSource(C,S),g.compileShader(C),g.attachShader(this.program,C);const z=g.createShader(g.VERTEX_SHADER);g.isContextLost()?this.failedToCreate=!0:(g.shaderSource(z,A),g.compileShader(z),g.attachShader(this.program,z),this.attributes={},g.linkProgram(this.program),g.deleteShader(z),g.deleteShader(C),this.fixedUniforms=p(t),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(R=>({u_instanceID:new s.ch(R)}))(t)),(m.includes("TERRAIN")||n.includes("symbol")||n.includes("circle"))&&(this.terrainUniforms=(R=>({u_dem:new s.ch(R),u_dem_prev:new s.ch(R),u_dem_tl:new s.ck(R),u_dem_scale:new s.cj(R),u_dem_tl_prev:new s.ck(R),u_dem_scale_prev:new s.cj(R),u_dem_size:new s.cj(R),u_dem_lerp:new s.cj(R),u_exaggeration:new s.cj(R),u_depth:new s.ch(R),u_depth_size_inv:new s.ck(R),u_depth_range_unpack:new s.ck(R),u_occluder_half_size:new s.cj(R),u_occlusion_depth_offset:new s.cj(R),u_meter_to_dem:new s.cj(R),u_label_plane_matrix_inv:new s.cl(R)}))(t)),m.includes("GLOBE")&&(this.globeUniforms=(R=>({u_tile_tl_up:new s.ci(R),u_tile_tr_up:new s.ci(R),u_tile_br_up:new s.ci(R),u_tile_bl_up:new s.ci(R),u_tile_up_scale:new s.cj(R)}))(t)),m.includes("FOG")&&(this.fogUniforms=(R=>({u_fog_matrix:new s.cl(R),u_fog_range:new s.ck(R),u_fog_color:new s.d3(R),u_fog_horizon_blend:new s.cj(R),u_fog_vertical_limit:new s.ck(R),u_fog_temporal_offset:new s.cj(R),u_frustum_tl:new s.ci(R),u_frustum_tr:new s.ci(R),u_frustum_br:new s.ci(R),u_frustum_bl:new s.ci(R),u_globe_pos:new s.ci(R),u_globe_radius:new s.cj(R),u_globe_transition:new s.cj(R),u_is_globe:new s.ch(R),u_viewport:new s.ck(R)}))(t)),m.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(R=>({u_cutoff_params:new s.d3(R)}))(t)),m.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(R=>({u_lighting_ambient_color:new s.ci(R),u_lighting_directional_dir:new s.ci(R),u_lighting_directional_color:new s.ci(R),u_ground_radiance:new s.ci(R)}))(t)),m.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(R=>({u_light_matrix_0:new s.cl(R),u_light_matrix_1:new s.cl(R),u_fade_range:new s.ck(R),u_shadow_normal_offset:new s.ci(R),u_shadow_intensity:new s.cj(R),u_shadow_texel_size:new s.cj(R),u_shadow_map_resolution:new s.cj(R),u_shadow_direction:new s.ci(R),u_shadow_bias:new s.ci(R),u_shadowmap_0:new s.ch(R),u_shadowmap_1:new s.ch(R)}))(t)))}getAttributeLocation(t,n){let c=this.attributes[n];return c===void 0&&(c=this.attributes[n]=t.getAttribLocation(this.program,n)),c}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,p,m,g,x,w,S){const M=t.options.wireframe;if(M.terrain===!1&&M.layers2D===!1&&M.layers3D===!1)return;const A=t.context;if(!(!(!M.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!M.layers2D||t._terrain&&t._terrain.renderingToTexture||!gm.includes(this.name))||!(!M.layers3D||!ym.includes(this.name))))return;const C=A.gl,z=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,p,A);if(!z)return;
2972const R=[...this.fixedDefines,"DEBUG_WIREFRAME"],k=t.getOrCreateProgram(this.name,{config:this.configuration,defines:R});A.program.set(k.program);const F=(j,te,Y)=>{if(te[j]&&Y[j])for(const Q in te[j])Y[j][Q]&&Y[j][Q].set(Y.program,Q,te[j][Q].current)};w&&w.setUniforms(k.program,A,k.binderUniforms,g,{zoom:x}),F("fixedUniforms",this,k),F("terrainUniforms",this,k),F("globeUniforms",this,k),F("fogUniforms",this,k),F("lightsUniforms",this,k),F("shadowUniforms",this,k),z.bind(),A.setColorMode(new Dt([C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ZERO,C.ONE],s.ao.transparent,[!0,!0,!0,!1])),A.setDepthMode(new ht(n.func===C.LESS?C.LEQUAL:n.func,ht.ReadOnly,n.range)),A.setStencilMode(St.disabled);const U=3*m.primitiveLength*2,H=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const j=S||1;for(let te=0;te<j;++te)k.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",te),C.drawElements(C.LINES,U,C.UNSIGNED_SHORT,H)}else S&&S>1?C.drawElementsInstanced(C.LINES,U,C.UNSIGNED_SHORT,H,S):C.drawElements(C.LINES,U,C.UNSIGNED_SHORT,H);p.bind(),A.program.set(this.program),A.setDepthMode(n),A.setStencilMode(c),A.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,p,m,g,x,w,S,M,A,C,z,R,k){const F=t.context,U=F.gl;if(this.failedToCreate)return;F.program.set(this.program),F.setDepthMode(c),F.setStencilMode(d),F.setColorMode(p),F.setCullFace(m);for(const[X,$]of this.fixedUniformsEntries)$.set(this.program,X,g[X]);z&&z.setUniforms(this.program,F,this.binderUniforms,A,{zoom:C});const H={[U.POINTS]:1,[U.LINES]:2,[U.TRIANGLES]:3,[U.LINE_STRIP]:1}[n];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const j=R||[],te=z?z.getPaintVertexBuffers():[],Y=n===U.TRIANGLES&&S,Q=k&&k>0?1:void 0;for(const X of M.get()){const $=X.vaos||(X.vaos={});if(($[x]||($[x]=new cm)).bind(F,this,w,te,S,X.vertexOffset,j,Q),this.forceManualRenderingForInstanceIDShaders){const ie=k||1;for(let ue=0;ue<ie;++ue)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",ue),S?U.drawElements(n,X.primitiveLength*H,U.UNSIGNED_SHORT,X.primitiveOffset*H*2):U.drawArrays(n,X.vertexOffset,X.vertexLength)}else k&&k>1?U.drawElementsInstanced(n,X.primitiveLength*H,U.UNSIGNED_SHORT,X.primitiveOffset*H*2,k):S?U.drawElements(n,X.primitiveLength*H,U.UNSIGNED_SHORT,X.primitiveOffset*H*2):U.drawArrays(n,X.vertexOffset,X.vertexLength);Y&&this._drawDebugWireframe(t,c,d,p,S,X,A,C,z,k)}}}function Sf(l,t,n=0){const c=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,l.transform.tileZoom)/c,p=d*(t.tileID.canonical.x+t.tileID.wrap*c),m=d*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.ay(t,1,l.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m],u_pattern_transition:n}}const Kc={terrain:0,flat:1},xm=s.bC(),Jc=(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k,F)=>{const U=t.style.light,H=U.properties.get("position"),j=[H.x,H.y,H.z],te=s.dO();U.properties.get("anchor")==="viewport"&&(s.dP(te,-t.transform.angle),s.dQ(j,j,te));const Y=U.properties.get("color").toPremultipliedRenderColor(null),Q=t.transform,X={u_matrix:l,u_lightpos:j,u_lightintensity:U.properties.get("intensity"),u_lightcolor:[Y.r,Y.g,Y.b],u_vertical_gradient:+n,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:xm,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Kc[w],u_base_type:Kc[S],u_ao:d,u_edge_radius:p,u_width_scale:m,u_flood_light_color:z,u_vertical_scale:R,u_flood_light_intensity:k,u_ground_shadow_factor:F};return Q.projection.name==="globe"&&(X.u_tile_id=[g.canonical.x,g.canonical.y,1<<g.canonical.z],X.u_zoom_transition=M,X.u_inv_rot_matrix=C,X.u_merc_center=A,X.u_up_dir=Q.projection.upVector(new s.cD(0,0,0),A[0]*s.al,A[1]*s.al),X.u_height_lift=x),X},Lh=(l,t,n,c,d,p)=>({u_matrix:l,u_edge_radius:t,u_width_scale:n,u_vertical_scale:c,u_height_type:Kc[d],u_base_type:Kc[p]}),Ef=(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k,F)=>{const U=Jc(l,t,n,c,d,p,m,g,w,S,M,A,C,z,R,k,1,[0,0,0]),H={u_height_factor:-Math.pow(2,g.overscaledZ
2972)/x.tileSize/8};return Object.assign(U,Sf(t,x,F),H)},Za=(l,t,n,c,d,p,m,g,x,w,S)=>({u_matrix:t,u_opacity:n,u_ao_pass:c?1:0,u_meter_to_tile:d,u_ao:p,u_flood_light_intensity:m,u_flood_light_color:g,u_attenuation:x,u_edge_radius:w,u_fb:0,u_fb_size:S,u_dynamic_offset:1}),Oh=(l,t,n)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:n}),Fh=(l,t,n,c,d,p=0)=>Object.assign(Oh(l,t,d),Sf(n,c,p)),If=(l,t,n,c)=>({u_matrix:l,u_world:n,u_emissive_strength:t,u_ground_shadow_factor:c}),kh=(l,t,n,c,d,p,m=0)=>Object.assign(Fh(l,t,n,c,p,m),{u_world:d}),Ls=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),fa=(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}),Qc=(l,t,n,c,d,p,m,g,x)=>({u_matrix:l,u_normal_matrix:t,u_opacity:n,u_faux_facade_ao_intensity:c,u_camera_pos:d,u_tile_to_meter:p,u_facade_emissive_chance:m,u_flood_light_color:g,u_flood_light_intensity:x}),Af=l=>({u_matrix:l}),Os=l=>({u_matrix:l}),Bh=(l,t,n,c,d,p,m,g)=>{const x=s.al/p.tileSize;return{u_matrix:l,u_inv_rot_matrix:t,u_camera_to_center_distance:n.getCameraToCenterDistance(g),u_extrude_scale:[n.pixelsToGLUnits[0]/x,n.pixelsToGLUnits[1]/x],u_zoom_transition:c,u_tile_id:m,u_merc_center:d}},Ul=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),Mf=s.bC(),Cf=(l,t,n,c,d,p,m)=>{const g=l.transform,x=g.projection.name==="globe",w=x?s.dR(g.zoom,t.canonical)*g._pixelsPerMercatorPixel:s.ay(n,1,p),S={u_matrix:t.projMatrix,u_extrude_scale:w,u_intensity:m,u_inv_rot_matrix:Mf,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=s.aj(g.zoom);const M=d[0]*s.al,A=d[1]*s.al;S.u_up_dir=g.projection.upVector(new s.cD(0,0,0),M,A)}return S};function eu(l,[t,n,c,d],[p,m]){if(p===m)return[0,0,0,0];const g=255*(l-1)/(l*(m-p));return[t*g,n*g,c*g,d*g]}function tu(l,t,[n,c]){return n===c?0:.5/l+(t-n)*(l-1)/(l*(c-n))}const Pf=(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k,F,U,H,j)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:w,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:s.dT(M.paint.get("raster-saturation")),u_contrast_factor:s.dS(M.paint.get("raster-contrast")),u_spin_weights:Rf(M.paint.get("raster-hue-rotate")),u_perspective_transform:A,u_raster_elevation:C,u_zoom_transition:m,u_merc_center:g,u_cutoff_params:x,u_colorization_mix:eu(s.dU,R,F),u_colorization_offset:tu(s.dU,k,F),u_color_ramp:z,u_texture_offset:[H/(U+2*H),U/(U+2*H)],u_texture_res:[U+2*H,U+2*H],u_emissive_strength:j});function Rf(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 Oo=.05,vm=(l,t,n,c,d,p,m,g,x,w,S,M)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:w,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:g,u_cutoff_params:x}),bm=(l,t,n,c,d,p,m,g,x,w)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_tile_offset:n,u_velocity:c,u_color_ramp:p,u_velocity_res:d,u_max_speed:m,u_uv_offset:g,u_data_scale:[255*x[0],255*x[1]],u_data_offset:w,u_particle_pos_scale:1.1,u_particle_pos_offset:[Oo,Oo]}),zf=(l,t,n,c,d,p,m,g,x,w)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:n,u_velocity_res:c,u_max_speed:d,u_speed_factor:p,u_reset_rate:m,u_rand_seed:Math.random(),u_uv_offset:g,u_data_scale:[255*x[0],255*x[1]],u_data_offset:w,u_particle_pos_scale:1.1,u_particle_pos_offset:[Oo,Oo]}),Df=s.bC(),iu=(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k,F,U,H,j,te,Y,Q)=>{const X=d.transform,$={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:X.getCameraToCenterDistance(U),u_rotate_symbol:+n,u_aspect_ratio:X.width/X.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:g,u_is_text:+w,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:Df,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Df,u_up_vector:[0,-1,0],u_color_adj_mat:te,u_icon_transition:Y||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(U)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:s.o.devicePixelRatio,u_is_halo:1,u_scale_factor:Q||1,u_ground_shadow_factor:H,u_inv_matrix:s.bl(s.bC(),m),u_normal_scale:j,u_lutTexture:jr.LUT};
2972return U.name==="globe"&&($.u_tile_id=[C.canonical.x,C.canonical.y,1<<C.canonical.z],$.u_zoom_transition=z,$.u_inv_rot_matrix=k,$.u_merc_center=R,$.u_camera_forward=X._camera.forward(),$.u_ecef_origin=s.dV(X.globeMatrix,C.toUnwrapped()),$.u_tile_matrix=Float32Array.from(X.globeMatrix),$.u_up_vector=F),$},jl=(l,t,n,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:n,u_color:c}),Fs=(l,t,n,c,d,p,m,g,x)=>Object.assign((function(w,S,M,A,C,z){const{width:R,height:k}=A.imageManager.getPixelSize(S),F=Math.pow(2,z.tileID.overscaledZ),U=z.tileSize*Math.pow(2,A.transform.tileZoom)/F,H=U*(z.tileID.canonical.x+z.tileID.wrap*F),j=U*z.tileID.canonical.y;return{u_image:0,u_pattern_tl:M.tl,u_pattern_br:M.br,u_texsize:[R,k],u_pattern_size:M.displaySize,u_pattern_units_to_pixels:C?[A.transform.width,-1*A.transform.height]:[1/s.ay(z,1,A.transform.tileZoom),1/s.ay(z,1,A.transform.tileZoom)],u_pixel_coord_upper:[H>>16,j>>16],u_pixel_coord_lower:[65535&H,65535&j]}})(0,p,m,c,g,x),{u_matrix:l,u_emissive_strength:t,u_opacity:n}),Wa=new Float32Array(s.bA([])),pa=(l,t,n,c,d,p,m,g,x,w,S,M,A,C=[0,0,0],z,R,k)=>{const F=d.style.light,U=F.properties.get("position"),H=[-U.x,-U.y,U.z],j=s.dO();F.properties.get("anchor")==="viewport"&&(s.dP(j,-d.transform.angle),s.dQ(H,H,j));const te=S.alphaMode==="MASK",Y=F.properties.get("color").toNonPremultipliedRenderColor(null),Q=A.paint.get("model-ambient-occlusion-intensity"),X=A.paint.get("model-color").constantOr(s.ao.white).toNonPremultipliedRenderColor(null);return X.a=A.paint.get("model-color-mix-intensity").constantOr(0),k&&(X.r=k[0],X.g=k[1],X.b=k[2],X.a=k[3]),R&&(X.r=R.color.r,X.g=R.color.g,X.b=R.color.b,X.a=R.colorMix,M=R.emissionStrength,p*=R.opacity),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:n,u_node_matrix:c||Wa,u_lightpos:H,u_lightintensity:F.properties.get("intensity"),u_lightcolor:[Y.r,Y.g,Y.b],u_camera_pos:C,u_opacity:p,u_baseTextureIsAlpha:0,u_alphaMask:+te,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:g.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:w,u_baseColorTexture:jr.BaseColor,u_metallicRoughnessTexture:jr.MetallicRoughness,u_normalTexture:jr.Normal,u_occlusionTexture:jr.Occlusion,u_emissionTexture:jr.Emission,u_lutTexture:jr.LUT,u_color_mix:X.toArray01(),u_aoIntensity:Q,u_emissive_strength:M,u_occlusionTextureTransform:z||[0,0,0,0]}},Nh=(l,t=Wa,n=Wa)=>({u_matrix:l,u_instance:t,u_node_matrix:n}),ru={fillExtrusion:l=>({u_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_vertical_gradient:new s.cj(l),u_opacity:new s.cj(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_ao:new s.ck(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_up_dir:new s.ci(l),u_height_lift:new s.cj(l),u_flood_light_color:new s.ci(l),u_vertical_scale:new s.cj(l),u_flood_light_intensity:new s.cj(l),u_ground_shadow_factor:new s.ci(l)}),fillExtrusionDepth:l=>({u_matrix:new s.cl(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_vertical_scale:new s.cj(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l)}),fillExtrusionPattern:l=>({u_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_vertical_gradient:new s.cj(l),u_height_factor:new s.cj(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_ao:new s.ck(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_up_dir:new s.ci(l),u_height_lift:new s.cj(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_opacity:new s.cj(l),u_pattern_transition:new s.cj(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new s.cl(l),u_opacity:new s.cj(l),u_ao_pass:new s.cj(l),u_meter_to_tile:new s.cj(l),u_ao:new s.ck(l),u_flood_light_intensity:new s.cj(l),u_flood_light_color:new s.ci(l),u_attenuation:new s.cj(l),u_edge_radius:new s.cj(l),u_fb:new s.ch(l),u_fb_size:new s.cj(l),u_dynamic_offset:new s.cj(l)}),fill:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_ground_shadow_factor:new s.ci(l)}),fillPattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_pattern_transition:new s.cj(l)}),fillOutline:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_world:new s.ck(l),u_ground_shadow_factor:new s.ci(l)}),fillOutlinePattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_world:new s.ck(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_pattern_transition:new s.cj(l)}),building:l=>({u_matrix:new s.cl(l),u_normal_matrix:new s.cl(l),u_opacity:new s.cj(l),u_faux_facade_ao_intensity:new s.cj(l),u_camera_pos:new s.ci(l),u_tile_to_meter:new s.cj(l),u_facade_emissive_chance:new s.cj(l),u_flood_light_color:new s.ci(l),u_flood_light_intensity:new s.cj(l)}),buildingBloom:l=>({u_matrix:new s.cl(l)}),buildingDepth:l=>({u_matrix:new s.cl(l)}),elevatedStructuresDepth:l=>({u_matrix:new s.cl(l),u_depth_bias:new s.cj(l)}),elevatedStructures:l=>({u_matrix:new s.cl(l),u_ground_shadow_factor:new s.ci(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new s.cl(l),u_camera_pos:new s.ci(l),u_depth_bias:new s.cj(l),u_height_scale:new s.cj(l),u_reset_depth:new s.cj(l)}),circle:s.dY,collisionBox:l=>({u_matrix:new s.cl(l),u_inv_rot_matrix:new s.cl(l),u_camera_to_center_distance:new s.cj(l),u_extrude_scale:new s.ck(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_tile_id:new s.ci(l)}),collisionCircle:l=>({u_matrix:new s.cl(l),u_inv_matrix:new s.cl(l),u_camera_to_center_distance:new s.cj(l),u_viewport_size:new s.ck(l)}),debug:l=>({u_color:new s.dB(l),u_matrix:new s.cl(l),u_overlay:new s.ch(l),u_overlay_scale:new s.cj(l)}),clippingMask:l=>({u_matrix:new s.cl(l)}),heatmap:l=>({u_extrude_scale:new s.cj(l),u_intensity:new s.cj(l),u_matrix:new s.cl(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_up_dir:new s.ci(l)}),heatmapTexture:l=>({u_image:new s.ch(l),u_color_ramp:new s.ch(l),u_opacity:new s.cj(l)}),hillshade:l=>({u_matrix:new s.cl(l),u_image:new s.ch(l),u_latrange:new s.ck(l),u_light:new s.ck(l),u_shadow:new s.dB(l),u_highlight:new s.dB(l),u_emissive_strength:new s.cj(l),u_accent:new s.dB(l)}),hillshadePrepare:l=>({u_matrix:new s.cl(l),u_image:new s.ch(l),u_dimension:new s.ck(l),u_zoom:new s.cj(l)}),line:s.dX,linePattern:s.dW,raster:l=>({u_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_grid_matrix:new s.dC(l),u_tl_parent:new s.ck(l),u_scale_parent:new s.cj(l),u_fade_t:new s.cj(l),u_opacity:new s.cj(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_brightness_low:new s.cj(l),u_brightness_high:new s.cj(l),u_saturation_factor:new s.cj(l),u_contrast_factor:new s.cj(l),u_spin_weights:new s.ci(l),u_perspective_transform:new s.ck(l),u_raster_elevation:new s.cj(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_cutoff_params:new s.d3(l),u_colorization_mix:new s.d3(l),u_colorization_offset:new s.cj(l),u_color_ramp:new s.ch(l),u_texture_offset:new s.ck(l),u_texture_res:new s.ck(l),u_emissive_strength:new s.cj(l)}),rasterParticle:l=>({u_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_grid_matrix:new s.dC(l),u_tl_parent:new s.ck(l),u_scale_parent:new s.cj(l),u_fade_t:new s.cj(l),u_opacity:new s.cj(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_raster_elevation:new s.cj(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_cutoff_params:new s.d3(l)}),rasterParticleTexture:l=>({u_texture:new s.ch(l),u_opacity:new s.cj(l)}),rasterParticleDraw:l=>({u_particle_texture:new s.ch(l),u_particle_texture_side_len:new s.cj(l),u_tile_offset:new s.ck(l),u_velocity:new s.ch(l),u_color_ramp:new s.ch(l),u_velocity_res:new s.ck(l),u_max_speed:new s.cj(l),u_uv_offset:new s.ck(l),u_data_scale:new s.ck(l),u_data_offset:new s.cj(l),u_particle_pos_scale:new s.cj(l),u_particle_pos_offset:new s.ck(l)}),rasterParticleUpdate:l=>({u_particle_texture:new s.ch(l),u_particle_texture_side_len:new s.cj(l),u_velocity:new s.ch(l),u_velocity_res:new s.ck(l),u_max_speed:new s.cj(l),u_speed_factor:new s.cj(l),u_reset_rate:new s.cj(l),u_rand_seed:new s.cj(l),u_uv_offset:new s.ck(l),u_data_scale:new s.ck(l),u_data_offset:new s.cj(l),u_particle_pos_scale:new s.cj(l),u_particle_pos_offset:new s.ck(l)}),symbol:l=>({u_is_size_zoom_constant:new s.ch(l),u_is_size_feature_constant:new s.ch(l),u_size_t:new s.cj(l),u_size:new s.cj(l),u_camera_to_center_distance:new s.cj(l),u_rotate_symbol:new s.ch(l),u_aspect_ratio:new s.cj(l),u_fade_change:new s.cj(l),u_matrix:new s.cl(l),u_label_plane_matrix:new s.cl(l),u_coord_matrix:new s.cl(l),u_is_text:new s.ch(l),u_elevation_from_sea:new s.ch(l),u_pitch_with_map:new s.ch(l),u_texsize:new s.ck(l),u_texsize_icon:new s.ck(l),u_texture:new s.ch(l),u_texture_icon:new s.ch(l),u_gamma_scale:new s.cj(l),u_device_pixel_ratio:new s.cj(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_camera_forward:new s.ci(l),u_tile_matrix:new s.cl(l),u_up_vector:new s.ci(l),u_ecef_origin:new s.ci(l),u_is_halo:new s.ch(l),u_icon_transition:new s.cj(l),u_color_adj_mat:new s.cl(l),u_scale_factor:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_inv_matrix:new s.cl(l),u_normal_scale:new s.cj(l),u_lutTexture:new s.ch(l)}),background:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_opacity:new s.cj(l),u_color:new s.dB(l)}),backgroundPattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_opacity:new s.cj(l),u_image:new s.ch(l),u_pattern_tl:new s.ck(l),u_pattern_br:new s.ck(l),u_texsize:new s.ck(l),u_pattern_size:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_pattern_units_to_pixels:new s.ck(l)}),terrainRaster:l=>({u_matrix:new s.cl(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_skirt_height:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_emissive_texture_available:new s.cj(l)}),skybox:l=>({u_matrix:new s.cl(l),u_sun_direction:new s.ci(l),u_cubemap:new s.ch(l),u_opacity:new s.cj(l),u_temporal_offset:new s.cj(l)}),skyboxGradient:l=>({u_matrix:new s.cl(l),u_color_ramp:new s.ch(l),u_center_direction:new s.ci(l),u_radius:new s.cj(l),u_opacity:new s.cj(l),u_temporal_offset:new s.cj(l)}),skyboxCapture:l=>({u_matrix_3f:new s.dC(l),u_sun_direction:new s.ci(l),u_sun_intensity:new s.cj(l),u_color_tint_r:new s.d3(l),u_color_tint_m:new s.d3(l),u_luminance:new s.cj(l)}),globeRaster:l=>({u_proj_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_grid_matrix:new s.dC(l),u_skirt_height:new s.cj(l),u_far_z_cutoff:new s.cj(l),u_frustum_tl:new s.ci(l),u_frustum_tr:new s.ci(l),u_frustum_br:new s.ci(l),u_frustum_bl:new s.ci(l),u_globe_pos:new s.ci(l),u_globe_radius:new s.cj(l),u_viewport:new s.ck(l),u_emissive_texture_available:new s.cj(l)}),globeAtmosphere:l=>({u_frustum_tl:new s.ci(l),u_frustum_tr:new s.ci(l),u_frustum_br:new s.ci(l),u_frustum_bl:new s.ci(l),u_horizon:new s.cj(l),u_transition:new s.cj(l),u_fadeout_range:new s.cj(l),u_atmosphere_fog_color:new s.d3(l),u_high_color:new s.d3(l),u_space_color:new s.d3(l),u_temporal_offset:new s.cj(l),u_horizon_angle:new s.cj(l)}),model:l=>({u_matrix:new s.cl(l),u_lighting_matrix:new s.cl(l),u_normal_matrix:new s.cl(l),u_node_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_camera_pos:new s.ci(l),u_opacity:new s.cj(l),u_baseColorFactor:new s.d3(l),u_emissiveFactor:new s.d3(l),u_metallicFactor:new s.cj(l),u_roughnessFactor:new s.cj(l),u_baseTextureIsAlpha:new s.ch(l),u_alphaMask:new s.ch(l),u_alphaCutoff:new s.cj(l),u_baseColorTexture:new s.ch(l),u_metallicRoughnessTexture:new s.ch(l),u_normalTexture:new s.ch(l),u_occlusionTexture:new s.ch(l),u_emissionTexture:new s.ch(l),u_lutTexture:new s.ch(l),u_color_mix:new s.d3(l),u_aoIntensity:new s.cj(l),u_emissive_strength:new s.cj(l),u_occlusionTextureTransform:new s.d3(l)}),modelDepth:l=>({u_matrix:new s.cl(l),u_instance:new s.cl(l),u_node_matrix:new s.cl(l)}),groundShadow:l=>({u_matrix:new s.cl(l),u_ground_shadow_factor:new s.ci(l)}),stars:l=>({u_matrix:new s.cl(l),u_up:new s.ci(l),u_right:new s.ci(l),u_intensity_multiplier:new s.cj(l)}),snowParticle:l=>({u_modelview:new s.cl(l),u_projection:new s.cl(l),u_time:new s.cj(l),u_cam_pos:new s.ci(l),u_velocityConeAperture:new s.cj(l),u_velocity:new s.cj(l),u_horizontalOscillationRadius:new s.cj(l),u_horizontalOscillationRate:new s.cj(l),u_boxSize:new s.cj(l),u_billboardSize:new s.cj(l),u_simpleShapeParameters:new s.ck(l),u_screenSize:new s.ck(l),u_thinningCenterPos:new s.ck(l),u_thinningShape:new s.ci(l),u_thinningAffectedRatio:new s.cj(l),u_thinningParticleOffset:new s.cj(l),u_particleColor:new s.d3(l),u_direction:new s.ci(l)}),rainParticle:l=>({u_modelview:new s.cl(l),u_projection:new s.cl(l),u_time:new s.cj(l),u_cam_pos:new s.ci(l),u_texScreen:new s.ch(l),u_velocityConeAperture:new s.cj(l),u_velocity:new s.cj(l),u_boxSize:new s.cj(l),u_rainDropletSize:new s.ck(l),u_distortionStrength:new s.cj(l),u_rainDirection:new s.ci(l),u_color:new s.d3(l),u_screenSize:new s.ck(l),u_thinningCenterPos:new s.ck(l),u_thinningShape:new s.ci(l),u_thinningAffectedRatio:new s.cj(l),u_thinningParticleOffset:new s.cj(l),u_shapeDirectionalPower:new s.cj(l),u_shapeNormalPower:new s.cj(l),u_mode:new s.cj(l)}),vignette:l=>({u_vignetteShape:new s.ci(l),u_vignetteColor:new s.d3(l)}),occlusion:l=>({u_matrix:new s.cl(l),u_anchorPos:new s.ci(l),u_screenSizePx:new s.ck(l),u_occluderSizePx:new s.ck(l),u_color:new s.d3(l)})};class yo{constructor(t,n,c,d){this.id=yo.uniqueIdxCounter,yo.uniqueIdxCounter++,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||d||n.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=yo.uniqueIdxCounter,yo.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)}}yo.uniqueIdxCounter=0;const Vh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Lf{constructor(t,n,c,d,p,m){this.length=n.length,this.attributes=c,this.itemSize=n.bytesPerElement,this.dynamicDraw=d,this.instanceCount=m,this.context=t;const g=t.gl;this.buffer=g.createBuffer(),t.bindVertexBuffer.set(this.buffer),g.bufferData(g.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||p||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)}
2972enableAttributes(t,n){for(let c=0;c<this.attributes.length;c++){const d=n.getAttributeLocation(t,this.attributes[c].name);d!==-1&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=this.attributes[d],m=n.getAttributeLocation(t,p.name);m!==-1&&t.vertexAttribPointer(m,p.components,t[Vh[p.type]],!1,this.itemSize,p.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=n.getAttributeLocation(t,this.attributes[d].name);p!==-1&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(p,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Of{constructor(t,n,c,d,p){this.context=t,this.width=n,this.height=c;const m=this.framebuffer=t.gl.createFramebuffer();d>0&&(this.colorAttachment0=new $c(t,m,0)),d>1&&(this.colorAttachment1=new $c(t,m,1)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new Ha(t,m):new kl(t,m))}createColorAttachment(t,n){n===0?this.colorAttachment0=new $c(t,this.framebuffer,0):n===1&&(this.colorAttachment1=new $c(t,this.framebuffer,1))}removeColorAttachment(t,n){const c=this.context.gl;let d;n===0?(d=this.colorAttachment0.get(),this.colorAttachment0=void 0):n===1&&(d=this.colorAttachment1.get(),this.colorAttachment1=void 0),d&&c.deleteTexture(d)}destroy(){const t=this.context.gl;if(this.colorAttachment0){const n=this.colorAttachment0.get();n&&t.deleteTexture(n)}if(this.colorAttachment1){const n=this.colorAttachment1.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 Xa{constructor(t,n){this.gl=t,this.clearColor=new fm(this),this.clearDepth=new pf(this),this.clearStencil=new wh(this),this.colorMask=new Uc(this),this.depthMask=new Th(this),this.stencilMask=new da(this),this.stencilFunc=new Va(this),this.stencilOp=new Ol(this),this.stencilTest=new Ua(this),this.depthRange=new mf(this),this.depthTest=new Sh(this),this.depthFunc=new _f(this),this.blend=new ja(this),this.blendFunc=new jc(this),this.blendColor=new Gc(this),this.blendEquation=new Eh(this),this.cullFace=new Hc(this),this.cullFaceSide=new Fl(this),this.frontFace=new gf(this),this.program=new yf(this),this.activeTexture=new xf(this),this.viewport=new Ga(this),this.bindFramebuffer=new vf(this),this.bindRenderbuffer=new pm(this),this.bindTexture=new mm(this),this.bindVertexBuffer=new _m(this),this.bindElementBuffer=new Ih(this),this.bindVertexArrayOES=new Ah(this),this.pixelStoreUnpack=new Mh(this),this.pixelStoreUnpackPremultiplyAlpha=new Ch(this),this.pixelStoreUnpackFlipY=new bf(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.extBlendFuncExtended=t.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n,c){return new yo(this,t,n,c)}createVertexBuffer(t,n,c,d,p){return new Lf(this,t,n,c,d,p)}createRenderbuffer(t,n,c){const d=this.gl,p=d.createRenderbuffer();return this.bindRenderbuffer.set(p),d.renderbufferStorage(d.RENDERBUFFER,t,n,c),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,c,d){return new Of(this,t,n,c,d)}clear({color:t,depth:n,stencil:c,colorMask:d}){const p=this.gl;let m=0;t&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),n!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),c!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),p.clear(m)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){s.by(t.blendFunction,Dt.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 ma;function ot(l,t,n,c,d,p,m){const g=l.context,x=g.gl,w=l.transform,S=[s.aF(w.center.lng),s.aJ(w.center.lat)],M=n.layout.get("symbol-placement"),A=n.layout.get("text-variable-anchor"),C=n.layout.get("icon-rotation-alignment")==="map",z=n.layout.get("text-rotation-alignment")==="map",R=M!=="point",k=[];let F=0,U=0;for(let $=0;$<c.length;$++){const ie=c[$],ue=t.getTile(ie),le=ue.getBucket(n);if(!le)continue;const xe=le.getProjection().createInversionMatrix(w,ie.canonical),ve=[],Ae=Sc(ie,le,w),Ve=!m&&C&&R,me=m&&z&&R,se=A&&le.hasTextData(),Te=le.hasIconTextFit()&&se&&le.hasIconData(),_e=Ve||me||m&&se||Te,Re=le.projection.name==="globe",We=Re?s.aj(w.zoom):0;Re&&(ve.push("PROJECTION_GLOBE_VIEW"),_e&&ve.push("PROJECTED_POS_ON_VIEWPORT"));const et=l.getOrCreateProgram("collisionBox",{defines:ve});let qe=Ae;d[0]===0&&d[1]===0||(qe=l.translatePosMatrix(Ae,ue,d,p));const Ue=m?le.textCollisionBox:le.iconCollisionBox,ct=le.collisionCircleArray;
2972if(ct.length>0){const Je=s.bC(),it=qe;s.cP(Je,le.placementInvProjMatrix,w.glCoordMatrix),s.cP(Je,Je,le.placementViewportMatrix),k.push({circleArray:ct,circleOffset:U,transform:it,invTransform:Je,projection:le.getProjection()}),F+=ct.length/4,U=F}if(!Ue)continue;l.terrain&&l.terrain.setupElevationDraw(ue,et);const st=Re?[ie.canonical.x,ie.canonical.y,1<<ie.canonical.z]:[0,0,0];et.draw(l,x.LINES,ht.disabled,St.disabled,l.colorModeForRenderPass(),Tt.disabled,Bh(qe,xe,w,We,S,ue,st,le.getProjection()),n.id,Ue.layoutVertexBuffer,Ue.indexBuffer,Ue.segments,null,w.zoom,null,[Ue.collisionVertexBuffer,Ue.collisionVertexBufferExt])}if(!m||!k.length)return;const H=l.getOrCreateProgram("collisionCircle"),j=new s.dZ;j.resize(4*F),j._trim();let te=0;for(const $ of k)for(let ie=0;ie<$.circleArray.length/4;ie++){const ue=4*ie,le=$.circleArray[ue+0],xe=$.circleArray[ue+1],ve=$.circleArray[ue+2],Ae=$.circleArray[ue+3];j.emplace(te++,le,xe,ve,Ae,0),j.emplace(te++,le,xe,ve,Ae,1),j.emplace(te++,le,xe,ve,Ae,2),j.emplace(te++,le,xe,ve,Ae,3)}(!ma||ma.length<2*F)&&(ma=(function($){const ie=2*$,ue=new s.b0;ue.resize(ie),ue._trim();for(let le=0;le<ie;le++){const xe=6*le;ue.uint16[xe+0]=4*le+0,ue.uint16[xe+1]=4*le+1,ue.uint16[xe+2]=4*le+2,ue.uint16[xe+3]=4*le+2,ue.uint16[xe+4]=4*le+3,ue.uint16[xe+5]=4*le+0}return ue})(F));const Y=g.createIndexBuffer(ma,!0),Q=g.createVertexBuffer(j,s.d_.members,!0);for(const $ of k){const ie={u_matrix:$.transform,u_inv_matrix:$.invTransform,u_camera_to_center_distance:(X=w).getCameraToCenterDistance($.projection),u_viewport_size:[X.width,X.height]};H.draw(l,x.TRIANGLES,ht.disabled,St.disabled,l.colorModeForRenderPass(),Tt.disabled,ie,n.id,Q,Y,s.bg.simpleSegment(0,2*$.circleOffset,$.circleArray.length,$.circleArray.length/2),null,w.zoom)}var X;Q.destroy(),Y.destroy()}const Gl=s.bC();function Qo(l){const t=l._camera.getWorldToCamera(l.worldSize,1),n=s.aB([],t,l.globeMatrix);s.bl(n,n);const c=[0,0,0],d=[0,1,0,0];return s.aC(d,d,n),c[0]=d[0],c[1]=d[1],c[2]=d[2],s.aw(c,c),c}function ks({width:l,height:t,anchor:n,textOffset:c,textScale:d},p){const{horizontalAlign:m,verticalAlign:g}=s.c1(n),x=-(m-.5)*l,w=-(g-.5)*t,S=s.c2(n,c);return new s.P((x/d+S[0])*p,(w/d+S[1])*p)}function yt(l,t,n,c,d,p,m,g,x,w){const S=l.text.placedSymbolArray,M=l.text.dynamicLayoutVertexArray,A=l.icon.dynamicLayoutVertexArray,C={},z=l.getProjection(),R=Po(m,z,d),k=d.elevation,F=z.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;M.clear();for(let U=0;U<S.length;U++){const H=S.get(U),{tileAnchorX:j,tileAnchorY:te,numGlyphs:Y}=H,Q=H.hidden||!H.crossTileID||l.allowVerticalPlacement&&!H.placedOrientation?null:c[H.crossTileID];if(Q){let X=0,$=0,ie=0;const ue=l.elevationType==="road";if(k||ue){const _e=ue?l.getElevationFeatureForText(U):null,Re=s.bV.getAtTileOffset(m,new s.P(j,te),k,_e),[We,et,qe]=z.upVector(m.canonical,j,te);X=Re*We*F,$=Re*et*F,ie=Re*qe*F}let[le,xe,ve,Ae]=Yn(H.projectedAnchorX+X,H.projectedAnchorY+$,H.projectedAnchorZ+ie,n?R:p);const Ve=yi(d.getCameraToCenterDistance(z),Ae);let me=s.bM(l.textSizeData,x,H)*Ve/s.bY;n&&(me*=l.tilePixelRatio/g);const se=ks(Q,me);n?({x:le,y:xe,z:ve}=z.projectTilePoint(j+se.x,te+se.y,m.canonical),[le,xe,ve]=Yn(le+X,xe+$,ve+ie,p)):(t&&se._rotate(-d.angle),le+=se.x,xe+=se.y,ve=0);const Te=l.allowVerticalPlacement&&H.placedOrientation===s.bL.vertical?Math.PI/2:0;for(let _e=0;_e<Y;_e++)s.bO(M,le,xe,ve,Te);w&&H.associatedIconIndex>=0&&(C[H.associatedIconIndex]={x:le,y:xe,z:ve,angle:Te})}else mo(Y,M)}if(w){A.clear();const U=l.icon.placedSymbolArray;for(let H=0;H<U.length;H++){const j=U.get(H),{numGlyphs:te}=j,Y=C[H];if(j.hidden||!Y)mo(te,A);else{const{x:Q,y:X,z:$,angle:ie}=Y;for(let ue=0;ue<te;ue++)s.bO(A,Q,X,$,ie)}}l.icon.dynamicLayoutVertexBuffer.updateData(A)}l.text.dynamicLayoutVertexBuffer.updateData(M)}function Hl(l,t,n,c,d,p,m={}){const g=n.paint.get("icon-translate"),x=n.paint.get("text-translate"),w=n.paint.get("icon-translate-anchor"),S=n.paint.get("text-translate-anchor"),M=n.layout.get("icon-rotation-alignment"),A=n.layout.get("text-rotation-alignment"),C=n.layout.get("icon-pitch-alignment"),z=n.layout.get("text-pitch-alignment"),R=n.layout.get("icon-keep-upright"),k=n.layout.get("text-keep-upright"),F=n.paint.get("icon-color-saturation"),U=n.paint.get("icon-color-contrast"),H=n.paint.get("icon-color-brightness-min"),j=n.paint.get("icon-color-brightness-max"),te=n.layout.get("symbol-elevation-reference")==="sea",Y=n.layout.get("icon-image-use-theme")==="none",Q=l.context,X=Q.gl,$=l.transform,ie=M==="map",ue=A==="map",le=C==="map",xe=z==="map",ve=n.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Ae=!1;const Ve=l.depthModeForSublayer(0,ht.ReadOnly),me=new ht(l.context.gl.LEQUAL,ht.ReadOnly,l.depthRangeFor3D),se=[s.aF($.center.lng),s.aJ($.center.lat)],Te=n.layout.get("text-variable-anchor"),_e=$.projection.name==="globe",Re=[],We=[0,-1,0];for(const et of c){const qe=t.getTile(et),Ue=qe.getBucket(n);if(!Ue||Ue.projection.name==="mercator"&&_e||Ue.fullyClipped)continue;const ct=Ue.projection.name==="globe",st=ct?s.aj($.zoom):0,Je=Po(et,Ue.getProjection(),$),it=$.calculatePixelsToTileUnitsMatrix(qe),gt=Te&&Ue.hasTextData(),Mt=Ue.hasIconTextFit()&>&&Ue.hasIconData(),$t=Ue.getProjection().createInversionMatrix($,et.canonical),ci=(1<<qe.tileID.canonical.z)*s.al/l.transform.worldSize,ut=fi=>{let Qt=[0,0,0];if(fi){const Ft=l.style.directionalLight,Fi=l.style.ambientLight;Ft&&Fi&&(Qt=Ko(l.style,Ft,Fi))}return Qt},si=fi=>{$.depthOcclusionForSymbolsAndCircles&&(n.hasOcclusionOpacityProperties||l.terrain)&&(fi.push("DEPTH_D24"),fi.push("DEPTH_OCCLUSION"))},At=fi=>{n.lut&&!Y&&(n.lut.texture||(n.lut.texture=new s.d$(l.context,n.lut.image,[n.lut.image.height,n.lut.image.height,n.lut.image.height],Q.gl.RGBA8)),Q.activeTexture.set(Q.gl.TEXTURE0+jr.LUT),n.lut.texture&&n.lut.texture.bind(Q.gl.LINEAR,Q.gl.CLAMP_TO_EDGE),fi.push("APPLY_LUT_ON_GPU"))},di=()=>{const fi=ie&&n.layout.get("symbol-placement")!=="point",Qt=[];si(Qt),At(Qt);const Ft=fi||Mt,Fi=Ue.elevationType==="road",ur=l.shadowRenderer,Xi=Fi&&le&&!!ur&&ur.enabled,Ai=ut(Xi),vn=Fi&&le&&!l.terrain?me:Ve,Kr=n.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&le&&Qt.push("PITCH_WITH_MAP_TERRAIN"),ct&&(Qt.push("PROJECTION_GLOBE_VIEW"),Ft&&Qt.push("PROJECTED_POS_ON_VIEWPORT")),Kr>0&&Ue.hasAnySecondaryIcon&&Qt.push("ICON_TRANSITION"),!Ue.icon.zOffsetVertexBuffer||Fi&&l.terrain||Qt.push("Z_OFFSET"),F===0&&U===0&&H===0&&j===1||Qt.push("COLOR_ADJUSTMENT"),Ue.sdfIcons&&Qt.push("RENDER_SDF"),Xi&&Qt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Fi&&le&&!l.terrain&&Ue.icon.orientationVertexBuffer&&Qt.push("ELEVATED_ROADS");const Cr=Ue.icon.programConfigurations.get(n.id),sn=l.getOrCreateProgram("symbol",{c
2972onfig:Cr,defines:Qt}),an=qe.imageAtlasTexture?qe.imageAtlasTexture.size:[0,0],Zr=Ue.iconSizeData,Hn=s.bK(Zr,$.zoom),no=le||!$.isOrthographic,Cn=fn(Je,qe.tileID.canonical,le,ie,$,Ue.getProjection(),it),ar=El(Je,qe.tileID.canonical,le,ie,$,Ue.getProjection(),it),pr=l.translatePosMatrix(ar,qe,g,w,!0),Mi=l.translatePosMatrix(Je,qe,g,w),yr=Ft?Gl:Cn,ir=ie&&!le&&!fi;let Yi=We;!_e&&!$.mercatorFromTransition||ie||(Yi=Qo($));const oo=ct?Yi:We,ic=n.getColorAdjustmentMatrix(F,U,H,j),bo=iu(Zr.kind,Hn,ir,le,l,Mi,yr,pr,te,!1,an,[0,0],0,et,st,se,$t,oo,Ue.getProjection(),Ai,ci,ic,Kr,null),rc=qe.imageAtlasTexture?qe.imageAtlasTexture:null,nl=n.layout.get("icon-size").constantOr(0)!==1||Ue.iconsNeedLinear,Vo=Ue.sdfIcons||l.options.rotating||l.options.zooming||nl||no?X.LINEAR:X.NEAREST,ls=Ue.sdfIcons&&n.paint.get("icon-halo-width").constantOr(1)!==0,ol=l.terrain&&le&&fi?s.bl(s.bC(),Cn):Gl;if(fi&&Ue.icon){const js=s.bV.getAtTileOffsetFunc(et,$.center.lat,$.worldSize,Ue.getProjection()),cs=Ec(Je,qe.tileID.canonical,le,ie,$,Ue.getProjection(),it),wo=n.layout.get("icon-size-scale-range"),us=s.aA(l.scaleFactor,wo[0],wo[1]);of(Ue,Je,l,!1,cs,ar,le,R,js,et,us)}return{program:sn,buffers:Ue.icon,uniformValues:bo,atlasTexture:rc,atlasTextureIcon:null,atlasInterpolation:Vo,atlasInterpolationIcon:null,isSDF:Ue.sdfIcons,hasHalo:ls,depthMode:vn,tile:qe,renderWithShadows:Xi,labelPlaneMatrixInv:ol}},Ti=()=>{const fi=ue&&n.layout.get("symbol-placement")!=="point",Qt=[],Ft=fi||Te||Mt,Fi=Ue.elevationType==="road",ur=l.shadowRenderer,Xi=Fi&&xe&&!!ur&&ur.enabled,Ai=ut(Xi),vn=Fi&&xe&&!l.terrain?me:Ve;l.terrainRenderModeElevated()&&xe&&Qt.push("PITCH_WITH_MAP_TERRAIN"),ct&&(Qt.push("PROJECTION_GLOBE_VIEW"),Ft&&Qt.push("PROJECTED_POS_ON_VIEWPORT")),!Ue.text.zOffsetVertexBuffer||Fi&&l.terrain||Qt.push("Z_OFFSET"),Ue.iconsInText&&Qt.push("RENDER_TEXT_AND_SYMBOL"),Qt.push("RENDER_SDF"),Xi&&Qt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Fi&&xe&&!l.terrain&&Ue.text.orientationVertexBuffer&&Qt.push("ELEVATED_ROADS"),si(Qt);const Kr=Ue.text.programConfigurations.get(n.id),Cr=l.getOrCreateProgram("symbol",{config:Kr,defines:Qt});let sn,an=[0,0],Zr=null;const Hn=Ue.textSizeData;Ue.iconsInText&&(an=qe.imageAtlasTexture?qe.imageAtlasTexture.size:[0,0],Zr=qe.imageAtlasTexture?qe.imageAtlasTexture:null,sn=xe||!$.isOrthographic||l.options.rotating||l.options.zooming||Hn.kind==="composite"||Hn.kind==="camera"?X.LINEAR:X.NEAREST);const no=qe.glyphAtlasTexture?qe.glyphAtlasTexture.size:[0,0],Cn=n.layout.get("text-size-scale-range"),ar=s.aA(l.scaleFactor,Cn[0],Cn[1]),pr=s.bK(Hn,$.zoom,ar),Mi=fn(Je,qe.tileID.canonical,xe,ue,$,Ue.getProjection(),it),yr=El(Je,qe.tileID.canonical,xe,ue,$,Ue.getProjection(),it),ir=l.translatePosMatrix(yr,qe,x,S,!0),Yi=l.translatePosMatrix(Je,qe,x,S),oo=Ft?Gl:Mi,ic=ue&&!xe&&!fi;let bo=We;!_e&&!$.mercatorFromTransition||ue||(bo=Qo($));const rc=iu(Hn.kind,pr,ic,xe,l,Yi,oo,ir,te,!0,no,an,0,et,st,se,$t,ct?bo:We,Ue.getProjection(),Ai,ci,null,null,ar),nl=qe.glyphAtlasTexture?qe.glyphAtlasTexture:null,Vo=X.LINEAR,ls=n.paint.get("text-halo-width").constantOr(1)!==0,ol=l.terrain&&xe&&fi?s.bl(s.bC(),Mi):Gl;if(fi&&Ue.text){const js=s.bV.getAtTileOffsetFunc(et,$.center.lat,$.worldSize,Ue.getProjection()),cs=Ec(Je,qe.tileID.canonical,xe,ue,$,Ue.getProjection(),it);of(Ue,Je,l,!0,cs,yr,xe,k,js,et,ar)}return{program:Cr,buffers:Ue.text,uniformValues:rc,atlasTexture:nl,atlasTextureIcon:Zr,atlasInterpolation:Vo,atlasInterpolationIcon:sn,isSDF:!0,hasHalo:ls,depthMode:vn,tile:qe,renderWithShadows:Xi,labelPlaneMatrixInv:ol}},xi=Ue.icon.segments.get().length,ni=Ue.text.segments.get().length,Ot=xi&&!m.onlyText?di():null,hi=ni&&!m.onlyIcons?Ti():null,tr=n.paint.get("icon-opacity").constantOr(1),Ui=n.paint.get("text-opacity").constantOr(1);if(ve&&Ue.canOverlap){Ae=!0;const fi=tr&&!m.onlyText?Ue.icon.segments.get():[],Qt=Ui&&!m.onlyIcons?Ue.text.segments.get():[];for(const Ft of fi)Re.push({segments:new s.bg([Ft]),sortKey:Ft.sortKey,state:Ot});for(const Ft of Qt)Re.push({segments:new s.bg([Ft]),sortKey:Ft.sortKey,state:hi})}else m.onlyText||Re.push({segments:tr?Ue.icon.segments:new s.bg([]),sortKey:0,state:Ot}),m.onlyIcons||Re.push({segments:Ui?Ue.text.segments:new s.bg([]),sortKey:0,state:hi})}Ae&&Re.sort(((et,qe)=>et.sortKey-qe.sortKey));for(const et of Re){const qe=et.state;if(qe)if(l.terrain?l.terrain.setupElevationDraw(qe.tile,qe.program,{useDepthForOcclusion:$.depthOcclusionForSymbolsAndCircles,labelPlaneMatr
2972ixInv:qe.labelPlaneMatrixInv}):l.setupDepthForOcclusion($.depthOcclusionForSymbolsAndCircles,qe.program),Q.activeTexture.set(X.TEXTURE0),qe.atlasTexture&&qe.atlasTexture.bind(qe.atlasInterpolation,X.CLAMP_TO_EDGE,!0),qe.atlasTextureIcon&&(Q.activeTexture.set(X.TEXTURE1),qe.atlasTextureIcon&&qe.atlasTextureIcon.bind(qe.atlasInterpolationIcon,X.CLAMP_TO_EDGE,!0)),qe.renderWithShadows&&l.shadowRenderer.setupShadows(qe.tile.tileID.toUnwrapped(),qe.program,"vector-tile"),l.uploadCommonLightUniforms(l.context,qe.program),qe.hasHalo){const Ue=qe.uniformValues;Ue.u_is_halo=1,Uh(qe.buffers,et.segments,n,l,qe.program,qe.depthMode,d,p,Ue,2),Ue.u_is_halo=0}else{if(qe.isSDF){const Ue=qe.uniformValues;qe.hasHalo&&(Ue.u_is_halo=1,Uh(qe.buffers,et.segments,n,l,qe.program,qe.depthMode,d,p,Ue,1)),Ue.u_is_halo=0}Uh(qe.buffers,et.segments,n,l,qe.program,qe.depthMode,d,p,qe.uniformValues,1)}}}function Uh(l,t,n,c,d,p,m,g,x,w){const S=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,p,m,g,Tt.disabled,x,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,c.transform.zoom,l.programConfigurations.get(n.id),S,w)}function Ff(l,t){const n=1<<l.canonical.z,c=(t.x*n-l.canonical.x-l.wrap*n)*s.al,d=(t.y*n-l.canonical.y)*s.al,p=s.e8(t.z,t.y);return s.d5(c,d,p)}function nu(l,t,n,c,d){if(!n.layout||n.layout.get("fill-elevation-reference")==="none"||n.paint.get("fill-opacity").constantOr(1)===0)return;const p=l.context.gl,m=new ht(l.context.gl.LEQUAL,ht.ReadWrite,l.depthRangeFor3D),g=new ht(l.context.gl.GREATER,ht.ReadWrite,l.depthRangeFor3D),x=(function(C){let z=.01;return C.isOrthographic&&(z=s.ak(1e-4,z,s.d0(C.pitch>=go?1:C.pitch/go))),2*z})(l.transform),w=l.transform.getFreeCameraOptions().position,S="elevatedStructuresDepthReconstruct",M=l.getOrCreateProgram(S,{defines:["DEPTH_RECONSTRUCTION"]}),A=l.getOrCreateProgram(S);for(const C of c){const z=t.getTile(C),R=z.getBucket(n);if(!R)continue;const k=R.elevatedStructures;if(!k)continue;const F=R.elevationBufferData.heightRange,U=Ff(C.toUnwrapped(),w),H=l.translatePosMatrix(C.projMatrix,z,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));let j,te,Y,Q;if(d==="initialize"){if(!F||F.min>=1||k.depthSegments.segments[0].primitiveLength===0)continue;j=fa(H,U,x,1,0),te=m,Y=k.depthSegments,Q=M}else if(d==="reset"){if(!F||F.min>=0||k.maskSegments.segments[0].primitiveLength===0)continue;j=fa(H,U,0,0,1),te=g,Y=k.maskSegments,Q=M}else if(d==="geometry"){if(k.depthSegments.segments[0].primitiveLength===0)continue;j=fa(H,U,x,1,0),te=m,Y=k.depthSegments,Q=A}Q.draw(l,p.TRIANGLES,te,St.disabled,Dt.disabled,Tt.disabled,j,n.id,k.vertexBuffer,k.indexBuffer,Y,n.paint,l.transform.zoom)}}function ou(l,t,n,c){const{painter:d,sourceCache:p,layer:m,coords:g,colorMode:x,elevationType:w,terrainEnabled:S,pass:M}=l,A=d.context.gl,C=m.paint.get("fill-pattern"),z=m.paint.get("fill-pattern-cross-fade"),R=C.constantOr(null);let k=w;w!=="road"||t&&!S||(k="none");const F=k==="road",U=l.painter.shadowRenderer,H=F&&!!U&&U.enabled,j=new ht(d.context.gl.LEQUAL,ht.ReadOnly,d.depthRangeFor3D);let te=[0,0,0];if(H){const $=d.style.directionalLight,ie=d.style.ambientLight;$&&ie&&(te=Ko(d.style,$,ie))}const Y=C&&C.constantOr(1),Q=d.terrain&&d.terrain.renderingToTexture,X=($,ie)=>{let ue,le,xe,ve,Ae;ie?(ue=Y&&!m.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",xe=A.LINES):(ue=Y?"fillPattern":"fill",xe=A.TRIANGLES);for(const Ve of g){const me=p.getTile(Ve);if(Y&&!me.patternsLoaded())continue;const se=me.getBucket(m);if(!se)continue;const Te=t?se.elevationBufferData:se.bufferData;if(Te.isEmpty())continue;d.prepareDrawTile();const _e=Te.programConfigurations.get(m.id),Re=d.isTileAffectedByFog(Ve),We=[],et=[];F&&(We.push("ELEVATED_ROADS"),et.push(Te.elevatedLayoutVertexBuffer)),H&&We.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Q&&n&&We.push("USE_MRT1"),Y&&(d.context.activeTexture.set(A.TEXTURE0),me.imageAtlasTexture&&me.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),_e.updatePaintBuffers());let qe=!1;if(R&&me.imageAtlas){const it=me.imageAtlas,gt=s.e3.from(R),Mt=gt.getPrimary().scaleSelf(s.o.devicePixelRatio).toString(),$t=gt.getSecondary(),ci=it.patternPositions.get(Mt),ut=$t?it.patternPositions.get($t.scaleSelf(s.o.devicePixelRatio).toString()):null;qe=!!ci&&!!ut,ci&&_e.setConstantPatternPositions(ci,ut)}z>0&&(qe||_e.getPatternTransitionVertexBuffer("fill-pattern"))&&We.push("FILL_PATTERN_TRANSITION");const Ue=d.getOrCreateProgram(ue,{config:_e,overrideFog:Re,defines:We}),ct=d.translatePosMatrix(Ve.projMatrix,me,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));H&&U.setupShadows(me.tileID.toUnwrapped(),Ue,"vector-tile");const st=m.paint.get("fill-emissive-strength");if(ie){ve=Te.lineIndexBuffer,Ae=Te.lineSegments;const it=d.terrain&&d.terrain.renderingToTexture?d.terrain.drapeBufferSize:[A.drawingBufferWidth,A.drawingBufferHeight];le=ue==="fillOutlinePattern"&&Y?kh(ct,st,d,me,it,te,z):If(ct,st,it,te)}else ve=Te.indexBuffer,Ae=Te.triangleSegments,le=Y?Fh(ct,st,d,me,te,z):Oh(ct,st,te);d.uploadCommonUniforms(d.context,Ue,Ve.toUnwrapped());let Je=$;(w==="road"&&!S||w==="offset")&&(Je=j),Ue.draw(d,xe,Je,c||d.stencilModeForClipping(Ve),x,Tt.disabled,le,m.id,Te.layoutVertexBuffer,ve,Ae,m.paint,d.transform.zoom,_e,et)}};d.renderPass===M&&X(d.depthModeForSublayer(1,d.renderPass==="opaque"?ht.ReadWrite:ht.ReadOnly),!1),k==="none"&&d.renderPass==="translucent"&&m.paint.get("fill-antialias")&&X(d.depthModeForSublayer(m.getPaintProperty("fill-outline-color")?2:0,ht.ReadOnly),!0)}function su(l,t,n,c,d,p,m,g){n.resetLayerRenderingStats(l);const x=l.context,w=x.gl,S=l.transform,M=n.paint.get("fill-extrusion-pattern"),A=n.paint.get("fill-extrusion-pattern-cross-fade"),C=M.constantOr(null),z=M.constantOr(1),R=n.paint.get("fill-extrusion-opacity"),k=l.style.enable3dLights(),F=n.paint.get(k&&!z?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),U=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),F],H=n.layout.get("fill-extrusion-edge-radius"),j=H>0&&!n.paint.get("fill-extrusion-rounded-roof"),te=j?0:H,Y=S.projection.name==="globe"?s.eb():0,Q=S.projection.name==="globe",X=Q?s.aj(S.zoom):0,$=[s.aF(S.
2972center.lng),s.aJ(S.center.lat)],ie=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",ue=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ie?null:n.lut).toArray01().slice(0,3),le=n.paint.get("fill-extrusion-flood-light-intensity"),xe=n.paint.get("fill-extrusion-vertical-scale"),ve=n.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Ae=n.paint.get("fill-extrusion-height-alignment"),Ve=n.paint.get("fill-extrusion-base-alignment"),me=Ms(l,n.paint.get("fill-extrusion-cutoff-fade-range")),se=[];let Te;Q&&se.push("PROJECTION_GLOBE_VIEW"),U[0]>0&&se.push("FAUX_AO"),j&&se.push("ZERO_ROOF_RADIUS"),g&&se.push("HAS_CENTROID"),le>0&&se.push("FLOOD_LIGHT"),me.shouldRenderCutoff&&se.push("RENDER_CUTOFF"),ve&&se.push("RENDER_WALL_MODE");const _e=l.renderPass==="shadow",Re=l.shadowRenderer,We=_e&&!!Re,et=_e?Tt.disabled:Tt.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let qe=[0,0,0];if(Re){const st=l.style.directionalLight,Je=l.style.ambientLight;st&&Je&&(qe=Ko(l.style,st,Je)),_e||(se.push("RENDER_SHADOWS","DEPTH_TEXTURE"),Re.useNormalOffset&&se.push("NORMAL_OFFSET")),Te=se.concat(["SHADOWS_SINGLE_CASCADE"])}
2972const Ue=We?"fillExtrusionDepth":z?"fillExtrusionPattern":"fillExtrusion",ct=n.getLayerRenderingStats();for(const st of c){const Je=t.getTile(st),it=Je.getBucket(n);if(!it||it.projection.name!==S.projection.name)continue;let gt=!1;Re&&(gt=Re.getMaxCascadeForTile(st.toUnwrapped())===0);const Mt=l.isTileAffectedByFog(st),$t=it.programConfigurations.get(n.id);let ci=!1;if(C&&Je.imageAtlas){const ni=Je.imageAtlas,Ot=s.e3.from(C),hi=Ot.getPrimary().scaleSelf(s.o.devicePixelRatio).toString(),tr=Ot.getSecondary(),Ui=ni.patternPositions.get(hi),fi=tr?ni.patternPositions.get(tr.scaleSelf(s.o.devicePixelRatio).toString()):null;ci=!!Ui&&!!fi,Ui&&$t.setConstantPatternPositions(Ui,fi)}A>0&&(ci||$t.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&se.push("FILL_EXTRUSION_PATTERN_TRANSITION");const ut=l.getOrCreateProgram(Ue,{config:$t,defines:gt?Te:se,overrideFog:Mt});if(l.terrain&&l.terrain.setupElevationDraw(Je,ut,{useMeterToDem:!0}),!it.centroidVertexBuffer){const ni=ut.getAttributeLocation(w,"a_centroid_pos");ni!==-1&&w.vertexAttrib2f(ni,0,0)}!_e&&Re&&Re.setupShadows(Je.tileID.toUnwrapped(),ut,"vector-tile"),z&&(l.context.activeTexture.set(w.TEXTURE0),Je.imageAtlasTexture&&Je.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),$t.updatePaintBuffers());const si=n.paint.get("fill-extrusion-vertical-gradient"),At=1/it.tileToMeter;let di;if(_e&&Re){if(ts(Je.tileID,it.maxHeight,l))continue;const ni=Re.calculateShadowPassMatrixFromTile(Je.tileID.toUnwrapped());di=Lh(ni,te,At,xe,Ae,Ve)}else{const ni=l.translatePosMatrix(st.expandedProjMatrix,Je,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),Ot=S.projection.createInversionMatrix(S,st.canonical);di=z?Ef(ni,l,si,R,U,te,At,st,Je,Y,Ae,Ve,X,$,Ot,ue,xe,A):Jc(ni,l,si,R,U,te,At,st,Y,Ae,Ve,X,$,Ot,ue,xe,le,qe)}l.uploadCommonUniforms(x,ut,st.toUnwrapped(),null,me);let Ti=it.segments;if(S.projection.name==="mercator"&&!_e&&(Ti=it.getVisibleSegments(Je.tileID,l.terrain,l.transform.getFrustum(0)),!Ti.get().length))continue;if(ct)if(_e)for(const ni of Ti.get())ct.numRenderedVerticesInShadowPass+=ni.primitiveLength;else for(const ni of Ti.get())ct.numRenderedVerticesInTransparentPass+=ni.primitiveLength;const xi=[];(l.terrain||g)&&xi.push(it.centroidVertexBuffer),Q&&xi.push(it.layoutVertexExtBuffer),ve&&xi.push(it.wallVertexBuffer),ut.draw(l,x.gl.TRIANGLES,d,p,m,et,di,n.id,it.layoutVertexBuffer,it.indexBuffer,Ti,n.paint,l.transform.zoom,$t,xi)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}class jh{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function es(l,t,n,c,d,p,m,g,x,w,S,M,A,C,z,R,k,F,U,H){const j=t.context,te=j.gl,Y=t.transform,Q=t.transform.zoom,X=[],$=l.translate,ie=l.translateAnchor,ue=l.edgeRadius,le=Ms(t,l.cutoffFadeRange);S==="clear"?(X.push("CLEAR_SUBPASS"),H&&(X.push("CLEAR_FROM_TEXTURE"),j.activeTexture.set(te.TEXTURE0),H.bind(te.LINEAR,te.CLAMP_TO_EDGE))):S==="sdf"?X.push("SDF_SUBPASS"):S==="emissive"&&(X.push("USE_MRT1"),j.activeTexture.set(te.TEXTURE0),H.bind(te.LINEAR,te.CLAMP_TO_EDGE)),F&&X.push("HAS_CENTROID"),le.shouldRenderCutoff&&X.push("RENDER_CUTOFF");const xe=(ve,Ae,Ve,me,se)=>{let Te=X;Ae.groundRadiusBuffer!=null&&(Te=X.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const _e=Ae.programConfigurations.get(c.id),Re=t.isTileAffectedByFog(ve),We=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:_e,defines:Te,overrideFog:Re}),et=Za(t,me,M,w,se,[A,C*se],z,R,k,Q>=17?0:ue*se,H?H.size[0]:0),qe=[];F&&qe.push(Ae.hiddenByLandmarkVertexBuffer),Ae.groundRadiusBuffer!=null&&qe.push(Ae.groundRadiusBuffer),t.uploadCommonUniforms(j,We,ve.toUnwrapped(),null,le),We.draw(t,j.gl.TRIANGLES,p,m,g,x,et,c.id,Ae.vertexBuffer,Ae.indexBuffer,Ve,c.paint,Q,_e,qe)};for(const ve of d){const Ae=n.getTile(ve),Ve=Ae.getBucket(c);if(!Ve||Ve.projection.name!==Y.projection.name||!Ve.groundEffect||Ve.groundEffect&&!Ve.groundEffect.hasData())continue;const me=Ve.groundEffect,se=1/Ve.tileToMeter;{const Te=t.translatePosMatrix(ve.projMatrix,Ae,$,ie),_e=me.getDefaultSegment();xe(ve,me,_e,Te,se)}if(U)for(let Te=0;Te<4;Te++){const _e=s.e9[Te](ve),Re=n.getTile(_e);if(!Re)continue;const We=Re.getBucket(c);if(!We||We.projection.name!==Y.projection.name||!We.groundEffect||We.groundEffect&&!We.groundEffect.hasData())continue;const et=We.groundEffect;let qe,Ue;Te===0?(qe=[-s.al,0,0],Ue=1):Te===1?(qe=[s.al,0,0],Ue=0):Te===2?(qe=[0,-s.al,0],Ue=3):(qe=[0,s.al,0],Ue=2);const ct=et.regionSegments[Ue];if(!ct)continue;const st=new Float32Array(16);s.br(st,ve.projMatrix,qe),xe(ve,et,ct,t.translatePosMatrix(st,Ae,$,ie),se)}}}
2972function wm(l,t,n,c,d,p,m){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const g=p?p.findDEMTileFor(n):null;if(!(g&&g.dem||m))return;p&&g&&g.dem&&c.selfDEMTileTimestamp!==g.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=g.dem._timestamp);const x=F=>new s.P(Math.ceil((F+s.ed)*s.ee),0),w=F=>{const U=t.getSource().minzoom,H=te=>{const Y=t.getTileByID(te);if(Y&&Y.hasData())return Y.getBucket(d)},j=[0,-1,1];for(const te of j){if(F.overscaledZ+te<U)continue;const Y=H(F.calculateScaledKey(F.overscaledZ+te));if(Y)return Y}},S=[0,0,0],M=(F,U)=>(S[0]=Math.min(F.min.y,U.min.y),S[1]=Math.max(F.max.y,U.max.y),S[2]=s.al-U.min.x>F.max.x?U.min.x-s.al:F.max.x,S),A=(F,U)=>(S[0]=Math.min(F.min.x,U.min.x),S[1]=Math.max(F.max.x,U.max.x),S[2]=s.al-U.min.y>F.max.y?U.min.y-s.al:F.max.y,S),C=[(F,U)=>M(F,U),(F,U)=>M(U,F),(F,U)=>A(F,U),(F,U)=>A(U,F)],z=(F,U,H,j,te,Y,Q)=>{if(!p)return 0;const X=[[Y?H:F,Y?F:H,0],[Y?H:U,Y?U:H,0]],$=Q<0?s.al+Q:Q,ie=[Y?$:(F+U)/2,Y?(F+U)/2:$,0];return H===0&&Q<0||H!==0&&Q>0?p.getForTilePoints(te,[ie],!0,j):X.push(ie),p.getForTilePoints(n,X,!0,g),Math.max(X[0][2],X[1][2],ie[2])/p.exaggeration()};for(let F=0;F<4;F++){const U=c.borderFeatureIndices[F];if(U.length===0)continue;const H=s.e9[F](n),j=w(H);if(!(j&&j instanceof s.ea))continue;const te=p?p.findDEMTileFor(H):null;if(!(te&&te.dem||m)||(p&&te&&te.dem&&c.borderDEMTileTimestamp[F]!==te.dem._timestamp&&(c.borderDoneWithNeighborZ[F]=-1,c.borderDEMTileTimestamp[F]=te.dem._timestamp),c.borderDoneWithNeighborZ[F]===j.canonical.z))continue;j.centroidVertexArray.length===0&&j.createCentroidsBuffer();const Y=(F<2?1:5)-F,Q=j.borderDoneWithNeighborZ[Y]!==c.canonical.z,X=j.borderFeatureIndices[Y];let $=0;if(c.canonical.z!==j.canonical.z){for(const ie of U)c.showCentroid(c.featuresOnBorder[ie]);if(Q)for(const ie of X)j.showCentroid(j.featuresOnBorder[ie]);c.borderDoneWithNeighborZ[F]=j.canonical.z,j.borderDoneWithNeighborZ[Y]=c.canonical.z}for(const ie of U){const ue=c.featuresOnBorder[ie],le=c.centroidData[ue.centroidDataIndex],xe=ue.borders[F];let ve;for(;$<X.length;){ve=j.featuresOnBorder[X[$]];const Ae=ve.borders[Y];if(Ae[1]>xe[0]+3||Ae[0]>xe[0]-3)break;j.showCentroid(ve),$++}if(ve&&$<X.length){const Ae=$;let Ve=0;for(;!(ve.borders[Y][0]>xe[1]-3)&&(Ve++,++$!==X.length);)ve=j.featuresOnBorder[X[$]];ve=j.featuresOnBorder[X[Ae]];let me=!1;if(Ve>=1){const _e=ve.borders[Y];Math.abs(xe[0]-_e[0])<3&&Math.abs(xe[1]-_e[1])<3&&(Ve=1,me=!0,$=Ae+1)}else if(Ve===0){c.showCentroid(ue);continue}const se=j.centroidData[ve.centroidDataIndex];m&&me&&(((R=le).flags|(k=se).flags)&s.ec?(R.flags|=s.ec,k.flags|=s.ec):(R.flags&=~s.ec,k.flags&=~s.ec));const Te=ue.intersectsCount()>1||ve.intersectsCount()>1;if(Ve>1)$=Ae,le.centroidXY=se.centroidXY=new s.P(0,0);else if(te&&te.dem&&!Te){const _e=C[F](le,se),Re=F%2?s.al-1:0,We=z(_e[0],Math.min(s.al-1,_e[1]),Re,te,H,F<2,_e[2]);le.centroidXY=se.centroidXY=x(We)}else Te?le.centroidXY=se.centroidXY=new s.P(0,0):(le.centroidXY=c.encodeBorderCentroid(ue),se.centroidXY=j.encodeBorderCentroid(ve));c.writeCentroidToBuffer(le),j.writeCentroidToBuffer(se)}else c.showCentroid(ue)}c.borderDoneWithNeighborZ[F]=j.canonical.z,j.borderDoneWithNeighborZ[Y]=c.canonical.z}var R,k;(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const On=[1,0,0],Gh=[0,1,0],yn=[0,0,1];function ts(l,t,n){const c=n.transform,d=n.shadowRenderer;if(!d)return!0;const p=l.toUnwrapped(),m=c.tileSize*d._cascades[n.currentShadowCascade].scale;let g=t;if(c.elevation){const R=c.elevation.getMinMaxForTile(l);R&&(g+=R.max)}const x=[...d.shadowDirection];x[2]=-x[2];const w=d.computeSimplifiedTileShadowVolume(p,g,m,x);if(!w)return!1;const S=[On,Gh,yn,x,[x[0],0,x[2]],[0,x[1],x[2]]],M=c.projection.name==="globe",A=c.scaleZoom(m),C=s.cB.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,A,!M),z=d.getCurrentCascadeFrustum();return C.intersectsPrecise(w.vertices,w.planes,S)===0||z.intersectsPrecise(w.vertices,w.planes,S)===0}function ql(l){const{painter:t,source:n,layer:c,coords:d}=l;let p=l.defines;const m=t.context,g=t.renderPass==="shadow",x=t.renderPass==="light-beam",w=t.shadowRenderer,S=s.ef(t.transform.center.lat,t.transform.zoom),M=Ms(t,c.paint.get("building-cutoff-fade-range"));M.shouldRenderCutoff&&(p=p.concat("RENDER_CUTOFF")),l.floodLightIntensity>0&&(p=p.concat("FLOOD_LIGHT"));for(const A of d){const C=n.getTile(A),z=C.getBucket(c);if(!z)continue;w&&w.getMaxCascadeForTile(A.toUnwrapped())===0&&(p=p.concat("SHADOWS_SINGLE_CASCADE"));const R=z.programConfigurations.get(c.id);let k,F,U,H=t.translatePosMatrix(A.expandedProjMatrix,C,[0,0],"map");if(H=s.cS(s.bC(),H,[1,1,l.verticalScale]),g&&w){if(ts(C.tileID,z.maxHeight*S,t))continue;let te=w.calculateShadowPassMatrixFromTile(C.tileID.toUnwrapped());te=s.cS(s.bC(),te,[1,1,l.verticalScale]),U=Os(te),k=F=t.getOrCreateProgram("buildingDepth",{config:R,defines:p,overrideFog:!1})}else if(x)k=F=t.getOrCreateProgram("buildingBloom",{config:R,defines:p,overrideFog:!1}),U=Af(H);else{const te=t.transform.calculatePosMatrix(A.toUnwrapped(),t.transform.worldSize);s.cS(te,te,[1,1,l.verticalScale]);const Y=s.bC();s.cS(Y,te,[1,-1,1/S]),s.bl(Y,Y),s.eg(Y,Y);
2972const Q=t.transform.getFreeCameraOptions().position,X=1<<A.canonical.z;if(U=Qc(H,Y,l.opacity,l.facadeAOIntensity,[((Q.x-A.wrap)*X-A.canonical.x)*s.al,(Q.y*X-A.canonical.y)*s.al,Q.z*X*s.al],z.tileToMeter,l.facadeEmissiveChance,l.floodLightColor,l.floodLightIntensity),F=t.getOrCreateProgram("building",{config:R,defines:p,overrideFog:!1}),l.depthOnly===!0)k=F;else{const $=p.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);k=t.getOrCreateProgram("building",{config:R,defines:$,overrideFog:!1})}w&&(w.setupShadowsFromMatrix(te,F,!0),k!==F&&w.setupShadowsFromMatrix(te,k,!0))}const j=(te,Y)=>{if(x){const Q=te.entranceBloom;Y.draw(t,m.gl.TRIANGLES,l.depthMode,St.disabled,l.blendMode,Tt.disabled,U,c.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segmentsBucket,c.paint,t.transform.zoom,R,[Q.layoutAttenuationBuffer,Q.layoutColorBuffer])}else{const Q=te.segmentsBucket;let X=[te.layoutNormalBuffer,te.layoutCentroidBuffer,te.layoutColorBuffer,te.layoutFloodLightDataBuffer];te.layoutFacadePaintBuffer&&(X=X.concat([te.layoutFacadeDataBuffer,te.layoutFacadeVerticalRangeBuffer,te.layoutFacadePaintBuffer])),Y.draw(t,m.gl.TRIANGLES,l.depthMode,St.disabled,l.blendMode,g?Tt.disabled:Tt.backCW,U,c.id,te.layoutVertexBuffer,te.indexBuffer,Q,c.paint,t.transform.zoom,R,X)}};t.uploadCommonUniforms(m,F,A.toUnwrapped(),null,M),z.buildingWithoutFacade&&j(z.buildingWithoutFacade,F),z.buildingWithFacade&&(k!==F&&t.uploadCommonUniforms(m,k,A.toUnwrapped(),null,M),j(z.buildingWithFacade,k))}}function au(l,t,n,c,d,p,m,g,x,w,S,M,A){const C=l.context.gl,z=l.depthModeForSublayer(1,ht.ReadOnly,C.LEQUAL,!0),R=.1*(1-(k=S))+3*k;var k;const F=l._showOverdrawInspector,U=M,H=new jh;F||es(H,l,t,n,c,z,new St({func:C.ALWAYS,mask:255},255,255,C.KEEP,C.KEEP,C.REPLACE),new Dt([C.ONE,C.ONE,C.ONE,C.ONE],s.ao.transparent,[!1,!1,!1,!0],C.MIN),Tt.disabled,d,"sdf",p,m,g,x,w,R,U,!1);{const j=F?St.disabled:new St({func:C.EQUAL,mask:255},255,255,C.KEEP,C.DECR,C.DECR),te=F?l.colorModeForRenderPass():new Dt([C.ONE_MINUS_DST_ALPHA,C.DST_ALPHA,C.ONE,C.ONE],s.ao.transparent,[!0,!0,!0,!0]);es(H,l,t,n,c,z,j,te,Tt.disabled,d,"color",p,m,g,x,w,R,U,!1)}}function lu(l){return[l[0]*s.eh,l[1]*s.eh,l[2]*s.eh,0]}function $l(l,t,n,c,d,p,m,g,x){const w=c.getSource(),S=n.globeSharedBuffers;if(!S)return;let M,A,C;if(t&&(M=c.getTile(t)),w instanceof s.aU?(A=w.texture,C=s.dK(0,0,n.transform)):M&&t&&(A=M.texture,C=s.dK(t.canonical.z,t.canonical.x,n.transform)),!A||!C)return;l||(C=s.cS(s.bC(),C,[1,-1,1]));const z=n.context,R=z.gl,k=d.paint.get("raster-resampling")==="nearest"?R.NEAREST:R.LINEAR,F=n.colorModeForDrapableLayerRenderPass(p),U=m.defines;U.push("GLOBE_POLES");const H=new ht(R.LEQUAL,ht.ReadWrite,n.depthRangeFor3D),j=Float32Array.from(n.transform.expandedFarZProjMatrix),te=Float32Array.from(s.bk(s.dJ(new s.cD(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),z.activeTexture.set(R.TEXTURE0),A.bind(k,R.CLAMP_TO_EDGE),z.activeTexture.set(R.TEXTURE1),A.bind(k,R.CLAMP_TO_EDGE),"useMipmap"in A&&z.extTextureFilterAnisotropic&&n.transform.pitch>20&&R.texParameterf(R.TEXTURE_2D,z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,z.extTextureFilterAnisotropicMax);const[Y,Q,X,$]=t?S.getPoleBuffers(t.canonical.z,!1):S.getPoleBuffers(0,!0),ie=d.paint.get("raster-elevation");let ue;l?(ue=Y,n.renderDefaultNorthPole=ie!==0):(ue=Q,n.renderDefaultSouthPole=ie!==0);const le=lu(m.mix),xe=((Ae,Ve,me,se,Te,_e,Re,We,et,qe,Ue,ct,st)=>Pf(Ae,Ve,me,new Float32Array(16),new Float32Array(9),[0,0],se,[0,0],[0,0,0,0],1,{opacity:1,mix:0},_e,[0,0],We,2,qe,Ue,ct,1,0,st))(j,te,C,s.aj(n.transform.zoom),0,d,0,ie,0,le,m.offset,m.range,p),ve=n.getOrCreateProgram("raster",{defines:U});n.uploadCommonUniforms(z,ve,null),ve.draw(n,R.TRIANGLES,H,x,F,g,xe,d.id,ue,X,$)}function kf(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,p=t+d;return[t,n,(p-d-t)/c,(p-t)/c]}function is(l,t,n,c){if(l)return t instanceof dn&&l instanceof bc?t.getTextureDescriptor(l,n,!0):{texture:l.texture,mix:lu(c.mix),offset:c.offset,buffer:0,tileSize:1}}var Li=s.ei([{name:"a_index",type:"Int16",components:1}]);class cu{constructor(t,n,c,d){const p={width:c[0],height:c[1],data:null},m=t.gl;this.targetColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(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 s.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1});const p=new s.ej;p.reserve(d);for(let m=0;m<d;m++)p.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(p,Li.members,!0),this.particleSegment=s.bg.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=n.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=s.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Hh(l,t,n){if(!l)return null;const c=t.getTextureDescriptor(l,n,!0);if(!c)return null;let{texture:d,mix:p,offset:m,tileSize:g,buffer:x,format:w}=c;if(!d||!w)return null;let S=!1;return w==="uint32"&&(S=!0,p[3]=0,p=eu(s.ek,p,[0,n.paint.get("raster-particle-max-speed")]),m=tu(s.ek,m,[0,n.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(g+2*x),g/(g+2*x)],tileSize:g,scalarData:S,scale:p,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[w]]}}function Bf(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,p=t+d;return[t,n,(p-d-t)/c,(p-t)/c]}
2972const Nf=new s.ao(1,0,0,1),Vf=new s.ao(0,1,0,1),Uf=new s.ao(0,0,1,1),_a=new s.ao(1,0,1,1),ga=new s.ao(0,1,1,1);function He(l,t,n,c,d,p){for(let m=0;m<n.length;m++)if(d){const w=new s.ao(c.r*.8,c.g*.8,c.b*.8,1);Xe(l,t,n[m],c,-1,-1,p),Xe(l,t,n[m],c,-1,1,p),Xe(l,t,n[m],c,1,1,p),Xe(l,t,n[m],c,1,-1,p),Xe(l,t,n[m],w,0,0,p)}else Xe(l,t,n[m],c,0,0,p)}function Xe(l,t,n,c,d,p,m){const g=l.context,x=l.transform,w=g.gl,S=x.projection.name==="globe",M=S?["PROJECTION_GLOBE_VIEW"]:[];let A=s.bz(n.projMatrix);if(S&&s.aj(x.zoom)>0){const le=s.bj(n.canonical,x),xe=s.el(le);A=s.aB(new Float32Array(16),x.globeMatrix,xe),s.aB(A,x.projMatrix,A)}const C=s.bC();C[12]+=2*d/(s.o.devicePixelRatio*x.width),C[13]+=2*p/(s.o.devicePixelRatio*x.height),s.aB(A,C,A);const z=l.getOrCreateProgram("debug",{defines:M}),R=t.getTileByID(n.key);l.terrain&&l.terrain.setupElevationDraw(R,z);const k=ht.disabled,F=St.disabled,U=l.colorModeForRenderPass(),H="$debug";g.activeTexture.set(w.TEXTURE0),l.emptyTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),S?R._makeGlobeTileDebugBuffers(l.context,x):R._makeDebugTileBoundsBuffers(l.context,x.projection);const j=R._tileDebugBuffer||l.debugBuffer,te=R._tileDebugIndexBuffer||l.debugIndexBuffer,Y=R._tileDebugSegments||l.debugSegments;if(z.draw(l,w.LINE_STRIP,k,F,U,Tt.disabled,Ul(A,c.toPremultipliedRenderColor(null)),H,j,te,Y,null,null,null,[R._globeTileDebugBorderBuffer]),m){const le=R.latestRawTileData,xe=Math.floor((le&&le.byteLength||0)/1024);let ve=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(ve+=` => ${n.overscaledZ}`),ve+=` ${R.state}`,ve+=` ${xe}kb`,(function(Ae,Ve){Ae.initDebugOverlayCanvas();const me=Ae.debugOverlayCanvas,se=Ae.context.gl,Te=Ae.debugOverlayCanvas.getContext("2d");Te.clearRect(0,0,me.width,me.height),Te.shadowColor="white",Te.shadowBlur=2,Te.lineWidth=1.5,Te.strokeStyle="white",Te.textBaseline="top",Te.font="bold 36px Open Sans, sans-serif",Te.fillText(Ve,5,5),Te.strokeText(Ve,5,5),Ae.debugOverlayTexture.update(me),Ae.debugOverlayTexture.bind(se.LINEAR,se.CLAMP_TO_EDGE)})(l,ve)}const Q=t.getTile(n).tileSize,X=512/Math.min(Q,512)*(n.overscaledZ/x.zoom)*.5,$=R._tileDebugTextBuffer||l.debugBuffer,ie=R._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,ue=R._tileDebugTextSegments||l.debugSegments;z.draw(l,w.TRIANGLES,k,F,Dt.alphaBlended,Tt.disabled,Ul(A,s.ao.transparent.toPremultipliedRenderColor(null),X),H,$,ie,ue,null,null,null,[R._globeTileDebugTextBuffer])}function ya(l,t,n,c){fe(l,0,t+n/2,l.transform.width,n,c)}function sr(l,t,n,c){fe(l,t-n/2,0,n,l.transform.height,c)}function fe(l,t,n,c,d,p){const m=l.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(t*s.o.devicePixelRatio,n*s.o.devicePixelRatio,c*s.o.devicePixelRatio,d*s.o.devicePixelRatio),m.clear({color:p}),g.disable(g.SCISSOR_TEST)}const jf=s.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:uu}=jf;function Fo(l,t,n,c){l.emplaceBack(t,n,c)}class hu{constructor(t){this.vertexArray=new s.em,this.indices=new s.b0,Fo(this.vertexArray,-1,-1,1),Fo(this.vertexArray,1,-1,1),Fo(this.vertexArray,-1,1,1),Fo(this.vertexArray,1,1,1),Fo(this.vertexArray,-1,-1,-1),Fo(this.vertexArray,1,-1,-1),Fo(this.vertexArray,-1,1,-1),Fo(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,uu),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=s.bg.simpleSegment(0,0,36,12)}}function xa(l,t,n,c,d,p){const m=l.context.gl,g=t.paint.get("sky-atmosphere-color"),x=t.paint.get("sky-atmosphere-halo-color"),w=t.paint.get("sky-atmosphere-sun-intensity"),S=((M,A,C,z,R)=>({u_matrix_3f:M,u_sun_direction:A,u_sun_intensity:C,u_color_tint_r:[z.r,z.g,z.b,z.a],u_color_tint_m:[R.r,R.g,R.b,R.a],u_luminance:5e-5}))(s.eo(s.dO(),c),d,w,g.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+p,t.skyboxTexture,0),n.draw(l,m.TRIANGLES,ht.disabled,St.disabled,Dt.unblended,Tt.frontCW,S,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const Gf=s.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ya{constructor(t){const n=new s.ep;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 s.b0;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(n,Gf.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=s.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Tm=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class Sm{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Hf{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Dt([1,zo,1,zo],s.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Dt([1,0,1,0],s.ao.transparent,[!1,!1,!1,!0]),this.params=new Sm,this.updateNeeded=!0}update(t){const n=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Ya(n);const c=this.params.sizeRange,d=this.params.intensityRange,p=(function(S){const M=s.eq(30),A=[];for(let C=0;C<S;++C){const z=2*Math.PI*M(),R=Math.acos(1-2*M())-.5*Math.PI;A.push(s.d5(Math.cos(R)*Math.cos(z),Math.cos(R)*Math.sin(z),Math.sin(R)))}return A})(this.params.starsCount),m=s.eq(300),g=new s.er,x=new s.b0;let w=0;for(let S=0;S<p.length;++S){const M=s.c5([],p[S],200),A=Math.max(0,1+.01*c*(1*m()-.5)),C=Math.max(0,1+.01*d*(1*m()-.5));g.emplaceBack(M[0],M[1],M[2],-1,-1,A,C),g.emplaceBack(M[0],M[1],M[2],1,-1,A,C),g.emplaceBack(M[0],M[1],M[2],1,1,A,C),g.emplaceBack(M[0],M[1],M[2],-1,1,A,C),x.emplaceBack(w+0,w+1,w+2),x.emplaceBack(w+0,w+2,w+3),w+=4}this.starsVx=n.createVertexBuffer(g,Tm.members),this.starsIdx=n.createIndexBuffer(x),this.starsSegments=s.bg.simpleSegment(0,0,g.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,p=t.transform,m=new ht(d.LEQUAL,ht.ReadOnly,[0,1]),g=s.aj(p.zoom),x=t.style.getLut(n.scope),w=n.properties.get("color-use-theme")==="none",S=n.properties.get("color").toNonPremultipliedRenderColor(w?null:x),M=n.properties.get("high-color-use-theme")==="none",A=n.properties.get("high-color").toNonPremultipliedRenderColor(M?null:x),C=n.properties.get("space-color-use-theme")==="none",z=n.properties.get("space-color").toNonPremultipliedRenderColor(C?null:x),R=5e-4,k=s.es(n.properties.get("horizon-blend"),0,1,R,.25),F=s.dE(t,c,p)&&k===R?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,U=t.frameCounter/1e3%1,H=s.ag(p.globeCenterInViewSpace),j=Math.sqrt(Math.pow(H,2)-Math.pow(F,2)),te=Math.acos(j/H),Y=Q=>{const X=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];Q&&X.push("ALPHA_PASS");const $=t.getOrCreateProgram("globeAtmosphere",{defines:X}),ie=((le,xe,ve,Ae,Ve,me,se,Te,_e,Re,We,et)=>({u_frustum_tl:le,u_frustum_tr:xe,u_frustum_br:ve,u_frustum_bl:Ae,u_horizon:Ve,u_transition:me,u_fadeout_range:se,u_atmosphere_fog_color:Te.toArray01(),u_high_color:_e.toArray01(),u_space_color:Re.toArray01(),u_temporal_offset:We,u_horizon_angle:et}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,g,k,S,A,z,U,te);t.uploadCommonUniforms(c,$);const ue=this.atmosphereBuffer;ue&&$.draw(t,d.TRIANGLES,m,St.disabled,Q?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Tt.backCW,ie,Q?"atmosphere_glow_alpha":"atmosphere_glow",ue.vertexBuffer,ue.indexBuffer,ue.segments)};Y(!1),Y(!0)}drawStars(t,n){const c=s.aA(n.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,p=d.gl,m=t.transform,g=t.getOrCreateProgram("stars"),x=s.c7([]);s.c9(x,x,-m._pitch),s.c8(x,x,-m.angle),s.c9(x,x,s.an(m._center.lat)),s.et(x,x,-s.an(m._center.lng));const w=s.cc(new Float32Array(16),x),S=s.aB([],m.starsProjMatrix,w),M=s.eo([],w),A=s.eu([],M),C=[0,1,0];s.dQ(C,C,A),s.c5(C,C,this.params.sizeMultiplier);const z=[1,0,0];s.dQ(z,z,A),s.c5(z,z,this.params.sizeMultiplier);const R=(k=C,F=z,U=c,{u_matrix:Float32Array.from(S),u_up:k,u_right:F,u_intensity_multiplier:U});var k,F,U;t.uploadCommonUniforms(d,g),this.starsVx&&this.starsIdx&&g.draw(t,p.TRIANGLES,ht.disabled,St.disabled,this.colorModeAlphaBlendedWriteRGB,Tt.disabled,R,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class du{constructor(){this.visibleTiles=[]}updateBorders(t,n){const c=[],d=[],p=t._getRenderableCoordinates(!1,!0);for(const x of p){const w=t.getTile(x);if(!w.hasData())continue;const S=w.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 g=new Set;this.visibleTiles=c,d.sort(((x,w)=>x.tileID.z-w.tileID.z||x.tileID.x-w.tileID.x||x.tileID.y-w.tileID.y));for(const x of d){const w=new Array,S=new Array,M=x.bucket;for(const A of M.featuresOnBorder)g.has(A.featureId)?S.push(A.footprintIndex):(g.add(A.featureId),w.push(A.footprintIndex));M.updateFootprintHiddenFlags(w,s.ev,!1),M.updateFootprintHiddenFlags(S,s.ev,!0)}}}function fu(l,t){const n=[...l],c=t.cameraWorldSizeForFog/t.worldSize,d=s.bA([]);return s.cS(d,d,[c,c,1]),s.aB(n,d,n),s.aB(n,t.worldToFogMatrix,n),n}function pu(l,t,n,c,d){const p=n.material,m=c.context,{baseColorTexture:g,metallicRoughnessTexture:x}=p.pbrMetallicRoughness,{normalTexture:w,occlusionTexture:S,emissionTexture:M}=p;function A(z,R,k){if(z&&(l.push(R),m.activeTexture.set(m.gl.TEXTURE0+k),z.gfxTexture)){const{minFilter:F,magFilter:U,wrapS:H,wrapT:j}=z.sampler;z.gfxTexture.bindExtraParam(F,U,H,j)}}A(g,"HAS_TEXTURE_u_baseColorTexture",jr.BaseColor),A(x,"HAS_TEXTURE_u_metallicRoughnessTexture",jr.MetallicRoughness),A(w,"HAS_TEXTURE_u_normalTexture",jr.Normal),A(S,"HAS_TEXTURE_u_occlusionTexture",jr.Occlusion),A(M,"HAS_TEXTURE_u_emissionTexture",jr.Emission),d&&(d.texture||(d.texture=new s.d$(c.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+jr.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)),p.alphaMode!=="OPAQUE"&&p.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),p.defined||l.push("DIFFUSE_SHADED");const C=c.shadowRenderer;C&&(l.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&l.push("NORMAL_OFFSET"))}function mu(l,t,n,c,d,p){const m=l.modelOpacity,g=t.context,x=new ht(t.context.gl.LEQUAL,l.isLightMesh?ht.ReadOnly:ht.ReadWrite,t.depthRangeFor3D),w=t.transform,S=l.mesh,M=S.material,A=M.pbrMetallicRoughness,C=t.style.fog;let z;z=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:s.aB([],c.zScaleMatrix,l.nodeModelMatrix),s.aB(z,c.negCameraPosMatrix,z);const R=s.bl([],z);s.eg(R,R);
2972const k=n.paint.get("model-color-use-theme").constantOr("default")==="none",F=n.paint.get("model-emissive-strength").constantOr(0),U=pa(new Float32Array(l.worldViewProjection),new Float32Array(z),new Float32Array(R),null,t,m,A.baseColorFactor,M.emissiveFactor,A.metallicFactor,A.roughnessFactor,M,F,n,void 0,void 0,l.materialOverride,l.modelColor),H={defines:[]},j=[],te=t.shadowRenderer;te&&(te.useNormalOffset=!1),pu(H.defines,j,S,t,k?null:n.lut);let Y=null;if(C){const $=fu(l.nodeModelMatrix,t.transform);if(Y=new Float32Array($),w.projection.name!=="globe"){const ie=S.aabb.min,ue=S.aabb.max,[le,xe]=C.getOpacityForBounds($,ie[0],ie[1],ue[0],ue[1]);H.overrideFog=le>=Me||xe>=Me}}const Q=Ms(t,n.paint.get("model-cutoff-fade-range"));Q.shouldRenderCutoff&&H.defines.push("RENDER_CUTOFF");const X=t.getOrCreateProgram("model",H);t.uploadCommonUniforms(g,X,null,Y,Q),t.renderPass!=="shadow"&&te&&te.setupShadowsFromMatrix(l.nodeModelMatrix,X),X.draw(t,g.gl.TRIANGLES,x,d,p,S.material.doubleSided?Tt.disabled:Tt.backCCW,U,n.id,S.vertexBuffer,S.indexBuffer,S.segments,n.paint,t.transform.zoom,void 0,j)}function Zl(l,t){return l.style._importedAsBasemap?"basemap":t.scope}function va(l,t,n,c,d,p,m,g,x,w){const S=l.transform,M=!!t.isGeometryBloom&&t.isGeometryBloom;if(M&&l.renderPass==="shadow")return;const A=S.projection.name==="globe"?s.eD(n,S):[...n];s.aB(A,A,t.globalMatrix);const C=s.aB([],c,A);if(t.meshes)for(const z of t.meshes){const R=g.get(z.material.name);if(R&&R.opacity<=0)continue;if(z.material.alphaMode!=="BLEND"){m.push({mesh:z,depth:0,modelIndex:d,worldViewProjection:C,nodeModelMatrix:A,isLightMesh:M,materialOverride:R,modelOpacity:x,modelColor:w});continue}const k=s.af([],z.centroid,C);!S.isOrthographic&&k[2]<=0||p.push({mesh:z,depth:k[2],modelIndex:d,worldViewProjection:C,nodeModelMatrix:A,isLightMesh:M,materialOverride:R,modelOpacity:x,modelColor:w})}if(t.children)for(const z of t.children)va(l,z,n,c,d,p,m,g,x,w)}function xo(l,t,n,c){const d=n.shadowRenderer;if(!d)return;const p=d.getShadowPassDepthMode(),m=d.getShadowPassColorMode(),g=d.calculateShadowPassMatrixFromMatrix(t),x=Nh(g);n.getOrCreateProgram("modelDepth",{defines:n._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(n,n.context.gl.TRIANGLES,p,St.disabled,m,Tt.disabled,x,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,n.transform.zoom,void 0,void 0)}function qf(l,t,n,c,d,p){for(const m of d){const g=Object.assign({},c);g.part=m;const x={type:"Unknown",id:t,properties:g},w={orientation:l.paint.get("model-rotation").evaluate(x,n)};p.set(m,w)}}function $f(l,t,n,c,d,p){for(const m of d){const g=Object.assign({},c);g.part=m;const x={type:"Unknown",id:t,properties:g},w={color:l.paint.get("model-color").evaluate(x,n),colorMix:l.paint.get("model-color-mix-intensity").evaluate(x,n),opacity:l.paint.get("model-opacity").evaluate(x,n),emissionStrength:l.paint.get("model-emissive-strength").evaluate(x,n)};p.set(m,w)}}function Zf(l,t,n,c,d){let p=!1;for(const g of c)g.modelOpacity!==1&&(mu(g,l,t,d[g.modelIndex],St.disabled,Dt.disabled),p=!0);for(const g of c)mu(g,l,t,d[g.modelIndex],g.modelOpacity!==1?l.stencilModeFor3D():St.disabled,l.colorModeForRenderPass());p&&l.resetStencilClippingMasks();const m=Dt.additive;for(const g of n)mu(g,l,t,d[g.modelIndex],St.disabled,g.isLightMesh?m:l.colorModeForRenderPass())}function Wf(l,t,n){const c=t.updateZoomBasedPaintProperties(),d=(function(p,m,g){let x,w,S,M=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&M>0){const A=p.terrain,C=A.findDEMTileFor(g);C&&C.dem?x=s.eF.create(A,g,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 A in m.instancesPerModel){const C=m.instancesPerModel[A];for(let z=0;z<C.instancedDataArray.length;++z){const R=(x?M*x.getElevationAt(0|C.instancedDataArray.float32[16*z],0|C.instancedDataArray.float32[16*z+1],!0,!0):0)+C.instancesEvaluatedElevation[z];C.instancedDataArray.float32[16*z+6]=R,w=w?Math.min(m.terrainElevationMin,R):R,S=S?Math.max(m.terrainElevationMax,R):R}}return m.terrainElevationMin=w||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 ko={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new s.d9([0,0,0],[s.al,s.al,0])};function xn(l,t){const n=1<<l.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,p=l.canonical.x/n,m=(l.canonical.x+1)/n,g=l.canonical.y/n,x=(l.canonical.y+1)/n;let w=t._centerAltitude;if(d){const C=d.getMinMaxForTile(l);C&&C.max>w&&(w=C.max)}const S=s.aA(c.x,p,m)-c.x,M=s.aA(c.y,g,x)-c.y,A=s.cf(w,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(S*S+M*M+A*A))}function Xf(l,t,n,c,d,p,m){const g=l.context,x=l.renderPass==="shadow",w=l.shadowRenderer,S=x&&w?w.getShadowPassDepthMode():new ht(g.gl.LEQUAL,ht.ReadWrite,l.depthRangeFor3D),M=l.isTileAffectedByFog(p),A=l.transform.projection.name==="globe";if(n.meshes)for(const C of n.meshes){const z=A?[]:["MODEL_POSITION_ON_GPU"],R=[];let k,F,U;const H=!A&&c.instancedDataArray.length>20;H&&z.push("INSTANCED_ARRAYS");const j=Ms(l,t.paint.get("model-cutoff-fade-range"));if(j.shouldRenderCutoff&&z.push("RENDER_CUTOFF"),x&&w)k=l.getOrCreateProgram("modelDepth",{defines:z}),F=Nh(m.shadowTileMatrix,m.shadowTileMatrix,Float32Array.from(n.globalMatrix)),U=w.getShadowPassColorMode();
2972else{pu(z,R,C,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),k=l.getOrCreateProgram("model",{defines:z,overrideFog:M});const Y=C.material,Q=Y.pbrMetallicRoughness,X=t.paint.get("model-opacity").constantOr(1),$=t.paint.get("model-emissive-strength").constantOr(0);F=pa(p.expandedProjMatrix,Float32Array.from(n.globalMatrix),new Float32Array(16),null,l,X,Q.baseColorFactor,Y.emissiveFactor,Q.metallicFactor,Q.roughnessFactor,Y,$,t,d),w&&(m.shadowUniformsInitialized?k.setShadowUniformValues(g,w.getShadowUniformValues()):(w.setupShadows(p.toUnwrapped(),k,"model-tile"),m.shadowUniformsInitialized=!0)),U=j.shouldRenderCutoff||X<1||Y.alphaMode!=="OPAQUE"?Dt.alphaBlended:Dt.unblended}l.uploadCommonUniforms(g,k,p.toUnwrapped(),null,j);const te=C.material.doubleSided?Tt.disabled:Tt.backCCW;if(H)R.push(c.instancedDataBuffer),k.draw(l,g.gl.TRIANGLES,S,St.disabled,U,te,F,t.id,C.vertexBuffer,C.indexBuffer,C.segments,t.paint,l.transform.zoom,void 0,R,c.instancedDataArray.length);else{const Y=x?"u_instance":"u_normal_matrix";for(let Q=0;Q<c.instancedDataArray.length;++Q)F[Y]=new Float32Array(c.instancedDataArray.arrayBuffer,64*Q,16),k.draw(l,g.gl.TRIANGLES,S,St.disabled,U,te,F,t.id,C.vertexBuffer,C.indexBuffer,C.segments,t.paint,l.transform.zoom,void 0,R)}}if(n.children)for(const C of n.children)Xf(l,t,C,c,d,p,m)}const Wl=[1,-1,1];function Em(l,t,n,c){if(!n.modelManager)return!0;const d=n.modelManager;if(!n.shadowRenderer)return!0;const p=n.shadowRenderer,m=t.aabb;let g=!0,x=l.maxHeight;if(x===0){let S=0;for(const M in l.instancesPerModel){const A=d.getModel(M,c);A?S=Math.max(S,Math.max(Math.max(A.aabb.max[0],A.aabb.max[1]),A.aabb.max[2])):g=!1}x=l.maxScale*S*1.41+l.maxVerticalOffset,g&&(l.maxHeight=x)}m.max[2]=x,m.min[2]+=l.terrainElevationMin,m.max[2]+=l.terrainElevationMax,s.af(m.min,m.min,t.tileMatrix),s.af(m.max,m.max,t.tileMatrix);const w=m.intersects(p.getCurrentCascadeFrustum());return n.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=w===2),w===0}function Vi(l,t){const n=l.uniformValues.u_cutoff_params[0],c=l.uniformValues.u_cutoff_params[1],d=l.uniformValues.u_cutoff_params[2],p=l.uniformValues.u_cutoff_params[3];return c===n||p===d?1:s.aA(((t-n)/(c-n)-d)/(p-d),0,1)}function jt(l,t,n,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();s.aB(d,d,l);const p=s.bU(n.min[0],n.min[1],n.min[2],1);let m=s.aC(s.eG(),p,d),g=m,x=m;p[1]=n.max[1],m=s.aC(s.eG(),p,d),g=m[1]<g[1]?m:g,x=m[1]>x[1]?m:x,p[0]=n.max[0],m=s.aC(s.eG(),p,d),g=m[1]<g[1]?m:g,x=m[1]>x[1]?m:x,p[1]=n.min[1],m=s.aC(s.eG(),p,d),g=m[1]<g[1]?m:g,x=m[1]>x[1]?m:x;const w=s.aA(c[0],0,1),S=100*t.pixelsPerMeter*s.aA(c[1],0,1),M=s.aA(c[2],0,1),A=s.eH(s.eG(),g,x,w),C=Math.tan(.5*t.fovX),z=-A[2]*C;if(S===0)return A[1]<-Math.abs(z)?M:1;const R=(-Math.abs(z)-A[1])/S,k=(U,H,j)=>(1-j)*U+j*H,F=s.aA(k(1,M,R),M,1);return k(1,F,s.aA((t.pitch-20)/20,0,1))}class Yf{}class Bs{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,p=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),m=new ArrayBuffer(p),g=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new s.eJ;for(let M=0;M<p/2;M+=3){const A=g[M],C=g[M+1],z=g[M+2];x.emplaceBack(A,C),x.emplaceBack(C,z),x.emplaceBack(z,A)}const w=c.bindVertexArrayOES.current,S=new Yf;return S.buf=new yo(c,x),S.lastUsedFrameIdx=t,this._storage.set(n.id,S),c.bindVertexArrayOES.set(w),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 Ka{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Ja=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class rs{constructor(t){this.revealStart=11,this.revealRange=2}}const qh=s.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class $h{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,n){const c=t.getOrCreateProgram("vignette");
2972if(!this.vignetteVx||!this.vignetteIdx){const m=new s.eK,g=new s.b0;m.emplaceBack(-1,-1),m.emplaceBack(1,-1),m.emplaceBack(1,1),m.emplaceBack(-1,1),g.emplaceBack(0,1,2),g.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(m,qh.members),this.vignetteIdx=t.context.createIndexBuffer(g)}const d=s.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const m={u_vignetteShape:(p={vignetteShape:[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:p.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,ht.disabled,St.disabled,Dt.alphaBlended,Tt.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var p}}class Zh{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,n){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),p=c.toLngLat(),m=s.an(p.lng),g=s.an(p.lat),x=t.pixelsPerMeter/n,w=m*s.eM,S=s.eM*Math.log(Math.tan(Math.PI/4+g/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,A=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+w)*x,this._accumulatedOffsetY+=M*x,this._accumulatedElevation+=A*x,this._offsetXPrev=w,this._offsetYPrev=S,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function _u(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 jn(l){const t=s.eq(1323123451230),n=[];for(let c=0;c<l;++c){const d=2*t()-1,p=2*t()-1,m=2*t()-1;n.push(s.d5(d,p,m))}return n}function An(l,t,n,c,d){const p=s.aA((d-n)/(c-n),0,1);return(1-p)*l+p*t}class ba{constructor(t){this._movement=new Zh,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new $h,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,p=s.c7([]);s.c9(p,p,s.an(90)-c._pitch),s.c8(p,p,-c.angle);const m=s.cc(new Float32Array(16),p),g=s.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),x=s.eg([],g),w=s.aB([],x,m),S=Date.now()/1e3;return this._accumulatedTimeFromStart+=(S-this._prevTime)*n,this._prevTime=S,{projectionMatrix:d,modelviewMatrix:w}}}class gu extends ba{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 rs("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=jn(this.particlesCount),d=new s.eN,p=new s.b0;let m=0;const g=s.eq(1323123451230);for(let x=0;x<c.length;++x){const w=c[x],S=[2*g()-1,g(),g(),g()];d.emplaceBack(w[0],w[1],w[2],-1,-1,...S),d.emplaceBack(w[0],w[1],w[2],1,-1,...S),d.emplaceBack(w[0],w[1],w[2],1,1,...S),d.emplaceBack(w[0],w[1],w[2],-1,1,...S),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=n.createVertexBuffer(d,Ja.members),this.particlesIdx=n.createIndexBuffer(p)}}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=An(0,1,n.revealStart,n.revealStart+n.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const p=structuredClone(this._params);let m=[-p.direction.x,p.direction.y,-100];s.aw(m,m);
2972const g=structuredClone(this._vignetteParams);g.strength*=d,p.overrideStyleParameters||(p.intensity=t.style.rain.state.density,p.timeFactor=t.style.rain.state.intensity,p.color=structuredClone(t.style.rain.state.color),m=structuredClone(t.style.rain.state.direction),p.screenThinning.intensity=t.style.rain.state.centerThinning,p.dropletSizeX=t.style.rain.state.dropletSize[0],p.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],p.distortionStrength=100*t.style.rain.state.distortionStrength,g.strength=1,g.color=structuredClone(t.style.rain.state.vignetteColor));const x=this.updateOnRender(t,p.timeFactor),w=t.context,S=w.gl,M=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new s.T(w,{width:t.width,height:t.height,data:null},S.RGBA8)),p.distortionStrength>0&&(w.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 A=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(w,A),w.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const C=[p.color.r,p.color.g,p.color.b,p.color.a],z=(R,k)=>{const F=_u(this._movement.getPosition(),R),U=p.dropletSizeX,H=p.dropletSizeX*p.dropletSizeYScale,j=t.width/2,te=t.height/2,Y=An(0,p.screenThinning.start,0,1,p.screenThinning.intensity),Q=An(.001,p.screenThinning.range,0,1,p.screenThinning.intensity),X=An(0,p.screenThinning.particleOffset,0,1,p.screenThinning.intensity),$=(ie={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:F,velocityConeAperture:p.velocityConeAperture,velocity:p.velocity,boxSize:R,rainDropletSize:[U,H],distortionStrength:p.distortionStrength,rainDirection:m,color:C,screenSize:[M.width,M.height],thinningCenterPos:[j,te],thinningShape:[Y,Q,Math.pow(10,p.screenThinning.fadePower)],thinningAffectedRatio:p.screenThinning.affectedRatio,thinningParticleOffset:X,shapeDirectionalPower:p.shapeDirPower,shapeNormalPower:p.shapeNormalPower,mode:k?0:1},{u_modelview:Float32Array.from(ie.modelview),u_projection:Float32Array.from(ie.projection),u_time:ie.time,u_cam_pos:ie.camPos,u_texScreen:0,u_velocityConeAperture:ie.velocityConeAperture,u_velocity:ie.velocity,u_boxSize:ie.boxSize,u_rainDropletSize:ie.rainDropletSize,u_distortionStrength:ie.distortionStrength,u_rainDirection:ie.rainDirection,u_color:ie.color,u_screenSize:ie.screenSize,u_thinningCenterPos:ie.thinningCenterPos,u_thinningShape:ie.thinningShape,u_thinningAffectedRatio:ie.thinningAffectedRatio,u_thinningParticleOffset:ie.thinningParticleOffset,u_shapeDirectionalPower:ie.shapeDirectionalPower,u_shapeNormalPower:ie.shapeNormalPower,u_mode:ie.mode});var ie;const ue=Math.round(p.intensity*this.particlesCount),le=s.bg.simpleSegment(0,0,4*ue,2*ue);A.draw(t,S.TRIANGLES,ht.disabled,St.disabled,Dt.alphaBlended,Tt.disabled,$,"rain_particles",this.particlesVx,this.particlesIdx,le)};p.distortionStrength>0&&z(p.boxSize,!0),z(p.boxSize,!1),this._vignette.draw(t,g)}}const Wh=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class Xh extends ba{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 rs("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=jn(this.particlesCount),d=new s.eO,p=new s.b0;let m=0;const g=s.eq(1323123451230);for(let x=0;x<c.length;++x){const w=c[x],S=g(),M=g(),A=g(),C=[x/c.length,S,M,A],z=[g(),g()];d.emplaceBack(w[0],w[1],w[2],-1,-1,...C,...z),d.emplaceBack(w[0],w[1],w[2],1,-1,...C,...z),d.emplaceBack(w[0],w[1],w[2],1,1,...C,...z),d.emplaceBack(w[0],w[1],w[2],-1,1,...C,...z),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m
2972+=4}this.particlesVx=n.createVertexBuffer(d,Wh.members),this.particlesIdx=n.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const n=structuredClone(this._params);let c=[-n.direction.x,n.direction.y,-100];s.aw(c,c);const d=structuredClone(this._vignetteParams),p=n.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},m=t.transform.zoom;if(p.revealStart>m)return;const g=An(0,1,p.revealStart,p.revealStart+p.revealRange,m);d.strength*=g,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 w=t.context,S=w.gl,M=t.transform,A=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(w,A),((C,z,R)=>{const k=_u(this._movement.getPosition(),C),F=M.width/2,U=M.height/2,H=An(0,R.screenThinning.start,0,1,R.screenThinning.intensity),j=An(.001,R.screenThinning.range,0,1,R.screenThinning.intensity),te=An(0,R.screenThinning.particleOffset,0,1,R.screenThinning.intensity),Y=(Q={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:k,velocityConeAperture:R.velocityConeAperture,velocity:R.velocity,horizontalOscillationRadius:R.horizontalOscillationRadius,horizontalOscillationRate:R.horizontalOscillationRate,boxSize:C,billboardSize:1*R.billboardSize,simpleShapeParameters:[R.shapeFadeStart,R.shapeFadePower],screenSize:[M.width,M.height],thinningCenterPos:[F,U],thinningShape:[H,j,Math.pow(10,R.screenThinning.fadePower)],thinningAffectedRatio:R.screenThinning.affectedRatio,thinningParticleOffset:te,color:[R.color.r,R.color.g,R.color.b,R.color.a],direction:c},{u_modelview:Float32Array.from(Q.modelview),u_projection:Float32Array.from(Q.projection),u_time:Q.time,u_cam_pos:Q.camPos,u_velocityConeAperture:Q.velocityConeAperture,u_velocity:Q.velocity,u_horizontalOscillationRadius:Q.horizontalOscillationRadius,u_horizontalOscillationRate:Q.horizontalOscillationRate,u_boxSize:Q.boxSize,u_billboardSize:Q.billboardSize,u_simpleShapeParameters:Q.simpleShapeParameters,u_screenSize:Q.screenSize,u_thinningCenterPos:Q.thinningCenterPos,u_thinningShape:Q.thinningShape,u_thinningAffectedRatio:Q.thinningAffectedRatio,u_thinningParticleOffset:Q.thinningParticleOffset,u_particleColor:Q.color,u_direction:Q.direction});var Q;const X=Math.round(R.intensity*this.particlesCount),$=s.bg.simpleSegment(0,0,4*X,2*X);this.particlesVx&&this.particlesIdx&&A.draw(t,S.TRIANGLES,ht.disabled,St.disabled,Dt.alphaBlended,Tt.disabled,Y,"snow_particles",this.particlesVx,this.particlesIdx,$)})(n.boxSize,0,n),this._vignette.draw(t,d)}}const Ns={symbol:function(l,t,n,c,d){if(l.renderPass!=="translucent")return;const p=St.disabled,m=l.colorModeForRenderPass(),g=n.layout.get("text-variable-anchor"),x=n.layout.get("text-size-scale-range"),w=s.aA(l.scaleFactor,x[0],x[1]);g&&(function(A,C,z,R,k,F,U,H){const j=C.transform,te=k==="map",Y=F==="map";for(const Q of A){const X=R.getTile(Q),$=X.getBucket(z);if(!$||!$.text||!$.text.segments.get().length)continue;const ie=s.bK($.textSizeData,j.zoom,H),ue=Po(Q,$.getProjection(),j),le=j.calculatePixelsToTileUnitsMatrix(X),xe=fn(ue,X.tileID.canonical,Y,te,j,$.getProjection(),le),ve=$.hasIconTextFit()&&$.hasIconData();ie&&yt($,te,Y,U,j,xe,Q,Math.pow(2,j.zoom-X.tileID.overscaledZ),ie,ve)}})(c,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d,w);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)?Hl(l,t,n,c,p,m):(S&&Hl(l,t,n,c,p,m,{onlyIcons:!0}),M&&Hl(l,t,n,c,p,m,{onlyText:!0})),t.map.showCollisionBoxes&&(ot(l,t,n,c,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),ot(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"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),g=n.layout.get("
2972circle-sort-key").constantOr(1)!==void 0,x=n.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const w=l.context,S=w.gl,M=l.transform,A=!(!l.terrain||!l.terrain.enabled),C=n.layout.get("circle-elevation-reference"),z=l.depthModeForSublayer(0,ht.ReadOnly),R=new ht(l.context.gl.LEQUAL,ht.ReadOnly,l.depthRangeFor3D),k=C==="none"||A?z:R,F=St.disabled,U=l.colorModeForDrapableLayerRenderPass(x),H=M.projection.name==="globe",j=[s.aF(M.center.lng),s.aJ(M.center.lat)],te=[];for(let Q=0;Q<c.length;Q++){const X=c[Q],$=t.getTile(X),ie=$.getBucket(n);if(!ie||ie.projection.name!==M.projection.name)continue;const ue=ie.programConfigurations.get(n.id),le=ie.layoutVertexBuffer,xe=ie.globeExtVertexBuffer,ve=ie.indexBuffer,Ae=s.e0(n),Ve=[xe],me=l.isTileAffectedByFog(X);H&&Ae.push("PROJECTION_GLOBE_VIEW"),Ae.push("DEPTH_D24"),l.terrain&&M.depthOcclusionForSymbolsAndCircles&&Ae.push("DEPTH_OCCLUSION"),ie.hasElevation&&!l.terrain&&(Ae.push("ELEVATED_ROADS"),Ve.push(ie.elevatedLayoutVertexBuffer));const se=l.getOrCreateProgram("circle",{config:ue,defines:Ae,overrideFog:me}),Te=M.projection.createInversionMatrix(M,X.canonical),_e={programConfiguration:ue,program:se,layoutVertexBuffer:le,dynamicBuffers:Ve,indexBuffer:ve,uniformValues:s.e1(l,X,$,Te,j,n),tile:$};if(g){const Re=ie.segments.get();for(const We of Re)te.push({segments:new s.bg([We]),sortKey:We.sortKey,state:_e})}else te.push({segments:ie.segments,sortKey:0,state:_e})}g&&te.sort(((Q,X)=>Q.sortKey-X.sortKey));const Y={useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles};for(const Q of te){const{programConfiguration:X,program:$,layoutVertexBuffer:ie,dynamicBuffers:ue,indexBuffer:le,uniformValues:xe,tile:ve}=Q.state,Ae=Q.segments;l.terrain&&l.terrain.setupElevationDraw(ve,$,Y),l.uploadCommonUniforms(w,$,ve.tileID.toUnwrapped()),$.draw(l,S.TRIANGLES,k,F,U,Tt.disabled,xe,n.id,ie,le,Ae,n.paint,M.zoom,X,ue)}},heatmap:function(l,t,n,c){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const d=l.context,p=d.gl,m=St.disabled,g=new Dt([p.ONE,p.ONE,p.ONE,p.ONE],s.ao.transparent,[!0,!0,!0,!0]);(function(C,z,R,k){const F=C.gl,U=z.width*k,H=z.height*k;C.activeTexture.set(F.TEXTURE1),C.viewport.set([0,0,U,H]);let j=R.heatmapFbo;if(!j||j&&(j.width!==U||j.height!==H)){j&&j.destroy();const te=F.createTexture();F.bindTexture(F.TEXTURE_2D,te),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_S,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_T,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MIN_FILTER,F.LINEAR),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MAG_FILTER,F.LINEAR),j=R.heatmapFbo=C.createFramebuffer(U,H,1,null),(function(Y,Q,X,$,ie,ue){const le=Y.gl;le.texImage2D(le.TEXTURE_2D,0,Y.extRenderToTextureHalfFloat?le.RGBA16F:le.RGBA,ie,ue,0,le.RGBA,Y.extRenderToTextureHalfFloat?le.HALF_FLOAT:le.UNSIGNED_BYTE,null),$.colorAttachment0.set(X)})(C,0,te,j,U,H)}else F.bindTexture(F.TEXTURE_2D,j.colorAttachment0.get()),C.bindFramebuffer.set(j.framebuffer)})(d,l,n,l.transform.projection.name==="globe"?.5:.25),d.clear({color:s.ao.transparent});const x=l.transform,w=x.projection.name==="globe",S=w?["PROJECTION_GLOBE_VIEW"]:[],M=w?Tt.frontCCW:Tt.disabled,A=[s.aF(x.center.lng),s.aJ(x.center.lat)];for(let C=0;C<c.length;C++){const z=c[C];if(t.hasRenderableParent(z))continue;const R=t.getTile(z),k=R.getBucket(n);if(!k||k.projection.name!==x.projection.name)continue;const F=l.isTileAffectedByFog(z),U=k.programConfigurations.get(n.id),H=l.getOrCreateProgram("heatmap",{config:U,defines:S,overrideFog:F}),{zoom:j}=l.transform;l.terrain&&l.terrain.setupElevationDraw(R,H),l.uploadCommonUniforms(d,H,z.toUnwrapped());const te=x.projection.createInversionMatrix(x,z.canonical);H.draw(l,p.TRIANGLES,ht.disabled,m,g,M,Cf(l,z,R,te,A,j,n.paint.get("heatmap-intensity")),n.id,k.layoutVertexBuffer,k.indexBuffer,k.segments,n.paint,l.transform.zoom,U,w?[k.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),(function(d,p){const m=d.context,g=m.gl,x=p.heatmapFbo;if(!x)return;m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,x.colorAttachment0.get()),m.activeTexture.set(g.TEXTURE1);let w=p.colorRampTexture;w||(w=p.colorRampTexture=new s.T(m,p.colorRamp,g.RGBA8)),w.bind(g.LINEAR,g.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,g.TRIANGLES,ht.disabled,St.disabled,d.colorModeForRenderPass(),Tt.disabled,((S,M,A,C)=>({u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}))(0,p),p.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,p.paint,d.transform.zoom)})(l,n))},line:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(d.constantOr(1)===0||p.constantOr(1)===0)return;const m=n.paint.get("line-emissive-strength").isConstant(),g=n.paint.get("line-emissive-strength").constantOr(0),x=n.paint.get("line-occlusion-opacity"),w=n.layout.get("line-elevation-reference"),S=n.layout.get("line-width-unit")==="meters",M=w==="sea",A=!(!l.terrain||!l.terrain.enabled),C=l.context,z
2972=C.gl;if(n.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const R=n.layout.get("line-cross-slope"),k=R!==void 0,F=R<1,U=l.colorModeForDrapableLayerRenderPass(m?g:null),H=l.terrain&&l.terrain.renderingToTexture,j=H?1:s.o.devicePixelRatio,te=n.paint.get("line-dasharray"),Y=te.constantOr(1),Q=n.layout.get("line-cap"),X=te.constantOr(null),$=Q.constantOr(null),ie=n.paint.get("line-pattern"),ue=ie.constantOr(1),le=n.paint.get("line-pattern-cross-fade"),xe=ie.constantOr(null),ve=n.paint.get("line-opacity").constantOr(1);let Ae=!ue&&ve!==1||l.depthOcclusion&&x>0&&x<1;const Ve=n.paint.get("line-gradient"),me=ue?"linePattern":"line",se=s.e2(n);let Te;if(H&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(Ae=!1),x!==0&&l.depthOcclusion){const et=n.paint._values["line-opacity"];et&&et.value&&et.value.kind==="constant"?Te=et.value:s.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}p.value.kind!=="constant"&&p.value.isLineProgressConstant===!1&&se.push("VARIABLE_LINE_WIDTH"),H&&(l.emissiveMode!=="dual-source-blending"||m?l.emissiveMode==="mrt-fallback"&&se.push("USE_MRT1"):se.push("DUAL_SOURCE_BLENDING"));const _e=(et,qe,Ue,ct,st,Je)=>{for(const it of et){const gt=t.getTile(it);if(ue&&!gt.patternsLoaded())continue;const Mt=gt.getBucket(n);if(!Mt||Mt.elevationType!=="none"&&!st||Mt.elevationType==="none"&&st)continue;l.prepareDrawTile();const $t=[...qe],ci=l.shadowRenderer,ut=Mt.elevationType==="road"&&!!ci&&ci.enabled;let si=[0,0,0];if(ut){const Ft=l.style.directionalLight,Fi=l.style.ambientLight;Ft&&Fi&&(si=Ko(l.style,Ft,Fi)),$t.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const At=Mt.programConfigurations.get(n.id);let di=!1;if(xe&>.imageAtlas){const Ft=s.e3.from(xe),Fi=Ft.getPrimary().scaleSelf(j).toString(),ur=gt.imageAtlas.patternPositions.get(Fi),Xi=Ft.getSecondary(),Ai=Xi?gt.imageAtlas.patternPositions.get(Xi.scaleSelf(j).toString()):null;di=!!ur&&!!Ai,ur&&At.setConstantPatternPositions(ur,Ai)}le>0&&(di||At.getPatternTransitionVertexBuffer("line-pattern"))&&$t.push("LINE_PATTERN_TRANSITION");const Ti=l.isTileAffectedByFog(it),xi=l.getOrCreateProgram(me,{config:At,defines:$t,overrideFog:Ti});if(!ue&&X&&$&>.lineAtlas){const Ft=gt.lineAtlas.getDash(X,$);Ft&&At.setConstantPatternPositions(Ft)}ut&&ci.setupShadows(gt.tileID.toUnwrapped(),xi,"vector-tile");let[ni,Ot]=n.paint.get("line-trim-offset");($==="round"||$==="square")&&ni!==Ot&&(ni===0&&(ni-=1),Ot===1&&(Ot+=1));const hi=H?it.projMatrix:null,tr=S?1/Mt.tileToMeter/s.ay(gt,1,l.transform.zoom):1,Ui=S?1/Mt.tileToMeter/s.ay(gt,1,Math.floor(l.transform.zoom)):1,fi=ue?s.e4(l,gt,n,hi,j,tr,Ui,[ni,Ot],si,le):s.e5(l,gt,n,hi,Mt.lineClipsArray.length,j,tr,Ui,[ni,Ot],si);if(Ve){const Ft=Mt.gradients[n.id];let Fi=Ft.texture;if(n.gradientVersion!==Ft.version){let ur=256;if(n.stepInterpolant){const Xi=t.getSource().maxzoom,Ai=it.canonical.z===Xi?Math.ceil(1<<l.transform.maxZoom-it.canonical.z):1;ur=s.aA(s.e6(Mt.maxLineLength/s.al*1024*Ai),256,C.maxTextureSize)}Ft.gradient=s.e7({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:ur,image:Ft.gradient||void 0,clips:Mt.lineClipsArray}),Ft.texture?Ft.texture.update(Ft.gradient):Ft.texture=new s.T(C,Ft.gradient,z.RGBA8),Ft.version=n.gradientVersion,Fi=Ft.texture}C.activeTexture.set(z.TEXTURE1),Fi.bind(n.stepInterpolant?z.NEAREST:z.LINEAR,z.CLAMP_TO_EDGE)}Y&&(C.activeTexture.set(z.TEXTURE0),gt.lineAtlasTexture&>.lineAtlasTexture.bind(z.LINEAR,z.REPEAT),At.updatePaintBuffers()),ue&&(C.activeTexture.set(z.TEXTURE0),gt.imageAtlasTexture&>.imageAtlasTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),At.updatePaintBuffers()),st&&!M&&l.terrain.setupElevationDraw(gt,xi),l.uploadCommonUniforms(C,xi,it.toUnwrapped());const Qt=Ft=>{Te!=null&&(Te.value=ve*x),xi.draw(l,z.TRIANGLES,Ue,Ft,U,Tt.disabled,fi,n.id,Mt.layoutVertexBuffer,Mt.indexBuffer,Mt.segments,n.paint,l.transform.zoom,At,[Mt.layoutVertexBuffer2,Mt.patternVertexBuffer,Mt.zOffsetVertexBuffer]),Te!=null&&(Te.value=ve)};if(Ae&&!st){const Ft=l.stencilModeForClipping(it).ref;Ft===0&&H&&C.clear({stencil:0});const Fi={func:z.EQUAL,mask:255};
2972fi.u_alpha_discard_threshold=.8,Qt(new St(Fi,Ft,255,z.KEEP,z.KEEP,z.INVERT)),fi.u_alpha_discard_threshold=0,Qt(new St(Fi,Ft,255,z.KEEP,z.KEEP,z.KEEP))}else fi.u_alpha_discard_threshold=Ae&&st&&Je?.8:0,Qt(st?ct:l.stencilModeForClipping(it))}};let Re=l.depthModeForSublayer(0,ht.ReadOnly);const We=new ht(l.depthOcclusion?z.GREATER:z.LEQUAL,ht.ReadOnly,l.depthRangeFor3D);if(n.hasNonElevatedBuckets){const et=!H&&l.terrain;x!==0&&et?s.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):et?s.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):_e(c,se,Re,St.disabled,!1,!0)}if(n.hasElevatedBuckets){w==="hd-road-markup"?A||(Re=We,se.push("ELEVATED_ROADS")):(se.push("ELEVATED"),Re=We,k&&se.push(F?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),M&&se.push("ELEVATION_REFERENCE_SEA"));const et=Ae?l.stencilModeFor3D():St.disabled;l.forceTerrainMode=!0,_e(c,se,Re,et,!0,!0),Ae&&_e(c,se,Re,et,!0,!1),l.forceTerrainMode=!1}Ae&&(l.resetStencilClippingMasks(),H&&C.clear({stencil:0})),x===0||l.depthOcclusion||H||l.layersWithOcclusionOpacity.push(l.currentLayer)},fill:function(l,t,n,c){const d=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=n.paint.get("fill-emissive-strength"),g=l.colorModeForDrapableLayerRenderPass(m),x=n.paint.get("fill-pattern"),w=l.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(s.ao.transparent).a===1&&p.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),A={painter:l,sourceCache:t,layer:n,coords:c,colorMode:g,elevationType:S,terrainEnabled:M,pass:w};if(l.renderPass==="shadow")return void(l.shadowRenderer&&S==="road"&&!M&&(function(z){const{painter:R,sourceCache:k,layer:F,coords:U}=z,H=R.context.gl,j=z.painter.shadowRenderer;for(const te of U){const Y=k.getTile(te),Q=Y.getBucket(F);if(!Q)continue;const X=Q.elevatedStructures;if(!X||!X.shadowCasterSegments||X.shadowCasterSegments.segments[0].primitiveLength===0)continue;R.prepareDrawTile();const $=Q.bufferData.programConfigurations.get(F.id),ie=R.isTileAffectedByFog(te),ue=R.getOrCreateProgram("elevatedStructuresDepth",{config:$,overrideFog:ie}),le=j.calculateShadowPassMatrixFromTile(Y.tileID.toUnwrapped());R.uploadCommonUniforms(R.context,ue,te.toUnwrapped());const xe={u_matrix:le,u_depth_bias:0};ue.draw(R,H.TRIANGLES,j.getShadowPassDepthMode(),St.disabled,j.getShadowPassColorMode(),Tt.disabled,xe,F.id,X.vertexBuffer,X.indexBuffer,X.shadowCasterSegments,F.paint,R.transform.zoom,$)}})(A));const C=l.emissiveMode==="mrt-fallback";if(S!=="offset"){if(ou(A,!1,C),S==="road"){const z=!M&&l.renderPass==="translucent";z&&nu(l,t,n,c,"geometry"),ou(A,!0,C,St.disabled),z&&(function(R){const{painter:k,sourceCache:F,layer:U,coords:H,colorMode:j}=R,te=k.context.gl,Y=R.painter.shadowRenderer,Q=!!Y&&Y.enabled,X=new ht(k.context.gl.LEQUAL,ht.ReadOnly,k.depthRangeFor3D);let $=[0,0,0];if(Q){const ue=k.style.directionalLight,le=k.style.ambientLight;ue&&le&&($=Ko(k.style,ue,le))}const ie=ue=>{for(const le of H){const xe=F.getTile(le),ve=xe.getBucket(U);if(!ve)continue;const Ae=ve.elevatedStructures;if(!Ae)continue;let Ve,me;if(ue?(Ve=Ae.renderableBridgeSegments,me=Ae.bridgeProgramConfigurations.get(U.id)):(Ve=Ae.renderableTunnelSegments,me=Ae.tunnelProgramConfigurations.get(U.id)),!Ve||Ve.segments[0].primitiveLength===0)continue;me.updatePaintBuffers(),k.prepareDrawTile();const se=k.isTileAffectedByFog(le),Te=[];Q&&Te.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const _e=k.getOrCreateProgram("elevatedStructures",{config:me,overrideFog:se,defines:Te}),Re=k.translatePosMatrix(le.projMatrix,xe,U.paint.get("fill-translate"),U.paint.get("fill-translate-anchor"));Q&&Y.setupShadows(xe.tileID.toUnwrapped(),_e,"vector-tile");const We=Ls(Re,$);k.uploadCommonUniforms(k.context,_e,le.toUnwrapped()),_e.draw(k,te.TRIANGLES,X,St.disabled,j,Tt.backCCW,We,U.id,Ae.vertexBuffer,Ae.indexBuffer,Ve,U.paint,k.transform.zoom,me,[Ae.vertexBufferNormal])}};ie(!0),ie(!1)})(A)}}else ou(A,!1,C,l.stencilModeFor3D())},"fill-extrusion":function(l,t,n,c){const d=n.paint.get("fill-extrusion-opacity"),p=l.context,m=p.gl,g=l.terrain,x=g&&g.renderingToTexture;if(d===0)return;const w=l.emissiveMode==="mrt-fallback",S=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),M=l.style.order.indexOf(n.fqid);if(S&&(function(A,C,z,R,k){for(const F of R){const U=C.getTile(F).getBucket(z);U&&(U.updateReplacement(F,A.replacementSource,k),U.uploadCentroid(A.context))}})(l,t,n,c,M),g||S)for(const A of c){const C=t.getTile(A).getBucket(n);C&&wm(l.context,t,A,C,n,g,S)}if(l.renderPass==="shadow"&&l.shadowRenderer){const A=l.shadowRenderer;if(g&&d<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.ad)return;const C=A.getShadowPassDepthMode(),z=A.getShadowPassColorMode();
2972su(l,t,n,c,C,St.disabled,z,S)}else if(l.renderPass==="translucent"){const A=!n.paint.get("fill-extrusion-pattern").constantOr(1),C=n.paint.get("fill-extrusion-color").constantOr(s.ao.white);if(!x&&C.a!==0){const z=new ht(l.context.gl.LEQUAL,ht.ReadWrite,l.depthRangeFor3D);d===1&&A?su(l,t,n,c,z,St.disabled,Dt.unblended,S):(su(l,t,n,c,z,St.disabled,Dt.disabled,S),su(l,t,n,c,z,l.stencilModeFor3D(),l.colorModeForRenderPass(),S),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&A&&(!g&&l.transform.projection.name!=="globe"||x)){const z=n.paint.get("fill-extrusion-opacity"),R=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),k=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),F=n.paint.get("fill-extrusion-flood-light-intensity"),U=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",H=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(U?null:n.lut).toArray01().slice(0,3),j=R>0&&k>0,te=F>0,Y=($,ie,ue)=>(1-ue)*$+ue*ie,Q=new jh;Q.translate=n.paint.get("fill-extrusion-translate"),Q.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),Q.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),Q.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");const X=$=>{const ie=l.depthModeForSublayer(1,ht.ReadOnly,m.LEQUAL,!0),ue=n.paint.get($?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),le=Y(.1,3,ue),xe=l._showOverdrawInspector;if(!xe){const ve=new St({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Ae=new Dt([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0],m.MIN);es(Q,l,t,n,c,ie,ve,Ae,Tt.disabled,$,"sdf",z,R,k,F,H,le,S,!1)}{const ve=xe?St.disabled:new St({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Ae=xe?l.colorModeForRenderPass():new Dt([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],s.ao.transparent,[!0,!0,!0,!0]);es(Q,l,t,n,c,ie,ve,Ae,Tt.disabled,$,"color",z,R,k,F,H,le,S,!1)}};if(x){const $=()=>{const ue=g.drapeBufferSize[0],le=g.drapeBufferSize[1];let xe=g.framebufferCopyTexture;return xe&&(!xe||xe.size[0]===ue&&xe.size[1]===le)||(xe&&xe.destroy(),xe=g.framebufferCopyTexture=new s.T(p,new s.q({width:ue,height:le}),m.RGBA8)),xe.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,ue,le),xe},ie=(ue,le,xe)=>{const ve=l.depthModeForSublayer(1,ht.ReadOnly,m.LEQUAL,!1),Ae=n.paint.get(ue?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ve=Y(.1,3,Ae);{const me=new Dt([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0]);es(Q,l,t,n,c,ve,St.disabled,me,Tt.disabled,ue,"clear",z,R,k,F,H,Ve,S,le)}{const me=new St({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),se=new Dt([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0],m.MIN);es(Q,l,t,n,c,ve,me,se,Tt.disabled,ue,"sdf",z,R,k,F,H,Ve,S,le)}w&&!ue&&(xe=$());{const me=ue?m.ZERO:m.ONE_MINUS_DST_ALPHA,se=new St({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Te=new Dt([me,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],s.ao.transparent,[!0,!0,!0,!0]);es(Q,l,t,n,c,ve,se,Te,Tt.disabled,ue,"color",z,R,k,F,H,Ve,S,le)}if(!w||ue){const me=new Dt([m.ONE,m.ONE,m.ONE,ue?m.ZERO:m.ONE],s.ao.transparent,[!1,!1,!1,!0],ue?m.FUNC_ADD:m.MAX);es(Q,l,t,n,c,ve,St.disabled,me,Tt.disabled,ue,"clear",z,R,k,F,H,Ve,S,le,xe)}else{m.drawBuffers([m.NONE,m.COLOR_ATTACHMENT1]);const me=new St({func:m.EQUAL,mask:255},254,255,m.KEEP,m.DECR,m.DECR),se=new Dt([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!0,!1,!1,!1],m.MAX);es(Q,l,t,n,c,ve,me,se,Tt.disabled,ue,"emissive",z,R,k,F,H,Ve,S,le,xe),m.drawBuffers([m.COLOR_ATTACHMENT0])}};if(j||te){let ue;l.prepareDrawTile(),w&&!j||(ue=$()),j&&ie(!0,!1,ue),te&&ie(!1,!0,ue)}}else j&&X(!0),te&&X(!1),(j||te)&&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"),p=n.paint.get("building-ambient-occlusion-ground-radius"),m=n.paint.get("building-ambient-occlusion-ground-attenuation"),g=n.paint.get("building-opacity");if(g<=0)return;let x=d>0&&p>0,w=!0;const S=n.paint.get("building-vertical-scale");if(S<=0)return;l.shadowRenderer||(w=!1);const M=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),A=l.style.order.indexOf(n.fqid);if((function(C,z,R,k,F,U){for(const H of U){const j=z.getTile(H).getBucket(R);j&&(F&&j.updateReplacement(H,C.replacementSource,k),j.uploadUpdatedIndexBuffer(C.context))}})(l,t,n,A,M,c),(function(C,z,R,k){for(const F of k){const U=z.getTile(F).getBucket(R);
2972U&&U.needsEvaluation()&&U.uploadUpdatedColorBuffer(C.context)}})(l,t,n,c),n.resetLayerRenderingStats(l),l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0),l.renderPass==="shadow"&&l.shadowRenderer){const C=l.shadowRenderer,z=[],R=C.getShadowPassDepthMode();ql({painter:l,source:t,layer:n,coords:c,defines:z,blendMode:C.getShadowPassColorMode(),depthMode:R,opacity:g,verticalScale:S,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(l.renderPass==="translucent"){let C=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];w&&(C=C.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),l.shadowRenderer&&l.shadowRenderer.useNormalOffset&&(C=C.concat("NORMAL_OFFSET"));const z=n.paint.get("building-facade-emissive-chance"),R=n.paint.get("building-ambient-occlusion-intensity"),k=n.paint.get("building-flood-light-intensity"),F=n.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",U=n.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(F?null:n.lut).toArray01().slice(0,3),H=n.paint.get("building-flood-light-ground-attenuation"),j=k>0,te=new ht(l.context.gl.LEQUAL,ht.ReadWrite,l.depthRangeFor3D);g<1&&ql({painter:l,source:t,layer:n,coords:c,defines:C,blendMode:Dt.disabled,depthMode:te,opacity:g,verticalScale:S,facadeEmissiveChance:z,facadeAOIntensity:R,floodLightIntensity:k,floodLightColor:U,depthOnly:!0});const Y=l.colorModeForRenderPass();ql({painter:l,source:t,layer:n,coords:c,defines:C,blendMode:Y,depthMode:te,opacity:g,verticalScale:S,facadeEmissiveChance:z,facadeAOIntensity:R,floodLightIntensity:k,floodLightColor:U}),x&&au(l,t,n,c,!0,g,d,p,k,U,m,M),j&&au(l,t,n,c,!1,g,d,p,k,U,H,M)}else if(l.renderPass==="light-beam"){const C=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],z=new ht(l.context.gl.LEQUAL,ht.ReadOnly,l.depthRangeFor3D);ql({painter:l,source:t,layer:n,coords:c,defines:C,blendMode:Dt.alphaBlended,depthMode:z,opacity:g,verticalScale:S,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}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;const d=l.context,p=l.terrain&&l.terrain.renderingToTexture,[m,g]=l.renderPass!=="translucent"||p?[{},c]:l.stencilConfigForOverlap(c);for(const x of g){const w=t.getTile(x);if(w.needsHillshadePrepare&&l.renderPass==="offscreen")dm(l,w,n);else if(l.renderPass==="translucent"){const S=l.depthModeForSublayer(0,ht.ReadOnly),M=n.paint.get("hillshade-emissive-strength"),A=l.colorModeForDrapableLayerRenderPass(M),C=p&&l.terrain?l.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];hm(l,x,w,n,S,C,A)}}d.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,n,c,d,p){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0)return;const m=l.transform.projection.name==="globe",g=n.paint.get("raster-elevation")!==0,x=g&&m;if(l.renderElevatedRasterBackface&&!x)return;const w=l.context,S=w.gl,M=t.getSource(),A=(function(Y,Q,X,$,ie){const ue=Q.paint.get("raster-color"),le=Y.type==="raster-array",xe=[],ve=Q.paint.get("raster-resampling"),Ae=Q.paint.get("raster-color-mix");let Ve=Q.paint.get("raster-color-range");const me=[Ae[0],Ae[1],Ae[2],0],se=Ae[3];let Te=ve==="nearest"?$.NEAREST:$.LINEAR;if(le&&(xe.push("RASTER_ARRAY"),ue||xe.push("RASTER_COLOR"),ve==="linear"&&xe.push("RASTER_ARRAY_LINEAR"),Te=$.NEAREST,!Ve&&Y.rasterLayers)){const _e=Y.rasterLayers.find((({id:Re})=>Re===Q.sourceLayer));_e&&_e.fields&&_e.fields.range&&(Ve=_e.fields.range)}if(Ve=Ve||[0,1],ue){xe.push("RASTER_COLOR"),X.activeTexture.set($.TEXTURE2),Q.updateColorRamp(Ve);let _e=Q.colorRampTexture;_e||(_e=Q.colorRampTexture=new s.T(X,Q.colorRamp,$.RGBA8)),_e.bind($.LINEAR,$.CLAMP_TO_EDGE)}return ie&&xe.push("USE_MRT1"),{mix:me,range:Ve,offset:se,defines:xe,resampling:Te}})(M,n,w,S,l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback");if(M instanceof s.aU&&!c.length&&!m)return;const C=n.paint.get("raster-emissive-strength"),z=l.colorModeForDrapableLayerRenderPass(C),R=l.terrain&&l.terrain.renderingToTexture,k=!l.options.moving,F=n.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(M instanceof s.aU&&!c.length&&(M.onNorthPole||M.onSouthPole)){const Y=g?l.stencilModeFor3D():St.disabled;return void $l(!!M.onNorthPole,null,l,t,n,C,A,Tt.disabled,Y)}if(!c.length)return;const[U,H]=M instanceof s.aU||R?[{},c]:l.stencilConfigForOverlap(c),j=H[H.length-1].overscaledZ;x&&A.defines.push("PROJECTION_GLOBE_VIEW"),g&&A.defines.push("RENDER_CUTOFF");
2972const te=(Y,Q,X)=>{for(const $ of Y){const ie=$.toUnwrapped(),ue=t.getTile($);if(R&&(!ue||!ue.hasData()))continue;w.activeTexture.set(S.TEXTURE0);const le=is(ue,M,n,A);if(!le||!le.texture)continue;const{texture:xe,mix:ve,offset:Ae,tileSize:Ve,buffer:me}=le;let se,Te;R?(se=ht.disabled,Te=$.projMatrix):g?(se=new ht(S.LEQUAL,ht.ReadWrite,l.depthRangeFor3D),Te=m?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(ie,k)):(se=l.depthModeForSublayer($.overscaledZ-j,n.paint.get("raster-opacity")===1?ht.ReadWrite:ht.ReadOnly,S.LESS),Te=l.transform.calculateProjMatrix(ie,k));const _e=l.terrain&&R?l.terrain.stencilModeForRTTOverlap($):U[$.overscaledZ],Re=p?0:n.paint.get("raster-fade-duration");ue.registerFadeDuration(Re);const We=t.findLoadedParent($,0),et=Vl(ue,We,t,l.transform,Re);let qe,Ue;!et.isFading&&ue.refreshedUponExpiration&&(ue.refreshedUponExpiration=!1),l.terrain&&l.terrain.prepareDrawTile(),w.activeTexture.set(S.TEXTURE0),xe.bind(F,S.CLAMP_TO_EDGE),w.activeTexture.set(S.TEXTURE1),We?(We.texture&&We.texture.bind(F,S.CLAMP_TO_EDGE),qe=Math.pow(2,We.tileID.overscaledZ-ue.tileID.overscaledZ),Ue=[ue.tileID.canonical.x*qe%1,ue.t
2972ileID.canonical.y*qe%1]):xe.bind(F,S.CLAMP_TO_EDGE),"useMipmap"in xe&&w.extTextureFilterAnisotropic&&l.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);const ct=l.transform;let st;const Je=g?kf(ct):[0,0,0,0];let it,gt,Mt,$t,ci,ut=0;if(x&&M instanceof s.aU&&M.coordinates.length>3)it=Float32Array.from(s.bk(s.dJ(new s.cD(0,0,0)))),gt=Float32Array.from(ct.globeMatrix),Mt=Float32Array.from(s.dF(ct)),$t=[s.aF(ct.center.lng),s.aJ(ct.center.lat)],st=M.elevatedGlobePerspectiveTransform,ci=M.elevatedGlobeGridMatrix||new Float32Array(9);else if(x){const Ti=s.dG($.canonical);ut=s.dH(Ti.getCenter().lat),it=Float32Array.from(s.bk(s.dJ($.canonical))),gt=Float32Array.from(ct.globeMatrix),Mt=Float32Array.from(s.dF(ct)),$t=[s.aF(ct.center.lng),s.aJ(ct.center.lat)],st=[0,0],ci=Float32Array.from(s.dI($.canonical,Ti,ut,ct.worldSize/ct._pixelsPerMercatorPixel))}else st=M instanceof s.aU?M.perspectiveTransform:[0,0],it=new Float32Array(16),gt=new Float32Array(9),Mt=new Float32Array(16),$t=[0,0],ci=new Float32Array(9);const si=Pf(Te,it,gt,Mt,ci,Ue||[0,0],s.aj(l.transform.zoom),$t,Je,qe||1,et,n,st,g?n.paint.get("raster-elevation"):0,2,ve,Ae,A.range,Ve,me,C),At=l.isTileAffectedByFog($),di=l.getOrCreateProgram("raster",{defines:A.defines,overrideFog:At});if(l.uploadCommonUniforms(w,di,ie),M instanceof s.aU){const Ti=M.elevatedGlobeVertexBuffer,xi=M.elevatedGlobeIndexBuffer;if(R||!m)M.boundsBuffer&&M.boundsSegments&&di.draw(l,S.TRIANGLES,se,St.disabled,z,Tt.disabled,si,n.id,M.boundsBuffer,l.quadTriangleIndexBuffer,M.boundsSegments);else if(Ti&&xi){const ni=ct.zoom<=s.c_?M.elevatedGlobeSegments:M.getSegmentsForLongitude(ct.center.lng);ni&&di.draw(l,S.TRIANGLES,se,St.disabled,z,Q,si,n.id,Ti,xi,ni)}}else if(x){se=new ht(S.LEQUAL,ht.ReadOnly,l.depthRangeFor3D);const Ti=l.globeSharedBuffers;if(Ti){const[xi,ni,Ot]=Ti.getGridBuffers(ut,!1);di.draw(l,S.TRIANGLES,se,X||_e,l.colorModeForRenderPass(),Q,si,n.id,xi,ni,Ot)}}else{const{tileBoundsBuffer:Ti,tileBoundsIndexBuffer:xi,tileBoundsSegments:ni}=l.getTileBoundsBuffers(ue);di.draw(l,S.TRIANGLES,se,_e,z,Tt.disabled,si,n.id,Ti,xi,ni)}}if(!(M instanceof s.aU)&&x)for(const $ of Y){const ie=$.canonical.y===(1<<$.canonical.z)-1;$.canonical.y===0&&$l(!0,$,l,t,n,C,A,Q,X||St.disabled),ie&&$l(!1,$,l,t,n,C,A,Q===Tt.frontCW?Tt.backCW:Tt.frontCW,X||St.disabled)}};x?te(H,l.renderElevatedRasterBackface?Tt.backCW:Tt.frontCW,l.stencilModeFor3D()):te(H,Tt.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,n,c,d,p){l.renderPass==="offscreen"&&(function(m,g,x,w){if
2972(!w.length)return;const S=m.context,M=S.gl,A=g.getSource();if(!(A instanceof dn))return;const C=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let z=x.particlePositionRGBAImage;if(!z||z.width!==C){const H=(function(j){const te=j*j,Y=new Uint8Array(4*te),Q=function($){return $|=0,$=Math.imul(2747636419^$,2654435769),$=Math.imul($^$>>>16,2654435769),(($=Math.imul($^$>>>16,2654435769))>>>0)/4294967296},X=1/1.1;for(let $=0;$<te;$++){const ie=X*(Q(2*$+0)+Oo),ue=X*(Q(2*$+1)+Oo),le=255*ie%1,xe=255*ue%1,ve=le,Ae=ue-xe/255,Ve=xe;Y[4*$+0]=255*(ie-le/255),Y[4*$+1]=255*ve,Y[4*$+2]=255*Ae,Y[4*$+3]=255*Ve}return Y})(C);z=x.particlePositionRGBAImage=new s.q({width:C,height:C},H)}let R=x.particleFramebuffer;R?R.width!==C&&(R.destroy(),R=x.particleFramebuffer=S.createFramebuffer(C,C,1,null)):R=x.particleFramebuffer=S.createFramebuffer(C,C,1,null);const k=[];for(const H of w){const j=g.getTile(H);if(!(j instanceof bc))continue;const te=Hh(j,A,x);if(!te)continue;const Y=[j.tileSize,j.tileSize];let Q=x.tileFramebuffer;Q||(Q=x.tileFramebuffer=S.createFramebuffer(Y[0],Y[1],1,null));let X=j.rasterParticleState;X||(X=j.rasterParticleState=new cu(S,H,Y,z));const $=X.update(x.lastInvalidatedAt);X.particleTextureDimension!==C&&X.updateParticleTexture(H,z);const ie=X.targetColorTexture;X.targetColorTexture=X.backgroundColorTexture,X.backgroundColorTexture=ie;const ue=X.particleTexture0;X.particleTexture0=X.particleTexture1,X.particleTexture1=ue,k.push([H,te,X,$])}if(k.length===0)return;const F=s.o.now(),U=x.previousDrawTimestamp?.001*(F-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=F,x.hasColorMap()){S.activeTexture.set(M.TEXTURE0+2);let H=x.colorRampTexture;H||(H=x.colorRampTexture=new s.T(S,x.colorRamp,M.RGBA8)),H.bind(M.LINEAR,M.CLAMP_TO_EDGE)}S.bindFramebuffer.set(x.tileFramebuffer.framebuffer),(function(H,j,te){const Y=H.context,Q=Y.gl,X=j.tileFramebuffer;Y.activeTexture.set(Q.TEXTURE0);const $={u_texture:0,u_opacity:1.05*(ue=j.paint.get("raster-particle-fade-opacity-factor"))/(ue+.05)},ie=H.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var ue;for(const le of te){const[,,xe,ve]=le;X.colorAttachment0.set(xe.targetColorTexture.texture),Y.viewport.set([0,0,X.width,X.height]),Y.clear({color:s.ao.transparent}),ve&&(xe.backgroundColorTexture.bind(Q.NEAREST,Q.CLAMP_TO_EDGE),ie.draw(H,Q.TRIANGLES,ht.disabled,St.disabled,Dt.alphaBlended,Tt.disabled,$,j.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments))}})(m,x,k),(function(H,j,te,Y){const Q=H.context,X=Q.gl,$=te.tileFramebuffer,ie=H.transform.projection.name==="globe",ue=te.paint.get("raster-particle-max-speed");for(const le of Y){const[xe,ve,Ae]=le;Q.activeTexture.set(X.TEXTURE0+0),ve.texture.bind(X.LINEAR,X.CLAMP_TO_EDGE),$.colorAttachment0.set(Ae.targetColorTexture.texture);const Ve=H.getOrCreateProgram("rasterParticleDraw",{defines:ve.defines,overrideFog:!1});Q.activeTexture.set(X.TEXTURE0+1);const me=ve.scalarData?[]:[0,1,2,3].map((_e=>s.e9[_e](xe)));me.push(xe);const se=xe.canonical.x,Te=xe.canonical.y;for(const _e of me){const Re=j.getTile(ie?_e.wrapped():_e);if(!Re)continue;const We=Re.rasterParticleState;if(!We)continue;const et=_e.canonical.x+(1<<_e.canonical.z)*(_e.wrap-xe.wrap),qe=_e.canonical.y;We.particleTexture0.bind(X.NEAREST,X.CLAMP_TO_EDGE);const Ue=bm(1,We.particleTexture0.size[0],[et-se,qe-Te],0,ve.texture.size,2,ue,ve.textureOffset,ve.scale,ve.offset);Ve.draw(H,X.POINTS,ht.disabled,St.disabled,Dt.alphaBlended,Tt.disabled,Ue,te.id,We.particleIndexBuffer,void 0,We.particleSegment)}}})(m,g,x,k),S.bindFramebuffer.set(x.particleFramebuffer.framebuffer),(function(H,j,te,Y){const Q=H.context,X=Q.gl,$=j.paint.get("raster-particle-max-speed"),ie=Y*j.paint.get("raster-particle-speed-factor")*.15,ue=(function(xe){return Math.pow(xe,6)})(.01+1*j.paint.get("raster-particle-reset-rate-factor")),le=j.particleFramebuffer;Q.viewport.set([0,0,le.width,le.height]);for(const xe of te){const[,ve,Ae]=xe;Q.activeTexture.set(X.TEXTURE0+0),ve.texture.bind(X.LINEAR,X.CLAMP_TO_EDGE),Q.activeTexture.set(X.TEXTURE0+1);const Ve=Ae.particleTexture0;Ve.bind(X.NEAREST,X.CLAMP_TO_EDGE);const me=zf(1,Ve.size[0],0,ve.texture.size,$,ie,ue,ve.textureOffset,ve.scale,ve.offset);le.colorAttachment0.set(Ae.particleTexture1.texture),Q.clear({color:s.ao.transparent}),H.getOrCreateProgram("rasterParticleUpdate",{defines:ve.defines}).draw(H,X.TRIANGLES,ht.disabled,St.disabled,Dt.unblended,Tt.disabled,me,j.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments)}})(m,x,k,U)})(l,t,n,c),l.renderPass==="translucent"&&((function(m,g,x,w,S){const M=m.context,A=M.gl,C=g.getSource().tileSize,z=5*(1-s.ah(s.cL,s.cL+1,m.transform.zoom))*C+x.paint.get("raster-particle-elevation"),R=!m.options.moving,k=m.transform.projection.name==="globe";if(!w.length)return;const[F,U]=m.stencilConfigForOverlap(w),H=[];k&&H.push("PROJECTION_GLOBE_VIEW");const j=m.stencilModeFor3D();for(const te of U){const Y=te.toUnwrapped(),Q=g.getTile(te);if(!Q.rasterParticleState)continue;const X=Q.rasterParticleState,$=100;Q.registerFadeDuration($);const ie=g.findLoadedParent(te,0),ue=Vl(Q,ie,g,m.transform,$);let le,xe;m.terrain&&m.terrain.prepareDrawTile(),M.activeTexture.set(A.TEXTURE0),X.targetColorTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),M.activeTexture.set(A.TEXTURE1),ie&&ie.rasterParticleState?(ie.rasterParticleState.targetColorTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),le=Math.pow(2,ie.tileID.overscaledZ-Q.tileID.overscaledZ
2972),xe=[Q.tileID.canonical.x*le%1,Q.tileID.canonical.y*le%1]):X.targetColorTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE);const ve=k?Float32Array.from(m.transform.expandedFarZProjMatrix):m.transform.calculateProjMatrix(Y,R),Ae=m.transform,Ve=Bf(Ae),me=s.dG(te.canonical),se=s.dH(me.getCenter().lat);let Te,_e,Re,We,et;k?(Te=Float32Array.from(s.bk(s.dJ(te.canonical))),_e=Float32Array.from(Ae.globeMatrix),Re=Float32Array.from(s.dF(Ae)),We=[s.aF(Ae.center.lng),s.aJ(Ae.center.lat)],et=Float32Array.from(s.dI(te.canonical,me,se,Ae.worldSize/Ae._pixelsPerMercatorPixel))):(Te=new Float32Array(16),_e=new Float32Array(9),Re=new Float32Array(16),We=[0,0],et=new Float32Array(9));const qe=vm(ve,Te,_e,Re,et,xe||[0,0],s.aj(m.transform.zoom),We,Ve,le||1,ue,z),Ue=m.isTileAffectedByFog(te),ct=m.getOrCreateProgram("rasterParticle",{defines:H,overrideFog:Ue});if(m.uploadCommonUniforms(M,ct,Y),k){const st=new ht(A.LEQUAL,ht.ReadOnly,m.depthRangeFor3D),Je=0,it=m.globeSharedBuffers;if(it){const[gt,Mt,$t]=it.getGridBuffers(se,Je!==0);ct.draw(m,A.TRIANGLES,st,j,Dt.alphaBlended,m.renderElevatedRasterBackface?Tt.frontCCW:Tt.backCCW,qe,x.id,gt,Mt,$t)}}else{const st=m.depthModeForSublayer(0,ht.ReadOnly),Je=F[te.overscaledZ],{tileBoundsBuffer:it,tileBoundsIndexBuffer:gt,tileBoundsSegments:Mt}=m.getTileBoundsBuffers(Q);ct.draw(m,A.TRIANGLES,st,Je,Dt.alphaBlended,Tt.disabled,qe,x.id,it,gt,Mt)}}m.resetStencilClippingMasks()})(l,t,n,c),l.style.map.triggerRepaint())},background:function(l,t,n,c){const d=n.paint.get("background-color"),p=n.paint.get("background-color-use-theme").constantOr("default")==="none",m=n.paint.get("background-opacity"),g=n.paint.get("background-emissive-strength"),x=n.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const w=l.context,S=w.gl,M=l.transform,A=M.tileSize,C=n.paint.get("background-pattern");let z;if(C!==void 0&&(C===null||(z=l.imageManager.getPattern(s.I.from(C.toString()),n.scope,l.style.getLut(n.scope)),!z)))return;const R=!C&&d.a===1&&m===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==R)return;const k=St.disabled,F=l.depthModeForSublayer(0,R==="opaque"?ht.ReadWrite:ht.ReadOnly),U=l.colorModeForDrapableLayerRenderPass(g),H=C?"backgroundPattern":"background";let j,te=c;te||(j=l.getBackgroundTiles(),te=Object.values(j).map((Q=>Q.tileID))),C&&(w.activeTexture.set(S.TEXTURE0),l.imageManager.bind(l.context,n.scope));const Y=[];if(l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&Y.push("USE_MRT1"),x){const Q=l.getOrCreateProgram(H,{overrideFog:!1,overrideRtt:!0,defines:Y}),X=new Float32Array(s.bA([])),$=new s.aQ(0,0,0,0,0),ie=C?Fs(X,g,m,l,0,n.scope,z,x,{tileID:$,tileSize:A}):jl(X,g,m,d.toPremultipliedRenderColor(p?null:n.lut));Q.draw(l,S.TRIANGLES,F,k,U,Tt.disabled,ie,n.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}else for(const Q of te){const X=l.isTileAffectedByFog(Q),$=l.getOrCreateProgram(H,{overrideFog:X,defines:Y}),ie=Q.toUnwrapped(),ue=c?Q.projMatrix:l.transform.calculateProjMatrix(ie);l.prepareDrawTile();const le=t?t.getTile(Q):j?j[Q.key]:new sa(Q,A,M.zoom,l),xe=C?Fs(ue,g,m,l,0,n.scope,z,x,{tileID:Q,tileSize:A}):jl(ue,g,m,d.toPremultipliedRenderColor(p?null:n.lut));l.uploadCommonUniforms(w,$,ie);const{tileBoundsBuffer:ve,tileBoundsIndexBuffer:Ae,tileBoundsSegments:Ve}=l.getTileBoundsBuffers(le);$.draw(l,S.TRIANGLES,F,k,U,Tt.disabled,xe,n.id,ve,Ae,Ve)}},sky:function(l,t,n){const c=l._atmosphere?s.aj(l.transform.zoom):1,d=n.paint.get("sky-opacity")*c;if(d===0)return;const p=l.context,m=n.paint.get("sky-type"),g=new ht(p.gl.LEQUAL,ht.ReadOnly,[0,1]),x=l.frameCounter/1e3%1;m==="atmosphere"?l.renderPass==="offscreen"?n.needsSkyboxCapture(l)&&((function(w,S,M,A){const C=w.context,z=C.gl;let R=S.skyboxFbo;if(!R){R=S.skyboxFbo=C.createFramebuffer(32,32,1,null),S.skyboxGeometry=new hu(C),S.skyboxTexture=C.gl.createTexture(),z.bindTexture(z.TEXTURE_CUBE_MAP,S.skyboxTexture),z.texParameteri(z.TEXTURE_CUBE_MAP,z.TEXTURE_WRAP_S,z.CLAMP_TO_EDGE),z.texParameteri(z.TEXTURE_CUBE_MAP,z.TEXTURE_WRAP_T,z.CLAMP_TO_EDGE),z.texParameteri(z.TEXTURE_CUBE_MAP,z.TEXTURE_MIN_FILTER,z.LINEAR),z.texParameteri(z.TEXTURE_CUBE_MAP,z.TEXTURE_MAG_FILTER,z.LINEAR);for(let H=0;H<6;++H)z.texImage2D(z.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,z.RGBA,32,32,0,z.RGBA,z.UNSIGNED_BYTE,null)}C.bindFramebuffer.set(R.framebuffer),C.viewport.set([0,0,32,32]);const k=S.getCenter(w,!0),F=w.getOrCreateProgram("skyboxCapture"),U=new Float64Array(16);s.bA(U),s.en(U,U,.5*-Math.PI),xa(w,S,F,U,k,0),s.bA(U),s.en(U,U,.5*Math.PI),xa(w,S,F,U,k,1),s.bA(U),s.cU(U,U,.5*-Math.PI),xa(w,S,F,U,k,2),s.bA(U),s.cU(U,U,.5*Math.PI),xa(w,S,F,U,k,3),s.bA(U),xa(w,S,F,U,k,4),s.bA(U),s.en(U,U,Math.PI),xa(w,S,F,U,k,5),C.viewport.set([0,0,w.width,w.height])})(l,n),n.markSkyboxValid(l)):l.renderPass==="sky"&&(function(w,S,M,A,C){const z=w.context,R=z.gl,k=w.transform,F=w.getOrCreateProgram("skybox");z.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_CUBE_MAP,S.skyboxTexture);const U=((H,j,te,Y,Q)=>({u_matrix:H,u_sun_direction:j,u_cubemap:0,u_opacity:Y,u_temporal_offset:Q}))(k.skyboxMatrix,S.getCenter(w,!1),0,A,C);w.uploadCommonUniforms(z,F),F.draw(w,R.TRIANGLES,M,St.disabled,w.colorModeForRenderPass(),Tt.backCW,U,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)})(l,n,g,d,x):m==="gradient"&&l.renderPass==="sky"&&(function(w,S,M,A,C){const z=w.context,R=z.gl,k=w.transform,F=w.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new hu(z)),z.activeTexture.set(R.TEXTURE0);let U=S.colorRampTexture;U||(U=S.colorRampTexture=new s.T(z,S.colorRamp,R.RGBA8)),U.bind(R.LINEAR,R.CLAMP_TO_EDGE);const H=((j,te,Y,Q,X)=>({u_matrix:j,u_color_ramp:0,u_center_direction:te,u_radius:s.an(Y),u_opacity:Q,u_temporal_offset:X}))(k.skyboxMatrix,S.getCenter(w,!1),S.paint.get("sky-gradient-radius"),A,C);w.uploadCommonUniforms(z,F),F.draw(w,R.TRIANGLES,M,St.disabled,w.colorModeForRenderPass(),Tt.backCW,H,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)})(l,n,g,d,x)},custom:function(l,t,n,c){const d=l.context,p=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=p.prerender;if(m){if(l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const g=l.transform.pointMerc;m.call(p,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.aj(l.transform.zoom),[g.x,g.y],l.transform.pixelsPerMeterRatio)}else m.call(p,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const g=p.renderToTile;if(g){const x=c[0].canonical,w={x:x.x+c[0].wrap*(p.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(ht.disabled),d.setStencilMode(St.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),g.call(p,d.gl,w),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode(St.disabled);const m=p.renderingMode==="3d"?new ht(l.context.gl.LEQUAL,ht.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,ht.ReadOnly);if(d.setDepthMode(m),l.transform.projection.name==="globe"){const g=l.transform.pointMerc;p.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.aj(l.transform.zoom),[g.x,g.y],l.transform.pixelsPerMeterRatio)}else p.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else s.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,n,c){if(l.renderPass==="opaque")return;const d=n.paint.get("model-opacity").constantOr(1),p=n.paint.get("model-elevation-reference"),m=p==="ground",g=p==="ground";if(d===0)return;const x=n.paint.get("model-cast-shadows");
2972if(l.renderPass==="shadow"&&(!x||l.terrain&&d<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof s.ad))return;const w=l.shadowRenderer,S=n.paint.get("model-receive-shadows");w&&(w.useNormalOffset=!0,S||(w.enabled=!1));const M=()=>{w&&(w.useNormalOffset=!0,S||(w.enabled=!0))},A=t.getSource();if(l.renderPass==="light-beam"&&A.type!=="batched-model")return;if(A.type==="vector"||A.type==="geojson")return(function(j,te,Y,Q,X){const $=j.transform,ie=$.projection.name==="globe",ue=$.getFreeCameraOptions().position;if(!j.modelManager)return;const le=j.modelManager;Y.modelManager=le;const xe=j.shadowRenderer;if(!Y._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const ve=Y._unevaluatedLayout._values["model-id"],Ae=Object.assign({},Y.layout.get("model-id").parameters),Ve=j.style.order.indexOf(Y.fqid),me=Y.paint.get("model-opacity").constantOr(1);for(const se of Q){const Te=te.getTile(se).getBucket(Y);if(!Te||Te.projection.name!==$.projection.name)continue;const _e=Te.getModelUris();if(_e&&!Te.modelsRequested&&(le.addModelsFromBucket(_e,X),Te.modelsRequested=!0),ie)Ae.zoom=se.overscaledZ;else{const Je=xn(se,$);Ae.zoom=Je}const Re=ve.possiblyEvaluate(Ae);if(Wf(j,Te,se),ko.shadowUniformsInitialized=!1,ko.useSingleShadowCascade=!!xe&&xe.getMaxCascadeForTile(se.toUnwrapped())===0,j.renderPass==="shadow"&&xe){if(j.currentShadowCascade===1&&Te.isInsideFirstShadowMapFrustum)continue;const Je=$.calculatePosMatrix(se.toUnwrapped(),$.worldSize);if(ko.tileMatrix.set(Je),ko.shadowTileMatrix=Float32Array.from(xe.calculateShadowPassMatrixFromMatrix(Je)),ko.aabb.min=[0,0,0],ko.aabb.max[0]=ko.aabb.max[1]=s.al,ko.aabb.max[2]=0,Em(Te,ko,j,Y.scope))continue}const We=1<<se.canonical.z,et=[((ue.x-se.wrap)*We-se.canonical.x)*s.al,(ue.y*We-se.canonical.y)*s.al,ue.z*We*s.al];j.conflationActive&&Object.keys(Te.instancesPerModel).length>0&&j.style.isLayerClipped(Y,te.getSource())&&Te.updateReplacement(se,j.replacementSource,Ve,Y.scope)&&(Te.uploaded=!1,Te.upload(j.context));let qe=0;const Ue=new Array,ct=new Array,st=new Array;for(let Je in Te.instancesPerModel){const it=Te.instancesPerModel[Je];it.features.length>0&&!ie&&(Je=Re.evaluate(it.features[0].feature,{}));const gt=le.getModel(Je,X);if(gt||le.hasURLBeenRequested(Je)||Te.modelUris.includes(Je)||(Te.modelUris.push(Je),Te.modelsRequested=!1),gt&>.uploaded)if(ie){const Mt=s.c5([],[ue.x,ue.y,ue.z],j.transform.worldSize);s.ew(Mt,Mt);for(let $t=0;$t<it.instancedDataArray.length;++$t){const ci=[0,0,0],ut=[1,1,1],si=s.ex(),At=it.tileCoordinatesForInstance($t),di=it.transformForInstance($t);s.ey(ut,di),s.ez(si,di),s.eA(ci,si);const Ti=it.translationForInstance($t),xi=new s.aT(0,0);s.eB(Te.canonical,xi,At.x,At.y);const ni=s.bC();s.eC(ni,gt,j.transform,xi,ci,ut,Ti,!0,!1,!1);const Ot=it.colorForInstance($t),hi=s.bA([]),tr=s.ef(xi.lat,j.transform.zoom),Ui=s.bq([],[1,1,1/tr]);s.br(hi,hi,Mt),st.push({zScaleMatrix:Ui,negCameraPosMatrix:hi});for(const fi of gt.nodes)va(j,fi,ni,j.transform.expandedFarZProjMatrix,qe,Ue,ct,gt.materialOverrides,me,Ot);++qe}}else for(const Mt of gt.nodes)Xf(j,Y,Mt,it,et,se,ko)}if(ie)if(j.renderPass==="shadow"){for(const Je of ct)xo(Je.mesh,Je.nodeModelMatrix,j,Y);for(const Je of Ue)xo(Je.mesh,Je.nodeModelMatrix,j,Y)}else Zf(j,Y,Ue,ct,st)}})(l,t,n,c,Zl(l,n)),void M();if(!A.loaded())return;if(A.type==="batched-model")return(function(j,te,Y,Q){Y.resetLayerRenderingStats(j);const X=j.context,$=j.transform,ie=j.style.fog,ue=j.shadowRenderer;if($.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${$.projection.name} projection is not yet implemented`);const le=j.transform.getFreeCameraOptions().position,xe=s.c5([],[le.x,le.y,le.z],j.transform.worldSize),ve=s.ew([],xe),Ae=s.bA([]),Ve=s.ef($.center.lat,$.zoom),me=s.bq([],[1,1,1/Ve]);s.br(Ae,Ae,ve);const se=Y.paint.get("model-opacity").constantOr(1),Te=new ht(X.gl.LEQUAL,ht.ReadWrite,j.depthRangeFor3D),_e=new ht(X.gl.LEQUAL,ht.ReadOnly,j.depthRangeFor3D),Re=new s.d9([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),We=j.renderPass==="shadow",et=We&&ue?ue.getCurrentCascadeFrustum():$.getFrustum($.scaleZoom($.worldSize)),qe=Y.paint.get("model-front-cutoff"),Ue=qe[2]<1,ct=Ms(j,Y.paint.get("model-cutoff-fade-range")),st=Y.getLayerRenderingStats();(function(Je,it,gt,Mt){const $t=Je.terrain?Je.terrain.exaggeration():0,ci=Je.transform.zoom;for(const ut of Mt){const si=it.getTile(ut).getBucket(gt);si&&(si.setFilter(gt.filter),Je.conflationActive&&si.updateReplacement(ut,Je.replacementSource),si.evaluateTransform(Je,gt),Je.terrain&&$t>0&&si.elevationUpdate(Je.terrain,$t,ut,gt.source),si.needsReEvaluation(Je,ci,gt)&&si.evaluate(gt))}})(j,te,Y,Q),(function(){let Je,it,gt;Ue?(Je=Q.length-1,it=-1,gt=-1):(Je=0,it=Q.length,gt=1);const Mt=new Float64Array(16),$t=s.cA(),ci=new s.P(0,0);for(let ut=Je;ut!==it;ut+=gt){const si=Q[ut],At=te.getTile(si).getBucket(Y);if(!At||!At.uploaded)continue;let di=!1;ue&&(di=ue.getMaxCascadeForTile(si.toUnwrapped())===0);const Ti=$.calculatePosMatrix(si.toUnwrapped(),$.worldSize),xi=At.modelTraits;!We&&Ue&&(s.bl(Mt,Ti),s.af($t,xe,Mt),ci.x=$t[0],ci.y=$t[1]);const ni=[];At.setFilter(Y.filter);
2972for(const Ot of At.getNodesInfo()){if(Ot.hiddenByReplacement||!Ot.node.meshes)continue;const hi=Ot.node;let tr=0;j.terrain&&hi.elevation&&(tr=hi.elevation*j.terrain.exaggeration());const Ui=(()=>{const sn=Ot.aabb;return Re.min=[...sn.min],Re.max=[...sn.max],Re.min[2]+=tr,Re.max[2]+=tr,s.af(Re.min,Re.min,Ti),s.af(Re.max,Re.max,Ti),Re})(),fi=Ot.evaluatedScale;if(fi[0]<=1&&fi[1]<=1&&fi[2]<=1&&Ui.intersects(et)===0)continue;if(!We&&Ue){const sn=.16666666666666666;Ot.cameraCollisionOpacity=xe[0]>Ui.min[0]&&xe[0]<Ui.max[0]&&xe[1]>Ui.min[1]&&xe[1]<Ui.max[1]&&xe[2]*Ve<Ui.max[2]&&hi.footprint&&s.c0(ci,hi.footprint)?Math.max(Ot.cameraCollisionOpacity-sn,0):Math.min(1,Ot.cameraCollisionOpacity+sn)}const Qt=[...Ti],Ft=1/s.d7(si.canonical),Fi=hi.anchor?hi.anchor[0]:0,ur=hi.anchor?hi.anchor[1]:0;s.br(Qt,Qt,[Fi*(fi[0]-1)+Ot.evaluatedTranslation[0]*Ft,ur*(fi[1]-1)+Ot.evaluatedTranslation[1]*Ft,tr+Ot.evaluatedTranslation[2]]),s.cq(fi,s.eE)||s.cS(Qt,Qt,fi);const Xi=s.aB([],Qt,hi.globalMatrix),Ai=s.aB([],$.expandedFarZProjMatrix,Xi),vn=s.aB([],$.expandedFarZProjMatrix,Qt),Kr=s.aC([],[Fi,ur,tr,1],Ai)[2];hi.hidden=!1;let Cr=se;We||(Ue&&(Cr*=Ot.cameraCollisionOpacity,Cr*=jt(Qt,$,Ot.aabb,qe)),Cr*=Vi(ct,Kr)),Cr!==0?ni.push({nodeInfo:Ot,depth:Kr,opacity:Cr,wvpForNode:Ai,wvpForTile:vn,nodeModelMatrix:Xi,tileModelMatrix:Qt}):hi.hidden=!0}We||ni.sort(((Ot,hi)=>!Ue||Ot.opacity===1&&hi.opacity===1?Ot.depth<hi.depth?-1:1:Ot.opacity===1?-1:hi.opacity===1?1:Ot.depth>hi.depth?-1:1));for(const Ot of ni){const hi=Ot.nodeInfo,tr=hi.node;let Ui=s.aB([],me,Ot.tileModelMatrix);s.aB(Ui,Ae,Ui);const fi=s.bl([],Ui);s.eg(fi,fi),s.cS(fi,fi,Wl),Ui=s.aB(Ui,Ui,tr.globalMatrix);const Qt=j.renderPass==="light-beam",Ft=Y.paint.get("model-color-use-theme").constantOr("default")==="none",Fi=xi&s.eI.HasMapboxMeshFeatures,ur=Fi?0:hi.evaluatedRMEA[0][2];for(let Xi=0;Xi<tr.meshes.length;++Xi){const Ai=tr.meshes[Xi],vn=Xi===tr.lightMeshIndex;let Kr=Ot.wvpForNode;if(vn){if(!Qt&&!j.terrain&&j.shadowRenderer){j.currentLayer<j.firstLightBeamLayer&&(j.firstLightBeamLayer=j.currentLayer);continue}Kr=Ot.wvpForTile}else if(Qt)continue;const Cr={defines:[]},sn=[];if(!We&&ue&&(ue.useNormalOffset=!!Ai.normalBuffer),pu(Cr.defines,sn,Ai,j,Ft?null:Y.lut),Fi||Cr.defines.push("DIFFUSE_SHADED"),di&&Cr.defines.push("SHADOWS_SINGLE_CASCADE"),st&&(We?st.numRenderedVerticesInShadowPass+=Ai.vertexArray.length:st.numRenderedVerticesInTransparentPass+=Ai.vertexArray.length),We){xo(Ai,Ot.nodeModelMatrix,j,Y);continue}let an=null;if(ie){const pr=fu(Ot.nodeModelMatrix,j.transform);if(an=new Float32Array(pr),$.projection.name!=="globe"){const Mi=Ai.aabb.min,yr=Ai.aabb.max,[ir,Yi]=ie.getOpacityForBounds(pr,Mi[0],Mi[1],yr[0],yr[1]);Cr.overrideFog=ir>=Me||Yi>=Me}}const Zr=Ai.material;let Hn;Zr.occlusionTexture&&Zr.occlusionTexture.offsetScale&&(Hn=Zr.occlusionTexture.offsetScale,Cr.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const no=j.getOrCreateProgram("model",Cr);!We&&ue&&ue.setupShadowsFromMatrix(Ot.tileModelMatrix,no,ue.useNormalOffset),j.uploadCommonUniforms(X,no,null,an);const Cn=Zr.pbrMetallicRoughness;Cn.metallicFactor=.9,Cn.roughnessFactor=.5;const ar=pa(new Float32Array(Kr),new Float32Array(Ui),new Float32Array(fi),new Float32Array(tr.globalMatrix),j,Ot.opacity,Cn.baseColorFactor,Zr.emissiveFactor,Cn.metallicFactor,Cn.roughnessFactor,Zr,ur,Y,[0,0,0],Hn);!vn&&(hi.hasTranslucentParts||Ot.opacity<1)&&no.draw(j,X.gl.TRIANGLES,Te,St.disabled,Dt.disabled,Tt.backCCW,ar,Y.id,Ai.vertexBuffer,Ai.indexBuffer,Ai.segments,Y.paint,j.transform.zoom,void 0,sn),no.draw(j,X.gl.TRIANGLES,vn?_e:Te,St.disabled,vn||Ot.opacity<1||hi.hasTranslucentParts?Dt.alphaBlended:Dt.unblended,Tt.backCCW,ar,Y.id,Ai.vertexBuffer,Ai.indexBuffer,Ai.segments,Y.paint,j.transform.zoom,void 0,sn)}}}})()})(l,t,n,c),void M();if(A.type!=="model")return;const C=A.getModels(),z=[],R=l.transform.getFreeCameraOptions().position,k=s.c5([],[R.x,R.y,R.z],l.transform.worldSize);s.ew(k,k);const F=[],U=[];let H=0;for(const j of C){const te=t.getFeatureState("",j.id),Y={type:"Unknown",id:j.id,properties:j.featureProperties},Q=n.paint.get("model-rotation").evaluate(Y,te),X=n.paint.get("model-scale").evaluate(Y,te),$=n.paint.get("model-translation").evaluate(Y,te),ie=n.paint.get("model-opacity").evaluate(Y,te);qf(n,j.id,te,j.featureProperties,j.nodeOverrideNames,j.nodeOverrides),$f(n,j.id,te,j.featureProperties,j.materialOverrideNames,j.materialOverrides),j.nodeOverrides.size>0&&j.computeBoundsAndApplyParent(),j.computeModelMatrix(l,Q,X,$,g,m,!1);const ue=s.bA([]),le=s.ef(j.position.lat,l.transform.zoom),xe=s.bq([],[1,1,1/le]);s.br(ue,ue,k),z.push({zScaleMatrix:xe,negCameraPosMatrix:ue});for(const ve of j.nodes)va(l,ve,j.matrix,l.transform.expandedFarZProjMatrix,H,F,U,j.materialOverrides,ie);H++}if(F.sort(((j,te)=>te.depth-j.depth)),l.renderPass!=="shadow")Zf(l,n,F,U,z),M();else{for(const j of U)xo(j.mesh,j.nodeModelMatrix,l,n);for(const j of F)xo(j.mesh,j.nodeModelMatrix,l,n);M()}}},yu={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 p=t.getTile(d).getBucket(l);if(p&&(p.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,t,n){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(n.modelManager&&n.modelManager.upload(n,Zl(n,l)));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const p of d)p.upload(n.context)},raster:function(l,t,n){const c=t.getSource();if(!(c instanceof dn&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map((g=>t.getTileByID(g)));for(const g of m)g.updateNeeded(l.id,p)&&c.prepareTile(g,d,l.id,p)},"raster-particle":function(l,t,n){const c=t.getSource();if(!(c instanceof dn&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map((g=>t.getTileByID(g)));for(const g of m)g.updateNeeded(l.id,p)&&c.prepareTile(g,d,l.id,p)}},Gn={fill:nu},xu={fill:function(l,t,n,c){if(!n.layout||n.layout.get("fill-elevation-reference")==="none"||n.paint.get("fill-opacity").constantOr(1)===0)return;const d=l.context.gl,p=new ht(d.LEQUAL,ht.ReadOnly,l.depthRangeFor3D),m=new St({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),g=l.transform.getFreeCameraOptions().position,x=l.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const w of c){const S=t.getTile(w),M=S.getBucket(n);if(!M)continue;const A=M.elevatedStructures;if(!A||A.depthSegments.segments[0].primitiveLength===0)continue;const C=Ff(w.toUnwrapped(),g),z=l.translatePosMatrix(w.projMatrix,S,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor")),R=fa(z,C,0,1,0);x.draw(l,d.TRIANGLES,p,m,Dt.disabled,Tt.disabled,R,n.id,A.vertexBuffer,A.indexBuffer,A.depthSegments,n.paint,l.transform.zoom)}}};class vu{constructor(t,n,c,d,p){this.context=new Xa(t,n),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=s.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const m=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const x of m)this._debugParams.enabledLayers[x]=!0;for(const x of m);this.occlusionParams=new Ka,this.setup(),this.numSublayers=Ln.maxUnderzooming+Ln.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new ka(this),this._wireframeDebugCache=new Bs,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const g=new s.q({width:1,height:1},Uint8Array.of(0,0,0,0));
2972this.emptyDepthTexture=new s.T(this.context,g,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.worldview=p,this._forceEmissiveMode=!1,this.emissiveMode="constant"}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 Dh(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 p=c+.78*(d-c);this.transform.fogCullDistSq=p*p}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new Dh(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*s.o.devicePixelRatio,this.height=n*s.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,n=new s.bd;n.emplaceBack(0,0),n.emplaceBack(s.al,0),n.emplaceBack(0,s.al),n.emplaceBack(s.al,s.al),this.tileExtentBuffer=t.createVertexBuffer(n,s.bf.members),this.tileExtentSegments=s.bg.simpleSegment(0,0,4,2);const c=new s.bd;c.emplaceBack(0,0),c.emplaceBack(s.al,0),c.emplaceBack(0,s.al),c.emplaceBack(s.al,s.al),this.debugBuffer=t.createVertexBuffer(c,s.bf.members),this.debugSegments=s.bg.simpleSegment(0,0,4,5);const d=new s.bd;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,s.bf.members),this.viewportSegments=s.bg.simpleSegment(0,0,4,2);const p=new s.b1;p.emplaceBack(0,0,0,0),p.emplaceBack(s.al,0,s.al,0),p.emplaceBack(0,s.al,0,s.al),p.emplaceBack(s.al,s.al,s.al,s.al),this.mercatorBoundsBuffer=t.createVertexBuffer(p,s.bi.members),this.mercatorBoundsSegments=s.bg.simpleSegment(0,0,4,2);const m=new s.b0;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const g=new s.be;for(const w of[0,1,3,2,0])g.emplaceBack(w);this.debugIndexBuffer=t.createIndexBuffer(g),this.emptyTexture=new s.T(t,new s.q({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=s.bC();const x=this.context.gl;this.stencilClearMode=new St({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,ht.disabled,this.stencilClearMode,Dt.disabled,Tt.disabled,Nl(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 g=!1;for(const x of c)if(this._tileClippingMaskIDs[x.key]===void 0){g=!0;break}if(!g)return}this.currentStencilSource=n.id;const d=this.context,p=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(Dt.disabled),d.setDepthMode(ht.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of c){const x=n.getTile(g),w=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:M,tileBoundsSegments:A}=this.getTileBoundsBuffers(x);m.draw(this,p.TRIANGLES,ht.disabled,new St({func:p.ALWAYS,mask:0},w,255,p.KEEP,p.KEEP,p.REPLACE),Dt.disabled,Tt.disabled,Nl(g.projMatrix),"$clipping",S,M,A)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new St({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 St({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,g)=>
2972g.overscaledZ-m.overscaledZ)),d=c[c.length-1].overscaledZ,p=c[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let g=0;g<p;g++)m[g+d]=new St({func:n.GEQUAL,mask:255},g+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,c]}return[{[d]:St.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Dt([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new s.ao(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Dt.unblended:Dt.alphaBlended}colorModeForDrapableLayerRenderPass(t){const n=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?t!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new Dt([n.ONE,n.ONE_MINUS_SRC_ALPHA,n.CONSTANT_ALPHA,n.ONE_MINUS_SRC_ALPHA],new s.ao(0,0,0,t??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new Dt([n.ONE,n.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,n.ONE_MINUS_SRC_ALPHA],s.ao.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(t,n,c,d=!1){if(this.depthOcclusion)return new ht(this.context.gl.GREATER,ht.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return ht.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ht(c||this.context.gl.LEQUAL,n,[p,p])}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(),p=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 Of(this.context,n,c,0,"texture"),this.depthTexture=new s.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,p),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=s.o.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=n;const d=this.style._mergedLayers,p=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(p).filter((me=>{const se=d[me];return!(se.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[se.type]}));let g=m(),x=!1,w=!1,S=null,M=0,A=!1;for(const me of g){const se=d[me];se.visibility!=="none"&&(se.type==="circle"?x=!0:se.type==="building"?(S=se,++M):se.type==="symbol"&&(se.hasOcclusionOpacityProperties?w=!0:x=!0))}this.updateEmissiveMode();let C=g.map((me=>d[me]));const z=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(s.o.now()),this.imageManager.beginFrame();for(const me in z){const se=z[me];se.used&&(se.prepare(this.context),se.getSource().usedInConflation&&++M)}let R=!1;for(const me of C)me.isHidden(this.transform.zoom)||(me.type==="clip"&&(R=!0),this.prepareLayer(me));const k={},F={},U={},H={},j={};for(const me in z){const se=z[me];k[me]=se.getVisibleCoordinates(),F[me]=k[me].slice().reverse(),U[me]=se.getVisibleCoordinates(!0).reverse(),H[me]=se.getShadowCasterCoordinates(),j[me]=se.sortCoordinatesByDistance(k[me])}const te=me=>{const se=this.style.getLayerSourceCache(me);return se&&se.used?se.getSource():null};if(M||R||this._clippingActiveLastFrame){const me=[],se=[];let Te=0;for(const _e of C)this.isSourceForClippingOrConflation(_e,te(_e))&&(me.push(_e),se.push(Te)),Te++;if(me&&(R||me.length>1)||this._clippingActiveLastFrame){R=!1;const _e=[];for(let Re=0;Re<me.length;Re++){const We=me[Re],et=se[Re],qe=this.style.getLayerSourceCache(We);if(!qe||!qe.used||!qe.getSource().usedInConflation&&We.type!=="clip"&&We.type!=="building")continue;let Ue=s.eQ,ct=s.b_.None;const st=[];let Je=!0;if(We.type==="building")Ue=s.eS;else if(We.type==="clip"){Ue=et;
2972for(const it of We.layout.get("clip-layer-types"))ct|=it==="model"?s.b_.Model:it==="symbol"?s.b_.Symbol:s.b_.FillExtrusion;for(const it of We.layout.get("clip-layer-scope"))st.push(it);We.isHidden(this.transform.zoom)?Je=!1:R=!0}Je&&_e.push({layer:We.fqid,cache:qe,order:Ue,clipMask:ct,clipScope:st})}this.replacementSource.setSources(_e),A=!0}}this._clippingActiveLastFrame=R,A||this.replacementSource.clear(),this.conflationActive=A,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let me=0;me<C.length;me++){const se=C[me];if(se.visibility==="none")continue;const Te=se.cutoffRange();if(this.longestCutoffRange=Math.max(Te,this.longestCutoffRange),Te>0){const _e=te(se);_e&&(this.minCutoffZoom=Math.max(_e.minzoom,this.minCutoffZoom)),se.minzoom&&(this.minCutoffZoom=Math.max(se.minzoom,this.minCutoffZoom))}se.is3D(p)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=me),this._lastOcclusionLayer=me)}const Y=this.style&&this.style.fog;Y?(this._fogVisible=Y.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=Y.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(U),this.opaquePassCutoff=0,g=m(),C=g.map((me=>d[me])));const Q=this._shadowRenderer;if(Q){Q.updateShadowParameters(this.transform,this.style.directionalLight);for(const me in z)for(const se of k[me]){let Te={min:0,max:0};this.terrain&&(Te=this.terrain.getMinMaxForTile(se)||Te),Q.addShadowReceiver(se.toUnwrapped(),Te.min,Te.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Hf(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const X=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),$=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(X&&!this._snow&&(this._snow=new Xh(this)),!X&&this._snow&&(this._snow.destroy(),delete this._snow),$&&!this._rain&&(this._rain=new gu(this)),!$&&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 du);const me=this.style.getLayerSourceCache(S);this.buildingTileBorderManager.updateBorders(me,S)}if(!Dn.has(this.context.gl))return;this.renderPass="offscreen";for(const me of C){const se=t.getLayerSourceCache(me);if(!me.hasOffscreenPass()||me.isHidden(this.transform.zoom))continue;const Te=se?F[se.id]:void 0;(me.type==="custom"||me.type==="raster"||me.type==="raster-particle"||me.isSky()||Te&&Te.length)&&this.renderLayer(this,se,me,Te)}this.depthRangeFor3D=[0,1-(C.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,H)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const ie=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),ue=(()=>{if(n.showOverdrawInspector)return s.ao.black;const me=this.style.fog;if(me&&this.transform.projection.supportsFog){const se=this.style.getLut(me.scope);if(!ie){const Te=me.properties.get("color-use-theme")==="none",_e=me.properties.get("color").toNonPremultipliedRenderColor(Te?null:se).toArray01();return new s.ao(..._e)}if(ie){const Te=me.properties.get("space-color-use-theme")==="none",_e=me.properties.get("space-color").toNonPremultipliedRenderColor(Te?null:se).toArray01();return new s.ao(..._e)}}return s.ao.transparent})();if(this.context.clear({color:ue,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ie&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=g.length-1;this.currentLayer>=0;this.currentLayer--){const me=C[this.currentLayer],se=t.getLayerSourceCache(me);if(me.isSky())continue;const Te=se?(me.is3D(p)?j:F)[se.id]:void 0;this._renderTileClippingMasks(me,se,Te),this.renderLayer(this,se,me,Te)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ie&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isH
2972orizonVisible()))for(this.currentLayer=0;this.currentLayer<g.length;this.currentLayer++){const me=C[this.currentLayer],se=t.getLayerSourceCache(me);me.isSky()&&this.renderLayer(this,se,me,se?F[se.id]:void 0)}function le(me,se){let Te;return se&&(Te=(me.type==="symbol"?U:me.is3D(p)?j:F)[se.id]),Te}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<g.length;){const me=C[this.currentLayer];if(me.type==="raster"||me.type==="raster-particle"){const se=t.getLayerSourceCache(me);this.renderLayer(this,se,me,le(me,se))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let xe=0;Q&&(xe=Q.getShadowCastingLayerCount());let ve=!1,Ae=-1;for(let me=0;me<g.length;++me){const se=C[me];se.isHidden(this.transform.zoom)||se.is3D(p)&&(Ae=me)}w&&Ae===-1&&(x=!0);let Ve=!1;for(;this.currentLayer<g.length;){const me=C[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(!Ve&&me.is3D(p)&&!p){const Te=this.currentLayer,_e=Re=>{for(this.currentLayer=0;this.currentLayer<C.length;this.currentLayer++){const We=C[this.currentLayer];if(Gn[We.type]){const et=this.style.getLayerSourceCache(We);Gn[We.type](this,et,We,le(We,et),Re)}}};_e("initialize"),_e("reset"),this.currentLayer=Te,Ve=!0}if(x&&!ve&&this.terrain&&!this.transform.isOrthographic&&(ve=!0,this.blitDepth()),w&&Ae!==-1&&this.currentLayer===Ae+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(me,se,se?k[se.id]:void 0),this.renderLayer(this,se,me,le(me,se)),!this.terrain&&Q&&xe>0&&me.hasShadowPass()&&--xe==0){{this.clearStencil(),this.resetStencilClippingMasks();const Te=this.currentLayer;for(this.currentLayer=0;this.currentLayer<C.length;this.currentLayer++){const _e=C[this.currentLayer];if(xu[_e.type]){const Re=this.style.getLayerSourceCache(_e);xu[_e.type](this,Re,_e,le(_e,Re))}}this.currentLayer=Te}if(Q.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const Te=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Te;this.currentLayer++){const _e=C[this.currentLayer];if(!_e.hasLightBeamPass())continue;const Re=t.getLayerSourceCache(_e);this.renderLayer(this,Re,_e,Re?F[Re.id]:void 0)}this.currentLayer=Te,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Te=this.currentLayer;this.depthOcclusion=!0;for(const _e of this.layersWithOcclusionOpacity){this.currentLayer=_e;const Re=C[this.currentLayer],We=t.getLayerSourceCache(Re),et=We?F[We.id]:void 0;this.terrain||this._renderTileClippingMasks(Re,We,We?k[We.id]:void 0),this.renderLayer(this,We,Re,et)}this.depthOcclusion=!1,this.currentLayer=Te,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;C.forEach((se=>{const Te=t.getLayerSourceCache(se);Te&&!se.isHidden(this.transform.zoom)&&Te.getVisibleCoordinates().length&&(!me||me.getSource().maxzoom<Te.getSource().maxzoom)&&(me=Te)})),me&&this.options.showTileBoundaries&&He(this,me,me.getVisibleCoordinates(),s.ao.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&He(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.ao(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&(function(me){const se=me.transform.padding;ya(me,me.transform.height-(se.top||0),3,Nf),ya(me,se.bottom||0,3,Vf),sr(me,se.left||0,3,Uf),sr(me,me.transform.width-(se.right||0),3,_a);const Te=me.transform.centerPoint;(function(_e,Re,We,et){fe(_e,Re-1,We-10,2,20,et),fe(_e,Re-10,We-1,20,2,et)})(me,Te.x,me.transform.height-Te.y,ga)})(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
2972anvasCopy()),A||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:n}=this.transform.projection,c=!n||!n.includes(t.type);if(yu[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);yu[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"||Ns[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],p=this.context.extTimerQuery,m=p.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;
2972p.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,p){if(!c[0]&&!c[1])return t;const m=p?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(m){const w=Math.sin(m),S=Math.cos(m);c=[c[0]*S-c[1]*w,c[0]*w+c[1]*S]}const g=[p?c[0]:s.ay(n,c[0],this.transform.zoom),p?c[1]:s.ay(n,c[1],this.transform.zoom),0],x=new Float32Array(16);return s.br(x,t,g),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,p=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(p.push("LIGHTING_3D_MODE"),p.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||p.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||p.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(p.push("TERRAIN"),this.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&p.push("GLOBE"),!this._fogVisible||d||n!==void 0&&!n||p.push("FOG","FOG_DITHERING"),d&&p.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&p.push("OVERDRAW_INSPECTOR"),p}getOrCreateProgram(t,n){this.cache=this.cache||{};const c=n&&n.defines||[],d=n&&n.config,p=this.currentGlobalDefines(t,n&&n.overrideFog,n&&n.overrideRtt).concat(c),m=Tf.cacheKey(vh[t],t,p,d);return this.cache[m]||(this.cache[m]=new Tf(this.context,t,vh[t],d,ru[t],p)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,n){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const p=((m,g,x)=>{const w=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(),A=m.properties.get("intensity"),C=g.properties.get("color-use-theme")==="none",z=g.properties.get("color").toNonPremultipliedRenderColor(C?null:x.getLut(g.scope)).toArray01(),R=g.properties.get("intensity"),k=[w.x,w.y,w.z],F=s.dN(z,R),U=s.dN(M,A);return{u_lighting_ambient_color:F,u_lighting_directional_dir:k,u_lighting_directional_color:U,u_ground_radiance:$a(k,U,F)}})(c,d,this.style);n.setLightsUniformValues(t,p)}}}uploadCommonUniforms(t,n,c,d,p){if(this.uploadCommonLightUniforms(t,n),this.terrain&&this.terrain.renderingToTexture)return;const m=this.style.fog;if(m){const g=m.getOpacity(this.transform.pitch),x=((w,S,M,A,C,z,R,k,F,U,H,j)=>{const te=w.transform,Y=S.properties.get("color-use-theme")==="none",Q=S.properties.get("color").toNonPremultipliedRenderColor(Y?null:w.style.getLut(S.scope)).toArray01();Q[3]=A;const X=w.frameCounter/1e3%1,[$,ie]=S.properties.get("vertical-range");return{u_fog_matrix:M?te.calculateFogTileMatrix(M):j||w.identityMat,u_fog_range:S.getFovAdjustedRange(te._fov),u_fog_color:Q,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min($,ie),ie],u_fog_temporal_offset:X,u_frustum_tl:C,u_frustum_tr:z,u_frustum_br:R,u_frustum_bl:k,u_globe_pos:F,u_globe_radius:U,u_viewport:H,u_globe_transition:s.aj(te.zoom),u_is_globe:+(te.projection.name==="globe")}})(this,m,c,g,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*s.o.devicePixelRatio,this.transform.height*s.o.devicePixelRatio],d);n.setFogUniformValues(t,x)}p&&n.setCutoffUniformValues(t,p.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,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}
2972getBackgroundTiles(){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 sa(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]>=Me||n[1]>=Me}setupDepthForOcclusion(t,n,c){const d=this.context,p=d.gl,m=!!c;var g;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(p.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((g=this.depthRangeFor3D)[1]-g[0]),-1-2*g[0]/(g[1]-g[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE0),m||n.setTerrainUniformValues(d,c)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const t=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=t?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function bu(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 Yh{constructor(t){this._hashName=t&&encodeURIComponent(t),s.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=bu(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=Ar(t);if(this._hashName){const c=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map((m=>{const g=m.split("=")[0];return g===c?(d=!0,`${g}=${n}`):m})).filter((m=>m));return d||p.push(`${c}=${n}`),`#${p.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 Ar(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),p=Math.pow(10,d),m=Math.round(n.lng*p)/p,g=Math.round(n.lat*p)/p,x=l.getBearing(),w=l.getPitch();let S=t?`/${m}/${g}/${c}`:`${c}/${g}/${m}`;return(x||w)&&(S+="/"+Math.round(10*x)/10),w&&(S+=`/${Math.round(w)}`),S}const Qa={linearity:.3,easing:s.eT(0,0,.3,1)},Kh=Object.assign({deceleration:2500,maxSpeed:1400},Qa),Jh=Object.assign({deceleration:20,maxSpeed:1400},Qa),wa=Object.assign({deceleration:1e3,maxSpeed:360},Qa),Qh=Object.assign({deceleration:1e3,maxSpeed:90},Qa);class ed{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.o.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=s.o.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 s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){const p=Bo(n.pan.mag(),c,Object.assign({},Kh,t||{}));d.offset=n.pan.mult(p.amount/n.pan.mag()),d.center=this._map.transform.center,el(d,p)}if(n.zoom){const p=Bo(n.zoom,c,Jh);d.zoom=this._map.transform.zoom+p.amount,el(d,p)}if(n.bearing){const p=Bo(n.bearing,c,wa);
2972d.bearing=this._map.transform.bearing+s.aA(p.amount,-179,179),el(d,p)}if(n.pitch){const p=Bo(n.pitch,c,Qh);d.pitch=this._map.transform.pitch+p.amount,el(d,p)}if(d.zoom||d.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;d.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function el(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function Bo(l,t,n){const{maxSpeed:c,linearity:d,deceleration:p}=n,m=s.aA(l*d/(t/1e3),-c,c),g=Math.abs(m)/(p*d);return{easing:n.easing,duration:1e3*g,amount:m*(g/2)}}class Mn extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c,d={}){const p=So(n.getCanvasContainer(),c),m=n.unproject(p);super(t,Object.assign({point:p,lngLat:m,originalEvent:c},d)),this._defaultPrevented=!1,this.target=n}}class Vs extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c){const d=t==="touchend"?c.changedTouches:c.touches,p=ki(n.getCanvasContainer(),d),m=p.map((x=>n.unproject(x))),g=p.reduce(((x,w,S,M)=>x.add(w.div(M.length))),new s.P(0,0));super(t,{points:p,point:g,lngLats:m,lngLat:n.unproject(g),originalEvent:c}),this._defaultPrevented=!1}}class td extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n){super("wheel",{originalEvent:n}),this._defaultPrevented=!1}}class wu{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new td(this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Mn(t.type,this._map,t))}mouseup(t){this._map.fire(new Mn(t.type,this._map,t))}preclick(t){const n=new MouseEvent("preclick",t);this._map.fire(new Mn(n.type,this._map,n))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Mn(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Mn(t.type,this._map,t))}mouseover(t){this._map.fire(new Mn(t.type,this._map,t))}mouseout(t){this._map.fire(new Mn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Vs(t.type,this._map,t))}touchmove(t){this._map.fire(new Vs(t.type,this._map,t))}touchend(t){this._map.fire(new Vs(t.type,this._map,t))}touchcancel(t){this._map.fire(new Vs(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class id{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Mn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Mn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Mn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Tu{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&&(Hr(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const c=n,d=this._startPos,p=this._lastPos;if(!d||!p||p.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=mi("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const m=Math.min(d.x,c.x),g=Math.max(d.x,c.x),x=Math.min(d.y,c.y),w=Math.max(d.y,c.y);this._map._requestDomTask((()=>{this._box&&(this._box.style.transform=`translate(${m}px,${x}px)`,this._box.style.width=g-m+"px",this._box.style.height=w-x+"px")}))}mouseupWindow(t,n){if(!this._active)return;const c=this._startPos,d=n;if(c&&t.button===0){if(this.reset(),kn(),c.x!==d.x||c.y!==d.y)return this._map.fire(new s.z("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),Wn(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new s.z(t,{originalEvent:n}))}}function Su(l,t){const n={};for(let c=0;c<l.length;c++)n[l[c].identifier]=t[c];return n}class Kf{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 p=new s.P(0,0);for(const m of d)p._add(m);return p.div(d.length)})(n),this.touches=Su(c,n)))}touchmove(t,n,c){if(this.aborted||!this.centroid)return;const d=Su(c,n);for(const p in this.touches){const m=d[p];(!m||m.dist(this.touches[p])>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 Eu{constructor(t){this.singleTap=new Kf(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 p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(d)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Jf{constructor(){this._zoomIn=new Eu({numTouches:1,numTaps:2}),this._zoomOut=new Eu({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),p=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})}):p?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Qf={0:1,2:2},rd={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Iu{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=Sr(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,p){const m=Qf[p];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&&Sr(t)===this._eventButton&&(this._moved&&kn(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ep extends Iu{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 nd extends Iu{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?rd[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 od extends Iu{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?rd[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 tp{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),s.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new s.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&&!s.eU())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,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=Su(c,n),p=new s.P(0,0),m=new s.P(0,0);let g=0;for(const w in d){const S=d[w],M=this._touches[w];M&&(p._add(S),m._add(S.sub(M)),g++,d[w]=S)}if(this._touches=d,g<this._minTouches||!m.mag())return;const x=m.div(g);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(g),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=mi("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 Au{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[p,m]=d,g=Xl(c,n,p),x=Xl(c,n,m);if(!g||!x)return;const w=this._aroundCenter?null:g.add(x).div(2);return this._move([g,x],w,t)}touchend(t,n,c){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,m=Xl(c,n,d),g=Xl(c,n,p);m&&g||(this._active&&kn(),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 Xl(l,t,n){for(let c=0;c<l.length;c++)if(l[c].identifier===n)return t[c]}function ip(l,t){return Math.log2(l/t)}class Im extends Au{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;
2972if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ip(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ip(this._distance,c),pinchAround:n}}}function rp(l,t){return 180*l.angleWith(t)/Math.PI}class Wi extends Au{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:rp(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=rp(t,c);return Math.abs(d)<n}}function Mu(l){return Math.abs(l.y)>Math.abs(l.x)}class Am extends Au{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,Mu(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,c){const d=this._lastPoints;if(!d)return;const p=t[0].sub(d[0]),m=t[1].sub(d[1]);return this._map._cooperativeGestures&&!s.eU()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(p,m,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5})}gestureBeginsVertically(t,n,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,p=n.mag()>=2;if(!d&&!p)return;if(!d||!p)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Mu(t)&&Mu(n)&&m}}const Mm={panStep:100,bearingStep:15,pitchStep:10};class Cm{constructor(){const t=Mm;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,p=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(),p=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:g=>{const x=g.getZoom();g.easeTo({duration:300,easeId:"keyboardHandler",easing:Yl,zoom:n?Math.round(x)+n*(t.shiftKey?2:1):x,bearing:g.getBearing()+c*this._bearingStep,pitch:g.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:g.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 Yl(l){return l*(2-l)}const sd=4.000244140625,ad=1/450;class Cu{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=ad,s.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||s.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=s.o.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,n!==0&&n%sd==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=So(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._triggerRe
2972nderFrame())}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 w=this._type==="wheel"&&Math.abs(this._delta)>sd?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*w)));this._delta<0&&S!==0&&(S=1/S);const M=n(),A=Math.pow(2,M),C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):A;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,p=this._easing;let m,g=!1;if(this._type==="wheel"&&d&&p){const w=Math.min((s.o.now()-this._lastWheelEventTime)/200,1),S=p(w);m=s.ak(d,c,S),w<1?this._frameId||(this._frameId=!0):g=!0}else m=c,g=!0;this._active=!0,g&&(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:!g,zoomDelta:x,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=s.eV;if(this._prevEase){const c=this._prevEase,d=(s.o.now()-c.start)/c.duration,p=c.easing(d+.01)-c.easing(d),m=.27/Math.sqrt(p*p+1e-4)*.01,g=Math.sqrt(.0729-m*m);n=s.eT(m,g,.25,1)}return this._prevEase={start:s.o.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=mi("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 ns{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 Pu{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 Mr{constructor(){this._tap=new Eu({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],p=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:p/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 No{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 Kl{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 Ru{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 Jl=l=>l.zoom||l.drag||l.pitch||l.rotate;class Pm extends s.z{}class Ql{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,n){const c=s.av([],n,t);
vendor: 4,200 bytes, line 2972
2972this.radius=s.ag(c[2]<0?s.eX([],c,this.constants):[c[0],c[1],0])}projectRay(t){s.eX(t,t,this.constants),s.aw(t,t),s.eY(t,t,this.constants);const n=s.c5([],t,this.radius);if(n[2]>0){const c=s.c5([],[0,0,1],s.bJ(n,[0,0,1])),d=s.c5([],s.aw([],[n[0],n[1],0]),this.radius),p=s.d8([],n,s.c5([],s.av([],s.d8([],d,c),n),2));n[0]=p[0],n[1]=p[1]}return n}}function zu(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class Rm{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ed(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Ql,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),s.aY(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,m]of this._listeners){const g=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,g,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 wu(n,t));const d=n.boxZoom=new Tu(n,t);this._add("boxZoom",d);const p=new Jf,m=new Pu;n.doubleClickZoom=new ns(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const g=new Mr;this._add("tapDragZoom",g);const x=n.touchPitch=new Am(n);this._add("touchPitch",x);const w=new nd(t),S=new od(t);n.dragRotate=new Kl(t,w,S),this._add("mouseRotate",w,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const M=new ep(t),A=new tp(n,t);n.dragPan=new No(c,M,A),this._add("mousePan",M),this._add("touchPan",A,["touchZoom","touchRotate"]);const C=new Wi,z=new Im;n.touchZoomRotate=new Ru(c,z,C,g),this._add("touchRotate",C,["touchPan","touchZoom"]),this._add("touchZoom",z,["touchPan","touchRotate"]),this._add("blockableMapEvent",new id(n));const R=n.scrollZoom=new Cu(n,this);this._add("scrollZoom",R,["mousePan"]);const k=n.keyboard=new Cm;this._add("keyboard",k);for(const F of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[F]&&n[F].enable(t[F])}_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!!Jl(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,p={needsRenderFrame:!1},m={},g={},x=t.touches?this._getMapTouches(t.touches):void 0,w=x?ki(this._el,x):c?void 0:So(this._el,t);for(const{handlerName:A,handler:C,allowed:z}of this._handlers){if(!C.isEnabled())continue;let R;this._blockedByActive(g,z,A)?C.reset():C[n||t.type]&&(R=C[n||t.type](t,w,x),this.mergeHandlerResult(p,m,R,A,d),R&&R.needsRenderFrame&&this._triggerRenderFrame()),(R||C.isActive())&&(g[A]=C)}const S={};for(const A in this._previousActiveHandlers)g[A]||(S[A]=d);this._previousActiveHandlers=g,(Object.keys(S).length||zu(p))&&(this._changes.push([p,m,S]),this._triggerRe
2972nderFrame()),(Object.keys(g).length||zu(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=p;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,c,d,p){if(!c)return;Object.assign(t,c);const m={handlerName:d,originalEvent:c.originalEvent||p};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,p,m]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new s.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),Object.assign(n,p),Object.assign(c,m);this._updateMapTransform(t,n,c),this._changes=[]}_updateMapTransform(t,n,c){const d=this._map,p=d.transform,m=U=>[U.x,U.y,U.z];if((U=>{const H=this._eventsInProgress.drag;return H&&!this._handlersById[H.handlerName].isActive()})()&&!zu(t)){const U=p.zoom;p.cameraElevationReference="sea",this._originalZoom!=null&&p._orthographicProjectionAtLowPitch&&p.projection.name!=="globe"&&p.pitch===0?(p.cameraElevationReference="ground",p.zoom=this._originalZoom):(p.recenterOnTerrain(),p.cameraElevationReference="ground"),U!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!zu(t))return void this._fireEvents(n,c,!0);let{panDelta:g,zoomDelta:x,bearingDelta:w,pitchDelta:S,around:M,aroundCoord:A,pinchAround:C}=t;p._isCameraConstrained&&(x>0&&(x=0),p._isCameraConstrained=!1),C!==void 0&&(M=C),(x||(U=>n[U]&&!this._eventsInProgress[U])("drag"))&&M&&(this._dragOrigin=m(p.pointCoordinate3D(M)),this._originalZoom=p.zoom,this._trackingEllipsoid.setup(p._camera.position,this._dragOrigin)),p.cameraElevationReference="sea",d._stop(!0),M=M||d.transform.centerPoint,w&&(p.bearing+=w),S&&(p.pitch+=S),p._updateCameraState();const z=[0,0,0];if(g)if(p.projection.name==="mercator"){const U=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M).dir),H=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M.sub(g)).dir);z[0]=H[0]-U[0],z[1]=H[1]-U[1]}else{const U=p.pointCoordinate(M);if(p.projection.name==="globe"){g=g.rotate(-p.angle);const H=p._pixelsPerMercatorPixel/p.worldSize;z[0]=-g.x*s.eW(s.a$(U.y))*H,z[1]=-g.y*s.eW(p.center.lat)*H}else{const H=p.pointCoordinate(M.sub(g));U&&H&&(z[0]=H.x-U.x,z[1]=H.y-U.y)}}const R=p.zoom,k=[0,0,0];if(x){const U=m(A||p.pointCoordinate3D(M)),H={dir:s.aw([],s.av([],U,p._camera.position))};if(H.dir[2]<0){const j=p.zoomDeltaToMovement(U,x);s.c5(k,H.dir,j)}}const F=s.d8(z,z,k);p._translateCameraConstrained(F),x&&Math.abs(p.zoom-R)>1e-4&&p.recenterOnTerrain(),p.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,c,!0)}_fireEvents(t,n,c){const d=Jl(this._eventsInProgress),p=Jl(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&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:M}=t[S];this._fireEvent(S,M)}const g={};let x;for(const S in this._eventsInProgress){const{handlerName:M,originalEvent:A}=this._eventsInProgress[S];this._handlersById[M].isActive()||(delete this._eventsInProgress[S],x=n[M]||A,g[`${S}end`]=x)}for(const S in g)this._fireEvent(S,g[S]);const w=Jl(this._eventsInProgress);if(c&&(d||p)&&!w){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=A=>A!==0&&-this._bearingSnap<A&&A<this._bearingSnap;S?(M(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:x})):(this._map.fire(new s.z("moveend",{originalEvent:x})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new s.z(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{this._frameId=void 0,this.handleEvent(new Pm("renderFrame",{timeStamp:t})),this._applyChanges()}))}
2972_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Du="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class ld extends s.E{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this._respectPrefersReducedMotion=n.respectPrefersReducedMotion!==!1,s.aY(["_renderFrameCallback"],this)}getCenter(){return new s.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,c){return t=s.P.convert(t).mult(-1),this.panTo(this.transform.center,Object.assign({offset:t},n),c)}panTo(t,n,c){return this.easeTo(Object.assign({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(Object.assign({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(Object.assign({bearing:t},n),c)}resetNorth(t,n){return this.rotateTo(0,Object.assign({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(Object.assign({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=s.aI.convert(t);const c=n&&n.bearing||0,d=n&&n.pitch||0,p=t.getNorthWest(),m=t.getSouthEast();return this._cameraForBounds(this.transform,p,m,c,d,n)}_extendPadding(t){const n={top:0,right:0,bottom:0,left:0};return t==null?Object.assign({},n,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:Object.assign({},n,t)}_extendCameraOptions(t){return(t=Object.assign({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,p,m){const g=t.clone(),x=this._extendCameraOptions(m);g.bearing=d,g.pitch=p;const w=s.aT.convert(n),S=s.aT.convert(c),M=.5*(w.lat+S.lat),A=.5*(w.lng+S.lng),C=s.eZ(M,A),z=s.aw([],C),R=s.aw([],s.bI([],z,[0,1,0])),k=s.bI([],R,z),F=[R[0],R[1],R[2],0,k[0],k[1],k[2],0,z[0],z[1],z[2],0,0,0,0,1],U=[C,s.eZ(w.lat,w.lng),s.eZ(S.lat,w.lng),s.eZ(S.lat,S.lng),s.eZ(w.lat,S.lng),s.eZ(M,w.lng),s.eZ(M,S.lng),s.eZ(w.lat,A),s.eZ(S.lat,A)];let H=s.d9.fromPoints(U.map((_e=>[s.bJ(R,_e),s.bJ(k,_e),s.bJ(z,_e)])));const j=s.af([],H.center,F);s.e_(j)===0&&s.e$(j,0,0,1),s.aw(j,j),s.c5(j,j,s.aD),g.center=s.f0(j);const te=g.getWorldToCameraMatrix(),Y=s.bl(new Float64Array(16),te);H=s.d9.applyTransform(H,s.aB([],te,F));const Q=this._extendAABB(H,g,x,d);if(!Q)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");H=Q,s.af(j,j,te);const X=.5*(H.max[2]-H.min[2]),$=this._minimumAABBFrustumDistance(g,H),ie=s.c5([],[0,0,1],X),ue=s.d8(ie,j,ie),le=$+(g.pitch===0?0:s.bG(j,ue)),xe=g.globeCenterInViewSpace,ve=s.av([],j,[xe[0],xe[1],xe[2]]);s.aw(ve,ve),s.c5(ve,ve,le);const Ae=s.d8([],j,ve);s.af(Ae,Ae,Y);const Ve=s.eM/s.aD,me=s.ag(Ae),se=s.cf(Math.max(me*Ve-s.eM,Number.EPSILON),0),Te=Math.min(g.zoomFromMercatorZAdjusted(se),x.maxZoom);return Te>.5*(s.c_+s.cL)?(g.setProjection({name:"mercator"}),g.zoom=Te,this._cameraForBounds(g,n,c,d,p,m)):{center:g.center,zoom:Te,bearing:d,pitch:p}}_extendAABB(t,n,c,d){const p=.5*((c.padding.left||0)+(c.padding.right||0)),m=.5*((c.padding.top||0)+(c.padding.bottom||0)),g=m,x=p,w=p,S=m,M=n.width-(x+w),A=n.height-(g+S),C=s.av([],t.max,t.min),z=Math.min(M/C[0],A/C[1]),R=Math.min(n.scaleZoom(n.scale*z),c.maxZoom);if(isNaN(R))return null;const k=n.scale/n.zoomScale(R),F=new s.d9([t.min[0]-x*k,t.min[1]-S*k,t.min[2]],[t.max[0]+w*k,t.max[1]+g*k,t.max[2]]),U=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new s.P(c.offset.x,c.offset.y):s.P.convert(c.offset)).rotate(-s.an(d));return F.center[0]-=U.x*k,F.center[1]+=U.y*k,F}queryTerrainElevation(t,n){const c=this.transform.elevation;return c?(n=Object.assign({},{exaggerated:!0}
2972,n),c.getAtPoint(s.ae.fromLngLat(t),null,n.exaggerated)):null}_cameraForBounds(t,n,c,d,p,m){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,n,c,d,p,m);const g=t.clone(),x=this._extendCameraOptions(m);g.bearing=d,g.pitch=p;const w=s.aT.convert(n),S=s.aT.convert(c),M=new s.aT(w.lng,S.lat),A=new s.aT(S.lng,w.lat),C=g.project(w),z=g.project(S),R=this.queryTerrainElevation(w),k=this.queryTerrainElevation(S),F=this.queryTerrainElevation(M),U=this.queryTerrainElevation(A),H=[[C.x,C.y,Math.min(R||0,k||0,F||0,U||0)],[z.x,z.y,Math.max(R||0,k||0,F||0,U||0)]];let j=s.d9.fromPoints(H);const te=g.getWorldToCameraMatrix(),Y=s.bl(new Float64Array(16),te);j=s.d9.applyTransform(j,te);const Q=this._extendAABB(j,g,x,d);if(!Q)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");j=Q;const X=.5*s.av([],j.max,j.min)[2],$=this._minimumAABBFrustumDistance(g,j),ie=[0,0,1,0];s.aC(ie,ie,te),s.f1(ie,ie);const ue=s.c5([],ie,$+X),le=s.d8([],j.center,ue);s.af(j.center,j.center,Y),s.af(le,le,Y);const xe=g.unproject(new s.P(j.center[0],j.center[1])),ve=s.f2(g.projection,xe),Ae=Math.pow(2,ve),Ve=Math.min(g._zoomFromMercatorZ(le[2]*g.pixelsPerMeter*Ae/g.worldSize),x.maxZoom);return g.mercatorFromTransition&&Ve<.5*(s.c_+s.cL)?(g.setProjection({name:"globe"}),g.zoom=Ve,this._cameraForBounds(g,n,c,d,p,m)):{center:xe,zoom:Ve,bearing:d,pitch:p}}fitBounds(t,n,c){const d=this.cameraForBounds(t,n);return this._fitInternal(d,n,c)}fitScreenCoordinates(t,n,c,d,p){const m=s.P.convert(t),g=s.P.convert(n),x=new s.P(Math.min(m.x,g.x),Math.min(m.y,g.y)),w=new s.P(Math.max(m.x,g.x),Math.max(m.y,g.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(m,g))return this;const S=this.transform.pointLocation3D(x),M=this.transform.pointLocation3D(w),A=this.transform.pointLocation3D(new s.P(x.x,w.y)),C=this.transform.pointLocation3D(new s.P(w.x,x.y)),z=[Math.min(S.lng,M.lng,A.lng,C.lng),Math.min(S.lat,M.lat,A.lat,C.lat)],R=[Math.max(S.lng,M.lng,A.lng,C.lng),Math.max(S.lat,M.lat,A.lat,C.lat)],k=d&&d.pitch?d.pitch:this.getPitch(),F=this._cameraForBounds(this.transform,z,R,c,k,d);return this._fitInternal(F,d,p)}_fitInternal(t,n,c){return t?(n=Object.assign(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,p=!1,m=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=s.aT.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(p=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(m=!0,c.pitch=+t.pitch);const g=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(g))if(t.retainPadding===!1){const x=c.clone();x.padding=g,c.setLocationAtPoint(c.center,x.centerPoint)}else c.padding=g;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new s.z("movestart",n)).fire(new s.z("move",n)),d&&this.fire(new s.z("zoomstart",n)).fire(new s.z("zoom",n)).fire(new s.z("zoomend",n)),p&&this.fire(new s.z("rotatestart",n)).fire(new s.z("rotate",n)).fire(new s.z("rotateend",n)),m&&this.fire(new s.z("pitchstart",n)).fire(new s.z("pitch",n)).fire(new s.z("pitchend",n)),this.fire(new s.z("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(Du),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,n){const c=this.transform;if(!c.projection.supportsFreeCamera)return s.w(Du),this;this.stop();const d=c.zoom,p=c.pitch,m=c.bearing;c.setFreeCameraOptions(t);const g=d!==c.zoom,x=p!==c.pitch,w=m!==c.bearing;return this.fire(new s.z("movestart",n)).fire(new s.z("move",n)),g&&this.fire(new s.z("zoomstart",n)).fire(new s.z("zoom",n)).fire(new s.z("zoomend",n)),w&&this.fire(new s.z("rotatestart",n)).fire(new s.z("rotate",n)).fire(new s.z("rotateend",n)),x&&this.fire(new s.z("pitchstart",n)).fire(new s.z("pitch",n)).fire(new s.z("pitchend",n)),this.fire(new s.z("moveend",n)),this}easeTo(t,n){this._stop(!1,t.easeId),((t=Object.assign({offset:[0,0],duration:500,easing:s.eV},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),g=this.getPadding(),x="zoom"in t?+t.zoom:d,w="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),A=s.P.convert(t.offset);let C,z,R;
2972if(c.projection.name==="globe"){const ie=s.ae.fromLngLat(c.center),ue=A.rotate(-c.angle);ie.x+=ue.x/c.worldSize,ie.y+=ue.y/c.worldSize;const le=ie.toLngLat(),xe=s.aT.convert(t.center||le);this._normalizeCenter(xe),C=c.centerPoint.add(ue),z=new s.P(ie.x,ie.y).mult(c.worldSize),R=new s.P(s.aF(xe.lng),s.aJ(xe.lat)).mult(c.worldSize).sub(z)}else{C=c.centerPoint.add(A);const ie=c.pointLocation(C),ue=s.aT.convert(t.center||ie);this._normalizeCenter(ue),z=c.project(ie),R=c.project(ue).sub(z)}const k=c.zoomScale(x-d);let F,U;t.around&&(F=s.aT.convert(t.around),U=c.locationPoint(F));const H=this._zooming||x!==d,j=this._rotating||p!==w,te=this._pitching||S!==m,Y=!c.isPaddingEqual(M),Q=t.retainPadding===!1?c.clone():c,X=ie=>ue=>{if(H&&(ie.zoom=s.ak(d,x,ue)),j&&(ie.bearing=s.ak(p,w,ue)),te&&(ie.pitch=s.ak(m,S,ue)),Y&&(Q.interpolatePadding(g,M,ue),C=Q.centerPoint.add(A)),F)ie.setLocationAtPoint(F,U);else{const le=ie.zoomScale(ie.zoom-d),xe=x>d?Math.min(2,k):Math.max(.5,k),ve=Math.pow(xe,1-ue),Ae=ie.unproject(z.add(R.mult(ue*ve)).mult(le));ie.setLocationAtPoint(ie.renderWorldCopies?Ae.wrap():Ae,C)}return t.preloadOnly||this._fireMoveEvents(n),ie};if(t.preloadOnly){const ie=this._emulate(X,t.duration,c);return this._preloadTiles(ie),this}const $={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=H,this._rotating=j,this._pitching=te,this._padding=Y,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,$),this._ease(X(c),(ie=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(n,ie)}),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 s.z("movestart",t)),this._zooming&&!c.zooming&&this.fire(new s.z("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new s.z("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new s.z("pitchstart",t))}_fireMoveEvents(t){this.fire(new s.z("move",t)),this._zooming&&this.fire(new s.z("zoom",t)),this._rotating&&this.fire(new s.z("rotate",t)),this._pitching&&this.fire(new s.z("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new s.z("zoomend",t)),d&&this.fire(new s.z("rotateend",t)),p&&this.fire(new s.z("pitchend",t)),this.fire(new s.z("moveend",t))}flyTo(t,n){if(this._prefersReducedMotion(t)){const _e=s.aH(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(_e,n)}this.stop(),t=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:s.eV},t);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),g=this.getPadding(),x="zoom"in t?s.aA(+t.zoom,c.minZ
2972oom,c.maxZoom):d,w="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),A=c.zoomScale(x-d),C=s.P.convert(t.offset);let z=c.centerPoint.add(C);const R=c.pointLocation(z),k=s.aT.convert(t.center||R);this._normalizeCenter(k);const F=c.project(R),U=c.project(k).sub(F);let H=t.curve;const j=Math.max(c.width,c.height),te=j/A,Y=U.mag();if("minZoom"in t){const _e=s.aA(Math.min(t.minZoom,d,x),c.minZoom,c.maxZoom),Re=j/c.zoomScale(_e-d);H=Math.sqrt(Re/Y*2)}const Q=H*H;function X(_e){const Re=(te*te-j*j+(_e?-1:1)*Q*Q*Y*Y)/(2*(_e?te:j)*Q*Y);return Math.log(Math.sqrt(Re*Re+1)-Re)}function $(_e){return(Math.exp(_e)-Math.exp(-_e))/2}function ie(_e){return(Math.exp(_e)+Math.exp(-_e))/2}const ue=X(0);let le=function(_e){return ie(ue)/ie(ue+H*_e)},xe=function(_e){return j*((ie(ue)*($(Re=ue+H*_e)/ie(Re))-$(ue))/Q)/Y;var Re},ve=(X(1)-ue)/H;if(Math.abs(Y)<1e-6||!isFinite(ve)){if(Math.abs(j-te)<1e-6)return this.easeTo(t,n);const _e=te<j?-1:1;ve=Math.abs(Math.log(te/j))/H,xe=function(){return 0},le=function(Re){return Math.exp(_e*H*Re)}}t.duration="duration"in t?+t.duration:1e3*ve/("screenSpeed"in t?+t.screenSpeed/H:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Ae=p!==w,Ve=S!==m,me=!c.isPaddingEqual(M),se=t.retainPadding===!1?c.clone():c,Te=_e=>Re=>{const We=Re*ve,et=1/le(We);_e.zoom=Re===1?x:d+_e.scaleZoom(et),Ae&&(_e.bearing=s.ak(p,w,Re)),Ve&&(_e.pitch=s.ak(m,S,Re)),me&&(se.interpolatePadding(g,M,Re),z=se.centerPoint.add(C));const qe=Re===1?k:_e.unproject(F.add(U.mult(xe(We))).mult(et));return _e.setLocationAtPoint(_e.renderWorldCopies?qe.wrap():qe,z),_e._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(n),_e};if(t.preloadOnly){const _e=this._emulate(Te,t.duration,c);return this._preloadTiles(_e),this}return this._zooming=!0,this._rotating=Ae,this._pitching=Ve,this._padding=me,this._prepareEase(n,!1),this._ease(Te(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=s.o.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((s.o.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=s.bT(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&&s.o.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,n,c){const d=Math.ceil(15*n/1e3),p=[],m=t(c.clone());for(let g=0;g<=d;g++){const x=m(g/d);p.push(x.clone())}return p}_preloadTiles(t,n){}}class ec{constructor(t={}){this.options=t,s.aY(["_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=mi("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=mi("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=mi("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=mi("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
2972se")):(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||s.e.ACCESS_TOKEN}];if(t){const c=n.reduce(((d,p,m)=>(p.value&&(d+=`${p.key}=${p.value}${m<n.length-1?"&":""}`),d)),"?");t.href=`${s.e.FEEDBACK_URL}/${c}#${Ar(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||(t.dataType!=="source"||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility")&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const n=this._map.style._mergedSourceCaches;for(const d in n){const p=n[d];if(p.used){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t.sort(((d,p)=>d.length-p.length)),t=t.filter(((d,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(d)>=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.map((d=>(function(p){const m=new DOMParser().parseFromString(p,"text/html");return Array.from(m.body.querySelectorAll("*")).forEach((g=>{const x=g.textContent||"";if(g.tagName!=="A")return void g.replaceWith(m.createTextNode(x));const w=g.getAttribute("href");if(!w||!/^(https?:|mailto:)/i.test(w))return void g.replaceWith(m.createTextNode(x));const S=m.createElement("a");S.href=w,S.textContent=x,S.rel="noopener nofollow";const M=g.getAttribute("class");M&&(S.className=M),g.replaceWith(S)})),m.body.innerHTML})(d))).join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class tc{constructor(){s.aY(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=mi("div","mapboxgl-ctrl");const n=mi("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 tl{constructor(){s.aY(["_onIndoorUpdate"],this)}onAdd(t){return this._map=t,this._container=mi("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",(n=>this._onIndoorUpdate(n))),this._container}_createButton(t,n){const c=mi("button",t,this._container);return c.type="button",c.addEventListener("click",n),c}_createSeparator(){return mi("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(t,n){this._map&&(t.setAttribute("aria-label",n),t.textContent=n)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(t){if(!t||!t.floors)return this._model=t,void(this._container.style.display="none");const n=this._model;this._model=t,this._container.style.display="inline-block",this._container.style.borderRadius="8px",n&&Array.from(this._container.children).forEac
2972h((c=>c.remove())),t.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(t.floors,t.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const t=this._createButton("mapboxgl-ctrl-buildings-toggle",(()=>{const n=this._map;this._model&&n&&n._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)}));mi("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&t.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(t),this._createSeparator()}_updateBuildingsButtonState(){const t=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");t&&this._model&&(this._model.activeFloorsVisible?t.classList.remove("mapboxgl-ctrl-level-button-selected"):t.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(t,n){for(let c=0;c<t.length;c++){const d=t[c],p=this._createButton("mapboxgl-ctrl-level-button",(()=>{this._map._selectIndoorFloor(d.id)}));this._setButtonTitle(p,d.zIndex.toString()),this._model&&d.id===this._model.selectedFloorId&&n&&p.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(p),c<t.length-1&&this._createSeparator()}}}class os{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 ss{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const n=s.dD((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 as={"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 Us extends s.z{constructor(t,n,c,d){const{point:p,lngLat:m,originalEvent:g,target:x}=t;super(t.type,{point:p,lngLat:m,originalEvent:g,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=n,this.interaction=c,this.feature=d}}class vo{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,s.b6(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const p=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,n)):p.size===0&&this.map.on(d,this.handleType),p.size===0&&this.interactionsByType.set(d,p),p.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,p]of n)p.target&&c.push({targetId:d,target:p.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const 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:p}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(p.id,p);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())
2972))}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 s.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),p=!!n;n=n||this.queryTargets(t.point,d);let m=!1;const g=new Set;for(const x of n){for(const[w,S]of d){if(!S.target)continue;const M=x.variants?x.variants[w]:null;if(M){for(const A of M){if(Da(A,x,g,w))continue;const C=new s.dx(x,A),z=na(A,x,w);p&&C.id!==void 0&&(C.state=this.map.getFeatureState(C));const R=c?this.prevHoveredFeatures.get(z):null,k=new Us(t,w,S,C),F=R?R.stop:S.handler(k);if(c&&this.hoveredFeatures.set(z,{feature:x,stop:F}),F!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,w]of d){const{handler:S,target:M}=w;if(!M&&S(new Us(t,x,w,null))!==!1)break}}}function zm(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 s.by(l,t)}const Dm={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"},Lm={showCompass:!0,showZoom:!0,visualizePitch:!1};class Om{constructor(t,n,c=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new nd({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new od({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),s.aY(["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),Hr()}move(t,n){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,n),p=d&&d.bearingDelta;if(p&&c.setBearing(c.getBearing()+p),this.mousePitch){const m=this.mousePitch.mousemoveWindow(t,n),g=m&&m.pitchDelta;g&&c.setPitch(c.getPitch()+g)}}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(){Wn(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(Object.assign({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),So(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,So(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=ki(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=ki(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 cd(l,t,n){if(l=new s.aT(l.lng,l.lat),t){const c=new s.aT(l.lng-360,l.lat),d=new s.aT(l.lng+360,l.lat),p=360*Math.ceil(Math.abs(l.lng-n.center.lng)/360),m=n.locationPoint3D(l).distSqr(t),g=t.x<0||t.y<0||t.x>n.width||t.y>n.height;n.locationPoint3D(c).distSqr(t)<m&&(g||Math.abs(c.lng-n.center.lng)<p)?l=c:n.locationPoint3D(d).distSqr(t)<m&&(g||Math.abs(d.lng-n.center.lng)<p)&&(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}
2972const on={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%)"},to={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class Lu extends s.E{constructor(t,n){super(),(t instanceof HTMLElement||n)&&(t=Object.assign({element:t},n)),s.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:p=1,draggable:m=!1,clickTolerance:g=0,rotation:x=to.rotation,rotationAlignment:w=to.rotationAlignment,pitchAlignment:S=to.pitchAlignment,occludedOpacity:M=to.occludedOpacity,altitude:A=to.altitude}=t||{};this._anchor=c,this._color=d,this._scale=p,this._draggable=m,this._clickTolerance=g,this._rotation=x,this._rotationAlignment=w,this._pitchAlignment=S,this._occludedOpacity=M,this._altitude=A,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=s.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=s.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(R=>{R.preventDefault()})),this._element.addEventListener("mousedown",(R=>{R.preventDefault()}));const C=this._element.classList;for(const R in on)C.remove(`mapboxgl-marker-anchor-${R}`);C.add(`mapboxgl-marker-anchor-${this._anchor}`);const z=t&&t.className?t.className.trim().split(/\s+/):[];C.add(...z),this._popup=null}_createDefaultMarker(){const t=mi("div"),n=Ni("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=Ni("radialGradient",{id:"shadowGradient"},Ni("defs",{},n));Ni("stop",{offset:"10%","stop-opacity":.4},c),Ni("stop",{offset:"100%","stop-opacity":.05},c),Ni("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n)}return Ni("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),Ni("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),Ni("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=s.aT.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||to.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:[
29720,-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 p=d.position.toLngLat();return p.distanceTo(c)<.9*p.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()&&s.f5(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const n=this._offset.mult(this._scale);this._element.style.transform=` 2973 translate(${t.x}px,${t.y}px) 2974 ${on[this._anchor]} 2975 ${this._calculateXYTransform()} ${this._calculateZTransform()} 2976 translate(${n.x}px,${n.y}px) 2977 `}_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=s.cX(s.f6(n.transform,this._lngLat)),p=t.sub(s.f7(n.transform)),m=Math.abs(p.x)+Math.abs(p.y);if(m===0)return"";const g=d/m;return`rotateX(${-p.y*g}deg) rotateY(${p.x*g}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 p=n.project(new s.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=n.project(new s.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(p);c=s.cX(Math.atan2(m.y,m.x))-90}else c=-n.getBearing();else if(d==="horizon"){const p=s.ah(4,6,n.getZoom()),m=s.f7(n.transform);m.y+=p*n.transform.height;const g=t.sub(m),x=s.cX(Math.atan2(g.y,g.x));c=(x>90?x-270:x+90)*(1-p)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const n=this._map;
2977n&&(n.transform.renderWorldCopies&&(this._lngLat=cd(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=s.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const n=this._map;if(!n)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const p=this._clickTolerance||n._clickTolerance;if(t.point.dist(c)<p)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 s.z("dragstart"))),this.fire(new s.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new s.z("dragend")),this._state="inactive"}_addDragHandler(t){const 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||to.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||to.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||to.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||to.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Fm={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},il={maxWidth:100,unit:"metric"},ud={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},io={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},ro=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ta(l=new s.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 s.P(0,l);case"top-left":return new s.P(n,n);case"top-right":return new s.P(-n,n);case"bottom":return new s.P(0,-l);case"bottom-left":return new s.P(n,-n);case"bottom-right":return new s.P(-n,-n);case"left":return new s.P(l,0);case"right":return new s.P(-l,0)}return new s.P(0,0)}return l instanceof s.P||Array.isArray(l)?s.P.convert(l):s.P.convert(l[t]||[0,0])}return{version:Wr,supported:lo.supported,setRTLTextPlugin:s.fb,getRTLTextPluginStatus:s.fa,Map:class extends ld{constructor(l){so.mark($i.create);const t=l;if((l=Object.assign({}
2977,Dm,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&s.f3(window)&&(l.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new fh(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 os,this._domRenderTaskQueue=new os,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.b2(),this._locale=Object.assign({},as,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 ss(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new Eo(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&&s.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,s.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Rm(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||s.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),l.hash&&(this._hash=new Yh(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,Object.assign({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new ec({customAttribution:l.customAttribution}
2977)),this._logoControl=new tc,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()})),this.on("data",(n=>{this._update(n.dataType==="style"),this.fire(new s.z(`${n.dataType}data`,n))})),this.on("dataloading",(n=>{this.fire(new s.z(`${n.dataType}dataloading`,n))})),this._interactions=new vo(this)}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new s.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const 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 s.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new s.z("movestart",l)).fire(new s.z("move",l)),this.fire(new s.z("resize",l)),t&&this.fire(new s.z("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(s.aI.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new s.z("zoomstart")).fire(new s.z("zoom")).fire(new s.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new s.z("zoomstart")).fire(new s.z("zoom")).fire(new s.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new s.z("pitchstart")).fire(new s.z("pitch")).fire(new s.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new s.z("pitchstart")).fire(new s.z("pitch")).fire(new s.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this._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>=s.cL?(l.setMercatorFromTransition(),n=!0):t==="mercator"&&l.zoom<s.cL&&(l.setProjection({name:"globe"}),n=!0),n&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
2977Update(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;const n=this.transform.mercatorFromTransition;t=l.name==="globe"&&this.transform.zoom>=s.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate();const c=this.transform.getProjection().name==="mercator"&&n!==this.transform.mercatorFromTransition;return(t||c)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(s.aT.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(s.P.convert(l),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(l,t,n){const c=d=>{let p=[];if(Array.isArray(t)){const m=t.filter((g=>this.getLayer(g)));p=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else p=this.queryRenderedFeatures(d,{target:t});return p};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:m=>{const g=c(m.point);g.length?d||(d=!0,n.call(this,new Mn(l,this,m.originalEvent,{features:g}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:g=>{c(g.point).length?d=!0:d&&(d=!1,n.call(this,new Mn(l,this,g.originalEvent)))},mouseout:g=>{d&&(d=!1,n.call(this,new Mn(l,this,g.originalEvent)))}}}}{const d=p=>{const m=c(p.point);m.length&&(p.features=m,n.call(this,p),delete p.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 p=0;p<d.length;p++){const m=d[p];if(m.listener===n&&zm(m.targets,t)){for(const g in m.delegates)this.off(g,m.delegates[g]);return d.splice(p,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof s.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const p=this.style.queryRenderedFeatures(l,void 0,this.transform),m=this.style.queryRenderedFeatureset(l,void 0,this.transform);return p.concat(m)}let 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 p of t.layers)if(!this._isValidId(p)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(l,t,this.transform)}let d=[];return c&&(d=d.concat(this.style.queryRenderedFeatures(l,t,this.transform))),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)}queryRasterValue(l,t,n){return this._isValidId(l)?this.style.queryRasterValue(l,t,n):Promise.resolve(null)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&s.w(`${t} projection does not support isPointOnSurface, this API may behave unex
2977pectedly.`),this.transform.isPointOnSurface(s.P.convert(l))}addInteraction(l,t){return this._interactions.add(l,t),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,t){return t=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&l&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(l,((n,c)=>{if(n){const d=typeof n=="string"?n:n instanceof Error?n.message:n.error;s.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}else c&&this._update(!0)}),(()=>this._postStyleLoadEvent())),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const n=Object.assign({},t);t&&t.config&&(n.initialConfig=t.config,delete n.config),this.style=new eo(this,n).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new eo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(s.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new s.y(new Error("IDs can't be empty."))),!1):!s.dr(l)||(this.fire(new s.y(new Error(`IDs can't contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const t of l)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(l)}addSource(l,t){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,t,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:p,content:m}={}){this._lazyInitEmptyStyle();const g=s.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:w,data:S}=s.o.getImageData(t);this.style.addImage(g,{data:new s.q({width:x,height:w},S),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new s.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:x,height:w}=t,S=t;this.style.addImage(g,{data:new s.q({width:x,height:w},new Uint8Array(S.data)),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,usvg:!1,version:0,userImage:S}),S.onAdd&&S.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const n=s.I.from(l),c=this.style.getImage(n);if(!c)return void this.fire(new s.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?s.o.getImageData(t):t,{width:p,height:m,data:g}=d;if(p===void 0||m===void 0)return void this.fire(new s.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(p!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||m!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new s.y(new Error(`The width and height of the updated image (${p}, ${m}) 2978 must be that same as the previous version of the image 2979 (${c.data.width}, ${c.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let w=!1;c.usvg?(c.data=new s.q({width:p,height:m},new Uint8Array(g)),c.usvg=!1,c.icon=void 0,w=!0):c.data.replace(g,x),this.style.updateImage(n,c,w)}hasImage(l){return l?!!this.style&&!!this.style.getImage(s.I.from(l)):(this.fire(new s.y(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(s.I.from(l))}loadImage(l,t){s.n(this._requestManager.transformRequest(l,s.R.Image),((n,c)=>{t(n,c instanceof HTMLImageElement?s.o.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 s.y(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,t){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)):this}getSlot(l){const t=this.getLayer(l);return t&&t.slot||null}setSlot(l,t){return this.style.setSlot(l,t),this.style.mergeLayers(),this._update(!0)}
2979addImport(l,t){return this.style.addImport(l,t).catch((n=>this.fire(new s.y(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}setLayerProperty(l,t,n,c={}){return this._isValidId(l)?(t==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(l,t,n,c),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,t){return this.style.setSchema(l,t),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,t){return this.style.setConfig(l,t),this._update(!0)}getConfigProperty(l,t){return this.style.getConfigProperty(l,t)}setConfigProperty(l,t,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(s.aT.convert(l),this.transform):0}setFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.setFeatureState(l,t),this._update())}removeFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.removeFeatureState(l,t),this._update())}getFeatureState(l){return l.source&&!this._isValidId(l.source)?null:this.style.getFeatureState(l)}_selectIndoorFloor(l){this.indoor.selectFloor(l)}_setIndoorActiveFloorsVisibility(l){this.indoor.setActiveFloorsVisibility(l)}
2979_addIndoorControl(){this._indoorControl||(this._indoorControl=new tl),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,p=this._container;for(;p&&(!c||!d);){const m=window.getComputedStyle(p).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])),p=p.parentElement}this._containerWidth=c?Math.abs(l/c):l,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupIndoor(){this.style.isIndoorEnabled()&&(this.indoor=new hf(this.style),this.on("load",(()=>{this._addIndoorControl(),this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds()),this.on("move",(()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())})),this.on("idle",(()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())}))})))}_setupContainer(){const l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=mi("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=mi("div","mapboxgl-canvas-container",l);this._canvas=mi("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=mi("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach((d=>{c[d]=mi("div",`mapboxgl-ctrl-${d}`,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const n=s.o.devicePixelRatio||1;this._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=Object.assign({},lo.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(un(t,!0),this.painter=new vu(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",(n=>{n.dataType==="source"&&this.painter.setTileLoadedFlag(!0)})),s.k.testSupport(t)):this.fire(new s.y(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.z("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new s.z("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;this.fire(new s.z("renderstart")),++this._frameId;const n=this.painter.context.extTimerQuery,c=s.o.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())&&
2979(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const w=this.transform.zoom,S=this.transform.pitch,M=s.o.now(),A=new s.ac(w,{now:M,fadeDuration:p,pitch:S,transition:this.style.transition,worldview:this._worldview});this.style.update(A)}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 g=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),g&&(this._placementDirty=g.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:p,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new s.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,so.mark($i.load),this.fire(new s.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const w=s.o.now()-c;d.endQuery(n.TIME_ELAPSED_EXT),setTimeout((()=>{const S=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new s.z("gpu-timing-frame",{cpuTime:w,gpuTime:S}))}),50)}if(this.listens("gpu-timing-layer")){const w=this.painter.collectGpuTimers();setTimeout((()=>{const S=this.painter.queryGpuTimers(w);this.fire(new s.z("gpu-timing-layer",{layerTimes:S}))}),50)}if(this.listens("gpu-timing-deferred-render")){const w=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const S=this.painter.queryGpuTimeDeferredRender(w);this.fire(new s.z("gpu-timing-deferred-render",{gpuTime:S}))}),50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(x||this._repaint)this.triggerRepaint();else{const w=this.idle();if(w&&(m=this._updateAverageElevation(c,!0)),m)this.triggerRepaint();else if(this._triggerFrame(!1),w&&(this.fire(new s.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const S=this._calculateSpeedIndex();this.fire(new s.z("speedindexcompleted",{speedIndex:S})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,so.mark($i.fullLoad),this._performanceMetricsCollection&&gr(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(l){for(const t of this._markers)l&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!l||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(l,t=!1){const 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 p=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=l;const m=Math.abs(d-p);if(m>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(p),n(p);this._averageElevation.easeTo(p,l,300)}else if(m>1e-4)return this._averageElevation.jumpTo(p),n(p)}return!!this._averageElevation.isEasing(l)&&n(this._averageElevation.getValue(l))}_authenticate(){vs(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(l=>{if(l&&(l.message===ei||l.status===401)){const t=this.painter.context.gl;un(t,!1),this._logoControl instanceof tc&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),fc(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_postStyleLoadEvent(){this.style.globalId&&pc(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Bi(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){en(this._requestManager._customAccessToken)}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const n=this.painter.context.gl,c=n.createFramebuffer();function d(p){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,p,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 p=0;p<t.length;p++){const m=t[p];let g=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]&&(g+=1);c+=(n[p+2]-n[p+1])*(1-g/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&&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),Dn.delete(this.painter.context.gl),xs.remove(),qr.remove(),this._removed=!0,this.fire(new s.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=s.o.frame((t=>{const n=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,n&&this._render(t)})))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return s.bw(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._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this.style&&l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,l&&this._update())}_setCacheLimits(l,t){s.f4(l,t)}get version(){return Wr}},NavigationControl:class{constructor(l={}){this.options=Object.assign({},Lm,l),this._container=mi("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(s.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(t=>{this._map&&this._map.zoomIn({},{originalEvent:t})})),mi("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})})),mi("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(t=>{const n=this._map;n&&(this.options.visualizePitch?n.resetNorthPitch({},{originalEvent:t}):n.resetNorth({},{originalEvent:t}))})),this._compassIcon=mi("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;
2979const 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 Om(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(l,t){const n=mi("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 s.E{constructor(l={}){super();const t=navigator.geolocation;this.options=Object.assign({geolocation:t},Fm,l),s.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=bu(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=mi("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 s.z("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2979RROR":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 s.z("geolocate",Object.assign({coords:l.coords,timestamp:l.timestamp},l.toJSON?{toJSON:l.toJSON.bind(l)}:{}))),this._finish()}}_updateCamera(l){const t=new s.aT(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,c=this._map.getBearing(),d=Object.assign({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),d,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new s.aT(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,t=s.cf(1,l._center.lat)*l.worldSize,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 s.z("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=mi("button","mapboxgl-ctrl-geolocate",this._container),mi("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2979se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=mi("div","mapboxgl-user-location"),this._dotElement.appendChild(mi("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(mi("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Lu({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=mi("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Lu({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 s.z("trackuserlocationend")))}))}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this.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
2979se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ec,ScaleControl:class{constructor(l={}){this.options=Object.assign({},il,l),s.aY(["_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]),p=t.unproject([c+l,n]),m=d.distanceTo(p);if(this.options.unit==="imperial"){const g=3.2808*m;g>5280?this._setScale(l,g/5280,"mile"):this._setScale(l,g,"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(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let g=p/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:(function(x){const w=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*w)/w})(g),m*g})(t),d=c/t;this._container.innerHTML=n!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:n}).format(c):`${c} ${ud[n]}`,this._container.style.width=l*d+"px"}))}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=mi("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:s.w("Full screen control 'container' must be a DOM element.")),s.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=mi("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=mi("button","mapboxgl-ctrl-fullscreen",this._controlContainer);mi("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:tl,Popup:class extends s.E{constructor(l){super(),this.options=Object.assign(Object.create(io),l),this._altitude=this.options.altitude,s.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new s.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new s.z("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=s.aT.convert(l),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(l){return this._altitude=l,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let c;for(n.innerHTML=l;c=n.firstChild,c;
2979)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=mi("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const n=this._closeButton=mi("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,p=n.offsetHeight,m=c.x<d/2,g=c.x>t.transform.width-d/2;if(c.y+l<p)return m?"top-left":g?"top-right":"top";if(c.y>t.transform.height-p){if(m)return"bottom-left";if(g)return"bottom-right"}return m?"left":g?"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=mi("div","mapboxgl-popup",t.getContainer()),this._tip=mi("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=cd(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof s.P?l:t.project(this._lngLat,this._altitude),p=Ta(this.options.offset),m=this._anchor=this._getAnchor(p.y),g=Ta(this.options.offset,m),x=d.add(g).round();t._requestDomTask((()=>{this._container&&m&&(this._container.style.transform=`${on[m]} translate(${x.x}px,${x.y}px)`)}))}if(!this._marker&&t._showingGlobe()){const d=s.f5(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(ro);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:Lu,Style:eo,LngLat:s.aT,LngLatBounds:s.aI,Point:s.P,MercatorCoordinate:s.ae,FreeCameraOptions:gn,Evented:s.E,config:s.e,prewarm:s.f9,clearPrewarmedResources:s.f8,get accessToken(){return s.e.ACCESS_TOKEN},set accessToken(l){s.e.ACCESS_TOKEN=l},get baseApiUrl(){return s.e.API_URL},set baseApiUrl(l){s.e.API_URL=l},get workerCount(){return s.fi.workerCount},set workerCount(l){s.fi.workerCount=l},get maxParallelImageRequests(){return s.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){s.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){s.fh(l)},get workerUrl(){return s.fg.workerUrl},set workerUrl(l){s.fg.workerUrl=l},get workerClass(){return s.fg.workerClass},set workerClass(l){s.fg.workerClass=l},get workerParams(){return s.fg.workerParams},set workerParams(l){s.fg.workerParams=l},get dracoUrl(){return s.ff()},set dracoUrl(l){s.fe(l)},get meshoptUrl(){return s.fd()},set meshoptUrl(l){s.fc(l)},setNow:s.o.setNow,restoreNow:s.o.restoreNow}}));var im=fl;return im}))})(Qp)),Qp.exports}var ng=nT(),oT=em('<div class="sidebar svelte-av1g0r"> </div>'),sT=em('<div class="svelte-av1g0r"> </div>'),aT=em('<div class="error-log svelte-av1g0r"></div>'),lT=em('<div><div class="map svelte-av1g0r"></div> <!> <!></div>');function uT(tm,Go){$w(Go,!0);let $s=Ma(Go,"marker",19,()=>[]),Zs=Ma(Go,"lng",7,10.8972),fl=Ma(Go,"lat",7,48.3727),pl=Ma(Go,"zoom",7,
297911.7),im=Ma(Go,"layers",19,()=>[]),s=Ma(Go,"sources",19,()=>[]),Wr=Ma(Go,"icons",19,()=>({})),$i=Ma(Go,"iconAnchor",3,"bottom"),so=Ma(Go,"ratio",3,"");function Ca(ki){if(!ki)return null;const Sr=ki.toString().includes(":")?":":"/",dr=ki.toString().split(Sr).map(Number);return dr.length===2&&dr[0]>0&&dr[1]>0?(dr[1]/dr[0]*100).toFixed(4)+"%":null}let ao=eT(()=>Ca(so())),rr,lo,mi=Zw([]);function Ni(ki,Sr){const dr=Sr?`${ki}: ${Sr.message||Sr}`:ki;mi.push(dr),console.error(dr,Sr)}function Xr(ki,Sr){const dr=Sr?`${ki}: ${Sr.message||Sr}`:ki;mi.push(dr),console.warn(dr,Sr)}function Gi(){if(rr)try{pl(rr.getZoom()),Zs(rr.getCenter().lng),fl(rr.getCenter().lat)}catch(ki){Xr("Mapbox updateData error",ki)}}Ww(()=>{try{const ki={lng:Zs()??10.8972,lat:fl()??48.3727,zoom:pl()??11.7};rr=new ng.Map({container:lo,accessToken:"pk.eyJ1IjoianBmdWhyIiwiYSI6ImNtM2RqNXN5ZzAzZjUybHF5Ym8za2lnMmcifQ.1cC8gnpkzJ04iMjQ9jegzA",style:"mapbox://styles/mapbox/outdoors-v11",center:[ki.lng,ki.lat],zoom:ki.zoom});const Sr=new ng.NavigationControl({showCompass:!1});rr.addControl(Sr,"bottom-right"),rr.on("load",()=>{try{let ei=function(Vt){return typeof Vt=="string"?{url:Vt,width:48,height:60}:{url:Vt.url||Vt.src||"",width:Vt.width||48,height:Vt.height||60}};const Bn={...Wr()||{},staugpin:"/svg/staugpin.svg"};async function Eo(Vt){if(typeof Vt=="string"&&Vt.trim().startsWith("<svg")){const gi=new Blob([Vt],{type:"image/svg+xml"});return URL.createObjectURL(gi)}try{const gi=await fetch(Vt+"?t="+Date.now());if(!gi.ok)throw new Error(`HTTP ${gi.status}`);const Or=await gi.text(),cn=new Blob([Or],{type:"image/svg+xml"});return URL.createObjectURL(cn)}catch(gi){return Xr(`Fehler beim Laden von ${Vt}`,gi),Vt}}const Ir=new Set,nr=Object.entries(Bn).map(([Vt,gi])=>{const{url:Or,width:cn,height:Rn}=ei(gi);return new Promise(async zn=>{const Zi=await Eo(Or),qr=new Image(cn,Rn);qr.onload=()=>{qr.naturalWidth===0||qr.naturalHeight===0?Xr(`Mapbox-Icon "${Vt}" hat keine gültige GröÃe`,Or):(rr.addImage(Vt,qr),Ir.add(Vt)),zn(Vt)},qr.onerror=()=>{Xr(`Mapbox-Icon "${Vt}" konnte nicht geladen werden`,Or),zn(Vt)},qr.src=Zi})});Promise.all(nr).then(()=>{try{if(t0.forEach(s(),Vt=>{const{name:gi,...Or}=Vt;rr.addSource(gi,Or)}),t0.forEach(im(),Vt=>{rr.addLayer(Vt)}),$s()&&$s().length){const Vt={type:"FeatureCollection",features:$s().map(gi=>({type:"Feature",geometry:{type:"Point",coordinates:gi.lnglat},properties:{popup:gi.popup,icon:gi.icon&&Ir.has(gi.icon)?gi.icon:"staugpin"}}))};rr.addSource("markerSource",{type:"geojson",data:Vt}),rr.addLayer({id:"markerLayer",type:"symbol",source:"markerSource",layout:{"icon-image":["get","icon"],"icon-size":1,"icon-allow-overlap":!0,"icon-anchor":$i()}}),rr.on("click","markerLayer",gi=>{try{const Or=gi.features[0].geometry.coordinates.slice(),cn=gi.features[0].properties.popup,Rn=$i()==="center"?[0,-30]:[0,-45];new ng.Popup({closeButton:!1,offset:Rn}).setLngLat(Or).setText(cn).addTo(rr)}catch(Or){Xr("Mapbox popup error",Or)}}),rr.on("mouseenter","markerLayer",()=>{rr.getCanvas().style.cursor="pointer"}),rr.on("mouseleave","markerLayer",()=>{rr.getCanvas().style.cursor=""})}}catch(Vt){Ni("Mapbox layer setup error",Vt)}}).catch(Vt=>{Ni("Mapbox icon loading error",Vt)})}catch(dr){Ni("Mapbox onLoad error",dr)}}),rr.on("move",()=>{try{Gi()}catch(dr){Xr("Mapbox move error",dr)}}),rr.on("contextmenu",dr=>{if(i0.eingeloggt){const Bn=`${dr.lngLat.lng.toFixed(6)}, ${dr.lngLat.lat.toFixed(6)}`;navigator.clipboard.writeText(Bn).catch(ei=>{console.warn("Konnte Koordinaten nicht kopieren:",ei)})}})}catch(ki){Ni("Mapbox initialization error",ki)}}),Xw(()=>{try{rr?.remove()}catch(ki){Xr("Mapbox cleanup error",ki)}});var Qr=lT(),Hr=rg(Qr);Yw(Hr,ki=>lo=ki,()=>lo);var Wn=r0(Hr,2);{var wn=ki=>{var Sr=oT(),dr=rg(Sr);ig((Bn,ei,Eo)=>o0(dr,`[${Bn??""}, ${ei??""}] 2980 ${Eo??""}`),[()=>Zs()?.toFixed?.(4)??"-",()=>fl()?.toFixed?.(4)??"-",()=>pl()?.toFixed?.(2)??"-"]),Jp(ki,Sr)};n0(Wn,ki=>{i0.eingeloggt&&ki(wn)})}var kn=r0(Wn,2);{var So=ki=>{var Sr=aT();tT(Sr,21,()=>mi,iT,(dr,Bn)=>{var ei=sT(),Eo=rg(ei);ig(()=>o0(Eo,Kp(Bn))),Jp(dr,ei)}),Jp(ki,Sr)};n0(kn,ki=>{mi.length&&ki(So)})}ig(()=>{Kw(Qr,1,`map-wrap ${Kp(ao)?"has-ratio":""}`,"svelte-av1g0r"),Jw(Qr,Kp(ao)?`padding-bottom: ${Kp(ao)};`:"")}),Jp(tm,Qr),Qw()}export{uT as default};
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.